# frozen_string_literal: true module DjiMqttConnect module Factories::StateMessages ### Gateway Messages ### def build_thing_product_state_message_with_firmware_version message_data = { firmware_version: "10.01.1607", compatible_status: 0, firmware_upgrade_status: 0 } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_live_capacity message_data = { live_capacity: { available_video_number: 3, coexist_video_number_max: 2, device_list: [ { sn: "DOCK01", 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: "DRONE01", 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" ] } ] } ] } ] } } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_live_status message_data = { live_status: [ { video_id: "1581F6QAD242M00BD78G/80-0-0/normal-0", video_type: "wide", video_quality: 0, status: 1, error_status: 0 }, { video_id: "7CTDM2100BQ58L/165-0-7/normal-0", video_type: "normal", video_quality: 0, status: 1, error_status: 0 } ] } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_rtcm_info message_data = { rtcm_info: { host: "192.168.0.1", mount_point: "RTCM3X", port: "2101", rtcm_device_type: 1, source_type: 3 } } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end ### Payload Messages ### def build_thing_product_state_message_with_ar_info_switch message_data = { ar_info_switch: 1 } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_commander_flight_height message_data = { commander_flight_height: 50 } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_commander_flight_mode message_data = { commander_flight_mode: 0 } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_commander_mode_lost_action message_data = { commander_mode_lost_action: 1 } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_current_commander_flight_mode message_data = { current_commander_flight_mode: 0 } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_current_rth_mode message_data = { current_rth_mode: 1 } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_flysafe_database_version message_data = { flysafe_database_version: "01.00.01.35" } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_geo_caging_status message_data = { geo_caging_status: { state: 0 } } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_mode_code_reason message_data = { mode_code_reason: 0 } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_offline_map_enable message_data = { offline_map_enable: true } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_payloads message_data = { payloads: [ { control_source: "A", payload_index: "80-0-0" } ] } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_proudct_state_message_with_rth_mode message_data = { rth_mode: 1 } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_uom_real_name_state message_data = { uom_real_name_state: 11 } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end def build_thing_product_state_message_with_wireless_link_topo message_data = { wireless_link_topo: { center_node: { sdr_id: 836770082, sn: "WIRELESSLINK01" }, leaf_nodes: [{ control_source_index: 1, sdr_id: 961551644, sn: "LEAFNODE01", valid: true }, { control_source_index: 2, sdr_id: 878711578, sn: "LEAFNODE02", valid: true }], secret_code: [0, 0, 0, 0, 1, 0, 0, 0, 126, 180, 137, 135, 192, 229, 237, 97, 34, 58, 71, 58, 139, 30, 218, 120, 160, 254, 117, 250] } } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", need_reply: 1, _data: message_data, data: message_data ) end def build_thing_product_state_message_with_wpmz_version message_data = { wpmz_version: "1.0.6" } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAYSN", _data: message_data, data: message_data ) end end end