Difference between revisions of "Engine Terms"

From RifidiWiki

Jump to: navigation, search
(New page: category:developerDoccategory:engineDoc ====Formatter==== The formatter handles any reader specific parsing that needs to be done to a raw message coming into (using the decode met...)
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[category:developerDoc]][[category:engineDoc]]
+
[[category:developerDoc]][[category:EmulatorDoc]]
 
====Formatter====
 
====Formatter====
The formatter handles any reader specific parsing that needs to be done to a raw message coming into (using the decode method) or going out of the reader (using the encode method).  For example, in the Symbol Formatter, the third byte is the command type, and is used to look up the handler method to use:
+
The formatter handles any reader specific parsing that needs to be done to a raw message coming into (using the decode method) or going out of the reader (using the encode method).  For an example, see [[Formatter]].
 
+
<code><pre>
+
public ArrayList<Object> decode(byte[] arg) {
+
    if (arg == null || arg.length < 4) {
+
        return null;
+
    }
+
    ArrayList<Object> retVal = new ArrayList<Object>();
+
    retVal.add(ByteAndHexConvertingUtility.toHexString(arg[3]));
+
    retVal.add(arg);
+
   
+
    return retVal;
+
}</pre></code>
+
 
+
On the way out, a 0x01 needs to be prepended to a response, and the CRC needs to be calculated.
+
 
+
<code><pre>
+
public ArrayList<Object> encode(ArrayList<Object> arg) {
+
 
+
ArrayList<Object> retVal = new ArrayList<Object>();
+
 
+
for (Object o : arg) {
+
byte[] command = (byte[]) o;
+
 
+
/*
+
* Create outgoing array list that is 3 slots bigger than incoming
+
* one: one for start of frame and two for crc bytes
+
*/
+
byte[] outgoingCommand = new byte[command.length + 3];
+
for (int i = 0; i < command.length; i++) {
+
outgoingCommand[i + 1] = command[i];
+
}
+
 
+
/* Add Start of Frame Byte */
+
outgoingCommand[0] = 0x01;
+
 
+
// Calculate CRC
+
int crc = CRC16.calculateCRC(command, 0xBEEF,CRC16.XR400_CRC_TABLE, true);
+
byte[] crcBytes = ByteAndHexConvertingUtility.intToByteArray(crc, 2);
+
 
+
// put crc in outgoingCommand, LSB first
+
outgoingCommand[outgoingCommand.length - 2] = crcBytes[1];
+
outgoingCommand[outgoingCommand.length - 1] = crcBytes[0];
+
+
logger.debug(ByteAndHexConvertingUtility.toHexString(outgoingCommand));
+
+
+
retVal.add(outgoingCommand);
+
 
+
}
+
 
+
return retVal;
+
}</pre></code>
+
  
 
====Handler Method====
 
====Handler Method====
Line 64: Line 12:
 
     return arg;
 
     return arg;
 
}</pre></code>
 
}</pre></code>
 +
 +
====Radio====
 +
The [[Radio|radio]] is the interface between the antennas and the TagMemory.
 +
 +
====Tag Memory====
 +
The [[TagMemory|tag memory]] is the structure that holds tags in a specific reader.  Each kind of reader should have its own TagMemory.
 +
 +
====GPIO====
 +
[[GPIO]] (General Purpose input/output) is used to interface the reader with other PLC devices such as Light Stacks and Photo eyes.

Latest revision as of 17:56, 29 November 2007

Formatter

The formatter handles any reader specific parsing that needs to be done to a raw message coming into (using the decode method) or going out of the reader (using the encode method). For an example, see Formatter.

Handler Method

A method within a reader's project that handles a specific command for a reader. For example if a Rifidi Symbol reader receives a Set System Parameter Command, the following method handles the logic for that command:
	
public CommandObject setSystemParameter(CommandObject arg, AbstractReaderSharedResources asr) {
    byte[] setSystemParam = { 0x04, 0x06, 0x27, 0x00 };
    arg.getReturnValue().add(setSystemParam);
    return arg;
}

Radio

The radio is the interface between the antennas and the TagMemory.

Tag Memory

The tag memory is the structure that holds tags in a specific reader. Each kind of reader should have its own TagMemory.

GPIO

GPIO (General Purpose input/output) is used to interface the reader with other PLC devices such as Light Stacks and Photo eyes.

Personal tools