Search in sources :

Example 21 with SetParameter

use of org.openmuc.jdlms.SetParameter in project open-smart-grid-platform by OSGP.

the class SetPushSetupAlarmCommandExecutor method getSetParameterPushObjectList.

private SetParameter getSetParameterPushObjectList(final PushSetupAlarmDto pushSetupAlarm) {
    final AttributeAddress pushObjectListAddress = new AttributeAddress(CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_PUSH_OBJECT_LIST);
    final DataObject value = DataObject.newArrayData(this.pushSetupMapper.mapAsList(pushSetupAlarm.getPushObjectList(), DataObject.class));
    return new SetParameter(pushObjectListAddress, value);
}
Also used : DataObject(org.openmuc.jdlms.datatypes.DataObject) AttributeAddress(org.openmuc.jdlms.AttributeAddress) SetParameter(org.openmuc.jdlms.SetParameter)

Example 22 with SetParameter

use of org.openmuc.jdlms.SetParameter in project open-smart-grid-platform by OSGP.

the class SetPushSetupAlarmCommandExecutor method setSendDestinationAndMethod.

private AccessResultCode setSendDestinationAndMethod(final DlmsConnectionManager conn, final PushSetupAlarmDto pushSetupAlarm) throws ProtocolAdapterException {
    LOGGER.info("Setting Send destination and method of Push Setup Alarm: {}", pushSetupAlarm.getSendDestinationAndMethod());
    final SetParameter setParameterSendDestinationAndMethod = this.getSetParameterSendDestinationAndMethod(pushSetupAlarm);
    final AccessResultCode resultCode = this.doSetRequest("PushSetupAlarm, Send destination and method", conn, setParameterSendDestinationAndMethod);
    if (resultCode != null) {
        return resultCode;
    } else {
        throw new ProtocolAdapterException("Error setting Alarm push setup data (destination and method.");
    }
}
Also used : AccessResultCode(org.openmuc.jdlms.AccessResultCode) ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException) SetParameter(org.openmuc.jdlms.SetParameter)

Example 23 with SetParameter

use of org.openmuc.jdlms.SetParameter in project open-smart-grid-platform by OSGP.

the class SetPushSetupAlarmCommandExecutor method setPushObjectList.

private AccessResultCode setPushObjectList(final DlmsConnectionManager conn, final PushSetupAlarmDto pushSetupAlarm) throws ProtocolAdapterException {
    LOGGER.info("Setting Push Object List of Push Setup Alarm: {}", pushSetupAlarm.getPushObjectList());
    // Before setting the push object list, verify if the objects in the list are really present in
    // the meter
    this.verifyPushObjects(pushSetupAlarm.getPushObjectList(), conn);
    final SetParameter setParameterPushObjectList = this.getSetParameterPushObjectList(pushSetupAlarm);
    final AccessResultCode resultCode = this.doSetRequest("PushSetupAlarm, push object list", conn, setParameterPushObjectList);
    if (resultCode != null) {
        return resultCode;
    } else {
        throw new ProtocolAdapterException("Error setting Alarm push setup data (push object list).");
    }
}
Also used : AccessResultCode(org.openmuc.jdlms.AccessResultCode) ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException) SetParameter(org.openmuc.jdlms.SetParameter)

Example 24 with SetParameter

use of org.openmuc.jdlms.SetParameter in project open-smart-grid-platform by OSGP.

the class SetPushSetupAlarmCommandExecutor method getSetParameterSendDestinationAndMethod.

private SetParameter getSetParameterSendDestinationAndMethod(final PushSetupAlarmDto pushSetupAlarm) {
    final AttributeAddress sendDestinationAndMethodAddress = new AttributeAddress(CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_SEND_DESTINATION_AND_METHOD);
    final DataObject value = this.pushSetupMapper.map(pushSetupAlarm.getSendDestinationAndMethod(), DataObject.class);
    return new SetParameter(sendDestinationAndMethodAddress, value);
}
Also used : DataObject(org.openmuc.jdlms.datatypes.DataObject) AttributeAddress(org.openmuc.jdlms.AttributeAddress) SetParameter(org.openmuc.jdlms.SetParameter)

Example 25 with SetParameter

use of org.openmuc.jdlms.SetParameter in project open-smart-grid-platform by OSGP.

the class SetPushSetupSmsCommandExecutor method getSetParameter.

private SetParameter getSetParameter(final PushSetupSmsDto pushSetupSms) throws ProtocolAdapterException {
    this.checkPushSetupSms(pushSetupSms);
    final AttributeAddress sendDestinationAndMethodAddress = new AttributeAddress(CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_SEND_DESTINATION_AND_METHOD);
    final DataObject value = this.pushSetupMapper.map(pushSetupSms.getSendDestinationAndMethod(), DataObject.class);
    return new SetParameter(sendDestinationAndMethodAddress, value);
}
Also used : DataObject(org.openmuc.jdlms.datatypes.DataObject) AttributeAddress(org.openmuc.jdlms.AttributeAddress) SetParameter(org.openmuc.jdlms.SetParameter)

Aggregations

SetParameter (org.openmuc.jdlms.SetParameter)31 AttributeAddress (org.openmuc.jdlms.AttributeAddress)14 DataObject (org.openmuc.jdlms.datatypes.DataObject)12 AccessResultCode (org.openmuc.jdlms.AccessResultCode)11 Test (org.junit.jupiter.api.Test)7 IOException (java.io.IOException)5 ConnectionException (org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ConnectionException)4 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException)4 ActivityCalendarDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ActivityCalendarDto)4 DlmsDevice (org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice)3 CosemDateDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemDateDto)3 CosemTimeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemTimeDto)3 PushSetupAlarmDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.PushSetupAlarmDto)3 GetResultImpl (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.testutil.GetResultImpl)2 ArrayList (java.util.ArrayList)1 DateTime (org.joda.time.DateTime)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 CosemDateTime (org.openmuc.jdlms.datatypes.CosemDateTime)1 DlmsObjectConfigConfiguration (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.DlmsObjectConfigConfiguration)1 DlmsObjectConfigService (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.DlmsObjectConfigService)1