mqtt-sn-ruby 0.1.1 → 0.1.2

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mqtt-sn-ruby.rb +9 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4f084a51dc0bd607b1900db2538237006d67575
4
- data.tar.gz: c5e15cf5dbebf2fd20dc952673d2e79c21902d02
3
+ metadata.gz: 039a346b9a168561fb786790f130fae2e62ed049
4
+ data.tar.gz: 92ee170999744efabe899e8e9c8c23e650c1ca7c
5
5
  SHA512:
6
- metadata.gz: 511d406d08eafc28272637f9c7418f2296864519f2036d04a76133e58feb00e49609331e0ad855ec1c7ecb6e9781bc00e6dd8661a1dc94fdbb0b3a3c9bc88cca
7
- data.tar.gz: 90c07411e0b78c7baccc7f68b4a7b4ed735155e7de943d88cf567b3eaa1b22d2f86ff21714468b5e52d570f23bf56f6b540166a74f10568207bd0ceb8d677232
6
+ metadata.gz: fc9ced0a03a300d6a1254506f8eeea48aebc2f46fe54519752b4dd365b34be43dbefece49fe0c0ad14afe7ce55f95be33236f85d70fb2dc9f5ef7db8271c1248
7
+ data.tar.gz: c45cc715e4ca498be66eeeb1bde3eae033b0db55ac8c6c6b4d003b2ee08c62f82077632443c24a1836ae6fc1ea27531b31a202da4ebbe6ca0c7f4396ab68a7bb
data/lib/mqtt-sn-ruby.rb CHANGED
@@ -13,7 +13,8 @@ class MqttSN
13
13
 
14
14
  Nretry = 3 # Max retry
15
15
  Tretry = 3 # Timeout before retry
16
-
16
+
17
+ # :stopdoc:
17
18
  SEARCHGW_TYPE =0x01
18
19
  GWINFO_TYPE =0x02
19
20
  ADVERTISE_TYPE =0x03
@@ -627,8 +628,14 @@ class MqttSN
627
628
  send :disconnect, duration: duration, expect: :disconnect do |status,message|
628
629
  end
629
630
  end
631
+
632
+ ##
633
+ # Mid-level function to send Subscription to Broker, if code block is provided, it will run the block when new messages are received.
634
+ # When subsciption is established with Broker, a :sub_ack message is given to code block.
635
+ # Incoming messages are indicated with :got_data status.
636
+ # If connection to Broker is disrupted, a :disconnect message is given.!
630
637
 
631
- def subscribe topic,hash={},&block
638
+ def subscribe topic,hash={},&block # :yields: status, message
632
639
  send :subscribe, topic: topic, qos: hash[:qos],expect: :sub_ack do |s,m|
633
640
  if s==:ok
634
641
  if m[:topic_id] and m[:topic_id]>0 #when subs topic has no wild cards, we get topic id here:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mqtt-sn-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Siitonen