dji_mqtt_connect 0.1.36.2 → 0.1.37

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/config/locales/fileupload_modules.en.yml +5 -0
  3. data/config/locales/thing_product_services.en.yml +3 -0
  4. data/deleteme +0 -0
  5. data/lib/dji_mqtt_connect/factories/events/drc_status_notify.rb +12 -6
  6. data/lib/dji_mqtt_connect/factories/events/flighttask_progress.rb +60 -0
  7. data/lib/dji_mqtt_connect/factories/events/fly_to_point_progress.rb +42 -0
  8. data/lib/dji_mqtt_connect/factories/events/joystick_invalid_notify.rb +4 -2
  9. data/lib/dji_mqtt_connect/factories/events/takeoff_to_point_progress.rb +35 -0
  10. data/lib/dji_mqtt_connect/factories/events_messages.rb +0 -91
  11. data/lib/dji_mqtt_connect/factories/services/fileupload_list.rb +55 -0
  12. data/lib/dji_mqtt_connect/factories/services/fileupload_start.rb +58 -0
  13. data/lib/dji_mqtt_connect/factories/services/fileupload_update.rb +24 -0
  14. data/lib/dji_mqtt_connect/factories/services/ir_metering_mode_set.rb +1 -1
  15. data/lib/dji_mqtt_connect/factories/services_messages.rb +0 -46
  16. data/lib/dji_mqtt_connect/factories/services_reply/fly_to_point.rb +18 -0
  17. data/lib/dji_mqtt_connect/factories/services_reply/fly_to_point_stop.rb +18 -0
  18. data/lib/dji_mqtt_connect/factories/services_reply/fly_to_point_update.rb +18 -0
  19. data/lib/dji_mqtt_connect/messages/thing/product/events/flighttask_progress.rb +2 -12
  20. data/lib/dji_mqtt_connect/messages/thing/product/events/fly_to_point_progress.rb +1 -1
  21. data/lib/dji_mqtt_connect/messages/thing/product/events/hms.rb +9 -5
  22. data/lib/dji_mqtt_connect/messages/thing/product/events/takeoff_to_point_progress.rb +1 -1
  23. data/lib/dji_mqtt_connect/messages/thing/product/osd/dock.rb +2 -2
  24. data/lib/dji_mqtt_connect/messages/thing/product/osd/drone.rb +8 -4
  25. data/lib/dji_mqtt_connect/messages/thing/product/services/fileupload_list.rb +3 -1
  26. data/lib/dji_mqtt_connect/messages/thing/product/services/fileupload_start.rb +3 -1
  27. data/lib/dji_mqtt_connect/messages/thing/product/services/fileupload_update.rb +29 -0
  28. data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_prepare.rb +7 -7
  29. data/lib/dji_mqtt_connect/messages/thing/product/services/ir_metering_mode_set.rb +5 -10
  30. data/lib/dji_mqtt_connect/messages/thing/product/services/takeoff_to_point.rb +5 -5
  31. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/fileupload_list.rb +38 -0
  32. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/fileupload_start.rb +16 -0
  33. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/fileupload_update.rb +16 -0
  34. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/flighttask_progress_get.rb +1 -11
  35. data/lib/dji_mqtt_connect/mixins/fileupload_module.rb +12 -0
  36. data/lib/dji_mqtt_connect/types.rb +241 -2
  37. data/lib/dji_mqtt_connect/version.rb +1 -1
  38. metadata +18 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 940329d2cd6cc1a579fda21b7d6325a9731ccf4b0834773fd47a5aab77653374
4
- data.tar.gz: 1d7197e5354a9cfad990ec0a8c27fbf358ae6a8ed4def7327321363e20c0db27
3
+ metadata.gz: c9d9f413e3ed17ec23e3ebd7f0922c723d02c34887e21370fc93c4f3c967e501
4
+ data.tar.gz: 896905fcf6590cc681dd214b703d423f9b1387ed51b26218d6e4d4ce25b0f882
5
5
  SHA512:
6
- metadata.gz: 229a6017739b1c560fedca7f24bf7f6b4a4821d02a88c0f328a1b145dabeab8e084566d7cbba36ba1a4022b28c2f22c3cca3c8130f06c5e1f5de1f72ad29916c
7
- data.tar.gz: 2480edeb9ed44f2b5c03c2f5db02532af5ccd8437da71c8d807120ebf8edf48dd5bd5416c907a0f076facd8b990c6d9d119c6358b38df49d76694e5370d6bcb4
6
+ metadata.gz: e94e7632a218b5da97d0529bb5303e4300995e16b91870c689c7ca70140a98d852bbdf96c2d1e95e8e59d8a0cc6d79e7a2ca7752ad1f2d4d096f9fc9d40ae00c
7
+ data.tar.gz: 977f59258206042ee6f707f0a1c8f1a966b750b7f6cb0ef30f84131f44f5571acb7d15d1c640b69ce34b7adb4155c77f285f5718c28411bc77a89d4d02c038b9
@@ -0,0 +1,5 @@
1
+ en:
2
+ dji_mqtt_connect:
3
+ fileupload_modules:
4
+ "0": "Aircraft"
5
+ "3": "DJI Dock"
@@ -15,6 +15,9 @@ en:
15
15
  drone_format: "Requesting aircraft data formatting"
16
16
  esim_activate: "Requesting eSIM activation"
17
17
  esim_operator_switch: "Requesting eSIM operator switch"
18
+ fileupload_list: "Requesting log file list"
19
+ fileupload_start: "Requesting log file upload"
20
+ fileupload_update: "Requesting log file upload state change: %{status}"
18
21
  flighttask_execute: "Requesting flight task execution"
19
22
  flighttask_pause: "Requesting pause for all Flights"
20
23
  flighttask_prepare: "Requesting flight task preparation"
data/deleteme ADDED
File without changes
@@ -4,22 +4,28 @@ module DjiMqttConnect
4
4
  module Factories::EventsMessages
5
5
  ### DRC Status Notify ###
6
6
 
7
- def build_thing_product_drc_status_notify_events_message
7
+ def build_thing_product_drc_status_notify_events_message(
8
+ drc_state: Thing::Product::DrcStatusNotifyEventsMessage::DRC_STATE_CONNECTED,
9
+ result: 0,
10
+ timestamp: Message.current_timestamp
11
+ )
8
12
  message_data = {
9
- result: 0,
10
- drc_state: 2
13
+ result: result,
14
+ drc_state: drc_state
11
15
  }
12
16
 
13
- Thing::Product::DrcStatusNotifyEventsMessage.new(
17
+ message_attributes = {
14
18
  bid: Message.generate_bid,
15
19
  tid: Message.generate_tid,
16
- timestamp: Message.current_timestamp,
17
20
  _method: "drc_status_notify",
18
21
  need_reply: 1,
19
22
  gateway: "GATEWAYSN",
20
23
  data: message_data,
21
24
  _data: message_data
22
- )
25
+ }
26
+ message_attributes[:timestamp] = timestamp unless timestamp.nil?
27
+
28
+ Thing::Product::DrcStatusNotifyEventsMessage.new(message_attributes)
23
29
  end
24
30
  end
25
31
  end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Factories::EventsMessages
5
+ def build_thing_product_flighttask_progress_events_message(
6
+ flight_id: "flight_id",
7
+ status: "ok",
8
+ result: 0,
9
+ current_step: 19,
10
+ percent: 100,
11
+ current_waypoint_index: 3,
12
+ break_reason: 1,
13
+ track_id: "track_id",
14
+ wayline_mission_state: 2
15
+ )
16
+ message_ext = {
17
+ current_waypoint_index: current_waypoint_index,
18
+ media_count: 6,
19
+ track_id: track_id,
20
+ flight_id: flight_id,
21
+ wayline_mission_state: wayline_mission_state
22
+ }
23
+
24
+ unless break_reason.nil?
25
+ message_ext[:break_point] = {
26
+ index: 1,
27
+ state: 0,
28
+ progress: 0.34,
29
+ wayline_id: 0,
30
+ break_reason: break_reason,
31
+ latitude: 23.4,
32
+ longitude: 113.99,
33
+ height: 100.23,
34
+ attitude_head: 30
35
+ }
36
+ end
37
+
38
+ message_data = {
39
+ output: {
40
+ ext: message_ext,
41
+ progress: {
42
+ current_step: current_step,
43
+ percent: percent
44
+ },
45
+ status: status
46
+ },
47
+ result: result
48
+ }
49
+
50
+ Thing::Product::FlighttaskProgressEventsMessage.new(
51
+ bid: Message.generate_bid,
52
+ tid: Message.generate_tid,
53
+ data: message_data,
54
+ _data: message_data,
55
+ _method: "flighttask_progress",
56
+ timestamp: Message.current_timestamp
57
+ )
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Factories::EventsMessages
5
+ ### Fly to Point Progress ###
6
+
7
+ def build_thing_product_fly_to_point_progress_events_message(
8
+ fly_to_id: SecureRandom.uuid,
9
+ status: "wayline_progress",
10
+ result: 0,
11
+ remaining_distance: 0,
12
+ remaining_time: 0,
13
+ way_point_index: 0
14
+ )
15
+ message_data = {
16
+ fly_to_id: fly_to_id,
17
+ planned_path_points: [
18
+ {
19
+ height: BigDecimal("123.234"),
20
+ latitude: BigDecimal("13.23"),
21
+ longitude: BigDecimal("123.234")
22
+ }
23
+ ],
24
+ remaining_distance: remaining_distance,
25
+ remaining_time: remaining_time,
26
+ result: result,
27
+ status: status,
28
+ way_point_index: way_point_index
29
+ }
30
+
31
+ Thing::Product::FlyToPointProgressEventsMessage.new(
32
+ bid: Message.generate_bid,
33
+ tid: Message.generate_tid,
34
+ timestamp: Message.current_timestamp,
35
+ _method: "fly_to_point_progress",
36
+ need_reply: 1,
37
+ data: message_data,
38
+ _data: message_data
39
+ )
40
+ end
41
+ end
42
+ end
@@ -2,9 +2,11 @@
2
2
 
3
3
  module DjiMqttConnect
4
4
  module Factories::EventsMessages
5
- def build_thing_product_joystick_invalid_notify_events_message
5
+ def build_thing_product_joystick_invalid_notify_events_message(
6
+ reason: Thing::Product::JoystickInvalidNotifyEventsMessage::REMOTE_CONTROLLER_LOST_CONNECTION_REASON
7
+ )
6
8
  message_data = {
7
- reason: 0
9
+ reason: reason
8
10
  }
9
11
 
10
12
  Thing::Product::JoystickInvalidNotifyEventsMessage.new(
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Factories::EventsMessages
5
+ def build_thing_product_takeoff_to_point_progress_events_message(
6
+ flight_id: SecureRandom.uuid,
7
+ status: "wayline_ok",
8
+ result: 0,
9
+ remaining_distance: 100,
10
+ remaining_time: 10,
11
+ track_id: SecureRandom.uuid,
12
+ way_point_index: 3
13
+ )
14
+ message_data = {
15
+ flight_id: flight_id,
16
+ remaining_distance: remaining_distance,
17
+ remaining_time: remaining_time,
18
+ result: result,
19
+ status: status,
20
+ track_id: track_id,
21
+ way_point_index: way_point_index
22
+ }
23
+
24
+ Thing::Product::TakeoffToPointProgressEventsMessage.new(
25
+ bid: Message.generate_bid,
26
+ tid: Message.generate_tid,
27
+ timestamp: Message.current_timestamp,
28
+ _method: "takeoff_to_point_progress",
29
+ need_reply: 1,
30
+ data: message_data,
31
+ _data: message_data
32
+ )
33
+ end
34
+ end
35
+ end
@@ -210,45 +210,6 @@ module DjiMqttConnect
210
210
  )
211
211
  end
212
212
 
213
- def build_thing_product_flighttask_progress_events_message
214
- message_data = {
215
- output: {
216
- ext: {
217
- current_waypoint_index: 3,
218
- media_count: 6,
219
- track_id: "track_id",
220
- flight_id: "flight_id",
221
- break_point: {
222
- index: 1,
223
- state: 0,
224
- progress: 0.34,
225
- wayline_id: 0,
226
- break_reason: 1,
227
- latitude: 23.4,
228
- longitude: 113.99,
229
- height: 100.23,
230
- attitude_head: 30
231
- }
232
- },
233
- progress: {
234
- current_step: 19,
235
- percent: 100
236
- },
237
- status: "ok"
238
- },
239
- result: 0
240
- }
241
-
242
- Thing::Product::FlighttaskProgressEventsMessage.new(
243
- bid: Message.generate_bid,
244
- tid: Message.generate_tid,
245
- data: message_data,
246
- _data: message_data,
247
- _method: "flighttask_progress",
248
- timestamp: Message.current_timestamp
249
- )
250
- end
251
-
252
213
  def build_thing_product_flighttask_ready_events_message
253
214
  message_data = {
254
215
  flight_ids: [
@@ -267,36 +228,6 @@ module DjiMqttConnect
267
228
  )
268
229
  end
269
230
 
270
- ### Fly to Point Progress ###
271
-
272
- def build_thing_product_fly_to_point_progress_events_message
273
- message_data = {
274
- fly_to_id: SecureRandom.uuid,
275
- planned_path_points: [
276
- {
277
- height: BigDecimal("123.234"),
278
- latitude: BigDecimal("13.23"),
279
- longitude: BigDecimal("123.234")
280
- }
281
- ],
282
- remaining_distance: 0,
283
- remaining_time: 0,
284
- result: 0,
285
- status: "wayline_progress",
286
- way_point_index: 0
287
- }
288
-
289
- Thing::Product::FlyToPointProgressEventsMessage.new(
290
- bid: Message.generate_bid,
291
- tid: Message.generate_tid,
292
- timestamp: Message.current_timestamp,
293
- _method: "fly_to_point_progress",
294
- need_reply: 1,
295
- data: message_data,
296
- _data: message_data
297
- )
298
- end
299
-
300
231
  def build_thing_product_highest_priority_upload_flighttask_media_events_message
301
232
  message_data = {
302
233
  flight_id: SecureRandom.uuid
@@ -377,28 +308,6 @@ module DjiMqttConnect
377
308
  _data: message_data
378
309
  )
379
310
  end
380
-
381
- def build_thing_product_takeoff_to_point_progress_events_message
382
- message_data = {
383
- flight_id: SecureRandom.uuid,
384
- remaining_distance: 100,
385
- remaining_time: 10,
386
- result: 0,
387
- status: "ok",
388
- track_id: SecureRandom.uuid,
389
- way_point_index: 3
390
- }
391
-
392
- Thing::Product::TakeoffToPointProgressEventsMessage.new(
393
- bid: Message.generate_bid,
394
- tid: Message.generate_tid,
395
- timestamp: Message.current_timestamp,
396
- _method: "takeoff_to_point_progress",
397
- need_reply: 1,
398
- data: message_data,
399
- _data: message_data
400
- )
401
- end
402
311
  end
403
312
  end
404
313
 
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Factories::ServicesMessages
5
+ def build_thing_product_fileupload_list_services_message
6
+ Thing::Product::FileuploadListServicesMessage.build(
7
+ module_list: [0, 3]
8
+ )
9
+ end
10
+
11
+ def build_thing_product_fileupload_list_services_reply_message(result: 0)
12
+ timestamp = Message.current_timestamp
13
+ message_data = {
14
+ result: result,
15
+ files: [
16
+ {
17
+ device_sn: "DRONESN",
18
+ result: 0,
19
+ module: Types::FILEUPLOAD_MODULE_AIRCRAFT,
20
+ list: [
21
+ {
22
+ boot_index: 1111,
23
+ start_time: timestamp - 4000,
24
+ end_time: timestamp - 3000,
25
+ size: 33789
26
+ }
27
+ ]
28
+ },
29
+ {
30
+ device_sn: "DOCKSN",
31
+ result: 0,
32
+ module: Types::FILEUPLOAD_MODULE_DOCK,
33
+ list: [
34
+ {
35
+ boot_index: 22222,
36
+ start_time: timestamp - 2000,
37
+ end_time: timestamp - 1000,
38
+ size: 36772
39
+ }
40
+ ]
41
+ }
42
+ ]
43
+ }
44
+
45
+ Thing::Product::FileuploadListServicesReplyMessage.new(
46
+ bid: Message.generate_bid,
47
+ tid: Message.generate_tid,
48
+ timestamp: timestamp,
49
+ _method: "fileupload_list",
50
+ _data: message_data,
51
+ data: message_data
52
+ )
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Factories::ServicesMessages
5
+ def build_thing_product_fileupload_start_services_message
6
+ timestamp = Message.current_timestamp
7
+ Thing::Product::FileuploadStartServicesMessage.build(
8
+ data: {
9
+ bucket: "stg-dji-service-hz-ksd7",
10
+ region: "hz",
11
+ credentials: {
12
+ access_key_id: "STS.access_key_id",
13
+ access_key_secret: "access_key_secret",
14
+ expire: 3600,
15
+ security_token: "security_token"
16
+ },
17
+ endpoint: "https://oss-cn-hangzhou.aliyuncs.com",
18
+ params: {
19
+ files: [
20
+ {
21
+ list: [
22
+ {
23
+ boot_index: 1111,
24
+ end_time: timestamp - 3000,
25
+ size: 33789,
26
+ start_time: timestamp - 4000
27
+ },
28
+ {
29
+ boot_index: 22222,
30
+ end_time: timestamp - 1000,
31
+ size: 33789,
32
+ start_time: timestamp - 2000
33
+ }
34
+ ],
35
+ module: Types::FILEUPLOAD_MODULE_DOCK,
36
+ object_key: "object_key"
37
+ }
38
+ ]
39
+ },
40
+ provider: "ali"
41
+ }
42
+ )
43
+ end
44
+
45
+ def build_thing_product_fileupload_start_services_reply_message(result: 0)
46
+ message_data = {result: result}
47
+
48
+ Thing::Product::FileuploadStartServicesReplyMessage.new(
49
+ bid: Message.generate_bid,
50
+ tid: Message.generate_tid,
51
+ timestamp: Message.current_timestamp,
52
+ _method: "fileupload_start",
53
+ _data: message_data,
54
+ data: message_data
55
+ )
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Factories::ServicesMessages
5
+ def build_thing_product_fileupload_update_services_message
6
+ Thing::Product::FileuploadUpdateServicesMessage.build(
7
+ module_list: [0, 3]
8
+ )
9
+ end
10
+
11
+ def build_thing_product_fileupload_update_services_reply_message(result: 0)
12
+ message_data = {result: result}
13
+
14
+ Thing::Product::FileuploadUpdateServicesReplyMessage.new(
15
+ bid: Message.generate_bid,
16
+ tid: Message.generate_tid,
17
+ timestamp: Message.current_timestamp,
18
+ _method: "fileupload_update",
19
+ _data: message_data,
20
+ data: message_data
21
+ )
22
+ end
23
+ end
24
+ end
@@ -12,7 +12,7 @@ module DjiMqttConnect
12
12
 
13
13
  def build_thing_product_ir_metering_mode_set_services_message_data
14
14
  {
15
- mode: Thing::Product::IrMeteringModeSetServicesMessage::MODE_POINT,
15
+ mode: Types::IR_METERING_MODE_POINT,
16
16
  payload_index: "39-0-7"
17
17
  }
18
18
  end
@@ -30,52 +30,6 @@ module DjiMqttConnect
30
30
  Thing::Product::DroneOpenServicesMessage.build
31
31
  end
32
32
 
33
- def build_thing_product_fileupload_list_services_message
34
- Thing::Product::FileuploadListServicesMessage.build(
35
- module_list: [0, 3]
36
- )
37
- end
38
-
39
- def build_thing_product_fileupload_start_services_message
40
- timestamp = Message.current_timestamp
41
- Thing::Product::FileuploadStartServicesMessage.build(
42
- data: {
43
- bucket: "stg-dji-service-hz-ksd7",
44
- region: "hz",
45
- credentials: {
46
- access_key_id: "STS.access_key_id",
47
- access_key_secret: "access_key_secret",
48
- expire: 3600,
49
- security_token: "security_token"
50
- },
51
- endpoint: "https://oss-cn-hangzhou.aliyuncs.com",
52
- params: {
53
- files: [
54
- {
55
- list: [
56
- {
57
- boot_index: 1111,
58
- end_time: timestamp - 3000,
59
- size: 33789,
60
- start_time: timestamp - 4000
61
- },
62
- {
63
- boot_index: 22222,
64
- end_time: timestamp - 1000,
65
- size: 33789,
66
- start_time: timestamp - 2000
67
- }
68
- ],
69
- module: "3",
70
- object_key: "object_key"
71
- }
72
- ]
73
- },
74
- provider: "ali"
75
- }
76
- )
77
- end
78
-
79
33
  ### Flighttask Execute ###
80
34
 
81
35
  def build_thing_product_flighttask_execute_services_message
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Factories
5
+ def build_thing_product_fly_to_point_services_reply_message(result: 0)
6
+ message_data = {result: result}
7
+
8
+ Thing::Product::FlyToPointServicesReplyMessage.new(
9
+ bid: Message.generate_bid,
10
+ tid: Message.generate_tid,
11
+ timestamp: Message.current_timestamp,
12
+ _method: "fly_to_point",
13
+ _data: message_data,
14
+ data: message_data
15
+ )
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Factories
5
+ def build_thing_product_fly_to_point_stop_services_reply_message(result: 0)
6
+ message_data = {result: result}
7
+
8
+ Thing::Product::FlyToPointStopServicesReplyMessage.new(
9
+ bid: Message.generate_bid,
10
+ tid: Message.generate_tid,
11
+ timestamp: Message.current_timestamp,
12
+ _method: "fly_to_point_stop",
13
+ _data: message_data,
14
+ data: message_data
15
+ )
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Factories
5
+ def build_thing_product_fly_to_point_update_services_reply_message(result: 0)
6
+ message_data = {result: result}
7
+
8
+ Thing::Product::FlyToPointUpdateServicesReplyMessage.new(
9
+ bid: Message.generate_bid,
10
+ tid: Message.generate_tid,
11
+ timestamp: Message.current_timestamp,
12
+ _method: "fly_to_point_update",
13
+ _data: message_data,
14
+ data: message_data
15
+ )
16
+ end
17
+ end
18
+ end
@@ -36,7 +36,7 @@ module DjiMqttConnect
36
36
  attribute :index, Types::Integer
37
37
 
38
38
  # {"0":"On the wayline segment","1":"On the waypoint"}
39
- attribute :state, Types::Integer.enum(0, 1)
39
+ attribute :state, Types::BreakPointState
40
40
 
41
41
  # {"min":"0","max":"1.0"}
42
42
  attribute :progress, Types::JSON::Decimal.constrained(gteq: 0, lteq: 1.0)
@@ -61,17 +61,7 @@ module DjiMqttConnect
61
61
  end
62
62
 
63
63
  # {"partially_done":"partially done","sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
64
- attribute :status, Types::String.enum(
65
- "partially_done",
66
- "sent",
67
- "in_progress",
68
- "ok",
69
- "paused",
70
- "rejected",
71
- "failed",
72
- "canceled",
73
- "timeout"
74
- )
64
+ attribute :status, Types::FlighttaskStatus
75
65
 
76
66
  def humanized_status
77
67
  I18n.t(status, scope: "dji_mqtt_connect.flighttask_status", default: status.titleize)
@@ -27,7 +27,7 @@ module DjiMqttConnect
27
27
  include Mixins::ResultCode
28
28
 
29
29
  # {"wayline_cancel":"Cancel flying to target point","wayline_failed":"Execution failed","wayline_ok":"Executed successfully, flown to target point","wayline_progress":"Executing"}
30
- attribute :status, Types::String
30
+ attribute :status, Types::FlyToPointProgressStatus
31
31
 
32
32
  attribute :way_point_index, Types::Integer
33
33
  end
@@ -8,18 +8,18 @@ module DjiMqttConnect
8
8
  attribute :data do
9
9
  attribute :list, Types::Array do
10
10
  # {"0":"Inform","1":"Notice","2":"Alarm"}
11
- attribute :level, Types::Integer.enum(0, 1, 2)
11
+ attribute :level, Types::HmsLevel
12
12
 
13
13
  # {"0":"flight mission","1":"device management","2":"media","3":"hms"}
14
- attribute :module, Types::Integer.enum(0, 1, 2, 3)
14
+ attribute :module, Types::HmsModule
15
15
 
16
16
  # {"0":"on the ground","1":"in the sky"}
17
- attribute? :in_the_sky, Types::Integer.enum(0, 1)
17
+ attribute? :in_the_sky, Types::HmsInTheSky
18
18
 
19
19
  attribute :code, Types::String
20
20
 
21
21
  # {"0":"No","1":"Yes"}
22
- attribute? :imminent, Types::Integer.enum(0, 1)
22
+ attribute? :imminent, Types::HmsImminent
23
23
 
24
24
  attribute :args do
25
25
  attribute :component_index, Types::Integer
@@ -28,7 +28,11 @@ module DjiMqttConnect
28
28
  end
29
29
 
30
30
  def in_the_sky?
31
- in_the_sky == 1
31
+ in_the_sky == Types::HMS_IN_THE_SKY
32
+ end
33
+
34
+ def imminent?
35
+ imminent == Types::HMS_IMMINENT
32
36
  end
33
37
 
34
38
  def aircraft_message
@@ -26,7 +26,7 @@ module DjiMqttConnect
26
26
  attribute :remaining_time, Types::JSON::Decimal
27
27
 
28
28
  # {"task_finish":"One-key takeoff mission completed","task_ready":"Ready 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::String
29
+ attribute :status, Types::TakeoffToPointProgressStatus
30
30
 
31
31
  attribute :track_id, Types::String | Types::Nil
32
32