meshtastic 0.0.45 → 0.0.47

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2d188ac05f244ce12a4825659a327bb883a51cb601875e5c21e8b45b4528741
4
- data.tar.gz: 535ab977c36d067eb9c6a2a3be242b96efa1e3ed0864e2e4d3517970c806d870
3
+ metadata.gz: 8c8b90d169f041f15fe64d36133a7ed30606c98bb7377c1f783e222c57b805bc
4
+ data.tar.gz: b8fc0fc381efecc813bf0c622638c73a2d3edd016f124f8636822324329b307a
5
5
  SHA512:
6
- metadata.gz: c46cdbb49616cc18ddf12a06f11e2dcd981581455146923571601a16ca417a7ddf18b3d769a6182b874ae01aafb526ed6d967c453dfedb30142ed995b398728c
7
- data.tar.gz: df15c9aa4b5084734e3db4122647242ed16d89ddc45d8a54bc163602b86ca5cf93a110ca064d90052698f726dc01910023ac8506bbc1b88ce50609dd825f0abc
6
+ metadata.gz: ec4a0d4ecf315388482c71b51edb9213e03ac56ed2fad87a62c7bd715ba8071be85700d207646aa28392a52cbee9b0d431e8911ae7924ae8455ab51481219330
7
+ data.tar.gz: 17d1662d12d303ff0824b5716fa00829275d3fd8169a86f48d84960e207dc8e80fdd17337f240d4b6d52326cf98e2d2a851013306d7bd60e85bfae479eae35cd
@@ -127,6 +127,9 @@ module Meshtastic
127
127
  decoder = Meshtastic::Waypoint
128
128
  # when :ZPS_APP
129
129
  # decoder = Meshtastic::Zps
130
+ else
131
+ puts "WARNING: Can't decode\n#{payload}\nw/ portnum: #{msg_type.inspect}"
132
+ return payload
130
133
  end
131
134
 
132
135
  payload = decoder.decode(payload).to_h
@@ -205,6 +208,7 @@ module Meshtastic
205
208
 
206
209
  # NOTE: Use MQTT Explorer for topic discovery
207
210
  full_topic = "#{root_topic}/#{region}/#{channel}"
211
+ full_topic = "#{root_topic}/#{region}" if region == '#'
208
212
  puts "Subscribing to: #{full_topic}"
209
213
  mqtt_obj.subscribe(full_topic, qos)
210
214
 
@@ -227,6 +231,8 @@ module Meshtastic
227
231
  decoded_payload_hash = decoded_payload.to_h
228
232
  end
229
233
 
234
+ next unless decoded_payload_hash[:packet].is_a?(Hash)
235
+
230
236
  message = decoded_payload_hash[:packet] if decoded_payload_hash.keys.include?(:packet)
231
237
  message[:topic] = raw_topic
232
238
  message[:node_id_from] = "!#{message[:from].to_i.to_s(16)}"
@@ -293,24 +299,26 @@ module Meshtastic
293
299
  next
294
300
  ensure
295
301
  filter_arr = [message[:id].to_s] if filter.nil?
296
- flat_message = message.values.join(' ')
297
-
298
- disp = true if filter_arr.first == message[:id] ||
299
- filter_arr.all? { |filter| flat_message.include?(filter) }
300
-
301
- if disp
302
- if block_given?
303
- yield decoded_payload_hash
304
- else
305
- puts "\n"
306
- puts '-' * 80
307
- puts 'MSG:'
308
- puts stdout_message
309
- puts '-' * 80
310
- puts "\n\n\n"
302
+ if message.is_a?(Hash)
303
+ flat_message = message.values.join(' ')
304
+
305
+ disp = true if filter_arr.first == message[:id] ||
306
+ filter_arr.all? { |filter| flat_message.include?(filter) }
307
+
308
+ if disp
309
+ if block_given?
310
+ yield decoded_payload_hash
311
+ else
312
+ puts "\n"
313
+ puts '-' * 80
314
+ puts 'MSG:'
315
+ puts stdout_message
316
+ puts '-' * 80
317
+ puts "\n\n\n"
318
+ end
319
+ # else
320
+ # print '.'
311
321
  end
312
- else
313
- print '.'
314
322
  end
315
323
  end
316
324
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Meshtastic
4
- VERSION = '0.0.45'
4
+ VERSION = '0.0.47'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meshtastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.45
4
+ version: 0.0.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-07 00:00:00.000000000 Z
11
+ date: 2024-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler