meshtastic 0.0.114 → 0.0.115
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/README.md +3 -3
- data/lib/meshtastic/mqtt.rb +9 -11
- data/lib/meshtastic/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caa92569cfc04914d4775054daefc5382265ccdcde9791caa0c7efcb27322ce3
|
4
|
+
data.tar.gz: f06f9ec597ee5636fa7faed5bfaa6023f731d561b4d46341d9486e311eb29ea1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ba94636af81ca286cdf239ed65249093457a666df9dd003975417e729c4179c8b010e28480424a2e263670174283326e40672ea591dbc11d50bad5a1b4043ec
|
7
|
+
data.tar.gz: 575743047507a3d99fbe9556c348f09b4606c3247565d50aaf668662dd0eec3f970640a4db19bddfcbf0e71d2981355ccc1125ea77ada3cae62d78267f1c7f61
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
-
At the moment the only module available is `Meshtastic::MQTT`. To view MQTT messages, and
|
27
|
+
At the moment the only module available is `Meshtastic::MQTT`. To view MQTT messages, and include only messages containing `_APP` _and_ `LongFast` strings, use the following code:
|
28
28
|
|
29
29
|
```ruby
|
30
30
|
require 'meshtastic'
|
@@ -32,7 +32,7 @@ Meshtastic::MQTT.help
|
|
32
32
|
mqtt_obj = Meshastic::MQTT.connect
|
33
33
|
Meshtastic::MQTT.subscribe(
|
34
34
|
mqtt_obj: mqtt_obj,
|
35
|
-
|
35
|
+
include: '_APP, LongFast'
|
36
36
|
)
|
37
37
|
```
|
38
38
|
|
@@ -78,7 +78,7 @@ Meshtastic::MQTT.subscribe(
|
|
78
78
|
region: 'US',
|
79
79
|
channel_topic: '2/e/LongFast/#',
|
80
80
|
psks: { LongFast: 'AQ==' },
|
81
|
-
|
81
|
+
include: '!YOUR_CLIENT_ID'
|
82
82
|
) do |message|
|
83
83
|
puts message.inspect
|
84
84
|
end
|
data/lib/meshtastic/mqtt.rb
CHANGED
@@ -66,7 +66,7 @@ module Meshtastic
|
|
66
66
|
# psks: 'optional - hash of :channel_id => psk key value pairs (default: { LongFast: "AQ==" })',
|
67
67
|
# qos: 'optional - quality of service (default: 0)',
|
68
68
|
# exclude: 'optional - comma-delimited string(s) to exclude in message (default: nil)',
|
69
|
-
#
|
69
|
+
# include: 'optional - comma-delimited string(s) to include on in message (default: nil)',
|
70
70
|
# gps_metadata: 'optional - include GPS metadata in output (default: false)',
|
71
71
|
# include_raw: 'optional - include raw packet data in output (default: false)'
|
72
72
|
# )
|
@@ -88,7 +88,7 @@ module Meshtastic
|
|
88
88
|
qos = opts[:qos] ||= 0
|
89
89
|
json = opts[:json] ||= false
|
90
90
|
exclude = opts[:exclude]
|
91
|
-
|
91
|
+
include = opts[:include]
|
92
92
|
gps_metadata = opts[:gps_metadata] ||= false
|
93
93
|
include_raw = opts[:include_raw] ||= false
|
94
94
|
|
@@ -100,7 +100,7 @@ module Meshtastic
|
|
100
100
|
|
101
101
|
# MQTT::ProtocolException: No Ping Response received for 23 seconds (MQTT::ProtocolException)
|
102
102
|
|
103
|
-
|
103
|
+
include_arr = include.to_s.split(',').map(&:strip)
|
104
104
|
exclude_arr = exclude.to_s.split(',').map(&:strip)
|
105
105
|
mqtt_obj.get_packet do |packet_bytes|
|
106
106
|
raw_packet = packet_bytes.to_s if include_raw
|
@@ -204,16 +204,14 @@ module Meshtastic
|
|
204
204
|
|
205
205
|
next
|
206
206
|
ensure
|
207
|
-
|
208
|
-
filter_arr = [message[:id].to_s] if filter.nil?
|
207
|
+
include_arr = [message[:id].to_s] if include_arr.empty?
|
209
208
|
if message.is_a?(Hash)
|
210
209
|
flat_message = message.values.join(' ')
|
211
210
|
|
212
|
-
disp = true if
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
exclude_arr.all? { |exclude| flat_message.include?(exclude) }
|
211
|
+
disp = true if exclude_arr.none? { |exclude| flat_message.include?(exclude) } && (
|
212
|
+
include_arr.first == message[:id] ||
|
213
|
+
include_arr.all? { |include| flat_message.include?(include) }
|
214
|
+
)
|
217
215
|
|
218
216
|
if disp
|
219
217
|
if block_given?
|
@@ -312,7 +310,7 @@ module Meshtastic
|
|
312
310
|
qos: 'optional - quality of service (default: 0)',
|
313
311
|
json: 'optional - JSON output (default: false)',
|
314
312
|
exclude: 'optional - comma-delimited string(s) to exclude in message (default: nil)',
|
315
|
-
|
313
|
+
include: 'optional - comma-delimited string(s) to include on in message (default: nil)',
|
316
314
|
gps_metadata: 'optional - include GPS metadata in output (default: false)'
|
317
315
|
)
|
318
316
|
|
data/lib/meshtastic/version.rb
CHANGED