public class PassThruApduProcessor extends Object
Example Usage: public class MainActivity extends Activity implements EMDKListener { SecureNfcManager secureNfcManager; EMDKManager emdkManager; PassThruApduProcessor passThruApduProcessor; protected void onCreate(Bundle savedInstanceState) { EMDKResults results = EMDKManager.getEMDKManager( getApplicationContext(), this); } public void onOpened(EMDKManager emdkManager) { this.emdkManager = emdkManager; this.secureNfcManager = (secureNfcManager) this.emdkManager .getInstance(FEATURE_TYPE.SECURENFC); if (this.secureNfcManager != null) { if(secureNfcMgr!= null){ passThruApduProcessor = secureNfcMgr.getPassThruApduInstance(); try { passThruApduProcessor.enable(ProtocolType.T1); passThruApduProcessor.disable(); }catch (PassThruApduException e) { e.printStackTrace(); } } } } public void onDestroy() { if (this.emdkManager != null) this.emdkManager.release(); } public void onClosed() { this.emdkManager.release(); } }
Modifier and Type | Class and Description |
---|---|
static class |
PassThruApduProcessor.ProtocolType
Communication protocol between a SAM and tag.
|
static class |
PassThruApduProcessor.VersionType
The enum to get the Smart Card stack and connected Smart Card versions.
|
Modifier and Type | Method and Description |
---|---|
void |
disable()
Closes already established connection between host device and SAM.
|
void |
enable(PassThruApduProcessor.ProtocolType protocolType)
Enables connection between host device and Secure Access Module (SAM).
|
String |
getVersion(PassThruApduProcessor.VersionType versionType)
Retrieves version of smart card stack or connected smart card.
|
byte[] |
process(byte[] cmdApdu,
short expectedRespLength,
boolean userFormattedProtocolFrame)
Sends the Command APDU (C-APDU) (Application Protocol Data Unit) and
receives Response APDU (R-APDU) from connected contactless smart cards.
|
public void enable(PassThruApduProcessor.ProtocolType protocolType) throws PassThruApduException
protocolType
- Protocol to be used for communication between card reader
(SAM) and contactless cards. This parameter is added for future use only.PassThruApduException
- The exception will be thrown if it fails to enable the
smartcard.public void disable() throws PassThruApduException
PassThruApduException
- The exception will be thrown if it fails to disable the
smartcard.public String getVersion(PassThruApduProcessor.VersionType versionType) throws PassThruApduException
versionType
- PassThruApduException
- The exception will be thrown if it fails to retrieve version
of smart card stack or connected smart card.public byte[] process(byte[] cmdApdu, short expectedRespLength, boolean userFormattedProtocolFrame) throws PassThruApduException
cmdApdu
- Command APDU (C-APDU) to be processed by smart cardexpectedRespLength
- Length of expected response. Pass this parameter as 0, when
expected response length is unknown while calling this API.userFormattedProtocolFrame
- This parameter applicable for only T1 protocol. Typically user
will provide this parameter as false. true: User provides
frame header, Command APDU (C-APDU) and trailer. false: User
provides only Command APDU (C-APDU). Typically user will
provide this parameter as false.PassThruApduException
- The exception will be thrown if it fails to process the given
APDU.