Overview of NFC Design Components
NFC functionality is implemented with the help of the following NFC-specific design components:
This action is used to start or stop the pushing and/or receiving of messages.
Pushing and/or receiving is started when the NFC Start action is triggered. The sequence of steps that the action sets in motion is as follows:
1.NFC must be enabled on the device. If NFC is not enabled, then triggering the Start action will cause a prompt to appear asking the user to enable NFC. 2.After ensuring that NFC is enabled, the MobileTogether Client app will be registered for NFC. 3.Immediately thereafter, NFC tag discovery starts automatically and NFC messages in NFC tags will be received automatically. Pushing can be started on Windows devices via an NFC Push action; it is not automatically started.
The NFC Stop action stops the pushing and receiving of all messages. To re-start the pushing and receiving of messages, trigger the Start action again.
See also Discovering and Reading NFC Tags.
|
The NFC Push action works on Windows devices and enables data to be transmitted from the Windows device running the solution to any other NFC-enabled device. The NFC Push action defines the message or file to push. When the action is triggered, the specified message or file is transmitted via NFC.
Note: NFC data-pushing is supported on Windows devices, but not on Android or iOS devices.
For more information, see Pushing Data to Other Devices and NFC Push action.
|
The $MT_NFC tree is automatically created as a page source in the design when an NFC Start action is defined. The tree is automatically populated when an NFC tag is discovered. The data from the NFC tag is stored in the nodes of the $MT_NFC tree. For simulations, you can use an NFC sample file to see how data from its NFC tag is stored in the $MT_NFC tree. (See the section NFC Sample Files for more information about NFC simulations.)
|
Two NFC-related events provide crucial functionality:
•OnPushNdefMessageCompleted specifies what action/s to carry out when the transmission of NFC data (via NFC Push) has been completed. •OnNfcTagDiscovered specifies what action/s to carry out when an NFC tag is discovered. For example, when this event is triggered, an Update Node action can be used to update data-source trees with data from the discovered NFC tag.
|
The following NFC-related functions are available:
•mt-nfc-started: a Boolean test to check whether the solution has started NFC. •mt-hexBinary-to-string: converts a hexBinary to a text string. •mt-hexBinary-to-base64: converts a hexBinary to a Base64-encoded image. •mt-string-to-hexBinary: converts a text string to a hexBinary string. •mt-base64-to-hexBinary: converts a Base64-encoded image to a hexBinary string.
Since the payload of messages is transported in hexBinary format, the conversion functions enable data to be prepared for transport (that is, converted to hexBinary) and converted from hexBinary to human-usable formats (text and images). For more detailed descriptions of these functions, see MobileTogether Extension Functions.
|
For simulations, you can create an NFC sample file and use this file to test whether data from NFC tags is being correctly imported into the $MT_NFC tree. See the section NFC Sample Files for more information about NFC simulations.
|