Hi there,
I'm banking on Zebra expertise for this :
I am trying to develop an application with Rhodes for reading the tag ID of RFID ISO 15693 tag using an Android phone with NFC.
The surprising thing is that my application does not read the tag ID of 16 characters hex until I write something to the tag first.
I am attaching the screenshots taken by NFC TagInfo, an application I downloaded from Google Play.
You can see from 1.png, I have written the string "Mark" to the tag. Only after I have written this text to the tag can my mobile phone display the tag ID of 16 characters hex. Other tags which have nothing written to them cannot be read by my application.
Sample controller code (Adapted from rhodes-system-api-samples) :
def nfc_tech_callback
@msg = "Tech received! Reading tag..."
add_to_log(@msg)
# get_current_Tag:Returns the current NFCTag that the mobile device has just read, or returns nil if no tag has been discovered
tag=Rho::NFCManager.get_current_Tag
if tag != nil
@msg = test_ndef_read(tag)
else
@msg = "Tag is nil!"
end
puts "msg at tech callback: #{@msg.inspect}"
add_to_log(@msg)
end
def test_ndef_read(tag)
result = "No records..."
# Find out what tech the tag uses with the method NFCTag.get_tech; the tag techs are listed in the NFCTagTechnology class. In this example, the tag is Ndef tech
ndef=tag.get_tech(Rho::NFCTagTechnology::NDEF)
# string array containing the NFC tag
tag_tech_list=tag.get_tech_list
# This method returns a byte array containing the NFC tag ID. This is what I need to display.
tag_ID=tag.get_ID
puts "ndef at test_ndef_read tag: #{ndef.inspect}"
if ndef != nil
# Connect to the tag with the method NFCTagTechnology.connect
ndef.connect
tag_name=ndef.get_name
type = ndef.get_type
# In this example, it is an Ndef tag, so use the NTagTechnology_Ndef.read_NdefMessage method (subclass of NFCTechnology) to read the message.
msg = ndef.read_NdefMessage
puts "tag_tech_list at test_ndef_read tag: #{tag_tech_list.inspect}"
puts "tag_ID at test_ndef_read tag: #{tag_ID.inspect}"
puts "Tag name at test_ndef_read tag: #{tag_name.inspect}"
puts "Tag type at test_ndef_read tag: #{type.inspect}"
puts "msg at test_ndef_read tag: #{msg.inspect}"
result="%02X%02X%02X%02X%02X%02X%02X%02X" % tag_ID.reverse
ndef.close
end
result
end
In the above code,
result = "No records..." is shown as the tag ID for an unwritten ("blank") tag, whereas the 16 character hex string (e.g., result = E00401004DEA2E9F) is correctly shown as the tag ID for a "written" tag.
Can anyone tell me the reason for this behaviour?
0 Replies