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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34eef8b231322cca365191e89c50ef9b10a77d8456ae2e390b86e41b72611d3f
4
- data.tar.gz: e1e2dc348d689525ba523dd68f0e333a4f3aae60c83d8413b9f04ab70b8cba62
3
+ metadata.gz: caa92569cfc04914d4775054daefc5382265ccdcde9791caa0c7efcb27322ce3
4
+ data.tar.gz: f06f9ec597ee5636fa7faed5bfaa6023f731d561b4d46341d9486e311eb29ea1
5
5
  SHA512:
6
- metadata.gz: 138fb6597e450a6f7d8818040d329093c259bb598d06679588d26c520b3cc1c64ebc6fab0e1c6ebe85c89d78e2ce8651cbb5be349708e014fce693ce9cf2b1fa
7
- data.tar.gz: f7b9b40377b8829b0be90f7278bdf00086ca715a80d6e19b20ff8275a37cedcbe2e1a5436cea15d5fcdb0592c2a1681ce046bedbf79f39ad724b09046377f9db
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 filter for all messages containing `_APP` _and_ `LongFast` strings, use the following code:
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
- filter: '_APP, LongFast'
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
- filter: '!YOUR_CLIENT_ID'
81
+ include: '!YOUR_CLIENT_ID'
82
82
  ) do |message|
83
83
  puts message.inspect
84
84
  end
@@ -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
- # filter: 'optional - comma-delimited string(s) to filter on in message (default: nil)',
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
- filter = opts[:filter]
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
- filter_arr = filter.to_s.split(',').map(&:strip)
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
- exclude_arr = [message[:id].to_s] if exclude.nil?
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 filter_arr.first == message[:id] ||
213
- filter_arr.all? { |filter| flat_message.include?(filter) }
214
-
215
- disp = false if exclude_arr.first == message[:id] ||
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
- filter: 'optional - comma-delimited string(s) to filter on in message (default: nil)',
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Meshtastic
4
- VERSION = '0.0.114'
4
+ VERSION = '0.0.115'
5
5
  end
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.114
4
+ version: 0.0.115
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.