use of org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse in project open-smart-grid-platform by OSGP.
the class CommonGetFirmwareRequestMessageProcessor method handleGetFirmwareVersionDeviceResponse.
private void handleGetFirmwareVersionDeviceResponse(final DeviceResponse deviceResponse, final ResponseMessageSender responseMessageSender, final String domain, final String domainVersion, final String messageType, final int retryCount) {
ResponseMessageResultType result = ResponseMessageResultType.OK;
final String firmwareVersion;
OsgpException osgpException = null;
final List<FirmwareVersionDto> firmwareVersions = new ArrayList<>();
try {
final GetFirmwareVersionDeviceResponse response = (GetFirmwareVersionDeviceResponse) deviceResponse;
firmwareVersion = response.getFirmwareVersion();
firmwareVersions.add(new FirmwareVersionDto(FirmwareModuleType.FUNCTIONAL, firmwareVersion));
} catch (final Exception e) {
LOGGER.error("Device Response Exception", e);
result = ResponseMessageResultType.NOT_OK;
osgpException = new TechnicalException(ComponentType.UNKNOWN, "Exception occurred while getting device firmware version", e);
}
final ProtocolResponseMessage responseMessage = ProtocolResponseMessage.newBuilder().messageMetadata(MessageMetadataFactory.from(deviceResponse, messageType).builder().withDomain(domain).withDomainVersion(domainVersion).withRetryCount(retryCount).build()).result(result).osgpException(osgpException).dataObject((Serializable) firmwareVersions).build();
responseMessageSender.send(responseMessage);
}
use of org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse in project open-smart-grid-platform by OSGP.
the class OslpDeviceService method handleOslpResponseGetFirmwareVersion.
private void handleOslpResponseGetFirmwareVersion(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse, final DeviceResponseHandler deviceResponseHandler) {
this.saveOslpResponseLogEntry(deviceRequest, oslpResponse);
this.updateSequenceNumber(deviceRequest.getDeviceIdentification(), oslpResponse);
String firmwareVersion = "";
if (oslpResponse.getPayloadMessage().hasGetFirmwareVersionResponse()) {
firmwareVersion = oslpResponse.getPayloadMessage().getGetFirmwareVersionResponse().getFirmwareVersion();
}
final DeviceResponse deviceResponse = new GetFirmwareVersionDeviceResponse(deviceRequest, firmwareVersion);
deviceResponseHandler.handleResponse(deviceResponse);
}
Aggregations