READERNAME CATEGORY Handler.java

From RifidiWiki

Revision as of 00:05, 24 November 2008 by Jmaine (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Handler method class is made up of handler methods. These are special methods designed to take care of one specific reader level command. For example, when you send a 'get taglist' command to the alien reader, it does the actual work of scanning the radio and getting tags in the taglist command handler. A handler method class usually has more than one command handler in it, and readers normally have more than one handler method class. The handler methods can usually be divided up by the type of the command. For example, in the LLRP reader, the command that deal with ROSpecs are in a different file from the commands dealing with AccessSpecs.

Each Handler method must registered in the reader.xml file. Please see it for how do it.

Command Handler Method

public CommandObject commandName(CommandObject arg, AbstractReaderSharedResources asr)

Arguments

  1. arg - The incoming command
  2. asr - abstract shared resources

Return Value

A command object where the first object in the commandObject's return value array is the return value of the funtion

Reference Implementation

This is a command handler in the symbol reader. All this handler method does is return four bytes. It places the bytes in the first slot in the RetrunValue array in the command object. This return value will then later be processed into an outgoing message by the formatter.

public CommandObject setSystemParameter(CommandObject arg, AbstractReaderSharedResources asr) {
    byte[] setSystemParam = { 0x04, 0x06, 0x27, 0x00 };
    arg.getReturnValue().add(setSystemParam);
    return arg;
}

Personal tools