use of org.opensmartgridplatform.dto.valueobjects.smartmetering.MessageTypeDto 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);
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.MessageTypeDto in project open-smart-grid-platform by OSGP.
the class DlmsHelper method readMessageType.
public MessageTypeDto readMessageType(final DataObject resultData, final String description) throws ProtocolAdapterException {
final Number number = this.readNumber(resultData, description, "Enum");
if (number == null) {
return null;
}
final MessageTypeDto message;
final int enumValue = number.intValue();
switch(enumValue) {
case 0:
message = MessageTypeDto.A_XDR_ENCODED_X_DLMS_APDU;
break;
case 1:
message = MessageTypeDto.XML_ENCODED_X_DLMS_APDU;
break;
default:
if (enumValue < 128 || enumValue > 255) {
LOGGER.error("Unexpected Enum value for MessageType: {}", enumValue);
throw new ProtocolAdapterException("Unknown Enum value for MessageType: " + enumValue);
}
message = MessageTypeDto.MANUFACTURER_SPECIFIC;
}
return message;
}
Aggregations