Search in sources :

Example 1 with SmartPosterRecord

use of net.rim.device.api.io.nfc.ndef.rtd.SmartPosterRecord in project Samples-for-Java by blackberry.

the class NfcReadNdefSmartTagUpdate method run.

/*
     * (non-Javadoc)
     * 
     * @see java.lang.Runnable#run()
     * 
     * This is the runnable unit of work that was scheduled from the NDEF Message handler
     */
public void run() {
    NDEFRecord[] records = _message.getRecords();
    try {
        Utilities.log("XXXX using helper classes to parse NDEF message");
        SmartPosterRecord sp = new SmartPosterRecord(records[0]);
        String uri = sp.getUri();
        String id = sp.getId();
        String mime = sp.getMimeType();
        int size = sp.getSize();
        String type = sp.getType();
        byte[] payload = sp.getPayload();
        //            _screen.logEvent("id="+id);
        _screen.logEvent("type=" + type);
        _screen.logEvent("URI=" + uri);
        //            _screen.logEvent("MIME="+mime);
        //            _screen.logEvent("size="+size);
        _screen.logEvent("Payload size=" + payload.length);
    } catch (NFCException e) {
        Utilities.log("XXXX NFCException using helper classes to parse NDEF message:" + e.getMessage());
    }
}
Also used : NDEFRecord(net.rim.device.api.io.nfc.ndef.NDEFRecord) NFCException(net.rim.device.api.io.nfc.NFCException) SmartPosterRecord(net.rim.device.api.io.nfc.ndef.rtd.SmartPosterRecord)

Aggregations

NFCException (net.rim.device.api.io.nfc.NFCException)1 NDEFRecord (net.rim.device.api.io.nfc.ndef.NDEFRecord)1 SmartPosterRecord (net.rim.device.api.io.nfc.ndef.rtd.SmartPosterRecord)1