meshtastic 0.0.98 → 0.0.99
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 +5 -5
- data/lib/meshtastic/version.rb +1 -1
- data/lib/meshtastic.rb +82 -21
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19b2268e9d4efe0f6859ad716e08cfcf0b77f867fe5c2f7915ba6fcf75e27f07
|
4
|
+
data.tar.gz: 92337d4c1dd42ce604710d014b1f1a702cff6738337b295c7ebe5ae7a9f40e58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46eac9ee60d6276da8254c0c0383231e92280ecabc2c767f6cf6467e72769c50d9d29df545e214e35fec2f39b42c00b40caf6acec7b9676af58ae4aafc5f4116
|
7
|
+
data.tar.gz: 7622bd994c0e9af5945209e1426c13ec2292c5934976194b3f9aaadd2aad898ea0bc33c6426a3f9944df7dcf198d0a35465a2efd6c893561f2afe5964e020ebb
|
data/lib/meshtastic/mqtt.rb
CHANGED
@@ -216,9 +216,9 @@ module Meshtastic
|
|
216
216
|
# Supported Method Parameters::
|
217
217
|
# Meshtastic.send_text(
|
218
218
|
# mqtt_obj: 'required - mqtt_obj returned from #connect method',
|
219
|
-
# from: '
|
220
|
-
# to: 'optional - Destination ID (Default:
|
221
|
-
# topic: 'optional - topic to publish to (
|
219
|
+
# from: 'required - From ID (String or Integer) (Default: "!00000b0b")',
|
220
|
+
# to: 'optional - Destination ID (Default: "!ffffffff")',
|
221
|
+
# topic: 'optional - topic to publish to (Default: "msh/US/2/e/LongFast/1")',
|
222
222
|
# channel: 'optional - channel (Default: 6)',
|
223
223
|
# text: 'optional - Text Message (Default: SYN)',
|
224
224
|
# want_ack: 'optional - Want Acknowledgement (Default: false)',
|
@@ -287,8 +287,8 @@ module Meshtastic
|
|
287
287
|
|
288
288
|
#{self}.send_text(
|
289
289
|
mqtt_obj: 'required - mqtt_obj returned from #connect method',
|
290
|
-
from: '
|
291
|
-
to: 'optional - Destination ID (Default:
|
290
|
+
from: 'required - From ID (String or Integer) (Default: \"!00000b0b\")',
|
291
|
+
to: 'optional - Destination ID (Default: \"!ffffffff\")',
|
292
292
|
topic: 'optional - topic to publish to (default: 'msh/US/2/e/LongFast/1')',
|
293
293
|
channel: 'optional - channel (Default: 6)',
|
294
294
|
text: 'optional - Text Message (Default: SYN)',
|
data/lib/meshtastic/version.rb
CHANGED
data/lib/meshtastic.rb
CHANGED
@@ -51,8 +51,8 @@ module Meshtastic
|
|
51
51
|
|
52
52
|
# Supported Method Parameters::
|
53
53
|
# Meshtastic.send_text(
|
54
|
-
# from: 'required - From ID (String or Integer)',
|
55
|
-
# to: 'optional - Destination ID (Default:
|
54
|
+
# from: 'required - From ID (String or Integer) (Default: "!00000b0b")',
|
55
|
+
# to: 'optional - Destination ID (Default: "!ffffffff")',
|
56
56
|
# last_packet_id: 'optional - Last Packet ID (Default: 0)',
|
57
57
|
# via: 'optional - :radio || :mqtt (Default: :radio)',
|
58
58
|
# channel: 'optional - Channel (Default: 6)',
|
@@ -65,13 +65,13 @@ module Meshtastic
|
|
65
65
|
# )
|
66
66
|
public_class_method def self.send_text(opts = {})
|
67
67
|
# Send a text message to a node
|
68
|
-
from = opts[:from]
|
68
|
+
from = opts[:from] ||= '!00000b0b'
|
69
69
|
# from_hex = from.delete('!').bytes.map { |b| b.to_s(16).rjust(2, '0') }.join if from.is_a?(String)
|
70
70
|
from_hex = from.delete('!') if from.is_a?(String)
|
71
71
|
from = from_hex.to_i(16) if from_hex
|
72
72
|
raise 'ERROR: from parameter is required.' unless from
|
73
73
|
|
74
|
-
to = opts[:to] ||=
|
74
|
+
to = opts[:to] ||= '!ffffffff'
|
75
75
|
# to_hex = to.delete('!').bytes.map { |b| b.to_s(16).rjust(2, '0') }.join if to.is_a?(String)
|
76
76
|
to_hex = to.delete('!') if to.is_a?(String)
|
77
77
|
to = to_hex.to_i(16) if to_hex
|
@@ -123,8 +123,8 @@ module Meshtastic
|
|
123
123
|
|
124
124
|
# Supported Method Parameters::
|
125
125
|
# Meshtastic.send_data(
|
126
|
-
# from: 'required - From ID (String or Integer)',
|
127
|
-
# to: 'optional - Destination ID (Default:
|
126
|
+
# from: 'required - From ID (String or Integer) (Default: "!00000b0b")',
|
127
|
+
# to: 'optional - Destination ID (Default: "!ffffffff")',
|
128
128
|
# last_packet_id: 'optional - Last Packet ID (Default: 0)',
|
129
129
|
# via: 'optional - :radio || :mqtt (Default: :radio)',
|
130
130
|
# channel: 'optional - Channel (Default: 0)',
|
@@ -136,13 +136,13 @@ module Meshtastic
|
|
136
136
|
# )
|
137
137
|
public_class_method def self.send_data(opts = {})
|
138
138
|
# Send a text message to a node
|
139
|
-
from = opts[:from]
|
139
|
+
from = opts[:from] ||= '!00000b0b'
|
140
140
|
# from_hex = from.delete('!').bytes.map { |b| b.to_s(16).rjust(2, '0') }.join if from.is_a?(String)
|
141
141
|
from_hex = from.delete('!') if from.is_a?(String)
|
142
142
|
from = from_hex.to_i(16) if from_hex
|
143
143
|
raise 'ERROR: from parameter is required.' unless from
|
144
144
|
|
145
|
-
to = opts[:to] ||=
|
145
|
+
to = opts[:to] ||= '!ffffffff'
|
146
146
|
# to_hex = to.delete('!').bytes.map { |b| b.to_s(16).rjust(2, '0') }.join if to.is_a?(String)
|
147
147
|
to_hex = to.delete('!') if to.is_a?(String)
|
148
148
|
to = to_hex.to_i(16) if to_hex
|
@@ -188,8 +188,8 @@ module Meshtastic
|
|
188
188
|
# Supported Method Parameters::
|
189
189
|
# Meshtastic.send_packet(
|
190
190
|
# mesh_packet: 'required - Mesh Packet to Send',
|
191
|
-
# from: 'required - From ID (String or Integer)',
|
192
|
-
# to: 'optional - Destination ID (Default:
|
191
|
+
# from: 'required - From ID (String or Integer) (Default: "!00000b0b")',
|
192
|
+
# to: 'optional - Destination ID (Default: "!ffffffff")',
|
193
193
|
# last_packet_id: 'optional - Last Packet ID (Default: 0)',
|
194
194
|
# via: 'optional - :radio || :mqtt (Default: :radio)',
|
195
195
|
# channel: 'optional - Channel (Default: 0)',
|
@@ -199,13 +199,13 @@ module Meshtastic
|
|
199
199
|
# )
|
200
200
|
public_class_method def self.send_packet(opts = {})
|
201
201
|
mesh_packet = opts[:mesh_packet]
|
202
|
-
from = opts[:from]
|
202
|
+
from = opts[:from] ||= '!00000b0b'
|
203
203
|
# from_hex = from.delete('!').bytes.map { |b| b.to_s(16).rjust(2, '0') }.join if from.is_a?(String)
|
204
204
|
from_hex = from.delete('!') if from.is_a?(String)
|
205
205
|
from = from_hex.to_i(16) if from_hex
|
206
206
|
raise 'ERROR: from parameter is required.' unless from
|
207
207
|
|
208
|
-
to = opts[:to] ||=
|
208
|
+
to = opts[:to] ||= '!ffffffff'
|
209
209
|
# to_hex = to.delete('!').bytes.map { |b| b.to_s(16).rjust(2, '0') }.join if to.is_a?(String)
|
210
210
|
to_hex = to.delete('!') if to.is_a?(String)
|
211
211
|
to = to_hex.to_i(16) if to_hex
|
@@ -340,7 +340,7 @@ module Meshtastic
|
|
340
340
|
# Supported Method Parameters::
|
341
341
|
# Meshtastic.gps_search(
|
342
342
|
# lat: 'required - latitude float (e.g. 37.7749)',
|
343
|
-
# lon: 'required - longitude float (e.g. -122.4194)'
|
343
|
+
# lon: 'required - longitude float (e.g. -122.4194)'
|
344
344
|
# )
|
345
345
|
public_class_method def self.gps_search(opts = {})
|
346
346
|
lat = opts[:lat]
|
@@ -477,13 +477,74 @@ module Meshtastic
|
|
477
477
|
# Display a List of Every Meshtastic Module
|
478
478
|
|
479
479
|
public_class_method def self.help
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
480
|
+
puts "USAGE:
|
481
|
+
#{self}.send_text(
|
482
|
+
from: 'required - From ID (String or Integer) (Default: \"!00000b0b\")',
|
483
|
+
to: 'optional - Destination ID (Default: \"!ffffffff\")',
|
484
|
+
last_packet_id: 'optional - Last Packet ID (Default: 0)',
|
485
|
+
via: 'optional - :radio || :mqtt (Default: :radio)',
|
486
|
+
channel: 'optional - Channel (Default: 6)',
|
487
|
+
text: 'optional - Text Message (Default: SYN)',
|
488
|
+
want_ack: 'optional - Want Acknowledgement (Default: false)',
|
489
|
+
want_response: 'optional - Want Response (Default: false)',
|
490
|
+
hop_limit: 'optional - Hop Limit (Default: 3)',
|
491
|
+
on_response: 'optional - Callback on Response',
|
492
|
+
psks: 'optional - hash of :channel => psk key value pairs (default: { LongFast: \"AQ==\" })'
|
493
|
+
)
|
494
|
+
|
495
|
+
#{self}.send_data(
|
496
|
+
from: 'required - From ID (String or Integer) (Default: \"!00000b0b\")',
|
497
|
+
to: 'optional - Destination ID (Default: \"!ffffffff\")',
|
498
|
+
last_packet_id: 'optional - Last Packet ID (Default: 0)',
|
499
|
+
via: 'optional - :radio || :mqtt (Default: :radio)',
|
500
|
+
channel: 'optional - Channel (Default: 0)',
|
501
|
+
data: 'required - Data to Send',
|
502
|
+
want_ack: 'optional - Want Acknowledgement (Default: false)',
|
503
|
+
hop_limit: 'optional - Hop Limit (Default: 3)',
|
504
|
+
port_num: 'optional - (Default: Meshtastic::PortNum::PRIVATE_APP)',
|
505
|
+
psks: 'optional - hash of :channel => psk key value pairs (default: { LongFast: \"AQ==\" })'
|
506
|
+
)
|
507
|
+
|
508
|
+
#{self}.send_packet(
|
509
|
+
mesh_packet: 'required - Mesh Packet to Send',
|
510
|
+
from: 'required - From ID (String or Integer) (Default: \"!00000b0b\")',
|
511
|
+
to: 'optional - Destination ID (Default: \"!ffffffff\")',
|
512
|
+
last_packet_id: 'optional - Last Packet ID (Default: 0)',
|
513
|
+
via: 'optional - :radio || :mqtt (Default: :radio)',
|
514
|
+
channel: 'optional - Channel (Default: 0)',
|
515
|
+
want_ack: 'optional - Want Acknowledgement (Default: false)',
|
516
|
+
hop_limit: 'optional - Hop Limit (Default: 3)',
|
517
|
+
psks: 'optional - hash of :channel => psk key value pairs (default: { LongFast: \"AQ==\" })'
|
518
|
+
)
|
519
|
+
|
520
|
+
#{self}.generate_packet_id(
|
521
|
+
last_packet_id: 'optional - Last Packet ID (Default: 0)'
|
522
|
+
)
|
523
|
+
|
524
|
+
#{self}.get_cipher_keys(
|
525
|
+
psks: 'required - hash of channel / pre-shared key value pairs'
|
526
|
+
)
|
527
|
+
|
528
|
+
#{self}.send_to_radio(
|
529
|
+
to_radio: 'required - ToRadio Message to Send'
|
530
|
+
)
|
531
|
+
|
532
|
+
#{self}.send_to_mqtt(
|
533
|
+
service_envelope: 'required - ServiceEnvelope Message to Send'
|
534
|
+
)
|
535
|
+
|
536
|
+
#{self}.gps_search(
|
537
|
+
lat: 'required - latitude float (e.g. 37.7749)',
|
538
|
+
lon: 'required - longitude float (e.g. -122.4194)'
|
539
|
+
)
|
540
|
+
|
541
|
+
#{self}.decode_payload(
|
542
|
+
payload: 'required - payload to recursively decode',
|
543
|
+
msg_type: 'required - message type (e.g. :TEXT_MESSAGE_APP)',
|
544
|
+
gps_metadata: 'optional - include GPS metadata in output (default: false)',
|
545
|
+
)
|
546
|
+
|
547
|
+
#{self}.authors
|
548
|
+
"
|
488
549
|
end
|
489
550
|
end
|