use of org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.DomainInfo in project open-smart-grid-platform by OSGP.
the class ConnectionSteps method initResponseMetadata.
private ResponseMetadata initResponseMetadata(final String deviceIdentification, final DeviceType deviceType) throws Exception {
final DomainInfo domainInfo = DomainInfoFactory.forDeviceType(deviceType);
// Make sure the connection event listener works as expected
final ResponseMetadata responseMetadata = new ResponseMetadata.Builder().withDeviceIdentification(deviceIdentification).withDeviceType(deviceType).withOrganisationIdentification(DEFAULT_ORGANISATION_IDENTIFICATION).withDomainInfo(domainInfo).withMessageType(DEFAULT_MESSAGE_TYPE).build();
return responseMetadata;
}
use of org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.DomainInfo in project open-smart-grid-platform by OSGP.
the class OsgpCoreResponseSteps method protocolResponseMessage.
private ProtocolResponseMessage protocolResponseMessage(final Map<String, String> map) {
final String deviceIdentification = map.get("device_identification");
final Iec60870Device device = this.deviceSteps.getDevice(deviceIdentification).orElse(null);
final DomainInfo domainInfo = DomainInfoFactory.forDeviceType(device.getDeviceType());
final MessageMetadata deviceMessageMetadata = new MessageMetadata.Builder().withDeviceIdentification(deviceIdentification).withMessageType(MessageType.GET_LIGHT_SENSOR_STATUS.name()).withDomain(domainInfo.getDomain()).withDomainVersion(domainInfo.getDomainVersion()).build();
return ProtocolResponseMessage.newBuilder().messageMetadata(deviceMessageMetadata).dataObject(new LightSensorStatusDto(LightSensorStatusTypeDto.valueOf(map.get("status")))).result(ResponseMessageResultType.OK).build();
}
use of org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.DomainInfo in project open-smart-grid-platform by OSGP.
the class OsgpCoreResponseSteps method connectResponseMessage.
private ProtocolResponseMessage connectResponseMessage(final Map<String, String> map) {
final String deviceIdentification = map.get("device_identification");
final Iec60870Device device = this.deviceSteps.getDevice(deviceIdentification).orElse(null);
final DomainInfo domainInfo = DomainInfoFactory.forDeviceType(device.getDeviceType());
final MessageMetadata deviceMessageMetadata = new MessageMetadata.Builder().withDeviceIdentification(deviceIdentification).withMessageType(MessageType.CONNECT.name()).withDomain(domainInfo.getDomain()).withDomainVersion(domainInfo.getDomainVersion()).build();
return ProtocolResponseMessage.newBuilder().messageMetadata(deviceMessageMetadata).result(ResponseMessageResultType.OK).build();
}
Aggregations