dji_mqtt_connect 0.1.37.7 → 0.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 127fe0fe90647f78ce5a4780c73fb368650d20799473278a45a42dbff11efd82
4
- data.tar.gz: d9b6dc615e7cdd91760855f3627279af8a16c3f13044e8a324863ae461a0214a
3
+ metadata.gz: 55c8dc51144cdcf112ccb8d29d06928ddacf65ffffdd860bde73f5271a7f155c
4
+ data.tar.gz: 63c5bebcc5c5f404b77e570533e9c588c06438096b1e64f70d2ac9dff49cc439
5
5
  SHA512:
6
- metadata.gz: 9effc40fa3053a2c504a926d9d716e442ca2250e5b9d052ad7043a013d4ead122dc3055514df4bd2424fa1866a8ab5f78ba3e6c82dc0ea2f0bbf524e7174deed
7
- data.tar.gz: a7fcf77dac18d9b483a0ebffcfd9a809d4b594479ce685acd2744a2e0301c9039368ea25488c950d68a2e395265508f1ffa6b1ba4b983b3cbb0135ccfb053b26
6
+ metadata.gz: 85bdec67ccac88efb1bf43d96f708a16a886c46efdd70c12505b3cb22814825d85f024cb61ee2f3223b99f50067a5359920c03bf3c52414910782574e5abda01
7
+ data.tar.gz: 3ce5493b1afd6bc2d08ae8128ca4a35fe4ed30dea1ce868b34021be5dbb8b66ef949c7c07e7f01b6d2ffab96905d2a29c83302c4cbe9f7091daa9a7d6526fdf6
@@ -13,6 +13,16 @@ module DjiMqttConnect
13
13
  import Dry::Transformer::Conditional
14
14
  import Dry::Transformer::HashTransformations
15
15
 
16
+ # Drones report each payload's state in a block keyed by its payload index, i.e. "53-0-0",
17
+ # these are gathered into a payloads list, as the keys differ for every payload
18
+ COLLECT_PAYLOADS = lambda do |data|
19
+ payloads = data.filter_map do |key, value|
20
+ value.merge("payload_index" => key) if Types::PayloadIndex.valid?(key) && value.is_a?(Hash)
21
+ end
22
+
23
+ payloads.empty? ? data : data.merge("payloads" => payloads)
24
+ end
25
+
16
26
  define! do
17
27
  # Ensure there is a data element
18
28
  map_value "data", ->(data) { data || {} }
@@ -20,6 +30,8 @@ module DjiMqttConnect
20
30
  # Create a backup for unsupported attributes
21
31
  copy_keys "data" => "_data"
22
32
 
33
+ map_value "data", COLLECT_PAYLOADS
34
+
23
35
  map_value "data" do
24
36
  # Rename the invalid (for Ruby) wireless link attributes
25
37
  guard ->(data) { data.key?("wireless_link") } do
@@ -42,6 +54,8 @@ module DjiMqttConnect
42
54
 
43
55
  # FlightHub Dock messages have a host attribute
44
56
  guard ->(data) { data.key?("host") } do
57
+ map_value "host", COLLECT_PAYLOADS
58
+
45
59
  map_value "host" do
46
60
  # Dock 3 sends tilt_angle as a bare value, with validity in tilt_valid_flag
47
61
  # i.e. "tilt_angle":0.18,"tilt_valid_flag":1
@@ -25,8 +25,14 @@ module DjiMqttConnect
25
25
 
26
26
  attribute :remaining_time, Types::JSON::Decimal
27
27
 
28
- # {"task_finish":"One-key takeoff mission completed","task_ready":"Ready for takeoff","takeoff_prepare":"Preparing for takeoff","wayline_cancel":"Cancel flying to target point","wayline_failed":"Execution failed","wayline_ok":"Executed successfully, flown to target point","wayline_progress":"Executing"}
29
- attribute :status, Types::TakeoffToPointProgressStatus
28
+ # {"landing_prepare":"Preparing for landing","task_finish":"One-key takeoff mission completed","task_ready":"Ready for takeoff","takeoff_prepare":"Preparing for takeoff","wayline_cancel":"Cancel flying to target point","wayline_failed":"Execution failed","wayline_ok":"Executed successfully, flown to target point","wayline_progress":"Executing"}
29
+ # Docks send statuses DJI does not document, so an unknown status is kept rather than
30
+ # rejecting the message. Check status? before relying on it being one of the above.
31
+ attribute :status, Types::TakeoffToPointProgressStatus | Types::String
32
+
33
+ def status?
34
+ Types::TakeoffToPointProgressStatus.valid?(status)
35
+ end
30
36
 
31
37
  attribute :track_id, Types::String | Types::Nil
32
38
 
@@ -203,6 +203,20 @@ module DjiMqttConnect
203
203
  attribute? :zoom_factor, Types::JSON::Decimal
204
204
  end
205
205
 
206
+ # The state of each payload, reported in a block keyed by its payload index
207
+ attribute? :payloads, Types::Array do
208
+ attribute :payload_index, Types::PayloadIndex
209
+
210
+ # {"0":"Auto","1":"Low gain","2":"High gain"}
211
+ # Docks send modes DJI does not document, so an unknown mode is kept rather than
212
+ # rejecting the message. Check thermal_gain_mode? before relying on it being one of the above.
213
+ attribute? :thermal_gain_mode, Types::ThermalGainMode | Types::Integer
214
+
215
+ def thermal_gain_mode?
216
+ thermal_gain_mode && Types::ThermalGainMode.valid?(thermal_gain_mode)
217
+ end
218
+ end
219
+
206
220
  # {"0":"Continue to execute the wayline task","1":"Exit the wayline task, and execute the remote controller out of control action."}
207
221
  attribute? :exit_wayline_when_rc_lost, Types::ExitWaylineWhenRcLost
208
222
 
@@ -331,8 +331,9 @@ module DjiMqttConnect
331
331
  )
332
332
 
333
333
  # How far a one-key takeoff has got. The statuses a flight to a target point reports, plus the
334
- # ones the takeoff itself reports. DJI does not document takeoff_prepare, but docks send it
335
- # {"task_finish":"One-key takeoff mission completed","task_ready":"Ready for takeoff","takeoff_prepare":"Preparing for takeoff","wayline_cancel":"Cancel flying to target point","wayline_failed":"Execution failed","wayline_ok":"Executed successfully, flown to target point","wayline_progress":"Executing"}
334
+ # ones the takeoff itself reports. DJI does not document takeoff_prepare or landing_prepare, but
335
+ # docks send them
336
+ # {"landing_prepare":"Preparing for landing","task_finish":"One-key takeoff mission completed","task_ready":"Ready for takeoff","takeoff_prepare":"Preparing for takeoff","wayline_cancel":"Cancel flying to target point","wayline_failed":"Execution failed","wayline_ok":"Executed successfully, flown to target point","wayline_progress":"Executing"}
336
337
  TakeoffToPointProgressStatus = Types::String.enum(
337
338
  FLY_TO_POINT_PROGRESS_STATUS_IN_PROGRESS,
338
339
  FLY_TO_POINT_PROGRESS_STATUS_OK,
@@ -340,7 +341,8 @@ module DjiMqttConnect
340
341
  FLY_TO_POINT_PROGRESS_STATUS_CANCELED,
341
342
  TAKEOFF_TO_POINT_PROGRESS_STATUS_PREPARE = "takeoff_prepare",
342
343
  TAKEOFF_TO_POINT_PROGRESS_STATUS_READY = "task_ready",
343
- TAKEOFF_TO_POINT_PROGRESS_STATUS_FINISHED = "task_finish"
344
+ TAKEOFF_TO_POINT_PROGRESS_STATUS_FINISHED = "task_finish",
345
+ TAKEOFF_TO_POINT_PROGRESS_STATUS_LANDING_PREPARE = "landing_prepare"
344
346
  )
345
347
 
346
348
  # {"0":"Inform","1":"Notice","2":"Alarm"}
@@ -380,6 +382,13 @@ module DjiMqttConnect
380
382
  IR_METERING_MODE_AREA = 2
381
383
  )
382
384
 
385
+ # {"0":"Auto","1":"Low gain","2":"High gain"}
386
+ ThermalGainMode = Types::Integer.enum(
387
+ THERMAL_GAIN_MODE_AUTO = 0,
388
+ THERMAL_GAIN_MODE_LOW = 1,
389
+ THERMAL_GAIN_MODE_HIGH = 2
390
+ )
391
+
383
392
  # {"get_bid":"Get bid","check_work_mode":"Check whether to enter remote debugging mode","check_task_state":"Check if the DJI Dock is free","land_mcu_reboot":"Land MCU reboot","rain_mcu_reboot":"Weather station MCU reboot","core_mcu_reboot":"Central control MCU reboot","sdr_reboot":"SDR reboot","write_reboot_param_file":"Write reboot flag","get_drone_power_state":"Get battery charge state","close_putter":"Close the putter","check_wired_connect_state":"Get aircraft state","open_drone":"Open the plane","open_alarm":"Open sound and light alarm","check_scram_state":"Check if the emergency stop switch is pressed","open_cover":"Open the hatch","check_drone_sdr_connect_state":"Establish SDR wireless connection","turn_on_drone":"Turn the plane on","drone_paddle_forward":"Turn on forward paddle","close_cover":"Close the hatch","drone_paddle_reverse":"Turn on reverse paddle","drone_paddle_stop":"Stop Paddle Rotation","free_putter":"Free Putter","stop_charge":"Stop charging"}
384
393
  EventsProgressStepKey = Types::String.enum(
385
394
  "get_bid",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DjiMqttConnect
4
- VERSION = "0.1.37.7"
4
+ VERSION = "0.1.38"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dji_mqtt_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.37.7
4
+ version: 0.1.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sphere Drones
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-29 00:00:00.000000000 Z
11
+ date: 2026-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport