dji_mqtt_connect 0.1.2 → 0.1.3

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: 824a4b8942fc65705e25588a32df620e49602573b1eb14ed6f1b2c34c98023cd
4
- data.tar.gz: 7f9dc5c06e40c04862baed3c41b8342da77a9fbedb083ab7432b9173180ebce1
3
+ metadata.gz: e40cb40801a11ebd25bc5ae79c3b6b332c879cb1ddb026e5e2a4cf8c48415564
4
+ data.tar.gz: b0629c19cbc9a6e3c7378727c0fa1a0253c42def15ac0ff0602c64ea8d071357
5
5
  SHA512:
6
- metadata.gz: 58ccec055d15866882fd93521c5d312719012c10e8778e18b99191c2bb48a7173ac0283f7f18daf21fb950d0472c02b3cb861cd1d07b0da0584e62278d62554c
7
- data.tar.gz: ac4f30aa186b37fa04dbadbc49d813648c08ca031809a7c3b73d97fb0d6f7489cc680d74e0a3a83015ebcf77d26d25386c7f8dbecdb4e04e337308bc3a1f7a6c
6
+ metadata.gz: 8bc46c0f8448ae3d551c7bc99f74e432e5a253a6686aff92a7e4798867ff801bcbff895675813646a3fbf727a1d8db93c82e30613eaef14f4d8bf1c0d834624b
7
+ data.tar.gz: a91a113aa29a75f636704b2266dff13e10a2e7daeb0e1fe1f3ee4951a8cdf85b255fe88502534fe28e98a512751f6d00731f11ef029311a8281a55427c9557e5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dji_mqtt_connect (0.1.2)
4
+ dji_mqtt_connect (0.1.3)
5
5
  activesupport (>= 6.0, <= 8)
6
6
  dry-struct (~> 1.6)
7
7
  dry-transformer (~> 1.0)
@@ -41,6 +41,11 @@ module DjiMqttConnect
41
41
  Sys::Product::StatusReplyTopicRepository.new(self)
42
42
  end
43
43
 
44
+ # Handles topic thing/product/#{pid}/events
45
+ def thing_product_events_topic
46
+ Thing::Product::EventsTopicRepository.new(self)
47
+ end
48
+
44
49
  # Handles topic thing/product/#{pid}/osd
45
50
  def thing_product_osd_topic
46
51
  Thing::Product::OsdTopicRepository.new(self)
@@ -30,7 +30,7 @@ module DjiMqttConnect
30
30
  attribute :credentials do
31
31
  attribute :access_key_id, Types::String
32
32
  attribute :access_key_secret, Types::String
33
- attribute :expire, Types::Integer
33
+ attribute :expire, Types::Integer.constrained(gt: 0)
34
34
  attribute :security_token, Types::String
35
35
  end
36
36
  attribute :endpoint, Types::String
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DjiMqttConnect
4
+ module Thing::Product
5
+ class EventsTopicRepository < TopicRepository
6
+ EVENTS_TOPIC_REGEX = /\Athing\/product\/(?<device_sn>.+)\/events\z/
7
+
8
+ def listen!
9
+ listen_to_topic("thing/product/+/events") do |topic, raw_message|
10
+ logger.debug(raw_message)
11
+
12
+ matched_topic = EVENTS_TOPIC_REGEX.match(topic)
13
+ raise Error, "Unknown topic: #{topic}" unless matched_topic
14
+
15
+ # Everything is Unsupported
16
+ broadcast(:unsupported_message, topic, raw_message)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DjiMqttConnect
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -50,6 +50,7 @@ module DjiMqttConnect
50
50
  autoload :StorageConfigGetRequestsReplyMessage, "dji_mqtt_connect/messages/thing/product/storage_config_get_requests_reply_message"
51
51
 
52
52
  # Topics
53
+ autoload :EventsTopicRepository, "dji_mqtt_connect/topics/thing/product/events"
53
54
  autoload :OsdTopicRepository, "dji_mqtt_connect/topics/thing/product/osd"
54
55
  autoload :RequestsTopicRepository, "dji_mqtt_connect/topics/thing/product/requests"
55
56
  autoload :RequestsReplyTopicRepository, "dji_mqtt_connect/topics/thing/product/requests_reply"
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.2
4
+ version: 0.1.3
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-11 00:00:00.000000000 Z
11
+ date: 2023-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -139,6 +139,7 @@ files:
139
139
  - lib/dji_mqtt_connect/topic_repository.rb
140
140
  - lib/dji_mqtt_connect/topics/sys/product/status.rb
141
141
  - lib/dji_mqtt_connect/topics/sys/product/status_reply.rb
142
+ - lib/dji_mqtt_connect/topics/thing/product/events.rb
142
143
  - lib/dji_mqtt_connect/topics/thing/product/osd.rb
143
144
  - lib/dji_mqtt_connect/topics/thing/product/requests.rb
144
145
  - lib/dji_mqtt_connect/topics/thing/product/requests_reply.rb