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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7200eec80ec91cb140cd1d3601ec51805518ea92226f5bc6059121a476bd2ea9
4
- data.tar.gz: b83f2d2f30ad0f4ee56f11e6800852df1b2f65b6cc617848e39f91ea1a5e52a5
3
+ metadata.gz: 2e838a5ad607ba7d6a0d5babe727ce2366d2cc6f384d0c658202d8ff52b0b788
4
+ data.tar.gz: d02409916db5899c662e6435b7d3dcc59093b837889e3da12173f9e1b989ffca
5
5
  SHA512:
6
- metadata.gz: '008f3c27d34852e0c836e0d9277839423931b19ee565ed7982644037754c5e97a443bab3b7046ea7309bfc77554e823f1c9f403a69296efc097c3175ea44e200'
7
- data.tar.gz: 803b1f36e00d8fa4be008530bcb8aa72c1fde33f7dc37db195cd39d9957233c0c0198a892b5d6e8eb2028f340c997c58f6227a1d3fe09ea4551bca864bcc6add
6
+ metadata.gz: ff60ebb000eb556d282f2c733f55e1bbfd62e1eebe6bb29369c9092eeb8aaf50d910c174deb8fa3c5bed7501dd5dc285096c64c4eff16feacd11c7dfac57db34
7
+ data.tar.gz: 9569a7668378b563f1bdfecc7ca761ab47b0e24d9cdba2eda359d0661dede59b4c3c74f20582f1b6e8e044e14d0778b152cf5915d05634d00eddde8bd02032ad
@@ -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
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Meshtastic
4
- VERSION = '0.0.112'
4
+ VERSION = '0.0.113'
5
5
  end
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meshtastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.112
4
+ version: 0.0.113
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.