Class RfidProtocol

    • Constructor Detail

      • RfidProtocol

        public RfidProtocol()
        Constructor for an RFID Protocol. Used when a single reader is connected directly to a port, not via a concentrator.
      • RfidProtocol

        public RfidProtocol​(char concentratorFirst,
                            char concentratorLast,
                            int portPosition)
        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 port
        concentratorLast - character representing last concentrator port
        portPosition - position of port character in reply string; 1 for first character
    • Method Detail

      • getTag

        public java.lang.String getTag​(AbstractMRReply msg)
        Retrieves RFID Tag information from message
        Parameters:
        msg - Message to decode
        Returns:
        String representation of tag
      • providesChecksum

        public boolean 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

        public abstract java.lang.String getCheckSum​(AbstractMRReply msg)
        When available, returns the checksum portion of an RFID reply
        Parameters:
        msg - RFID reply to process
        Returns:
        checksum value
      • isValid

        public abstract boolean isValid​(AbstractMRReply msg)
        Determines if this RFID reply is valid
        Parameters:
        msg - RFID reply to process
        Returns:
        true if valid
      • endOfMessage

        public abstract boolean endOfMessage​(AbstractMRReply msg)
        Determines if at the end of this RFID reply
        Parameters:
        msg - RFID reply to process
        Returns:
        true if at end
      • initString

        public abstract java.lang.String 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
      • toMonitorString

        public java.lang.String toMonitorString​(AbstractMRReply msg)
        Provides a textual representation of this message for the monitor
        Parameters:
        msg - RFID reply to process
        Returns:
        textual representation
      • convertHexString

        protected static byte[] convertHexString​(java.lang.String s)
        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:
        java.lang.IllegalArgumentException - when s is not a valid hex string