dji_mqtt_connect 0.1.29.2 → 0.1.30.1

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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/config/locales/thing_product_osd.en.yml +1 -0
  3. data/lib/dji_mqtt_connect/factories.rb +71 -0
  4. data/lib/dji_mqtt_connect/marshals/thing/product/osd_marshal.rb +3 -3
  5. data/lib/dji_mqtt_connect/marshals/thing/product/requests_marshal.rb +9 -0
  6. data/lib/dji_mqtt_connect/messages/sys/product/status_message.rb +1 -1
  7. data/lib/dji_mqtt_connect/messages/sys/product/status_reply_message.rb +1 -1
  8. data/lib/dji_mqtt_connect/messages/thing/product/events/device_log.rb +1 -1
  9. data/lib/dji_mqtt_connect/messages/thing/product/events/fileupload_progress.rb +1 -1
  10. data/lib/dji_mqtt_connect/messages/thing/product/events_message.rb +1 -1
  11. data/lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb +1 -1
  12. data/lib/dji_mqtt_connect/messages/thing/product/osd/drone.rb +1 -1
  13. data/lib/dji_mqtt_connect/messages/thing/product/osd/flight_hub_dock.rb +12 -0
  14. data/lib/dji_mqtt_connect/messages/thing/product/osd/flight_hub_drone.rb +256 -0
  15. data/lib/dji_mqtt_connect/messages/thing/product/osd_message.rb +1 -1
  16. data/lib/dji_mqtt_connect/messages/thing/product/requests/offline_map_get_v2.rb +1 -1
  17. data/lib/dji_mqtt_connect/messages/thing/product/requests_message.rb +1 -1
  18. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply_message.rb +1 -1
  19. data/lib/dji_mqtt_connect/messages/thing/product/services/fileupload_start.rb +2 -2
  20. data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_prepare.rb +3 -3
  21. data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_stop.rb +1 -1
  22. data/lib/dji_mqtt_connect/messages/thing/product/services/live_stop_push.rb +1 -1
  23. data/lib/dji_mqtt_connect/messages/thing/product/services_message.rb +1 -1
  24. data/lib/dji_mqtt_connect/messages/thing/product/services_reply_message.rb +1 -1
  25. data/lib/dji_mqtt_connect/messages/thing/product/state_message.rb +8 -3
  26. data/lib/dji_mqtt_connect/messages/thing/product/state_reply_message.rb +1 -1
  27. data/lib/dji_mqtt_connect/translations.rb +4 -0
  28. data/lib/dji_mqtt_connect/types.rb +7 -2
  29. data/lib/dji_mqtt_connect/version.rb +1 -1
  30. data/lib/dji_mqtt_connect.rb +1 -0
  31. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbbbf8d76b4b59cfa044b9bc78b1f15d29da687eb415ff3ace8b5b5eea8c65fc
4
- data.tar.gz: 249408710024a2b88f9b43550c62051b712d18ff2e9c90ce14e2ba049a05a180
3
+ metadata.gz: ebc14e4ca0bf1f712c0875c20cdbd99b027560336c41a93a25583ddf4aec97aa
4
+ data.tar.gz: 6366d350a9f9cc6c82d5d207dee6b81278814543aaa46be40c70264869c2f841
5
5
  SHA512:
6
- metadata.gz: e7459b05b6ab7bdf2940280bf5b9512e5dc71c371ddca6c738d8e857fcc78d9f017758b298dbb2514e0f9e5d76bc811406660e71fc19d1084936334c7d715e8e
7
- data.tar.gz: b590ee8f812a960bd32f4dc66307cc992014236da45647bb2d9189fe751e742ab07f45bbdc26b93eb2054b37fc28eb1e4b47816817eb0a4e4c6b57d65a18b330
6
+ metadata.gz: 40ff2883c6259b1824c98a1d059db98a7ce6d2f05199c869c0ac26c93cf650677b9451a0e88dc7f174ba3a9f05f00c82ad2ea59d8b7c9119fad1b39752cef8fe
7
+ data.tar.gz: 6b4d733ea7f5394419408963a9ae86a67ee3289b261140eaeffa57766782da1014c28418bd215d20573092eb606b0a02c66707a74d49ae3c18865d30311606dc
@@ -3,6 +3,7 @@ en:
3
3
  thing_product_osd_summary:
4
4
  default: "Received OSD message"
5
5
  flight_hub_dock: "Received OSD message from FlightHub Dock"
6
+ flight_hub_drone: "Received OSD message from FlightHub Drone"
6
7
  dock: "Received OSD message from Dock"
7
8
  drone: "Received OSD message from Drone"
8
9
  remote: "Received OSD message from Remote"
@@ -243,6 +243,77 @@ module DjiMqttConnect
243
243
  )
244
244
  end
245
245
 
246
+ def build_thing_product_flight_hub_drone_osd_message
247
+ message_data = {
248
+ host: {
249
+ activation_time: 1682969151,
250
+ attitude_head: 164.2085418701172,
251
+ attitude_pitch: -2.0999999046325684,
252
+ attitude_roll: 0.30000001192092896,
253
+ battery: {
254
+ batteries: [
255
+ {
256
+ capacity_percent: 95,
257
+ firmware_version: "01.00.0600",
258
+ index: 0,
259
+ loop_times: 27,
260
+ sn: "BATTERY01",
261
+ sub_type: 67,
262
+ temperature: 38,
263
+ type: 2,
264
+ voltage: 24200
265
+ }
266
+ ],
267
+ capacity_percent: 95,
268
+ landing_power: 20,
269
+ remain_flight_time: 19,
270
+ return_home_power: 25
271
+ },
272
+ distance_limit_status: {
273
+ distance_limit: 500,
274
+ is_near_distance_limit: 0,
275
+ state: 1
276
+ },
277
+ elevation: 62.20537567138672,
278
+ firmware_version: "01.00.0600",
279
+ gear: 0,
280
+ height: 62.20537567138672,
281
+ height_limit: 500,
282
+ home_distance: 23.390625,
283
+ horizontal_speed: 0.10000000149011612,
284
+ latitude: -33.768706649492614,
285
+ longitude: 150.9497880000493,
286
+ mode_code: 0,
287
+ position_state: {
288
+ gps_number: 6,
289
+ is_fixed: 3,
290
+ quality: 5,
291
+ rtk_number: 30
292
+ },
293
+ storage: {
294
+ total: 53082240,
295
+ used: 14370264
296
+ },
297
+ total_flight_distance: 1234.5,
298
+ total_flight_time: 146930,
299
+ track_id: nil,
300
+ vertical_speed: -0.30000001192092896,
301
+ wind_direction: 180,
302
+ wind_speed: 0.800000011920929
303
+ },
304
+ sn: "DRONE01"
305
+ }
306
+
307
+ Thing::Product::FlightHubDroneOsdMessage.new(
308
+ OrganizationUUID: "b13d0443-4379-461b-b985-18184ffd324d",
309
+ biz_code: "device_osd",
310
+ version: "1.0",
311
+ timestamp: Message.current_timestamp,
312
+ data: message_data,
313
+ _data: message_data
314
+ )
315
+ end
316
+
246
317
  # Status
247
318
 
248
319
  def build_thing_product_update_topo_message_with_online_device
@@ -59,7 +59,9 @@ module DjiMqttConnect
59
59
 
60
60
  message_data = parsed_message.fetch("data", {})
61
61
 
62
- message_class = if parsed_message.key?("OrganizationUUID")
62
+ message_class = if FlightHubDroneOsdMessage.matches?(parsed_message)
63
+ FlightHubDroneOsdMessage
64
+ elsif FlightHubDockOsdMessage.matches?(parsed_message)
63
65
  FlightHubDockOsdMessage
64
66
  elsif drone_osd_data_attributes.all? { |attribute| message_data.key?(attribute.to_s) }
65
67
  DroneOsdMessage
@@ -74,8 +76,6 @@ module DjiMqttConnect
74
76
 
75
77
  transformed_message = osd_transformer.call(parsed_message)
76
78
 
77
- puts JSON.pretty_generate(transformed_message)
78
-
79
79
  build_message(message_class, transformed_message)
80
80
  end
81
81
 
@@ -12,9 +12,18 @@ module DjiMqttConnect
12
12
  # Rename pesky `method` argument to `_method` and makes a copy of the raw data
13
13
  class RequestsTransformer < Dry::Transformer::Pipe
14
14
  import Dry::Transformer::HashTransformations
15
+ import Dry::Transformer::Conditional
15
16
 
16
17
  define! do
18
+ # Convert nil data to empty hash
19
+ guard ->(data) { data["data"].nil? } do
20
+ map_value "data", ->(_) { {} }
21
+ end
22
+
23
+ # Keep a copy of the original data hash
17
24
  copy_keys "data" => "_data"
25
+
26
+ # Prevent clash with Ruby reserved word
18
27
  rename_keys "method" => "_method"
19
28
  end
20
29
  end
@@ -6,7 +6,7 @@ module DjiMqttConnect
6
6
  class StatusMessage < DjiMqttConnect::Message
7
7
  attribute :tid, Types::UUID
8
8
  attribute :bid, Types::UUID
9
- attribute :timestamp, Types::Timestamp
9
+ attribute :timestamp, Types::TimestampMS
10
10
 
11
11
  attribute :_data, Types::Hash
12
12
  attribute :_method, Types::String
@@ -8,7 +8,7 @@ module DjiMqttConnect
8
8
 
9
9
  attribute :tid, Types::UUID
10
10
  attribute :bid, Types::UUID
11
- attribute :timestamp, Types::Timestamp
11
+ attribute :timestamp, Types::TimestampMS
12
12
 
13
13
  attribute :_method, Types::String
14
14
 
@@ -12,7 +12,7 @@ module DjiMqttConnect
12
12
  attribute :level, Types::Integer
13
13
  attribute :key, Types::Integer
14
14
  attribute :module, Types::Integer
15
- attribute :create_time, Types::Timestamp
15
+ attribute :create_time, Types::TimestampMS
16
16
  attribute :args, Types::Hash
17
17
  end
18
18
  end
@@ -26,7 +26,7 @@ module DjiMqttConnect
26
26
  attribute :current_step, Types::Integer
27
27
  attribute? :total_step, Types::Integer
28
28
  attribute :progress, Types::Integer
29
- attribute? :finish_time, Types::Timestamp
29
+ attribute? :finish_time, Types::TimestampMS
30
30
  attribute :upload_rate, Types::Integer
31
31
  attribute? :result, Types::Integer
32
32
  attribute :status, Types::String
@@ -5,7 +5,7 @@ module DjiMqttConnect
5
5
  class EventsMessage < DjiMqttConnect::Message
6
6
  attribute :bid, Types::UUID
7
7
  attribute :tid, Types::UUID
8
- attribute :timestamp, Types::Timestamp
8
+ attribute :timestamp, Types::TimestampMS
9
9
 
10
10
  # Can be determined from the topic, but included for convenience
11
11
  attribute? :gateway, Types::SerialNumber
@@ -22,7 +22,7 @@ module DjiMqttConnect
22
22
 
23
23
  attribute :bid, Types::UUID
24
24
  attribute :tid, Types::UUID
25
- attribute :timestamp, Types::Timestamp
25
+ attribute :timestamp, Types::TimestampMS
26
26
 
27
27
  attribute :_method, Types::String
28
28
 
@@ -100,7 +100,7 @@ module DjiMqttConnect
100
100
  # M30 Fields
101
101
 
102
102
  attribute? :cameras, Types::Array do
103
- attribute :payload_index, Types::String
103
+ attribute :payload_index, Types::PayloadIndex
104
104
 
105
105
  attribute? :camera_mode, Types::Integer
106
106
 
@@ -3,6 +3,18 @@
3
3
  module DjiMqttConnect
4
4
  module Thing::Product
5
5
  class FlightHubDockOsdMessage < OsdMessage
6
+ def self.matches?(parsed_message_data)
7
+ parsed_message_data.key?("OrganizationUUID") &&
8
+ parsed_message_data.dig("data", "host").is_a?(Hash) &&
9
+ FlightHubDockOsdMessage::Data::Host.schema.keys.all? do |key|
10
+ key.required? ? parsed_message_data.dig("data", "host").key?(key.name.to_s) : true
11
+ end
12
+ end
13
+
14
+ attribute :OrganizationUUID, Types::UUID
15
+ attribute :biz_code, Types::String
16
+ attribute :version, Types::String
17
+
6
18
  attribute :data do
7
19
  attribute :host do
8
20
  attribute? :acc_time, Types::Integer
@@ -0,0 +1,256 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Thing::Product
5
+ class FlightHubDroneOsdMessage < OsdMessage
6
+ def self.matches?(parsed_message_data)
7
+ required_keys = FlightHubDroneOsdMessage::Data::Host.schema.keys.select(&:required?)
8
+
9
+ parsed_message_data.key?("OrganizationUUID") &&
10
+ parsed_message_data.dig("data", "host").is_a?(Hash) &&
11
+ required_keys.all? do |key|
12
+ parsed_message_data.dig("data", "host").key?(key.name.to_s)
13
+ end
14
+ end
15
+
16
+ attribute :OrganizationUUID, Types::UUID
17
+ attribute :biz_code, Types::String
18
+ attribute :version, Types::String
19
+
20
+ attribute :data do
21
+ attribute :host do
22
+ attribute :activation_time, Types::Timestamp | Types::NullInteger
23
+
24
+ attribute :attitude_head, Types::JSON::Decimal
25
+
26
+ attribute :attitude_pitch, Types::JSON::Decimal
27
+
28
+ attribute :attitude_roll, Types::JSON::Decimal
29
+
30
+ attribute :battery do
31
+ attribute :batteries, Types::Array do
32
+ attribute :capacity_percent, Types::Integer
33
+ include Mixins::CapacityPercent
34
+
35
+ attribute :firmware_version, Types::String | Types::Nil
36
+ attribute? :high_voltage_storage_days, Types::Integer
37
+
38
+ attribute :index, Types::Integer
39
+
40
+ attribute :loop_times, Types::Integer
41
+
42
+ attribute :sn, Types::SerialNumber | Types::Nil
43
+
44
+ attribute :sub_type, Types::DeviceSubType
45
+
46
+ attribute :temperature, Types::Temperature
47
+ include Mixins::Temperature
48
+
49
+ attribute :type, Types::DeviceType
50
+
51
+ attribute :voltage, Types::Integer
52
+ end
53
+
54
+ attribute :capacity_percent, Types::Integer
55
+ include Mixins::CapacityPercent
56
+
57
+ attribute :landing_power, Types::Integer
58
+
59
+ attribute :remain_flight_time, Types::Integer
60
+
61
+ attribute? :remain_job_time, Types::Integer
62
+
63
+ attribute :return_home_power, Types::Integer
64
+ end
65
+
66
+ attribute? :best_link_gateway, Types::SerialNumber.optional
67
+
68
+ attribute? :cameras, Types::Array do
69
+ attribute :camera_mode, Types::Integer
70
+
71
+ attribute :liveview_world_region do
72
+ attribute :bottom, Types::JSON::Decimal
73
+ attribute :left, Types::JSON::Decimal
74
+ attribute :right, Types::JSON::Decimal
75
+ attribute :top, Types::JSON::Decimal
76
+ end
77
+
78
+ attribute :payload_index, Types::PayloadIndex
79
+
80
+ attribute :photo_state, Types::Integer
81
+
82
+ attribute :record_time, Types::Integer
83
+
84
+ attribute? :recording_state, Types::Integer
85
+
86
+ attribute :remain_photo_num, Types::Integer
87
+
88
+ attribute :remain_record_duration, Types::Integer
89
+
90
+ attribute :wide_calibrate_farthest_focus_value, Types::Integer
91
+
92
+ attribute :wide_calibrate_nearest_focus_value, Types::Integer
93
+
94
+ attribute :wide_exposure_mode, Types::Integer
95
+
96
+ attribute :wide_exposure_value, Types::Integer
97
+
98
+ attribute :wide_focus_mode, Types::Integer
99
+
100
+ attribute :wide_focus_state, Types::Integer
101
+
102
+ attribute :wide_focus_value, Types::Integer
103
+
104
+ attribute :wide_iso, Types::Integer
105
+
106
+ attribute :wide_max_focus_value, Types::Integer
107
+
108
+ attribute :wide_min_focus_value, Types::Integer
109
+
110
+ attribute :wide_shutter_speed, Types::Integer
111
+
112
+ attribute :zoom_calibrate_farthest_focus_value, Types::Integer
113
+
114
+ attribute :zoom_calibrate_nearest_focus_value, Types::Integer
115
+
116
+ attribute :zoom_exposure_mode, Types::Integer
117
+
118
+ attribute :zoom_exposure_value, Types::Integer
119
+
120
+ attribute :zoom_factor, Types::JSON::Decimal
121
+
122
+ attribute :zoom_focus_mode, Types::Integer
123
+
124
+ attribute :zoom_focus_state, Types::Integer
125
+
126
+ attribute :zoom_focus_value, Types::Integer
127
+
128
+ attribute :zoom_iso, Types::Integer
129
+
130
+ attribute :zoom_max_focus_value, Types::Integer
131
+
132
+ attribute :zoom_min_focus_value, Types::Integer
133
+
134
+ attribute :zoom_shutter_speed, Types::Integer
135
+ end
136
+
137
+ attribute? :country, Types::String
138
+
139
+ attribute? :distance_limit_status do
140
+ attribute :distance_limit, Types::Integer
141
+
142
+ # {"0":"Not reached","1":"Reached"}
143
+ attribute? :is_near_distance_limit, Types::Integer.enum(0, 1)
144
+
145
+ # {"0":"Not set","1":"Have been set"}
146
+
147
+ attribute :state, Types::Integer.enum(0, 1)
148
+ end
149
+
150
+ attribute :elevation, Types::JSON::Decimal
151
+
152
+ attribute? :firmware_version, Types::String | Types::Nil
153
+
154
+ attribute? :fts_info do
155
+ attribute :fts_firmware_version, Types::String.optional
156
+ attribute :fts_sn, Types::SerialNumber.optional
157
+ attribute :fts_status, Types::Integer
158
+ attribute :fts_timestamp, Types::Integer
159
+ attribute :fts_valid_duration, Types::Integer
160
+ attribute :fts_verification_code, Types::String.optional
161
+ end
162
+
163
+ attribute :gear, Types::Integer
164
+
165
+ attribute :height, Types::JSON::Decimal
166
+
167
+ attribute? :height_limit, Types::JSON::Decimal
168
+
169
+ attribute :home_distance, Types::JSON::Decimal
170
+
171
+ attribute :horizontal_speed, Types::JSON::Decimal
172
+
173
+ attribute? :is_near_area_limit, Types::Integer.enum(0, 1)
174
+
175
+ attribute? :is_near_height_limit, Types::Integer.enum(0, 1)
176
+
177
+ attribute :latitude, Types::Latitude
178
+ include Mixins::Latitude
179
+
180
+ attribute :longitude, Types::Longitude
181
+ include Mixins::Longitude
182
+
183
+ attribute? :maintain_status do
184
+ attribute :maintain_status_array, Types::Array do
185
+ attribute :last_maintain_flight_sorties, Types::Integer
186
+
187
+ attribute :last_maintain_flight_time, Types::Integer
188
+
189
+ attribute :last_maintain_time, Types::Integer
190
+
191
+ attribute :last_maintain_type, Types::Integer
192
+
193
+ attribute :state, Types::Integer
194
+ end
195
+ end
196
+
197
+ # {"0":"Standby","1":"Takeoff preparation","2":"Takeoff preparation completed","3":"Manual flight","4":"Automatic takeoff","5":"Wayline flight","6":"Panoramic photography","7":"Intelligent tracking","8":"ADS-B avoidance","9":"Auto returning to home","10":"Automatic landing","11":"Forced landing","12":"Three-blade landing","13":"Upgrading","14":"Not connected","15":"APAS","16":"Virtual stick state","17":"Live Flight Controls","18":"Airborne RTK fixing mode","19":"Dock address selecting","20":"POI"}
198
+ attribute :mode_code, Types::DroneModeCode
199
+
200
+ attribute? :night_lights_state, Types::Integer.enum(0, 1)
201
+
202
+ attribute? :obstacle_avoidance do
203
+ attribute :downside, Types::Integer.enum(0, 1)
204
+ attribute :horizon, Types::Integer.enum(0, 1)
205
+ attribute :upside, Types::Integer.enum(0, 1)
206
+ end
207
+
208
+ attribute :position_state do
209
+ attribute :gps_number, Types::Integer
210
+
211
+ attribute :is_fixed, Types::Integer
212
+
213
+ attribute :quality, Types::Integer
214
+ include Mixins::PositionStateQuality
215
+
216
+ attribute :rtk_number, Types::Integer
217
+ end
218
+
219
+ # {"0":"Hovering","1":"Landing","2":"Returning to home"}
220
+ attribute? :rc_lost_action, Types::Integer.enum(0, 1, 2)
221
+
222
+ attribute? :rid_state, Types::Bool
223
+
224
+ # {"unit":"m","min":20,"max":500}
225
+ attribute? :rth_altitude, Types::Integer
226
+
227
+ attribute? :storage do
228
+ attribute :total, Types::Integer
229
+
230
+ attribute :used, Types::Integer
231
+ end
232
+
233
+ attribute :total_flight_distance, Types::JSON::Decimal
234
+
235
+ attribute? :total_flight_sorties, Types::Integer
236
+
237
+ attribute :total_flight_time, Types::JSON::Decimal
238
+
239
+ attribute? :track_id, Types::String | Types::Nil
240
+
241
+ attribute :vertical_speed, Types::JSON::Decimal
242
+
243
+ attribute :wind_direction, Types::JSON::Decimal
244
+
245
+ attribute :wind_speed, Types::JSON::Decimal
246
+ end # end #data
247
+
248
+ attribute :sn, Types::SerialNumber
249
+ end
250
+
251
+ def humanized_summary
252
+ Translations.thing_product_flight_hub_drone_osd_summary(**humanized_summary_interpolation)
253
+ end
254
+ end
255
+ end
256
+ end
@@ -5,7 +5,7 @@ module DjiMqttConnect
5
5
  class OsdMessage < DjiMqttConnect::Message
6
6
  attribute? :tid, Types::UUID
7
7
  attribute? :bid, Types::UUID
8
- attribute :timestamp, Types::Timestamp
8
+ attribute :timestamp, Types::TimestampMS
9
9
 
10
10
  # Can be determined from the topic, but included for convenience
11
11
  attribute? :gateway, Types::SerialNumber
@@ -6,7 +6,7 @@ module DjiMqttConnect
6
6
  attribute :_method, Types::String.enum("offline_map_get_v2")
7
7
 
8
8
  attribute :data do
9
- attribute :tile_type, Types::Array.of(Types::String).default([].freeze)
9
+ attribute? :tile_type, Types::Array.of(Types::String).default([].freeze)
10
10
  end
11
11
  end
12
12
  end
@@ -5,7 +5,7 @@ module DjiMqttConnect
5
5
  class RequestsMessage < DjiMqttConnect::Message
6
6
  attribute :tid, Types::UUID
7
7
  attribute :bid, Types::UUID
8
- attribute :timestamp, Types::Timestamp
8
+ attribute :timestamp, Types::TimestampMS
9
9
 
10
10
  # Can be determined from the topic, but included for convenience
11
11
  attribute? :gateway, Types::SerialNumber
@@ -8,7 +8,7 @@ module DjiMqttConnect
8
8
 
9
9
  attribute :tid, Types::UUID
10
10
  attribute :bid, Types::UUID
11
- attribute :timestamp, Types::Timestamp
11
+ attribute :timestamp, Types::TimestampMS
12
12
 
13
13
  attribute :_method, Types::String
14
14
 
@@ -29,9 +29,9 @@ module DjiMqttConnect
29
29
  attribute :files, Types::Array do
30
30
  attribute :list, Types::Array do
31
31
  attribute :boot_index, Types::Integer
32
- attribute :end_time, Types::Timestamp
32
+ attribute :end_time, Types::TimestampMS
33
33
  attribute :size, Types::Integer
34
- attribute :start_time, Types::Timestamp
34
+ attribute :start_time, Types::TimestampMS
35
35
  end
36
36
  attribute :module, Types::Coercible::String.enum("0", "3")
37
37
  attribute :object_key, Types::String
@@ -20,7 +20,7 @@ module DjiMqttConnect
20
20
  attribute :data do
21
21
  # Millisecond timestamp of task execution time.
22
22
  # Optional field. When the task_type is 0 or 1, it is required. When the task_type is 2, it is not required.
23
- attribute? :execute_time, Types::Timestamp
23
+ attribute? :execute_time, Types::TimestampMS
24
24
 
25
25
  attribute :flight_id, Types::FlightID
26
26
 
@@ -47,9 +47,9 @@ module DjiMqttConnect
47
47
  attribute? :ready_conditions do
48
48
  attribute? :battery_capacity, Types::Integer
49
49
 
50
- attribute? :begin_time, Types::Timestamp
50
+ attribute? :begin_time, Types::TimestampMS
51
51
 
52
- attribute? :end_time, Types::Timestamp
52
+ attribute? :end_time, Types::TimestampMS
53
53
  end
54
54
 
55
55
  # Optional field. Pre-check conditions added for task execution on the device side. If any condition is not satisfied, execution will fail.
@@ -17,7 +17,7 @@ module DjiMqttConnect
17
17
 
18
18
  attribute :tid, Types::UUID
19
19
  attribute :bid, Types::UUID
20
- attribute :timestamp, Types::Timestamp
20
+ attribute :timestamp, Types::TimestampMS
21
21
 
22
22
  attribute :_method, Types::String.enum("flighttask_stop")
23
23
 
@@ -17,7 +17,7 @@ module DjiMqttConnect
17
17
 
18
18
  attribute :tid, Types::UUID
19
19
  attribute :bid, Types::UUID
20
- attribute :timestamp, Types::Timestamp
20
+ attribute :timestamp, Types::TimestampMS
21
21
 
22
22
  attribute :_method, Types::String.enum("live_stop_push")
23
23
 
@@ -8,7 +8,7 @@ module DjiMqttConnect
8
8
 
9
9
  attribute :tid, Types::UUID
10
10
  attribute :bid, Types::UUID
11
- attribute :timestamp, Types::Timestamp
11
+ attribute :timestamp, Types::TimestampMS
12
12
 
13
13
  attribute :_method, Types::String
14
14
 
@@ -5,7 +5,7 @@ module DjiMqttConnect
5
5
  class ServicesReplyMessage < DjiMqttConnect::Message
6
6
  attribute :tid, Types::UUID
7
7
  attribute :bid, Types::UUID
8
- attribute :timestamp, Types::Timestamp
8
+ attribute :timestamp, Types::TimestampMS
9
9
 
10
10
  attribute :_data, Types::Hash
11
11
  attribute :_method, Types::String
@@ -77,7 +77,7 @@ module DjiMqttConnect
77
77
  class StateMessage < DjiMqttConnect::Message
78
78
  attribute? :tid, Types::UUID
79
79
  attribute? :bid, Types::UUID
80
- attribute :timestamp, Types::Timestamp
80
+ attribute :timestamp, Types::TimestampMS
81
81
 
82
82
  # Can be determined from the topic, but included for convenience
83
83
  attribute? :gateway, Types::SerialNumber
@@ -104,7 +104,9 @@ module DjiMqttConnect
104
104
  attribute :right, Types::JSON::Decimal
105
105
  attribute :top, Types::JSON::Decimal
106
106
  end
107
- attribute :payload_index, Types::String
107
+
108
+ attribute :payload_index, Types::PayloadIndex
109
+
108
110
  attribute? :photo_state, Types::Integer
109
111
  attribute? :record_time, Types::Integer
110
112
  attribute? :recording_state, Types::Integer
@@ -178,8 +180,11 @@ module DjiMqttConnect
178
180
 
179
181
  attribute? :payloads, Types::Array do
180
182
  attribute :control_source, Types::String | Types::Nil
183
+
181
184
  attribute? :firmware_version, Types::String | Types::Nil
182
- attribute :payload_index, Types::String
185
+
186
+ attribute :payload_index, Types::PayloadIndex
187
+
183
188
  attribute? :sn, Types::SerialNumber | Types::Nil
184
189
  end
185
190
 
@@ -20,7 +20,7 @@ module DjiMqttConnect
20
20
 
21
21
  attribute :bid, Types::UUID
22
22
  attribute :tid, Types::UUID
23
- attribute :timestamp, Types::Timestamp
23
+ attribute :timestamp, Types::TimestampMS
24
24
 
25
25
  attribute :data do
26
26
  attribute :result, Types::ResultCode
@@ -157,6 +157,10 @@ module DjiMqttConnect
157
157
  I18n.t("flight_hub_dock", **data, scope: "dji_mqtt_connect.thing_product_osd_summary", default: :default)
158
158
  end
159
159
 
160
+ def thing_product_flight_hub_drone_osd_summary(**data)
161
+ I18n.t("flight_hub_drone", **data, scope: "dji_mqtt_connect.thing_product_osd_summary", default: :default)
162
+ end
163
+
160
164
  def thing_product_dock_osd_summary(**data)
161
165
  I18n.t("dock", **data, scope: "dji_mqtt_connect.thing_product_osd_summary", default: :default)
162
166
  end
@@ -16,8 +16,11 @@ module DjiMqttConnect
16
16
  # Not a Strict UUID format... turns out DJI doesn't follow one
17
17
  UUID = Strict::String.constrained(format: /\A[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\z/i)
18
18
 
19
- # Just make sure Timestamps are 13 digits long
20
- Timestamp = Types::Integer & Types::Coercible::String.constrained(format: /\A[1-9][0-9]{12}\z/)
19
+ # Timestamp in seconds since epoch
20
+ Timestamp = Types::Integer & Types::Coercible::String.constrained(format: /\A[1-9][0-9]{9}\z/)
21
+
22
+ # Just make sure Timestamps are 13 digits long (millisecond precision)
23
+ TimestampMS = Types::Integer & Types::Coercible::String.constrained(format: /\A[1-9][0-9]{12}\z/)
21
24
 
22
25
  # Serial Numbers are alphanumeric with optional hyphen
23
26
  SerialNumber = Types::String.constrained(format: /\A[0-9A-Z]+(-[0-9A-Z]+)?\z/)
@@ -181,6 +184,8 @@ module DjiMqttConnect
181
184
  NETWORK_STATE_QUALITY_GOOD = 2
182
185
  )
183
186
 
187
+ PayloadIndex = String.constrained(format: /\A\d+-\d+-\d+\z/)
188
+
184
189
  PositionStateQuality = Types::Integer.enum(1, 2, 3, 4, 5, 10)
185
190
 
186
191
  # {"0":"Closed","1":"Opened","2":"Half-open","3":"Putter state is abnormal"}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DjiMqttConnect
4
- VERSION = "0.1.29.2"
4
+ VERSION = "0.1.30.1"
5
5
  end
@@ -65,6 +65,7 @@ module DjiMqttConnect
65
65
 
66
66
  autoload :OsdMessage, "dji_mqtt_connect/messages/thing/product/osd_message"
67
67
  autoload :FlightHubDockOsdMessage, "dji_mqtt_connect/messages/thing/product/osd/flight_hub_dock"
68
+ autoload :FlightHubDroneOsdMessage, "dji_mqtt_connect/messages/thing/product/osd/flight_hub_drone"
68
69
  autoload :DockOsdMessage, "dji_mqtt_connect/messages/thing/product/osd/dock"
69
70
  autoload :DroneOsdMessage, "dji_mqtt_connect/messages/thing/product/osd/drone"
70
71
  autoload :RemoteOsdMessage, "dji_mqtt_connect/messages/thing/product/osd/remote"
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.29.2
4
+ version: 0.1.30.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sphere Drones
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-03 00:00:00.000000000 Z
11
+ date: 2025-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -187,6 +187,7 @@ files:
187
187
  - lib/dji_mqtt_connect/messages/thing/product/osd/dock.rb
188
188
  - lib/dji_mqtt_connect/messages/thing/product/osd/drone.rb
189
189
  - lib/dji_mqtt_connect/messages/thing/product/osd/flight_hub_dock.rb
190
+ - lib/dji_mqtt_connect/messages/thing/product/osd/flight_hub_drone.rb
190
191
  - lib/dji_mqtt_connect/messages/thing/product/osd/remote.rb
191
192
  - lib/dji_mqtt_connect/messages/thing/product/osd_message.rb
192
193
  - lib/dji_mqtt_connect/messages/thing/product/requests/airport_bind_status.rb