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
@@ -0,0 +1,276 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class FlightHubDockOsdMessage < OsdMessage
|
6
|
+
attribute :data do
|
7
|
+
attribute :host do
|
8
|
+
attribute? :acc_time, Types::Integer
|
9
|
+
|
10
|
+
attribute? :acdc_power_input, Types::JSON::Decimal
|
11
|
+
|
12
|
+
attribute? :air_conditioner do
|
13
|
+
attribute :air_conditioner_state, Types::AirConditionerState | Types::Integer
|
14
|
+
attribute :switch_time, Types::Integer
|
15
|
+
|
16
|
+
def air_conditioner_state?
|
17
|
+
Types::AirConditionerState.valid?(air_conditioner_state)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
attribute? :activation_time, Types::Integer
|
22
|
+
|
23
|
+
# {"0":"Closed","1":"Opened"}
|
24
|
+
attribute? :alarm_state, Types::Integer.enum(
|
25
|
+
ALARM_STATE_CLOSED = 0,
|
26
|
+
ALARM_STATE_OPEN = 1
|
27
|
+
)
|
28
|
+
|
29
|
+
attribute? :alternate_land_point do
|
30
|
+
attribute :latitude, Types::Latitude
|
31
|
+
attribute :longitude, Types::Longitude
|
32
|
+
attribute :height, Types::JSON::Decimal
|
33
|
+
attribute :safe_land_height, Types::JSON::Decimal
|
34
|
+
attribute :is_configured, Types::Integer.enum(0, 1)
|
35
|
+
end
|
36
|
+
|
37
|
+
attribute? :backup_battery do
|
38
|
+
include Mixins::TemperatureConditional
|
39
|
+
|
40
|
+
attribute :switch, Types::Integer.enum(0, 1)
|
41
|
+
attribute :voltage, Types::Integer
|
42
|
+
attribute :temperature, Types::Temperature
|
43
|
+
end
|
44
|
+
|
45
|
+
# {"1":"Planned storage strategy of battery","2":"Emergency storage strategy of battery"}
|
46
|
+
attribute? :battery_store_mode, Types::Integer.enum(1, 2)
|
47
|
+
|
48
|
+
# {"0":"Closed","1":"Opened","2":"Half-open","3":"Cover state is abnormal"}
|
49
|
+
attribute? :cover_state, Types::Integer.enum(
|
50
|
+
COVER_STATE_CLOSED = 0,
|
51
|
+
COVER_STATE_OPEN = 1,
|
52
|
+
COVER_STATE_HALF_OPEN = 2,
|
53
|
+
COVER_STATE_ABNORMAL = 3
|
54
|
+
)
|
55
|
+
|
56
|
+
attribute? :departure_point do
|
57
|
+
attribute :height, Types::JSON::Decimal
|
58
|
+
attribute :latitude, Types::Latitude
|
59
|
+
attribute :longitude, Types::Longitude
|
60
|
+
end
|
61
|
+
|
62
|
+
attribute? :departure_point_status, Types::Integer
|
63
|
+
|
64
|
+
attribute? :deployment_mode, Types::Integer
|
65
|
+
|
66
|
+
# {"0":"Disconnected","1":"Connecting","2":"Connected"}
|
67
|
+
attribute? :drc_state, Types::Integer.enum(0, 1, 2)
|
68
|
+
|
69
|
+
attribute? :drone_battery_maintenance_info do
|
70
|
+
attribute :batteries, Types::Array do
|
71
|
+
include Mixins::TemperatureConditional
|
72
|
+
|
73
|
+
attribute :index, Types::Integer
|
74
|
+
|
75
|
+
attribute :capacity_percent, Types::Integer
|
76
|
+
include Mixins::CapacityPercent
|
77
|
+
|
78
|
+
attribute :voltage, Types::Integer
|
79
|
+
attribute :temperature, Types::Temperature
|
80
|
+
end
|
81
|
+
|
82
|
+
# {"0":"Battery is not in heating or insulation","1":"Battery is in heating","2":"Battery is in insulation"}
|
83
|
+
attribute? :heat_state, Types::Integer.enum(0, 1, 2)
|
84
|
+
|
85
|
+
# {"0":"No need to maintenance","1":"Need maintenance","2":"Under maintenance"}
|
86
|
+
attribute? :maintenance_state, Types::Integer
|
87
|
+
attribute? :maintenance_time_left, Types::Integer
|
88
|
+
end
|
89
|
+
|
90
|
+
attribute? :drone_charge_state do
|
91
|
+
attribute :state, Types::DroneChargeState
|
92
|
+
include Mixins::DroneChargeState
|
93
|
+
|
94
|
+
# {"min":"0","max":"100"}
|
95
|
+
attribute :capacity_percent, Types::Integer
|
96
|
+
include Mixins::CapacityPercent
|
97
|
+
end
|
98
|
+
|
99
|
+
attribute? :drone_in_dock, Types::Integer.enum(0, 1)
|
100
|
+
|
101
|
+
attribute? :electric_supply_voltage, Types::Integer
|
102
|
+
|
103
|
+
# {"0":"Closed","1":"Opened"}
|
104
|
+
attribute? :emergency_stop_state, Types::Integer.enum(
|
105
|
+
EMERGENCY_STOP_STATE_CLOSED = 0,
|
106
|
+
EMERGENCY_STOP_STATE_OPEN = 1
|
107
|
+
)
|
108
|
+
|
109
|
+
attribute? :environment_temperature, Types::Temperature
|
110
|
+
|
111
|
+
attribute? :first_power_on, Types::Integer
|
112
|
+
|
113
|
+
attribute? :flighttask_prepare_capacity, Types::Integer
|
114
|
+
|
115
|
+
attribute? :flighttask_step_code, Types::FlightTaskStepCode
|
116
|
+
|
117
|
+
attribute? :gimbal_holder_state, Types::Integer
|
118
|
+
|
119
|
+
# {"max":"180","min":"-180","step":"","unit_name":"Degrees / °"}
|
120
|
+
attribute? :heading, Types::JSON::Decimal.constrained(gteq: -180, lteq: 180)
|
121
|
+
|
122
|
+
attribute? :height, Types::JSON::Decimal
|
123
|
+
|
124
|
+
attribute? :home_position_is_valid, Types::Integer
|
125
|
+
|
126
|
+
attribute? :humidity, Types::Integer
|
127
|
+
|
128
|
+
attribute? :job_number, Types::Integer
|
129
|
+
|
130
|
+
attribute? :latitude, Types::Latitude
|
131
|
+
|
132
|
+
attribute? :longitude, Types::Longitude
|
133
|
+
|
134
|
+
attribute? :maintain_status do
|
135
|
+
attribute :maintain_status_array, Types::Array do
|
136
|
+
# {"0":"No maintenance","1":"Under maintenance"}
|
137
|
+
attribute :state, Types::Integer
|
138
|
+
|
139
|
+
# {"0":"No maintenance","1":"Drone basic maintenance","2":"Drone routine maintenance","3":"Drone deep maintenance","17":"Dock maintenance"}
|
140
|
+
attribute :last_maintain_type, Types::Integer
|
141
|
+
|
142
|
+
attribute :last_maintain_time, Types::Integer
|
143
|
+
attribute :last_maintain_work_sorties, Types::Integer
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
attribute? :media_file_detail do
|
148
|
+
attribute :remain_upload, Types::Integer
|
149
|
+
end
|
150
|
+
|
151
|
+
attribute? :mode_code, Types::DockModeCode
|
152
|
+
|
153
|
+
attribute? :network_state do
|
154
|
+
attribute :type, Types::NetworkStateType
|
155
|
+
include Mixins::NetworkStateType
|
156
|
+
|
157
|
+
attribute :quality, Types::NetworkStateQuality
|
158
|
+
include Mixins::NetworkStateQuality
|
159
|
+
|
160
|
+
attribute :rate, Types::JSON::Decimal
|
161
|
+
end
|
162
|
+
|
163
|
+
attribute? :poe_link_status, Types::Integer
|
164
|
+
|
165
|
+
attribute? :poe_power_output, Types::Integer
|
166
|
+
|
167
|
+
attribute? :position_state do
|
168
|
+
# {"0":"Not calibrated","1":"Calibrated"}
|
169
|
+
attribute :is_calibration, Types::Integer.enum(0, 1)
|
170
|
+
|
171
|
+
# {"0":"Not start","1":"fixing","2":"fix successfully","3":"fix failed"}
|
172
|
+
attribute :is_fixed, Types::Integer.enum(0, 1, 2, 3)
|
173
|
+
|
174
|
+
attribute :quality, Types::Integer
|
175
|
+
include Mixins::PositionStateQuality
|
176
|
+
|
177
|
+
attribute :gps_number, Types::Integer
|
178
|
+
attribute :rtk_number, Types::Integer
|
179
|
+
end
|
180
|
+
|
181
|
+
# {"0":"Closed","1":"Opened","2":"Half-open","3":"Putter state is abnormal"}
|
182
|
+
attribute? :putter_state, Types::Integer.enum(
|
183
|
+
PUTTER_STATE_CLOSED = 0,
|
184
|
+
PUTTER_STATE_OPEN = 1,
|
185
|
+
PUTTER_STATE_HALF_OPEN = 2,
|
186
|
+
PUTTER_STATE_ABNORMAL = 3
|
187
|
+
)
|
188
|
+
|
189
|
+
# {"0":"No rain","1":"Light rain","2":"Moderate rain","3":"Heavy rain"}
|
190
|
+
attribute? :rainfall, Types::Integer.enum(
|
191
|
+
RAINFALL_NONE = 0,
|
192
|
+
RAINFALL_LIGHT = 1,
|
193
|
+
RAINFALL_MODERATE = 2,
|
194
|
+
RAINFALL_HEAVY = 3
|
195
|
+
)
|
196
|
+
|
197
|
+
attribute? :relative_alternate_land_point do
|
198
|
+
attribute :latitude, Types::Latitude
|
199
|
+
attribute :longitude, Types::Longitude
|
200
|
+
attribute :safe_land_height, Types::JSON::Decimal
|
201
|
+
attribute :status, Types::Integer
|
202
|
+
end
|
203
|
+
|
204
|
+
attribute? :sdr do
|
205
|
+
attribute :down_quality, Types::Integer
|
206
|
+
attribute :frequency_band, Types::JSON::Decimal
|
207
|
+
attribute :up_quality, Types::Integer
|
208
|
+
end
|
209
|
+
|
210
|
+
attribute? :self_converge_coordinate do
|
211
|
+
attribute :height, Types::JSON::Decimal
|
212
|
+
attribute :latitude, Types::Latitude
|
213
|
+
attribute :longitude, Types::Longitude
|
214
|
+
end
|
215
|
+
|
216
|
+
attribute? :silent_mode, Types::Integer
|
217
|
+
|
218
|
+
attribute? :storage do
|
219
|
+
attribute :total, Types::Integer
|
220
|
+
attribute :used, Types::Integer
|
221
|
+
end
|
222
|
+
|
223
|
+
attribute? :sub_device do
|
224
|
+
attribute? :device_sn, Types::SerialNumber
|
225
|
+
attribute? :device_model_key, Types::String
|
226
|
+
|
227
|
+
# {"0":"Offline","1":"Online"}
|
228
|
+
attribute :device_online_status, Types::Integer.enum(0, 1)
|
229
|
+
|
230
|
+
# {"0":"Not paired","1":"Paired"}
|
231
|
+
attribute :device_paired, Types::Integer.enum(0, 1)
|
232
|
+
end
|
233
|
+
|
234
|
+
attribute? :supplement_light_state, Types::Integer.enum(
|
235
|
+
SUPPLEMENT_LIGHT_STATE_CLOSED = 0,
|
236
|
+
SUPPLEMENT_LIGHT_STATE_OPEN = 1
|
237
|
+
)
|
238
|
+
|
239
|
+
attribute? :temperature, Types::Temperature
|
240
|
+
|
241
|
+
attribute? :tilt_angle do
|
242
|
+
attribute :valid, Types::Integer
|
243
|
+
attribute :value, Types::JSON::Decimal
|
244
|
+
end
|
245
|
+
|
246
|
+
attribute? :user_experience_improvement, Types::Integer
|
247
|
+
|
248
|
+
attribute? :wind_speed, Types::JSON::Decimal
|
249
|
+
|
250
|
+
attribute? :wireless_link do
|
251
|
+
attribute :_4g_freq_band, Types::JSON::Decimal
|
252
|
+
attribute :_4g_gnd_quality, Types::Integer
|
253
|
+
attribute :_4g_link_state, Types::Integer
|
254
|
+
attribute :_4g_quality, Types::Integer
|
255
|
+
attribute :_4g_uav_quality, Types::Integer
|
256
|
+
attribute :dongle_number, Types::Integer
|
257
|
+
attribute :link_workmode, Types::Integer
|
258
|
+
attribute :sdr_freq_band, Types::JSON::Decimal
|
259
|
+
attribute :sdr_link_state, Types::Integer
|
260
|
+
attribute :sdr_quality, Types::Integer
|
261
|
+
end
|
262
|
+
|
263
|
+
attribute? :working_current, Types::Integer
|
264
|
+
|
265
|
+
attribute? :working_voltage, Types::Integer
|
266
|
+
end # end #data
|
267
|
+
|
268
|
+
attribute :sn, Types::SerialNumber
|
269
|
+
end
|
270
|
+
|
271
|
+
def humanized_summary
|
272
|
+
Translations.thing_product_flight_hub_dock_osd_summary(**humanized_summary_interpolation)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
@@ -3,12 +3,12 @@
|
|
3
3
|
module DjiMqttConnect
|
4
4
|
module Thing::Product
|
5
5
|
class OsdMessage < DjiMqttConnect::Message
|
6
|
-
attribute :tid, Types::UUID
|
7
|
-
attribute :bid, Types::UUID
|
6
|
+
attribute? :tid, Types::UUID
|
7
|
+
attribute? :bid, Types::UUID
|
8
8
|
attribute :timestamp, Types::Timestamp
|
9
9
|
|
10
10
|
# Can be determined from the topic, but included for convenience
|
11
|
-
attribute :gateway, Types::SerialNumber
|
11
|
+
attribute? :gateway, Types::SerialNumber
|
12
12
|
|
13
13
|
# Backup of received data
|
14
14
|
attribute :_data, Types::Hash
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class OfflineMapGetV2RequestsMessage < RequestsMessage
|
6
|
+
attribute :_method, Types::String.enum("offline_map_get_v2")
|
7
|
+
|
8
|
+
attribute :data do
|
9
|
+
attribute :tile_type, Types::Array.of(Types::String).default([].freeze)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -7,7 +7,20 @@ module DjiMqttConnect
|
|
7
7
|
attribute :_method, Types::String.enum("storage_config_get")
|
8
8
|
|
9
9
|
attribute :data do
|
10
|
-
attribute :
|
10
|
+
attribute? :country_code, Types::String
|
11
|
+
|
12
|
+
attribute? :device_sn, Types::SerialNumber
|
13
|
+
|
14
|
+
attribute? :flight_id, Types::FlightID
|
15
|
+
|
16
|
+
attribute :sns_to_encrypted, Types::Array.of(Types::SerialNumber).default([].freeze)
|
17
|
+
|
18
|
+
attribute :module, Types::Integer
|
19
|
+
end
|
20
|
+
|
21
|
+
# All the flight IDs in the message
|
22
|
+
def flight_ids
|
23
|
+
[data.flight_id].compact
|
11
24
|
end
|
12
25
|
end
|
13
26
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class OfflineMapGetV2RequestsReplyMessage < RequestsReplyMessage
|
6
|
+
def self.build_for(offline_map_get, result: 0)
|
7
|
+
new(
|
8
|
+
_method: offline_map_get._method,
|
9
|
+
data: {
|
10
|
+
result: result
|
11
|
+
},
|
12
|
+
tid: offline_map_get.tid,
|
13
|
+
bid: offline_map_get.bid,
|
14
|
+
timestamp: current_timestamp
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
attribute :_method, Types::String.enum("offline_map_get_v2")
|
19
|
+
|
20
|
+
attribute :data do
|
21
|
+
include Mixins::ResultMessage
|
22
|
+
|
23
|
+
attribute :result, Types::ResultCode
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class DroneCloseServicesMessage < 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: "drone_close"
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
attribute :_method, Types::String.enum("drone_close")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class DroneOpenServicesMessage < 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: "drone_open"
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
attribute :_method, Types::String.enum("drone_open")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class DroneCloseServicesReplyMessage < ServicesReplyMessage
|
6
|
+
attribute :_method, Types::String.enum("drone_close")
|
7
|
+
|
8
|
+
attribute :data do
|
9
|
+
include Mixins::ResultMessage
|
10
|
+
|
11
|
+
attribute :result, Types::ResultCode
|
12
|
+
|
13
|
+
attribute :output do
|
14
|
+
include Mixins::ServicesOutputStatusChecks
|
15
|
+
|
16
|
+
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
17
|
+
attribute :status, Types::ServicesOutputStatus
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Thing::Product
|
5
|
+
class DroneOpenServicesReplyMessage < ServicesReplyMessage
|
6
|
+
attribute :_method, Types::String.enum("drone_open")
|
7
|
+
|
8
|
+
attribute :data do
|
9
|
+
include Mixins::ResultMessage
|
10
|
+
|
11
|
+
attribute :result, Types::ResultCode
|
12
|
+
|
13
|
+
attribute :output do
|
14
|
+
include Mixins::ServicesOutputStatusChecks
|
15
|
+
|
16
|
+
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
17
|
+
attribute :status, Types::ServicesOutputStatus
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -75,12 +75,12 @@ module DjiMqttConnect
|
|
75
75
|
# "gateway": "4BKBJ4R1010TGD"
|
76
76
|
# }
|
77
77
|
class StateMessage < DjiMqttConnect::Message
|
78
|
-
attribute :tid, Types::UUID
|
79
|
-
attribute :bid, Types::UUID
|
78
|
+
attribute? :tid, Types::UUID
|
79
|
+
attribute? :bid, Types::UUID
|
80
80
|
attribute :timestamp, Types::Timestamp
|
81
81
|
|
82
82
|
# Can be determined from the topic, but included for convenience
|
83
|
-
attribute :gateway, Types::SerialNumber
|
83
|
+
attribute? :gateway, Types::SerialNumber
|
84
84
|
|
85
85
|
attribute :_data, Types::Hash
|
86
86
|
|
@@ -93,7 +93,7 @@ module DjiMqttConnect
|
|
93
93
|
|
94
94
|
attribute :data do
|
95
95
|
attribute? :geo_caging_status do
|
96
|
-
attribute :state, Types::Integer
|
96
|
+
attribute? :state, Types::Integer
|
97
97
|
end
|
98
98
|
|
99
99
|
attribute? :cameras, Types::Array do
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Mixins
|
5
|
+
module DroneChargeState
|
6
|
+
def humanized_state
|
7
|
+
state_key = case state
|
8
|
+
when Types::DRONE_CHARGE_STATE_NOT_CHARGING
|
9
|
+
"Not Charging"
|
10
|
+
when Types::DRONE_CHARGE_STATE_CHARGING
|
11
|
+
"Charging"
|
12
|
+
end
|
13
|
+
I18n.t(state_key.parameterize.underscore, scope: "dji_mqtt_connect.dock_drone_charge_state.state", default: state_key)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Mixins
|
5
|
+
module NetworkStateQuality
|
6
|
+
def humanized_quality
|
7
|
+
quality_key = case quality
|
8
|
+
when Types::NETWORK_STATE_QUALITY_BAD
|
9
|
+
"Bad"
|
10
|
+
when Types::NETWORK_STATE_QUALITY_MODERATE
|
11
|
+
"Moderate"
|
12
|
+
when Types::NETWORK_STATE_QUALITY_GOOD
|
13
|
+
"Good"
|
14
|
+
end
|
15
|
+
I18n.t(quality_key.downcase, scope: "dji_mqtt_connect.dock_network_state.quality", default: quality_key)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DjiMqttConnect
|
4
|
+
module Mixins
|
5
|
+
module NetworkStateType
|
6
|
+
def humanized_type
|
7
|
+
type_key = case type
|
8
|
+
when Types::NETWORK_STATE_TYPE_4G
|
9
|
+
"4G"
|
10
|
+
when Types::NETWORK_STATE_TYPE_ETHERNET
|
11
|
+
"Ethernet"
|
12
|
+
end
|
13
|
+
I18n.t(type_key.downcase, scope: "dji_mqtt_connect.dock_network_state.type", default: type_key)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -153,6 +153,10 @@ module DjiMqttConnect
|
|
153
153
|
I18n.t("default", **data, scope: "dji_mqtt_connect.thing_product_osd_summary")
|
154
154
|
end
|
155
155
|
|
156
|
+
def thing_product_flight_hub_dock_osd_summary(**data)
|
157
|
+
I18n.t("flight_hub_dock", **data, scope: "dji_mqtt_connect.thing_product_osd_summary", default: :default)
|
158
|
+
end
|
159
|
+
|
156
160
|
def thing_product_dock_osd_summary(**data)
|
157
161
|
I18n.t("dock", **data, scope: "dji_mqtt_connect.thing_product_osd_summary", default: :default)
|
158
162
|
end
|
@@ -39,6 +39,9 @@ module DjiMqttConnect
|
|
39
39
|
DeviceType = Types::Integer
|
40
40
|
DeviceSubType = Types::Integer
|
41
41
|
|
42
|
+
# {"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"}
|
43
|
+
AirConditionerState = Types::Integer.enum(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
|
44
|
+
|
42
45
|
# {"0":"Capturing","1":"Recording","2":"Smart Low-Light","3":"Panorama","-1":"Unsupported mode"}
|
43
46
|
# "4":"Timed Shot"
|
44
47
|
CameraMode = Types::Integer.enum(
|
@@ -94,6 +97,12 @@ module DjiMqttConnect
|
|
94
97
|
DRONE_MODE_FAILED = 65535
|
95
98
|
)
|
96
99
|
|
100
|
+
# {"0":"not charging","1":"charging"}
|
101
|
+
DroneChargeState = Types::Integer.enum(
|
102
|
+
DRONE_CHARGE_STATE_NOT_CHARGING = 0,
|
103
|
+
DRONE_CHARGE_STATE_CHARGING = 1
|
104
|
+
)
|
105
|
+
|
97
106
|
# {"0":"Operation preparation","1":"In-flight operation","2":"Post-operation state recovery","3":"Custom flight area updating","4":"Terrain obstacle updating","5":"Mission idle","255":"Aircraft is abnormal","256":"Unknown state"}
|
98
107
|
FlightTaskStepCode = Types::Integer.enum(
|
99
108
|
FLIGHT_TASK_STEP_OPERATION_PREPARATION = 0,
|
@@ -137,6 +146,17 @@ module DjiMqttConnect
|
|
137
146
|
"plc_check"
|
138
147
|
)
|
139
148
|
|
149
|
+
NetworkStateType = Integer.enum(
|
150
|
+
NETWORK_STATE_TYPE_4G = 1,
|
151
|
+
NETWORK_STATE_TYPE_ETHERNET = 2
|
152
|
+
)
|
153
|
+
|
154
|
+
NetworkStateQuality = Integer.enum(
|
155
|
+
NETWORK_STATE_QUALITY_BAD = 0,
|
156
|
+
NETWORK_STATE_QUALITY_MODERATE = 1,
|
157
|
+
NETWORK_STATE_QUALITY_GOOD = 2
|
158
|
+
)
|
159
|
+
|
140
160
|
PositionStateQuality = Types::Integer.enum(1, 2, 3, 4, 5, 10)
|
141
161
|
|
142
162
|
# {"sent":"sent","in_progress":"in progress","ok":"success","paused":"paused","rejected":"rejected","failed":"failed","canceled":"canceled or stopped","timeout":"timeout"}
|
data/lib/dji_mqtt_connect.rb
CHANGED
@@ -39,6 +39,8 @@ module DjiMqttConnect
|
|
39
39
|
autoload :AirsenseWarningEventsMessage, "dji_mqtt_connect/messages/thing/product/events/airsense_warning"
|
40
40
|
autoload :CoverCloseEventsMessage, "dji_mqtt_connect/messages/thing/product/events/cover_close"
|
41
41
|
autoload :CoverOpenEventsMessage, "dji_mqtt_connect/messages/thing/product/events/cover_open"
|
42
|
+
autoload :DroneCloseEventsMessage, "dji_mqtt_connect/messages/thing/product/events/drone_close"
|
43
|
+
autoload :DroneOpenEventsMessage, "dji_mqtt_connect/messages/thing/product/events/drone_open"
|
42
44
|
autoload :DeviceLogEventsMessage, "dji_mqtt_connect/messages/thing/product/events/device_log"
|
43
45
|
autoload :DeviceRebootEventsMessage, "dji_mqtt_connect/messages/thing/product/events/device_reboot"
|
44
46
|
autoload :DeviceExitHomingNotifyEventsMessage, "dji_mqtt_connect/messages/thing/product/events/device_exit_homing_notify"
|
@@ -56,11 +58,13 @@ module DjiMqttConnect
|
|
56
58
|
autoload :StatusCodeEventsMessage, "dji_mqtt_connect/messages/thing/product/events/status_code"
|
57
59
|
autoload :TakeoffToPointProgressEventsMessage, "dji_mqtt_connect/messages/thing/product/events/takeoff_to_point_progress"
|
58
60
|
autoload :TrackEventsMessage, "dji_mqtt_connect/messages/thing/product/events/track"
|
61
|
+
autoload :UomFlyDataInfoEventsMessage, "dji_mqtt_connect/messages/thing/product/events/uom_fly_data_info"
|
59
62
|
autoload :EventsMessage, "dji_mqtt_connect/messages/thing/product/events_message"
|
60
63
|
|
61
64
|
autoload :EventsReplyMessage, "dji_mqtt_connect/messages/thing/product/events_reply_message"
|
62
65
|
|
63
66
|
autoload :OsdMessage, "dji_mqtt_connect/messages/thing/product/osd_message"
|
67
|
+
autoload :FlightHubDockOsdMessage, "dji_mqtt_connect/messages/thing/product/osd/flight_hub_dock"
|
64
68
|
autoload :DockOsdMessage, "dji_mqtt_connect/messages/thing/product/osd/dock"
|
65
69
|
autoload :DroneOsdMessage, "dji_mqtt_connect/messages/thing/product/osd/drone"
|
66
70
|
autoload :RemoteOsdMessage, "dji_mqtt_connect/messages/thing/product/osd/remote"
|
@@ -72,6 +76,7 @@ module DjiMqttConnect
|
|
72
76
|
autoload :FlightAreasGetRequestsMessage, "dji_mqtt_connect/messages/thing/product/requests/flight_areas_get"
|
73
77
|
autoload :FlighttaskResourceGetRequestsMessage, "dji_mqtt_connect/messages/thing/product/requests/flighttask_resource_get"
|
74
78
|
autoload :OfflineMapGetRequestsMessage, "dji_mqtt_connect/messages/thing/product/requests/offline_map_get"
|
79
|
+
autoload :OfflineMapGetV2RequestsMessage, "dji_mqtt_connect/messages/thing/product/requests/offline_map_get_v2"
|
75
80
|
autoload :StorageConfigGetRequestsMessage, "dji_mqtt_connect/messages/thing/product/requests/storage_config_get"
|
76
81
|
autoload :RequestsMessage, "dji_mqtt_connect/messages/thing/product/requests_message"
|
77
82
|
|
@@ -82,6 +87,7 @@ module DjiMqttConnect
|
|
82
87
|
autoload :ConfigRequestsReplyMessage, "dji_mqtt_connect/messages/thing/product/requests_reply/config"
|
83
88
|
autoload :FlighttaskResourceGetRequestsReplyMessage, "dji_mqtt_connect/messages/thing/product/requests_reply/flighttask_resource_get"
|
84
89
|
autoload :OfflineMapGetRequestsReplyMessage, "dji_mqtt_connect/messages/thing/product/requests_reply/offline_map_get"
|
90
|
+
autoload :OfflineMapGetV2RequestsReplyMessage, "dji_mqtt_connect/messages/thing/product/requests_reply/offline_map_get_v2"
|
85
91
|
autoload :StorageConfigGetRequestsReplyMessage, "dji_mqtt_connect/messages/thing/product/requests_reply/storage_config_get"
|
86
92
|
autoload :RequestsReplyMessage, "dji_mqtt_connect/messages/thing/product/requests_reply_message"
|
87
93
|
|
@@ -91,6 +97,8 @@ module DjiMqttConnect
|
|
91
97
|
autoload :CoverOpenServicesMessage, "dji_mqtt_connect/messages/thing/product/services/cover_open"
|
92
98
|
autoload :DebugModeCloseServicesMessage, "dji_mqtt_connect/messages/thing/product/services/debug_mode_close"
|
93
99
|
autoload :DebugModeOpenServicesMessage, "dji_mqtt_connect/messages/thing/product/services/debug_mode_open"
|
100
|
+
autoload :DroneCloseServicesMessage, "dji_mqtt_connect/messages/thing/product/services/drone_close"
|
101
|
+
autoload :DroneOpenServicesMessage, "dji_mqtt_connect/messages/thing/product/services/drone_open"
|
94
102
|
autoload :FileuploadListServicesMessage, "dji_mqtt_connect/messages/thing/product/services/fileupload_list"
|
95
103
|
autoload :FileuploadStartServicesMessage, "dji_mqtt_connect/messages/thing/product/services/fileupload_start"
|
96
104
|
autoload :FlighttaskExecuteServicesMessage, "dji_mqtt_connect/messages/thing/product/services/flighttask_execute"
|
@@ -114,6 +122,8 @@ module DjiMqttConnect
|
|
114
122
|
autoload :CoverOpenServicesReplyMessage, "dji_mqtt_connect/messages/thing/product/services_reply/cover_open"
|
115
123
|
autoload :DebugModeCloseServicesReplyMessage, "dji_mqtt_connect/messages/thing/product/services_reply/debug_mode_close"
|
116
124
|
autoload :DebugModeOpenServicesReplyMessage, "dji_mqtt_connect/messages/thing/product/services_reply/debug_mode_open"
|
125
|
+
autoload :DroneCloseServicesReplyMessage, "dji_mqtt_connect/messages/thing/product/services_reply/drone_close"
|
126
|
+
autoload :DroneOpenServicesReplyMessage, "dji_mqtt_connect/messages/thing/product/services_reply/drone_open"
|
117
127
|
autoload :FlighttaskExecuteServicesReplyMessage, "dji_mqtt_connect/messages/thing/product/services_reply/flighttask_execute"
|
118
128
|
autoload :FlighttaskPauseServicesReplyMessage, "dji_mqtt_connect/messages/thing/product/services_reply/flighttask_pause"
|
119
129
|
autoload :FlighttaskPrepareServicesReplyMessage, "dji_mqtt_connect/messages/thing/product/services_reply/flighttask_prepare"
|
@@ -163,10 +173,14 @@ module DjiMqttConnect
|
|
163
173
|
# Mixinx
|
164
174
|
module Mixins
|
165
175
|
autoload :CapacityPercent, "dji_mqtt_connect/mixins/capacity_percent"
|
176
|
+
autoload :DroneChargeState, "dji_mqtt_connect/mixins/drone_charge_state"
|
166
177
|
autoload :EventsProgressChecks, "dji_mqtt_connect/mixins/events_progress_checks"
|
167
178
|
autoload :HumanizedCameraIndex, "dji_mqtt_connect/mixins/humanized_camera_index"
|
168
179
|
autoload :LatitudeConditional, "dji_mqtt_connect/mixins/latitude_conditional"
|
169
180
|
autoload :LongitudeConditional, "dji_mqtt_connect/mixins/longitude_conditional"
|
181
|
+
autoload :NetworkStateType, "dji_mqtt_connect/mixins/network_state_type"
|
182
|
+
autoload :NetworkStateQuality, "dji_mqtt_connect/mixins/network_state_quality"
|
183
|
+
autoload :PositionStateQuality, "dji_mqtt_connect/mixins/position_state_quality"
|
170
184
|
autoload :ServicesOutputStatusChecks, "dji_mqtt_connect/mixins/services_output_status_checks"
|
171
185
|
autoload :ResultMessage, "dji_mqtt_connect/mixins/result_message"
|
172
186
|
autoload :TemperatureConditional, "dji_mqtt_connect/mixins/temperature_conditional"
|