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
@@ -1,34 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry-transformer"
|
4
3
|
require "json"
|
5
4
|
|
6
5
|
module DjiMqttConnect
|
7
6
|
module Thing::Product
|
8
7
|
class EventsReplyMarshal < MessageMarshal
|
9
|
-
|
10
|
-
class HashTransformer < Dry::Transformer::Pipe
|
11
|
-
import Dry::Transformer::HashTransformations
|
12
|
-
|
13
|
-
define! do
|
14
|
-
rename_keys _method: :method
|
15
|
-
end
|
16
|
-
end
|
8
|
+
include Utils::MessageDumping
|
17
9
|
|
18
10
|
# Converts a message for transmission via MQTT
|
19
11
|
def dump(message)
|
20
12
|
# Fix up the hash representation
|
21
|
-
transformed_message =
|
13
|
+
transformed_message = convert_message_to_hash(message)
|
22
14
|
|
23
15
|
# Convert the transformed message into JSON
|
24
16
|
JSON.generate(transformed_message)
|
25
17
|
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def hash_transformer
|
30
|
-
@hash_transformer ||= HashTransformer.new
|
31
|
-
end
|
32
18
|
end
|
33
19
|
end
|
34
20
|
end
|
@@ -9,7 +9,7 @@ module DjiMqttConnect
|
|
9
9
|
include Utils::MessageParsing
|
10
10
|
|
11
11
|
# Make a copy of the raw data
|
12
|
-
class
|
12
|
+
class OsdTransformer < Dry::Transformer::Pipe
|
13
13
|
import Dry::Transformer::Conditional
|
14
14
|
import Dry::Transformer::HashTransformations
|
15
15
|
|
@@ -53,15 +53,15 @@ module DjiMqttConnect
|
|
53
53
|
OsdMessage
|
54
54
|
end
|
55
55
|
|
56
|
-
transformed_message =
|
56
|
+
transformed_message = osd_transformer.call(parsed_message)
|
57
57
|
|
58
58
|
build_message(message_class, transformed_message)
|
59
59
|
end
|
60
60
|
|
61
61
|
private
|
62
62
|
|
63
|
-
def
|
64
|
-
@
|
63
|
+
def osd_transformer
|
64
|
+
@osd_transformer ||= OsdTransformer.new
|
65
65
|
end
|
66
66
|
|
67
67
|
def dock_osd_data_attributes
|
@@ -10,7 +10,7 @@ module DjiMqttConnect
|
|
10
10
|
include Utils::MessageParsing
|
11
11
|
|
12
12
|
# Rename pesky `method` argument to `_method` and makes a copy of the raw data
|
13
|
-
class
|
13
|
+
class RequestsTransformer < Dry::Transformer::Pipe
|
14
14
|
import Dry::Transformer::HashTransformations
|
15
15
|
|
16
16
|
define! do
|
@@ -25,7 +25,7 @@ module DjiMqttConnect
|
|
25
25
|
parsed_message = parse_json(raw_message)
|
26
26
|
|
27
27
|
# Transform the message
|
28
|
-
transformed_message =
|
28
|
+
transformed_message = requests_transformer.call(parsed_message)
|
29
29
|
message_method = transformed_message["_method"]
|
30
30
|
|
31
31
|
# Build an instance of the class, or a generic message from the current class
|
@@ -35,8 +35,8 @@ module DjiMqttConnect
|
|
35
35
|
|
36
36
|
private
|
37
37
|
|
38
|
-
def
|
39
|
-
@
|
38
|
+
def requests_transformer
|
39
|
+
@requests_transformer ||= RequestsTransformer.new
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -1,34 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry-transformer"
|
4
3
|
require "json"
|
5
4
|
|
6
5
|
module DjiMqttConnect
|
7
6
|
module Thing::Product
|
8
7
|
class RequestsReplyMarshal < MessageMarshal
|
9
|
-
|
10
|
-
class HashTransformer < Dry::Transformer::Pipe
|
11
|
-
import Dry::Transformer::HashTransformations
|
12
|
-
|
13
|
-
define! do
|
14
|
-
rename_keys _method: :method
|
15
|
-
end
|
16
|
-
end
|
8
|
+
include Utils::MessageDumping
|
17
9
|
|
18
10
|
# Converts a message for transmission via MQTT
|
19
11
|
def dump(message)
|
20
12
|
# Fix up the hash representation
|
21
|
-
transformed_message =
|
13
|
+
transformed_message = convert_message_to_hash(message)
|
22
14
|
|
23
15
|
# Convert the transformed message into JSON
|
24
16
|
JSON.generate(transformed_message)
|
25
17
|
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def hash_transformer
|
30
|
-
@hash_transformer ||= HashTransformer.new
|
31
|
-
end
|
32
18
|
end
|
33
19
|
end
|
34
20
|
end
|
@@ -1,34 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry-transformer"
|
4
3
|
require "json"
|
5
4
|
|
6
5
|
module DjiMqttConnect
|
7
6
|
module Thing::Product
|
8
7
|
class ServicesMarshal < MessageMarshal
|
9
|
-
|
10
|
-
class HashTransformer < Dry::Transformer::Pipe
|
11
|
-
import Dry::Transformer::HashTransformations
|
12
|
-
|
13
|
-
define! do
|
14
|
-
rename_keys _method: :method
|
15
|
-
end
|
16
|
-
end
|
8
|
+
include Utils::MessageDumping
|
17
9
|
|
18
10
|
# Converts a message for transmission via MQTT
|
19
11
|
def dump(message)
|
20
12
|
# Fix up the hash representation
|
21
|
-
transformed_message =
|
13
|
+
transformed_message = convert_message_to_hash(message)
|
22
14
|
|
23
15
|
# Convert the transformed message into JSON
|
24
16
|
JSON.generate(transformed_message)
|
25
17
|
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def hash_transformer
|
30
|
-
@hash_transformer ||= HashTransformer.new
|
31
|
-
end
|
32
18
|
end
|
33
19
|
end
|
34
20
|
end
|
@@ -10,7 +10,7 @@ module DjiMqttConnect
|
|
10
10
|
include Utils::MessageParsing
|
11
11
|
|
12
12
|
# Rename pesky `method` argument to `_method` and makes a copy of the raw data
|
13
|
-
class
|
13
|
+
class ServicesReplyTransformer < Dry::Transformer::Pipe
|
14
14
|
import Dry::Transformer::HashTransformations
|
15
15
|
|
16
16
|
define! do
|
@@ -25,7 +25,7 @@ module DjiMqttConnect
|
|
25
25
|
parsed_message = parse_json(raw_message)
|
26
26
|
|
27
27
|
# Transform the message
|
28
|
-
transformed_message =
|
28
|
+
transformed_message = services_reply_transformer.call(parsed_message)
|
29
29
|
message_method = transformed_message["_method"]
|
30
30
|
|
31
31
|
# Build an instance of the class, or a generic message from the current class
|
@@ -35,8 +35,8 @@ module DjiMqttConnect
|
|
35
35
|
|
36
36
|
private
|
37
37
|
|
38
|
-
def
|
39
|
-
@
|
38
|
+
def services_reply_transformer
|
39
|
+
@services_reply_transformer ||= ServicesReplyTransformer.new
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -10,7 +10,7 @@ module DjiMqttConnect
|
|
10
10
|
include Utils::MessageParsing
|
11
11
|
|
12
12
|
# Rename pesky `method` argument to `_method` and makes a copy of the raw data
|
13
|
-
class
|
13
|
+
class StateTransformer < Dry::Transformer::Pipe
|
14
14
|
import Dry::Transformer::HashTransformations
|
15
15
|
|
16
16
|
define! do
|
@@ -24,7 +24,7 @@ module DjiMqttConnect
|
|
24
24
|
parsed_message = parse_json(raw_message)
|
25
25
|
|
26
26
|
# Transform the message
|
27
|
-
transformed_message =
|
27
|
+
transformed_message = state_transformer.call(parsed_message)
|
28
28
|
|
29
29
|
# Build an instance of the class, or a generic message from the current class
|
30
30
|
build_message(StateMessage, transformed_message)
|
@@ -32,8 +32,8 @@ module DjiMqttConnect
|
|
32
32
|
|
33
33
|
private
|
34
34
|
|
35
|
-
def
|
36
|
-
@
|
35
|
+
def state_transformer
|
36
|
+
@state_transformer ||= StateTransformer.new
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -1,34 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry-transformer"
|
4
3
|
require "json"
|
5
4
|
|
6
5
|
module DjiMqttConnect
|
7
6
|
module Thing::Product
|
8
7
|
class StateReplyMarshal < MessageMarshal
|
9
|
-
|
10
|
-
class HashTransformer < Dry::Transformer::Pipe
|
11
|
-
import Dry::Transformer::HashTransformations
|
12
|
-
|
13
|
-
define! do
|
14
|
-
rename_keys _method: :method
|
15
|
-
end
|
16
|
-
end
|
8
|
+
include Utils::MessageDumping
|
17
9
|
|
18
10
|
# Converts a message for transmission via MQTT
|
19
11
|
def dump(message)
|
20
12
|
# Fix up the hash representation
|
21
|
-
transformed_message =
|
13
|
+
transformed_message = convert_message_to_hash(message)
|
22
14
|
|
23
15
|
# Convert the transformed message into JSON
|
24
16
|
JSON.generate(transformed_message)
|
25
17
|
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def hash_transformer
|
30
|
-
@hash_transformer ||= HashTransformer.new
|
31
|
-
end
|
32
18
|
end
|
33
19
|
end
|
34
20
|
end
|
@@ -14,7 +14,7 @@ module DjiMqttConnect
|
|
14
14
|
attribute? :thing_version, Types::String # dock contains thing_version instead of version
|
15
15
|
|
16
16
|
attribute :sub_devices, Types::Array do
|
17
|
-
attribute :sn, Types::
|
17
|
+
attribute :sn, Types::SerialNumber
|
18
18
|
attribute? :domain, Types::DeviceDomain
|
19
19
|
attribute :type, Types::DeviceType
|
20
20
|
attribute :sub_type, Types::DeviceSubType
|
@@ -11,6 +11,16 @@ module DjiMqttConnect
|
|
11
11
|
attribute :_data, Types::Hash
|
12
12
|
attribute :_method, Types::String
|
13
13
|
|
14
|
+
attribute :data, Types::Hash.default({}.freeze)
|
15
|
+
|
16
|
+
def humanized_summary
|
17
|
+
Translations.sys_product_status_summary(_method, **humanized_summary_interpolation)
|
18
|
+
end
|
19
|
+
|
20
|
+
def humanized_summary_interpolation
|
21
|
+
data.to_h.merge(method: _method)
|
22
|
+
end
|
23
|
+
|
14
24
|
def to_s
|
15
25
|
# Include data method for Generic messages
|
16
26
|
instance_of?(StatusMessage) ? "#{super}[#{_method}]" : super
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module DjiMqttConnect
|
4
4
|
module Sys::Product
|
5
|
-
class UpdateTopoStatusReplyMessage <
|
5
|
+
class UpdateTopoStatusReplyMessage < StatusReplyMessage
|
6
6
|
# Builds a reply for an update_topo status message
|
7
7
|
# a result of 0 means we approve of this action
|
8
8
|
def self.build_for(update_topo_status_message, result: 0)
|
@@ -18,15 +18,6 @@ module DjiMqttConnect
|
|
18
18
|
end
|
19
19
|
|
20
20
|
attribute :_method, Types::String.enum("update_topo")
|
21
|
-
|
22
|
-
attribute :tid, Types::UUID
|
23
|
-
attribute :bid, Types::UUID
|
24
|
-
attribute :timestamp, Types::Timestamp
|
25
|
-
attribute :data do
|
26
|
-
include Mixins::ResultMessage
|
27
|
-
|
28
|
-
attribute :result, Types::ResultCode
|
29
|
-
end
|
30
21
|
end
|
31
22
|
end
|
32
23
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Sys::Product
|
5
|
+
class StatusReplyMessage < 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 do
|
16
|
+
include Mixins::ResultMessage
|
17
|
+
|
18
|
+
attribute :result, Types::ResultCode
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -4,31 +4,32 @@ module DjiMqttConnect
|
|
4
4
|
module Thing::Product
|
5
5
|
class AirsenseWarningEventsMessage < EventsMessage
|
6
6
|
attribute :_method, Types::String.enum("airsense_warning")
|
7
|
-
attribute :_data, Types::Array
|
8
7
|
|
9
|
-
attribute :data
|
10
|
-
attribute :
|
8
|
+
attribute :data do
|
9
|
+
attribute :list, Types::Array do
|
10
|
+
attribute :icao, Types::String
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
# {"0":"No danger","1":"Level one","2":"Level two","3":"Level three","4":"Level four"}
|
13
|
+
attribute :warning_level, Types::Integer.enum(0, 1, 2, 3, 4)
|
14
14
|
|
15
|
-
|
15
|
+
attribute :latitude, Types::Latitude
|
16
16
|
|
17
|
-
|
17
|
+
attribute :longitude, Types::Longitude
|
18
18
|
|
19
|
-
|
19
|
+
attribute :altitude, Types::Integer
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
# {"0":"Ellipsoid height","1":"altitude"}
|
22
|
+
attribute :altitude_type, Types::Integer.enum(0, 1)
|
23
23
|
|
24
|
-
|
24
|
+
attribute :distance, Types::Integer
|
25
25
|
|
26
|
-
|
26
|
+
attribute :heading, Types::JSON::Decimal
|
27
27
|
|
28
|
-
|
28
|
+
attribute :relative_altitude, Types::Integer
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
# {"0":"Relative height unchanged","1":"Relative height increase","2":"Relative height decrease"}
|
31
|
+
attribute :vert_trend, Types::Integer.enum(0, 1, 2)
|
32
|
+
end
|
32
33
|
end
|
33
34
|
end
|
34
35
|
end
|
@@ -33,6 +33,15 @@ module DjiMqttConnect
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
37
|
+
def humanized_summary_interpolation
|
38
|
+
super.merge(
|
39
|
+
status: data.output.humanized_status,
|
40
|
+
percent: data.output.progress.percent,
|
41
|
+
current_step: data.output.progress.current_step || "-",
|
42
|
+
total_steps: data.output.progress.total_steps || "-"
|
43
|
+
)
|
44
|
+
end
|
36
45
|
end
|
37
46
|
end
|
38
47
|
end
|
@@ -33,6 +33,15 @@ module DjiMqttConnect
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
37
|
+
def humanized_summary_interpolation
|
38
|
+
super.merge(
|
39
|
+
status: data.output.humanized_status,
|
40
|
+
percent: data.output.progress.percent,
|
41
|
+
current_step: data.output.progress.current_step || "-",
|
42
|
+
total_steps: data.output.progress.total_steps || "-"
|
43
|
+
)
|
44
|
+
end
|
36
45
|
end
|
37
46
|
end
|
38
47
|
end
|
@@ -4,6 +4,7 @@ module DjiMqttConnect
|
|
4
4
|
module Thing::Product
|
5
5
|
# Notification of device exits the Return to Home (RTH) state
|
6
6
|
# https://developer.dji.com/doc/cloud-api-tutorial/en/server-api-reference/mqtt/thing-model/gateway/dock/wayline.html#notification-of-device-exits-the-return-to-home-rth-state
|
7
|
+
# https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock2/wayline.html#device-notification-of-return-to-home-exit-state
|
7
8
|
class DeviceExitHomingNotifyEventsMessage < EventsMessage
|
8
9
|
ENTERING_EXIT_RTH_STATE_ACTION = 1
|
9
10
|
EXIT_EXITING_RTH_STATE_ACTION = 0
|
@@ -14,6 +15,10 @@ module DjiMqttConnect
|
|
14
15
|
# {"1":"Enter exiting RTH state"},{"0":"Exit exiting RTH state"}
|
15
16
|
attribute :action, Types::Coercible::Integer.enum(EXIT_EXITING_RTH_STATE_ACTION, ENTERING_EXIT_RTH_STATE_ACTION)
|
16
17
|
|
18
|
+
def humanized_action
|
19
|
+
I18n.t(action, scope: "dji_mqtt_connect.thing_product_device_exit_homing_notify_events_message.humanized_action")
|
20
|
+
end
|
21
|
+
|
17
22
|
attribute :sn, Types::SerialNumber
|
18
23
|
|
19
24
|
# {"0":"Add joystick throttle","1":"Add joystick pitch","2":"The initialization of behavior tree is failed","3":"Surrounded by obstacles","4":"Flight restriction is triggered","5":"Obstacle is too closed","6":"No GPS signal","7":"The output flag of GPS and VIO location is false","8":"The error of GPS and VIO fusion position is too large","9":"Backtrack in a short distance","10":"Trigger the RTH in a short distance"}
|
@@ -30,6 +35,14 @@ module DjiMqttConnect
|
|
30
35
|
BACKTRACK_IN_A_SHORT_DISTANCE_REASON = 9,
|
31
36
|
TRIGGER_THE_RTH_IN_A_SHORT_DISTANCE_REASON = 10
|
32
37
|
)
|
38
|
+
|
39
|
+
def humanized_reason
|
40
|
+
I18n.t(reason, scope: "dji_mqtt_connect.thing_product_device_exit_homing_notify_events_message.humanized_reason", default: "-")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def humanized_summary_interpolation
|
45
|
+
super.merge(action: data.humanized_action, reason: data.humanized_reason)
|
33
46
|
end
|
34
47
|
end
|
35
48
|
end
|
@@ -33,6 +33,15 @@ module DjiMqttConnect
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
37
|
+
def humanized_summary_interpolation
|
38
|
+
super.merge(
|
39
|
+
status: data.output.humanized_status,
|
40
|
+
percent: data.output.progress.percent,
|
41
|
+
current_step: data.output.progress.current_step || "-",
|
42
|
+
total_steps: data.output.progress.total_steps || "-"
|
43
|
+
)
|
44
|
+
end
|
36
45
|
end
|
37
46
|
end
|
38
47
|
end
|
@@ -18,7 +18,7 @@ module DjiMqttConnect
|
|
18
18
|
attribute :name, Types::String
|
19
19
|
|
20
20
|
attribute :ext do
|
21
|
-
attribute :flight_id, Types::
|
21
|
+
attribute :flight_id, Types::FlightID
|
22
22
|
|
23
23
|
attribute :drone_model_key, Types::String
|
24
24
|
|
@@ -50,6 +50,18 @@ module DjiMqttConnect
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
def humanized_summary_interpolation
|
55
|
+
super.merge(
|
56
|
+
file_name: data.file.name,
|
57
|
+
flight_id: data.file.ext.flight_id
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
# All the flight IDs in the message
|
62
|
+
def flight_ids
|
63
|
+
[data.file.ext.flight_id]
|
64
|
+
end
|
53
65
|
end
|
54
66
|
end
|
55
67
|
end
|
@@ -13,8 +13,12 @@ module DjiMqttConnect
|
|
13
13
|
# {"0":"Aircraft","3":"DJI Dock"}
|
14
14
|
attribute :module, Types::Coercible::Integer.enum(0, 3)
|
15
15
|
|
16
|
+
def humanized_module
|
17
|
+
I18n.t(self.module, scope: "dji_mqtt_connect.thing_product_fileupload_progress_events_message.humanized_module")
|
18
|
+
end
|
19
|
+
|
16
20
|
attribute :size, Types::Integer
|
17
|
-
attribute :device_sn, Types::
|
21
|
+
attribute :device_sn, Types::SerialNumber
|
18
22
|
attribute :key, Types::String
|
19
23
|
attribute? :fingerprint, Types::String
|
20
24
|
|
@@ -26,12 +30,35 @@ module DjiMqttConnect
|
|
26
30
|
attribute :upload_rate, Types::Integer
|
27
31
|
attribute? :result, Types::Integer
|
28
32
|
attribute :status, Types::String
|
33
|
+
|
34
|
+
def humanized_status
|
35
|
+
# NOTE: status shares many values with flighttask_status, but not all
|
36
|
+
I18n.t(status, scope: "dji_mqtt_connect.flighttask_status", default: status.titleize)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def humanized_summary
|
41
|
+
I18n.t(
|
42
|
+
"humanized_summary",
|
43
|
+
scope: "dji_mqtt_connect.thing_product_fileupload_progress_events_message",
|
44
|
+
module: humanized_module,
|
45
|
+
key: key.split("/").last,
|
46
|
+
status: progress.humanized_status,
|
47
|
+
progress: progress.progress
|
48
|
+
)
|
29
49
|
end
|
30
50
|
end
|
31
51
|
end
|
52
|
+
|
32
53
|
attribute :status, Types::String
|
33
54
|
end
|
34
55
|
end
|
56
|
+
|
57
|
+
def humanized_summary_interpolation
|
58
|
+
super.merge(
|
59
|
+
progress: data.output.ext.files.map(&:humanized_summary).join(", ")
|
60
|
+
)
|
61
|
+
end
|
35
62
|
end
|
36
63
|
end
|
37
64
|
end
|
@@ -21,6 +21,14 @@ module DjiMqttConnect
|
|
21
21
|
|
22
22
|
# {"1":"Failed to parse file information returned from the cloud.","2":"Failed to retrieve file information from the aircraft's end.","3":"Failed to download the file from the cloud.","4":"Link flipping failed.","5":"File transmission failed."}
|
23
23
|
attribute :reason, Types::Integer.enum(0, 1, 2, 3, 4, 5)
|
24
|
+
|
25
|
+
def humanized_reason
|
26
|
+
I18n.t(reason, scope: "dji_mqtt_connect.thing_product_flight_areas_sync_progress_events_message.humanized_reason")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def humanized_summary_interpolation
|
31
|
+
super.merge(reason: data.humanized_reason)
|
24
32
|
end
|
25
33
|
end
|
26
34
|
end
|