Search in sources :

Example 11 with CosemDateDto

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);
}
Also used : CosemDateDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemDateDto) CosemTimeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemTimeDto)

Example 12 with CosemDateDto

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);
}
Also used : CosemDateDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemDateDto) ClockStatusDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ClockStatusDto) ByteBuffer(java.nio.ByteBuffer) CosemTimeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemTimeDto) CosemDateTimeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemDateTimeDto)

Aggregations

CosemDateDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemDateDto)12 CosemTimeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemTimeDto)10 Test (org.junit.jupiter.api.Test)5 CosemDate (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemDate)5 ClockStatusDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ClockStatusDto)4 AccessResultCode (org.openmuc.jdlms.AccessResultCode)3 SetParameter (org.openmuc.jdlms.SetParameter)3 ClockStatus (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ClockStatus)3 CosemTime (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemTime)3 ActivityCalendarDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ActivityCalendarDto)3 SpecialDay (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDay)2 SpecialDaysRequest (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequest)2 SpecialDaysRequestData (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequestData)2 SpecialDayDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDayDto)2 SpecialDaysRequestDataDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDaysRequestDataDto)2 SpecialDaysRequestDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDaysRequestDto)2 ByteBuffer (java.nio.ByteBuffer)1 DateTime (org.joda.time.DateTime)1 ClockStatus (org.openmuc.jdlms.datatypes.CosemDateTime.ClockStatus)1 CosemDateTimeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemDateTimeDto)1