dji_mqtt_connect 0.1.12.1 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/dji_mqtt_connect/client.rb +5 -0
- data/lib/dji_mqtt_connect/factories.rb +356 -0
- data/lib/dji_mqtt_connect/marshals/thing/product/services_reply_marshal.rb +47 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/cover_close.rb +65 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/cover_open.rb +65 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/device_exit_homing_notify.rb +36 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/device_log.rb +20 -0
- data/lib/dji_mqtt_connect/messages/thing/product/{file_upload_callback_events_message.rb → events/file_upload_callback.rb} +0 -7
- data/lib/dji_mqtt_connect/messages/thing/product/{fileupload_progress_events_message.rb → events/fileupload_progress.rb} +0 -7
- data/lib/dji_mqtt_connect/messages/thing/product/events/flighttask_progress.rb +67 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/flighttask_ready.rb +15 -0
- data/lib/dji_mqtt_connect/messages/thing/product/{highest_priority_upload_flighttask_media_events_message.rb → events/highest_priority_upload_flighttask_media.rb} +0 -7
- data/lib/dji_mqtt_connect/messages/thing/product/events_message.rb +7 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb +3 -0
- data/lib/dji_mqtt_connect/messages/thing/product/requests/flighttask_resource_get.rb +15 -0
- data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/flighttask_resource_get.rb +44 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/alarm_state_switch.rb +29 -0
- data/lib/dji_mqtt_connect/messages/thing/product/{cover_close_services_message.rb → services/cover_close.rb} +2 -5
- data/lib/dji_mqtt_connect/messages/thing/product/{cover_open_services_message.rb → services/cover_open.rb} +2 -5
- data/lib/dji_mqtt_connect/messages/thing/product/services/debug_mode_close.rb +20 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/debug_mode_open.rb +20 -0
- data/lib/dji_mqtt_connect/messages/thing/product/{fileupload_list_services_message.rb → services/fileupload_list.rb} +1 -4
- data/lib/dji_mqtt_connect/messages/thing/product/{fileupload_start_services_message.rb → services/fileupload_start.rb} +1 -5
- data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_execute.rb +27 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_pause.rb +20 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_prepare.rb +86 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_recovery.rb +22 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/flighttask_undo.rb +27 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/return_home.rb +25 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/return_home_cancel.rb +28 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_message.rb +14 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/alarm_state_switch.rb +27 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/cover_close.rb +27 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/cover_open.rb +27 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/debug_mode_close.rb +27 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/debug_mode_open.rb +27 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/flighttask_execute.rb +9 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/flighttask_pause.rb +9 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/flighttask_prepare.rb +9 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/flighttask_recovery.rb +9 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/flighttask_undo.rb +9 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/return_home.rb +27 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/return_home_cancel.rb +9 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply_message.rb +23 -0
- data/lib/dji_mqtt_connect/topics/thing/product/services_reply.rb +40 -0
- data/lib/dji_mqtt_connect/types.rb +2 -0
- data/lib/dji_mqtt_connect/version.rb +1 -1
- data/lib/dji_mqtt_connect.rb +61 -26
- metadata +60 -26
- /data/lib/dji_mqtt_connect/messages/sys/product/{update_topo_status_message.rb → status/update_topo.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/sys/product/{update_topo_status_reply_message.rb → status_reply/update_topo.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{hms_events_message.rb → events/hms.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{status_code_events_message.rb → events/status_code.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{dock_osd_message.rb → osd/dock.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{drone_osd_message.rb → osd/drone.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{remote_osd_message.rb → osd/remote.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{airport_bind_status_requests_message.rb → requests/airport_bind_status.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{airport_organization_bind_requests_message.rb → requests/airport_organization_bind.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{airport_organization_get_requests_message.rb → requests/airport_organization_get.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{config_requests_message.rb → requests/config.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{storage_config_get_requests_message.rb → requests/storage_config_get.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{airport_bind_status_requests_reply_message.rb → requests_reply/airport_bind_status.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{airport_organization_bind_requests_reply_message.rb → requests_reply/airport_organization_bind.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{airport_organization_get_requests_reply_message.rb → requests_reply/airport_organization_get.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{config_requests_reply_message.rb → requests_reply/config.rb} +0 -0
- /data/lib/dji_mqtt_connect/messages/thing/product/{storage_config_get_requests_reply_message.rb → requests_reply/storage_config_get.rb} +0 -0
@@ -6,9 +6,6 @@ module DjiMqttConnect
|
|
6
6
|
class FileuploadProgressEventsMessage < EventsMessage
|
7
7
|
attribute :_method, Types::String.enum("fileupload_progress")
|
8
8
|
|
9
|
-
# NOTE: Not documented, but appears in examples
|
10
|
-
attribute? :need_reply, Types::Integer.enum(0, 1)
|
11
|
-
|
12
9
|
attribute :data do
|
13
10
|
attribute :output do
|
14
11
|
attribute :ext do
|
@@ -35,10 +32,6 @@ module DjiMqttConnect
|
|
35
32
|
attribute :status, Types::String
|
36
33
|
end
|
37
34
|
end
|
38
|
-
|
39
|
-
def need_reply?
|
40
|
-
need_reply == 1
|
41
|
-
end
|
42
35
|
end
|
43
36
|
end
|
44
37
|
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
# Report wayline task progress
|
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
|
+
class FlighttaskProgressEventsMessage < EventsMessage
|
8
|
+
attribute :_method, Types::String.enum("flighttask_progress")
|
9
|
+
|
10
|
+
attribute :data do
|
11
|
+
attribute :output do
|
12
|
+
attribute :ext do
|
13
|
+
attribute :current_waypoint_index, Types::Integer
|
14
|
+
attribute :media_count, Types::Integer
|
15
|
+
attribute :track_id, Types::String
|
16
|
+
attribute :flight_id, Types::String
|
17
|
+
|
18
|
+
attribute :break_point do
|
19
|
+
attribute :index, Types::Integer
|
20
|
+
|
21
|
+
# {"0":"On the wayline segment","1":"On the waypoint"}
|
22
|
+
attribute :state, Types::Integer.enum(0, 1)
|
23
|
+
|
24
|
+
# {"min":"0","max":"1.0"}
|
25
|
+
attribute :progress, Types::JSON::Decimal.constrained(gteq: 0, lteq: 1.0)
|
26
|
+
|
27
|
+
attribute :wayline_id, Types::Integer
|
28
|
+
|
29
|
+
attribute :break_reason, Types::Integer
|
30
|
+
|
31
|
+
attribute :latitude, Types::Latitude
|
32
|
+
attribute :longitude, Types::Longitude
|
33
|
+
|
34
|
+
# {"unit":"m","unitName":"meter"}
|
35
|
+
attribute :height, Types::JSON::Decimal
|
36
|
+
|
37
|
+
attribute :attitude_head, Types::Integer
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# {"partially_done":"partially done","sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
42
|
+
attribute :status, Types::String.enum(
|
43
|
+
"partially_done",
|
44
|
+
"sent",
|
45
|
+
"in_progress",
|
46
|
+
"ok",
|
47
|
+
"paused",
|
48
|
+
"rejected",
|
49
|
+
"failed",
|
50
|
+
"canceled",
|
51
|
+
"timeout"
|
52
|
+
)
|
53
|
+
|
54
|
+
attribute :progress do
|
55
|
+
# {"0-4":"MissionCenter starting, checking and resuming","5-18":"Waiting state","19, 20":"Task executing","21-29":"Returning to home","30-39":"Pulling logs","Others":"Interaction completed"}
|
56
|
+
attribute :current_step, Types::Integer
|
57
|
+
|
58
|
+
# {"min":"0","max":"100","step":"1"}
|
59
|
+
attribute :percent, Types::Integer.constrained(gteq: 0, lteq: 100)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
attribute :result, Types::Integer
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
# Notification of task readiness
|
6
|
+
# https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/thing-model/gateway/dock/wayline.html#notification-of-task-readiness
|
7
|
+
class FlighttaskReadyEventsMessage < EventsMessage
|
8
|
+
attribute :_method, Types::String.enum("flighttask_ready")
|
9
|
+
|
10
|
+
attribute :data do
|
11
|
+
attribute :flight_ids, Types::Array.of(Types::String)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -5,16 +5,9 @@ module DjiMqttConnect
|
|
5
5
|
class HighestPriorityUploadFlighttaskMediaEventsMessage < EventsMessage
|
6
6
|
attribute :_method, Types::String.enum("highest_priority_upload_flighttask_media")
|
7
7
|
|
8
|
-
# NOTE: Not documented, but appears in examples
|
9
|
-
attribute? :need_reply, Types::Integer.enum(0, 1)
|
10
|
-
|
11
8
|
attribute :data do
|
12
9
|
attribute :flight_id, Types::String
|
13
10
|
end
|
14
|
-
|
15
|
-
def need_reply?
|
16
|
-
need_reply == 1
|
17
|
-
end
|
18
11
|
end
|
19
12
|
end
|
20
13
|
end
|
@@ -7,9 +7,16 @@ module DjiMqttConnect
|
|
7
7
|
attribute :tid, Types::UUID
|
8
8
|
attribute :timestamp, Types::Timestamp
|
9
9
|
|
10
|
+
# NOTE: Included in most events messages, requires a reply on the events_reply topic if true
|
11
|
+
attribute? :need_reply, Types::Integer.enum(0, 1)
|
12
|
+
|
10
13
|
attribute :_data, Types::Hash
|
11
14
|
attribute :_method, Types::String
|
12
15
|
|
16
|
+
def need_reply?
|
17
|
+
need_reply == 1
|
18
|
+
end
|
19
|
+
|
13
20
|
def to_s
|
14
21
|
# Include data method for Generic messages
|
15
22
|
instance_of?(EventsMessage) ? "#{super}[#{_method}]" : super
|
@@ -22,8 +22,11 @@ module DjiMqttConnect
|
|
22
22
|
attribute :timestamp, Types::Timestamp
|
23
23
|
|
24
24
|
attribute :_method, Types::String.enum(
|
25
|
+
"device_exit_homing_notify",
|
25
26
|
"file_upload_callback",
|
26
27
|
"fileupload_progress",
|
28
|
+
"flighttask_progress",
|
29
|
+
"flighttask_ready",
|
27
30
|
"highest_priority_upload_flighttask_media"
|
28
31
|
)
|
29
32
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
# Get the wayline task resource
|
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 FlighttaskResourceGetRequestsMessage < RequestsMessage
|
8
|
+
attribute :_method, Types::String.enum("flighttask_resource_get")
|
9
|
+
|
10
|
+
attribute :data do
|
11
|
+
attribute :flight_id, Types::String
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
# Get the wayline task resource
|
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
|
8
|
+
def self.build_for(airport_organization_get_message, file:, result: 0)
|
9
|
+
new(
|
10
|
+
_method: airport_organization_get_message._method,
|
11
|
+
tid: airport_organization_get_message.tid,
|
12
|
+
bid: airport_organization_get_message.bid,
|
13
|
+
timestamp: current_timestamp,
|
14
|
+
data: {
|
15
|
+
result: result,
|
16
|
+
output: {
|
17
|
+
file: file
|
18
|
+
}
|
19
|
+
}
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
attribute :tid, Types::UUID
|
24
|
+
attribute :bid, Types::UUID
|
25
|
+
attribute :timestamp, Types::Timestamp
|
26
|
+
|
27
|
+
attribute :_method, Types::String.enum("flighttask_resource_get")
|
28
|
+
|
29
|
+
attribute :data do
|
30
|
+
attribute :result, Types::Integer
|
31
|
+
|
32
|
+
attribute :output do
|
33
|
+
attribute :file do
|
34
|
+
# File MD5 signature
|
35
|
+
attribute :fingerprint, Types::String
|
36
|
+
|
37
|
+
# File URL
|
38
|
+
attribute :url, Types::String
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class AlarmStateSwitchServicesMessage < ServicesMessage
|
6
|
+
ACTION_OPEN = 1
|
7
|
+
ACTION_CLOSE = 0
|
8
|
+
|
9
|
+
def self.build(action:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
10
|
+
new(
|
11
|
+
bid: bid,
|
12
|
+
tid: tid,
|
13
|
+
timestamp: timestamp,
|
14
|
+
_method: "alarm_state_switch",
|
15
|
+
data: {
|
16
|
+
action: action
|
17
|
+
}
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
attribute :_method, Types::String.enum("alarm_state_switch")
|
22
|
+
|
23
|
+
attribute :data do
|
24
|
+
# {"0":"Close","1":"Open"}
|
25
|
+
attribute :action, Types::Integer.enum(ACTION_CLOSE, ACTION_OPEN)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module DjiMqttConnect
|
4
4
|
module Thing::Product
|
5
|
-
class CoverCloseServicesMessage <
|
5
|
+
class CoverCloseServicesMessage < ServicesMessage
|
6
6
|
def self.build(bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
7
7
|
new(
|
8
8
|
bid: bid,
|
@@ -12,11 +12,8 @@ module DjiMqttConnect
|
|
12
12
|
)
|
13
13
|
end
|
14
14
|
|
15
|
-
attribute :tid, Types::UUID
|
16
|
-
attribute :bid, Types::UUID
|
17
|
-
attribute :timestamp, Types::Timestamp
|
18
|
-
|
19
15
|
attribute :_method, Types::String.enum("cover_close")
|
16
|
+
|
20
17
|
attribute :data, Types::Hash.default({}.freeze)
|
21
18
|
end
|
22
19
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module DjiMqttConnect
|
4
4
|
module Thing::Product
|
5
|
-
class CoverOpenServicesMessage <
|
5
|
+
class CoverOpenServicesMessage < ServicesMessage
|
6
6
|
def self.build(bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
7
7
|
new(
|
8
8
|
bid: bid,
|
@@ -12,11 +12,8 @@ module DjiMqttConnect
|
|
12
12
|
)
|
13
13
|
end
|
14
14
|
|
15
|
-
attribute :tid, Types::UUID
|
16
|
-
attribute :bid, Types::UUID
|
17
|
-
attribute :timestamp, Types::Timestamp
|
18
|
-
|
19
15
|
attribute :_method, Types::String.enum("cover_open")
|
16
|
+
|
20
17
|
attribute :data, Types::Hash.default({}.freeze)
|
21
18
|
end
|
22
19
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class DebugModeCloseServicesMessage < ServicesMessage
|
6
|
+
def self.build(bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
7
|
+
new(
|
8
|
+
bid: bid,
|
9
|
+
tid: tid,
|
10
|
+
timestamp: timestamp,
|
11
|
+
_method: "debug_mode_close"
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
attribute :_method, Types::String.enum("debug_mode_close")
|
16
|
+
|
17
|
+
attribute :data, Types::Hash.default({}.freeze)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class DebugModeOpenServicesMessage < ServicesMessage
|
6
|
+
def self.build(bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
7
|
+
new(
|
8
|
+
bid: bid,
|
9
|
+
tid: tid,
|
10
|
+
timestamp: timestamp,
|
11
|
+
_method: "debug_mode_open"
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
attribute :_method, Types::String.enum("debug_mode_open")
|
16
|
+
|
17
|
+
attribute :data, Types::Hash.default({}.freeze)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module DjiMqttConnect
|
4
4
|
module Thing::Product
|
5
|
-
class FileuploadListServicesMessage <
|
5
|
+
class FileuploadListServicesMessage < ServicesMessage
|
6
6
|
def self.build(module_list:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
7
7
|
new(
|
8
8
|
_method: "fileupload_list",
|
@@ -17,9 +17,6 @@ module DjiMqttConnect
|
|
17
17
|
|
18
18
|
attribute :_method, Types::String.enum("fileupload_list")
|
19
19
|
|
20
|
-
attribute :tid, Types::UUID
|
21
|
-
attribute :bid, Types::UUID
|
22
|
-
attribute :timestamp, Types::Timestamp
|
23
20
|
attribute :data do
|
24
21
|
attribute :module_list, Types::Array.of(Types::Coercible::String.enum("0", "3"))
|
25
22
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module DjiMqttConnect
|
4
4
|
module Thing::Product
|
5
|
-
class FileuploadStartServicesMessage <
|
5
|
+
class FileuploadStartServicesMessage < ServicesMessage
|
6
6
|
def self.build(data:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
7
7
|
new(
|
8
8
|
_method: "fileupload_start",
|
@@ -15,10 +15,6 @@ module DjiMqttConnect
|
|
15
15
|
|
16
16
|
attribute :_method, Types::String.enum("fileupload_start")
|
17
17
|
|
18
|
-
attribute :tid, Types::UUID
|
19
|
-
attribute :bid, Types::UUID
|
20
|
-
attribute :timestamp, Types::Timestamp
|
21
|
-
|
22
18
|
attribute :data do
|
23
19
|
attribute :endpoint, Types::String
|
24
20
|
attribute :bucket, Types::String
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
# Execute wayline task
|
6
|
+
# https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/thing-model/gateway/dock/wayline.html#execute-wayline-task
|
7
|
+
class FlighttaskExecuteServicesMessage < ServicesMessage
|
8
|
+
def self.build(flight_id:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
9
|
+
new(
|
10
|
+
bid: bid,
|
11
|
+
tid: tid,
|
12
|
+
timestamp: timestamp,
|
13
|
+
_method: "flighttask_execute",
|
14
|
+
data: {
|
15
|
+
flight_id: flight_id
|
16
|
+
}
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
attribute :_method, Types::String.enum("flighttask_execute")
|
21
|
+
|
22
|
+
attribute :data do
|
23
|
+
attribute :flight_id, Types::String
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class FlighttaskPauseServicesMessage < ServicesMessage
|
6
|
+
def self.build(bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
7
|
+
new(
|
8
|
+
bid: bid,
|
9
|
+
tid: tid,
|
10
|
+
timestamp: timestamp,
|
11
|
+
_method: "flighttask_pause"
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
attribute :_method, Types::String.enum("flighttask_pause")
|
16
|
+
|
17
|
+
attribute :data, Types::Hash.default({}.freeze)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
# Issue wayline task
|
6
|
+
# https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/thing-model/gateway/dock/wayline.html#issue-wayline-task
|
7
|
+
class FlighttaskPrepareServicesMessage < 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_prepare",
|
14
|
+
data: data
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
attribute :_method, Types::String.enum("flighttask_prepare")
|
19
|
+
|
20
|
+
attribute :data do
|
21
|
+
# Millisecond timestamp of task execution time.
|
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
|
24
|
+
|
25
|
+
attribute :flight_id, Types::String
|
26
|
+
|
27
|
+
# The execution time of immediate task and timed task are defined by execute_time.
|
28
|
+
# The conditional task supports the task readiness condition defined by ready_conditions.
|
29
|
+
# The task can be executed if conditions are satisfied within a specified period.
|
30
|
+
# Immediate task has the highest priority.
|
31
|
+
# Timed task and conditional task have the same priority.
|
32
|
+
# {"0":"Immediate task","1":"Timed task","2":"Conditional task"}
|
33
|
+
attribute :task_type, Types::Integer.enum(0, 1, 2)
|
34
|
+
|
35
|
+
# {"0":"Normal waypoint wayline"}
|
36
|
+
attribute :wayline_type, Types::Integer.enum(0)
|
37
|
+
|
38
|
+
attribute :file do
|
39
|
+
# File MD5 signature
|
40
|
+
attribute :fingerprint, Types::String
|
41
|
+
|
42
|
+
# File URL
|
43
|
+
attribute :url, Types::String
|
44
|
+
end
|
45
|
+
|
46
|
+
# Optional field. For conditional task (which means the task_type is 2), this field is required. For other types of tasks, this field is ignored.
|
47
|
+
# After the conditional task is issued, device will check whether the ready_conditions are satisfied or not at a fixed frequency.
|
48
|
+
# If conditions are satisfied, flighttask_ready event will be sent.
|
49
|
+
# When the device side receives the flighttask_execute command, conditions of the ready_conditions of task will be checked whether they are all satisfied.
|
50
|
+
attribute? :ready_conditions do
|
51
|
+
attribute? :battery_capacity, Types::Integer
|
52
|
+
|
53
|
+
attribute? :begin_time, Types::Timestamp
|
54
|
+
|
55
|
+
attribute? :end_time, Types::Timestamp
|
56
|
+
end
|
57
|
+
|
58
|
+
# Optional field. Pre-check conditions added for task execution on the device side. If any condition is not satisfied, execution will fail.
|
59
|
+
attribute? :executable_conditions do
|
60
|
+
attribute :storage_capacity, Types::Integer
|
61
|
+
end
|
62
|
+
|
63
|
+
# Optional field for resuming interrupted wayline task. If specified, the wayline task will start executing from the breakpoint position indicated by the field.
|
64
|
+
attribute? :break_point do
|
65
|
+
attribute :index, Types::Integer
|
66
|
+
|
67
|
+
# {"0":"On the wayline segment","1":"On the waypoint"}
|
68
|
+
attribute :state, Types::Integer.enum(0, 1)
|
69
|
+
|
70
|
+
attribute :progress, Types::Float.constrained(gteq: 0, lteq: 1.0)
|
71
|
+
|
72
|
+
attribute :wayline_id, Types::Integer
|
73
|
+
end
|
74
|
+
|
75
|
+
# {"unit":"meter","min":20,"max":1500}
|
76
|
+
attribute :rth_altitude, Types::Integer.constrained(gteq: 20, lteq: 1500)
|
77
|
+
|
78
|
+
# {"0":"Return to Home (RTH)","1":"Hovering","2":"Landing"}
|
79
|
+
attribute :out_of_control_action, Types::Integer.enum(0, 1, 2)
|
80
|
+
|
81
|
+
# {"0":"Continue executing the wayline task","1":"Exit the wayline task and execute the remote controller out of control action"}
|
82
|
+
attribute :exit_wayline_when_rc_lost, Types::Integer.enum(0, 1)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
# Resume wayline task
|
6
|
+
# https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/thing-model/gateway/dock/wayline.html#resume-wayline-task
|
7
|
+
class FlighttaskRecoveryServicesMessage < ServicesMessage
|
8
|
+
def self.build(bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
9
|
+
new(
|
10
|
+
bid: bid,
|
11
|
+
tid: tid,
|
12
|
+
timestamp: timestamp,
|
13
|
+
_method: "flighttask_recovery"
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
attribute :_method, Types::String.enum("flighttask_recovery")
|
18
|
+
|
19
|
+
attribute :data, Types::Hash.default({}.freeze)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
# Cancel wayline task
|
6
|
+
# https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/thing-model/gateway/dock/wayline.html#cancel-wayline-task
|
7
|
+
class FlighttaskUndoServicesMessage < ServicesMessage
|
8
|
+
def self.build(flight_ids:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
9
|
+
new(
|
10
|
+
bid: bid,
|
11
|
+
tid: tid,
|
12
|
+
timestamp: timestamp,
|
13
|
+
_method: "flighttask_undo",
|
14
|
+
data: {
|
15
|
+
flight_ids: flight_ids
|
16
|
+
}
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
attribute :_method, Types::String.enum("flighttask_undo")
|
21
|
+
|
22
|
+
attribute :data do
|
23
|
+
attribute :flight_ids, Types::Array.of(Types::String)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
# Return to Home (RTH)
|
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
|
8
|
+
def self.build(bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
9
|
+
new(
|
10
|
+
bid: bid,
|
11
|
+
tid: tid,
|
12
|
+
timestamp: timestamp,
|
13
|
+
_method: "return_home"
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
attribute :tid, Types::UUID
|
18
|
+
attribute :bid, Types::UUID
|
19
|
+
attribute :timestamp, Types::Timestamp
|
20
|
+
|
21
|
+
attribute :_method, Types::String.enum("return_home")
|
22
|
+
attribute :data, Types::Hash.default({}.freeze)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
# Cancel return to home
|
6
|
+
#
|
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
|
+
#
|
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
|
11
|
+
def self.build(bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
|
12
|
+
new(
|
13
|
+
bid: bid,
|
14
|
+
tid: tid,
|
15
|
+
timestamp: timestamp,
|
16
|
+
_method: "return_home_cancel"
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
attribute :tid, Types::UUID
|
21
|
+
attribute :bid, Types::UUID
|
22
|
+
attribute :timestamp, Types::Timestamp
|
23
|
+
|
24
|
+
attribute :_method, Types::String.enum("return_home_cancel")
|
25
|
+
attribute :data, Types::Hash.default({}.freeze)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class ServicesMessage < 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
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class AlarmStateSwitchServicesReplyMessage < ServicesReplyMessage
|
6
|
+
attribute :_method, Types::String.enum("alarm_state_switch")
|
7
|
+
|
8
|
+
attribute :data do
|
9
|
+
attribute :result, Types::Integer
|
10
|
+
|
11
|
+
attribute :output do
|
12
|
+
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
13
|
+
attribute :status, Types::String.enum(
|
14
|
+
"sent",
|
15
|
+
"in_progress",
|
16
|
+
"ok",
|
17
|
+
"paused",
|
18
|
+
"rejected",
|
19
|
+
"failed",
|
20
|
+
"canceled",
|
21
|
+
"timeout"
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|