Class SeeedStudioRfidProtocol
- java.lang.Object
-
- jmri.jmrix.rfid.RfidProtocol
-
- jmri.jmrix.rfid.protocol.seeedstudio.SeeedStudioRfidProtocol
-
public class SeeedStudioRfidProtocol extends RfidProtocol
Common routines to extract the Tag information and validate checksum for implementations that use the SeeedStudio protocol.
This file is part of JMRI.JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-
Field Summary
-
Fields inherited from class jmri.jmrix.rfid.RfidProtocol
concentratorFirst, concentratorLast, isConcentrator, portPosition
-
-
Constructor Summary
Constructors Constructor Description SeeedStudioRfidProtocol()
Constructor for SeeedStudio RFID Protocol.SeeedStudioRfidProtocol(char concentratorFirst, char concentratorLast, int portPosition)
Constructor for SeeedStudio RFID Protocol.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
endOfMessage(AbstractMRReply msg)
Determines if at the end of this RFID replyjava.lang.String
getCheckSum(AbstractMRReply msg)
When available, returns the checksum portion of an RFID replystatic int
getMaxSize()
java.lang.String
getTag(AbstractMRReply msg)
Retrieves RFID Tag information from messagejava.lang.String
initString()
Returns the initialisation string to be sent to an adapter implementing the protocol.boolean
isCheckSumValid(AbstractMRReply msg)
boolean
isValid(AbstractMRReply msg)
Determines if this RFID reply is validboolean
providesChecksum()
Determines if this protocol provides checksum values Default is false.java.lang.String
toMonitorString(AbstractMRReply msg)
Provides a textual representation of this message for the monitor-
Methods inherited from class jmri.jmrix.rfid.RfidProtocol
convertHexString, getReaderPort
-
-
-
-
Constructor Detail
-
SeeedStudioRfidProtocol
public SeeedStudioRfidProtocol()
Constructor for SeeedStudio RFID Protocol. Used when a single reader is connected directly to a port, not via a concentrator.
-
SeeedStudioRfidProtocol
public SeeedStudioRfidProtocol(char concentratorFirst, char concentratorLast, int portPosition)
Constructor for SeeedStudio 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
-
-
Method Detail
-
getMaxSize
public static final int getMaxSize()
-
initString
public java.lang.String initString()
Description copied from class:RfidProtocol
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- Specified by:
initString
in classRfidProtocol
- Returns:
- initialisation string
-
getTag
public java.lang.String getTag(AbstractMRReply msg)
Description copied from class:RfidProtocol
Retrieves RFID Tag information from message- Overrides:
getTag
in classRfidProtocol
- Parameters:
msg
- Message to decode- Returns:
- String representation of tag
-
providesChecksum
public boolean providesChecksum()
Description copied from class:RfidProtocol
Determines if this protocol provides checksum values Default is false. Protocols that do provide them should override this method.- Overrides:
providesChecksum
in classRfidProtocol
- Returns:
- true if provided
-
getCheckSum
public java.lang.String getCheckSum(AbstractMRReply msg)
Description copied from class:RfidProtocol
When available, returns the checksum portion of an RFID reply- Specified by:
getCheckSum
in classRfidProtocol
- Parameters:
msg
- RFID reply to process- Returns:
- checksum value
-
isValid
public boolean isValid(AbstractMRReply msg)
Description copied from class:RfidProtocol
Determines if this RFID reply is valid- Specified by:
isValid
in classRfidProtocol
- Parameters:
msg
- RFID reply to process- Returns:
- true if valid
-
isCheckSumValid
public boolean isCheckSumValid(AbstractMRReply msg)
-
endOfMessage
public boolean endOfMessage(AbstractMRReply msg)
Description copied from class:RfidProtocol
Determines if at the end of this RFID reply- Specified by:
endOfMessage
in classRfidProtocol
- Parameters:
msg
- RFID reply to process- Returns:
- true if at end
-
toMonitorString
public java.lang.String toMonitorString(AbstractMRReply msg)
Description copied from class:RfidProtocol
Provides a textual representation of this message for the monitor- Overrides:
toMonitorString
in classRfidProtocol
- Parameters:
msg
- RFID reply to process- Returns:
- textual representation
-
-