Search in sources :

Example 1 with AccessResultCode

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

the class ConfigurationService method setSpecialDays.

public void setSpecialDays(final DlmsConnectionManager conn, final DlmsDevice device, final SpecialDaysRequestDto specialDaysRequest, final MessageMetadata messageMetadata) throws ProtocolAdapterException {
    // The Special days towards the Smart Meter
    final SpecialDaysRequestDataDto specialDaysRequestData = specialDaysRequest.getSpecialDaysRequestData();
    LOGGER.info(VISUAL_SEPARATOR);
    LOGGER.info("********** Set Special Days: 0-0:11.0.0.255 **********");
    LOGGER.info(VISUAL_SEPARATOR);
    final List<SpecialDayDto> specialDays = specialDaysRequestData.getSpecialDays();
    for (final SpecialDayDto specialDay : specialDays) {
        LOGGER.info("Date :{}, dayId : {} ", specialDay.getSpecialDayDate(), specialDay.getDayId());
    }
    LOGGER.info(VISUAL_SEPARATOR);
    final AccessResultCode accessResultCode = this.setSpecialDaysCommandExecutor.execute(conn, device, specialDays, messageMetadata);
    if (!AccessResultCode.SUCCESS.equals(accessResultCode)) {
        throw new ProtocolAdapterException("Set special days reported result is: " + accessResultCode);
    }
}
Also used : AccessResultCode(org.openmuc.jdlms.AccessResultCode) ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException) SpecialDayDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDayDto) SpecialDaysRequestDataDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDaysRequestDataDto)

Example 2 with AccessResultCode

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

the class ConfigurationService method requestSetAdministrativeStatus.

public void requestSetAdministrativeStatus(final DlmsConnectionManager conn, final DlmsDevice device, final AdministrativeStatusTypeDto administrativeStatusType, final MessageMetadata messageMetadata) throws ProtocolAdapterException {
    LOGGER.info("Device for Set Administrative Status is: {}", device);
    final AccessResultCode accessResultCode = this.setAdministrativeStatusCommandExecutor.execute(conn, device, administrativeStatusType, messageMetadata);
    if (AccessResultCode.SUCCESS != accessResultCode) {
        throw new ProtocolAdapterException("AccessResultCode for set administrative status was not SUCCESS: " + accessResultCode);
    }
}
Also used : AccessResultCode(org.openmuc.jdlms.AccessResultCode) ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException)

Example 3 with AccessResultCode

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

the class ConfigurationService method setPushSetupAlarm.

public void setPushSetupAlarm(final DlmsConnectionManager conn, final DlmsDevice device, final PushSetupAlarmDto pushSetupAlarm, final MessageMetadata messageMetadata) throws ProtocolAdapterException {
    LOGGER.info("Push Setup Alarm to set on the device: {}", pushSetupAlarm);
    final AccessResultCode accessResultCode = this.setPushSetupAlarmCommandExecutor.execute(conn, device, pushSetupAlarm, messageMetadata);
    if (AccessResultCode.SUCCESS != accessResultCode) {
        throw new ProtocolAdapterException("AccessResultCode for set push setup alarm was not SUCCESS: " + accessResultCode);
    }
}
Also used : AccessResultCode(org.openmuc.jdlms.AccessResultCode) ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException)

Example 4 with AccessResultCode

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

the class ConfigurationService method setPushSetupSms.

public void setPushSetupSms(final DlmsConnectionManager conn, final DlmsDevice device, final PushSetupSmsDto pushSetupSms, final MessageMetadata messageMetadata) throws ProtocolAdapterException {
    LOGGER.info("Push Setup Sms to set on the device: {}", pushSetupSms);
    final AccessResultCode accessResultCode = this.setPushSetupSmsCommandExecutor.execute(conn, device, pushSetupSms, messageMetadata);
    if (AccessResultCode.SUCCESS != accessResultCode) {
        throw new ProtocolAdapterException("AccessResultCode for set push setup sms was not SUCCESS: " + accessResultCode);
    }
}
Also used : AccessResultCode(org.openmuc.jdlms.AccessResultCode) ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException)

Example 5 with AccessResultCode

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

the class ConfigurationService method requestSetConfiguration.

// === REQUEST Configuration Object DATA ===
public void requestSetConfiguration(final DlmsConnectionManager conn, final DlmsDevice device, final SetConfigurationObjectRequestDto setConfigurationObjectRequest, final MessageMetadata messageMetadata) throws ProtocolAdapterException {
    // Configuration Object towards the Smart Meter
    final ConfigurationObjectDto configurationObject = setConfigurationObjectRequest.getSetConfigurationObjectRequestData().getConfigurationObject();
    final GprsOperationModeTypeDto gprsOperationModeType = configurationObject.getGprsOperationMode();
    final ConfigurationFlagsDto configurationFlags = configurationObject.getConfigurationFlags();
    LOGGER.info(VISUAL_SEPARATOR);
    LOGGER.info("******** Configuration Object: 0-1:94.31.3.255 *******");
    LOGGER.info(VISUAL_SEPARATOR);
    LOGGER.info("Operation mode: {}", gprsOperationModeType == null ? "not altered by this request" : gprsOperationModeType);
    if (configurationFlags == null) {
        LOGGER.info("Flags: none enabled or disabled by this request");
    } else {
        LOGGER.info("{}", configurationFlags);
    }
    LOGGER.info(VISUAL_SEPARATOR);
    final AccessResultCode accessResultCode = this.setConfigurationObjectCommandExecutor.execute(conn, device, configurationObject, messageMetadata);
    if (!AccessResultCode.SUCCESS.equals(accessResultCode)) {
        throw new ProtocolAdapterException("Set configuration object reported result is: " + accessResultCode);
    }
}
Also used : GprsOperationModeTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GprsOperationModeTypeDto) ConfigurationFlagsDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationFlagsDto) ConfigurationObjectDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationObjectDto) AccessResultCode(org.openmuc.jdlms.AccessResultCode) ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException)

Aggregations

AccessResultCode (org.openmuc.jdlms.AccessResultCode)36 Test (org.junit.jupiter.api.Test)16 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException)14 SetParameter (org.openmuc.jdlms.SetParameter)12 AttributeAddress (org.openmuc.jdlms.AttributeAddress)7 DlmsDevice (org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice)6 AlarmNotificationDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.AlarmNotificationDto)5 IOException (java.io.IOException)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 ActivityCalendarDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ActivityCalendarDto)4 ConfigurationObjectDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationObjectDto)4 BitString (org.openmuc.jdlms.datatypes.BitString)3 DataObject (org.openmuc.jdlms.datatypes.DataObject)3 ConnectionException (org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ConnectionException)3 CosemDateDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemDateDto)3 CosemTimeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemTimeDto)3 GprsOperationModeTypeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.GprsOperationModeTypeDto)3 PushSetupAlarmDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.PushSetupAlarmDto)3 GetResult (org.openmuc.jdlms.GetResult)2 GetResultImpl (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.testutil.GetResultImpl)2