Class AlienTag
In: alientag.rb
Parent: Object

A storage class for RFID tag data elements.

Methods

<=>   create   new   tag   tag=   to_s   update  

Included Modules

Comparable

Attributes

ant  [RW] 
count  [RW] 
disc  [RW] 
field  [R] 
freq  [RW] 
id  [RW] 
last  [RW] 
proto  [RW] 
rssi  [RW] 
speed  [RW] 

Public Class methods

Populate the instance variables from a taglist entry string. The following field separators are supported in the taglist entry string:

 'tag:', 'disc:', 'last:', 'count:', 'ant:', 'proto:', 'speed:', 'rssi:'

Public Instance methods

The ‘spaceship’ operator allows us to compare tags for sorting, etc.

Try to parse a taglist entry into a set of Tag object variables.

Uses a simple mapping from Alien ‘text’ format (comma-separated "key:value" fields):

 Tag:0102 0304 0506 0708 0900 0A0B, Disc:2008/10/28 10:49:35, Last:2008/10/28 10:49:35, Count:1, Ant:3, Proto:2

RSSI, SPEED, and FREQ data are not included in the default text format. In order to have them (and any other additional tag data) parsed correctly the TagListFormat must be set to custom and the TagListCustomFormat fields must be separated by the following text tokens:

    'tag:', 'disc:', 'last:', 'count:', 'ant:', 'proto:', 'speed:', 'rssi:', "freq:"

For example:

   @rdr.taglistcustomformat = "Tag:%i, Disc:${DATE1} ${TIME1}, Last:${DATE2} ${TIME2}, Count:${COUNT}, Ant:${TX}, Proto:${PROTO#}, Speed:${SPEED}, rssi:${RSSI}"
   @rdr.taglistformat = "custom"

Any other custom tokens included in the tag line may be accessed through the @field hash. For example, if:

   @rdr.taglistcustomformat = "Tag:%i, PC:${PCWORD}"

then after parsing a line of tag data, the PC word could be accessed with:

   alientag.field['pc']

(Deprecated) Returns tag id. This method is for backward compatibility with an earlier version of this API. Use id instead.

(Deprecated) Sets tag id. This method is for backward compatibility with an earlier version of this API. Use id= instead.

Returns a printable version of the tag object (returns tag id as a string)

Updates an existing tag object from the new one by incrementing the count and setting the new last time

[Validate]