Package jmri.jmrix.rfid
Class RfidProtocol
java.lang.Object
jmri.jmrix.rfid.RfidProtocol
- Direct Known Subclasses:
CoreIdRfidProtocol,Em18RfidProtocol,OlimexRfid1356mifareProtocol,OlimexRfidProtocol,ParallaxRfidProtocol,SeeedStudioRfidProtocol
Basic interface to be implemented for each tag protocol.
- Since:
- 3.9.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected charprotected charprotected booleanprotected int -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for an RFID Protocol.RfidProtocol(char concentratorFirst, char concentratorLast, int portPosition) Constructor for an RFID Protocol. -
Method Summary
Modifier and TypeMethodDescriptionprotected static byte[]Converts a hex string to an unsigned byte array.abstract booleanDetermines if at the end of this RFID replyabstract StringWhen available, returns the checksum portion of an RFID replychargetTag(AbstractMRReply msg) Retrieves RFID Tag information from messageabstract StringReturns the initialisation string to be sent to an adapter implementing the protocol.abstract booleanisValid(AbstractMRReply msg) Determines if this RFID reply is validbooleanDetermines if this protocol provides checksum values Default is false.Provides a textual representation of this message for the monitor
-
Field Details
-
isConcentrator
-
concentratorFirst
-
concentratorLast
-
portPosition
-
-
Constructor Details
-
RfidProtocol
public RfidProtocol()Constructor for an RFID Protocol. Used when a single reader is connected directly to a port, not via a concentrator. -
RfidProtocol
Constructor for an RFID Protocol. Supports the use of concentrators where a character range is used to determine the specific reader port.- Parameters:
concentratorFirst- character representing first concentrator portconcentratorLast- character representing last concentrator portportPosition- position of port character in reply string; 1 for first character
-
-
Method Details
-
getTag
Retrieves RFID Tag information from message- Parameters:
msg- Message to decode- Returns:
- String representation of tag
-
providesChecksum
Determines if this protocol provides checksum values Default is false. Protocols that do provide them should override this method.- Returns:
- true if provided
-
getCheckSum
When available, returns the checksum portion of an RFID reply- Parameters:
msg- RFID reply to process- Returns:
- checksum value
-
isValid
Determines if this RFID reply is valid- Parameters:
msg- RFID reply to process- Returns:
- true if valid
-
endOfMessage
Determines if at the end of this RFID reply- Parameters:
msg- RFID reply to process- Returns:
- true if at end
-
initString
Returns the initialisation string to be sent to an adapter implementing the protocol. For those protocols that do not require one, return a blank string- Returns:
- initialisation string
-
getReaderPort
-
toMonitorString
Provides a textual representation of this message for the monitor- Parameters:
msg- RFID reply to process- Returns:
- textual representation
-
convertHexString
Converts a hex string to an unsigned byte array. Both upper and lower case hex codes are permitted.- Parameters:
s- String representation of a hex number. Must be a whole number of bytes (i.e. an even number of characters) and be formed only of digits 0..9, a..f or A..F- Returns:
- corresponding unsigned byte array
- Throws:
IllegalArgumentException- when s is not a valid hex string
-