Class: DjiMqttConnect::Thing::Product::StateMessage

Inherits:
Message
  • Object
show all
Defined in:
lib/dji_mqtt_connect/messages/thing/product/state_message.rb

Overview

{ "bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx", "tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx", "data": { "live_capacity": { "available_video_number": 3, "coexist_video_number_max": 2, "device_list": [ { "sn": "4BKBJ4R1010TGD", "available_video_number": 1, "coexist_video_number_max": 1, "camera_list": [ { "camera_index": "165-0-7", "available_video_number": 1, "coexist_video_number_max": 1, "video_list": [ { "video_index": "normal-0", "video_type": "normal", "switchable_video_types": [ "normal" ] } ] } ] }, { "sn": "1581F4BND22180040075", "available_video_number": 2, "coexist_video_number_max": 2, "camera_list": [ { "camera_index": "39-0-7", "available_video_number": 1, "coexist_video_number_max": 1, "video_list": [ { "video_index": "normal-0", "video_type": "normal", "switchable_video_types": [ "normal" ] } ] }, { "camera_index": "52-0-0", "available_video_number": 1, "coexist_video_number_max": 1, "video_list": [ { "video_index": "normal-0", "video_type": "wide", "switchable_video_types": [ "wide", "zoom", "ir" ] } ] } ] } ] } }, "timestamp:": 1654070968655, "gateway": "4BKBJ4R1010TGD" }

Instance Method Summary collapse

Methods inherited from Message

current_timestamp, generate_bid, generate_tid, #to_s

Instance Method Details

#humanized_summaryObject



283
284
285
# File 'lib/dji_mqtt_connect/messages/thing/product/state_message.rb', line 283

def humanized_summary
  Translations.thing_product_state_summary(**humanized_summary_interpolation)
end

#humanized_summary_interpolationObject



287
288
289
290
291
292
# File 'lib/dji_mqtt_connect/messages/thing/product/state_message.rb', line 287

def humanized_summary_interpolation
  data.to_h.merge(
    # Provides a list of all keys that are not nil or empty
    topics: data.to_h.compact.keys.sort.join(", ").presence || "-"
  )
end

#need_reply?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/dji_mqtt_connect/messages/thing/product/state_message.rb', line 90

def need_reply?
  need_reply == 1
end