Utilities.log("XXXX onTargetDetected attempting to communicate with ISO_14443_4 target");
_screen.logEvent("info:Attempting to communicate with ISO_14443_4 target");
String targetURI = target.getUri(Target.ISO_14443_4);
ISO14443Part4Connection targetISO14443Part4Connection = null;
byte[] tranceiveResponse = null;
try {
/*
* Now that we have an ISO_14443_4 target in the RF field we will send our simple
* proprietary C-APDU to request the contents of the screen on the other device
*
* The basic protocol sequence that is of importance is as follows:
*
* Device acting as card reader/writer
*
* Sends C-APDU -> A0 37 00 01 99 00
*
* Receives R-APDU <- 53 65 6e 64 20 74 6f 20 6f 74 68 65 72 20 64 65 76 69 63 65 90 00
* Text from screen == S e n d t o o t h e r d e v i c e
*
*/
String record = "Sending command\n" + "Command Len: " + CommonADPUs.simpleISO14443Capdu.length + "\nPayload: \n"
+ Utilities.formatAsHexPairs(Constants.DISPLAY_COLUMN_WIDTH, CommonADPUs.simpleISO14443Capdu);
Utilities.log("XXXX onTargetDetected: " + record);
String eventlog_msg="send:"+Utilities.formatAsHexPairs(Constants.DISPLAY_COLUMN_WIDTH, CommonADPUs.simpleISO14443Capdu);
_screen.logEvent(eventlog_msg);
targetISO14443Part4Connection = (ISO14443Part4Connection) Connector.open(targetURI);
tranceiveResponse = targetISO14443Part4Connection.transceive(CommonADPUs.simpleISO14443Capdu);
record = "Received:\n" + " Len: " + tranceiveResponse.length + "\nPayload: \n"
+ Utilities.formatAsHexPairs(Constants.DISPLAY_COLUMN_WIDTH, tranceiveResponse);
eventlog_msg = "rcvd:"+Utilities.formatAsHexPairs(Constants.DISPLAY_COLUMN_WIDTH, tranceiveResponse);