<cards>
  <card name="ProcessorCard" >

    <commands>
    	<!-- Select DF by 16-bit-id -->
      <command name="SelectDFS" driver="generic_pcsc">
        <send>
	  			<APDU lr="255" >
  	    		<ELEM type="dword">0x00a40000</ELEM>
	  			</APDU>
	  			<DATA>
	    			<ELEM name="fileId" type="word" />
	  			</DATA>
				</send>
				<results>
      		<result sw1="0x6a" sw2="0x82" type="error">File not found</result>
				</results>
				<responses>
	  			<response type="success">
	    	 		<ELEM name="fileInfo" type="tlv" tlvtype="simple" minnum="0">
              <tlv id="0x6f">
                <ELEM name="fci" type="tlv" tlvtype="simple" 
                      maxnum="0">
                  <tlv id="0x81">
                    <ELEM name="space" type="word" />
                  </tlv>
                  <tlv id="0x82">
                    <ELEM name="fileDescr" type="bytes" />
                  </tlv>
                  <tlv id="0x83">
                    <ELEM name="shortFileId" type="word" />
                  </tlv>
                  <tlv id="0x84">
                    <ELEM name="fileName" type="bytes" />
                  </tlv>
                  <tlv id="0x85">
                    <ELEM name="sfi" type="byte" />
                    <ELEM name="filePath" type="bytes" />
                  </tlv>
                  <tlv id="0x86" name="AC" >
                    <ELEM name="AC_admin" type="word" />
                    <GROUP name="AC_cmd" minnum="0" maxnum="0" >
                      <ELEM name="cla" type="byte" />
                      <ELEM name="ins" type="byte" />
                      <ELEM name="ac" type="word" />
                    </GROUP>
                  </tlv>
                  <tlv id="0xa5">
                    <ELEM name="accessControl" type="tlv" tlvtype="simple"
                          maxnum="0">
                      <tlv id="0x86" name="AC" >
                        <ELEM name="sfi" type="byte" />
                        <ELEM name="AC_admin" type="word" />
                        <ELEM name="moreACs" type="bytes" minnum="0" />
                      </tlv>
                    </ELEM>
                  </tlv>
                </ELEM>
              </tlv>
            </ELEM>
	  			</response>
				</responses>
    	</command>

    	<!-- Select DF by application-id -->
      <command name="SelectDFL" driver="generic_pcsc">
        <send>
	  			<APDU lr="255" >
  	    		<ELEM type="dword">0x00a40400</ELEM>
	  			</APDU>
	  			<DATA>
	    			<ELEM name="fileId" type="bytes" />
	  			</DATA>
				</send>
				<results>
      		<result sw1="0x6a" sw2="0x82" type="error">File not found</result>
				</results>
				<responses>
	  			<response type="success">
	    	 		<ELEM name="fileInfo" type="tlv" tlvtype="simple" minnum="0">
              <tlv id="0x6f">
                <ELEM name="fci" type="tlv" tlvtype="simple" 
                      maxnum="0">
                  <tlv id="0x81">
                    <ELEM name="space" type="word" />
                  </tlv>
                  <tlv id="0x82">
                    <ELEM name="fileDescr" type="bytes" />
                  </tlv>
                  <tlv id="0x83">
                    <ELEM name="shortFileId" type="word" />
                  </tlv>
                  <tlv id="0x84">
                    <ELEM name="fileName" type="bytes" />
                  </tlv>
                  <tlv id="0x85">
                    <ELEM name="sfi" type="byte" />
                    <ELEM name="filePath" type="bytes" />
                  </tlv>
                  <tlv id="0x86" name="accessControl" >
                    <ELEM name="AC_admin" type="word" />
                    <GROUP name="AC_cmd" minnum="0" maxnum="0" >
                      <ELEM name="cla" type="byte" />
                      <ELEM name="ins" type="byte" />
                      <ELEM name="ac" type="word" />
                    </GROUP>
                  </tlv>
                  <tlv id="0xa5">
                    <ELEM name="accessControl" type="tlv" tlvtype="simple"
                          maxnum="0">
                      <tlv id="0x86" name="AC" >
                        <ELEM name="sfi" type="byte" />
                        <ELEM name="AC_admin" type="word" />
                        <ELEM name="moreACs" type="bytes" minnum="0" />
                      </tlv>
                    </ELEM>
                  </tlv>
                </ELEM>
              </tlv>
            </ELEM>
	  			</response>
				</responses>
    	</command>

      <!-- Select EF by id -->
      <command name="SelectEFS" driver="generic_pcsc">
        <send>
	  			<APDU lr="255" >
  	    		<ELEM type="dword">0x00a40200</ELEM>
	  			</APDU>
	  			<DATA>
	    			<ELEM name="fileId" type="word" />
	  			</DATA>
				</send>
				<results>
      		<result sw1="0x6a" sw2="0x82" type="error">File not found</result>
				</results>
				<responses>
	  			<response type="success">
	    	 		<ELEM name="fileInfo" type="tlv" tlvtype="simple" minnum="0">
              <tlv id="0x6f">
                <ELEM name="fci" type="tlv" tlvtype="simple" 
                      maxnum="0">
                  <tlv id="0x81">
                    <ELEM name="space" type="word" />
                  </tlv>
                  <tlv id="0x82">
                    <ELEM name="fileDescr" type="bytes" />
                  </tlv>
                  <tlv id="0x83">
                    <ELEM name="shortFileId" type="word" />
                  </tlv>
                  <tlv id="0x84">
                    <ELEM name="fileName" type="bytes" />
                  </tlv>
                  <tlv id="0x86" name="accesControl" >
                    <ELEM name="AC_admin" type="word" />
                    <ELEM name="AC_readRecord" type="word" />
                    <ELEM name="AC_writeRecord" type="word" />
                    <ELEM name="moreACs" type="bytes" minnum="0" />
                  </tlv>
                </ELEM>
              </tlv>
            </ELEM>
	  			</response>
				</responses>
    	</command>

      <!-- Select Master File -->
      <command name="SelectMF" driver="generic_pcsc">
      	<send>
	  			<APDU >
  	    		<ELEM type="dword">0x00a4000c</ELEM>
	  			</APDU>
				</send>
				<results>
      		<result sw1="0x6a" sw2="0x82" type="error">File not found</result>
				</results>
				<responses>
	  			<response type="success">
	    	 		<ELEM name="fileInfo" type="tlv" tlvtype="simple" minnum="0">
              <tlv id="0x6f">
                <ELEM name="fci" type="tlv" tlvtype="simple"
                      maxnum="0">
                  <tlv id="0x81">
                    <ELEM name="space" type="word" />
                  </tlv>
                  <tlv id="0x82">
                    <ELEM name="fileDescr" type="bytes" />
                  </tlv>
                  <tlv id="0x83">
                    <ELEM name="shortFileId" type="word" />
                  </tlv>
                  <tlv id="0x84">
                    <ELEM name="fileName" type="bytes" />
                  </tlv>
                  <tlv id="0x85">
                    <ELEM name="sfi" type="byte" />
                    <ELEM name="filePath" type="bytes" />
                  </tlv>
                  <tlv id="0x86" name="AC" >
                    <ELEM name="AC_admin" type="word" />
                    <GROUP name="AC_cmd" minnum="0" maxnum="0" >
                      <ELEM name="cla" type="byte" />
                      <ELEM name="ins" type="byte" />
                      <ELEM name="ac" type="word" />
                    </GROUP>
                  </tlv>
                  <tlv id="0xa5">
                    <ELEM name="accessControl" type="tlv" tlvtype="simple"
                          maxnum="0">
                      <tlv id="0x86" name="AC" >
                        <ELEM name="sfi" type="byte" />
                        <ELEM name="AC_admin" type="word" />
                        <ELEM name="moreACs" type="bytes" minnum="0" />
                      </tlv>
                    </ELEM>
                  </tlv>
                </ELEM>
              </tlv>
            </ELEM>
	  			</response>
				</responses>
    	</command>

      <!-- Read Record -->
      <command name="ReadRecord" driver="generic_pcsc">
      	<send>
	  			<APDU lr="255" >
  	    		<ELEM type="word">0x00b2</ELEM>
            <ELEM name="recNum" type="byte" />
            <ELEM type="byte">0x04</ELEM>
	  			</APDU>
				</send>
       <results>
         <result sw1="0x61" type="success" >
           Command executed, correct size in SW2
         </result>
         <result sw1="0x69" sw2="0x86" type="error" >
           No EF selected (internal error)
         </result>
         <result sw1="0x6a" sw2="0x83" type="error" >
           Record not found
         </result>
       </results>
    	</command>

      <!-- Update Record -->
      <command name="WriteRecord" driver="generic_pcsc">
      	<send>
	  			<APDU>
  	    		<ELEM type="word">0x00dc</ELEM>
            <ELEM name="recNum" type="byte" />
            <ELEM type="byte">0x04</ELEM>
	  			</APDU>
          <DATA>
            <ELEM name="data" type="bytes" />
          </DATA>
				</send>
       <results>
         <result sw1="0x61" type="success" >
           Command executed, correct size in SW2
         </result>
         <result sw1="0x69" sw2="0x86" type="error" >
           No EF selected (internal error)
         </result>
         <result sw1="0x6a" sw2="0x83" type="error" >
           Record not found
         </result>
       </results>
    	</command>

    </commands>


    
    <!-- generic command responses -->
    <results>
      <!-- success -->
      <result sw1="0x90" type="success">
        Command successfully executed
      </result>
      <result sw1="0x61" type="success">
        Command executed, correct size in SW2
      </result>
      <result sw1="0x63" type="success" >
        Success after internal retries (see SW2 for number of retries)
      </result>

      <!-- errors -->
      <result sw1="0x64" sw2="0x00" type="error" >
        No precise diagnosis (no change on card)
      </result>
      <result sw1="0x65" sw2="0x81" type="error" >
        Memory failure (error while reading)
      </result>
      <result sw1="0x67" sw2="0x00" type="error" >
        Wrong APDU length (internal error)
      </result>
      <result sw1="0x67" sw2="0x81" type="error" >
        Response too long (internal error)
      </result>
      <result sw1="0x69" sw2="0x86" type="error" >
        Command not allowed (internal error)
      </result>
      <result sw1="0x6a" sw2="0x86" type="error" >
        Incorrect parameters in p1-p2 (internal error)
      </result>
      <result sw1="0x6d" sw2="0x00" type="error" >
        Wrong instruction code (internal error)
      </result>
      <result sw1="0x6e" sw2="0x00" type="error" >
        CLA not supported (internal error)
      </result>

      <result type="error">Unhandled error</result>
    </results>

  </card>
</cards>

