Class: DjiMqttConnect::Thing::Product::OsdMarshal
- Inherits:
-
MessageMarshal
- Object
- MessageMarshal
- DjiMqttConnect::Thing::Product::OsdMarshal
- Includes:
- Utils::MessageParsing
- Defined in:
- lib/dji_mqtt_connect/marshals/thing/product/osd_marshal.rb
Defined Under Namespace
Classes: OsdTransformer
Instance Method Summary collapse
-
#load(raw_message) ⇒ Object
Parse message from Device > Cloud Server.
Methods inherited from MessageMarshal
Instance Method Details
#load(raw_message) ⇒ Object
Parse message from Device > Cloud Server
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/dji_mqtt_connect/marshals/thing/product/osd_marshal.rb', line 40 def load() = parse_json() = .fetch("data", {}) = if drone_osd_data_attributes.all? { |attribute| .key?(attribute.to_s) } DroneOsdMessage elsif required_remote_osd_data_attributes.all? { |attribute| .key?(attribute.to_s) } && optional_remote_osd_data_attributes.any? { |attribute| .key?(attribute.to_s) } RemoteOsdMessage elsif dock_osd_data_attributes.any? { |attribute| .key?(attribute.to_s) } DockOsdMessage else OsdMessage end = osd_transformer.call() (, ) end |