meshtastic 0.0.178 → 0.0.180
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/README.md +3 -175
- data/documentation/README.md +60 -0
- data/documentation/admin-channel.md +33 -0
- data/documentation/admin-config.md +28 -0
- data/documentation/admin-firmware.md +69 -0
- data/documentation/admin.md +55 -0
- data/documentation/apponly.md +22 -0
- data/documentation/atak.md +110 -0
- data/documentation/bluetooth-bluez.md +35 -0
- data/documentation/bluetooth.md +87 -0
- data/documentation/cannedmessages.md +25 -0
- data/documentation/channel.md +3 -0
- data/documentation/clientonly.md +21 -0
- data/documentation/config.md +3 -0
- data/documentation/connection-status.md +22 -0
- data/documentation/deviceonly.md +22 -0
- data/documentation/localonly.md +21 -0
- data/documentation/mesh-interface.md +52 -0
- data/documentation/meshtastic.md +45 -0
- data/documentation/module-config.md +26 -0
- data/documentation/mqtt.md +101 -0
- data/documentation/paxcount.md +25 -0
- data/documentation/portnums.md +67 -0
- data/documentation/position.md +34 -0
- data/documentation/protobufs.md +162 -0
- data/documentation/remote-hardware.md +33 -0
- data/documentation/rtttl.md +24 -0
- data/documentation/serial.md +78 -0
- data/documentation/storeforward.md +24 -0
- data/documentation/stream-interface.md +15 -0
- data/documentation/tcp.md +43 -0
- data/documentation/telemetry.md +32 -0
- data/documentation/traceroute.md +28 -0
- data/documentation/util.md +27 -0
- data/documentation/xmodem.md +22 -0
- data/lib/meshtastic/admin/channel.rb +90 -0
- data/lib/meshtastic/admin/config.rb +154 -0
- data/lib/meshtastic/admin/firmware.rb +173 -0
- data/lib/meshtastic/admin.rb +495 -7
- data/lib/meshtastic/apponly.rb +26 -8
- data/lib/meshtastic/atak.rb +298 -7
- data/lib/meshtastic/bluetooth/bluez.rb +20 -1
- data/lib/meshtastic/bluetooth.rb +70 -59
- data/lib/meshtastic/cannedmessages.rb +23 -8
- data/lib/meshtastic/channel.rb +3 -21
- data/lib/meshtastic/clientonly.rb +26 -8
- data/lib/meshtastic/config.rb +3 -21
- data/lib/meshtastic/connection_status.rb +13 -8
- data/lib/meshtastic/deviceonly.rb +23 -8
- data/lib/meshtastic/localonly.rb +23 -8
- data/lib/meshtastic/mesh_interface.rb +11 -0
- data/lib/meshtastic/module_config.rb +18 -9
- data/lib/meshtastic/mqtt.rb +72 -35
- data/lib/meshtastic/paxcount.rb +30 -9
- data/lib/meshtastic/portnums.rb +18 -8
- data/lib/meshtastic/position.rb +45 -0
- data/lib/meshtastic/remote_hardware.rb +50 -9
- data/lib/meshtastic/rtttl.rb +26 -8
- data/lib/meshtastic/serial.rb +81 -70
- data/lib/meshtastic/storeforward.rb +23 -8
- data/lib/meshtastic/stream_interface.rb +11 -0
- data/lib/meshtastic/tcp.rb +153 -0
- data/lib/meshtastic/telemetry.rb +27 -9
- data/lib/meshtastic/traceroute.rb +42 -0
- data/lib/meshtastic/util.rb +3 -1
- data/lib/meshtastic/version.rb +1 -1
- data/lib/meshtastic/xmodem.rb +17 -8
- data/lib/meshtastic.rb +46 -6
- data/spec/conventions_spec.rb +321 -0
- data/spec/lib/meshtastic/admin/channel_spec.rb +45 -0
- data/spec/lib/meshtastic/admin/config_spec.rb +48 -0
- data/spec/lib/meshtastic/admin/firmware_spec.rb +118 -0
- data/spec/lib/meshtastic/admin_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/admin_spec.rb +79 -0
- data/spec/lib/meshtastic/apponly_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/apponly_spec.rb +4 -0
- data/spec/lib/meshtastic/atak_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/atak_spec.rb +147 -0
- data/spec/lib/meshtastic/bluetooth_spec.rb +1 -1
- data/spec/lib/meshtastic/cannedmessages_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/cannedmessages_spec.rb +3 -0
- data/spec/lib/meshtastic/channel_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/channel_spec.rb +3 -0
- data/spec/lib/meshtastic/clientonly_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/clientonly_spec.rb +5 -0
- data/spec/lib/meshtastic/config_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/config_spec.rb +4 -1
- data/spec/lib/meshtastic/connection_status_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/connection_status_spec.rb +3 -0
- data/spec/lib/meshtastic/deviceonly_legacy_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/deviceonly_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/deviceonly_spec.rb +3 -0
- data/spec/lib/meshtastic/localonly_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/localonly_spec.rb +3 -0
- data/spec/lib/meshtastic/mesh_beacon_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/mesh_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/module_config_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/module_config_spec.rb +21 -0
- data/spec/lib/meshtastic/mqtt_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/paxcount_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/paxcount_spec.rb +23 -0
- data/spec/lib/meshtastic/portnums_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/portnums_spec.rb +4 -0
- data/spec/lib/meshtastic/position_spec.rb +33 -0
- data/spec/lib/meshtastic/remote_hardware_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/remote_hardware_spec.rb +24 -0
- data/spec/lib/meshtastic/rtttl_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/rtttl_spec.rb +21 -0
- data/spec/lib/meshtastic/storeforward_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/storeforward_spec.rb +21 -0
- data/spec/lib/meshtastic/tcp_spec.rb +48 -0
- data/spec/lib/meshtastic/telemetry_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/telemetry_spec.rb +21 -0
- data/spec/lib/meshtastic/traceroute_spec.rb +27 -0
- data/spec/lib/meshtastic/xmodem_pb_spec.rb +1 -1
- data/spec/lib/meshtastic/xmodem_spec.rb +6 -1
- data/spec/lib/meshtastic_spec.rb +3 -0
- metadata +48 -1
data/lib/meshtastic/channel.rb
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
# Protobuf class Meshtastic::Channel lives in channel_pb.
|
|
4
|
+
# Admin get/set API: Meshtastic::Admin::Channel
|
|
3
5
|
require 'meshtastic/channel_pb'
|
|
4
|
-
|
|
5
|
-
# Plugin used to interact with Meshtastic nodes
|
|
6
|
-
module Meshtastic
|
|
7
|
-
module Channel
|
|
8
|
-
# Author(s):: 0day Inc. <support@0dayinc.com>
|
|
9
|
-
|
|
10
|
-
public_class_method def self.authors
|
|
11
|
-
"AUTHOR(S):
|
|
12
|
-
0day Inc. <support@0dayinc.com>
|
|
13
|
-
"
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Display Usage for this Module
|
|
17
|
-
|
|
18
|
-
public_class_method def self.help
|
|
19
|
-
puts "USAGE:
|
|
20
|
-
#{self}.authors
|
|
21
|
-
"
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
6
|
+
require 'meshtastic/admin/channel'
|
|
@@ -2,22 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
require 'meshtastic/clientonly_pb'
|
|
4
4
|
|
|
5
|
-
# Plugin used to interact with Meshtastic nodes
|
|
6
5
|
module Meshtastic
|
|
7
6
|
module Clientonly
|
|
8
|
-
|
|
7
|
+
public_class_method def self.encode(opts = {})
|
|
8
|
+
profile = Meshtastic::DeviceProfile.new
|
|
9
|
+
profile.long_name = opts[:long_name].to_s if opts[:long_name]
|
|
10
|
+
profile.short_name = opts[:short_name].to_s if opts[:short_name]
|
|
11
|
+
profile
|
|
12
|
+
end
|
|
9
13
|
|
|
10
|
-
public_class_method def self.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
+
public_class_method def self.decode(opts = {})
|
|
15
|
+
bytes = opts[:bytes]
|
|
16
|
+
Meshtastic::DeviceProfile.decode(bytes)
|
|
14
17
|
end
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
public_class_method def self.authors
|
|
20
|
+
"AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
|
|
21
|
+
end
|
|
17
22
|
|
|
18
23
|
public_class_method def self.help
|
|
19
|
-
puts "USAGE:
|
|
24
|
+
puts " USAGE:
|
|
25
|
+
# Run the encode class method for this module.
|
|
26
|
+
#{self}.encode(
|
|
27
|
+
long_name: 'optional - value for long_name passed into encode',
|
|
28
|
+
short_name: 'optional - value for short_name passed into encode'
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# Run the decode class method for this module.
|
|
32
|
+
#{self}.decode(
|
|
33
|
+
bytes: 'optional - value for bytes passed into decode'
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
# Run the authors class method for this module.
|
|
20
37
|
#{self}.authors
|
|
38
|
+
|
|
21
39
|
"
|
|
22
40
|
end
|
|
23
41
|
end
|
data/lib/meshtastic/config.rb
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
# Protobuf class Meshtastic::Config lives in config_pb.
|
|
4
|
+
# Admin get/set API: Meshtastic::Admin::Config
|
|
3
5
|
require 'meshtastic/config_pb'
|
|
4
|
-
|
|
5
|
-
# Plugin used to interact with Meshtastic nodes
|
|
6
|
-
module Meshtastic
|
|
7
|
-
module Config
|
|
8
|
-
# Author(s):: 0day Inc. <support@0dayinc.com>
|
|
9
|
-
|
|
10
|
-
public_class_method def self.authors
|
|
11
|
-
"AUTHOR(S):
|
|
12
|
-
0day Inc. <support@0dayinc.com>
|
|
13
|
-
"
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Display Usage for this Module
|
|
17
|
-
|
|
18
|
-
public_class_method def self.help
|
|
19
|
-
puts "USAGE:
|
|
20
|
-
#{self}.authors
|
|
21
|
-
"
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
6
|
+
require 'meshtastic/admin/config'
|
|
@@ -2,22 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
require 'meshtastic/connection_status_pb'
|
|
4
4
|
|
|
5
|
-
# Plugin used to interact with Meshtastic nodes
|
|
6
5
|
module Meshtastic
|
|
7
6
|
module ConnectionStatus
|
|
8
|
-
|
|
7
|
+
public_class_method def self.decode(opts = {})
|
|
8
|
+
bytes = opts[:bytes]
|
|
9
|
+
Meshtastic::DeviceConnectionStatus.decode(bytes)
|
|
10
|
+
end
|
|
9
11
|
|
|
10
12
|
public_class_method def self.authors
|
|
11
|
-
"AUTHOR(S)
|
|
12
|
-
0day Inc. <support@0dayinc.com>
|
|
13
|
-
"
|
|
13
|
+
"AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
# Display Usage for this Module
|
|
17
|
-
|
|
18
16
|
public_class_method def self.help
|
|
19
|
-
puts "USAGE:
|
|
17
|
+
puts " USAGE:
|
|
18
|
+
# Run the decode class method for this module.
|
|
19
|
+
#{self}.decode(
|
|
20
|
+
bytes: 'optional - value for bytes passed into decode'
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# Run the authors class method for this module.
|
|
20
24
|
#{self}.authors
|
|
25
|
+
|
|
21
26
|
"
|
|
22
27
|
end
|
|
23
28
|
end
|
|
@@ -2,22 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
require 'meshtastic/deviceonly_pb'
|
|
4
4
|
|
|
5
|
-
# Plugin used to interact with Meshtastic nodes
|
|
6
5
|
module Meshtastic
|
|
7
6
|
module Deviceonly
|
|
8
|
-
|
|
7
|
+
public_class_method def self.decode_state(opts = {})
|
|
8
|
+
bytes = opts[:bytes]
|
|
9
|
+
Meshtastic::DeviceState.decode(bytes)
|
|
10
|
+
end
|
|
9
11
|
|
|
10
|
-
public_class_method def self.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
12
|
+
public_class_method def self.decode_nodedb(opts = {})
|
|
13
|
+
bytes = opts[:bytes]
|
|
14
|
+
Meshtastic::NodeDatabase.decode(bytes)
|
|
14
15
|
end
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
public_class_method def self.authors
|
|
18
|
+
"AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
|
|
19
|
+
end
|
|
17
20
|
|
|
18
21
|
public_class_method def self.help
|
|
19
|
-
puts "USAGE:
|
|
22
|
+
puts " USAGE:
|
|
23
|
+
# Run the decode_state class method for this module.
|
|
24
|
+
#{self}.decode_state(
|
|
25
|
+
bytes: 'optional - value for bytes passed into decode_state'
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# Run the decode_nodedb class method for this module.
|
|
29
|
+
#{self}.decode_nodedb(
|
|
30
|
+
bytes: 'optional - value for bytes passed into decode_nodedb'
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
# Run the authors class method for this module.
|
|
20
34
|
#{self}.authors
|
|
35
|
+
|
|
21
36
|
"
|
|
22
37
|
end
|
|
23
38
|
end
|
data/lib/meshtastic/localonly.rb
CHANGED
|
@@ -2,22 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
require 'meshtastic/localonly_pb'
|
|
4
4
|
|
|
5
|
-
# Plugin used to interact with Meshtastic nodes
|
|
6
5
|
module Meshtastic
|
|
7
6
|
module Localonly
|
|
8
|
-
|
|
7
|
+
public_class_method def self.decode_config(opts = {})
|
|
8
|
+
bytes = opts[:bytes]
|
|
9
|
+
Meshtastic::LocalConfig.decode(bytes)
|
|
10
|
+
end
|
|
9
11
|
|
|
10
|
-
public_class_method def self.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
12
|
+
public_class_method def self.decode_module_config(opts = {})
|
|
13
|
+
bytes = opts[:bytes]
|
|
14
|
+
Meshtastic::LocalModuleConfig.decode(bytes)
|
|
14
15
|
end
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
public_class_method def self.authors
|
|
18
|
+
"AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
|
|
19
|
+
end
|
|
17
20
|
|
|
18
21
|
public_class_method def self.help
|
|
19
|
-
puts "USAGE:
|
|
22
|
+
puts " USAGE:
|
|
23
|
+
# Run the decode_config class method for this module.
|
|
24
|
+
#{self}.decode_config(
|
|
25
|
+
bytes: 'optional - value for bytes passed into decode_config'
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# Run the decode_module_config class method for this module.
|
|
29
|
+
#{self}.decode_module_config(
|
|
30
|
+
bytes: 'optional - value for bytes passed into decode_module_config'
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
# Run the authors class method for this module.
|
|
20
34
|
#{self}.authors
|
|
35
|
+
|
|
21
36
|
"
|
|
22
37
|
end
|
|
23
38
|
end
|
|
@@ -613,5 +613,16 @@ module Meshtastic
|
|
|
613
613
|
#{self}.authors
|
|
614
614
|
"
|
|
615
615
|
end
|
|
616
|
+
|
|
617
|
+
public_class_method def self.authors
|
|
618
|
+
"AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
|
|
619
|
+
end
|
|
620
|
+
|
|
621
|
+
public_class_method def self.help
|
|
622
|
+
puts "USAGE:
|
|
623
|
+
# Print the AUTHOR(S) string for this module.
|
|
624
|
+
#{self}.authors
|
|
625
|
+
"
|
|
626
|
+
end
|
|
616
627
|
end
|
|
617
628
|
end
|
|
@@ -2,22 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
require 'meshtastic/module_config_pb'
|
|
4
4
|
|
|
5
|
-
# Plugin used to interact with Meshtastic nodes
|
|
6
5
|
module Meshtastic
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
class ModuleConfig
|
|
7
|
+
public_class_method def self.get(opts = {})
|
|
8
|
+
Admin.send(opts.merge(get_module_config_request: opts.fetch(:module_config_type, :MQTT_CONFIG)))
|
|
9
|
+
end
|
|
9
10
|
|
|
10
|
-
public_class_method def self.
|
|
11
|
-
|
|
12
|
-
0day Inc. <support@0dayinc.com>
|
|
13
|
-
"
|
|
11
|
+
public_class_method def self.set(opts = {})
|
|
12
|
+
Admin.send(opts.merge(set_module_config: opts.fetch(:module_config)))
|
|
14
13
|
end
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
public_class_method def self.authors
|
|
16
|
+
"AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
|
|
17
|
+
end
|
|
17
18
|
|
|
18
19
|
public_class_method def self.help
|
|
19
|
-
puts "USAGE:
|
|
20
|
+
puts " USAGE:
|
|
21
|
+
# Run the get class method for this module.
|
|
22
|
+
#{self}.get
|
|
23
|
+
|
|
24
|
+
# Run the set class method for this module.
|
|
25
|
+
#{self}.set
|
|
26
|
+
|
|
27
|
+
# Run the authors class method for this module.
|
|
20
28
|
#{self}.authors
|
|
29
|
+
|
|
21
30
|
"
|
|
22
31
|
end
|
|
23
32
|
end
|
data/lib/meshtastic/mqtt.rb
CHANGED
|
@@ -280,6 +280,27 @@ module Meshtastic
|
|
|
280
280
|
raise e
|
|
281
281
|
end
|
|
282
282
|
|
|
283
|
+
public_class_method def self.send_data(opts = {})
|
|
284
|
+
mqtt_obj = opts[:mqtt_obj]
|
|
285
|
+
raise ArgumentError, 'mqtt_obj is required' unless mqtt_obj
|
|
286
|
+
raise ArgumentError, 'data is required' unless opts[:data].is_a?(Meshtastic::Data)
|
|
287
|
+
|
|
288
|
+
opts = opts.dup
|
|
289
|
+
opts[:from] ||= mqtt_obj.client_id
|
|
290
|
+
opts[:to] ||= '!ffffffff'
|
|
291
|
+
opts[:root_topic] ||= 'msh'
|
|
292
|
+
opts[:region] ||= 'US'
|
|
293
|
+
opts[:topic] ||= '2/e/LongFast/#'
|
|
294
|
+
opts[:topic] = opts[:topic].to_s.gsub('/#', '')
|
|
295
|
+
opts[:channel] ||= 6
|
|
296
|
+
absolute_topic = "#{opts[:root_topic]}/#{opts[:region]}/#{opts[:topic]}/#{opts[:from]}"
|
|
297
|
+
opts[:topic] = absolute_topic
|
|
298
|
+
opts[:via] = :mqtt
|
|
299
|
+
mqtt_obj.publish(absolute_topic, Meshtastic::MeshInterface.new.send_data(opts))
|
|
300
|
+
rescue StandardError => e
|
|
301
|
+
raise e
|
|
302
|
+
end
|
|
303
|
+
|
|
283
304
|
# Supported Method Parameters::
|
|
284
305
|
# mqtt_obj = Meshtastic.disconnect(
|
|
285
306
|
# mqtt_obj: 'required - mqtt_obj returned from #connect method'
|
|
@@ -304,52 +325,68 @@ module Meshtastic
|
|
|
304
325
|
# Display Usage for this Module
|
|
305
326
|
|
|
306
327
|
public_class_method def self.help
|
|
307
|
-
puts "USAGE:
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
328
|
+
puts " USAGE:
|
|
329
|
+
# Run the connect class method for this module.
|
|
330
|
+
#{self}.connect(
|
|
331
|
+
host: 'optional - value for host passed into connect',
|
|
332
|
+
port: 'optional - value for port passed into connect',
|
|
333
|
+
tls: 'optional - value for tls passed into connect',
|
|
334
|
+
username: 'optional - value for username passed into connect',
|
|
335
|
+
password: 'optional - value for password passed into connect',
|
|
336
|
+
client_id: 'optional - value for client_id passed into connect',
|
|
337
|
+
keep_alive: 'optional - value for keep_alive passed into connect',
|
|
338
|
+
ack_timeout: 'optional - value for ack_timeout passed into connect'
|
|
317
339
|
)
|
|
318
340
|
|
|
341
|
+
# Run the subscribe class method for this module.
|
|
319
342
|
#{self}.subscribe(
|
|
320
|
-
mqtt_obj: '
|
|
321
|
-
root_topic: 'optional -
|
|
322
|
-
region: 'optional -
|
|
323
|
-
topic: 'optional -
|
|
324
|
-
psks: 'optional -
|
|
325
|
-
qos: 'optional -
|
|
326
|
-
json: 'optional -
|
|
327
|
-
exclude: 'optional -
|
|
328
|
-
include: 'optional -
|
|
329
|
-
gps_metadata: 'optional -
|
|
343
|
+
mqtt_obj: 'optional - value for mqtt_obj passed into subscribe',
|
|
344
|
+
root_topic: 'optional - value for root_topic passed into subscribe',
|
|
345
|
+
region: 'optional - value for region passed into subscribe',
|
|
346
|
+
topic: 'optional - value for topic passed into subscribe',
|
|
347
|
+
psks: 'optional - value for psks passed into subscribe',
|
|
348
|
+
qos: 'optional - value for qos passed into subscribe',
|
|
349
|
+
json: 'optional - value for json passed into subscribe',
|
|
350
|
+
exclude: 'optional - value for exclude passed into subscribe',
|
|
351
|
+
include: 'optional - value for include passed into subscribe',
|
|
352
|
+
gps_metadata: 'optional - value for gps_metadata passed into subscribe',
|
|
353
|
+
include_raw: 'optional - value for include_raw passed into subscribe'
|
|
330
354
|
)
|
|
331
355
|
|
|
356
|
+
# Run the send_text class method for this module.
|
|
332
357
|
#{self}.send_text(
|
|
333
|
-
mqtt_obj: '
|
|
334
|
-
from: '
|
|
335
|
-
to: 'optional -
|
|
336
|
-
root_topic: 'optional -
|
|
337
|
-
region: 'optional -
|
|
338
|
-
topic: 'optional -
|
|
339
|
-
channel: 'optional - channel
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
358
|
+
mqtt_obj: 'optional - value for mqtt_obj passed into send_text',
|
|
359
|
+
from: 'optional - value for from passed into send_text',
|
|
360
|
+
to: 'optional - value for to passed into send_text',
|
|
361
|
+
root_topic: 'optional - value for root_topic passed into send_text',
|
|
362
|
+
region: 'optional - value for region passed into send_text',
|
|
363
|
+
topic: 'optional - value for topic passed into send_text',
|
|
364
|
+
channel: 'optional - value for channel passed into send_text',
|
|
365
|
+
via: 'optional - value for via passed into send_text',
|
|
366
|
+
text: 'optional - value for text passed into send_text'
|
|
367
|
+
)
|
|
368
|
+
|
|
369
|
+
# Run the send_data class method for this module.
|
|
370
|
+
#{self}.send_data(
|
|
371
|
+
mqtt_obj: 'optional - value for mqtt_obj passed into send_data',
|
|
372
|
+
data: 'optional - value for data passed into send_data',
|
|
373
|
+
from: 'optional - value for from passed into send_data',
|
|
374
|
+
to: 'optional - value for to passed into send_data',
|
|
375
|
+
root_topic: 'optional - value for root_topic passed into send_data',
|
|
376
|
+
region: 'optional - value for region passed into send_data',
|
|
377
|
+
topic: 'optional - value for topic passed into send_data',
|
|
378
|
+
channel: 'optional - value for channel passed into send_data',
|
|
379
|
+
via: 'optional - value for via passed into send_data'
|
|
346
380
|
)
|
|
347
381
|
|
|
348
|
-
|
|
349
|
-
|
|
382
|
+
# Run the disconnect class method for this module.
|
|
383
|
+
#{self}.disconnect(
|
|
384
|
+
mqtt_obj: 'optional - value for mqtt_obj passed into disconnect'
|
|
350
385
|
)
|
|
351
386
|
|
|
387
|
+
# Run the authors class method for this module.
|
|
352
388
|
#{self}.authors
|
|
389
|
+
|
|
353
390
|
"
|
|
354
391
|
end
|
|
355
392
|
end
|
data/lib/meshtastic/paxcount.rb
CHANGED
|
@@ -2,22 +2,43 @@
|
|
|
2
2
|
|
|
3
3
|
require 'meshtastic/paxcount_pb'
|
|
4
4
|
|
|
5
|
-
# Plugin used to interact with Meshtastic nodes
|
|
6
5
|
module Meshtastic
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
class Paxcount
|
|
7
|
+
public_class_method def self.build(opts = {})
|
|
8
|
+
count = new
|
|
9
|
+
count.wifi = opts[:wifi].to_i if opts[:wifi]
|
|
10
|
+
count.ble = opts[:ble].to_i if opts[:ble]
|
|
11
|
+
count.uptime = opts[:uptime].to_i if opts[:uptime]
|
|
12
|
+
count
|
|
13
|
+
end
|
|
9
14
|
|
|
10
|
-
public_class_method def self.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
public_class_method def self.transmit(opts = {})
|
|
16
|
+
data = Meshtastic::Data.new(
|
|
17
|
+
portnum: :PAXCOUNTER_APP,
|
|
18
|
+
payload: build(opts).to_proto
|
|
19
|
+
)
|
|
20
|
+
Meshtastic.deliver_data(opts.merge(data: data, port_num: Meshtastic::PortNum::PAXCOUNTER_APP))
|
|
14
21
|
end
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
public_class_method def self.authors
|
|
24
|
+
"AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
|
|
25
|
+
end
|
|
17
26
|
|
|
18
27
|
public_class_method def self.help
|
|
19
|
-
puts "USAGE:
|
|
28
|
+
puts " USAGE:
|
|
29
|
+
# Run the build class method for this module.
|
|
30
|
+
#{self}.build(
|
|
31
|
+
wifi: 'optional - value for wifi passed into build',
|
|
32
|
+
ble: 'optional - value for ble passed into build',
|
|
33
|
+
uptime: 'optional - value for uptime passed into build'
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
# Run the transmit class method for this module.
|
|
37
|
+
#{self}.transmit
|
|
38
|
+
|
|
39
|
+
# Run the authors class method for this module.
|
|
20
40
|
#{self}.authors
|
|
41
|
+
|
|
21
42
|
"
|
|
22
43
|
end
|
|
23
44
|
end
|
data/lib/meshtastic/portnums.rb
CHANGED
|
@@ -2,22 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
require 'meshtastic/portnums_pb'
|
|
4
4
|
|
|
5
|
-
# Plugin used to interact with Meshtastic nodes
|
|
6
5
|
module Meshtastic
|
|
7
6
|
module Portnums
|
|
8
|
-
|
|
7
|
+
public_class_method def self.lookup(opts = {})
|
|
8
|
+
name_or_number = opts[:value] || opts[:name_or_number]
|
|
9
|
+
if name_or_number.is_a?(Integer)
|
|
10
|
+
Meshtastic::PortNum.lookup(name_or_number)
|
|
11
|
+
else
|
|
12
|
+
Meshtastic::PortNum.resolve(name_or_number.to_sym)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
9
15
|
|
|
10
16
|
public_class_method def self.authors
|
|
11
|
-
"AUTHOR(S)
|
|
12
|
-
0day Inc. <support@0dayinc.com>
|
|
13
|
-
"
|
|
17
|
+
"AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
|
|
14
18
|
end
|
|
15
19
|
|
|
16
|
-
# Display Usage for this Module
|
|
17
|
-
|
|
18
20
|
public_class_method def self.help
|
|
19
|
-
puts "USAGE:
|
|
21
|
+
puts " USAGE:
|
|
22
|
+
# Run the lookup class method for this module.
|
|
23
|
+
#{self}.lookup(
|
|
24
|
+
value: 'optional - value for value passed into lookup',
|
|
25
|
+
name_or_number: 'optional - value for name_or_number passed into lookup'
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# Run the authors class method for this module.
|
|
20
29
|
#{self}.authors
|
|
30
|
+
|
|
21
31
|
"
|
|
22
32
|
end
|
|
23
33
|
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'meshtastic/mesh_pb'
|
|
4
|
+
|
|
5
|
+
module Meshtastic
|
|
6
|
+
class Position
|
|
7
|
+
public_class_method def self.build(opts = {})
|
|
8
|
+
position = new
|
|
9
|
+
position.latitude_i = (opts.fetch(:lat).to_f * 10_000_000).round
|
|
10
|
+
position.longitude_i = (opts.fetch(:lon).to_f * 10_000_000).round
|
|
11
|
+
position.altitude = opts[:altitude].to_i if opts[:altitude]
|
|
12
|
+
position.time = opts[:time].to_i if opts[:time]
|
|
13
|
+
position
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
public_class_method def self.transmit(opts = {})
|
|
17
|
+
data = Meshtastic::Data.new(
|
|
18
|
+
portnum: :POSITION_APP,
|
|
19
|
+
payload: build(opts).to_proto
|
|
20
|
+
)
|
|
21
|
+
Meshtastic.deliver_data(opts.merge(data: data, port_num: Meshtastic::PortNum::POSITION_APP))
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
public_class_method def self.authors
|
|
25
|
+
"AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
public_class_method def self.help
|
|
29
|
+
puts " USAGE:
|
|
30
|
+
# Run the build class method for this module.
|
|
31
|
+
#{self}.build(
|
|
32
|
+
altitude: 'optional - value for altitude passed into build',
|
|
33
|
+
time: 'optional - value for time passed into build'
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
# Run the transmit class method for this module.
|
|
37
|
+
#{self}.transmit
|
|
38
|
+
|
|
39
|
+
# Run the authors class method for this module.
|
|
40
|
+
#{self}.authors
|
|
41
|
+
|
|
42
|
+
"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -1,23 +1,64 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'meshtastic/
|
|
3
|
+
require 'meshtastic/mesh_pb'
|
|
4
4
|
|
|
5
|
-
# Plugin used to interact with Meshtastic nodes
|
|
6
5
|
module Meshtastic
|
|
7
6
|
module RemoteHardware
|
|
8
|
-
|
|
7
|
+
public_class_method def self.encode(opts = {})
|
|
8
|
+
message = Meshtastic::HardwareMessage.new
|
|
9
|
+
message.type = opts.fetch(:type, :READ_GPIOS)
|
|
10
|
+
message.gpio_mask = opts.fetch(:gpio_mask, 0)
|
|
11
|
+
message.gpio_value = opts[:gpio_value].to_i if opts[:gpio_value]
|
|
12
|
+
message
|
|
13
|
+
end
|
|
9
14
|
|
|
10
|
-
public_class_method def self.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
public_class_method def self.send(opts = {})
|
|
16
|
+
data = Meshtastic::Data.new(
|
|
17
|
+
portnum: :REMOTE_HARDWARE_APP,
|
|
18
|
+
payload: encode(opts).to_proto,
|
|
19
|
+
want_response: opts.fetch(:want_response, true)
|
|
20
|
+
)
|
|
21
|
+
Meshtastic.deliver_data(opts.merge(data: data, port_num: Meshtastic::PortNum::REMOTE_HARDWARE_APP))
|
|
14
22
|
end
|
|
15
23
|
|
|
16
|
-
|
|
24
|
+
public_class_method def self.read_gpios(opts = {})
|
|
25
|
+
send(opts.merge(type: :READ_GPIOS))
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
public_class_method def self.write_gpios(opts = {})
|
|
29
|
+
send(opts.merge(type: :WRITE_GPIOS, want_response: false))
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
public_class_method def self.watch_gpios(opts = {})
|
|
33
|
+
send(opts.merge(type: :WATCH_GPIOS))
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
public_class_method def self.authors
|
|
37
|
+
"AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
|
|
38
|
+
end
|
|
17
39
|
|
|
18
40
|
public_class_method def self.help
|
|
19
|
-
puts "USAGE:
|
|
41
|
+
puts " USAGE:
|
|
42
|
+
# Run the encode class method for this module.
|
|
43
|
+
#{self}.encode(
|
|
44
|
+
gpio_value: 'optional - value for gpio_value passed into encode'
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
# Run the send class method for this module.
|
|
48
|
+
#{self}.send
|
|
49
|
+
|
|
50
|
+
# Run the read_gpios class method for this module.
|
|
51
|
+
#{self}.read_gpios
|
|
52
|
+
|
|
53
|
+
# Run the write_gpios class method for this module.
|
|
54
|
+
#{self}.write_gpios
|
|
55
|
+
|
|
56
|
+
# Run the watch_gpios class method for this module.
|
|
57
|
+
#{self}.watch_gpios
|
|
58
|
+
|
|
59
|
+
# Run the authors class method for this module.
|
|
20
60
|
#{self}.authors
|
|
61
|
+
|
|
21
62
|
"
|
|
22
63
|
end
|
|
23
64
|
end
|