Class ZigBeeDate

  • All Implemented Interfaces:
    ZCLDataTypeDescription, ZCLSimpleTypeDescription

    public class ZigBeeDate
    extends java.lang.Object
    implements ZCLSimpleTypeDescription
    A singleton class that represents the 'Date' data type, as it is defined in the ZigBee Cluster Library specification.

    The ZigBee data type is mapped to a byte[4] array where byte[0] must contain the Year field (be careful that in the ZCL specification this byte do not contain the actual year, but an offset) whereas byte[3] the Day of Week. The array is marshaled/unmarshaled starting from byte[0].

    Author:
    $Id: 8abc2db45f3e3caf73a35f1bf0ff0c40fde1a463 $
    • Method Detail

      • getInstance

        public static ZigBeeDate getInstance()
        Gets a singleton instance of this class.
        Returns:
        the singleton instance.
      • getId

        public short getId()
        Description copied from interface: ZCLDataTypeDescription
        Returns the data type identifier.
        Specified by:
        getId in interface ZCLDataTypeDescription
        Returns:
        the data type identifier. The data types identifiers supported by this specification are defined in the ZigBeeDataTypes interface.
      • serialize

        public void serialize​(ZigBeeDataOutput os,
                              java.lang.Object value)
                       throws java.io.IOException
        Description copied from interface: ZCLSimpleTypeDescription
        Serializes a ZigBee data type into a ZigBeeDataOutput stream. An implementation of this method must throw an IllegalArgumentException if the passed value does not belong to the expected class or its value exceeds the possible values allowed (in terms of range or length).

        An implementation of this method must interpret (where it makes sense) a null value as the request to serialize the so called Invalid Value.

        Specified by:
        serialize in interface ZCLSimpleTypeDescription
        Parameters:
        os - a ZigBeeDataOutput stream where to the passed value will be appended. This parameter cannot be null. If null a NullPointerException must be thrown.
        value - The value that have to be serialized on the output stream. If null is passed this method outputs on the stream the ZigBee invalid value related the specific data type. If the data type do not allow any invalid value and the passed value is null an IllegalArgumentException is thrown.
        Throws:
        java.io.IOException - If an I/O error occurs while writing on the ZigBeeDataOutput. The EOFException may be thrown if there is no more space on the data output for serializing the passed value.
      • deserialize

        public java.lang.Object deserialize​(ZigBeeDataInput is)
                                     throws java.io.IOException
        Description copied from interface: ZCLSimpleTypeDescription
        Deserializes a value from the passed ZigBeeDataInput stream.
        Specified by:
        deserialize in interface ZCLSimpleTypeDescription
        Parameters:
        is - the ZigBeeDataInput from where the value of data type is read from.
        Returns:
        An object that represents the deserialized value of data. Returns null if the read value represents the Invalid Value for the specific ZigBee data type.
        Throws:
        java.io.IOException - If an I/O error occurs while reading the ZigBeeDataInput. An EOFException is thrown if the data input stream end is reached while deserializing the data type.