Package org.openmuc.jdlms.datatypes
Class CosemDateTime
- java.lang.Object
-
- org.openmuc.jdlms.datatypes.CosemDateTime
-
- All Implemented Interfaces:
CosemDateFormat
public class CosemDateTime extends java.lang.Object implements CosemDateFormat
Class representing the COSEM DateTime.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CosemDateTime.ClockStatus
-
Nested classes/interfaces inherited from interface org.openmuc.jdlms.datatypes.CosemDateFormat
CosemDateFormat.Field
-
-
Constructor Summary
Constructors Constructor Description 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.CosemDateTime(int year, int month, int dayOfMonth, int hour, int minute, int second, int deviation, CosemDateTime.ClockStatus... clockStatus)
Constructs a a COSEM Date_Time.CosemDateTime(CosemDate date, CosemTime time, int deviation, java.util.concurrent.TimeUnit deviationTimeUnit, CosemDateTime.ClockStatus... clockStatus)
Constructs a a COSEM Date_Time.CosemDateTime(CosemDate date, CosemTime time, int deviation, CosemDateTime.ClockStatus... clockStatus)
Constructs a a COSEM Date_Time.CosemDateTime(CosemDate date, CosemTime time, CosemDateTime.ClockStatus... clockStatus)
Constructs a a COSEM Date_Time.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CosemDateTime
decode(byte[] octetString)
byte[]
encode()
The octet string.int
get(CosemDateFormat.Field field)
Retrieves the value for a certain value.int
length()
The size of the octet string.
-
-
-
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 to0xFFFF
.month
- the month from 1 to 12. Set to0xFF
if not specified.dayOfMonth
- the day of the month starting from 1 to max 31. Set to0xFE
for the last day of a month and0xFD
for the second last day of a month. Set to0xFF
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
to720
.0x8000
if not specifiedclockStatus
- 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 specifiedclockStatus
- 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 datetime
- the timedeviation
- the deviation in minutes from local time to GMT. From -720 to 720. 0x8000 if not specifiedclockStatus
- 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 datetime
- the timedeviation
- the deviationdeviationTimeUnit
- the unit of the deviation valueclockStatus
- 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 datetime
- the timeclockStatus
- 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 interfaceCosemDateFormat
- Returns:
- the octet string.
-
length
public int length()
Description copied from interface:CosemDateFormat
The size of the octet string.- Specified by:
length
in interfaceCosemDateFormat
- 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 interfaceCosemDateFormat
- Parameters:
field
- the field which should be retrieved.- Returns:
- the value as an int32.
-
-