dji_mqtt_connect 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbf7e03c9debc9957d9d8fadc1fa6126377a14574f5f0cdc24009afac5b77bc5
4
- data.tar.gz: e86ae21b238e3c0063cd42c584544350ba30b8e60eb8241c43b4d8cedb69aedf
3
+ metadata.gz: 9dc11cccab3b3a496ba3fabbbc78499f8a614996da46761ddaf2eb9686de35c1
4
+ data.tar.gz: 512c5d6ce41c476f961e9b797f5cb023b2f69f44dab30637b601bdf9a9595f07
5
5
  SHA512:
6
- metadata.gz: 5930cd00dbb6d2779af90659fdde1b70e2cf31247a1f31dcc3f6a4301f7663117bf06d061dfc1c1d101100c43ce040003fff5152435ad5b4bf1536cea74035a9
7
- data.tar.gz: 4df8067dff28fb839f2e849b426760fa44ce2f7b9bb5f676c85daae15e54f9395030a3f6f047016f6aaa6ee9d328d75176ccc97d072615be1fb0ea6fd3d42b10
6
+ metadata.gz: 9ba2eed8daee1e0d08d4fd44f33b84429c455425ca7e34a48f3bc9ef70dfd0a7ae87766fc596f977b34a2d8b50fb734c4617f5722d7164a75cf73c7ed6ebc6e6
7
+ data.tar.gz: 26dcb1c2aed6ef0aaad6cf93aa601860c8bcb40c4344948e20ff3b81f64c5cf7a6f80cc7e8442e42467e6aa7e25d2abe1649b9d7c56c07464f1ac6fb429211bb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dji_mqtt_connect (0.1.14)
4
+ dji_mqtt_connect (0.1.15)
5
5
  activesupport (>= 6.0, <= 8)
6
6
  dry-struct (~> 1.6)
7
7
  dry-transformer (~> 1.0)
@@ -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
@@ -161,11 +161,36 @@ module DjiMqttConnect
161
161
 
162
162
  attribute? :height, Types::JSON::Decimal
163
163
  attribute? :humidity, Types::Integer
164
- attribute? :rainfall, Types::JSON::Decimal
164
+
165
165
  attribute? :temperature, Types::Temperature
166
166
  attribute? :wind_speed, Types::JSON::Decimal
167
167
  attribute? :environment_temperature, Types::Temperature
168
168
 
169
+ # {"0":"No rain","1":"Light rain","2":"Moderate rain","3":"Heavy rain"}
170
+ attribute? :rainfall, Types::Integer.enum(
171
+ RAINFALL_NONE = 0,
172
+ RAINFALL_LIGHT = 1,
173
+ RAINFALL_MODERATE = 2,
174
+ RAINFALL_HEAVY = 3
175
+ )
176
+
177
+ def humanized_rainfall
178
+ return unless rainfall
179
+
180
+ rainfall_key = case rainfall
181
+ when RAINFALL_NONE
182
+ "None"
183
+ when RAINFALL_LIGHT
184
+ "Light"
185
+ when RAINFALL_MODERATE
186
+ "Moderate"
187
+ when RAINFALL_HEAVY
188
+ "Heavy"
189
+ end
190
+
191
+ I18n.t(rainfall_key.downcase, scope: "dji_mqtt_connect.rainfall", default: rainfall_key)
192
+ end
193
+
169
194
  attribute? :alternate_land_point do
170
195
  attribute :latitude, Types::Latitude
171
196
  attribute :longitude, Types::Longitude
@@ -8,6 +8,11 @@ module DjiMqttConnect
8
8
  module Mixins
9
9
  # Provides checks for the output object that contains a Types::ServicesOutputStatus status value
10
10
  module ServicesOutputStatusChecks
11
+ # Provide accessors for each status value
12
+ DjiMqttConnect::Types::ServicesOutputStatus.values.each do |status_value|
13
+ define_method(:"status_#{status_value}?") { status == status_value }
14
+ end
15
+
11
16
  def status_finalized?
12
17
  [
13
18
  Types::SERVICE_OUTPUT_STATUS_OK,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DjiMqttConnect
4
- VERSION = "0.1.14"
4
+ VERSION = "0.1.15"
5
5
  end
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.14
4
+ version: 0.1.15
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-20 00:00:00.000000000 Z
11
+ date: 2023-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport