use of org.openmuc.jdlms.SetParameter in project open-smart-grid-platform by OSGP.
the class ClearMBusStatusOnAllChannelsCommandExecutor method setClearStatusMask.
private AccessResultCode setClearStatusMask(final long statusMask, final DlmsConnectionManager conn, final Integer channel, final AttributeAddress attributeAddress) throws IOException {
final SetParameter parameter = new SetParameter(attributeAddress, DataObject.newUInteger32Data(statusMask));
conn.getDlmsMessageListener().setDescription("ClearMBusStatusOnAllChannels-setClearStatusMask for channel" + channel + " - writing status mask " + JdlmsObjectToStringUtil.describeAttributes(attributeAddress));
log.info("Writing clear status mask {} for M-Bus channel {} with attributeAddress: {}.", statusMask, channel, attributeAddress);
return conn.getConnection().set(parameter);
}
use of org.openmuc.jdlms.SetParameter in project open-smart-grid-platform by OSGP.
the class SetAlarmNotificationsCommandExecutor method writeUpdatedAlarmNotifications.
private AccessResultCode writeUpdatedAlarmNotifications(final DlmsConnectionManager conn, final long alarmFilterLongValue, final AttributeAddress alarmFilterValue) throws IOException {
final DataObject value = DataObject.newUInteger32Data(alarmFilterLongValue);
final SetParameter setParameter = new SetParameter(alarmFilterValue, value);
conn.getDlmsMessageListener().setDescription("SetAlarmNotifications write updated value " + alarmFilterLongValue + ", set attribute: " + JdlmsObjectToStringUtil.describeAttributes(alarmFilterValue));
return conn.getConnection().set(setParameter);
}
use of org.openmuc.jdlms.SetParameter in project open-smart-grid-platform by OSGP.
the class SetClockConfigurationCommandExecutor method execute.
@Override
public Void execute(final DlmsConnectionManager conn, final DlmsDevice device, final SetClockConfigurationRequestDto object, final MessageMetadata messageMetadata) throws ProtocolAdapterException {
this.dlmsLogWrite(conn, ATTRIBUTE_TIME_ZONE);
this.writeAttribute(conn, new SetParameter(ATTRIBUTE_TIME_ZONE, DataObject.newInteger16Data(object.getTimeZoneOffset())), "Timezone");
final CosemDateTime daylightSavingsBegin = this.configurationMapper.map(object.getDaylightSavingsBegin(), CosemDateTime.class);
this.dlmsLogWrite(conn, ATTRIBUTE_DAYLIGHT_SAVINGS_BEGIN);
this.writeAttribute(conn, new SetParameter(ATTRIBUTE_DAYLIGHT_SAVINGS_BEGIN, DataObject.newOctetStringData(daylightSavingsBegin.encode())), "Daylight savings begin");
final CosemDateTime daylightSavingsEnd = this.configurationMapper.map(object.getDaylightSavingsEnd(), CosemDateTime.class);
this.dlmsLogWrite(conn, ATTRIBUTE_DAYLIGHT_SAVINGS_END);
this.writeAttribute(conn, new SetParameter(ATTRIBUTE_DAYLIGHT_SAVINGS_END, DataObject.newOctetStringData(daylightSavingsEnd.encode())), "Daylight savinds end");
this.dlmsLogWrite(conn, ATTRIBUTE_DAYLIGHT_SAVINGS_ENABLED);
this.writeAttribute(conn, new SetParameter(ATTRIBUTE_DAYLIGHT_SAVINGS_ENABLED, DataObject.newBoolData(object.isDaylightSavingsEnabled())), "Daylight savings enabled");
return null;
}
use of org.openmuc.jdlms.SetParameter in project open-smart-grid-platform by OSGP.
the class ClearMBusStatusOnAllChannelsCommandExecutorTest method assertClearStatus.
private void assertClearStatus(final List<SetParameter> setParameters) {
for (int i = 1; i <= 4; i++) {
final SetParameter setParameter = setParameters.get(i - 1);
assertThat(((Number) setParameter.getData().getValue()).longValue()).isEqualTo(STATUS_MASK);
final AttributeAddress attributeAddress = setParameter.getAttributeAddress();
assertThat(attributeAddress.getInstanceId().asDecimalString()).isEqualTo(OBIS_CODE_TEMPLATE_CLEAR_STATUS.replaceAll("<c>", String.valueOf(i)));
assertThat(attributeAddress.getClassId()).isEqualTo(CLASS_ID_CLEAR_STATUS);
}
}
use of org.openmuc.jdlms.SetParameter in project open-smart-grid-platform by OSGP.
the class ConfigureDefinableLoadProfileCommandExecutor method writeCapturePeriod.
private void writeCapturePeriod(final DlmsConnectionManager conn, final long capturePeriod) throws ProtocolAdapterException {
this.dlmsLogWrite(conn, ATTRIBUTE_CAPTURE_PERIOD, ATTRIBUTE_NAME_CAPTURE_PERIOD);
this.writeAttribute(conn, new SetParameter(ATTRIBUTE_CAPTURE_PERIOD, DataObject.newUInteger32Data(capturePeriod)), ATTRIBUTE_NAME_CAPTURE_PERIOD);
}
Aggregations