meshtastic 0.0.112 → 0.0.113
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/meshtastic/mqtt.rb +8 -0
- data/lib/meshtastic/version.rb +1 -1
- data/lib/meshtastic.rb +5 -0
- 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: 2e838a5ad607ba7d6a0d5babe727ce2366d2cc6f384d0c658202d8ff52b0b788
|
|
4
|
+
data.tar.gz: d02409916db5899c662e6435b7d3dcc59093b837889e3da12173f9e1b989ffca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff60ebb000eb556d282f2c733f55e1bbfd62e1eebe6bb29369c9092eeb8aaf50d910c174deb8fa3c5bed7501dd5dc285096c64c4eff16feacd11c7dfac57db34
|
|
7
|
+
data.tar.gz: 9569a7668378b563f1bdfecc7ca761ab47b0e24d9cdba2eda359d0661dede59b4c3c74f20582f1b6e8e044e14d0778b152cf5915d05634d00eddde8bd02032ad
|
data/lib/meshtastic/mqtt.rb
CHANGED
|
@@ -65,6 +65,7 @@ module Meshtastic
|
|
|
65
65
|
# channel_topic: 'optional - channel ID path e.g. "2/stat/#" (default: "2/e/LongFast/#")',
|
|
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
|
+
# exclude: 'optional - comma-delimited string(s) to exclude in message (default: nil)',
|
|
68
69
|
# filter: 'optional - comma-delimited string(s) to filter on in message (default: nil)',
|
|
69
70
|
# gps_metadata: 'optional - include GPS metadata in output (default: false)',
|
|
70
71
|
# include_raw: 'optional - include raw packet data in output (default: false)'
|
|
@@ -86,6 +87,7 @@ module Meshtastic
|
|
|
86
87
|
|
|
87
88
|
qos = opts[:qos] ||= 0
|
|
88
89
|
json = opts[:json] ||= false
|
|
90
|
+
exclude = opts[:exclude]
|
|
89
91
|
filter = opts[:filter]
|
|
90
92
|
gps_metadata = opts[:gps_metadata] ||= false
|
|
91
93
|
include_raw = opts[:include_raw] ||= false
|
|
@@ -99,6 +101,7 @@ module Meshtastic
|
|
|
99
101
|
# MQTT::ProtocolException: No Ping Response received for 23 seconds (MQTT::ProtocolException)
|
|
100
102
|
|
|
101
103
|
filter_arr = filter.to_s.split(',').map(&:strip)
|
|
104
|
+
exclude_arr = exclude.to_s.split(',').map(&:strip)
|
|
102
105
|
mqtt_obj.get_packet do |packet_bytes|
|
|
103
106
|
raw_packet = packet_bytes.to_s if include_raw
|
|
104
107
|
raw_topic = packet_bytes.topic ||= ''
|
|
@@ -196,10 +199,14 @@ module Meshtastic
|
|
|
196
199
|
|
|
197
200
|
next
|
|
198
201
|
ensure
|
|
202
|
+
exclude_arr = [message[:id].to_s] if exclude.nil?
|
|
199
203
|
filter_arr = [message[:id].to_s] if filter.nil?
|
|
200
204
|
if message.is_a?(Hash)
|
|
201
205
|
flat_message = message.values.join(' ')
|
|
202
206
|
|
|
207
|
+
disp = false if exclude_arr.first == message[:id] ||
|
|
208
|
+
exclude_arr.all? { |exclude| flat_message.include?(exclude) }
|
|
209
|
+
|
|
203
210
|
disp = true if filter_arr.first == message[:id] ||
|
|
204
211
|
filter_arr.all? { |filter| flat_message.include?(filter) }
|
|
205
212
|
|
|
@@ -299,6 +306,7 @@ module Meshtastic
|
|
|
299
306
|
psks: 'optional - hash of :channel_id => psk key value pairs (default: { LongFast: 'AQ==' })',
|
|
300
307
|
qos: 'optional - quality of service (default: 0)',
|
|
301
308
|
json: 'optional - JSON output (default: false)',
|
|
309
|
+
exclude: 'optional - comma-delimited string(s) to exclude in message (default: nil)',
|
|
302
310
|
filter: 'optional - comma-delimited string(s) to filter on in message (default: nil)',
|
|
303
311
|
gps_metadata: 'optional - include GPS metadata in output (default: false)'
|
|
304
312
|
)
|
data/lib/meshtastic/version.rb
CHANGED
data/lib/meshtastic.rb
CHANGED
|
@@ -441,6 +441,11 @@ module Meshtastic
|
|
|
441
441
|
payload[:macaddr] = mac_hex_str
|
|
442
442
|
end
|
|
443
443
|
|
|
444
|
+
if payload.keys.include?(:public_key)
|
|
445
|
+
public_key_raw = payload[:public_key]
|
|
446
|
+
payload[:public_key] = Base64.strict_encode64(public_key_raw)
|
|
447
|
+
end
|
|
448
|
+
|
|
444
449
|
if payload.keys.include?(:time)
|
|
445
450
|
time_int = payload[:time]
|
|
446
451
|
if time_int.is_a?(Integer)
|