Search in sources :

Example 1 with GetConfigurationObjectService

use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.GetConfigurationObjectService in project open-smart-grid-platform by OSGP.

the class SetConfigurationObjectCommandExecutor method execute.

@Override
public AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device, final ConfigurationObjectDto configurationToSet, final MessageMetadata messageMetadata) throws ProtocolAdapterException {
    final Protocol protocol = Protocol.forDevice(device);
    final GetConfigurationObjectService getService = this.protocolServiceLookup.lookupGetService(protocol);
    final ConfigurationObjectDto configurationOnDevice = getService.getConfigurationObject(conn);
    final SetConfigurationObjectService setService = this.protocolServiceLookup.lookupSetService(protocol);
    return setService.setConfigurationObject(conn, configurationToSet, configurationOnDevice);
}
Also used : SetConfigurationObjectService(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.SetConfigurationObjectService) GetConfigurationObjectService(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.GetConfigurationObjectService) ConfigurationObjectDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationObjectDto) Protocol(org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.Protocol)

Example 2 with GetConfigurationObjectService

use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.GetConfigurationObjectService in project open-smart-grid-platform by OSGP.

the class SetRandomisationSettingsCommandExecutor method writeDirectAttach.

private void writeDirectAttach(final DlmsConnectionManager conn, final DlmsDevice device, final boolean directAttach) throws ProtocolAdapterException {
    final Protocol protocol = Protocol.forDevice(device);
    final GetConfigurationObjectService getConfigurationObjectService = this.protocolServiceLookup.lookupGetService(protocol);
    final ConfigurationObjectDto configurationOnDevice = getConfigurationObjectService.getConfigurationObject(conn);
    final SetConfigurationObjectService setService = this.protocolServiceLookup.lookupSetService(protocol);
    final ConfigurationObjectDto configurationToSet = this.createNewConfiguration(directAttach, configurationOnDevice);
    final AccessResultCode result = setService.setConfigurationObject(conn, configurationToSet, configurationOnDevice);
    this.checkResult(result, "directAttach");
}
Also used : SetConfigurationObjectService(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.SetConfigurationObjectService) GetConfigurationObjectService(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.GetConfigurationObjectService) ConfigurationObjectDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationObjectDto) AccessResultCode(org.openmuc.jdlms.AccessResultCode) Protocol(org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.Protocol)

Example 3 with GetConfigurationObjectService

use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.GetConfigurationObjectService in project open-smart-grid-platform by OSGP.

the class SetConfigurationObjectCommandExecutorDsmr4IT method setUp.

@BeforeEach
public void setUp() throws IOException {
    final DlmsHelper dlmsHelper = new DlmsHelper();
    final GetConfigurationObjectService getService = new GetConfigurationObjectServiceDsmr4(dlmsHelper);
    final SetConfigurationObjectService setService = new SetConfigurationObjectServiceDsmr4(dlmsHelper);
    super.setUp(getService, setService);
}
Also used : DlmsHelper(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.utils.DlmsHelper) SetConfigurationObjectService(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.SetConfigurationObjectService) GetConfigurationObjectService(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.GetConfigurationObjectService) GetConfigurationObjectServiceDsmr4(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.GetConfigurationObjectServiceDsmr4) SetConfigurationObjectServiceDsmr4(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.SetConfigurationObjectServiceDsmr4) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with GetConfigurationObjectService

use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.GetConfigurationObjectService in project open-smart-grid-platform by OSGP.

the class SetConfigurationObjectCommandExecutorSmr5IT method setUp.

@BeforeEach
public void setUp() throws IOException {
    final DlmsHelper dlmsHelper = new DlmsHelper();
    final GetConfigurationObjectService getService = new GetConfigurationObjectServiceSmr5(dlmsHelper);
    final SetConfigurationObjectService setService = new SetConfigurationObjectServiceSmr5(dlmsHelper);
    super.setUp(getService, setService);
}
Also used : DlmsHelper(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.utils.DlmsHelper) SetConfigurationObjectService(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.SetConfigurationObjectService) GetConfigurationObjectServiceSmr5(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.GetConfigurationObjectServiceSmr5) GetConfigurationObjectService(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.GetConfigurationObjectService) SetConfigurationObjectServiceSmr5(org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.SetConfigurationObjectServiceSmr5) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

GetConfigurationObjectService (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.GetConfigurationObjectService)4 SetConfigurationObjectService (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.SetConfigurationObjectService)4 BeforeEach (org.junit.jupiter.api.BeforeEach)2 DlmsHelper (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.utils.DlmsHelper)2 Protocol (org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.Protocol)2 ConfigurationObjectDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationObjectDto)2 AccessResultCode (org.openmuc.jdlms.AccessResultCode)1 GetConfigurationObjectServiceDsmr4 (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.GetConfigurationObjectServiceDsmr4)1 GetConfigurationObjectServiceSmr5 (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.GetConfigurationObjectServiceSmr5)1 SetConfigurationObjectServiceDsmr4 (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.SetConfigurationObjectServiceDsmr4)1 SetConfigurationObjectServiceSmr5 (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.configuration.service.SetConfigurationObjectServiceSmr5)1