mqtt-sn-ruby 0.0.16 → 0.0.17
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/bin/mqtt-sn-pub.rb +13 -8
- data/lib/mqtt-sn-ruby.rb +2 -1
- 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: 36933af1cb091daf1589de7c56e0fd405aa9d498
|
4
|
+
data.tar.gz: acfaa8908bd286530b1d2d57ee755401c867820b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08b91c72b2b0819b9aae457eb7f9c97d38bb3e999b4b8f098191c62f07c69cd1bcbfdba9431d76b05636bac43a1b8702b5628ba5c35ca16702bcd0e3366649ca
|
7
|
+
data.tar.gz: a1d0cd9bd2b15a1fd88883dfb82c88cf33a4b2aa1dd1b34de350a225a63f4a774a314554db75e5013a86a37269b19089859f4a30231fbb15bbf77917b07e40b2
|
data/bin/mqtt-sn-pub.rb
CHANGED
@@ -44,14 +44,19 @@ puts "MQTT-SN-PUB: #{options.to_json}"
|
|
44
44
|
begin
|
45
45
|
sn=MqttSN.new options
|
46
46
|
sent=false
|
47
|
-
|
48
|
-
sn.
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
if options[:qos]==-1
|
48
|
+
sn.publish options[:topic]||"XX", options[:msg]||"test_value", qos: options[:qos]
|
49
|
+
puts "Sent."
|
50
|
+
else
|
51
|
+
while not sent
|
52
|
+
sn.connect options[:id] do |s,m|
|
53
|
+
if s==:ok
|
54
|
+
sn.publish options[:topic]||"test/message/123", options[:msg]||"test_value", qos: options[:qos]
|
55
|
+
puts "Sent ok."
|
56
|
+
sent=true
|
57
|
+
else
|
58
|
+
sn.disconnect
|
59
|
+
end
|
55
60
|
end
|
56
61
|
end
|
57
62
|
end
|
data/lib/mqtt-sn-ruby.rb
CHANGED
@@ -290,9 +290,10 @@ class MqttSN
|
|
290
290
|
|
291
291
|
def send type,hash={},&block
|
292
292
|
#puts "" if @verbose
|
293
|
-
if @state!=:connected and type!=:connect and type!=:will_topic and type!=:will_msg and type!=:searchgw
|
293
|
+
if @state!=:connected and type!=:connect and type!=:will_topic and type!=:will_msg and type!=:searchgw
|
294
294
|
if type==:disconnect
|
295
295
|
return #already disconnected.. nothing to do
|
296
|
+
elsif type==:publish and hash[:qos]==-1
|
296
297
|
else
|
297
298
|
note "Error: Cannot #{type} while unconnected, send :connect first!"
|
298
299
|
return nil
|