dji_mqtt_connect 0.1.13.1 → 0.1.14.1
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/config/locales/{dji_mqtt_connect.en.yml → hms_event_codes.en.yml} +1 -1
- data/config/locales/services_output_status.en.yml +13 -0
- data/lib/dji_mqtt_connect/factories.rb +158 -0
- data/lib/dji_mqtt_connect/messages/thing/product/events/cover_close.rb +9 -10
- data/lib/dji_mqtt_connect/messages/thing/product/events/cover_open.rb +9 -10
- data/lib/dji_mqtt_connect/messages/thing/product/osd/dock.rb +142 -8
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/alarm_state_switch.rb +3 -10
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/cover_close.rb +3 -10
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/cover_open.rb +3 -10
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/debug_mode_close.rb +3 -10
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/debug_mode_open.rb +3 -10
- data/lib/dji_mqtt_connect/messages/thing/product/services_reply/return_home.rb +3 -10
- data/lib/dji_mqtt_connect/mixins/services_output_status_checks.rb +27 -0
- data/lib/dji_mqtt_connect/types.rb +12 -0
- data/lib/dji_mqtt_connect/version.rb +1 -1
- data/lib/dji_mqtt_connect.rb +1 -0
- metadata +6 -4
- /data/config/locales/{dji_mqtt_connect.zh.yml → hms_event_codes.zh.yml} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47395f1b58ac06502a0920de3175c3410f11872f25c6248245b206bd4f4a5522
|
4
|
+
data.tar.gz: 72ff4759ad36e7f157b374a1d230d5f493e384a767b26a3d59d20e8a8f32c5c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acf0c009ffd5fbe14ad9b0ef6708dcb437e3d4ffdd1082e4aa567dbd7734b98f93b756155be1fbb820d291c86d4b11eb6ff14f4cca657e9abf67cb4cfbeb6ce2
|
7
|
+
data.tar.gz: fc2b1c92cc39e9d8581df7056c6531e3cc6979d66b2a8fba89e7818097e5723b7deda2bdb5c3f708cf5619eaab6d42fde52de05f7b93a06033cc1cdee60cc22c
|
data/Gemfile.lock
CHANGED
@@ -750,7 +750,7 @@
|
|
750
750
|
fpv_tip_0x16100006_in_the_sky: Invalid IMU serial number. Return to home or
|
751
751
|
land
|
752
752
|
fpv_tip_0x16100008: Compass calibrating. Unable to take off. Wait for calibration
|
753
|
-
to complete before taking off(%{alarmid})
|
753
|
+
to complete before taking off (%{alarmid})
|
754
754
|
fpv_tip_0x16100008_in_the_sky: Compass calibrating. Wait for calibration to
|
755
755
|
complete before taking off
|
756
756
|
fpv_tip_0x16100009: Sensor system initializing. Unable to take off. Wait for
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
:en:
|
3
|
+
:dji_mqtt_connect:
|
4
|
+
:cover_step_key:
|
5
|
+
check_drone_sdr_connect_state: "Check Drone SDR Connect State"
|
6
|
+
check_scram_state: "Check SCRAM State"
|
7
|
+
core_mcu_reboot: "Core MCU Reboot"
|
8
|
+
land_mcu_reboot: "Land MCU Reboot"
|
9
|
+
rain_mcu_reboot: "Rain MCU Reboot"
|
10
|
+
sdr_reboot: "SDR Reboot"
|
11
|
+
:services_output_status:
|
12
|
+
ok: "Success"
|
13
|
+
canceled: "Canceled or Stopped"
|
@@ -190,6 +190,164 @@ module DjiMqttConnect
|
|
190
190
|
)
|
191
191
|
end
|
192
192
|
|
193
|
+
# OSD
|
194
|
+
|
195
|
+
def build_thing_product_dock_osd_message_with_sub_device
|
196
|
+
message_data = {
|
197
|
+
network_state: {
|
198
|
+
type: 2,
|
199
|
+
quality: 0,
|
200
|
+
rate: 0.1459999978542328
|
201
|
+
},
|
202
|
+
drone_charge_state: {
|
203
|
+
state: 0,
|
204
|
+
capacity_percent: 0
|
205
|
+
},
|
206
|
+
drone_in_dock: 0,
|
207
|
+
rainfall: 1,
|
208
|
+
wind_speed: 0,
|
209
|
+
environment_temperature: 18.8,
|
210
|
+
temperature: 19.6,
|
211
|
+
humidity: 58,
|
212
|
+
latitude: 0,
|
213
|
+
longitude: 0,
|
214
|
+
height: 0,
|
215
|
+
alternate_land_point: {
|
216
|
+
latitude: "-33.865143",
|
217
|
+
longitude: "151.209900",
|
218
|
+
height: 0,
|
219
|
+
safe_land_height: 30,
|
220
|
+
is_configured: 0
|
221
|
+
},
|
222
|
+
first_power_on: 1631945855969,
|
223
|
+
position_state: {
|
224
|
+
is_calibration: 1,
|
225
|
+
is_fixed: 1,
|
226
|
+
quality: 1,
|
227
|
+
gps_number: 0,
|
228
|
+
rtk_number: 0
|
229
|
+
},
|
230
|
+
storage: {
|
231
|
+
total: 82045336,
|
232
|
+
used: 56385704
|
233
|
+
},
|
234
|
+
mode_code: 1,
|
235
|
+
cover_state: 1,
|
236
|
+
supplement_light_state: 0,
|
237
|
+
emergency_stop_state: 0,
|
238
|
+
air_conditioner: {
|
239
|
+
air_conditioner_state: 32767,
|
240
|
+
switch_time: 32767
|
241
|
+
},
|
242
|
+
battery_store_mode: 2,
|
243
|
+
alarm_state: 0,
|
244
|
+
putter_state: 1,
|
245
|
+
sub_device: {
|
246
|
+
device_sn: "M30DRONE01",
|
247
|
+
device_model_key: "0-67-0",
|
248
|
+
device_online_status: 0,
|
249
|
+
device_paired: 0
|
250
|
+
}
|
251
|
+
}
|
252
|
+
|
253
|
+
Thing::Product::DockOsdMessage.new(
|
254
|
+
tid: Message.generate_tid,
|
255
|
+
bid: Message.generate_bid,
|
256
|
+
timestamp: Message.current_timestamp,
|
257
|
+
gateway: "gatewaysn",
|
258
|
+
data: message_data,
|
259
|
+
_data: message_data
|
260
|
+
)
|
261
|
+
end
|
262
|
+
|
263
|
+
def build_thing_product_dock_osd_message_with_maintenance_status
|
264
|
+
message_data = {
|
265
|
+
job_number: 52,
|
266
|
+
acc_time: 146930,
|
267
|
+
activation_time: 1682969151,
|
268
|
+
maintain_status: {
|
269
|
+
maintain_status_array: [
|
270
|
+
{
|
271
|
+
state: 0,
|
272
|
+
last_maintain_type: 17,
|
273
|
+
last_maintain_time: 0,
|
274
|
+
last_maintain_work_sorties: 0
|
275
|
+
}
|
276
|
+
]
|
277
|
+
},
|
278
|
+
electric_supply_voltage: 0,
|
279
|
+
working_voltage: 0,
|
280
|
+
working_current: 0,
|
281
|
+
backup_battery: {
|
282
|
+
voltage: 24365,
|
283
|
+
temperature: 32767,
|
284
|
+
switch: 1
|
285
|
+
},
|
286
|
+
drone_battery_maintenance_info: {
|
287
|
+
batteries: [
|
288
|
+
{
|
289
|
+
index: 0,
|
290
|
+
capacity_percent: 32767,
|
291
|
+
voltage: 32767,
|
292
|
+
temperature: 32767
|
293
|
+
},
|
294
|
+
{
|
295
|
+
index: 1,
|
296
|
+
capacity_percent: 32767,
|
297
|
+
voltage: 32767,
|
298
|
+
temperature: 32767
|
299
|
+
}
|
300
|
+
]
|
301
|
+
}
|
302
|
+
}
|
303
|
+
|
304
|
+
Thing::Product::DockOsdMessage.new(
|
305
|
+
tid: Message.generate_tid,
|
306
|
+
bid: Message.generate_bid,
|
307
|
+
timestamp: Message.current_timestamp,
|
308
|
+
gateway: "gatewaysn",
|
309
|
+
data: message_data,
|
310
|
+
_data: message_data
|
311
|
+
)
|
312
|
+
end
|
313
|
+
|
314
|
+
def build_thing_product_dock_osd_message_with_link_status
|
315
|
+
message_data = {
|
316
|
+
drc_state: 0,
|
317
|
+
flighttask_prepare_capacity: 1,
|
318
|
+
flighttask_step_code: 255,
|
319
|
+
media_file_detail: {
|
320
|
+
remain_upload: 140
|
321
|
+
},
|
322
|
+
sdr: {
|
323
|
+
down_quality: 0,
|
324
|
+
frequency_band: 5.8,
|
325
|
+
up_quality: 0
|
326
|
+
},
|
327
|
+
wireless_link: {
|
328
|
+
_4g_freq_band: 2.4,
|
329
|
+
_4g_gnd_quality: 0,
|
330
|
+
_4g_link_state: 0,
|
331
|
+
_4g_quality: 0,
|
332
|
+
_4g_uav_quality: 0,
|
333
|
+
dongle_number: 0,
|
334
|
+
link_workmode: 0,
|
335
|
+
sdr_freq_band: 2.4,
|
336
|
+
sdr_link_state: 0,
|
337
|
+
sdr_quality: 0
|
338
|
+
}
|
339
|
+
}
|
340
|
+
|
341
|
+
Thing::Product::DockOsdMessage.new(
|
342
|
+
tid: Message.generate_tid,
|
343
|
+
bid: Message.generate_bid,
|
344
|
+
timestamp: Message.current_timestamp,
|
345
|
+
gateway: "gatewaysn",
|
346
|
+
data: message_data,
|
347
|
+
_data: message_data
|
348
|
+
)
|
349
|
+
end
|
350
|
+
|
193
351
|
# Status
|
194
352
|
|
195
353
|
def build_device_online_update_topo_message
|
@@ -9,17 +9,10 @@ module DjiMqttConnect
|
|
9
9
|
attribute :result, Types::Integer
|
10
10
|
|
11
11
|
attribute :output do
|
12
|
+
include Mixins::ServicesOutputStatusChecks
|
13
|
+
|
12
14
|
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
13
|
-
attribute :status, Types::
|
14
|
-
"sent",
|
15
|
-
"in_progress",
|
16
|
-
"ok",
|
17
|
-
"paused",
|
18
|
-
"rejected",
|
19
|
-
"failed",
|
20
|
-
"canceled",
|
21
|
-
"timeout"
|
22
|
-
)
|
15
|
+
attribute :status, Types::ServicesOutputStatus
|
23
16
|
|
24
17
|
attribute :progress do
|
25
18
|
# {"min":"0","max":"100","step":"1"}
|
@@ -56,6 +49,12 @@ module DjiMqttConnect
|
|
56
49
|
"stop_charge"
|
57
50
|
)
|
58
51
|
|
52
|
+
def humanized_step_key
|
53
|
+
return unless step_key
|
54
|
+
|
55
|
+
I18n.t(step_key, scope: "dji_mqtt_connect.cover_step_key", default: step_key.titleize)
|
56
|
+
end
|
57
|
+
|
59
58
|
attribute? :step_result, Types::Integer
|
60
59
|
end
|
61
60
|
end
|
@@ -9,17 +9,10 @@ module DjiMqttConnect
|
|
9
9
|
attribute :result, Types::Integer
|
10
10
|
|
11
11
|
attribute :output do
|
12
|
+
include Mixins::ServicesOutputStatusChecks
|
13
|
+
|
12
14
|
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
13
|
-
attribute :status, Types::
|
14
|
-
"sent",
|
15
|
-
"in_progress",
|
16
|
-
"ok",
|
17
|
-
"paused",
|
18
|
-
"rejected",
|
19
|
-
"failed",
|
20
|
-
"canceled",
|
21
|
-
"timeout"
|
22
|
-
)
|
15
|
+
attribute :status, Types::ServicesOutputStatus
|
23
16
|
|
24
17
|
attribute :progress do
|
25
18
|
# {"min":"0","max":"100","step":"1"}
|
@@ -56,6 +49,12 @@ module DjiMqttConnect
|
|
56
49
|
"stop_charge"
|
57
50
|
)
|
58
51
|
|
52
|
+
def humanized_step_key
|
53
|
+
return unless step_key
|
54
|
+
|
55
|
+
I18n.t(step_key, scope: "dji_mqtt_connect.cover_step_key", default: step_key.titleize)
|
56
|
+
end
|
57
|
+
|
59
58
|
attribute? :step_result, Types::Integer
|
60
59
|
end
|
61
60
|
end
|
@@ -53,7 +53,20 @@ module DjiMqttConnect
|
|
53
53
|
|
54
54
|
attribute? :drone_charge_state do
|
55
55
|
# {"0":"not charging","1":"charging"}
|
56
|
-
attribute :state, Types::Integer.enum(
|
56
|
+
attribute :state, Types::Integer.enum(
|
57
|
+
STATE_NOT_CHARGING = 0,
|
58
|
+
STATE_CHARGING = 1
|
59
|
+
)
|
60
|
+
|
61
|
+
def humanized_state
|
62
|
+
state_key = case state
|
63
|
+
when STATE_NOT_CHARGING
|
64
|
+
"Not Charging"
|
65
|
+
when STATE_CHARGING
|
66
|
+
"Charging"
|
67
|
+
end
|
68
|
+
I18n.t(state_key.parameterize.underscore, scope: "dji_mqtt_connect.dock_drone_charge_state.state", default: state_key)
|
69
|
+
end
|
57
70
|
|
58
71
|
# {"min":"0","max":"100"}
|
59
72
|
attribute :capacity_percent, Types::Integer.constrained(gteq: 0, lteq: 100)
|
@@ -88,9 +101,38 @@ module DjiMqttConnect
|
|
88
101
|
end
|
89
102
|
|
90
103
|
attribute? :network_state do
|
91
|
-
attribute :type, Types::Integer
|
92
|
-
|
104
|
+
attribute :type, Types::Integer.enum(
|
105
|
+
NETWORK_TYPE_4G = 1,
|
106
|
+
NETWORK_TYPE_ETHERNET = 2
|
107
|
+
)
|
108
|
+
attribute :quality, Types::Integer.enum(
|
109
|
+
QUALITY_BAD = 0,
|
110
|
+
QUALITY_MODERATE = 1,
|
111
|
+
QUALITY_GOOD = 2
|
112
|
+
)
|
93
113
|
attribute :rate, Types::JSON::Decimal
|
114
|
+
|
115
|
+
def humanized_type
|
116
|
+
type_key = case type
|
117
|
+
when NETWORK_TYPE_4G
|
118
|
+
"4G"
|
119
|
+
when NETWORK_TYPE_ETHERNET
|
120
|
+
"Ethernet"
|
121
|
+
end
|
122
|
+
I18n.t(type_key.downcase, scope: "dji_mqtt_connect.dock_network_state.type", default: type_key)
|
123
|
+
end
|
124
|
+
|
125
|
+
def humanized_quality
|
126
|
+
quality_key = case quality
|
127
|
+
when QUALITY_BAD
|
128
|
+
"Bad"
|
129
|
+
when QUALITY_MODERATE
|
130
|
+
"Moderate"
|
131
|
+
when QUALITY_GOOD
|
132
|
+
"Good"
|
133
|
+
end
|
134
|
+
I18n.t(quality_key.downcase, scope: "dji_mqtt_connect.dock_network_state.quality", default: quality_key)
|
135
|
+
end
|
94
136
|
end
|
95
137
|
|
96
138
|
attribute? :sdr do
|
@@ -164,22 +206,114 @@ module DjiMqttConnect
|
|
164
206
|
end
|
165
207
|
|
166
208
|
# {"0":"Closed","1":"Opened"}
|
167
|
-
attribute? :alarm_state, Types::Integer.enum(
|
209
|
+
attribute? :alarm_state, Types::Integer.enum(
|
210
|
+
ALARM_STATE_CLOSED = 0,
|
211
|
+
ALARM_STATE_OPEN = 1
|
212
|
+
)
|
213
|
+
|
214
|
+
def humanized_alarm_state
|
215
|
+
return unless alarm_state
|
216
|
+
|
217
|
+
state_key = case alarm_state
|
218
|
+
when ALARM_STATE_CLOSED
|
219
|
+
"Closed"
|
220
|
+
when ALARM_STATE_OPEN
|
221
|
+
"Open"
|
222
|
+
end
|
223
|
+
|
224
|
+
I18n.t(state_key.downcase, scope: "dji_mqtt_connect.dock_alarm_state", default: state_key)
|
225
|
+
end
|
168
226
|
|
169
227
|
# {"1":"Planned storage strategy of battery","2":"Emergency storage strategy of battery"}
|
170
228
|
attribute? :battery_store_mode, Types::Integer.enum(1, 2)
|
171
229
|
|
172
230
|
# {"0":"Closed","1":"Opened","2":"Half-open","3":"Cover state is abnormal"}
|
173
|
-
attribute? :cover_state, Types::Integer.enum(
|
231
|
+
attribute? :cover_state, Types::Integer.enum(
|
232
|
+
COVER_STATE_CLOSED = 0,
|
233
|
+
COVER_STATE_OPEN = 1,
|
234
|
+
COVER_STATE_HALF_OPEN = 2,
|
235
|
+
COVER_STATE_ABNORMAL = 3
|
236
|
+
)
|
237
|
+
|
238
|
+
def humanized_cover_state
|
239
|
+
return unless cover_state
|
240
|
+
|
241
|
+
state_key = case cover_state
|
242
|
+
when COVER_STATE_CLOSED
|
243
|
+
"Closed"
|
244
|
+
when COVER_STATE_OPEN
|
245
|
+
"Open"
|
246
|
+
when COVER_STATE_HALF_OPEN
|
247
|
+
"Half-open"
|
248
|
+
when COVER_STATE_ABNORMAL
|
249
|
+
"Abnormal"
|
250
|
+
end
|
251
|
+
|
252
|
+
I18n.t(state_key.parameterize.underscore, scope: "dji_mqtt_connect.dock_cover_state", default: state_key)
|
253
|
+
end
|
174
254
|
|
175
255
|
# {"0":"Closed","1":"Opened"}
|
176
|
-
attribute? :emergency_stop_state, Types::Integer.enum(
|
256
|
+
attribute? :emergency_stop_state, Types::Integer.enum(
|
257
|
+
EMERGENCY_STOP_STATE_CLOSED = 0,
|
258
|
+
EMERGENCY_STOP_STATE_OPEN = 1
|
259
|
+
)
|
260
|
+
|
261
|
+
def humanized_emergency_stop_state
|
262
|
+
return unless emergency_stop_state
|
263
|
+
|
264
|
+
state_key = case emergency_stop_state
|
265
|
+
when EMERGENCY_STOP_STATE_CLOSED
|
266
|
+
"Closed"
|
267
|
+
when EMERGENCY_STOP_STATE_OPEN
|
268
|
+
"Open"
|
269
|
+
end
|
270
|
+
|
271
|
+
I18n.t(state_key.downcase, scope: "dji_mqtt_connect.dock_emergency_stop_state", default: state_key)
|
272
|
+
end
|
177
273
|
|
178
274
|
# {"0":"Closed","1":"Opened","2":"Half-open","3":"Putter state is abnormal"}
|
179
|
-
attribute? :putter_state, Types::Integer.enum(
|
275
|
+
attribute? :putter_state, Types::Integer.enum(
|
276
|
+
PUTTER_STATE_CLOSED = 0,
|
277
|
+
PUTTER_STATE_OPEN = 1,
|
278
|
+
PUTTER_STATE_HALF_OPEN = 2,
|
279
|
+
PUTTER_STATE_ABNORMAL = 3
|
280
|
+
)
|
281
|
+
|
282
|
+
def humanized_putter_state
|
283
|
+
return unless putter_state
|
284
|
+
|
285
|
+
state_key = case putter_state
|
286
|
+
when PUTTER_STATE_CLOSED
|
287
|
+
"Closed"
|
288
|
+
when PUTTER_STATE_OPEN
|
289
|
+
"Open"
|
290
|
+
when PUTTER_STATE_HALF_OPEN
|
291
|
+
"Half-open"
|
292
|
+
when PUTTER_STATE_ABNORMAL
|
293
|
+
"Abnormal"
|
294
|
+
end
|
295
|
+
|
296
|
+
I18n.t(state_key.parameterize.underscore, scope: "dji_mqtt_connect.dock_putter_state", default: state_key)
|
297
|
+
end
|
180
298
|
|
181
299
|
# {"0":"Closed","1":"Opened"}
|
182
|
-
attribute? :supplement_light_state, Types::Integer.enum(
|
300
|
+
attribute? :supplement_light_state, Types::Integer.enum(
|
301
|
+
SUPPLEMENT_LIGHT_STATE_CLOSED = 0,
|
302
|
+
SUPPLEMENT_LIGHT_STATE_OPEN = 1
|
303
|
+
)
|
304
|
+
|
305
|
+
def humanized_supplement_light_state
|
306
|
+
return unless supplement_light_state
|
307
|
+
|
308
|
+
state_key = case supplement_light_state
|
309
|
+
when SUPPLEMENT_LIGHT_STATE_CLOSED
|
310
|
+
"Closed"
|
311
|
+
when SUPPLEMENT_LIGHT_STATE_OPEN
|
312
|
+
"Open"
|
313
|
+
end
|
314
|
+
|
315
|
+
I18n.t(state_key.downcase, scope: "dji_mqtt_connect.dock_supplement_light_state", default: state_key)
|
316
|
+
end
|
183
317
|
|
184
318
|
attribute? :sub_device do
|
185
319
|
attribute? :device_sn, Types::String
|
@@ -9,17 +9,10 @@ module DjiMqttConnect
|
|
9
9
|
attribute :result, Types::Integer
|
10
10
|
|
11
11
|
attribute :output do
|
12
|
+
include Mixins::ServicesOutputStatusChecks
|
13
|
+
|
12
14
|
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
13
|
-
attribute :status, Types::
|
14
|
-
"sent",
|
15
|
-
"in_progress",
|
16
|
-
"ok",
|
17
|
-
"paused",
|
18
|
-
"rejected",
|
19
|
-
"failed",
|
20
|
-
"canceled",
|
21
|
-
"timeout"
|
22
|
-
)
|
15
|
+
attribute :status, Types::ServicesOutputStatus
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
@@ -9,17 +9,10 @@ module DjiMqttConnect
|
|
9
9
|
attribute :result, Types::Integer
|
10
10
|
|
11
11
|
attribute :output do
|
12
|
+
include Mixins::ServicesOutputStatusChecks
|
13
|
+
|
12
14
|
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
13
|
-
attribute :status, Types::
|
14
|
-
"sent",
|
15
|
-
"in_progress",
|
16
|
-
"ok",
|
17
|
-
"paused",
|
18
|
-
"rejected",
|
19
|
-
"failed",
|
20
|
-
"canceled",
|
21
|
-
"timeout"
|
22
|
-
)
|
15
|
+
attribute :status, Types::ServicesOutputStatus
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
@@ -9,17 +9,10 @@ module DjiMqttConnect
|
|
9
9
|
attribute :result, Types::Integer
|
10
10
|
|
11
11
|
attribute :output do
|
12
|
+
include Mixins::ServicesOutputStatusChecks
|
13
|
+
|
12
14
|
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
13
|
-
attribute :status, Types::
|
14
|
-
"sent",
|
15
|
-
"in_progress",
|
16
|
-
"ok",
|
17
|
-
"paused",
|
18
|
-
"rejected",
|
19
|
-
"failed",
|
20
|
-
"canceled",
|
21
|
-
"timeout"
|
22
|
-
)
|
15
|
+
attribute :status, Types::ServicesOutputStatus
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
@@ -9,17 +9,10 @@ module DjiMqttConnect
|
|
9
9
|
attribute :result, Types::Integer
|
10
10
|
|
11
11
|
attribute :output do
|
12
|
+
include Mixins::ServicesOutputStatusChecks
|
13
|
+
|
12
14
|
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
13
|
-
attribute :status, Types::
|
14
|
-
"sent",
|
15
|
-
"in_progress",
|
16
|
-
"ok",
|
17
|
-
"paused",
|
18
|
-
"rejected",
|
19
|
-
"failed",
|
20
|
-
"canceled",
|
21
|
-
"timeout"
|
22
|
-
)
|
15
|
+
attribute :status, Types::ServicesOutputStatus
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
@@ -9,17 +9,10 @@ module DjiMqttConnect
|
|
9
9
|
attribute :result, Types::Integer
|
10
10
|
|
11
11
|
attribute :output do
|
12
|
+
include Mixins::ServicesOutputStatusChecks
|
13
|
+
|
12
14
|
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
13
|
-
attribute :status, Types::
|
14
|
-
"sent",
|
15
|
-
"in_progress",
|
16
|
-
"ok",
|
17
|
-
"paused",
|
18
|
-
"rejected",
|
19
|
-
"failed",
|
20
|
-
"canceled",
|
21
|
-
"timeout"
|
22
|
-
)
|
15
|
+
attribute :status, Types::ServicesOutputStatus
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
@@ -9,17 +9,10 @@ module DjiMqttConnect
|
|
9
9
|
attribute :result, Types::Integer
|
10
10
|
|
11
11
|
attribute :output do
|
12
|
+
include Mixins::ServicesOutputStatusChecks
|
13
|
+
|
12
14
|
# {"sent":"sent","in_progress":"in progress","ok":"succeeded","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or terminated","timeout":"timeout"}
|
13
|
-
attribute :status, Types::
|
14
|
-
"sent",
|
15
|
-
"in_progress",
|
16
|
-
"ok",
|
17
|
-
"paused",
|
18
|
-
"rejected",
|
19
|
-
"failed",
|
20
|
-
"canceled",
|
21
|
-
"timeout"
|
22
|
-
)
|
15
|
+
attribute :status, Types::ServicesOutputStatus
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
end
|
5
|
+
# frozen_string_literal: true
|
6
|
+
|
7
|
+
module DjiMqttConnect
|
8
|
+
module Mixins
|
9
|
+
# Provides checks for the output object that contains a Types::ServicesOutputStatus status value
|
10
|
+
module ServicesOutputStatusChecks
|
11
|
+
def status_finalized?
|
12
|
+
[
|
13
|
+
Types::SERVICE_OUTPUT_STATUS_OK,
|
14
|
+
Types::SERVICE_OUTPUT_STATUS_REJECTED,
|
15
|
+
Types::SERVICE_OUTPUT_STATUS_FAILED,
|
16
|
+
Types::SERVICE_OUTPUT_STATUS_CANCELED,
|
17
|
+
Types::SERVICE_OUTPUT_STATUS_TIMEOUT
|
18
|
+
].include?(status)
|
19
|
+
end
|
20
|
+
alias_method :status_finalised?, :status_finalized?
|
21
|
+
|
22
|
+
def humanized_status
|
23
|
+
I18n.t(status, scope: "dji_mqtt_connect.services_output_status", default: status.titleize)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -34,5 +34,17 @@ module DjiMqttConnect
|
|
34
34
|
|
35
35
|
InvalidTemperature = Types::Integer.constrained(gteq: 1300) # maximum temp of k-type thermocouple, errors are usually 30K+
|
36
36
|
Temperature = InvalidTemperature | Types::JSON::Decimal
|
37
|
+
|
38
|
+
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
39
|
+
ServicesOutputStatus = Types::String.enum(
|
40
|
+
SERVICE_OUTPUT_STATUS_SENT = "sent",
|
41
|
+
SERVICE_OUTPUT_STATUS_IN_PROGRESS = "in_progress",
|
42
|
+
SERVICE_OUTPUT_STATUS_OK = "ok",
|
43
|
+
SERVICE_OUTPUT_STATUS_PAUSED = "paused",
|
44
|
+
SERVICE_OUTPUT_STATUS_REJECTED = "rejected",
|
45
|
+
SERVICE_OUTPUT_STATUS_FAILED = "failed",
|
46
|
+
SERVICE_OUTPUT_STATUS_CANCELED = "canceled",
|
47
|
+
SERVICE_OUTPUT_STATUS_TIMEOUT = "timeout"
|
48
|
+
)
|
37
49
|
end
|
38
50
|
end
|
data/lib/dji_mqtt_connect.rb
CHANGED
@@ -126,6 +126,7 @@ module DjiMqttConnect
|
|
126
126
|
module Mixins
|
127
127
|
autoload :LatitudeConditional, "dji_mqtt_connect/mixins/latitude_conditional"
|
128
128
|
autoload :LongitudeConditional, "dji_mqtt_connect/mixins/longitude_conditional"
|
129
|
+
autoload :ServicesOutputStatusChecks, "dji_mqtt_connect/mixins/services_output_status_checks"
|
129
130
|
autoload :TemperatureConditional, "dji_mqtt_connect/mixins/temperature_conditional"
|
130
131
|
end
|
131
132
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dji_mqtt_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sphere Drones
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -103,8 +103,9 @@ files:
|
|
103
103
|
- Gemfile.lock
|
104
104
|
- README.md
|
105
105
|
- Rakefile
|
106
|
-
- config/locales/
|
107
|
-
- config/locales/
|
106
|
+
- config/locales/hms_event_codes.en.yml
|
107
|
+
- config/locales/hms_event_codes.zh.yml
|
108
|
+
- config/locales/services_output_status.en.yml
|
108
109
|
- dji_mqtt_connect.gemspec
|
109
110
|
- lib/dji_mqtt_connect.rb
|
110
111
|
- lib/dji_mqtt_connect/client.rb
|
@@ -184,6 +185,7 @@ files:
|
|
184
185
|
- lib/dji_mqtt_connect/messages/thing/product/services_reply_message.rb
|
185
186
|
- lib/dji_mqtt_connect/mixins/latitude_conditional.rb
|
186
187
|
- lib/dji_mqtt_connect/mixins/longitude_conditional.rb
|
188
|
+
- lib/dji_mqtt_connect/mixins/services_output_status_checks.rb
|
187
189
|
- lib/dji_mqtt_connect/mixins/temperature_conditional.rb
|
188
190
|
- lib/dji_mqtt_connect/railtie.rb
|
189
191
|
- lib/dji_mqtt_connect/railties/message_serializer.rb
|
File without changes
|