public class CosemDateTime extends java.lang.Object implements CosemDateFormat
Modifier and Type | Class and Description |
---|---|
static class |
CosemDateTime.ClockStatus |
CosemDateFormat.Field
Constructor and Description |
---|
CosemDateTime(CosemDate date,
CosemTime time,
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,
int deviation,
java.util.concurrent.TimeUnit deviationTimeUnit,
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(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.
|
Modifier and Type | Method and 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.
|
java.util.Calendar |
toCalendar()
Converts the COSEM DATE/TIME to a
Calendar . |
public CosemDateTime(int year, int month, int dayOfMonth, int hour, int minute, int second, int deviation, CosemDateTime.ClockStatus... clockStatus)
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 specifiedclockStatus
- the clock status flagsjava.lang.IllegalArgumentException
- if a parameter does not fit the rangepublic CosemDateTime(int year, int month, int dayOfMonth, int dayOfWeek, int hour, int minute, int second, int hundredths, int deviation, CosemDateTime.ClockStatus... clockStatus)
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 flagsjava.lang.IllegalArgumentException
- if a parameter does not fit the rangepublic CosemDateTime(CosemDate date, CosemTime time, int deviation, CosemDateTime.ClockStatus... clockStatus)
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 flagsjava.lang.IllegalArgumentException
- if a parameter does not fit the rangepublic CosemDateTime(CosemDate date, CosemTime time, int deviation, java.util.concurrent.TimeUnit deviationTimeUnit, CosemDateTime.ClockStatus... clockStatus)
date
- the datetime
- the timedeviation
- the deviationdeviationTimeUnit
- the unit of the deviation valueclockStatus
- the clock status flagsjava.lang.IllegalArgumentException
- if a parameter does not fit the rangepublic CosemDateTime(CosemDate date, CosemTime time, CosemDateTime.ClockStatus... clockStatus)
date
- the datetime
- the timeclockStatus
- the clock status flagsjava.lang.IllegalArgumentException
- if a parameter does not fit the rangepublic static CosemDateTime decode(byte[] octetString)
public byte[] encode()
CosemDateFormat
encode
in interface CosemDateFormat
public java.util.Calendar toCalendar()
CosemDateFormat
Calendar
.toCalendar
in interface CosemDateFormat
public int length()
CosemDateFormat
length
in interface CosemDateFormat
public int get(CosemDateFormat.Field field)
CosemDateFormat
get
in interface CosemDateFormat
field
- the field which should be retrieved.