lora-rb 0.9.0 → 0.9.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/lora-rb/mqtt/call.rb +15 -3
- data/lib/version.rb +1 -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: 6721e00c200b9586f0163e4201d8d6567da32c95
|
4
|
+
data.tar.gz: a3570cca519d24039ffc15e3f5f460d8c375b6f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8be4bf0294c38f19c0221b674867be53a4f21263e968244c8f952b87fcee9d0ebe0b7b534ac48556834d2f3ed1ed4e272d6deac89444e73847b3b0a3a2f988fb
|
7
|
+
data.tar.gz: 960adbb35dbdb17ecc3d42f94cfece6dfa256eb837a07ba694d06032408f632f6db17f88a3fa4ebdeb9e939f3a128224f908d316b4b05b7fd325f995b61123b9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
v0.9.1 [☰](https://bitbucket.org/fractalgarden/loriot-rb/branches/compare/v0.9.0..v0.9.1) August 7th, 2017
|
2
|
+
------------------------------
|
3
|
+
* Added port to message uplink via mqtt, EUI is now eui
|
4
|
+
|
1
5
|
v0.9.0 [☰](https://bitbucket.org/fractalgarden/loriot-rb/branches/compare/v0.8.0..v0.9.0) August 7th, 2017
|
2
6
|
------------------------------
|
3
7
|
* Mqtt protocol renamed to Rabbitmq and new generic mqtt protocol added
|
data/lib/lora-rb/mqtt/call.rb
CHANGED
@@ -84,7 +84,10 @@ module LoraRb
|
|
84
84
|
puts " [x] Reading topic #{topic}..." if options[:debug]
|
85
85
|
topic, message = @client.get(topic)
|
86
86
|
message = JSON.parse(message)
|
87
|
-
|
87
|
+
if message.respond_to? '[]'
|
88
|
+
message['eui'] ||= get_eui_from_topic(topic)
|
89
|
+
message['port'] ||= get_port_from_topic(topic)
|
90
|
+
end
|
88
91
|
puts " [x] #{topic}: #{message}" if options[:debug]
|
89
92
|
return topic, message
|
90
93
|
end
|
@@ -98,7 +101,10 @@ module LoraRb
|
|
98
101
|
# Block is executed for every message received
|
99
102
|
puts " [x] #{topic}: #{message}" if options[:debug]
|
100
103
|
message = JSON.parse(message)
|
101
|
-
|
104
|
+
if message.respond_to? '[]'
|
105
|
+
message['eui'] ||= get_eui_from_topic(topic)
|
106
|
+
message['port'] ||= get_port_from_topic(topic)
|
107
|
+
end
|
102
108
|
puts " [x] after rework: #{message}" if options[:debug]
|
103
109
|
block.call(topic, message) if block
|
104
110
|
break if options[:test]
|
@@ -113,7 +119,13 @@ module LoraRb
|
|
113
119
|
private
|
114
120
|
|
115
121
|
def get_eui_from_topic(topic)
|
116
|
-
topic&.match(/
|
122
|
+
res = topic&.match(/devices\/(\w{16})/)
|
123
|
+
res[1] if res
|
124
|
+
end
|
125
|
+
|
126
|
+
def get_port_from_topic(topic)
|
127
|
+
res = topic&.match(/uplink\/(\d+)(\/|\Z)/)
|
128
|
+
res[1] if res
|
117
129
|
end
|
118
130
|
|
119
131
|
def generate_request_id
|
data/lib/version.rb
CHANGED