Module: DjiMqttConnect::Factories::OsdMessages

Included in:
DjiMqttConnect::Factories
Defined in:
lib/dji_mqtt_connect/factories/osd/dock.rb,
lib/dji_mqtt_connect/factories/osd/drone.rb,
lib/dji_mqtt_connect/factories/osd_messages.rb,
lib/dji_mqtt_connect/factories/osd/flight_hub_dock.rb,
lib/dji_mqtt_connect/factories/osd/flight_hub_drone.rb

Instance Method Summary collapse

Instance Method Details



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/dji_mqtt_connect/factories/osd/dock.rb', line 124

def build_thing_product_dock_osd_message_with_link_status
  message_data = {
    drc_state: 0,
    flighttask_prepare_capacity: 1,
    flighttask_step_code: 255,
    media_file_detail: {
      remain_upload: 140
    },
    sdr: {
      down_quality: 0,
      frequency_band: 5.8,
      up_quality: 0
    },
    wireless_link: {
      _4g_freq_band: 2.4,
      _4g_gnd_quality: 0,
      _4g_link_state: 0,
      _4g_quality: 0,
      _4g_uav_quality: 0,
      dongle_number: 0,
      link_workmode: 0,
      sdr_freq_band: 2.4,
      sdr_link_state: 0,
      sdr_quality: 0
    }
  }

  Thing::Product::DockOsdMessage.new(
    tid: Message.generate_tid,
    bid: Message.generate_bid,
    timestamp: Message.current_timestamp,
    gateway: "GATEWAYSN",
    data: message_data,
    _data: message_data
  )
end

#build_thing_product_dock_osd_message_with_maintenance_statusObject



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/dji_mqtt_connect/factories/osd/dock.rb', line 73

def build_thing_product_dock_osd_message_with_maintenance_status
  message_data = {
    job_number: 52,
    acc_time: 146930,
    activation_time: 1682969151,
    maintain_status: {
      maintain_status_array: [
        {
          state: 0,
          last_maintain_type: 17,
          last_maintain_time: 0,
          last_maintain_work_sorties: 0
        }
      ]
    },
    electric_supply_voltage: 0,
    working_voltage: 0,
    working_current: 0,
    backup_battery: {
      voltage: 24365,
      temperature: 32767,
      switch: 1
    },
    drone_battery_maintenance_info: {
      batteries: [
        {
          index: 0,
          capacity_percent: 32767,
          voltage: 32767,
          temperature: 32767
        },
        {
          index: 1,
          capacity_percent: 32767,
          voltage: 32767,
          temperature: 32767
        }
      ]
    }
  }

  Thing::Product::DockOsdMessage.new(
    tid: Message.generate_tid,
    bid: Message.generate_bid,
    timestamp: Message.current_timestamp,
    gateway: "GATEWAYSN",
    data: message_data,
    _data: message_data
  )
end

#build_thing_product_dock_osd_message_with_sub_deviceObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/dji_mqtt_connect/factories/osd/dock.rb', line 5

def build_thing_product_dock_osd_message_with_sub_device
  message_data = {
    network_state: {
      type: 2,
      quality: 0,
      rate: 0.1459999978542328
    },
    drone_charge_state: {
      state: 0,
      capacity_percent: 0
    },
    drone_in_dock: 0,
    rainfall: 1,
    wind_speed: 0,
    environment_temperature: 18.8,
    temperature: 19.6,
    humidity: 58,
    latitude: 0,
    longitude: 0,
    height: 0,
    alternate_land_point: {
      latitude: "-33.865143",
      longitude: "151.209900",
      height: 0,
      safe_land_height: 30,
      is_configured: 0
    },
    first_power_on: 1631945855969,
    position_state: {
      is_calibration: 1,
      is_fixed: 1,
      quality: 1,
      gps_number: 0,
      rtk_number: 0
    },
    storage: {
      total: 82045336,
      used: 56385704
    },
    mode_code: 1,
    cover_state: 1,
    supplement_light_state: 0,
    emergency_stop_state: 0,
    air_conditioner: {
      air_conditioner_state: 32767,
      switch_time: 32767
    },
    battery_store_mode: 2,
    alarm_state: 0,
    putter_state: 1,
    sub_device: {
      device_sn: "M30DRONE01",
      device_model_key: "0-67-0",
      device_online_status: 0,
      device_paired: 0
    }
  }

  Thing::Product::DockOsdMessage.new(
    tid: Message.generate_tid,
    bid: Message.generate_bid,
    timestamp: Message.current_timestamp,
    gateway: "GATEWAYSN",
    data: message_data,
    _data: message_data
  )
end

#build_thing_product_drone_osd_messageObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/dji_mqtt_connect/factories/osd/drone.rb', line 5

def build_thing_product_drone_osd_message
  message_data = {
    attitude_head: 121,
    attitude_pitch: -6.9,
    attitude_roll: 29.7,
    battery: {
      batteries: [
        {
          capacity_percent: 99,
          firmware_version: "08.75.02.17",
          index: 0,
          loop_times: 2,
          sn: "BATTERYSERIAL",
          sub_type: 0,
          temperature: 26.4,
          type: 0,
          voltage: 17260
        }
      ],
      capacity_percent: 99,
      landing_power: 0,
      remain_flight_time: 0,
      return_home_power: 0
    },
    distance_limit_status: {
      distance_limit: 480,
      state: 1
    },
    elevation: 0,
    firmware_version: "05.00.0206",
    gear: 1,
    height: 123.424911,
    height_limit: 0,
    home_distance: 0,
    horizontal_speed: 0,
    latitude: 0,
    longitude: 0,
    mode_code: 0,
    position_state: {
      gps_number: 0,
      is_fixed: 0,
      quality: 0,
      rtk_number: 0
    },
    storage: {
      total: 60097000,
      used: 15189000
    },
    total_flight_distance: 0,
    total_flight_time: 0,
    track_id: "",
    vertical_speed: 0,
    wind_direction: 0,
    wind_speed: 0
  }

  Thing::Product::DroneOsdMessage.new(
    tid: Message.generate_tid,
    bid: Message.generate_bid,
    timestamp: Message.current_timestamp,
    gateway: "GATEWAYSN",
    data: message_data,
    _data: message_data
  )
end

#build_thing_product_flight_hub_dock_osd_messageObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/dji_mqtt_connect/factories/osd/flight_hub_dock.rb', line 5

def build_thing_product_flight_hub_dock_osd_message
  message_data = {
    host: {
      air_conditioner: {
        air_conditioner_state: 0,
        switch_time: 0
      },
      alarm_state: 0,
      alternate_land_point: {
        height: 0,
        is_configured: 1,
        latitude: -33.76867482124178,
        longitude: 150.94983762222526,
        safe_land_height: 30
      },
      battery_store_mode: 2,
      cover_state: 0,
      drone_charge_state: {
        capacity_percent: 95,
        state: 0
      },
      drone_in_dock: 1,
      emergency_stop_state: 0,
      environment_temperature: 24.8,
      first_power_on: 1631945855969,
      heading: 164.2085418701172,
      height: 62.20537567138672,
      home_position_is_valid: 2,
      humidity: 47,
      latitude: -33.768706649492614,
      longitude: 150.9497880000493,
      mode_code: 0,
      network_state: {
        quality: 0,
        rate: 3,
        type: 2
      },
      position_state: {
        gps_number: 6,
        is_calibration: 1,
        is_fixed: 3,
        quality: 5,
        rtk_number: 30
      },
      putter_state: 0,
      rainfall: 0,
      silent_mode: 0,
      storage: {
        total: 53082240,
        used: 14370264
      },
      sub_device: {
        device_online_status: 0,
        device_paired: 1,
        device_sn: "SN000002"
      },
      supplement_light_state: 0,
      temperature: 33.1,
      wind_speed: 0.8
    },
    sn: "SN00001"
  }

  Thing::Product::FlightHubDockOsdMessage.new(
    OrganizationUUID: "b13d0443-4379-461b-b985-18184ffd324d",
    biz_code: "device_osd",
    version: "1.0",
    timestamp: Message.current_timestamp,
    data: message_data,
    _data: message_data
  )
end

#build_thing_product_flight_hub_drone_osd_messageObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/dji_mqtt_connect/factories/osd/flight_hub_drone.rb', line 5

def build_thing_product_flight_hub_drone_osd_message
  message_data = {
    host: {
      activation_time: 1682969151,
      attitude_head: 164.2085418701172,
      attitude_pitch: -2.0999999046325684,
      attitude_roll: 0.30000001192092896,
      battery: {
        batteries: [
          {
            capacity_percent: 95,
            firmware_version: "01.00.0600",
            index: 0,
            loop_times: 27,
            sn: "BATTERY01",
            sub_type: 67,
            temperature: 38,
            type: 2,
            voltage: 24200
          }
        ],
        capacity_percent: 95,
        landing_power: 20,
        remain_flight_time: 19,
        return_home_power: 25
      },
      distance_limit_status: {
        distance_limit: 500,
        is_near_distance_limit: 0,
        state: 1
      },
      elevation: 62.20537567138672,
      firmware_version: "01.00.0600",
      gear: 0,
      height: 62.20537567138672,
      height_limit: 500,
      home_distance: 23.390625,
      horizontal_speed: 0.10000000149011612,
      latitude: -33.768706649492614,
      longitude: 150.9497880000493,
      mode_code: 0,
      position_state: {
        gps_number: 6,
        is_fixed: 3,
        quality: 5,
        rtk_number: 30
      },
      storage: {
        total: 53082240,
        used: 14370264
      },
      total_flight_distance: 1234.5,
      total_flight_time: 146930,
      track_id: nil,
      vertical_speed: -0.30000001192092896,
      wind_direction: 180,
      wind_speed: 0.800000011920929
    },
    sn: "DRONE01"
  }

  Thing::Product::FlightHubDroneOsdMessage.new(
    OrganizationUUID: "b13d0443-4379-461b-b985-18184ffd324d",
    biz_code: "device_osd",
    version: "1.0",
    timestamp: Message.current_timestamp,
    data: message_data,
    _data: message_data
  )
end