Package net.rim.device.api.io.nfc.readerwriter

Examples of net.rim.device.api.io.nfc.readerwriter.ISO14443Part4Connection


            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);

View Full Code Here


     * @param target
     *            The detected ISO 14443 4 tag
     */
    public void readISO14443Target(final String uri, final Target target) {
        _screen.addTargetInfo("URI: " + uri);
        ISO14443Part4Connection c = null;

        // Try to open a connection to the tag and send it a command
        try {
            c = (ISO14443Part4Connection) Connector.open(uri);

            // Get some metadata about the tag to determine what type
            // of tag it is and what command set to use on it.
            _screen.addTargetInfo("Name: " + target.getProperty("Name"));

            // Note: not a real command. Command bytes need
            // to be determined based on type of tag detected.

            // Note: For the sake of this demo, we are hardcoding the request
            // that we will send the tag as the "Capability Container Select"
            // command.

            // Capability Container select command
            final byte[] response =
                    c.transceive(new byte[] { (byte) 0x00, (byte) 0xA4,
                            (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0xE1,
                            (byte) 0x03 });

            parseISO14443Response(response);

View Full Code Here

TOP

Related Classes of net.rim.device.api.io.nfc.readerwriter.ISO14443Part4Connection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.