dji_mqtt_connect 0.1.24.1 → 0.1.25
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 +4 -4
- data/Gemfile.lock +1 -1
- data/config/locales/flighttask_status.en.yml +136 -0
- data/config/locales/result_codes.en.yml +2 -0
- data/config/locales/sys_product_status.en.yml +4 -0
- data/config/locales/thing_product_events.en.yml +64 -0
- data/config/locales/thing_product_events_reply.en.yml +4 -0
- data/config/locales/thing_product_osd.en.yml +7 -0
- data/config/locales/thing_product_requests.en.yml +12 -0
- data/config/locales/thing_product_requests_reply.en.yml +14 -0
- data/config/locales/thing_product_services.en.yml +27 -0
- data/config/locales/thing_product_services_reply.en.yml +4 -0
- data/config/locales/thing_product_state.en.yml +4 -0
- data/config/locales/thing_product_state_reply.en.yml +3 -0
- data/config/locales/video_qualities.en.yml +8 -0
- data/config/locales/video_types.en.yml +7 -0
- data/lib/dji_mqtt_connect/factories/events_messages.rb +73 -14
- data/lib/dji_mqtt_connect/factories/services_messages.rb +190 -0
- data/lib/dji_mqtt_connect/factories/state_messages.rb +19 -19
- data/lib/dji_mqtt_connect/factories.rb +14 -176
- data/lib/dji_mqtt_connect/marshals/sys/product/status_reply_marshal.rb +2 -16
- data/lib/dji_mqtt_connect/marshals/thing/product/events_marshal.rb +11 -4
- data/lib/dji_mqtt_connect/marshals/thing/product/events_reply_marshal.rb +2 -16
- data/lib/dji_mqtt_connect/marshals/thing/product/osd_marshal.rb +4 -4
- data/lib/dji_mqtt_connect/marshals/thing/product/requests_marshal.rb +4 -4
- data/lib/dji_mqtt_connect/marshals/thing/product/requests_reply_marshal.rb +2 -16
- data/lib/dji_mqtt_connect/marshals/thing/product/services_marshal.rb +2 -16
- data/lib/dji_mqtt_connect/marshals/thing/product/services_reply_marshal.rb +4 -4
- data/lib/dji_mqtt_connect/marshals/thing/product/state_marshal.rb +4 -4
- data/lib/dji_mqtt_connect/marshals/thing/product/state_reply_marshal.rb +2 -16
- data/lib/dji_mqtt_connect/messages/sys/product/status/update_topo.rb +1 -1
- data/lib/dji_mqtt_connect/messages/sys/product/status_message.rb +10 -0
- data/lib/dji_mqtt_connect/messages/sys/product/status_reply/update_topo.rb +1 -10
- data/lib/dji_mqtt_connect/messages/sys/product/status_reply_message.rb +22 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/airsense_warning.rb +16 -15
- data/lib/dji_mqtt_connect/messages/thing/product/events/cover_close.rb +9 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/cover_open.rb +9 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/device_exit_homing_notify.rb +13 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/device_reboot.rb +9 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/file_upload_callback.rb +13 -1
- data/lib/dji_mqtt_connect/messages/thing/product/events/fileupload_progress.rb +28 -1
- data/lib/dji_mqtt_connect/messages/thing/product/events/flight_areas_sync_progress.rb +8 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/flighttask_progress.rb +50 -2
- data/lib/dji_mqtt_connect/messages/thing/product/events/flighttask_ready.rb +6 -1
- data/lib/dji_mqtt_connect/messages/thing/product/events/highest_priority_upload_flighttask_media.rb +6 -1
- data/lib/dji_mqtt_connect/messages/thing/product/events/return_home_info.rb +24 -1
- data/lib/dji_mqtt_connect/messages/thing/product/events/takeoff_to_point_progress.rb +7 -1
- data/lib/dji_mqtt_connect/messages/thing/product/events_message.rb +19 -1
- data/lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb +12 -1
- data/lib/dji_mqtt_connect/messages/thing/product/osd/dock.rb +5 -1
- data/lib/dji_mqtt_connect/messages/thing/product/osd/drone.rb +5 -1
- data/lib/dji_mqtt_connect/messages/thing/product/osd/remote.rb +4 -0
- data/lib/dji_mqtt_connect/messages/thing/product/osd_message.rb +14 -4
- data/lib/dji_mqtt_connect/messages/thing/product/requests/airport_bind_status.rb +8 -1
- data/lib/dji_mqtt_connect/messages/thing/product/requests/airport_organization_bind.rb +15 -1
- data/lib/dji_mqtt_connect/messages/thing/product/requests/config.rb +0 -1
- data/lib/dji_mqtt_connect/messages/thing/product/requests/flight_areas_get.rb +0 -2
- data/lib/dji_mqtt_connect/messages/thing/product/requests/flighttask_resource_get.rb +6 -1
- data/lib/dji_mqtt_connect/messages/thing/product/requests/offline_map_get.rb +0 -2
- data/lib/dji_mqtt_connect/messages/thing/product/requests_message.rb +18 -1
- data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/airport_bind_status.rb +16 -6
- data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/airport_organization_bind.rb +2 -6
- data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/airport_organization_get.rb +7 -5
- data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/config.rb +9 -5
- data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/flight_areas_get.rb +21 -5
- data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/flighttask_resource_get.rb +1 -5
- data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/offline_map_get.rb +3 -14
- data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/storage_config_get.rb +7 -5
- data/lib/dji_mqtt_connect/messages/thing/product/requests_reply_message.rb +26 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/alarm_state_switch.rb +10 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/cover_close.rb +0 -2
- data/lib/dji_mqtt_connect/messages/thing/product/services/cover_open.rb +0 -2
- data/lib/dji_mqtt_connect/messages/thing/product/services/debug_mode_close.rb +0 -2
- data/lib/dji_mqtt_connect/messages/thing/product/services/debug_mode_open.rb +0 -2
- data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_execute.rb +81 -1
- data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_pause.rb +0 -2
- data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_prepare.rb +19 -5
- data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_progress_get.rb +25 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_recovery.rb +0 -2
- data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_stop.rb +37 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_undo.rb +12 -1
- data/lib/dji_mqtt_connect/messages/thing/product/services/live_lens_change.rb +10 -16
- data/lib/dji_mqtt_connect/messages/thing/product/services/live_set_quality.rb +10 -18
- data/lib/dji_mqtt_connect/messages/thing/product/services/live_start_push.rb +5 -19
- data/lib/dji_mqtt_connect/messages/thing/product/services/live_stop_push.rb +2 -1
- data/lib/dji_mqtt_connect/messages/thing/product/services/return_home.rb +1 -6
- data/lib/dji_mqtt_connect/messages/thing/product/services/return_home_cancel.rb +1 -6
- data/lib/dji_mqtt_connect/messages/thing/product/services/return_specific_home.rb +27 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_message.rb +18 -1
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/flighttask_progress_get.rb +48 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/flighttask_stop.rb +9 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/return_specific_home.rb +22 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply_message.rb +8 -0
- data/lib/dji_mqtt_connect/messages/thing/product/state_message.rb +71 -9
- data/lib/dji_mqtt_connect/messages/thing/product/state_reply_message.rb +12 -1
- data/lib/dji_mqtt_connect/mixins/video_quality.rb +43 -0
- data/lib/dji_mqtt_connect/mixins/video_type.rb +37 -0
- data/lib/dji_mqtt_connect/translations.rb +144 -0
- data/lib/dji_mqtt_connect/types.rb +24 -1
- data/lib/dji_mqtt_connect/utils/message_dumping.rb +49 -0
- data/lib/dji_mqtt_connect/version.rb +1 -1
- data/lib/dji_mqtt_connect.rb +12 -0
- metadata +26 -2
@@ -4,6 +4,7 @@ module DjiMqttConnect
|
|
4
4
|
module Thing::Product
|
5
5
|
# Report wayline task progress
|
6
6
|
# https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/thing-model/gateway/dock/wayline.html#report-wayline-task-progress
|
7
|
+
# https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock2/wayline.html#report-mission-progress
|
7
8
|
class FlighttaskProgressEventsMessage < EventsMessage
|
8
9
|
attribute :_method, Types::String.enum("flighttask_progress")
|
9
10
|
|
@@ -15,9 +16,22 @@ module DjiMqttConnect
|
|
15
16
|
attribute :output do
|
16
17
|
attribute :ext do
|
17
18
|
attribute :current_waypoint_index, Types::Integer
|
19
|
+
|
20
|
+
# {"0":"Disconnected","1":"This waypoint is not supported","2":"Wayline preparation state. It can upload files and execute existing files","3":"Wayline file uploading","4":"Trigger start command. The aircraft triggers logic such as reading the wayline. The mission has not started yet and it's in a preparation state","5":"Entering the wayline, heading to the first waypoint","6":"Wayline execution","7":"Wayline interrupted. Triggered conditions are 1 for User actively pauses and 2 for Flight control abnormality","8":"Wayline recovery","9":"Wayline completed"}
|
21
|
+
attribute? :wayline_mission_state, Types::Integer.enum(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
|
22
|
+
|
23
|
+
def humanized_wayline_mission_state
|
24
|
+
I18n.t(wayline_mission_state, scope: "dji_mqtt_connect.thing_product_flighttask_progress_events_message.humanized_wayline_mission_state", default: wayline_mission_state)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Number of media files generated during the current flight mission
|
18
28
|
attribute? :media_count, Types::Integer
|
29
|
+
|
19
30
|
attribute :track_id, Types::String | Types::Nil
|
20
|
-
|
31
|
+
|
32
|
+
attribute :flight_id, Types::FlightID
|
33
|
+
|
34
|
+
attribute? :wayline_id, Types::Integer
|
21
35
|
|
22
36
|
attribute? :break_point do
|
23
37
|
attribute :index, Types::Integer
|
@@ -30,8 +44,13 @@ module DjiMqttConnect
|
|
30
44
|
|
31
45
|
attribute :wayline_id, Types::Integer
|
32
46
|
|
47
|
+
# {"0":"No abnormalities","1":"Mission ID does not exist. The wayline mission has not been executed.","2":"Uncommon error, please contact technical support","4":"Error loading wayline file when requesting to start/resume the wayline mission, please try uploading the file again or contact technical support","5":"Failed to query breakpoint file when requesting breakpoint information. Failed to parse breakpoint type when requesting to resume the wayline mission","6":"Incorrect cmd parameter when requesting to start/end the wayline mission, incorrect protocol command in the request. Failed to parse breakpoint type when requesting to resume the wayline mission","7":"Timeout parsing the WPMZ file when requesting to start/resume the wayline mission, please retry","257":"Wayline has already started, cannot start again","258":"Unable to interrupt the wayline in this state, only allowed to pause the wayline in the executing state","259":"Wayline has not started, cannot end the wayline","261":"Flight mission conflict, unable to obtain control of the aircraft, not allowed to start the wayline during landing and return","262":"Unable to resume wayline in this state, only allowed when the wayline is paused","513":"Aircraft exceeded the maximum altitude limit","514":"Aircraft exceeded the maximum distance limit","516":"Aircraft triggered altitude limit","517":"Aircraft triggered obstacle sensing","518":"Poor RTK signal","519":"Approaching the boundary of Restricted Zone","521":"Exceeded the dock's GEO zone altitude limit","522":"Failed to request takeoff for the wayline","523":"Takeoff mission execution failed","524":"Failed to request wayline mission","526":"Failed to request wayline RTK fixing mission","527":"Wayline RTK fixing mission failed to run","769":"Weak GPS signal","770":"The remote controller gear is not in N position.","771":"Home point not refreshed","772":"Unable to start the mission due to low current battery level","773":"Wayline interrupted due to low battery causing return to home","775":"Disconnection between the remote controller and the aircraft","778":"Aircraft is on the ground with propellers spinning, not allowed to start the wayline","779":"During the real-time terrain follow, the camera state is abnormal(such as too bright, too dark and inconsistent brightness on both sides)","780":"Real-time terrain-following altitude set by the user is invalid (greater than 200m or less than 30m)","781":"Global map calculation error during real-time terrain follow","784":"Wayline interrupted due to strong winds causing return to home","1281":"User exit","1282":"User interruption","1283":"User triggered return to home","1539":"Incorrect start information (waypoint index or progress)","1540":"Using an unsupported coordinate system","1541":"Using an unsupported altitude mode","1542":"Using an unsupported transitional wayline mode","1543":"Using an unsupported yaw mode","1544":"Using an unsupported yaw direction reversal mode","1545":"Using an unsupported waypoint type","1546":"Coordinated turning type cannot be used for the start and end points","1547":"Wayline global speed exceeds a reasonable range","1548":"Waypoint number abnormal","1549":"Abnormal latitude and longitude data","1550":"Abnormal turning intercept","1551":"Maximum speed of wayline segment exceeds a reasonable range","1552":"Wayline segment target speed exceeds a reasonable range","1553":"Waypoint yaw angle exceeds a reasonable range","1555":"Input mission_id of resuming from breakpoint is wrong","1556":"Progress information of resuming from breakpoint input error","1557":"Mission state of resuming from breakpoint is abnormal","1558":"Waypoint index information of resuming from breakpoint input error","1559":"Incorrect latitude and longitude information for resuming from breakpoint","1560":"Yaw input error for waypoints during resuming from breakpoint","1561":"Incorrect flag setting for resuming from breakpoint","1563":"Wayline generation failed","1564":"Wayline execution failed","1565":"Emergency stop due to wayline obstacle sensing","1588":"Unrecognized action type","1595":"Action ID must be unique.","1598":"Action ID value cannot be 65535","1602":"Number of action groups exceeds a reasonable range","1603":"Error in action group effective range","1606":"Action index exceeds a reasonable range during resuming from breakpoint","1608":"Trigger running result of breakpoint information is abnormal","1609":"Action group ID information can not be duplicated during resume from breakpoint","1610":"Action group positions cannot be repeated during resuming from breakpoint","1611":"Action group positions exceed a reasonable range during resuming from breakpoint","1612":"Action ID is not in the breakpoint information during resuming","1613":"The action state can not be set to interrupt during the resuming flight from breakpoint","1614":"Resume failure due to incorrect breakpoint information","1634":"Unrecognized action type","1649":"Unrecognized trigger type","65534":"Unknown issue","65535":"Unknown issue"}
|
33
48
|
attribute :break_reason, Types::Integer
|
34
49
|
|
50
|
+
def humanized_break_reason
|
51
|
+
I18n.t(break_reason, scope: "dji_mqtt_connect.flighttask_progress.break_reason", default: break_reason.to_s)
|
52
|
+
end
|
53
|
+
|
35
54
|
attribute :latitude, Types::Latitude
|
36
55
|
attribute :longitude, Types::Longitude
|
37
56
|
|
@@ -60,14 +79,43 @@ module DjiMqttConnect
|
|
60
79
|
end
|
61
80
|
|
62
81
|
attribute :progress do
|
63
|
-
# {"0-4":"
|
82
|
+
# {"0":"Initial state","1":"Pre-flight check, whether the aircraft is executing a wayline","2":"Pre-flight check, whether the dock has exited working mode","3":"Pre-flight check, wayline execution in progress","4":"Pre-return-to-home check, in the process of returning to home","5":"Wayline execution enters the preparation state, waiting for the mission to be issued","6":"Dock enters working state","7":"Enter the startup check and cover preparation work","8":"Remote image transmission frequency Pairing","9":"Waiting for the flight system to be ready, push connection established","10":"Waiting for RTK source to listen for reported values","11":"Check if the RTK source is from the dock, if not, reset it","12":"Waiting for flight control notification","13":"The dock has no control and seizes the control of the aircraft","14":"Consistency check of custom flight area","15":"Consistency check of offline maps","16":"Get the latest KMZ URL","17":"Download KMZ","18":"KMZ uploading","19":"Coloring configuration","20":"Aircraft takeoff parameter setting, alternate landing point setting, takeoff altitude setting, coloring setting","21":"Aircraft flyto takeoff parameter setting","22":"Takeoff dock checks the landing dock preparation status","23":"Home point setting","24":"Trigger wayline execution","25":"Wayline executing","26":"Enter pre-return-to-home check","27":"Aircraft landing at the dock","28":"Close the cover after landing","29":"Dock exits working mode","30":"Dock abnormal recovery","31":"Dock uploads flight system logs","32":"Check camera recording state","33":"Get the number of media files","34":"Abnormal recovery after dock takeoff cover","35":"Notify mission result","36":"Log list retrieval - Aircraft list","37":"Log list retrieval - Retrieve the list of docks","38":"Log list retrieval - Upload log list result","39":"Log retrieval - Retrieve aircraft logs","40":"Log retrieval - Retrieve dock logs","41":"Log retrieval - Compress aircraft logs","42":"Log retrieval - Compress dock logs","43":"Log retrieval - Upload aircraft logs","44":"Log retrieval - Upload dock logs","45":"Log retrieval - Notify the result","46":"Custom flight area file update preparation","47":"Custom flight area updating","48":"Offline map update preparation","49":"Offline map updating","65533":"Wait for service response after completion","65534":"No specific state","65535":"UNKNOWN"}
|
64
83
|
attribute :current_step, Types::Integer
|
65
84
|
|
85
|
+
def humanized_current_step
|
86
|
+
I18n.t(current_step, scope: "dji_mqtt_connect.flighttask_progress.current_step", default: current_step.to_s)
|
87
|
+
end
|
88
|
+
|
66
89
|
# {"min":"0","max":"100","step":"1"}
|
67
90
|
attribute :percent, Types::Integer.constrained(gteq: 0, lteq: 100)
|
68
91
|
end
|
69
92
|
end
|
70
93
|
end
|
94
|
+
|
95
|
+
def humanized_summary
|
96
|
+
return super unless data.output.ext.break_point
|
97
|
+
|
98
|
+
Translations.thing_product_events_summary(
|
99
|
+
"#{_method}_with_break_point",
|
100
|
+
**humanized_summary_interpolation
|
101
|
+
)
|
102
|
+
end
|
103
|
+
|
104
|
+
def humanized_summary_interpolation
|
105
|
+
super.merge(
|
106
|
+
status: data.output.humanized_status,
|
107
|
+
percent: data.output.progress.percent,
|
108
|
+
current_step: data.output.progress.humanized_current_step,
|
109
|
+
wayline_mission_state: data.output.ext.humanized_wayline_mission_state || "-",
|
110
|
+
flight_id: data.output.ext.flight_id,
|
111
|
+
break_reason: data.output.ext.break_point&.humanized_break_reason || "-"
|
112
|
+
)
|
113
|
+
end
|
114
|
+
|
115
|
+
# All the flight IDs in the message
|
116
|
+
def flight_ids
|
117
|
+
[data.output.ext.flight_id]
|
118
|
+
end
|
71
119
|
end
|
72
120
|
end
|
73
121
|
end
|
@@ -8,7 +8,12 @@ module DjiMqttConnect
|
|
8
8
|
attribute :_method, Types::String.enum("flighttask_ready")
|
9
9
|
|
10
10
|
attribute :data do
|
11
|
-
attribute :flight_ids, Types::Array.of(Types::
|
11
|
+
attribute :flight_ids, Types::Array.of(Types::FlightID)
|
12
|
+
end
|
13
|
+
|
14
|
+
# All the flight IDs in the message
|
15
|
+
def flight_ids
|
16
|
+
data.flight_ids
|
12
17
|
end
|
13
18
|
end
|
14
19
|
end
|
data/lib/dji_mqtt_connect/messages/thing/product/events/highest_priority_upload_flighttask_media.rb
CHANGED
@@ -6,7 +6,12 @@ module DjiMqttConnect
|
|
6
6
|
attribute :_method, Types::String.enum("highest_priority_upload_flighttask_media")
|
7
7
|
|
8
8
|
attribute :data do
|
9
|
-
attribute :flight_id, Types::
|
9
|
+
attribute :flight_id, Types::FlightID
|
10
|
+
end
|
11
|
+
|
12
|
+
# All the flight IDs in the message
|
13
|
+
def flight_ids
|
14
|
+
[data.flight_id]
|
10
15
|
end
|
11
16
|
end
|
12
17
|
end
|
@@ -3,10 +3,28 @@
|
|
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/wayline.html#return-to-home-information
|
6
|
+
# https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock2/wayline.html#return-home-information
|
6
7
|
class ReturnHomeInfoEventsMessage < EventsMessage
|
7
8
|
attribute :_method, Types::String.enum("return_home_info")
|
8
9
|
|
9
10
|
attribute :data do
|
11
|
+
# Dock SN of the home point
|
12
|
+
attribute? :home_dock_sn, Types::SerialNumber
|
13
|
+
|
14
|
+
attribute? :multi_dock_home_info, Types::Array do
|
15
|
+
# Dock serial number
|
16
|
+
attribute :sn, Types::SerialNumber
|
17
|
+
|
18
|
+
# {"max":"100","min":"0","step":"1","unit_name":null}
|
19
|
+
attribute :estimated_battery_consumption, Types::Integer.constrained(gteq: 0, lteq: 100)
|
20
|
+
|
21
|
+
# Home point distance
|
22
|
+
attribute :home_distance, Types::JSON::Decimal
|
23
|
+
|
24
|
+
# {"0":"Planning failed or in progress","1":"Path planning unreachable","2":"Path planning unreachable due to battery","3":"Destination reachable"}
|
25
|
+
attribute :plan_status, Types::Integer.enum(0, 1, 2, 3)
|
26
|
+
end
|
27
|
+
|
10
28
|
attribute :planned_path_points, Types::Array.default([].freeze) do
|
11
29
|
attribute :latitude, Types::Latitude
|
12
30
|
attribute :longitude, Types::Longitude
|
@@ -16,7 +34,12 @@ module DjiMqttConnect
|
|
16
34
|
# {"0":"Last point of trajectory is located above the return point.","1":"Last point of trajectory is not located above the return point."}
|
17
35
|
attribute? :last_point_type, Types::Integer.enum(0, 1)
|
18
36
|
|
19
|
-
attribute :flight_id, Types::
|
37
|
+
attribute :flight_id, Types::FlightID
|
38
|
+
end
|
39
|
+
|
40
|
+
# All the flight IDs in the message
|
41
|
+
def flight_ids
|
42
|
+
[data.flight_id]
|
20
43
|
end
|
21
44
|
end
|
22
45
|
end
|
@@ -10,13 +10,19 @@ module DjiMqttConnect
|
|
10
10
|
|
11
11
|
attribute :result, Types::ResultCode
|
12
12
|
|
13
|
-
attribute :flight_id, Types::
|
13
|
+
attribute :flight_id, Types::FlightID
|
14
|
+
|
14
15
|
attribute :remaining_distance, Types::Integer
|
15
16
|
attribute :remaining_time, Types::Integer
|
16
17
|
attribute :status, Types::String
|
17
18
|
attribute :track_id, Types::String | Types::Nil
|
18
19
|
attribute :way_point_index, Types::Integer
|
19
20
|
end
|
21
|
+
|
22
|
+
# All the flight IDs in the message
|
23
|
+
def flight_ids
|
24
|
+
[data.flight_id]
|
25
|
+
end
|
20
26
|
end
|
21
27
|
end
|
22
28
|
end
|
@@ -2,21 +2,39 @@
|
|
2
2
|
|
3
3
|
module DjiMqttConnect
|
4
4
|
module Thing::Product
|
5
|
-
class EventsMessage < Message
|
5
|
+
class EventsMessage < DjiMqttConnect::Message
|
6
6
|
attribute :bid, Types::UUID
|
7
7
|
attribute :tid, Types::UUID
|
8
8
|
attribute :timestamp, Types::Timestamp
|
9
9
|
|
10
|
+
# Can be determined from the topic, but included for convenience
|
11
|
+
attribute? :gateway, Types::SerialNumber
|
12
|
+
|
10
13
|
# NOTE: Included in most events messages, requires a reply on the events_reply topic if true
|
11
14
|
attribute? :need_reply, Types::Integer.enum(0, 1)
|
12
15
|
|
13
16
|
attribute :_data, Types::Hash
|
14
17
|
attribute :_method, Types::String
|
15
18
|
|
19
|
+
attribute :data, Types::Hash.default({}.freeze)
|
20
|
+
|
16
21
|
def need_reply?
|
17
22
|
need_reply == 1
|
18
23
|
end
|
19
24
|
|
25
|
+
def humanized_summary
|
26
|
+
Translations.thing_product_events_summary(_method, **humanized_summary_interpolation)
|
27
|
+
end
|
28
|
+
|
29
|
+
def humanized_summary_interpolation
|
30
|
+
data.to_h.merge(method: _method, flight_ids: flight_ids.join(", "))
|
31
|
+
end
|
32
|
+
|
33
|
+
# All the flight IDs in the message
|
34
|
+
def flight_ids
|
35
|
+
[]
|
36
|
+
end
|
37
|
+
|
20
38
|
def to_s
|
21
39
|
# Include data method for Generic messages
|
22
40
|
instance_of?(EventsMessage) ? "#{super}[#{_method}]" : super
|
@@ -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/topic-definition.html#events-reply-struct-example
|
6
|
-
class EventsReplyMessage < Message
|
6
|
+
class EventsReplyMessage < DjiMqttConnect::Message
|
7
7
|
# a result of 0 means we approve of this action
|
8
8
|
def self.build_for(events_message, result: 0)
|
9
9
|
new(
|
@@ -17,6 +17,9 @@ module DjiMqttConnect
|
|
17
17
|
)
|
18
18
|
end
|
19
19
|
|
20
|
+
# Ensure all values are accepted
|
21
|
+
schema schema.strict
|
22
|
+
|
20
23
|
attribute :bid, Types::UUID
|
21
24
|
attribute :tid, Types::UUID
|
22
25
|
attribute :timestamp, Types::Timestamp
|
@@ -28,6 +31,14 @@ module DjiMqttConnect
|
|
28
31
|
|
29
32
|
attribute :result, Types::ResultCode
|
30
33
|
end
|
34
|
+
|
35
|
+
def humanized_summary
|
36
|
+
Translations.thing_product_events_reply_summary(_method, **humanized_summary_interpolation)
|
37
|
+
end
|
38
|
+
|
39
|
+
def humanized_summary_interpolation
|
40
|
+
data.to_h.merge(method: _method)
|
41
|
+
end
|
31
42
|
end
|
32
43
|
end
|
33
44
|
end
|
@@ -339,7 +339,7 @@ module DjiMqttConnect
|
|
339
339
|
end
|
340
340
|
|
341
341
|
attribute? :sub_device do
|
342
|
-
attribute? :device_sn, Types::
|
342
|
+
attribute? :device_sn, Types::SerialNumber
|
343
343
|
attribute? :device_model_key, Types::String
|
344
344
|
|
345
345
|
# {"0":"Offline","1":"Online"}
|
@@ -357,6 +357,10 @@ module DjiMqttConnect
|
|
357
357
|
environment_temperature && !Types::InvalidTemperature.valid?(environment_temperature)
|
358
358
|
end
|
359
359
|
end
|
360
|
+
|
361
|
+
def humanized_summary
|
362
|
+
Translations.thing_product_dock_osd_summary(**humanized_summary_interpolation)
|
363
|
+
end
|
360
364
|
end
|
361
365
|
end
|
362
366
|
end
|
@@ -39,7 +39,7 @@ module DjiMqttConnect
|
|
39
39
|
attribute? :high_voltage_storage_days, Types::Integer
|
40
40
|
attribute :index, Types::Integer
|
41
41
|
attribute :loop_times, Types::Integer
|
42
|
-
attribute :sn, Types::
|
42
|
+
attribute :sn, Types::SerialNumber | Types::Nil
|
43
43
|
attribute :sub_type, Types::DeviceSubType
|
44
44
|
attribute :temperature, Types::Temperature
|
45
45
|
attribute :type, Types::DeviceType
|
@@ -177,6 +177,10 @@ module DjiMqttConnect
|
|
177
177
|
|
178
178
|
attribute? :total_flight_sorties, Types::Integer
|
179
179
|
end
|
180
|
+
|
181
|
+
def humanized_summary
|
182
|
+
Translations.thing_product_drone_osd_summary(**humanized_summary_interpolation)
|
183
|
+
end
|
180
184
|
end
|
181
185
|
end
|
182
186
|
end
|
@@ -1,17 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry-transformer"
|
4
|
-
|
5
3
|
module DjiMqttConnect
|
6
4
|
module Thing::Product
|
7
|
-
class OsdMessage < Message
|
5
|
+
class OsdMessage < DjiMqttConnect::Message
|
8
6
|
attribute :tid, Types::UUID
|
9
7
|
attribute :bid, Types::UUID
|
10
8
|
attribute :timestamp, Types::Timestamp
|
11
|
-
|
9
|
+
|
10
|
+
# Can be determined from the topic, but included for convenience
|
11
|
+
attribute :gateway, Types::SerialNumber
|
12
12
|
|
13
13
|
# Backup of received data
|
14
14
|
attribute :_data, Types::Hash
|
15
|
+
|
16
|
+
attribute :data, Types::Hash.default({}.freeze)
|
17
|
+
|
18
|
+
def humanized_summary
|
19
|
+
Translations.thing_product_osd_summary(**humanized_summary_interpolation)
|
20
|
+
end
|
21
|
+
|
22
|
+
def humanized_summary_interpolation
|
23
|
+
data.to_h
|
24
|
+
end
|
15
25
|
end
|
16
26
|
end
|
17
27
|
end
|
@@ -7,9 +7,16 @@ module DjiMqttConnect
|
|
7
7
|
|
8
8
|
attribute :data do
|
9
9
|
attribute :devices, Types::Array do
|
10
|
-
attribute :sn, Types::
|
10
|
+
attribute :sn, Types::SerialNumber
|
11
11
|
end
|
12
12
|
end
|
13
|
+
|
14
|
+
def humanized_summary
|
15
|
+
Translations.thing_product_requests_summary(
|
16
|
+
_method,
|
17
|
+
devices: data.devices.map(&:sn).join(", ")
|
18
|
+
)
|
19
|
+
end
|
13
20
|
end
|
14
21
|
end
|
15
22
|
end
|
@@ -11,12 +11,26 @@ module DjiMqttConnect
|
|
11
11
|
attribute :device_binding_code, Types::String | Types::Nil
|
12
12
|
attribute :organization_id, Types::String | Types::Nil
|
13
13
|
attribute :device_callsign, Types::String | Types::Nil
|
14
|
-
attribute :sn, Types::
|
14
|
+
attribute :sn, Types::SerialNumber | Types::Nil
|
15
15
|
attribute :device_model_key, Types::String
|
16
16
|
attribute :device_nonce, Types::String | Types::Nil
|
17
17
|
attribute :device_secret, Types::String | Types::Nil
|
18
|
+
|
19
|
+
def humanized_summary
|
20
|
+
I18n.t(
|
21
|
+
"dji_mqtt_connect.thing_product_airport_organization_bind_requests_message.bind_devices_summary",
|
22
|
+
**to_h,
|
23
|
+
identifier: sn || device_model_key
|
24
|
+
)
|
25
|
+
end
|
18
26
|
end
|
19
27
|
end
|
28
|
+
|
29
|
+
def humanized_summary_interpolation
|
30
|
+
super.merge(
|
31
|
+
bind_status: data.bind_devices.map(&:humanized_summary).join(", ")
|
32
|
+
)
|
33
|
+
end
|
20
34
|
end
|
21
35
|
end
|
22
36
|
end
|
@@ -6,8 +6,6 @@ module DjiMqttConnect
|
|
6
6
|
# # 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
|
7
7
|
class FlightAreasGetRequestsMessage < RequestsMessage
|
8
8
|
attribute :_method, Types::String.enum("flight_areas_get")
|
9
|
-
|
10
|
-
attribute :data, Types::Hash
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
@@ -8,7 +8,12 @@ module DjiMqttConnect
|
|
8
8
|
attribute :_method, Types::String.enum("flighttask_resource_get")
|
9
9
|
|
10
10
|
attribute :data do
|
11
|
-
attribute :flight_id, Types::
|
11
|
+
attribute :flight_id, Types::FlightID
|
12
|
+
end
|
13
|
+
|
14
|
+
# All the flight IDs in the message
|
15
|
+
def flight_ids
|
16
|
+
[data.flight_id]
|
12
17
|
end
|
13
18
|
end
|
14
19
|
end
|
@@ -6,8 +6,6 @@ module DjiMqttConnect
|
|
6
6
|
# 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
|
7
7
|
class OfflineMapGetRequestsMessage < RequestsMessage
|
8
8
|
attribute :_method, Types::String.enum("offline_map_get")
|
9
|
-
|
10
|
-
attribute :data, Types::Hash
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
@@ -6,11 +6,28 @@ module DjiMqttConnect
|
|
6
6
|
attribute :tid, Types::UUID
|
7
7
|
attribute :bid, Types::UUID
|
8
8
|
attribute :timestamp, Types::Timestamp
|
9
|
-
|
9
|
+
|
10
|
+
# Can be determined from the topic, but included for convenience
|
11
|
+
attribute? :gateway, Types::SerialNumber
|
10
12
|
|
11
13
|
attribute :_data, Types::Hash
|
12
14
|
attribute :_method, Types::String
|
13
15
|
|
16
|
+
attribute :data, Types::Hash.default({}.freeze)
|
17
|
+
|
18
|
+
def humanized_summary
|
19
|
+
Translations.thing_product_requests_summary(_method, **humanized_summary_interpolation)
|
20
|
+
end
|
21
|
+
|
22
|
+
def humanized_summary_interpolation
|
23
|
+
data.to_h.merge(method: _method)
|
24
|
+
end
|
25
|
+
|
26
|
+
# All the flight IDs in the message
|
27
|
+
def flight_ids
|
28
|
+
[]
|
29
|
+
end
|
30
|
+
|
14
31
|
def to_s
|
15
32
|
# Include data method for Generic messages
|
16
33
|
instance_of?(RequestsMessage) ? "#{super}[#{_method}]" : super
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module DjiMqttConnect
|
4
4
|
module Thing::Product
|
5
|
-
class AirportBindStatusRequestsReplyMessage <
|
5
|
+
class AirportBindStatusRequestsReplyMessage < RequestsReplyMessage
|
6
6
|
def self.build_for(airport_bind_status_message, bind_status:, result: 0)
|
7
7
|
new(
|
8
8
|
_method: airport_bind_status_message._method,
|
@@ -18,10 +18,6 @@ module DjiMqttConnect
|
|
18
18
|
)
|
19
19
|
end
|
20
20
|
|
21
|
-
attribute :tid, Types::UUID
|
22
|
-
attribute :bid, Types::UUID
|
23
|
-
attribute :timestamp, Types::Timestamp
|
24
|
-
|
25
21
|
attribute :_method, Types::String.enum("airport_bind_status")
|
26
22
|
|
27
23
|
attribute :data do
|
@@ -31,14 +27,28 @@ module DjiMqttConnect
|
|
31
27
|
|
32
28
|
attribute :output do
|
33
29
|
attribute :bind_status, Types::Array do
|
34
|
-
attribute :sn, Types::
|
30
|
+
attribute :sn, Types::SerialNumber
|
35
31
|
attribute :is_device_bind_organization, Types::Bool
|
36
32
|
attribute :organization_id, Types::String
|
37
33
|
attribute :organization_name, Types::String
|
38
34
|
attribute :device_callsign, Types::String
|
35
|
+
|
36
|
+
def humanized_summary
|
37
|
+
I18n.t(
|
38
|
+
is_device_bind_organization ? "bound" : "unbound",
|
39
|
+
scope: "dji_mqtt_connect.thing_product_airport_bind_status_requests_reply_message.humanized_summary",
|
40
|
+
**to_h
|
41
|
+
)
|
42
|
+
end
|
39
43
|
end
|
40
44
|
end
|
41
45
|
end
|
46
|
+
|
47
|
+
def humanized_summary_interpolation
|
48
|
+
super.merge(
|
49
|
+
bind_status: data.output.bind_status.map(&:humanized_summary).join(", ")
|
50
|
+
)
|
51
|
+
end
|
42
52
|
end
|
43
53
|
end
|
44
54
|
end
|
data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/airport_organization_bind.rb
CHANGED
@@ -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/organization.html#device-bind-to-organization
|
6
|
-
class AirportOrganizationBindRequestsReplyMessage <
|
6
|
+
class AirportOrganizationBindRequestsReplyMessage < RequestsReplyMessage
|
7
7
|
def self.build_for(airport_organization_bind_message, err_infos: [], result: 0)
|
8
8
|
new(
|
9
9
|
_method: airport_organization_bind_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("airport_organization_bind")
|
25
21
|
|
26
22
|
attribute :data do
|
@@ -29,7 +25,7 @@ module DjiMqttConnect
|
|
29
25
|
attribute :result, Types::ResultCode
|
30
26
|
|
31
27
|
attribute :err_infos, Types::Array do
|
32
|
-
attribute :sn, Types::
|
28
|
+
attribute :sn, Types::SerialNumber
|
33
29
|
|
34
30
|
# Custom field. Non-zero indicates that the bind was unsuccessful.
|
35
31
|
attribute :err_code, Types::Integer
|
@@ -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/organization.html#search-for-the-organization-information-that-device-bound-to
|
6
|
-
class AirportOrganizationGetRequestsReplyMessage <
|
6
|
+
class AirportOrganizationGetRequestsReplyMessage < RequestsReplyMessage
|
7
7
|
def self.build_for(airport_organization_get_message, output:, result: 0)
|
8
8
|
new(
|
9
9
|
_method: airport_organization_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("airport_organization_get")
|
25
21
|
|
26
22
|
attribute :data do
|
@@ -32,6 +28,12 @@ module DjiMqttConnect
|
|
32
28
|
attribute :organization_name, Types::String
|
33
29
|
end
|
34
30
|
end
|
31
|
+
|
32
|
+
def humanized_summary_interpolation
|
33
|
+
super.merge(
|
34
|
+
organization_name: data.output.organization_name
|
35
|
+
)
|
36
|
+
end
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
@@ -2,7 +2,8 @@
|
|
2
2
|
|
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/dock2/config.html#get-configuration
|
6
|
+
class ConfigRequestsReplyMessage < RequestsReplyMessage
|
6
7
|
def self.build_for(config_request_message, data:)
|
7
8
|
new(
|
8
9
|
_method: config_request_message._method,
|
@@ -14,14 +15,17 @@ module DjiMqttConnect
|
|
14
15
|
)
|
15
16
|
end
|
16
17
|
|
17
|
-
|
18
|
-
attribute :
|
19
|
-
attribute :timestamp, Types::Timestamp
|
20
|
-
attribute :gateway, Types::String
|
18
|
+
# Gateway is included in the documentation, but not in any other request reply messages
|
19
|
+
attribute :gateway, Types::SerialNumber
|
21
20
|
|
22
21
|
attribute :_method, Types::String.enum("config")
|
22
|
+
|
23
23
|
attribute :data do
|
24
24
|
attribute :ntp_server_host, Types::String
|
25
|
+
|
26
|
+
# If this field is not included in the request, the default NTP port number is 123
|
27
|
+
attribute? :ntp_server_port, Types::Integer
|
28
|
+
|
25
29
|
attribute :app_id, Types::String
|
26
30
|
attribute :app_key, Types::String
|
27
31
|
attribute :app_license, Types::String
|