DlmsHelper { public CosemDateTimeDto fromDateTimeValue(final byte[] dateTimeValue) { final ByteBuffer bb = ByteBuffer.wrap(dateTimeValue); final int year = bb.getShort() & 0xFFFF; final int monthOfYear = bb.get() & 0xFF; final int dayOfMonth = bb.get() & 0xFF; final int dayOfWeek = bb.get() & 0xFF; final int hourOfDay = bb.get() & 0xFF; final int minuteOfHour = bb.get() & 0xFF; final int secondOfMinute = bb.get() & 0xFF; final int hundredthsOfSecond = bb.get() & 0xFF; final int deviation = bb.getShort(); final byte clockStatusValue = bb.get(); final CosemDateDto date = new CosemDateDto(year, monthOfYear, dayOfMonth, dayOfWeek); final CosemTimeDto time = new CosemTimeDto(hourOfDay, minuteOfHour, secondOfMinute, hundredthsOfSecond); final ClockStatusDto clockStatus = new ClockStatusDto(clockStatusValue); return new CosemDateTimeDto(date, time, deviation, clockStatus); }  DataObject getAttributeValue(final DlmsConnectionManager conn, final AttributeAddress attributeAddress); List<GetResult> getAndCheck(final DlmsConnectionManager conn, final DlmsDevice device,
            final String description, final AttributeAddress... params); void checkResultList(final List<GetResult> getResultList, final int expectedResults,
            final String description); List<GetResult> getWithList(final DlmsConnectionManager conn, final DlmsDevice device,
            final AttributeAddress... params); DataObject getClockDefinition(); DataObject getAccessSelectionTimeRangeParameter(final DateTime from, final DateTime to,
            final DataObject selectedValues); DlmsMeterValueDto getScaledMeterValue(final GetResult value, final GetResult scalerUnit,
            final String description); DlmsMeterValueDto getScaledMeterValue(final DataObject value, final DataObject scalerUnitObject,
            final String description); DataObject getAMRProfileDefinition(); Long readLong(final GetResult getResult, final String description); Long readLong(final DataObject resultData, final String description); Long readLongNotNull(final GetResult getResult, final String description); Long readLongNotNull(final DataObject resultData, final String description); Integer readInteger(final GetResult getResult, final String description); Short readShort(final GetResult getResult, final String description); DataObject readDataObject(final GetResult getResult, final String description); String readString(final DataObject resultData, final String description); CosemDateTimeDto readDateTime(final GetResult getResult, final String description); CosemDateTimeDto readDateTime(final DataObject resultData, final String description); CosemDateTimeDto convertDataObjectToDateTime(final DataObject object); CosemDateTimeDto fromDateTimeValue(final byte[] dateTimeValue); DataObject asDataObject(final DateTime dateTime); DataObject asDataObject(final DateTime dateTime, final int deviation, final boolean dst); DataObject asDataObject(final CosemDateDto date); List<CosemObjectDefinitionDto> readListOfObjectDefinition(final GetResult getResult,
            final String description); List<CosemObjectDefinitionDto> readListOfObjectDefinition(final DataObject resultData,
            final String description); CosemObjectDefinitionDto readObjectDefinition(final DataObject resultData, final String description); CosemObisCodeDto readLogicalName(final DataObject resultData, final String description); SendDestinationAndMethodDto readSendDestinationAndMethod(final GetResult getResult, final String description); SendDestinationAndMethodDto readSendDestinationAndMethod(final DataObject resultData,
            final String description); TransportServiceTypeDto readTransportServiceType(final DataObject resultData, final String description); MessageTypeDto readMessageType(final DataObject resultData, final String description); List<WindowElementDto> readListOfWindowElement(final GetResult getResult, final String description); List<WindowElementDto> readListOfWindowElement(final DataObject resultData, final String description); WindowElementDto readWindowElement(final DataObject resultData, final String description); String getDebugInfo(final DataObject dataObject); String getDebugInfoByteArray(final byte[] bytes); String getDebugInfoLogicalName(final byte[] logicalNameValue); String getDebugInfoDateTimeBytes(final byte[] dateTimeValue); String getDebugInfoBitStringBytes(final byte[] bitStringValue); void validateBufferedDateTime(final DateTime bufferedDateTime, final DateTime beginDateTime,
            final DateTime endDateTime); static final int MILLISECONDS_PER_MINUTE; }
@Test public void testFromByteArraySummerTime() throws Exception { final CosemDateTimeDto cosemDateTime = this.dlmsHelper.fromDateTimeValue(this.byteArraySummerTime()); assertThat(cosemDateTime.isDateTimeSpecified()).isTrue(); final DateTime dateInSummerTime = cosemDateTime.asDateTime(); assertThat(ISODateTimeFormat.dateTime().print(dateInSummerTime)).isEqualTo("2015-07-21T14:53:07.230+02:00"); }
@Test public void testFromByteArrayWinterTime() throws Exception { final CosemDateTimeDto cosemDateTime = this.dlmsHelper.fromDateTimeValue(this.byteArrayWinterTime()); assertThat(cosemDateTime.isDateTimeSpecified()).isTrue(); final DateTime dateInWinterTime = cosemDateTime.asDateTime(); assertThat(ISODateTimeFormat.dateTime().print(dateInWinterTime)).isEqualTo("2015-02-21T14:53:07.230+01:00"); }
@Test public void testFromByteArrayUnspecifiedTime() throws Exception { final CosemDateTimeDto cosemDateTime = this.dlmsHelper.fromDateTimeValue(this.byteArrayUnspecifiedTime()); assertThat(cosemDateTime.isDateTimeSpecified()).isFalse(); assertThat(cosemDateTime.isLocalDateSpecified()).isFalse(); assertThat(cosemDateTime.isLocalDateTimeSpecified()).isFalse(); assertThat(cosemDateTime.isLocalTimeSpecified()).isFalse(); assertThat(cosemDateTime.isDeviationSpecified()).isFalse(); assertThat(cosemDateTime.asDateTime()).isNull(); }