dji_mqtt_connect 0.1.27.2 → 0.1.28
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/config/locales/thing_product_events.en.yml +2 -0
- data/config/locales/thing_product_osd.en.yml +1 -0
- data/lib/dji_mqtt_connect/factories/events_messages.rb +41 -0
- data/lib/dji_mqtt_connect/factories/services_messages.rb +8 -0
- data/lib/dji_mqtt_connect/factories.rb +104 -0
- data/lib/dji_mqtt_connect/marshals/thing/product/osd_marshal.rb +22 -1
- data/lib/dji_mqtt_connect/messages/thing/product/events/cover_close.rb +1 -2
- data/lib/dji_mqtt_connect/messages/thing/product/events/drone_close.rb +40 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/drone_open.rb +29 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/release_terminal_control_area.rb +2 -2
- data/lib/dji_mqtt_connect/messages/thing/product/events/uom_fly_data_info.rb +66 -0
- data/lib/dji_mqtt_connect/messages/thing/product/osd/dock.rb +11 -53
- data/lib/dji_mqtt_connect/messages/thing/product/osd/drone.rb +2 -4
- data/lib/dji_mqtt_connect/messages/thing/product/osd/flight_hub_dock.rb +276 -0
- data/lib/dji_mqtt_connect/messages/thing/product/osd_message.rb +3 -3
- data/lib/dji_mqtt_connect/messages/thing/product/requests/offline_map_get_v2.rb +13 -0
- data/lib/dji_mqtt_connect/messages/thing/product/requests/storage_config_get.rb +14 -1
- data/lib/dji_mqtt_connect/messages/thing/product/requests_reply/offline_map_get_v2.rb +27 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/drone_close.rb +18 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services/drone_open.rb +18 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/drone_close.rb +22 -0
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/drone_open.rb +22 -0
- data/lib/dji_mqtt_connect/messages/thing/product/state_message.rb +4 -4
- data/lib/dji_mqtt_connect/mixins/drone_charge_state.rb +17 -0
- data/lib/dji_mqtt_connect/mixins/network_state_quality.rb +19 -0
- data/lib/dji_mqtt_connect/mixins/network_state_type.rb +17 -0
- data/lib/dji_mqtt_connect/mixins/position_state_quality.rb +11 -0
- data/lib/dji_mqtt_connect/translations.rb +4 -0
- data/lib/dji_mqtt_connect/types.rb +20 -0
- data/lib/dji_mqtt_connect/version.rb +1 -1
- data/lib/dji_mqtt_connect.rb +14 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a3cb4405a25a3c1b68d7e59f9ca08d8b89ba847807614c8b37127cbf59e31f1
|
4
|
+
data.tar.gz: bb6b789291fd1563dc244e80b9a9a3f0eb58f508d1072a841e7796fb46bd9aa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90cf0d255e1f891ceb3a2a2034fa9e665bf88d9e53ff39a48635b0f5a49197a1b90144bb9bb7fd30e4b3c51f2f0fd2fe10b700f21336b93704678399eb28c841
|
7
|
+
data.tar.gz: b42b2addd144c918e861c1e704e57c385279e0efae12d7dbbb73eb0203c40d9592723928b115051961a51f3a03f63ae8489aa915c204cdb2d9ab2c544a1cf9db
|
@@ -6,6 +6,8 @@ en:
|
|
6
6
|
cover_open: "Cover opening: %{status} (%{current_step}/%{total_steps} %{percent}%)"
|
7
7
|
device_exit_homing_notify: "Device is exiting return to home: %{action} (%{reason})"
|
8
8
|
device_reboot: "Rebooting device: %{status} (%{current_step}/%{total_steps} %{percent}%)"
|
9
|
+
drone_close: "Aircraft shutdown: %{status} (%{percent}%)"
|
10
|
+
drone_open: "Aircraft Power-on: %{status}"
|
9
11
|
file_upload_callback: "Uploading file: %{file_name}"
|
10
12
|
fileupload_progress: "Uploading files: %{progress}"
|
11
13
|
flight_areas_sync_progress: "Syncing flight areas: %{status} (%{reason})"
|
@@ -2,6 +2,7 @@ en:
|
|
2
2
|
dji_mqtt_connect:
|
3
3
|
thing_product_osd_summary:
|
4
4
|
default: "Received OSD message"
|
5
|
+
flight_hub_dock: "Received OSD message from FlightHub Dock"
|
5
6
|
dock: "Received OSD message from Dock"
|
6
7
|
drone: "Received OSD message from Drone"
|
7
8
|
remote: "Received OSD message from Remote"
|
@@ -72,6 +72,47 @@ module DjiMqttConnect
|
|
72
72
|
)
|
73
73
|
end
|
74
74
|
|
75
|
+
def build_thing_product_drone_close_events_message
|
76
|
+
message_data = {
|
77
|
+
output: {
|
78
|
+
status: "in_progress",
|
79
|
+
progress: {
|
80
|
+
percent: 0,
|
81
|
+
step_key: "get_bid"
|
82
|
+
}
|
83
|
+
},
|
84
|
+
result: 0
|
85
|
+
}
|
86
|
+
Thing::Product::DroneCloseEventsMessage.new(
|
87
|
+
bid: Message.generate_bid,
|
88
|
+
tid: Message.generate_tid,
|
89
|
+
timestamp: Message.current_timestamp,
|
90
|
+
_method: "drone_close",
|
91
|
+
need_reply: 1,
|
92
|
+
data: message_data,
|
93
|
+
_data: message_data
|
94
|
+
)
|
95
|
+
end
|
96
|
+
|
97
|
+
def build_thing_product_drone_open_events_message
|
98
|
+
message_data = {
|
99
|
+
output: {
|
100
|
+
status: "in_progress"
|
101
|
+
},
|
102
|
+
result: 0
|
103
|
+
}
|
104
|
+
|
105
|
+
Thing::Product::DroneOpenEventsMessage.new(
|
106
|
+
bid: Message.generate_bid,
|
107
|
+
tid: Message.generate_tid,
|
108
|
+
timestamp: Message.current_timestamp,
|
109
|
+
_method: "drone_open",
|
110
|
+
need_reply: 1,
|
111
|
+
data: message_data,
|
112
|
+
_data: message_data
|
113
|
+
)
|
114
|
+
end
|
115
|
+
|
75
116
|
def build_thing_product_file_upload_callback_events_message
|
76
117
|
message_data = {
|
77
118
|
file: {
|
@@ -22,6 +22,14 @@ module DjiMqttConnect
|
|
22
22
|
Thing::Product::DebugModeOpenServicesMessage.build
|
23
23
|
end
|
24
24
|
|
25
|
+
def build_thing_product_drone_close_services_message
|
26
|
+
Thing::Product::DroneCloseServicesMessage.build
|
27
|
+
end
|
28
|
+
|
29
|
+
def build_thing_product_drone_open_services_message
|
30
|
+
Thing::Product::DroneOpenServicesMessage.build
|
31
|
+
end
|
32
|
+
|
25
33
|
def build_thing_product_fileupload_list_services_message
|
26
34
|
Thing::Product::FileuploadListServicesMessage.build(
|
27
35
|
module_list: [0, 3]
|
@@ -170,6 +170,79 @@ module DjiMqttConnect
|
|
170
170
|
)
|
171
171
|
end
|
172
172
|
|
173
|
+
def build_thing_product_flight_hub_dock_osd_message
|
174
|
+
message_data = {
|
175
|
+
host: {
|
176
|
+
air_conditioner: {
|
177
|
+
air_conditioner_state: 0,
|
178
|
+
switch_time: 0
|
179
|
+
},
|
180
|
+
alarm_state: 0,
|
181
|
+
alternate_land_point: {
|
182
|
+
height: 0,
|
183
|
+
is_configured: 1,
|
184
|
+
latitude: -33.76867482124178,
|
185
|
+
longitude: 150.94983762222526,
|
186
|
+
safe_land_height: 30
|
187
|
+
},
|
188
|
+
battery_store_mode: 2,
|
189
|
+
cover_state: 0,
|
190
|
+
drone_charge_state: {
|
191
|
+
capacity_percent: 95,
|
192
|
+
state: 0
|
193
|
+
},
|
194
|
+
drone_in_dock: 1,
|
195
|
+
emergency_stop_state: 0,
|
196
|
+
environment_temperature: 24.8,
|
197
|
+
first_power_on: 1631945855969,
|
198
|
+
heading: 164.2085418701172,
|
199
|
+
height: 62.20537567138672,
|
200
|
+
home_position_is_valid: 2,
|
201
|
+
humidity: 47,
|
202
|
+
latitude: -33.768706649492614,
|
203
|
+
longitude: 150.9497880000493,
|
204
|
+
mode_code: 0,
|
205
|
+
network_state: {
|
206
|
+
quality: 0,
|
207
|
+
rate: 3,
|
208
|
+
type: 2
|
209
|
+
},
|
210
|
+
position_state: {
|
211
|
+
gps_number: 6,
|
212
|
+
is_calibration: 1,
|
213
|
+
is_fixed: 3,
|
214
|
+
quality: 5,
|
215
|
+
rtk_number: 30
|
216
|
+
},
|
217
|
+
putter_state: 0,
|
218
|
+
rainfall: 0,
|
219
|
+
silent_mode: 0,
|
220
|
+
storage: {
|
221
|
+
total: 53082240,
|
222
|
+
used: 14370264
|
223
|
+
},
|
224
|
+
sub_device: {
|
225
|
+
device_online_status: 0,
|
226
|
+
device_paired: 1,
|
227
|
+
device_sn: "SN000002"
|
228
|
+
},
|
229
|
+
supplement_light_state: 0,
|
230
|
+
temperature: 33.1,
|
231
|
+
wind_speed: 0.8
|
232
|
+
},
|
233
|
+
sn: "SN00001"
|
234
|
+
}
|
235
|
+
|
236
|
+
Thing::Product::FlightHubDockOsdMessage.new(
|
237
|
+
OrganizationUUID: "b13d0443-4379-461b-b985-18184ffd324d",
|
238
|
+
biz_code: "device_osd",
|
239
|
+
version: "1.0",
|
240
|
+
timestamp: Message.current_timestamp,
|
241
|
+
data: message_data,
|
242
|
+
_data: message_data
|
243
|
+
)
|
244
|
+
end
|
245
|
+
|
173
246
|
# Status
|
174
247
|
|
175
248
|
def build_thing_product_update_topo_message_with_online_device
|
@@ -444,6 +517,8 @@ module DjiMqttConnect
|
|
444
517
|
)
|
445
518
|
end
|
446
519
|
|
520
|
+
### offline_map_get ###
|
521
|
+
|
447
522
|
def build_thing_product_offline_map_get_requests_message
|
448
523
|
message_data = {}
|
449
524
|
|
@@ -467,6 +542,35 @@ module DjiMqttConnect
|
|
467
542
|
)
|
468
543
|
end
|
469
544
|
|
545
|
+
### offline_map_get_v2 ###
|
546
|
+
|
547
|
+
def build_thing_product_offline_map_get_v2_requests_message
|
548
|
+
message_data = {
|
549
|
+
tile_type: ["base_map_dem", "semantic_info"]
|
550
|
+
}
|
551
|
+
|
552
|
+
Thing::Product::OfflineMapGetV2RequestsMessage.new(
|
553
|
+
_method: "offline_map_get_v2",
|
554
|
+
_data: message_data,
|
555
|
+
tid: Message.generate_tid,
|
556
|
+
bid: Message.generate_bid,
|
557
|
+
timestamp: Message.current_timestamp,
|
558
|
+
gateway: "GATEWAYSN",
|
559
|
+
data: message_data
|
560
|
+
)
|
561
|
+
end
|
562
|
+
|
563
|
+
def build_thing_product_offline_map_get_v2_requests_reply_message
|
564
|
+
request_message = build_thing_product_offline_map_get_v2_requests_message
|
565
|
+
|
566
|
+
Thing::Product::OfflineMapGetV2RequestsReplyMessage.build_for(
|
567
|
+
request_message,
|
568
|
+
result: 0
|
569
|
+
)
|
570
|
+
end
|
571
|
+
|
572
|
+
### storage_config_get ###
|
573
|
+
|
470
574
|
def build_thing_product_storage_config_get_requests_message
|
471
575
|
message_data = {
|
472
576
|
module: 0
|
@@ -32,6 +32,23 @@ module DjiMqttConnect
|
|
32
32
|
"4g_uav_quality" => "_4g_uav_quality"
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
# FlightHub Dock messages have a host attribute
|
37
|
+
guard ->(data) { data.key?("host") } do
|
38
|
+
map_value "host" do
|
39
|
+
# Rename the invalid (for Ruby) wireless link attributes
|
40
|
+
guard ->(data) { data.key?("wireless_link") } do
|
41
|
+
# Translate wireless_link 4g keys (from remote payload)
|
42
|
+
map_value "wireless_link" do
|
43
|
+
rename_keys "4g_freq_band" => "_4g_freq_band",
|
44
|
+
"4g_gnd_quality" => "_4g_gnd_quality",
|
45
|
+
"4g_link_state" => "_4g_link_state",
|
46
|
+
"4g_quality" => "_4g_quality",
|
47
|
+
"4g_uav_quality" => "_4g_uav_quality"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
35
52
|
end
|
36
53
|
end
|
37
54
|
end
|
@@ -42,7 +59,9 @@ module DjiMqttConnect
|
|
42
59
|
|
43
60
|
message_data = parsed_message.fetch("data", {})
|
44
61
|
|
45
|
-
message_class = if
|
62
|
+
message_class = if parsed_message.key?("OrganizationUUID")
|
63
|
+
FlightHubDockOsdMessage
|
64
|
+
elsif drone_osd_data_attributes.all? { |attribute| message_data.key?(attribute.to_s) }
|
46
65
|
DroneOsdMessage
|
47
66
|
elsif required_remote_osd_data_attributes.all? { |attribute| message_data.key?(attribute.to_s) } &&
|
48
67
|
optional_remote_osd_data_attributes.any? { |attribute| message_data.key?(attribute.to_s) }
|
@@ -55,6 +74,8 @@ module DjiMqttConnect
|
|
55
74
|
|
56
75
|
transformed_message = osd_transformer.call(parsed_message)
|
57
76
|
|
77
|
+
puts JSON.pretty_generate(transformed_message)
|
78
|
+
|
58
79
|
build_message(message_class, transformed_message)
|
59
80
|
end
|
60
81
|
|
@@ -17,8 +17,6 @@ module DjiMqttConnect
|
|
17
17
|
attribute :status, Types::ServicesOutputStatus
|
18
18
|
|
19
19
|
attribute :progress do
|
20
|
-
include Mixins::EventsProgressChecks
|
21
|
-
|
22
20
|
# {"min":"0","max":"100","step":"1"}
|
23
21
|
attribute :percent, Types::Integer.constrained(gteq: 0, lteq: 100)
|
24
22
|
|
@@ -28,6 +26,7 @@ module DjiMqttConnect
|
|
28
26
|
|
29
27
|
# {"get_bid":"Get bid","check_work_mode":"Check whether to enter remote debugging mode","check_task_state":"Check if the DJI Dock is free","land_mcu_reboot":"Land MCU reboot","rain_mcu_reboot":"Weather station MCU reboot","core_mcu_reboot":"Central control MCU reboot","sdr_reboot":"SDR reboot","write_reboot_param_file":"Write reboot flag","get_drone_power_state":"Get battery charge state","close_putter":"Close the putter","check_wired_connect_state":"Get aircraft state","open_drone":"Open the plane","open_alarm":"Open sound and light alarm","check_scram_state":"Check if the emergency stop switch is pressed","open_cover":"Open the hatch","check_drone_sdr_connect_state":"Establish SDR wireless connection","turn_on_drone":"Turn the plane on","drone_paddle_forward":"Turn on forward paddle","close_cover":"Close the hatch","drone_paddle_reverse":"Turn on reverse paddle","drone_paddle_stop":"Stop Paddle Rotation","free_putter":"Free Putter","stop_charge":"Stop charging"}
|
30
28
|
attribute? :step_key, Types::EventsProgressStepKey
|
29
|
+
include Mixins::EventsProgressChecks
|
31
30
|
|
32
31
|
attribute? :step_result, Types::Integer
|
33
32
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
# @see https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock1/cmd.html#shutdown-aircraft-progress
|
6
|
+
class DroneCloseEventsMessage < EventsMessage
|
7
|
+
attribute :_method, Types::String.enum("drone_close")
|
8
|
+
|
9
|
+
attribute :data do
|
10
|
+
include Mixins::ResultMessage
|
11
|
+
|
12
|
+
attribute :result, Types::ResultCode
|
13
|
+
|
14
|
+
attribute :output do
|
15
|
+
include Mixins::ServicesOutputStatusChecks
|
16
|
+
|
17
|
+
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
18
|
+
attribute :status, Types::ServicesOutputStatus
|
19
|
+
|
20
|
+
attribute :progress do
|
21
|
+
include Mixins::EventsProgressChecks
|
22
|
+
|
23
|
+
# {"min":"0","max":"100","step":"1"}
|
24
|
+
attribute :percent, Types::Integer.constrained(gteq: 0, lteq: 100)
|
25
|
+
|
26
|
+
# {"get_bid":"Get bid","check_work_mode":"Check whether to enter remote debugging mode","check_task_state":"Check if the DJI Dock is free","land_mcu_reboot":"Land MCU reboot","rain_mcu_reboot":"Weather station MCU reboot","core_mcu_reboot":"Central control MCU reboot","sdr_reboot":"SDR reboot","write_reboot_param_file":"Write reboot flag","get_drone_power_state":"Get battery charge state","close_putter":"Close the putter","check_wired_connect_state":"Get aircraft state","open_drone":"Open the plane","open_alarm":"Open sound and light alarm","check_scram_state":"Check if the emergency stop switch is pressed","open_cover":"Open the hatch","check_drone_sdr_connect_state":"Establish SDR wireless connection","turn_on_drone":"Turn the plane on","drone_paddle_forward":"Turn on forward paddle","close_cover":"Close the hatch","drone_paddle_reverse":"Turn on reverse paddle","drone_paddle_stop":"Stop Paddle Rotation","free_putter":"Free Putter","stop_charge":"Stop charging"}
|
27
|
+
attribute? :step_key, Types::EventsProgressStepKey
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def humanized_summary_interpolation
|
33
|
+
super.merge(
|
34
|
+
status: data.output.humanized_status,
|
35
|
+
percent: data.output.progress.percent
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
# @see https://developer.dji.com/doc/cloud-api-tutorial/en/api-reference/dock-to-cloud/mqtt/dock/dock1/cmd.html#aircraft-power-on-progress
|
6
|
+
class DroneOpenEventsMessage < EventsMessage
|
7
|
+
attribute :_method, Types::String.enum("drone_open")
|
8
|
+
|
9
|
+
attribute :data do
|
10
|
+
include Mixins::ResultMessage
|
11
|
+
|
12
|
+
attribute :result, Types::ResultCode
|
13
|
+
|
14
|
+
attribute :output do
|
15
|
+
include Mixins::ServicesOutputStatusChecks
|
16
|
+
|
17
|
+
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
18
|
+
attribute :status, Types::ServicesOutputStatus
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def humanized_summary_interpolation
|
23
|
+
super.merge(
|
24
|
+
status: data.output.humanized_status
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -7,13 +7,13 @@ module DjiMqttConnect
|
|
7
7
|
attribute :_method, Types::String.enum("release_terminal_control_area")
|
8
8
|
|
9
9
|
attribute :data do
|
10
|
-
attribute :flight_id, Types::
|
10
|
+
attribute :flight_id, Types::FlightID.optional
|
11
11
|
attribute :reason, Types::Integer
|
12
12
|
end
|
13
13
|
|
14
14
|
# All the flight IDs in the message
|
15
15
|
def flight_ids
|
16
|
-
[data.flight_id]
|
16
|
+
[data.flight_id].compact
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class UomFlyDataInfoEventsMessage < EventsMessage
|
6
|
+
attribute :_method, Types::String.enum("uom_fly_data_info")
|
7
|
+
|
8
|
+
attribute :data do
|
9
|
+
attribute :result, Types::ResultCode
|
10
|
+
include Mixins::ResultMessage
|
11
|
+
|
12
|
+
attribute? :output do
|
13
|
+
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
14
|
+
attribute? :status, Types::ServicesOutputStatus
|
15
|
+
include Mixins::ServicesOutputStatusChecks
|
16
|
+
|
17
|
+
attribute? :progress do
|
18
|
+
attribute? :current_step, Types::Integer
|
19
|
+
|
20
|
+
# {"min":"0","max":"100","step":"1"}
|
21
|
+
attribute? :percent, Types::Integer.constrained(gteq: 0, lteq: 100)
|
22
|
+
end
|
23
|
+
|
24
|
+
attribute? :ext do
|
25
|
+
attribute? :G5, Types::Integer
|
26
|
+
attribute? :VS, Types::Integer
|
27
|
+
|
28
|
+
attribute? :altitude, Types::JSON::Decimal
|
29
|
+
|
30
|
+
attribute? :area_code, Types::String
|
31
|
+
|
32
|
+
attribute? :coordinate, Types::Integer
|
33
|
+
|
34
|
+
attribute? :course, Types::Integer
|
35
|
+
|
36
|
+
attribute? :flight_status, Types::String
|
37
|
+
|
38
|
+
attribute? :height, Types::JSON::Decimal
|
39
|
+
|
40
|
+
attribute? :height_type, Types::Integer
|
41
|
+
|
42
|
+
attribute? :is_flying, Types::Bool
|
43
|
+
|
44
|
+
attribute? :is_simulator_open, Types::Bool
|
45
|
+
|
46
|
+
attribute? :latitude, Types::JSON::Decimal
|
47
|
+
|
48
|
+
attribute? :longitude, Types::JSON::Decimal
|
49
|
+
|
50
|
+
attribute? :manufacture_id, Types::String
|
51
|
+
|
52
|
+
attribute? :order_id, Types::String
|
53
|
+
|
54
|
+
attribute? :sn, Types::SerialNumber
|
55
|
+
|
56
|
+
attribute? :time_stamp, Types::Coercible::Integer
|
57
|
+
|
58
|
+
attribute? :uas_id, Types::String
|
59
|
+
|
60
|
+
attribute? :uas_model, Types::String
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -9,9 +9,6 @@ module DjiMqttConnect
|
|
9
9
|
job_number
|
10
10
|
]
|
11
11
|
|
12
|
-
# {"0":"Idle mode (No cooling, heating, and dehumidification)","1":"Cooling mode","2":"Heating mode","3":"Dehumidification mode","4":"Cooling exit mode","5":"Heating exit mode","6":"Dehumidification exit mode","7":"Cooling preparation mode","8":"Heating preparation mode","9":"Dehumidification preparation mode"}
|
13
|
-
AirConditionerState = Types::Integer.enum(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
|
14
|
-
|
15
12
|
attribute :data do
|
16
13
|
include Mixins::LatitudeConditional
|
17
14
|
include Mixins::LongitudeConditional
|
@@ -54,25 +51,14 @@ module DjiMqttConnect
|
|
54
51
|
|
55
52
|
attribute? :drone_charge_state do
|
56
53
|
# {"0":"not charging","1":"charging"}
|
57
|
-
attribute :state, Types::
|
58
|
-
|
59
|
-
STATE_CHARGING = 1
|
60
|
-
)
|
61
|
-
|
62
|
-
def humanized_state
|
63
|
-
state_key = case state
|
64
|
-
when STATE_NOT_CHARGING
|
65
|
-
"Not Charging"
|
66
|
-
when STATE_CHARGING
|
67
|
-
"Charging"
|
68
|
-
end
|
69
|
-
I18n.t(state_key.parameterize.underscore, scope: "dji_mqtt_connect.dock_drone_charge_state.state", default: state_key)
|
70
|
-
end
|
54
|
+
attribute :state, Types::DroneChargeState
|
55
|
+
include Mixins::DroneChargeState
|
71
56
|
|
72
57
|
# {"min":"0","max":"100"}
|
73
58
|
attribute :capacity_percent, Types::Integer
|
74
59
|
include Mixins::CapacityPercent
|
75
60
|
end
|
61
|
+
|
76
62
|
attribute? :drone_in_dock, Types::Integer.enum(0, 1)
|
77
63
|
|
78
64
|
attribute? :electric_supply_voltage, Types::Integer
|
@@ -104,38 +90,13 @@ module DjiMqttConnect
|
|
104
90
|
end
|
105
91
|
|
106
92
|
attribute? :network_state do
|
107
|
-
attribute :type, Types::
|
108
|
-
|
109
|
-
NETWORK_TYPE_ETHERNET = 2
|
110
|
-
)
|
111
|
-
attribute :quality, Types::Integer.enum(
|
112
|
-
QUALITY_BAD = 0,
|
113
|
-
QUALITY_MODERATE = 1,
|
114
|
-
QUALITY_GOOD = 2
|
115
|
-
)
|
116
|
-
attribute :rate, Types::JSON::Decimal
|
93
|
+
attribute :type, Types::NetworkStateType
|
94
|
+
include Mixins::NetworkStateType
|
117
95
|
|
118
|
-
|
119
|
-
|
120
|
-
when NETWORK_TYPE_4G
|
121
|
-
"4G"
|
122
|
-
when NETWORK_TYPE_ETHERNET
|
123
|
-
"Ethernet"
|
124
|
-
end
|
125
|
-
I18n.t(type_key.downcase, scope: "dji_mqtt_connect.dock_network_state.type", default: type_key)
|
126
|
-
end
|
96
|
+
attribute :quality, Types::NetworkStateQuality
|
97
|
+
include Mixins::NetworkStateQuality
|
127
98
|
|
128
|
-
|
129
|
-
quality_key = case quality
|
130
|
-
when QUALITY_BAD
|
131
|
-
"Bad"
|
132
|
-
when QUALITY_MODERATE
|
133
|
-
"Moderate"
|
134
|
-
when QUALITY_GOOD
|
135
|
-
"Good"
|
136
|
-
end
|
137
|
-
I18n.t(quality_key.downcase, scope: "dji_mqtt_connect.dock_network_state.quality", default: quality_key)
|
138
|
-
end
|
99
|
+
attribute :rate, Types::JSON::Decimal
|
139
100
|
end
|
140
101
|
|
141
102
|
attribute? :sdr do
|
@@ -212,10 +173,7 @@ module DjiMqttConnect
|
|
212
173
|
attribute :is_fixed, Types::Integer.enum(0, 1, 2, 3)
|
213
174
|
|
214
175
|
attribute :quality, Types::Integer
|
215
|
-
|
216
|
-
def quality?
|
217
|
-
quality && Types::PositionStateQuality.valid?(quality)
|
218
|
-
end
|
176
|
+
include Mixins::PositionStateQuality
|
219
177
|
|
220
178
|
attribute :gps_number, Types::Integer
|
221
179
|
attribute :rtk_number, Types::Integer
|
@@ -229,11 +187,11 @@ module DjiMqttConnect
|
|
229
187
|
attribute? :mode_code, Types::DockModeCode
|
230
188
|
|
231
189
|
attribute? :air_conditioner do
|
232
|
-
attribute :air_conditioner_state, AirConditionerState | Types::Integer
|
190
|
+
attribute :air_conditioner_state, Types::AirConditionerState | Types::Integer
|
233
191
|
attribute :switch_time, Types::Integer
|
234
192
|
|
235
193
|
def air_conditioner_state?
|
236
|
-
AirConditionerState.valid?(air_conditioner_state)
|
194
|
+
Types::AirConditionerState.valid?(air_conditioner_state)
|
237
195
|
end
|
238
196
|
end
|
239
197
|
|
@@ -78,11 +78,9 @@ module DjiMqttConnect
|
|
78
78
|
attribute :position_state do
|
79
79
|
attribute :gps_number, Types::Integer
|
80
80
|
attribute :is_fixed, Types::Integer
|
81
|
-
attribute :quality, Types::Integer
|
82
81
|
|
83
|
-
|
84
|
-
|
85
|
-
end
|
82
|
+
attribute :quality, Types::Integer
|
83
|
+
include Mixins::PositionStateQuality
|
86
84
|
|
87
85
|
attribute :rtk_number, Types::Integer
|
88
86
|
end
|