deserializePPT method
Converts a uint8 JSON message into a PPT Payload Object
Implementation
@override
PPTPayload? deserializePPT(Uint8List binPayload) {
var messageStr = Utf8Decoder().convert(binPayload);
Object? decodedObject = json.decode(messageStr);
if (decodedObject is Map) {
final arguments = _normalizeJsonPayloadFragment(decodedObject['args']);
final argumentsKeywords = _normalizeJsonPayloadFragment(
decodedObject['kwargs'],
);
return PPTPayload(
arguments: arguments is List ? arguments.cast<dynamic>() : null,
argumentsKeywords: argumentsKeywords is Map
? argumentsKeywords.cast<String, dynamic>()
: null,
);
}
_logger.shout('Could not deserialize the message: $messageStr');
// TODO respond with an error
return null;
}