dji_mqtt_connect 0.1.24.1 → 0.1.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/config/locales/flighttask_status.en.yml +136 -0
  4. data/config/locales/result_codes.en.yml +2 -0
  5. data/config/locales/sys_product_status.en.yml +4 -0
  6. data/config/locales/thing_product_events.en.yml +64 -0
  7. data/config/locales/thing_product_events_reply.en.yml +4 -0
  8. data/config/locales/thing_product_osd.en.yml +7 -0
  9. data/config/locales/thing_product_requests.en.yml +12 -0
  10. data/config/locales/thing_product_requests_reply.en.yml +14 -0
  11. data/config/locales/thing_product_services.en.yml +27 -0
  12. data/config/locales/thing_product_services_reply.en.yml +4 -0
  13. data/config/locales/thing_product_state.en.yml +4 -0
  14. data/config/locales/thing_product_state_reply.en.yml +3 -0
  15. data/config/locales/video_qualities.en.yml +8 -0
  16. data/config/locales/video_types.en.yml +7 -0
  17. data/lib/dji_mqtt_connect/factories/events_messages.rb +73 -14
  18. data/lib/dji_mqtt_connect/factories/services_messages.rb +190 -0
  19. data/lib/dji_mqtt_connect/factories/state_messages.rb +19 -19
  20. data/lib/dji_mqtt_connect/factories.rb +14 -176
  21. data/lib/dji_mqtt_connect/marshals/sys/product/status_reply_marshal.rb +2 -16
  22. data/lib/dji_mqtt_connect/marshals/thing/product/events_marshal.rb +11 -4
  23. data/lib/dji_mqtt_connect/marshals/thing/product/events_reply_marshal.rb +2 -16
  24. data/lib/dji_mqtt_connect/marshals/thing/product/osd_marshal.rb +4 -4
  25. data/lib/dji_mqtt_connect/marshals/thing/product/requests_marshal.rb +4 -4
  26. data/lib/dji_mqtt_connect/marshals/thing/product/requests_reply_marshal.rb +2 -16
  27. data/lib/dji_mqtt_connect/marshals/thing/product/services_marshal.rb +2 -16
  28. data/lib/dji_mqtt_connect/marshals/thing/product/services_reply_marshal.rb +4 -4
  29. data/lib/dji_mqtt_connect/marshals/thing/product/state_marshal.rb +4 -4
  30. data/lib/dji_mqtt_connect/marshals/thing/product/state_reply_marshal.rb +2 -16
  31. data/lib/dji_mqtt_connect/messages/sys/product/status/update_topo.rb +1 -1
  32. data/lib/dji_mqtt_connect/messages/sys/product/status_message.rb +10 -0
  33. data/lib/dji_mqtt_connect/messages/sys/product/status_reply/update_topo.rb +1 -10
  34. data/lib/dji_mqtt_connect/messages/sys/product/status_reply_message.rb +22 -0
  35. data/lib/dji_mqtt_connect/messages/thing/product/events/airsense_warning.rb +16 -15
  36. data/lib/dji_mqtt_connect/messages/thing/product/events/cover_close.rb +9 -0
  37. data/lib/dji_mqtt_connect/messages/thing/product/events/cover_open.rb +9 -0
  38. data/lib/dji_mqtt_connect/messages/thing/product/events/device_exit_homing_notify.rb +13 -0
  39. data/lib/dji_mqtt_connect/messages/thing/product/events/device_reboot.rb +9 -0
  40. data/lib/dji_mqtt_connect/messages/thing/product/events/file_upload_callback.rb +13 -1
  41. data/lib/dji_mqtt_connect/messages/thing/product/events/fileupload_progress.rb +28 -1
  42. data/lib/dji_mqtt_connect/messages/thing/product/events/flight_areas_sync_progress.rb +8 -0
  43. data/lib/dji_mqtt_connect/messages/thing/product/events/flighttask_progress.rb +50 -2
  44. data/lib/dji_mqtt_connect/messages/thing/product/events/flighttask_ready.rb +6 -1
  45. data/lib/dji_mqtt_connect/messages/thing/product/events/highest_priority_upload_flighttask_media.rb +6 -1
  46. data/lib/dji_mqtt_connect/messages/thing/product/events/return_home_info.rb +24 -1
  47. data/lib/dji_mqtt_connect/messages/thing/product/events/takeoff_to_point_progress.rb +7 -1
  48. data/lib/dji_mqtt_connect/messages/thing/product/events_message.rb +19 -1
  49. data/lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb +12 -1
  50. data/lib/dji_mqtt_connect/messages/thing/product/osd/dock.rb +5 -1
  51. data/lib/dji_mqtt_connect/messages/thing/product/osd/drone.rb +5 -1
  52. data/lib/dji_mqtt_connect/messages/thing/product/osd/remote.rb +4 -0
  53. data/lib/dji_mqtt_connect/messages/thing/product/osd_message.rb +14 -4
  54. data/lib/dji_mqtt_connect/messages/thing/product/requests/airport_bind_status.rb +8 -1
  55. data/lib/dji_mqtt_connect/messages/thing/product/requests/airport_organization_bind.rb +15 -1
  56. data/lib/dji_mqtt_connect/messages/thing/product/requests/config.rb +0 -1
  57. data/lib/dji_mqtt_connect/messages/thing/product/requests/flight_areas_get.rb +0 -2
  58. data/lib/dji_mqtt_connect/messages/thing/product/requests/flighttask_resource_get.rb +6 -1
  59. data/lib/dji_mqtt_connect/messages/thing/product/requests/offline_map_get.rb +0 -2
  60. data/lib/dji_mqtt_connect/messages/thing/product/requests_message.rb +18 -1
  61. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/airport_bind_status.rb +16 -6
  62. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/airport_organization_bind.rb +2 -6
  63. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/airport_organization_get.rb +7 -5
  64. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/config.rb +9 -5
  65. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/flight_areas_get.rb +21 -5
  66. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/flighttask_resource_get.rb +1 -5
  67. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/offline_map_get.rb +3 -14
  68. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/storage_config_get.rb +7 -5
  69. data/lib/dji_mqtt_connect/messages/thing/product/requests_reply_message.rb +26 -0
  70. data/lib/dji_mqtt_connect/messages/thing/product/services/alarm_state_switch.rb +10 -0
  71. data/lib/dji_mqtt_connect/messages/thing/product/services/cover_close.rb +0 -2
  72. data/lib/dji_mqtt_connect/messages/thing/product/services/cover_open.rb +0 -2
  73. data/lib/dji_mqtt_connect/messages/thing/product/services/debug_mode_close.rb +0 -2
  74. data/lib/dji_mqtt_connect/messages/thing/product/services/debug_mode_open.rb +0 -2
  75. data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_execute.rb +81 -1
  76. data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_pause.rb +0 -2
  77. data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_prepare.rb +19 -5
  78. data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_progress_get.rb +25 -0
  79. data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_recovery.rb +0 -2
  80. data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_stop.rb +37 -0
  81. data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_undo.rb +12 -1
  82. data/lib/dji_mqtt_connect/messages/thing/product/services/live_lens_change.rb +10 -16
  83. data/lib/dji_mqtt_connect/messages/thing/product/services/live_set_quality.rb +10 -18
  84. data/lib/dji_mqtt_connect/messages/thing/product/services/live_start_push.rb +5 -19
  85. data/lib/dji_mqtt_connect/messages/thing/product/services/live_stop_push.rb +2 -1
  86. data/lib/dji_mqtt_connect/messages/thing/product/services/return_home.rb +1 -6
  87. data/lib/dji_mqtt_connect/messages/thing/product/services/return_home_cancel.rb +1 -6
  88. data/lib/dji_mqtt_connect/messages/thing/product/services/return_specific_home.rb +27 -0
  89. data/lib/dji_mqtt_connect/messages/thing/product/services_message.rb +18 -1
  90. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/flighttask_progress_get.rb +48 -0
  91. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/flighttask_stop.rb +9 -0
  92. data/lib/dji_mqtt_connect/messages/thing/product/services_reply/return_specific_home.rb +22 -0
  93. data/lib/dji_mqtt_connect/messages/thing/product/services_reply_message.rb +8 -0
  94. data/lib/dji_mqtt_connect/messages/thing/product/state_message.rb +71 -9
  95. data/lib/dji_mqtt_connect/messages/thing/product/state_reply_message.rb +12 -1
  96. data/lib/dji_mqtt_connect/mixins/video_quality.rb +43 -0
  97. data/lib/dji_mqtt_connect/mixins/video_type.rb +37 -0
  98. data/lib/dji_mqtt_connect/translations.rb +144 -0
  99. data/lib/dji_mqtt_connect/types.rb +24 -1
  100. data/lib/dji_mqtt_connect/utils/message_dumping.rb +49 -0
  101. data/lib/dji_mqtt_connect/version.rb +1 -1
  102. data/lib/dji_mqtt_connect.rb +12 -0
  103. metadata +26 -2
@@ -3,7 +3,7 @@
3
3
  module DjiMqttConnect
4
4
  module Thing::Product
5
5
  # https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/custom_fly_area.html#get-custom-flight-area-file
6
- class FlightAreasGetRequestsReplyMessage < Message
6
+ class FlightAreasGetRequestsReplyMessage < RequestsReplyMessage
7
7
  def self.build_for(flight_areas_get, files:, result: 0)
8
8
  new(
9
9
  _method: flight_areas_get._method,
@@ -19,11 +19,8 @@ module DjiMqttConnect
19
19
  )
20
20
  end
21
21
 
22
- attribute :tid, Types::UUID
23
- attribute :bid, Types::UUID
24
- attribute :timestamp, Types::Timestamp
25
-
26
22
  attribute :_method, Types::String.enum("flight_areas_get")
23
+
27
24
  attribute :data do
28
25
  include Mixins::ResultMessage
29
26
 
@@ -35,9 +32,28 @@ module DjiMqttConnect
35
32
  attribute :url, Types::String
36
33
  attribute :checksum, Types::String
37
34
  attribute :size, Types::Integer
35
+
36
+ def humanized_summary
37
+ name
38
+ end
38
39
  end
39
40
  end
40
41
  end
42
+
43
+ def humanized_summary
44
+ return super if data.output.files.none?
45
+
46
+ Translations.thing_product_requests_reply_summary(
47
+ "#{_method}_with_files",
48
+ **humanized_summary_interpolation
49
+ )
50
+ end
51
+
52
+ def humanized_summary_interpolation
53
+ super.merge(
54
+ files: data.output.files.map(&:humanized_summary).join(", ")
55
+ )
56
+ end
41
57
  end
42
58
  end
43
59
  end
@@ -4,7 +4,7 @@ module DjiMqttConnect
4
4
  module Thing::Product
5
5
  # Get the wayline task resource
6
6
  # https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/thing-model/gateway/dock/wayline.html#get-the-wayline-task-resource
7
- class FlighttaskResourceGetRequestsReplyMessage < Message
7
+ class FlighttaskResourceGetRequestsReplyMessage < RequestsReplyMessage
8
8
  def self.build_for(airport_organization_get_message, file:, result: 0)
9
9
  new(
10
10
  _method: airport_organization_get_message._method,
@@ -20,10 +20,6 @@ module DjiMqttConnect
20
20
  )
21
21
  end
22
22
 
23
- attribute :tid, Types::UUID
24
- attribute :bid, Types::UUID
25
- attribute :timestamp, Types::Timestamp
26
-
27
23
  attribute :_method, Types::String.enum("flighttask_resource_get")
28
24
 
29
25
  attribute :data do
@@ -3,15 +3,12 @@
3
3
  module DjiMqttConnect
4
4
  module Thing::Product
5
5
  # https://developer.dji.com/doc/cloud-api-tutorial/en/faq.html#why-does-the-third-party-platform-experience-prolonged-wait-time-when-executing-one-key-takeoff-or-wayline-missions-on-the-dock
6
- class OfflineMapGetRequestsReplyMessage < Message
6
+ class OfflineMapGetRequestsReplyMessage < RequestsReplyMessage
7
7
  def self.build_for(offline_map_get, result: 0)
8
8
  new(
9
9
  _method: offline_map_get._method,
10
10
  data: {
11
- result: result,
12
- output: {
13
- files: []
14
- }
11
+ result: result
15
12
  },
16
13
  tid: offline_map_get.tid,
17
14
  bid: offline_map_get.bid,
@@ -19,20 +16,12 @@ module DjiMqttConnect
19
16
  )
20
17
  end
21
18
 
22
- attribute :tid, Types::UUID
23
- attribute :bid, Types::UUID
24
- attribute :timestamp, Types::Timestamp
25
-
26
19
  attribute :_method, Types::String.enum("offline_map_get")
20
+
27
21
  attribute :data do
28
22
  include Mixins::ResultMessage
29
23
 
30
24
  attribute :result, Types::ResultCode
31
-
32
- # Debugging issues related to the offline map
33
- attribute :output do
34
- attribute :files, Types::Array.default([].freeze)
35
- end
36
25
  end
37
26
  end
38
27
  end
@@ -3,7 +3,7 @@
3
3
  module DjiMqttConnect
4
4
  module Thing::Product
5
5
  # https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/thing-model/gateway/dock/file.html#obtain-upload-temporary-credentials
6
- class StorageConfigGetRequestsReplyMessage < Message
6
+ class StorageConfigGetRequestsReplyMessage < RequestsReplyMessage
7
7
  def self.build_for(storage_config_get_message, output:, result: 0)
8
8
  new(
9
9
  _method: storage_config_get_message._method,
@@ -17,10 +17,6 @@ module DjiMqttConnect
17
17
  )
18
18
  end
19
19
 
20
- attribute :tid, Types::UUID
21
- attribute :bid, Types::UUID
22
- attribute :timestamp, Types::Timestamp
23
-
24
20
  attribute :_method, Types::String.enum("storage_config_get")
25
21
 
26
22
  attribute :data do
@@ -42,6 +38,12 @@ module DjiMqttConnect
42
38
  attribute :object_key_prefix, Types::String
43
39
  end
44
40
  end
41
+
42
+ def humanized_summary_interpolation
43
+ super.merge(
44
+ bucket_name: data.output.bucket
45
+ )
46
+ end
45
47
  end
46
48
  end
47
49
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Thing::Product
5
+ class RequestsReplyMessage < DjiMqttConnect::Message
6
+ # Ensure all values are accepted
7
+ schema schema.strict
8
+
9
+ attribute :tid, Types::UUID
10
+ attribute :bid, Types::UUID
11
+ attribute :timestamp, Types::Timestamp
12
+
13
+ attribute :_method, Types::String
14
+
15
+ attribute :data, Types::Hash.default({}.freeze)
16
+
17
+ def humanized_summary
18
+ Translations.thing_product_requests_reply_summary(_method, **humanized_summary_interpolation)
19
+ end
20
+
21
+ def humanized_summary_interpolation
22
+ data.to_h.merge(method: _method)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -23,6 +23,16 @@ module DjiMqttConnect
23
23
  attribute :data do
24
24
  # {"0":"Close","1":"Open"}
25
25
  attribute :action, Types::Integer.enum(ACTION_CLOSE, ACTION_OPEN)
26
+
27
+ def humanized_action
28
+ I18n.t(action, scope: "dji_mqtt_connect.thing_product_alarm_state_switch_services_message.humanized_action")
29
+ end
30
+ end
31
+
32
+ def humanized_summary_interpolation
33
+ super.merge(
34
+ action: data.humanized_action
35
+ )
26
36
  end
27
37
  end
28
38
  end
@@ -13,8 +13,6 @@ module DjiMqttConnect
13
13
  end
14
14
 
15
15
  attribute :_method, Types::String.enum("cover_close")
16
-
17
- attribute :data, Types::Hash.default({}.freeze)
18
16
  end
19
17
  end
20
18
  end
@@ -13,8 +13,6 @@ module DjiMqttConnect
13
13
  end
14
14
 
15
15
  attribute :_method, Types::String.enum("cover_open")
16
-
17
- attribute :data, Types::Hash.default({}.freeze)
18
16
  end
19
17
  end
20
18
  end
@@ -13,8 +13,6 @@ module DjiMqttConnect
13
13
  end
14
14
 
15
15
  attribute :_method, Types::String.enum("debug_mode_close")
16
-
17
- attribute :data, Types::Hash.default({}.freeze)
18
16
  end
19
17
  end
20
18
  end
@@ -13,8 +13,6 @@ module DjiMqttConnect
13
13
  end
14
14
 
15
15
  attribute :_method, Types::String.enum("debug_mode_open")
16
-
17
- attribute :data, Types::Hash.default({}.freeze)
18
16
  end
19
17
  end
20
18
  end
@@ -20,7 +20,87 @@ module DjiMqttConnect
20
20
  attribute :_method, Types::String.enum("flighttask_execute")
21
21
 
22
22
  attribute :data do
23
- attribute :flight_id, Types::String
23
+ attribute :flight_id, Types::FlightID
24
+
25
+ attribute? :multi_dock_task do
26
+ attribute :wireless_link_topo do
27
+ attribute :secret_code, Types::Array.of(Types::Integer)
28
+
29
+ # Aircraft frequency information
30
+ attribute :center_node do
31
+ # Scrambling code information
32
+ attribute :sdr_id, Types::Integer
33
+
34
+ attribute :sn, Types::SerialNumber
35
+ end
36
+
37
+ # Dock or remote controller frequency information, assemble the dock properties related to the multi-dock task
38
+ attribute :leaf_nodes, Types::Array do
39
+ attribute :sdr_id, Types::Integer
40
+
41
+ attribute :sn, Types::SerialNumber
42
+
43
+ # {"max":"1","min":"0","step":"1","unit_name":"None / "}
44
+ attribute :control_source_index, Types::Integer
45
+ end
46
+ end
47
+
48
+ attribute :dock_infos, Types::Array do
49
+ # {"landing":"Landing","takeoff":"Takeoff dock"}
50
+ attribute :dock_type, Types::String.enum("landing", "takeoff")
51
+
52
+ attribute :latitude, Types::Latitude
53
+ attribute :longitude, Types::Longitude
54
+
55
+ attribute :height, Types::JSON::Decimal
56
+
57
+ # {"max":"180","min":"-180","step":"","unit_name":"Degrees / °"}
58
+ attribute :heading, Types::JSON::Decimal.constrained(gteq: -180, lteq: 180)
59
+
60
+ # {"0":"Invalid","1":"Valid"}
61
+ attribute :home_position_is_valid, Types::Integer.enum(0, 1)
62
+
63
+ # {"max":"31","min":"1"}
64
+ attribute :index, Types::Integer.constrained(gteq: 1, lteq: 31)
65
+
66
+ attribute :sn, Types::SerialNumber
67
+
68
+ attribute :rtcm_info do
69
+ # Network RTK mounted point information
70
+ attribute :mount_point, Types::String
71
+
72
+ # Network port information
73
+ attribute :port, Types::String
74
+
75
+ # Network host information
76
+ attribute :host, Types::String
77
+
78
+ # {"1":"Dock"}
79
+ attribute :rtcm_device_type, Types::Integer.enum(1)
80
+
81
+ # {"0":"Not calibrated","1":"Auto-convergence calibration","2":"Manual calibration","3":"Network RTK calibration"}
82
+ attribute :source_type, Types::Integer.enum(0, 1, 2, 3)
83
+ end
84
+
85
+ attribute :alternate_land_point do
86
+ attribute :longitude, Types::Longitude
87
+ attribute :latitude, Types::Latitude
88
+
89
+ attribute :height, Types::JSON::Decimal
90
+
91
+ # Safe landing height (backup landing transfer height)
92
+ attribute :safe_land_height, Types::Integer
93
+
94
+ # {"0":"Not set","1":"Already set"}
95
+ attribute :is_configured, Types::Integer.enum(0, 1)
96
+ end
97
+ end
98
+ end
99
+ end
100
+
101
+ # All the flight IDs in the message
102
+ def flight_ids
103
+ [data.flight_id]
24
104
  end
25
105
  end
26
106
  end
@@ -13,8 +13,6 @@ module DjiMqttConnect
13
13
  end
14
14
 
15
15
  attribute :_method, Types::String.enum("flighttask_pause")
16
-
17
- attribute :data, Types::Hash.default({}.freeze)
18
16
  end
19
17
  end
20
18
  end
@@ -22,7 +22,7 @@ module DjiMqttConnect
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
23
  attribute? :execute_time, Types::Timestamp
24
24
 
25
- attribute :flight_id, Types::String
25
+ attribute :flight_id, Types::FlightID
26
26
 
27
27
  # The execution time of immediate task and timed task are defined by execute_time.
28
28
  # The conditional task supports the task readiness condition defined by ready_conditions.
@@ -32,9 +32,6 @@ module DjiMqttConnect
32
32
  # {"0":"Immediate task","1":"Timed task","2":"Conditional task"}
33
33
  attribute :task_type, Types::Integer.enum(0, 1, 2)
34
34
 
35
- # {"0":"Normal waypoint wayline"}
36
- attribute :wayline_type, Types::Integer.enum(0)
37
-
38
35
  attribute :file do
39
36
  # File MD5 signature
40
37
  attribute :fingerprint, Types::String
@@ -76,13 +73,30 @@ module DjiMqttConnect
76
73
  attribute :rth_altitude, Types::Integer.constrained(gteq: 20, lteq: 1500)
77
74
 
78
75
  # {"0":"Intelligent altitude","1":"Preset altitude"}
79
- attribute? :rth_mode, Types::Integer.enum(0, 1)
76
+ attribute :rth_mode, Types::Integer.enum(0, 1)
80
77
 
81
78
  # {"0":"Return to Home (RTH)","1":"Hovering","2":"Landing"}
82
79
  attribute :out_of_control_action, Types::Integer.enum(0, 1, 2)
83
80
 
84
81
  # {"0":"Continue executing the wayline task","1":"Exit the wayline task and execute the remote controller out of control action"}
85
82
  attribute :exit_wayline_when_rc_lost, Types::Integer.enum(0, 1)
83
+
84
+ # High-precision RTK mission: After takeoff, the aircraft will wait in the air until RTK convergence before executing the mission. The mission cannot be paused during the waiting process. It is recommended for default scenarios. GPS Mission: The aircraft can start executing without waiting for RTK convergence. It is recommended for tasks with low precision requirements or tasks with high requirements for takeoff timeliness.
85
+ # {"0":"GPS Mission","1":"High-precision RTK mission"}
86
+ attribute :wayline_precision_type, Types::Integer.enum(0, 1)
87
+
88
+ attribute? :simulate_mission do
89
+ # {"0":"Do not enable","1":"Enable"}
90
+ attribute :is_enable, Types::Integer.enum(0, 1)
91
+
92
+ attribute :latitude, Types::Latitude
93
+ attribute :longitude, Types::Longitude
94
+ end
95
+ end
96
+
97
+ # All the flight IDs in the message
98
+ def flight_ids
99
+ [data.flight_id]
86
100
  end
87
101
  end
88
102
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Thing::Product
5
+ # Dock requests for the task execution state of the other dock during the multi-dock task.
6
+ # https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock2/wayline.html#obtain-dock-task-execution-state
7
+ class FlighttaskProgressGetServicesMessage < ServicesMessage
8
+ def self.build(data:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
9
+ new(
10
+ bid: bid,
11
+ tid: tid,
12
+ timestamp: timestamp,
13
+ _method: "flighttask_progress_get",
14
+ data: data
15
+ )
16
+ end
17
+
18
+ attribute :_method, Types::String.enum("flighttask_progress_get")
19
+
20
+ attribute :data do
21
+ attribute :sn, Types::SerialNumber
22
+ end
23
+ end
24
+ end
25
+ end
@@ -15,8 +15,6 @@ module DjiMqttConnect
15
15
  end
16
16
 
17
17
  attribute :_method, Types::String.enum("flighttask_recovery")
18
-
19
- attribute :data, Types::Hash.default({}.freeze)
20
18
  end
21
19
  end
22
20
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Thing::Product
5
+ # When a dock reports the task termination, this method should be issued to the other dock during the multi-dock task.
6
+ # https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock2/wayline.html#task-termination
7
+ class FlighttaskStopServicesMessage < ServicesMessage
8
+ def self.build(data:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
9
+ new(
10
+ bid: bid,
11
+ tid: tid,
12
+ timestamp: timestamp,
13
+ _method: "flighttask_stop",
14
+ data: data
15
+ )
16
+ end
17
+
18
+ attribute :tid, Types::UUID
19
+ attribute :bid, Types::UUID
20
+ attribute :timestamp, Types::Timestamp
21
+
22
+ attribute :_method, Types::String.enum("flighttask_stop")
23
+
24
+ attribute :data do
25
+ attribute :flight_id, Types::FlightID
26
+
27
+ # {"0":"Normal termination","1":"The state machine of the other dock is abnormal"}
28
+ attribute :reason, Types::Integer.enum(0, 1)
29
+ end
30
+
31
+ # All the flight IDs in the message
32
+ def flight_ids
33
+ [data.flight_id]
34
+ end
35
+ end
36
+ end
37
+ end
@@ -20,7 +20,18 @@ module DjiMqttConnect
20
20
  attribute :_method, Types::String.enum("flighttask_undo")
21
21
 
22
22
  attribute :data do
23
- attribute :flight_ids, Types::Array.of(Types::String)
23
+ attribute :flight_ids, Types::Array.of(Types::FlightID)
24
+ end
25
+
26
+ # All the flight IDs in the message
27
+ def flight_ids
28
+ data.flight_ids
29
+ end
30
+
31
+ def humanized_summary_interpolation
32
+ super.merge(
33
+ flight_ids: flight_ids.join(", ")
34
+ )
24
35
  end
25
36
  end
26
37
  end
@@ -4,7 +4,7 @@ module DjiMqttConnect
4
4
  module Thing::Product
5
5
  # Live Set Lens
6
6
  # https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock1/live.html
7
- class LiveLensChangeServicesMessage < Message
7
+ class LiveLensChangeServicesMessage < ServicesMessage
8
8
  def self.build(data:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
9
9
  new(
10
10
  bid: bid,
@@ -15,25 +15,19 @@ module DjiMqttConnect
15
15
  )
16
16
  end
17
17
 
18
- # {"ir":"Infrared","normal":"Default","wide":"Wide-angle","zoom":"Zoom"}
19
- VIDEO_TYPE_INFRARED = "ir"
20
- VIDEO_TYPE_DEFAULT = "normal"
21
- VIDEO_TYPE_WIDE_ANGLE = "wide"
22
- VIDEO_TYPE_ZOOM = "zoom"
23
-
24
- attribute :tid, Types::UUID
25
- attribute :bid, Types::UUID
26
- attribute :timestamp, Types::Timestamp
27
-
28
18
  attribute :_method, Types::String.enum("live_lens_change")
19
+
29
20
  attribute :data do
21
+ include Mixins::VideoType
22
+
30
23
  attribute :video_id, Types::String
31
24
 
32
- attribute :video_type, Types::String.enum(
33
- VIDEO_TYPE_INFRARED,
34
- VIDEO_TYPE_DEFAULT,
35
- VIDEO_TYPE_WIDE_ANGLE,
36
- VIDEO_TYPE_ZOOM
25
+ attribute :video_type, Types::VideoType
26
+ end
27
+
28
+ def humanized_summary_interpolation
29
+ super.merge(
30
+ video_type: data.humanized_video_type
37
31
  )
38
32
  end
39
33
  end
@@ -4,7 +4,7 @@ module DjiMqttConnect
4
4
  module Thing::Product
5
5
  # Live Set Quality
6
6
  # https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock1/live.html
7
- class LiveSetQualityServicesMessage < Message
7
+ class LiveSetQualityServicesMessage < ServicesMessage
8
8
  def self.build(data:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
9
9
  new(
10
10
  bid: bid,
@@ -15,27 +15,19 @@ module DjiMqttConnect
15
15
  )
16
16
  end
17
17
 
18
- # {"0":"Adaptive","1":"Smooth","2":"Standard definition","3":"High definition","4":"Ultra-high definition"}
19
- VIDEO_QUALITY_ADAPTIVE = 0
20
- VIDEO_QUALITY_SMOOTH = 1
21
- VIDEO_QUALITY_STANDARD_DEFINITION = 2
22
- VIDEO_QUALITY_HIGH_DEFINITION = 3
23
- VIDEO_QUALITY_ULTRA_HIGH_DEFINITION = 4
24
-
25
- attribute :tid, Types::UUID
26
- attribute :bid, Types::UUID
27
- attribute :timestamp, Types::Timestamp
28
-
29
18
  attribute :_method, Types::String.enum("live_set_quality")
19
+
30
20
  attribute :data do
21
+ include Mixins::VideoQuality
22
+
31
23
  attribute :video_id, Types::String
32
24
 
33
- attribute :video_quality, Types::Integer.enum(
34
- VIDEO_QUALITY_ADAPTIVE,
35
- VIDEO_QUALITY_SMOOTH,
36
- VIDEO_QUALITY_STANDARD_DEFINITION,
37
- VIDEO_QUALITY_HIGH_DEFINITION,
38
- VIDEO_QUALITY_ULTRA_HIGH_DEFINITION
25
+ attribute :video_quality, Types::VideoQuality
26
+ end
27
+
28
+ def humanized_summary_interpolation
29
+ super.merge(
30
+ video_quality: data.humanized_video_quality
39
31
  )
40
32
  end
41
33
  end
@@ -4,7 +4,7 @@ module DjiMqttConnect
4
4
  module Thing::Product
5
5
  # Live Start Push
6
6
  # https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock1/live.html
7
- class LiveStartPushServicesMessage < Message
7
+ class LiveStartPushServicesMessage < ServicesMessage
8
8
  def self.build(data:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
9
9
  new(
10
10
  bid: bid,
@@ -21,19 +21,11 @@ module DjiMqttConnect
21
21
  URL_TYPE_GB28181 = 3
22
22
  URL_TYPE_WEBRTC = 4
23
23
 
24
- # {"0":"Adaptive","1":"Smooth","2":"Standard definition","3":"High definition","4":"Ultra-high definition"}
25
- VIDEO_QUALITY_ADAPTIVE = 0
26
- VIDEO_QUALITY_SMOOTH = 1
27
- VIDEO_QUALITY_STANDARD_DEFINITION = 2
28
- VIDEO_QUALITY_HIGH_DEFINITION = 3
29
- VIDEO_QUALITY_ULTRA_HIGH_DEFINITION = 4
30
-
31
- attribute :tid, Types::UUID
32
- attribute :bid, Types::UUID
33
- attribute :timestamp, Types::Timestamp
34
-
35
24
  attribute :_method, Types::String.enum("live_start_push")
25
+
36
26
  attribute :data do
27
+ include Mixins::VideoQuality
28
+
37
29
  attribute :url, Types::String
38
30
 
39
31
  attribute :url_type, Types::Integer.enum(
@@ -45,13 +37,7 @@ module DjiMqttConnect
45
37
 
46
38
  attribute :video_id, Types::String
47
39
 
48
- attribute :video_quality, Types::Integer.enum(
49
- VIDEO_QUALITY_ADAPTIVE,
50
- VIDEO_QUALITY_SMOOTH,
51
- VIDEO_QUALITY_STANDARD_DEFINITION,
52
- VIDEO_QUALITY_HIGH_DEFINITION,
53
- VIDEO_QUALITY_ULTRA_HIGH_DEFINITION
54
- )
40
+ attribute :video_quality, Types::VideoQuality
55
41
  end
56
42
  end
57
43
  end
@@ -4,7 +4,7 @@ module DjiMqttConnect
4
4
  module Thing::Product
5
5
  # Live Stop Push
6
6
  # https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock1/live.html
7
- class LiveStopPushServicesMessage < Message
7
+ class LiveStopPushServicesMessage < ServicesMessage
8
8
  def self.build(data:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
9
9
  new(
10
10
  bid: bid,
@@ -20,6 +20,7 @@ module DjiMqttConnect
20
20
  attribute :timestamp, Types::Timestamp
21
21
 
22
22
  attribute :_method, Types::String.enum("live_stop_push")
23
+
23
24
  attribute :data do
24
25
  attribute :video_id, Types::String
25
26
  end
@@ -4,7 +4,7 @@ module DjiMqttConnect
4
4
  module Thing::Product
5
5
  # Return to Home (RTH)
6
6
  # https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/thing-model/gateway/dock/wayline.html#return-to-home-rth
7
- class ReturnHomeServicesMessage < Message
7
+ class ReturnHomeServicesMessage < ServicesMessage
8
8
  def self.build(bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
9
9
  new(
10
10
  bid: bid,
@@ -14,12 +14,7 @@ module DjiMqttConnect
14
14
  )
15
15
  end
16
16
 
17
- attribute :tid, Types::UUID
18
- attribute :bid, Types::UUID
19
- attribute :timestamp, Types::Timestamp
20
-
21
17
  attribute :_method, Types::String.enum("return_home")
22
- attribute :data, Types::Hash.default({}.freeze)
23
18
  end
24
19
  end
25
20
  end
@@ -7,7 +7,7 @@ module DjiMqttConnect
7
7
  # After returning to home, the aircraft will exit the wayline mode. At this point, if the return-to-home command is canceled, the aircraft will hover.
8
8
  #
9
9
  # https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/thing-model/gateway/dock/wayline.html#cancel-return-to-home
10
- class ReturnHomeCancelServicesMessage < Message
10
+ class ReturnHomeCancelServicesMessage < ServicesMessage
11
11
  def self.build(bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
12
12
  new(
13
13
  bid: bid,
@@ -17,12 +17,7 @@ module DjiMqttConnect
17
17
  )
18
18
  end
19
19
 
20
- attribute :tid, Types::UUID
21
- attribute :bid, Types::UUID
22
- attribute :timestamp, Types::Timestamp
23
-
24
20
  attribute :_method, Types::String.enum("return_home_cancel")
25
- attribute :data, Types::Hash.default({}.freeze)
26
21
  end
27
22
  end
28
23
  end