Reader.xml

From RifidiWiki

Jump to: navigation, search

Reader.xml is a file that contains the mapping between handler methods and the command names. It tells the command processor where to find the proper handler method, given a particular command. See READERNAME_CATEGORY_Handler.java for more information about the command handlers.

Command

The command xml tag is the basic tag in the reader.xml file. It contains the information for the mapping of a single reader command to a single handler method. For example, it lets the command processor of the symbol reader know that if it receives a command with the number '22', it should go to the 'readFullField' command handler method to process this command.You will need one of these tags for every command that you want to support in the reader.

Sub elements

  1. queryName - The queryName is the unique name of the incoming command. It should be able to be derived from the incoming command messages somehow. For example, with the symbol and LLRP readers, all commands have numbers associated with them that identify the type of command. For the alien reader, which is text-based, the commands all have a unique textual name, such as 'taglist', or 'persistTime'.
  2. displayName - The display name is used if the properties view is enabled in the IDE. It is the name that should be used if a certain property is able to be displayed
  3. CommandState - This is a classifier for what state the reader should be in to use the command. It is not all that important, and should be set to interactive for most readers.
  4. CommandHandlerDetails - Information about the commandHandler method that will handle this command
    1. HandlerClass - the packagae name of the command. For example, 'org.rifidi.emulator.reader.symbol.commandhandler.BitEncodedCommands'
    2. handlerMethod - the method name. For example, 'readFullField'
    3. argumentType - If the command is used like a property, such as it is in the alien reader, this is the type of the property. Most readers should probably just use 'string'
  5. actionTag - should be set to 'IGNORE'
  6. category - again, if the property view is enabled, the category this property should be in. Most readers should use 'NONE'
  7. defaultValue - If this command is a property, the default value of it. Again, most readers other than the Alien do not use this, and it should be set to 'OFF'

Reference Implementation

This is the command tag for the Read full field command in the symbol reader. The important parts are the queryName, and the commandHandlerDetails.

	<Command>
		<queryName>22</queryName>
		<displayName>READ_FULL_FIELD</displayName>
		<commandState>Interactive</commandState>
		<commandHandlerDetails>
			<handlerClass>org.rifidi.emulator.reader.symbol.commandhandler.BitEncodedCommands</handlerClass>
			<handlerMethod>readFullField</handlerMethod>
			<argumentType>String</argumentType>
		</commandHandlerDetails>
		<actionTag>IGNORE</actionTag>
		<category>NONE</category>
		<defaultValue>OFF</defaultValue>
	</Command>

Because the Alien Reader treats all of its commands as properties that have values that can be displayed, it uses the fields that most readers do not need.

	<Command>
		<queryName>getPersistTime</queryName>
		<queryName>setPersistTime</queryName>
		<displayName>PersistTime</displayName>
		<commandState>Interactive</commandState>
		<commandHandlerDetails>
			<handlerClass>org.rifidi.emulator.reader.alien.commandhandler.AlienTag</handlerClass>
			<handlerMethod>persistTime</handlerMethod>
			<argumentType>Integer</argumentType>
		</commandHandlerDetails>
		<actionTag>EDITABLE</actionTag>
		<category>TAG</category>
		<defaultValue>-1</defaultValue>
	</Command>
Personal tools