Search in sources :

Example 6 with ProtocolAdapterException

use of org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException 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 7 with ProtocolAdapterException

use of org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException 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 8 with ProtocolAdapterException

use of org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException 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 9 with ProtocolAdapterException

use of org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException 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)

Example 10 with ProtocolAdapterException

use of org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException in project open-smart-grid-platform by OSGP.

the class DomainHelperService method pollForSession.

private String pollForSession(final SessionProvider sessionProvider, final DlmsDevice dlmsDevice) throws OsgpException {
    String deviceIpAddress = null;
    try {
        for (int i = 0; i < this.jasperGetSessionRetries; i++) {
            Thread.sleep(this.jasperGetSessionSleepBetweenRetries);
            deviceIpAddress = sessionProvider.getIpAddress(dlmsDevice.getIccId());
            if (deviceIpAddress != null) {
                return deviceIpAddress;
            }
        }
    } catch (final InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new ProtocolAdapterException("Interrupted while sleeping before calling the sessionProvider.getIpAddress", e);
    } catch (final SessionProviderException e) {
        throw new ProtocolAdapterException("", e);
    }
    return deviceIpAddress;
}
Also used : ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException) SessionProviderException(org.opensmartgridplatform.adapter.protocol.jasper.sessionproviders.exceptions.SessionProviderException)

Aggregations

ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException)95 DataObject (org.openmuc.jdlms.datatypes.DataObject)32 Test (org.junit.jupiter.api.Test)22 AccessResultCode (org.openmuc.jdlms.AccessResultCode)15 GetResult (org.openmuc.jdlms.GetResult)15 AttributeAddress (org.openmuc.jdlms.AttributeAddress)14 IOException (java.io.IOException)12 ArrayList (java.util.ArrayList)10 DlmsDevice (org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice)9 ConnectionException (org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ConnectionException)9 BitString (org.openmuc.jdlms.datatypes.BitString)7 CosemDateTimeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemDateTimeDto)7 ObisCode (org.openmuc.jdlms.ObisCode)6 SetParameter (org.openmuc.jdlms.SetParameter)5 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)5 DateTime (org.joda.time.DateTime)4 DlmsObjectType (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.DlmsObjectType)4 ConfigurationFlagsDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ConfigurationFlagsDto)4 Date (java.util.Date)3 List (java.util.List)3