dji_mqtt_connect 0.1.11 → 0.1.12.1

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.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +6 -6
  3. data/lib/dji_mqtt_connect/client.rb +5 -0
  4. data/lib/dji_mqtt_connect/factories.rb +88 -32
  5. data/lib/dji_mqtt_connect/marshals/thing/product/services_marshal.rb +34 -0
  6. data/lib/dji_mqtt_connect/message.rb +13 -0
  7. data/lib/dji_mqtt_connect/messages/sys/product/update_topo_status_reply_message.rb +4 -4
  8. data/lib/dji_mqtt_connect/messages/thing/product/airport_bind_status_requests_reply_message.rb +1 -1
  9. data/lib/dji_mqtt_connect/messages/thing/product/airport_organization_bind_requests_reply_message.rb +1 -1
  10. data/lib/dji_mqtt_connect/messages/thing/product/airport_organization_get_requests_reply_message.rb +1 -1
  11. data/lib/dji_mqtt_connect/messages/thing/product/config_requests_reply_message.rb +1 -1
  12. data/lib/dji_mqtt_connect/messages/thing/product/cover_close_services_message.rb +23 -0
  13. data/lib/dji_mqtt_connect/messages/thing/product/cover_open_services_message.rb +23 -0
  14. data/lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb +1 -1
  15. data/lib/dji_mqtt_connect/messages/thing/product/fileupload_list_services_message.rb +28 -0
  16. data/lib/dji_mqtt_connect/messages/thing/product/fileupload_progress_events_message.rb +4 -4
  17. data/lib/dji_mqtt_connect/messages/thing/product/fileupload_start_services_message.rb +48 -0
  18. data/lib/dji_mqtt_connect/messages/thing/product/storage_config_get_requests_reply_message.rb +1 -1
  19. data/lib/dji_mqtt_connect/topics/thing/product/services.rb +16 -0
  20. data/lib/dji_mqtt_connect/utils/message_sanitizer.rb +11 -1
  21. data/lib/dji_mqtt_connect/version.rb +1 -1
  22. data/lib/dji_mqtt_connect.rb +8 -0
  23. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2685591a0d96c757f12c00f683a9dc45ee25b81091414dc81d72f93ccfe2f324
4
- data.tar.gz: 53e45915630050082bd9dd1ddeb228d1eb9ce318d47eab213e0df0fb42c4d18a
3
+ metadata.gz: 2b9a7cb30f8a2cdf1f9b5d0648f1bd1175905abb81d1ab7730216d703a7e3224
4
+ data.tar.gz: '0338037ac0061b0885333b5664b80e4ad6c901d832e9fb24a8879c385553207c'
5
5
  SHA512:
6
- metadata.gz: fc83f3608e9162591d40e6bc0115f804b55d779149ef6612a3ae84b4864e98052e5d40b8faedc8b2f541fa056e589b9c1c7eba79dd3a812f35012c72b906947b
7
- data.tar.gz: da787b447741b0236e9c31bb28ea04ef33a900e47f5386e18dff9ebd43d243449a7d3119a9348f9f0515c314887288b4b3021b88ab4d522d6c8a266952a51ace
6
+ metadata.gz: e15ece0befefe9c5d60946d51083813f94cba248d6704f6dbb495cc634d5c1c514fe5670e3c9be4bc1fdfd8ad5c51ab5b39d0cf399e7c502ce496849e6bc8b5f
7
+ data.tar.gz: 8d659ae8e15bfd49da81adfde6837ac6ca2028d69a2860c6f25834f3c3b443112b73b7f81a752a3adbfdc5f6617d390c779f7292503cc9d20487706628d5a82d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dji_mqtt_connect (0.1.11)
4
+ dji_mqtt_connect (0.1.12.1)
5
5
  activesupport (>= 6.0, <= 8)
6
6
  dry-struct (~> 1.6)
7
7
  dry-transformer (~> 1.0)
@@ -11,10 +11,10 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activejob (7.0.4.3)
15
- activesupport (= 7.0.4.3)
14
+ activejob (7.0.5)
15
+ activesupport (= 7.0.5)
16
16
  globalid (>= 0.3.6)
17
- activesupport (7.0.4.3)
17
+ activesupport (7.0.5)
18
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
19
19
  i18n (>= 1.6, < 2)
20
20
  minitest (>= 5.1)
@@ -88,7 +88,7 @@ GEM
88
88
  parser (>= 3.2.1.0)
89
89
  rubocop-capybara (2.18.0)
90
90
  rubocop (~> 1.41)
91
- rubocop-factory_bot (2.22.0)
91
+ rubocop-factory_bot (2.23.1)
92
92
  rubocop (~> 1.33)
93
93
  rubocop-performance (1.16.0)
94
94
  rubocop (>= 1.7.0, < 2.0)
@@ -106,7 +106,7 @@ GEM
106
106
  simplecov_json_formatter (~> 0.1)
107
107
  simplecov-html (0.12.3)
108
108
  simplecov_json_formatter (0.1.4)
109
- standard (1.28.2)
109
+ standard (1.28.4)
110
110
  language_server-protocol (~> 3.17.0.2)
111
111
  lint_roller (~> 1.0)
112
112
  rubocop (~> 1.50.2)
@@ -66,6 +66,11 @@ module DjiMqttConnect
66
66
  Thing::Product::RequestsReplyTopicRepository.new(self)
67
67
  end
68
68
 
69
+ # Handles topic thing/product/#{pid}/services
70
+ def thing_product_services_topic
71
+ Thing::Product::ServicesTopicRepository.new(self)
72
+ end
73
+
69
74
  attr_reader :mqtt_client
70
75
  end
71
76
  end
@@ -34,11 +34,11 @@ module DjiMqttConnect
34
34
 
35
35
  Thing::Product::FileUploadCallbackEventsMessage.new(
36
36
  _method: "file_upload_callback",
37
- bid: "12345678-1234-1234-1234-12345678901B",
38
- tid: "12345678-1234-1234-1234-12345678901A",
37
+ bid: Message.generate_bid,
38
+ tid: Message.generate_tid,
39
39
  need_reply: 1,
40
40
  gateway: "xxx",
41
- timestamp: 1654070968655,
41
+ timestamp: Message.current_timestamp,
42
42
  data: message_data,
43
43
  _data: message_data
44
44
  )
@@ -57,7 +57,7 @@ module DjiMqttConnect
57
57
  fingerprint: "4f65b891f3bc09bdb6d4c36a996b532d",
58
58
  progress: {
59
59
  current_step: 19,
60
- prgress: 100,
60
+ progress: 100,
61
61
  finish_time: 1655781395926,
62
62
  upload_rate: 0,
63
63
  result: 0,
@@ -73,7 +73,7 @@ module DjiMqttConnect
73
73
  progress: {
74
74
  current_step: 19,
75
75
  total_step: 30,
76
- prgress: 100,
76
+ progress: 100,
77
77
  finish_time: 1655781395926,
78
78
  upload_rate: 0,
79
79
  result: 0,
@@ -89,9 +89,9 @@ module DjiMqttConnect
89
89
  Thing::Product::FileuploadProgressEventsMessage.new(
90
90
  _method: "fileupload_progress",
91
91
  need_reply: 0,
92
- bid: "12345678-1234-1234-1234-12345678901B",
93
- tid: "12345678-1234-1234-1234-12345678901A",
94
- timestamp: 1655781395926,
92
+ bid: Message.generate_bid,
93
+ tid: Message.generate_tid,
94
+ timestamp: Message.current_timestamp,
95
95
  gateway: "dock_sn",
96
96
  _data: message_data,
97
97
  data: message_data
@@ -104,13 +104,13 @@ module DjiMqttConnect
104
104
  }
105
105
 
106
106
  Thing::Product::HighestPriorityUploadFlighttaskMediaEventsMessage.new(
107
- bid: "fe0e2218-038f-46fe-b27d-74cd257c386a",
107
+ bid: Message.generate_bid,
108
108
  _data: message_data,
109
109
  data: message_data,
110
110
  _method: "highest_priority_upload_flighttask_media",
111
111
  need_reply: 1,
112
- tid: "c6aa22c0-e9dd-4895-a25c-6c12411513df",
113
- timestamp: 1684986146586,
112
+ tid: Message.generate_tid,
113
+ timestamp: Message.current_timestamp,
114
114
  gateway: "DOCK01"
115
115
  )
116
116
  end
@@ -139,9 +139,9 @@ module DjiMqttConnect
139
139
 
140
140
  Sys::Product::UpdateTopoStatusMessage.new(
141
141
  _method: "update_topo",
142
- tid: "12345678-1234-1234-1234-A00000000001",
143
- bid: "12345678-1234-1234-1234-B00000000001",
144
- timestamp: 1234567890123,
142
+ tid: Message.generate_tid,
143
+ bid: Message.generate_bid,
144
+ timestamp: Message.current_timestamp,
145
145
  data: message_data,
146
146
  _data: message_data.deep_stringify_keys
147
147
  )
@@ -150,9 +150,9 @@ module DjiMqttConnect
150
150
  def build_update_topo_status_reply_message
151
151
  Sys::Product::UpdateTopoStatusReplyMessage.new(
152
152
  _method: "update_topo",
153
- tid: "3093aad5-bb98-5026-685a-cea540eb9267",
154
- bid: "479533e0-cb01-933c-3758-22f2a82abeb8",
155
- timestamp: 1679380233000,
153
+ tid: Message.generate_tid,
154
+ bid: Message.generate_bid,
155
+ timestamp: Message.current_timestamp,
156
156
  data: {
157
157
  result: 0
158
158
  }
@@ -169,9 +169,9 @@ module DjiMqttConnect
169
169
 
170
170
  Thing::Product::ConfigRequestsMessage.new(
171
171
  _method: "config",
172
- tid: "3093aad5-bb98-5026-685a-cea540eb9267",
173
- bid: "479533e0-cb01-933c-3758-22f2a82abeb8",
174
- timestamp: 1679380233000,
172
+ tid: Message.generate_tid,
173
+ bid: Message.generate_bid,
174
+ timestamp: Message.current_timestamp,
175
175
  gateway: "gatewaysn",
176
176
  data: message_data,
177
177
  _data: message_data.deep_stringify_keys
@@ -205,9 +205,9 @@ module DjiMqttConnect
205
205
  Thing::Product::AirportBindStatusRequestsMessage.new(
206
206
  _method: "airport_bind_status",
207
207
  _data: message_data,
208
- tid: "3093aad5-bb98-5026-685a-cea540eb9267",
209
- bid: "479533e0-cb01-933c-3758-22f2a82abeb8",
210
- timestamp: 1679380233000,
208
+ tid: Message.generate_tid,
209
+ bid: Message.generate_bid,
210
+ timestamp: Message.current_timestamp,
211
211
  data: message_data
212
212
  )
213
213
  end
@@ -257,9 +257,9 @@ module DjiMqttConnect
257
257
  Thing::Product::AirportOrganizationBindRequestsMessage.new(
258
258
  _method: "airport_organization_bind",
259
259
  _data: message_data,
260
- tid: "3093aad5-bb98-5026-685a-cea540eb9267",
261
- bid: "479533e0-cb01-933c-3758-22f2a82abeb8",
262
- timestamp: 1679380233000,
260
+ tid: Message.generate_tid,
261
+ bid: Message.generate_bid,
262
+ timestamp: Message.current_timestamp,
263
263
  data: message_data,
264
264
  gateway: "DOCK01"
265
265
  )
@@ -283,9 +283,9 @@ module DjiMqttConnect
283
283
  Thing::Product::AirportOrganizationGetRequestsMessage.new(
284
284
  _method: "airport_organization_get",
285
285
  _data: message_data,
286
- tid: "3093aad5-bb98-5026-685a-cea540eb9267",
287
- bid: "479533e0-cb01-933c-3758-22f2a82abeb8",
288
- timestamp: 1679380233000,
286
+ tid: Message.generate_tid,
287
+ bid: Message.generate_bid,
288
+ timestamp: Message.current_timestamp,
289
289
  data: message_data
290
290
  )
291
291
  end
@@ -310,9 +310,9 @@ module DjiMqttConnect
310
310
  Thing::Product::StorageConfigGetRequestsMessage.new(
311
311
  _method: "storage_config_get",
312
312
  _data: message_data,
313
- tid: "3093aad5-bb98-5026-685a-cea540eb9267",
314
- bid: "479533e0-cb01-933c-3758-22f2a82abeb8",
315
- timestamp: 1679380233000,
313
+ tid: Message.generate_tid,
314
+ bid: Message.generate_bid,
315
+ timestamp: Message.current_timestamp,
316
316
  data: message_data
317
317
  )
318
318
  end
@@ -338,5 +338,61 @@ module DjiMqttConnect
338
338
  }
339
339
  )
340
340
  end
341
+
342
+ # Services
343
+
344
+ def build_thing_product_cover_close_services_message
345
+ Thing::Product::CoverCloseServicesMessage.build
346
+ end
347
+
348
+ def build_thing_product_cover_open_services_message
349
+ Thing::Product::CoverOpenServicesMessage.build
350
+ end
351
+
352
+ def build_thing_product_fileupload_list_services_message
353
+ Thing::Product::FileuploadListServicesMessage.build(
354
+ module_list: [0, 3]
355
+ )
356
+ end
357
+
358
+ def build_thing_product_fileupload_start_services_message
359
+ timestamp = Message.current_timestamp
360
+ Thing::Product::FileuploadStartServicesMessage.build(
361
+ data: {
362
+ bucket: "stg-dji-service-hz-ksd7",
363
+ region: "hz",
364
+ credentials: {
365
+ access_key_id: "STS.access_key_id",
366
+ access_key_secret: "access_key_secret",
367
+ expire: 3600,
368
+ security_token: "security_token"
369
+ },
370
+ endpoint: "https://oss-cn-hangzhou.aliyuncs.com",
371
+ params: {
372
+ files: [
373
+ {
374
+ list: [
375
+ {
376
+ boot_index: 1111,
377
+ end_time: timestamp - 3000,
378
+ size: 33789,
379
+ start_time: timestamp - 4000
380
+ },
381
+ {
382
+ boot_index: 22222,
383
+ end_time: timestamp - 1000,
384
+ size: 33789,
385
+ start_time: timestamp - 2000
386
+ }
387
+ ],
388
+ module: "3",
389
+ object_key: "object_key"
390
+ }
391
+ ]
392
+ },
393
+ provider: "ali"
394
+ }
395
+ )
396
+ end
341
397
  end
342
398
  end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry-transformer"
4
+ require "json"
5
+
6
+ module DjiMqttConnect
7
+ module Thing::Product
8
+ class ServicesMarshal < MessageMarshal
9
+ # Renames the method attribute
10
+ class HashTransformer < Dry::Transformer::Pipe
11
+ import Dry::Transformer::HashTransformations
12
+
13
+ define! do
14
+ rename_keys _method: :method
15
+ end
16
+ end
17
+
18
+ # Converts a message for transmission via MQTT
19
+ def dump(message)
20
+ # Fix up the hash representation
21
+ transformed_message = hash_transformer.call(message)
22
+
23
+ # Convert the transformed message into JSON
24
+ JSON.generate(transformed_message)
25
+ end
26
+
27
+ private
28
+
29
+ def hash_transformer
30
+ @hash_transformer ||= HashTransformer.new
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,11 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "dry-struct"
4
+ require "securerandom"
4
5
 
5
6
  module DjiMqttConnect
6
7
  class Message < Dry::Struct
7
8
  transform_keys(&:to_sym)
8
9
 
10
+ def self.current_timestamp
11
+ Integer(Time.now.strftime("%s%L"))
12
+ end
13
+
14
+ def self.generate_bid
15
+ SecureRandom.uuid
16
+ end
17
+
18
+ def self.generate_tid
19
+ SecureRandom.uuid
20
+ end
21
+
9
22
  def to_s
10
23
  self.class.name
11
24
  end
@@ -10,7 +10,7 @@ module DjiMqttConnect
10
10
  _method: update_topo_status_message._method,
11
11
  tid: update_topo_status_message.tid,
12
12
  bid: update_topo_status_message.bid,
13
- timestamp: Time.now.strftime("%s%L").to_i,
13
+ timestamp: current_timestamp,
14
14
  data: {
15
15
  result: result
16
16
  }
@@ -19,9 +19,9 @@ module DjiMqttConnect
19
19
 
20
20
  attribute :_method, Types::String.enum("update_topo")
21
21
 
22
- attribute :tid, Types::String
23
- attribute :bid, Types::String
24
- attribute :timestamp, Types::Integer
22
+ attribute :tid, Types::UUID
23
+ attribute :bid, Types::UUID
24
+ attribute :timestamp, Types::Timestamp
25
25
  attribute :data do
26
26
  attribute :result, Types::Integer
27
27
  end
@@ -8,7 +8,7 @@ module DjiMqttConnect
8
8
  _method: airport_bind_status_message._method,
9
9
  tid: airport_bind_status_message.tid,
10
10
  bid: airport_bind_status_message.bid,
11
- timestamp: Time.now.strftime("%s%L").to_i,
11
+ timestamp: current_timestamp,
12
12
  data: {
13
13
  result: result,
14
14
  output: {
@@ -9,7 +9,7 @@ module DjiMqttConnect
9
9
  _method: airport_organization_bind_message._method,
10
10
  tid: airport_organization_bind_message.tid,
11
11
  bid: airport_organization_bind_message.bid,
12
- timestamp: Time.now.strftime("%s%L").to_i,
12
+ timestamp: current_timestamp,
13
13
  data: {
14
14
  result: result,
15
15
  err_infos: err_infos
@@ -9,7 +9,7 @@ module DjiMqttConnect
9
9
  _method: airport_organization_get_message._method,
10
10
  tid: airport_organization_get_message.tid,
11
11
  bid: airport_organization_get_message.bid,
12
- timestamp: Time.now.strftime("%s%L").to_i,
12
+ timestamp: current_timestamp,
13
13
  data: {
14
14
  result: result,
15
15
  output: output
@@ -9,7 +9,7 @@ module DjiMqttConnect
9
9
  data: data,
10
10
  tid: config_request_message.tid,
11
11
  bid: config_request_message.bid,
12
- timestamp: Time.now.strftime("%s%L").to_i,
12
+ timestamp: current_timestamp,
13
13
  gateway: config_request_message.gateway
14
14
  )
15
15
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Thing::Product
5
+ class CoverCloseServicesMessage < Message
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: "cover_close"
12
+ )
13
+ end
14
+
15
+ attribute :tid, Types::UUID
16
+ attribute :bid, Types::UUID
17
+ attribute :timestamp, Types::Timestamp
18
+
19
+ attribute :_method, Types::String.enum("cover_close")
20
+ attribute :data, Types::Hash.default({}.freeze)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Thing::Product
5
+ class CoverOpenServicesMessage < Message
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: "cover_open"
12
+ )
13
+ end
14
+
15
+ attribute :tid, Types::UUID
16
+ attribute :bid, Types::UUID
17
+ attribute :timestamp, Types::Timestamp
18
+
19
+ attribute :_method, Types::String.enum("cover_open")
20
+ attribute :data, Types::Hash.default({}.freeze)
21
+ end
22
+ end
23
+ end
@@ -10,7 +10,7 @@ module DjiMqttConnect
10
10
  _method: events_message._method,
11
11
  tid: events_message.tid,
12
12
  bid: events_message.bid,
13
- timestamp: Time.now.strftime("%s%L").to_i,
13
+ timestamp: current_timestamp,
14
14
  data: {
15
15
  result: result
16
16
  }
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Thing::Product
5
+ class FileuploadListServicesMessage < Message
6
+ def self.build(module_list:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
7
+ new(
8
+ _method: "fileupload_list",
9
+ bid: bid,
10
+ tid: tid,
11
+ timestamp: timestamp,
12
+ data: {
13
+ module_list: module_list
14
+ }
15
+ )
16
+ end
17
+
18
+ attribute :_method, Types::String.enum("fileupload_list")
19
+
20
+ attribute :tid, Types::UUID
21
+ attribute :bid, Types::UUID
22
+ attribute :timestamp, Types::Timestamp
23
+ attribute :data do
24
+ attribute :module_list, Types::Array.of(Types::Coercible::String.enum("0", "3"))
25
+ end
26
+ end
27
+ end
28
+ end
@@ -19,15 +19,15 @@ module DjiMqttConnect
19
19
  attribute :size, Types::Integer
20
20
  attribute :device_sn, Types::String
21
21
  attribute :key, Types::String
22
- attribute :fingerprint, Types::String
22
+ attribute? :fingerprint, Types::String
23
23
 
24
24
  attribute :progress do
25
25
  attribute :current_step, Types::Integer
26
26
  attribute? :total_step, Types::Integer
27
- attribute :prgress, Types::Integer
28
- attribute :finish_time, Types::Timestamp
27
+ attribute :progress, Types::Integer
28
+ attribute? :finish_time, Types::Timestamp
29
29
  attribute :upload_rate, Types::Integer
30
- attribute :result, Types::Integer
30
+ attribute? :result, Types::Integer
31
31
  attribute :status, Types::String
32
32
  end
33
33
  end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Thing::Product
5
+ class FileuploadStartServicesMessage < Message
6
+ def self.build(data:, bid: generate_bid, tid: generate_tid, timestamp: current_timestamp)
7
+ new(
8
+ _method: "fileupload_start",
9
+ bid: bid,
10
+ tid: tid,
11
+ timestamp: timestamp,
12
+ data: data
13
+ )
14
+ end
15
+
16
+ attribute :_method, Types::String.enum("fileupload_start")
17
+
18
+ attribute :tid, Types::UUID
19
+ attribute :bid, Types::UUID
20
+ attribute :timestamp, Types::Timestamp
21
+
22
+ attribute :data do
23
+ attribute :endpoint, Types::String
24
+ attribute :bucket, Types::String
25
+ attribute :region, Types::String
26
+ attribute :credentials do
27
+ attribute :access_key_id, Types::String
28
+ attribute :access_key_secret, Types::String
29
+ attribute :expire, Types::Integer.constrained(gt: 0)
30
+ attribute :security_token, Types::String
31
+ end
32
+ attribute :params do
33
+ attribute :files, Types::Array do
34
+ attribute :list, Types::Array do
35
+ attribute :boot_index, Types::Integer
36
+ attribute :end_time, Types::Timestamp
37
+ attribute :size, Types::Integer
38
+ attribute :start_time, Types::Timestamp
39
+ end
40
+ attribute :module, Types::Coercible::String.enum("0", "3")
41
+ attribute :object_key, Types::String
42
+ end
43
+ end
44
+ attribute :provider, Types::String
45
+ end
46
+ end
47
+ end
48
+ end
@@ -9,7 +9,7 @@ module DjiMqttConnect
9
9
  _method: storage_config_get_message._method,
10
10
  tid: storage_config_get_message.tid,
11
11
  bid: storage_config_get_message.bid,
12
- timestamp: Time.now.strftime("%s%L").to_i,
12
+ timestamp: current_timestamp,
13
13
  data: {
14
14
  result: result,
15
15
  output: output
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Thing::Product
5
+ class ServicesTopicRepository < TopicRepository
6
+ # Publishes a message to gateway_sn on the "thing/product/+/services" topic.
7
+ def publish_to_device(gateway_sn, services_message)
8
+ publish_to_topic(
9
+ "thing/product/#{gateway_sn}/services",
10
+ services_message,
11
+ marshal: ServicesMarshal
12
+ )
13
+ end
14
+ end
15
+ end
16
+ end
@@ -9,7 +9,17 @@ module DjiMqttConnect
9
9
  DEFAULT_LATITUDE = "-33.865143"
10
10
  DEFAULT_LONGITUDE = "151.209900"
11
11
 
12
- SECRET_KEYS = %w[app_id app_key app_license callsign device_secret nonce]
12
+ SECRET_KEYS = %w[
13
+ app_id
14
+ app_key
15
+ app_license
16
+ callsign
17
+ device_secret
18
+ nonce
19
+ access_key_id
20
+ access_key_secret
21
+ security_token
22
+ ]
13
23
 
14
24
  SERIAL_NUMBER_KEYS = %w[device_sn gateway sn]
15
25
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DjiMqttConnect
4
- VERSION = "0.1.11"
4
+ VERSION = "0.1.12.1"
5
5
  end
@@ -61,12 +61,18 @@ module DjiMqttConnect
61
61
  autoload :ConfigRequestsReplyMessage, "dji_mqtt_connect/messages/thing/product/config_requests_reply_message"
62
62
  autoload :StorageConfigGetRequestsReplyMessage, "dji_mqtt_connect/messages/thing/product/storage_config_get_requests_reply_message"
63
63
 
64
+ autoload :CoverCloseServicesMessage, "dji_mqtt_connect/messages/thing/product/cover_close_services_message"
65
+ autoload :CoverOpenServicesMessage, "dji_mqtt_connect/messages/thing/product/cover_open_services_message"
66
+ autoload :FileuploadListServicesMessage, "dji_mqtt_connect/messages/thing/product/fileupload_list_services_message"
67
+ autoload :FileuploadStartServicesMessage, "dji_mqtt_connect/messages/thing/product/fileupload_start_services_message"
68
+
64
69
  # Topics
65
70
  autoload :EventsTopicRepository, "dji_mqtt_connect/topics/thing/product/events"
66
71
  autoload :EventsReplyTopicRepository, "dji_mqtt_connect/topics/thing/product/events_reply"
67
72
  autoload :OsdTopicRepository, "dji_mqtt_connect/topics/thing/product/osd"
68
73
  autoload :RequestsTopicRepository, "dji_mqtt_connect/topics/thing/product/requests"
69
74
  autoload :RequestsReplyTopicRepository, "dji_mqtt_connect/topics/thing/product/requests_reply"
75
+ autoload :ServicesTopicRepository, "dji_mqtt_connect/topics/thing/product/services"
70
76
 
71
77
  # Marshals
72
78
  autoload :EventsMarshal, "dji_mqtt_connect/marshals/thing/product/events_marshal"
@@ -76,6 +82,8 @@ module DjiMqttConnect
76
82
 
77
83
  autoload :RequestsMarshal, "dji_mqtt_connect/marshals/thing/product/requests_marshal"
78
84
  autoload :RequestsReplyMarshal, "dji_mqtt_connect/marshals/thing/product/requests_reply_marshal"
85
+
86
+ autoload :ServicesMarshal, "dji_mqtt_connect/marshals/thing/product/services_marshal"
79
87
  end
80
88
  end
81
89
 
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.11
4
+ version: 0.1.12.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-05-26 00:00:00.000000000 Z
11
+ date: 2023-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -117,6 +117,7 @@ files:
117
117
  - lib/dji_mqtt_connect/marshals/thing/product/osd_marshal.rb
118
118
  - lib/dji_mqtt_connect/marshals/thing/product/requests_marshal.rb
119
119
  - lib/dji_mqtt_connect/marshals/thing/product/requests_reply_marshal.rb
120
+ - lib/dji_mqtt_connect/marshals/thing/product/services_marshal.rb
120
121
  - lib/dji_mqtt_connect/message.rb
121
122
  - lib/dji_mqtt_connect/message_marshal.rb
122
123
  - lib/dji_mqtt_connect/messages/sys/product/status_message.rb
@@ -130,12 +131,16 @@ files:
130
131
  - lib/dji_mqtt_connect/messages/thing/product/airport_organization_get_requests_reply_message.rb
131
132
  - lib/dji_mqtt_connect/messages/thing/product/config_requests_message.rb
132
133
  - lib/dji_mqtt_connect/messages/thing/product/config_requests_reply_message.rb
134
+ - lib/dji_mqtt_connect/messages/thing/product/cover_close_services_message.rb
135
+ - lib/dji_mqtt_connect/messages/thing/product/cover_open_services_message.rb
133
136
  - lib/dji_mqtt_connect/messages/thing/product/dock_osd_message.rb
134
137
  - lib/dji_mqtt_connect/messages/thing/product/drone_osd_message.rb
135
138
  - lib/dji_mqtt_connect/messages/thing/product/events_message.rb
136
139
  - lib/dji_mqtt_connect/messages/thing/product/events_reply_message.rb
137
140
  - lib/dji_mqtt_connect/messages/thing/product/file_upload_callback_events_message.rb
141
+ - lib/dji_mqtt_connect/messages/thing/product/fileupload_list_services_message.rb
138
142
  - lib/dji_mqtt_connect/messages/thing/product/fileupload_progress_events_message.rb
143
+ - lib/dji_mqtt_connect/messages/thing/product/fileupload_start_services_message.rb
139
144
  - lib/dji_mqtt_connect/messages/thing/product/highest_priority_upload_flighttask_media_events_message.rb
140
145
  - lib/dji_mqtt_connect/messages/thing/product/hms_events_message.rb
141
146
  - lib/dji_mqtt_connect/messages/thing/product/osd_message.rb
@@ -157,6 +162,7 @@ files:
157
162
  - lib/dji_mqtt_connect/topics/thing/product/osd.rb
158
163
  - lib/dji_mqtt_connect/topics/thing/product/requests.rb
159
164
  - lib/dji_mqtt_connect/topics/thing/product/requests_reply.rb
165
+ - lib/dji_mqtt_connect/topics/thing/product/services.rb
160
166
  - lib/dji_mqtt_connect/translations.rb
161
167
  - lib/dji_mqtt_connect/types.rb
162
168
  - lib/dji_mqtt_connect/utils/message_parsing.rb