Search in sources :

Example 1 with DomainInfo

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;
}
Also used : DomainInfo(org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.DomainInfo) ResponseMetadata(org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.ResponseMetadata)

Example 2 with DomainInfo

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();
}
Also used : MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) DomainInfo(org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.DomainInfo) Iec60870Device(org.opensmartgridplatform.adapter.protocol.iec60870.domain.entities.Iec60870Device) LightSensorStatusDto(org.opensmartgridplatform.dto.valueobjects.LightSensorStatusDto)

Example 3 with DomainInfo

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();
}
Also used : MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) DomainInfo(org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.DomainInfo) Iec60870Device(org.opensmartgridplatform.adapter.protocol.iec60870.domain.entities.Iec60870Device)

Aggregations

DomainInfo (org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.DomainInfo)3 Iec60870Device (org.opensmartgridplatform.adapter.protocol.iec60870.domain.entities.Iec60870Device)2 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)2 ResponseMetadata (org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.ResponseMetadata)1 LightSensorStatusDto (org.opensmartgridplatform.dto.valueobjects.LightSensorStatusDto)1