use of org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemDateDto in project open-smart-grid-platform by OSGP.
the class SetActivityCalendarCommandExecutorTest method createDefaultActivityCalendar.
private ActivityCalendarDto createDefaultActivityCalendar() {
final List<Short> dayIds = Collections.singletonList((short) 1);
final List<CosemTimeDto> actionStartTimes = Collections.singletonList(new CosemTimeDto(0, 0, 0, 0));
final List<String> weekNames = Collections.singletonList("1");
final List<String> seasonNames = Collections.singletonList("1");
final List<CosemDateDto> seasonStarts = Collections.singletonList(new CosemDateDto(0xFFFF, 1, 1));
return this.createActivityCalendar(seasonNames, seasonStarts, weekNames, dayIds, actionStartTimes);
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemDateDto in project open-smart-grid-platform by OSGP.
the class DlmsHelper method fromDateTimeValue.
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);
}
Aggregations