Projects:RFIDIntegration WebPOS/Technical and Functional Design
Contents |
RFID Integration Technical and Functional Design
Overview
This document will explain the technical and functional design of RFID Integration project.
Technical Considerations
The RFID reader must be connected to a instance of the Hardware Manager.
Doing this, the RFID reader will be able to send data to a Web POS connected with it. To do so, the Hardware Manager, for the first time, has to start the communication.
To create this communication channel, the technology used has been web-sockets. Those kind of sockets allows us to establish a bidirectional communication between two endpoints initialized over HTTP/HTTPS.
If the configuration is appropriate, during the login Web POS will try to connect with an specific Websocket Servlet created in Hardware Manager.
- OB.UTIL.rfidWebsocket = new WebSocket(websocketServerLocation);
On the server side there is a Jetty servlet ready to receive incomming connections and handle them.
- @WebSocket
- public class RFIDEmbiWebSocketHandler implements WebSocketHandler
Once the communication is established either Hardware Manager or Web POS can send messages through the socket to the other.
- Hardware Manager (Java): this.websocketSession.getRemote().sendString(message.toString());
- Web POS (JavaScript): OB.UTIL.rfidWebsocket.send('removeAllEpcs:' + uuid);
Also an ACK system has been implemented in order to guarantee that the messages are delivered to the Hardware Manager. To use this, one can just call to the following function from Web POS.
- OB.UTIL.waitForAck(functionToExecute, callback, errorCallback, interval, uuid, trials)
Once that the uuid sent is returned, is considered that the message has been received. If the number of trials has been reached and the uuid has been received callback is executed, otherwise, errorCallback is executed.
I trials parameter is undefined it will keep trying forever.
Some Websockets jar's have been added to Hardware Manager's lib folder.
EmbiPOS Considerations
For this device an specific API had to be used. Its jar is called EmbiAPI_Java-1.8.0-jar-with-dependencies.jar and it has been added to Hardware Manager's lib folder as well.