Examples of NDEFTagConnection


Examples of net.rim.device.api.io.nfc.ndef.NDEFTagConnection

    }

    private void writeUriTag(String target_uri) {

        Utilities.log("XXXX Writing URI tag");
        NDEFTagConnection tagConnection = null;
        String uri = (String) _tag_attrs.get(Constants.TAG_ATTRIBUTE_URI);

        try {
            NDEFMessage uriNdefMessage = NDEFMessageUtils.createUriNDEFMessage(uri);
            tagConnection = (NDEFTagConnection) Connector.open(target_uri);
            tagConnection.write(uriNdefMessage);
            Utilities.log("XXXX NfcWriteNdefSmartTagListener URI Tag written successfully");
            _screen.logEvent("Custom Tag written successfully");
        } catch(Exception e) {
            _screen.logEvent(e.getClass().getName() + ":" + e.getMessage());
            Utilities.log("XXXX " + e.getClass().getName() + ":" + e.getMessage());
View Full Code Here

Examples of net.rim.device.api.io.nfc.ndef.NDEFTagConnection

    }

    private void writeTextTag(String target_uri) {

        Utilities.log("XXXX Writing Text tag");
        NDEFTagConnection tagConnection = null;
        String text = (String) _tag_attrs.get(Constants.TAG_ATTRIBUTE_TEXT);

        try {
            NDEFMessage externalNdefMessage = NDEFMessageUtils.createTextNDEFMessage(text, URL_TEXT_LOCALE);
            tagConnection = (NDEFTagConnection) Connector.open(target_uri);
            tagConnection.write(externalNdefMessage);
            Utilities.log("XXXX NfcWriteNdefSmartTagListener Text Tag written successfully");
            _screen.logEvent("Custom Tag written successfully");
        } catch(Exception e) {
            _screen.logEvent(e.getClass().getName() + ":" + e.getMessage());
            Utilities.log("XXXX " + e.getClass().getName() + ":" + e.getMessage());
View Full Code Here

Examples of net.rim.device.api.io.nfc.ndef.NDEFTagConnection

    }

    private void writeCustomTag(String target_uri) {

        Utilities.log("XXXX Writing Custom tag");
        NDEFTagConnection tagConnection = null;
        String content = (String) _tag_attrs.get(Constants.TAG_ATTRIBUTE_CONTENT);
        String domain = (String) _tag_attrs.get(Constants.TAG_ATTRIBUTE_DOMAIN);
        String type = (String) _tag_attrs.get(Constants.TAG_ATTRIBUTE_TYPE);

        Utilities.log("XXXX domain:" + domain);
        Utilities.log("XXXX type:" + type);
        Utilities.log("XXXX content:" + content);

        try {
            NDEFMessage externalNdefMessage = NDEFMessageUtils.createExternalTypeMessage(domain, type,
                    content.getBytes("US-ASCII"));
            tagConnection = (NDEFTagConnection) Connector.open(target_uri);
            tagConnection.write(externalNdefMessage);
            Utilities.log("XXXX NfcWriteNdefSmartTagListener Custom Tag written successfully");
            _screen.logEvent("Custom Tag written successfully");
        } catch(Exception e) {
            _screen.logEvent(e.getClass().getName() + ":" + e.getMessage());
            Utilities.log("XXXX " + e.getClass().getName() + ":" + e.getMessage());
View Full Code Here

Examples of net.rim.device.api.io.nfc.ndef.NDEFTagConnection

    }

    private void writeSpTag(String target_uri) {
        Utilities.log("XXXX Writing SP tag");
        NDEFTagConnection tagConnection = null;
        String willWriteMsg = "Writing Smart Poster Tag " + _screen.getTagDetails() + ",Language: " + URL_TEXT_LOCALE;

        _screen.logEvent(willWriteMsg);

        try {
            NDEFMessage smartPosterTag = createSmartPosterTag();
            tagConnection = (NDEFTagConnection) Connector.open(target_uri);
            tagConnection.write(smartPosterTag);
            Utilities.log("XXXX NfcWriteNdefSmartTagListener SP Tag written successfully");
            _screen.logEvent("SP tag written successfully");
        } catch(NFCException e) {
            e.printStackTrace();
            Utilities.log("XXXX NfcWriteNdefSmartTagListener NFCException");
View Full Code Here

Examples of net.rim.device.api.io.nfc.ndef.NDEFTagConnection

     * @param uri
     *            Detected NDEF target's URI
     */
    public void readNDEF(final String uri) {
        _screen.addTargetInfo("URI: " + uri);
        NDEFTagConnection c = null;
        String payload;
        final StringBuffer sb = new StringBuffer();

        // Try to open a connection to the NDEF tag and read its content
        try {
            c = (NDEFTagConnection) Connector.open(uri);
            final NDEFMessage ndefMessage = c.read();
            final NDEFRecord[] ndefRecords = ndefMessage.getRecords();

            // Go through all the NDEFRecords in the NDEFMessage
            for (int i = 0; i < ndefMessage.getNumberOfRecords(); i++) {
                final String type = ndefRecords[i].getType();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.