# frozen_string_literal: true module DjiMqttConnect module Thing::Product # { # "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" # } class StateMessage < DjiMqttConnect::Message attribute :tid, Types::UUID attribute :bid, Types::UUID attribute :timestamp, Types::Timestamp attribute :gateway, Types::String attribute :_data, Types::Hash # NOTE: Included in some state messages, requires a reply on the state_reply topic if true attribute? :need_reply, Types::Integer.enum(0, 1) def need_reply? need_reply == 1 end attribute :data do attribute? :geo_caging_status do attribute :state, Types::Integer end # Not all messages will have a live_capacity attribute attribute? :live_capacity do attribute :available_video_number, Types::Integer attribute :coexist_video_number_max, Types::Integer attribute :device_list, Types::Array do attribute :sn, Types::String attribute :available_video_number, Types::Integer attribute :coexist_video_number_max, Types::Integer attribute :camera_list, Types::Array do attribute :camera_index, Types::String attribute :available_video_number, Types::Integer attribute :coexist_video_number_max, Types::Integer attribute :video_list, Types::Array do attribute :video_index, Types::String attribute :video_type, Types::String attribute :switchable_video_types, Types::Array.of(Types::String) end end end end attribute? :live_status, Types::Array do attribute :video_id, Types::String attribute :video_type, Types::String attribute :video_quality, Types::Integer attribute :status, Types::Integer attribute :error_status, Types::Integer end attribute? :payloads, Types::Array do attribute :control_source, Types::String attribute? :firmware_version, Types::String attribute :payload_index, Types::String attribute? :sn, Types::String end attribute? :rtcm_info do attribute :host, Types::String attribute :mount_point, Types::String attribute :port, Types::String attribute :rtcm_device_type, Types::Integer attribute :source_type, Types::Integer end attribute? :wireless_link_topo do attribute :center_node do attribute :sdr_id, Types::Integer attribute :sn, Types::String end attribute :leaf_nodes, Types::Array do attribute :control_source_index, Types::Integer attribute :sdr_id, Types::Integer attribute :sn, Types::String attribute :valid, Types::Bool end attribute :secret_code, Types::Array.of(Types::Integer) end attribute? :ar_info_switch, Types::Integer attribute? :commander_flight_height, Types::Integer attribute? :commander_flight_mode, Types::Integer attribute? :commander_mode_lost_action, Types::Integer attribute? :control_source, Types::String attribute? :current_commander_flight_mode, Types::Integer attribute? :current_rth_mode, Types::Integer attribute? :flysafe_database_version, Types::String attribute? :home_latitude, Types::Latitude attribute? :home_longitude, Types::Longitude attribute? :locked, Types::Bool attribute? :mode_code_reason, Types::Integer attribute? :offline_map_enable, Types::Bool attribute? :rth_mode, Types::Integer attribute? :uom_real_name_state, Types::Integer attribute? :wpmz_version, Types::String attribute? :low_battery_warning_threshold, Types::Integer attribute? :serious_low_battery_warning_threshold, Types::Integer end end end end