NFC Sample Files
If you wish to simulate the discovery of an NFC tag, you must use an NFC sample file in place of the NFC tag. (This is because your desktop machine is not enabled for NFC.) Select the NFC sample file by clicking the NFC Samples button at the bottom of the simulation pane and then browsing for the NFC samples file. The NFC samples file must have the structure shown in the listing below.
<Root> <NFCS> <NFC name="Text" tooltip="sends a well known text 'This is my text'"> <Root> <Tag Id=""/> <NdefMessage CanMakeReadOnly="" IsWriteable="" MaxSize="" Type=""> <NdefRecord Id="" TypeNameField="" RecordTypeDefinition="" Type="" Text="" Language="" URI="" Payload="" MimeType="" ExternalDomain="" ExternalPackageName=""> <NdefRecord /> </NdefRecord> <NdefRecord /> ... <NdefRecord /> </NdefMessage> </Root> </NFC> <NFC/> ... <NFC/> </NFCS> </Root>
|
As you can see from the listing above, each NFC element corresponds to a single message (NdefMessage element), which contains multiple records (NdefRecord elements).
Note that each sample file can have multiple messages. Once an NFC sample file has been selected for use in a simulation, the index of the currently selected message is shown in the simulator (see screenshot below). Furthermore, if you place the mouse cursor over the message number, a tooltip is displayed (see screenshot). This tooltip is the value of that message's NFC/@tooltip, attribute. To set a new message as the current message, use the Next and Previous buttons (see screenshot).
Reading message data from an NFC sample file
To read data from a particular message into the $MT_NFC tree from the NFC sample file, do the following:
1.Start NFC (by triggering the Start NFC action).
2.Specify the NFC sample file by clicking NFC Samples and browsing for the file.
3.Make sure that the number of the message you want to read from the NFC sample file is the currently displayed message number (in the screenshot above, the number 2).
4.Click this message number. The message data in the file will be read and loaded into the $MT_NFC tree.