Class CosemDateTime

  • All Implemented Interfaces:
    CosemDateFormat

    public class CosemDateTime
    extends java.lang.Object
    implements CosemDateFormat
    Class representing the COSEM DateTime.
    • Constructor Detail

      • CosemDateTime

        public CosemDateTime​(int year,
                             int month,
                             int dayOfMonth,
                             int hour,
                             int minute,
                             int second,
                             int deviation,
                             CosemDateTime.ClockStatus... clockStatus)
        Constructs a a COSEM Date_Time.
        Parameters:
        year - the year from 0 to 0xFFFF.
        month - the month from 1 to 12. Set to 0xFF if not specified.
        dayOfMonth - the day of the month starting from 1 to max 31. Set to 0xFE for the last day of a month and 0xFD for the second last day of a month. Set to 0xFF if not specified.
        hour - the hour from 0 to 23. 0xFF if not specified.
        minute - the minute from 0 to 59. 0xFF if not specified.
        second - the second from 0 to 59. 0xFF if not specified.
        deviation - the deviation in minutes from local time to GMT. From -720 to 720. 0x8000 if not specified
        clockStatus - the clock status flags
        Throws:
        java.lang.IllegalArgumentException - if a parameter does not fit the range
      • CosemDateTime

        public CosemDateTime​(int year,
                             int month,
                             int dayOfMonth,
                             int dayOfWeek,
                             int hour,
                             int minute,
                             int second,
                             int hundredths,
                             int deviation,
                             CosemDateTime.ClockStatus... clockStatus)
        Constructs a a COSEM Date_Time.
        Parameters:
        year - the year from 0 to 0xffff.
        month - the month from 1 to 12. Set to 0xff if not specified.
        dayOfMonth - the day of the month starting from 1 to max 31. Set to 0xfe for the last day of a month and 0xfd for the second last day of a month. Set to 0xff if not specified.
        dayOfWeek - the day of a week from 1 to 7. 1 is Monday. Set to 0xff if not specified.
        hour - the hour from 0 to 23. 0xff if not specified.
        minute - the minute from 0 to 59. 0xff if not specified.
        second - the second from 0 to 59. 0xff if not specified.
        hundredths - the hundredths seconds from 0 to 99. 0xff if not specified.
        deviation - the deviation in minutes from local time to GMT. From -720 to 720. 0x8000 if not specified
        clockStatus - the clock status flags
        Throws:
        java.lang.IllegalArgumentException - if a parameter does not fit the range
      • CosemDateTime

        public CosemDateTime​(CosemDate date,
                             CosemTime time,
                             int deviation,
                             CosemDateTime.ClockStatus... clockStatus)
        Constructs a a COSEM Date_Time.
        Parameters:
        date - the date
        time - the time
        deviation - the deviation in minutes from local time to GMT. From -720 to 720. 0x8000 if not specified
        clockStatus - the clock status flags
        Throws:
        java.lang.IllegalArgumentException - if a parameter does not fit the range
      • CosemDateTime

        public CosemDateTime​(CosemDate date,
                             CosemTime time,
                             int deviation,
                             java.util.concurrent.TimeUnit deviationTimeUnit,
                             CosemDateTime.ClockStatus... clockStatus)
        Constructs a a COSEM Date_Time.
        Parameters:
        date - the date
        time - the time
        deviation - the deviation
        deviationTimeUnit - the unit of the deviation value
        clockStatus - the clock status flags
        Throws:
        java.lang.IllegalArgumentException - if a parameter does not fit the range
      • CosemDateTime

        public CosemDateTime​(CosemDate date,
                             CosemTime time,
                             CosemDateTime.ClockStatus... clockStatus)
        Constructs a a COSEM Date_Time. With a deviation not specified.
        Parameters:
        date - the date
        time - the time
        clockStatus - the clock status flags
        Throws:
        java.lang.IllegalArgumentException - if a parameter does not fit the range
    • Method Detail

      • decode

        public static CosemDateTime decode​(byte[] octetString)
      • encode

        public byte[] encode()
        Description copied from interface: CosemDateFormat
        The octet string.
        Specified by:
        encode in interface CosemDateFormat
        Returns:
        the octet string.
      • length

        public int length()
        Description copied from interface: CosemDateFormat
        The size of the octet string.
        Specified by:
        length in interface CosemDateFormat
        Returns:
        the size.
      • get

        public int get​(CosemDateFormat.Field field)
        Description copied from interface: CosemDateFormat
        Retrieves the value for a certain value.
        Specified by:
        get in interface CosemDateFormat
        Parameters:
        field - the field which should be retrieved.
        Returns:
        the value as an int32.