Search in sources :

Example 1 with TransportServiceTypeDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.TransportServiceTypeDto in project open-smart-grid-platform by OSGP.

the class DlmsHelper method readSendDestinationAndMethod.

public SendDestinationAndMethodDto readSendDestinationAndMethod(final DataObject resultData, final String description) throws ProtocolAdapterException {
    final List<DataObject> sendDestinationAndMethodElements = this.readList(resultData, description);
    if (sendDestinationAndMethodElements == null) {
        return null;
    }
    final TransportServiceTypeDto transportService = this.readTransportServiceType(sendDestinationAndMethodElements.get(0), "Transport Service from " + description);
    final String destination = this.readString(sendDestinationAndMethodElements.get(1), "Destination from " + description);
    final MessageTypeDto message = this.readMessageType(sendDestinationAndMethodElements.get(2), "Message from " + description);
    return new SendDestinationAndMethodDto(transportService, destination, message);
}
Also used : SendDestinationAndMethodDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SendDestinationAndMethodDto) DataObject(org.openmuc.jdlms.datatypes.DataObject) TransportServiceTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.TransportServiceTypeDto) BitString(org.openmuc.jdlms.datatypes.BitString) MessageTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.MessageTypeDto)

Example 2 with TransportServiceTypeDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.TransportServiceTypeDto in project open-smart-grid-platform by OSGP.

the class DlmsHelper method readTransportServiceType.

public TransportServiceTypeDto readTransportServiceType(final DataObject resultData, final String description) throws ProtocolAdapterException {
    final Number number = this.readNumber(resultData, description, "Enum");
    if (number == null) {
        return null;
    }
    final int enumValue = number.intValue();
    final TransportServiceTypeDto transportService = this.getTransportServiceTypeForEnumValue(enumValue);
    if (transportService == null) {
        LOGGER.error("Unexpected Enum value for TransportServiceType: {}", enumValue);
        throw new ProtocolAdapterException("Unknown Enum value for TransportServiceType: " + enumValue);
    }
    return transportService;
}
Also used : TransportServiceTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.TransportServiceTypeDto) ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException)

Aggregations

TransportServiceTypeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.TransportServiceTypeDto)2 BitString (org.openmuc.jdlms.datatypes.BitString)1 DataObject (org.openmuc.jdlms.datatypes.DataObject)1 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException)1 MessageTypeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.MessageTypeDto)1 SendDestinationAndMethodDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.SendDestinationAndMethodDto)1