Easy IoT Sensor On-Boarding Using Jini Auto-Discovery and Java SE Embedded (Part 3)
By Hinkmond-Oracle on Sep 04, 2014
For the Discovery part of the Jini Auto-Discovery of an IoT sensor, we'll need the specification of the device we are trying to on-board. In this case, we are integrating the Parallax USB RFID Reader using the Jini technology techniques for device discovery.
After a quick Web search, we see there is information about how to manually connect the Parallax USB RFID Reader at Stephen James Mason's blog post:
That gives us the key to integrating that specific sensor into a Jini network that we are creating. Just take the part that is manually being done (in the blog post) and write a Jini discovery adapter to watch for it when that particular Parallax USB RFID Reader gets connected to the Raspberry Pi.
... int result = serial.open( "/dev/ttyUSB0", 2400 ); ... In the RFID reader manual, the key transmitted is described as a sequence of bytes, such as “ 0x0A, 0×30, 0×46, 0×30, 0×31, 0×38, 0×34, 0×46, 0×30, 0×37, 0×41, 0x0D”, where 0x0a is the start byte, and 0x0d is the stop byte, leaving the remaining 10 bytes as the tag’s unique key.So, the sequence (above string of bytes from the USB device) is what we use to "discover" that specifically the Parallax USB RFID Reader was just connected to the USB port of the Raspberry Pi. At that point of discovery, we "Look-Up" the correct Jini proxy to use to communicate with that RFID Reader from inside a Java application (using the manufacturer's RFID Reader manual as our guidance).
Next, we'll take a closer look at the Jini code that is used to "discover" that RFID reader sequence of bytes (or its "fingerprint") so that the Jini auto-discovery phase happens each time a new connection is made, instead of doing that "manually" like it is described in Stephen James Mason's blog post. Automatically done is the way to go, and it's the Jini way!
Full series of steps: