meshtastic 0.0.36 → 0.0.37

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: a1557d6c023667935647acdf7bb90c4d1613bf048a1907b522849fb9f3a3c5d1
4
- data.tar.gz: a26600a5afd502eeb0a7efe99c9df4cddf8f41635d1d53414f8d4a7d59c036f3
3
+ metadata.gz: 41d11712815ee1680ff3929084cbe63bc0500d400bbdf7d2f087709a9ded258f
4
+ data.tar.gz: 817138fd986e7a7f7267e69861f866dedad4ac95de8194e7a6e3edcdd6b028ac
5
5
  SHA512:
6
- metadata.gz: 38f3941863fb6a984f0ea93e170435fdf9d6c9ff648b7b779cb476daf7c4d3e6fdae2c17ac1b28207a5e7a36088cf3eb9630478304059350a6edc9163538eb19
7
- data.tar.gz: 356331a1d7daf23a56359108cf469e059fb5671660a8cea817b21ada22253e400e8879cc74cc0ff4197a0240c47f5416783d84cadba37374c7f4c823e947340d
6
+ metadata.gz: 31ce0114b3ad6e1a03ad185b2706f44ee303c7d8ed1f5fa258ad96b5b6422bdde6d62352fcb7ea71005aa242d99a50eaa2917ef94c063c4a4d6c5f2f04a129e2
7
+ data.tar.gz: 2caacc5276cb34442c07af78fd8539620b613a3021b84893be243299c0ebd2bdbbdd303a2c65edd3286128c26792fa8e02b2d2be8e51e250b11323307817d6cb
@@ -46,11 +46,10 @@ module Meshtastic
46
46
  # Meshtastic::MQQT.subscribe(
47
47
  # mqtt_obj: 'required - mqtt_obj returned from #connect method'
48
48
  # root_topic: 'optional - root topic (default: msh)',
49
- # region: 'optional - region (default: US)',
50
- # channel: 'optional - channel name (default: LongFast)',
49
+ # region: 'optional - region e.g. 'US/VA', etc (default: US)',
50
+ # channel: 'optional - channel name (default: "2/c/LongFast/#")',
51
51
  # psk: 'optional - channel pre-shared key (default: AQ==)',
52
52
  # qos: 'optional - quality of service (default: 0)',
53
- # json: 'optional - JSON output (default: false)',
54
53
  # filter: 'optional - comma-delimited string(s) to filter on in message (default: nil)',
55
54
  # gps_metadata: 'optional - include GPS metadata in output (default: false)'
56
55
  # )
@@ -59,7 +58,7 @@ module Meshtastic
59
58
  mqtt_obj = opts[:mqtt_obj]
60
59
  root_topic = opts[:root_topic] ||= 'msh'
61
60
  region = opts[:region] ||= 'US'
62
- channel = opts[:channel] ||= 'LongFast'
61
+ channel = opts[:channel] ||= '2/e/LongFast/#'
63
62
  psk = opts[:psk] ||= 'AQ=='
64
63
  qos = opts[:qos] ||= 0
65
64
  json = opts[:json] ||= false
@@ -67,8 +66,7 @@ module Meshtastic
67
66
  gps_metadata = opts[:gps_metadata] ||= false
68
67
 
69
68
  # TODO: Find JSON URI for this
70
- full_topic = "#{root_topic}/#{region}/2/json/#{channel}/#" if json
71
- full_topic = "#{root_topic}/#{region}/2/c/#{channel}/#" unless json
69
+ full_topic = "#{root_topic}/#{region}/#{channel}"
72
70
  puts "Subscribing to: #{full_topic}"
73
71
  mqtt_obj.subscribe(full_topic, qos)
74
72
 
@@ -76,7 +74,7 @@ module Meshtastic
76
74
  # Our AES key is 128 or 256 bits, shared as part of the 'Channel' specification.
77
75
 
78
76
  # Actual pre-shared key for LongFast channel
79
- psk = '1PG7OiApB1nwvP+rz05pAQ==' if channel == 'LongFast'
77
+ psk = '1PG7OiApB1nwvP+rz05pAQ==' if channel.include?('LongFast')
80
78
  padded_psk = psk.ljust(psk.length + ((4 - (psk.length % 4)) % 4), '=')
81
79
  replaced_psk = padded_psk.gsub('-', '+').gsub('_', '/')
82
80
  psk = replaced_psk
@@ -227,8 +225,10 @@ module Meshtastic
227
225
  stdout_message = JSON.pretty_generate(decoded_payload_hash)
228
226
  end
229
227
  rescue Google::Protobuf::ParseError,
230
- JSON::GeneratorError
228
+ JSON::GeneratorError,
229
+ ArgumentError => e
231
230
 
231
+ message[:decrypted] = e.message if ArgumentError
232
232
  decoded_payload_hash[:packet] = message
233
233
  unless block_given?
234
234
  message[:stdout] = 'inspect'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Meshtastic
4
- VERSION = '0.0.36'
4
+ VERSION = '0.0.37'
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.36
4
+ version: 0.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.