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.
- checksums.yaml +4 -4
- data/lib/mqtt-sn-ruby.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 039a346b9a168561fb786790f130fae2e62ed049
|
4
|
+
data.tar.gz: 92ee170999744efabe899e8e9c8c23e650c1ca7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|