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);
}
}
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);
}
}
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);
}
}
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);
}
}
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;
}
Aggregations