Warning Older Docs! - You are viewing documentation for a previous released version of RhoMobile Suite.

Tag

NFC Tag

This class representative NFC Tag object

In order to use this API you must include the following extension in your build.yml

extensions: ["nfc"]

If you are building a Windows Mobile or Windows CE app with this API, you must set your app_type as “rhoelements” in your build.yml as shown here.

Methods

close()

release resources, close connection

Synchronous Return:

  • Void

Method Access:

  • Instance Method: This method can be accessed via an instance object of this class:
    • myObject.close()

exchangeData(STRING sendData)

This function exchanges raw data with Tag. Tag shouldn’t be NDEF formated. Only Milfare and Ti tags are supported. When sendData is empty then method reads data from Tag and write into receiveData parameter.

Parameters

  • sendData : STRING

Synchronous Return:

  • HASH
    • receiveData : STRING

      NFC_SUCCESS if OK

Method Access:

  • Instance Method: This method can be accessed via an instance object of this class:
    • myObject.exchangeData(STRING sendData)

formatNDEF()

format Tag to NDEF type

Synchronous Return:

  • Void

Method Access:

  • Instance Method: This method can be accessed via an instance object of this class:
    • myObject.formatNDEF()

getTagById(STRING id)

This function returns Tag object

Parameters

  • id : STRING

Synchronous Return:

  • SELF_INSTANCE

Method Access:

  • Class Method: This method can only be accessed via the API class object.
    • JavaScript: Rho.Tag.getTagById(STRING id)
    • Ruby: Rho::Tag.getTagById(STRING id)

makeReadOnly()

make Tag read only

Synchronous Return:

  • Void

Method Access:

  • Instance Method: This method can be accessed via an instance object of this class:
    • myObject.makeReadOnly()

writeMessage(ARRAY messages)

write messages on Tag. On the current moment only 1 message is supported.

Parameters

  • messages : ARRAY

    • Object : STRING

      id of Rho.NFC.Message object

Synchronous Return:

  • Void

Method Access:

  • Instance Method: This method can be accessed via an instance object of this class:
    • myObject.writeMessage(ARRAY messages)

Properties

ID : STRING Read Only

object ID

Property Access:

  • Instance: This property can be accessed via an instance object of this class:
    • myObject.ID

freeSize : INTEGER Read Only

free size in bytes

Property Access:

  • Instance: This property can be accessed via an instance object of this class:
    • myObject.freeSize

isConnected : BOOLEAN Read Only

connected or not(if connections between tag and nfc device exists)

Property Access:

  • Instance: This property can be accessed via an instance object of this class:
    • myObject.isConnected

isNdef : BOOLEAN Read Only

ndef or not

Property Access:

  • Instance: This property can be accessed via an instance object of this class:
    • myObject.isNdef

isReadOnly : BOOLEAN Read Only

Indicating if the tag is locked for write operation.

Property Access:

  • Instance: This property can be accessed via an instance object of this class:
    • myObject.isReadOnly

serialNumber : STRING Read Only

The serial number of a tag.

Property Access:

  • Instance: This property can be accessed via an instance object of this class:
    • myObject.serialNumber

size : INTEGER Read Only

size in bytes

Property Access:

  • Instance: This property can be accessed via an instance object of this class:
    • myObject.size

type : STRING Read Only

Tag type

Possible Values (false):

Constant: Rho.Tag.TAG_TYPE_TOPAZ (For Ruby use "::" instead of ".")
String: 1
Constant: Rho.Tag.TAG_TYPE_FELICA (For Ruby use "::" instead of ".")
String: 2
Constant: Rho.Tag.TAG_TYPE_MIFARE_CLASSIC (For Ruby use "::" instead of ".")
String: 3
Constant: Rho.Tag.TAG_TYPE_MIFARE_UL (For Ruby use "::" instead of ".")
String: 4
Constant: Rho.Tag.TAG_TYPE_MIFARE_DESFIRE (For Ruby use "::" instead of ".")
String: 6
Constant: Rho.Tag.TAG_TYPE_ISO15693 (For Ruby use "::" instead of ".")
String: 7
Constant: Rho.Tag.TAG_TYPE_B (For Ruby use "::" instead of ".")
String: 8
Constant: Rho.Tag.TAG_TYPE_MIFARE (For Ruby use "::" instead of ".")
String: 9
Constant: Rho.Tag.TAG_TYPE_NXP_I_CODE (For Ruby use "::" instead of ".")
String: 10
Constant: Rho.Tag.TAG_TYPE_MIFARE_PLUS (For Ruby use "::" instead of ".")
String: 11
Constant: Rho.Tag.TAG_TYPE_MIFARE_ULC (For Ruby use "::" instead of ".")
String: 12
Constant: Rho.Tag.TAG_TYPE_MIFARE_PLUS_S2K (For Ruby use "::" instead of ".")
String: 13
Constant: Rho.Tag.TAG_TYPE_MIFARE_PLUS_X2K (For Ruby use "::" instead of ".")
String: 14
Constant: Rho.Tag.TAG_TYPE_UNKNOWN (For Ruby use "::" instead of ".")
String: 255

Property Access:

  • Instance: This property can be accessed via an instance object of this class:
    • myObject.type