meshtastic 0.0.59 → 0.0.61
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 +40 -10
- data/lib/meshtastic/version.rb +1 -1
- data/lib/meshtastic.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dceeac29deeac96282b54784e35f07c58b94eefa80d90e52c99fa13d34abe359
|
4
|
+
data.tar.gz: 8a30e46f08215d9c681506e9e138856b442f97af1f9bdcb28b3a2c3defd02a14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac41b52aa5c8069b6da7b8ce6e27f09643604c0b2978230dde661612e50a1656e6740d7ede4f4c8bf27a0230b807e4b98f305897e293053f0450d5f8a793aa52
|
7
|
+
data.tar.gz: 760a90c99e4618a3b1448e13d5a2fd0434a5c169d7235629c8c18a128bc8761bd81135a131e6aa4cce84f823dd27eb15aa77a077a1b3ed4fd761e2cf3a54e6e8
|
data/lib/meshtastic/mqtt.rb
CHANGED
@@ -167,7 +167,8 @@ module Meshtastic
|
|
167
167
|
end
|
168
168
|
|
169
169
|
payload
|
170
|
-
rescue
|
170
|
+
rescue Encoding::CompatibilityError,
|
171
|
+
Google::Protobuf::ParseError
|
171
172
|
payload
|
172
173
|
rescue StandardError => e
|
173
174
|
raise e
|
@@ -291,18 +292,21 @@ module Meshtastic
|
|
291
292
|
message[:stdout] = 'pretty'
|
292
293
|
stdout_message = JSON.pretty_generate(decoded_payload_hash)
|
293
294
|
end
|
294
|
-
rescue
|
295
|
+
rescue Encoding::CompatibilityError,
|
296
|
+
Google::Protobuf::ParseError,
|
295
297
|
JSON::GeneratorError,
|
296
298
|
ArgumentError => e
|
297
299
|
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
300
|
+
unless e.is_a?(Encoding::CompatibilityError)
|
301
|
+
message[:decrypted] = e.message if e.message.include?('key must be')
|
302
|
+
message[:decrypted] = 'unable to decrypt - psk?' if e.message.include?('occurred during parsing')
|
303
|
+
decoded_payload_hash[:packet] = message
|
304
|
+
unless block_given?
|
305
|
+
puts "WARNING: #{e.inspect} - MSG IS >>>"
|
306
|
+
# puts e.backtrace
|
307
|
+
message[:stdout] = 'inspect'
|
308
|
+
stdout_message = decoded_payload_hash.inspect
|
309
|
+
end
|
306
310
|
end
|
307
311
|
|
308
312
|
next
|
@@ -339,6 +343,32 @@ module Meshtastic
|
|
339
343
|
mqtt_obj.disconnect if mqtt_obj
|
340
344
|
end
|
341
345
|
|
346
|
+
# Supported Method Parameters::
|
347
|
+
# Meshtastic.send_text(
|
348
|
+
# mqtt_obj: 'required - mqtt_obj returned from #connect method',
|
349
|
+
# from: ' required - From ID (String or Integer)',
|
350
|
+
# to: 'optional - Destination ID (Default: 0xFFFFFFFF)',
|
351
|
+
# topic: 'optional - topic to publish to (default: "msh/US/2/e/LongFast/1")',
|
352
|
+
# channel: 'optional - channel ID (Default: 6)',
|
353
|
+
# text: 'optional - Text Message (Default: SYN)',
|
354
|
+
# want_ack: 'optional - Want Acknowledgement (Default: false)',
|
355
|
+
# want_response: 'optional - Want Response (Default: false)',
|
356
|
+
# hop_limit: 'optional - Hop Limit (Default: 3)',
|
357
|
+
# on_response: 'optional - Callback on Response',
|
358
|
+
# psks: 'optional - hash of :channel => psk key value pairs (default: { LongFast: "AQ==" })'
|
359
|
+
# )
|
360
|
+
public_class_method def self.send_text(opts = {})
|
361
|
+
mqtt_obj = opts[:mqtt_obj]
|
362
|
+
topic = opts[:topic] ||= 'msh/US/2/e/LongFast/#'
|
363
|
+
opts[:via] = :mqtt
|
364
|
+
|
365
|
+
protobuf_text = Meshtastic.send_text(opts)
|
366
|
+
|
367
|
+
mqtt_obj.publish(topic, protobuf_text)
|
368
|
+
rescue StandardError => e
|
369
|
+
raise e
|
370
|
+
end
|
371
|
+
|
342
372
|
# Supported Method Parameters::
|
343
373
|
# mqtt_obj = Meshtastic.gps_search(
|
344
374
|
# lat: 'required - latitude float (e.g. 37.7749)',
|
data/lib/meshtastic/version.rb
CHANGED
data/lib/meshtastic.rb
CHANGED
@@ -55,7 +55,7 @@ module Meshtastic
|
|
55
55
|
# to: 'optional - Destination ID (Default: 0xFFFFFFFF)',
|
56
56
|
# last_packet_id: 'optional - Last Packet ID (Default: 0)',
|
57
57
|
# via: 'optional - :radio || :mqtt (Default: :radio)',
|
58
|
-
# channel: 'optional - Channel ID (Default:
|
58
|
+
# channel: 'optional - Channel ID (Default: 6)',
|
59
59
|
# text: 'optional - Text Message (Default: SYN)',
|
60
60
|
# want_ack: 'optional - Want Acknowledgement (Default: false)',
|
61
61
|
# want_response: 'optional - Want Response (Default: false)',
|
@@ -76,7 +76,7 @@ module Meshtastic
|
|
76
76
|
|
77
77
|
last_packet_id = opts[:last_packet_id] ||= 0
|
78
78
|
via = opts[:via] ||= :radio
|
79
|
-
channel = opts[:channel] ||=
|
79
|
+
channel = opts[:channel] ||= 6
|
80
80
|
text = opts[:text] ||= 'SYN'
|
81
81
|
want_ack = opts[:want_ack] ||= false
|
82
82
|
want_response = opts[:want_response] ||= false
|
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.
|
4
|
+
version: 0.0.61
|
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-
|
11
|
+
date: 2024-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|