|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.alien.enterpriseRFID.reader.AlienDLEObject
The AlienDLEObject class encapsulates the command and reply buffers used by
the AlienClassOEMReader
class to allow a host to communicate with
Alien readers which use the Alien Binary Reader Protocol. The messages are
binary data packets, consisting of a message payload delimited by two bytes
beginning every message (<DLE><SOM>) and two bytes ending every message
(<DLE><EOM>). The system is a Host-Talks-First scheme where the Host
initiates all communications. The reader responds to all commands with a
single response message - except for the Inventory command, which requires
multiple response messages.
<DLE> + <SOM> + <Payload> + <DLE> + <EOM>The payload portion of a command message has the following structure:
<SessionID> + <Reader#> + <Command> [+ CommandData] + <CRC16>The payload portion of a response message has the following structure:
<SessionID> + <Reader#> + <CommandEcho> + <CommType> [+ ResponseData] + <CRC16>The SessionID, Reader#, and CRC16 bytes are all handled automatically by this class. The Command and CommType value are all enumerated by int constant of this class, for instance
CMD_GET_FIRMWARE_VERSION
and
RESPONSE_MESSAGE_OK
.
For more information on how the Binary Protocol works, see the Reader Interface Guide that came with your Developer's Kit.
To issue a command to the reader, create an instance of AlienDLEObject, use
the prepareGenericCommand()
method to specify the Command and
CommandData you want to send, then pass it to
AlienClassOEMReader.issueReaderCommand()
. For example:
AlienDLEObject rc = new AlienDLEObject(); rc.prepareGenericCommand(AlienDLEObject.CMD_GET_FIRMWARE_VERSION); reader.issueReaderCommand(rc);If the reader command fails in any way, a subclass of AlienReaderException is thrown with the relevant details. The CommType byte that is returned by the reader with each response is stored in the "replyCommType" field of the AlienDLEObject instance, and will be one of the values enumerated by the RESPONSE_XXXXX constants.
The raw contents of the reader's reply is accessible via
AlienDLEObject.replyBuffer
, which is an array of bytes. The
payload portion of the reply is accessible via
AlienDLEObject.replyValueHexArray
and
AlienDLEObjectreplyValueIntArray
, which are arrays of bytes and
ints, respectively. If the response data can be represented as a single value,
this value is accessible via AlienDLEObject.replyValueInt
. For
example, following a command to get the reader number, the value can be
easily retrieved by:
rc.replyValueInt, or rc.replyValueIntArray[0], or rc.replyValueHexArray[0], or rc.replyBuffer[4] (the 1st four bytes of replyBuffer are SessionID, Reader#, CommandEcho, and CommType)Finally, inventory commands result in multiple reader response messages, each containing data for one tag that was read. This class will decode each of the messages, create
Tag
objects for each tag, and place them all into a
the tagTable field. The array of Tags can then be retrieved by:
Tag[] tagList = rc.tagTable.getTagList()
Constructor Summary | |
AlienDLEObject()
Constructs a new AlienDLEObject object. |
Method Summary | |
int |
addReply(int b)
Adds a byte to a reader reply and returns the current status of the reader's response. |
void |
prepareGenericCommand(byte[] commandByteSequence)
Prepares a ReaderCommand, using a byte array for the entire DLE command sequence, Command and Arguments. |
void |
prepareGenericCommand(int commandID)
Prepares a ReaderCommand, using 0 arguments for command paramters. |
void |
prepareGenericCommand(int commandID,
byte[] commandParamBytes)
Prepares a ReaderCommand, using a byte array for command paramters. |
void |
prepareGenericCommand(int commandID,
int commandParam1)
Prepares a ReaderCommand, using 1 int argument for command paramters. |
void |
prepareGenericCommand(int commandID,
int[] commandParamInts)
Prepares a ReaderCommand, using an int array for command paramters. |
void |
prepareGenericCommand(int commandID,
int commandParam1,
int commandParam2)
Prepares a ReaderCommand, using 2 int arguments for command paramters. |
void |
prepareGenericCommand(int commandID,
int commandParam1,
int commandParam2,
int commandParam3)
Prepares a ReaderCommand, using 3 int arguments for command paramters. |
void |
prepareGenericCommand(int commandID,
int commandParam1,
int commandParam2,
int commandParam3,
int commandParam4)
Prepares a ReaderCommand, using 4 int arguments for command paramters. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int COMMAND_BUFFER_SIZE
public static final int REPLY_BUFFER_SIZE
public static final int COMMAND_STATUS_UNKNOWN
public static final int COMMAND_STATUS_RESET
public static final int COMMAND_STATUS_SEND_ME
public static final int COMMAND_STATUS_RECEIVE_ME
public static final int COMMAND_STATUS_INVENTORY_BREAK
public static final int COMMAND_STATUS_COMPLETE
public static final int COMMAND_STATUS_ERROR
public static final int COMMAND_STATUS_TIMEOUT
public static final int COMMAND_STATUS_READER_ERROR
public static final int WAITING_FOR_DLE
public static final int WAITING_FOR_SOF
public static final int WAITING_FOR_MSG
public static final int WAITING_FOR_DLE_EMBEDDED
public static final int COMMAND_DLE
public static final int COMMAND_SOF
public static final int COMMAND_EOF
public static final int CMD_GET_FIRMWARE_VERSION
public static final int CMD_SET_READER_NUMBER
public static final int CMD_GET_READER_NUMBER
public static final int CMD_SET_BAUD_RATE
public static final int CMD_REBOOT
public static final int CMD_SET_IO_PORT_VALUE
public static final int CMD_GET_IO_PORT_VALUE
public static final int CMD_SET_ACTIVE_ANTENNA
public static final int CMD_GET_ACTIVE_ANTENNA
public static final int CMD_SET_RF_ATTENUATION
public static final int CMD_GET_RF_ATTENUATION
public static final int CMD_SET_IO_INVERSION_MASK
public static final int CMD_GET_IO_INVERSION_MASK
public static final int CMD_INTERNAL_TEST_PROCEDURE
public static final int CMD_SUSPEND_READER
public static final int CMD_GET_READER_STATUS
public static final int CMD_RESTORE_FACTORY_DEFAULTS
public static final int CMD_GET_HARDWARE_INFO
public static final int CMD_GET_MANUFACTURING_INFO
public static final int CMD_MANAGE_RESERVED_PARAMS
public static final int CMD_SET_TAG_MASK
public static final int CMD_GET_TAG_MASK
public static final int CMD_SET_BIDIRECTIONAL_DDR
public static final int CMD_GET_BIDIRECTIONAL_DDR
public static final int CMD_SET_IO_MASK
public static final int CMD_GET_IO_STATUS_LATCH
public static final int CMD_SET_RF_ONOFF
public static final int CMD_GET_RF_ONOFF
public static final int CMD_SET_ANTENNA_SEQUENCE
public static final int CMD_GET_ANTENNA_SEQUENCE
public static final int CMD_SET_OUTPUT_INITIAL_STATE
public static final int CMD_GET_OUTPUT_INITIAL_STATE
public static final int CMD_SET_ANTENNA_RF_POWER
public static final int CMD_GET_ANTENNA_RF_POWER
public static final int CMD_ENTER_BOOTLOADER
public static final int CMD_UPLOAD_FIRMWARE_LINE
public static final int CMD_GET_TAG_FIRMWARE_VERSION
public static final int CMD_SLEEP_TAG
public static final int CMD_WAKE_TAG
public static final int CMD_PROGRAM_ROW
public static final int CMD_GET_TAG_ID
public static final int CMD_SET_TAG_MEMORY
public static final int CMD_GET_TAG_MEMORY
public static final int CMD_FORMAT_TAG_MEMORY
public static final int CMD_SET_LOGGING
public static final int CMD_GET_LOGGING
public static final int CMD_SET_LOGGING_INTERVAL
public static final int CMD_GET_LOGGING_INTERVAL
public static final int CMD_SET_TIME
public static final int CMD_GET_TIME
public static final int CMD_SET_TAG_TYPE
public static final int CMD_GET_TAG_TYPE
public static final int CMD_SET_TAG_MODE
public static final int CMD_GET_TAG_MODE
public static final int CMD_GET_SENSOR_IMMEDIATE
public static final int CMD_VERIFY_TAG
public static final int CMD_GLOBALSCROLL_TAG
public static final int CMD_INVENTORY
public static final int CMD_WAKE_N
public static final int CMD_DIRECTED_INV_LIST_CONTROL
public static final int CMD_INV_DIAGNOSTIC_CONTROL
public static final int CMD_PROGRAM_TAG
public static final int CMD_ERASE_TAG
public static final int CMD_KILL_TAG
public static final int CMD_LOCK_TAG
public static final int CMD_READ_TAG_DATA
public static final int SUBCMD_PROGRAMMER_ENABLE
public static final int SUBCMD_GENERAL_PURPOSE_OUTPUTS
public static final int SUBCMD_GENERAL_PURPOSE_INPUTS
public static final int SUBCMD_BIDIRECTIONAL_IO
public static final int SUBCMD_MAXIMUM_HOP_TABLE_INDEX
public static final int SUBCMD_READER_TYPE
public static final int SUBCMD_LOCALIZATION
public static final int SUBCMD_RADIO_TYPE
public static final int SUBCMD_MINIMUM_FREQUENCY
public static final int SUBCMD_MAXIMUM_FREQUENCY
public static final int SUBCMD_HOP_STEP_SIZE
public static final int SUBCMD_PLL_TYPE
public static final int SUBCMD_MAXIMUM_RF_CHANNEL
public static final int SUBCMD_MAXIMUM_RF_POWER
public static final int SUBCMD_OPERATING_VOLTAGE
public static final int SUBCMD_AVAILABLE_BAUD_RATES
public static final int SUBCMD_MAX_DIRECTED_SORT_LIST
public static final int SUBCMD_SUPPORTED_TAG_TYPES
public static final int SUBCMD_HOP_INTERVAL
public static final int SUBCMD_RF_CHANNEL
public static final int SUBCMD_MAXIMUM_ANTENNA_NUMBER
public static final int SUBCMD_SEND_MODULATION_CONT
public static final int SUBCMD_SET_MOD_CONTROL_MANUAL
public static final int SUBCMD_GET_MOD_CONTROL_MANUAL
public static final int SUBCMD_SET_PA_BIAS
public static final int SUBCMD_GET_PA_BIAS
public static final int SUBCMD_SET_PA_VDD
public static final int SUBCMD_GET_PA_VDD
public static final int SUBCMD_SET_RECEIVER_GAIN
public static final int SUBCMD_GET_RECEIVER_GAIN
public static final int SUBCMD_SET_AIR_INTERFACE_BAUD
public static final int SUBCMD_GET_AIR_INTERFACE_BAUD
public static final int SUBCMD_SET_CAL_TABLE_ENTRY
public static final int SUBCMD_GET_CAL_TABLE_ENTRY
public static final int SUBCMD_SET_NV_RAW
public static final int SUBCMD_GET_NV_RAW
public static final int SUBCMD_RESTORE_DEFAULT_NV
public static final int SUBCMD_RESTORE_DEFAULT_HOP
public static final int SUBCMD_SET_HOP_TABLE_ENTRY
public static final int SUBCMD_GET_HOP_TABLE_ENTRY
public static final int SUBCMD_SET_READER_MANUF_INFO
public static final int SUBCMD_SET_RADIO_MANUF_INFO
public static final int SUBCMD_SET_RAW_RF_POWER
public static final int SUBCMD_GET_RAW_RF_POWER
public static final int SUBCMD_VOLTAGE_CALIBRATION
public static final int SUBCMD_SET_DIAGNOSTIC_MODE
public static final int SUBCMD_GET_DIAGNOSTIC_MODE
public static final int SUBCMD_SEND_PRIMITIVE_ONE_SHOT
public static final int SUBCMD_SET_RAW_MEMORY
public static final int SUBCMD_GET_RAW_MEMORY
public static final int SUBCMD_SET_PROGRAM_LENGTH
public static final int SUBCMD_GET_PROGRAM_LENGTH
public static final int SUBCMD_SET_PROGRAM_POWER_LEVELS
public static final int SUBCMD_GET_PROGRAM_POWER_LEVELS
public static final int SUBCMD_SET_DECODE_PARAMETERS
public static final int SUBCMD_GET_DECODE_PARAMETERS
public static final int SUBCMD_SET_DECODE_DIAG
public static final int SUBCMD_SET_TREE_INV_METHOD
public static final int SUBCMD_GET_TREE_INV_METHOD
public static final int SUBCMD_SET_ETSI_LISTEN_CHANNEL
public static final int SUBCMD_SET_MOD_FUDGE
public static final int SUBCMD_GET_MOD_FUDGE
public static final int SUBCMD_SET_SUSPENDERS_PARAMS
public static final int SUBCMD_GET_SUSPENDERS_PARAMS
public static final int SUBCMD_SET_PING_PARAMS
public static final int SUBCMD_GET_PING_PARAMS
public static final int SUBCMD_SET_ETSI_LISTEN_PARAMS
public static final int SUBCMD_GET_ETSI_LISTEN_PARAMS
public static final int RESPONSE_MESSAGE_OK
public static final int RESPONSE_INVENTORY_START
public static final int RESPONSE_INVENTORY_TAG
public static final int RESPONSE_INVENTORY_END
public static final int RESPONSE_LIST_DUMP_START
public static final int RESPONSE_LIST_DUMP_RECORD
public static final int RESPONSE_LIST_DUMP_END
public static final int RESPONSE_DIAGNOSTIC_START
public static final int RESPONSE_DIAGNOSTIC_DATA
public static final int RESPONSE_DIAGNOSTIC_END
public static final int RESPONSE_UPLOAD_OK
public static final int RESPONSE_UPLOAD_END
public static final int RESPONSE_SUSPEND
public static final int RESPONSE_RESUME
public static final int RESPONSE_MESSAGE_OK_G2
public static final int RESPONSE_UNKNOWN_LENGTH
public static final int RESPONSE_UNKNOWN_VALUE
public static final int RESPONSE_UNKNOWN_COMMAND
public static final int RESPONSE_UNKNOWN_TAG_COMMAND
public static final int RESPONSE_OVERFLOW_ERROR
public static final int RESPONSE_NO_TAG
public static final int RESPONSE_ERASE_FAILED
public static final int RESPONSE_PROGRAM_FAILED
public static final int RESPONSE_TAG_LOCKED
public static final int RESPONSE_KILL_FAILED
public static final int RESPONSE_LOCK_FAILED
public static final int RESPONSE_DATA_SIZE_MISMATCH
public static final int RESPONSE_HARDWARE_ERROR
public static final int RESPONSE_LIST_FULL
public static final int RESPONSE_UPLOAD_LINE_ERROR
public static final int RESPONSE_UPLOAD_INVALID
public static final int RESPONSE_UPLOAD_CRC_ERROR
public static final int RESPONSE_LOCK_CRC_ERROR
public static final int RESPONSE_TAG_LOST
public static final int RESPONSE_INVALID_KILL_CODE
public static final int TAGDECODE_GOOD_ID
public static final int TAGDECODE_NO_TAG
public static final int TAGDECODE_COLLISION
public static final int TAGDECODE_CRC_ERROR
public static final java.lang.String[] RESPONSE_STRINGS
public static int SESSION_ID
public byte[] commandBuffer
public byte[] unpackedCommandBuffer
public int commandLength
public byte[] replyBuffer
public byte[] replyBufferRaw
public int replyLength
public int replyLengthRaw
public int replyCommType
public java.lang.String replyCommTypeHexString
public java.lang.String replyCommTypeMessage
public int replyValueInt
public int[] replyValueIntArray
public byte[] replyValueHexArray
public TagTable tagTable
public int status
public int sessionID
public boolean isCyclops
Constructor Detail |
public AlienDLEObject()
Method Detail |
public void prepareGenericCommand(int commandID)
commandID
- the code of the reader commandpublic void prepareGenericCommand(int commandID, int commandParam1)
commandID
- the code of the reader commandcommandParam1
- the single parameter byte for this commandpublic void prepareGenericCommand(int commandID, int commandParam1, int commandParam2)
commandID
- the code of the reader commandcommandParam1
- the 1st parameter byte for this commandcommandParam2
- the 2nd parameter byte for this commandpublic void prepareGenericCommand(int commandID, int commandParam1, int commandParam2, int commandParam3)
commandID
- the code of the reader commandcommandParam1
- the 1st parameter byte for this commandcommandParam2
- the 2nd parameter byte for this commandcommandParam3
- the 3rd parameter byte for this commandpublic void prepareGenericCommand(int commandID, int commandParam1, int commandParam2, int commandParam3, int commandParam4)
commandID
- the code of the reader commandcommandParam1
- the 1st parameter byte for this commandcommandParam2
- the 2nd parameter byte for this commandcommandParam3
- the 3rd parameter byte for this commandcommandParam4
- the 4th parameter byte for this commandpublic void prepareGenericCommand(int commandID, int[] commandParamInts)
commandID
- the code of the reader commandcommandParamInts
- an int array containing the parameters for this commandpublic void prepareGenericCommand(int commandID, byte[] commandParamBytes)
commandID
- the code of the reader commandcommandParamBytes
- a byte array containing the parameters for this commandpublic void prepareGenericCommand(byte[] commandByteSequence)
commandByteSequence
- a byte array containing the command and argumentspublic int addReply(int b)
b
- the byte to add to the reply
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |