meshtastic 0.0.178 → 0.0.179

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.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -175
  3. data/documentation/README.md +59 -0
  4. data/documentation/admin.md +54 -0
  5. data/documentation/apponly.md +22 -0
  6. data/documentation/atak.md +27 -0
  7. data/documentation/bluetooth-bluez.md +35 -0
  8. data/documentation/bluetooth.md +87 -0
  9. data/documentation/cannedmessages.md +25 -0
  10. data/documentation/channel.md +30 -0
  11. data/documentation/clientonly.md +21 -0
  12. data/documentation/config.md +29 -0
  13. data/documentation/connection-status.md +22 -0
  14. data/documentation/deviceonly.md +22 -0
  15. data/documentation/localonly.md +21 -0
  16. data/documentation/mesh-interface.md +52 -0
  17. data/documentation/meshtastic.md +45 -0
  18. data/documentation/module-config.md +26 -0
  19. data/documentation/mqtt.md +101 -0
  20. data/documentation/paxcount.md +25 -0
  21. data/documentation/portnums.md +67 -0
  22. data/documentation/position.md +34 -0
  23. data/documentation/protobufs.md +162 -0
  24. data/documentation/remote-hardware.md +33 -0
  25. data/documentation/rtttl.md +24 -0
  26. data/documentation/serial.md +78 -0
  27. data/documentation/storeforward.md +24 -0
  28. data/documentation/stream-interface.md +15 -0
  29. data/documentation/tcp.md +43 -0
  30. data/documentation/telemetry.md +32 -0
  31. data/documentation/traceroute.md +28 -0
  32. data/documentation/util.md +27 -0
  33. data/documentation/xmodem.md +22 -0
  34. data/lib/meshtastic/admin.rb +66 -8
  35. data/lib/meshtastic/apponly.rb +14 -8
  36. data/lib/meshtastic/atak.rb +21 -8
  37. data/lib/meshtastic/cannedmessages.rb +16 -8
  38. data/lib/meshtastic/channel.rb +13 -9
  39. data/lib/meshtastic/clientonly.rb +14 -8
  40. data/lib/meshtastic/config.rb +12 -9
  41. data/lib/meshtastic/connection_status.rb +7 -9
  42. data/lib/meshtastic/deviceonly.rb +11 -8
  43. data/lib/meshtastic/localonly.rb +11 -8
  44. data/lib/meshtastic/module_config.rb +12 -9
  45. data/lib/meshtastic/paxcount.rb +19 -9
  46. data/lib/meshtastic/portnums.rb +12 -9
  47. data/lib/meshtastic/position.rb +35 -0
  48. data/lib/meshtastic/remote_hardware.rb +34 -9
  49. data/lib/meshtastic/rtttl.rb +17 -8
  50. data/lib/meshtastic/storeforward.rb +16 -8
  51. data/lib/meshtastic/tcp.rb +102 -0
  52. data/lib/meshtastic/telemetry.rb +18 -9
  53. data/lib/meshtastic/traceroute.rb +33 -0
  54. data/lib/meshtastic/version.rb +1 -1
  55. data/lib/meshtastic/xmodem.rb +11 -9
  56. data/lib/meshtastic.rb +26 -5
  57. data/spec/lib/meshtastic/admin_pb_spec.rb +1 -1
  58. data/spec/lib/meshtastic/admin_spec.rb +39 -0
  59. data/spec/lib/meshtastic/apponly_pb_spec.rb +1 -1
  60. data/spec/lib/meshtastic/apponly_spec.rb +4 -0
  61. data/spec/lib/meshtastic/atak_pb_spec.rb +1 -1
  62. data/spec/lib/meshtastic/atak_spec.rb +22 -0
  63. data/spec/lib/meshtastic/cannedmessages_pb_spec.rb +1 -1
  64. data/spec/lib/meshtastic/cannedmessages_spec.rb +3 -0
  65. data/spec/lib/meshtastic/channel_pb_spec.rb +1 -1
  66. data/spec/lib/meshtastic/channel_spec.rb +21 -0
  67. data/spec/lib/meshtastic/clientonly_pb_spec.rb +1 -1
  68. data/spec/lib/meshtastic/clientonly_spec.rb +5 -0
  69. data/spec/lib/meshtastic/config_pb_spec.rb +1 -1
  70. data/spec/lib/meshtastic/config_spec.rb +22 -1
  71. data/spec/lib/meshtastic/connection_status_pb_spec.rb +1 -1
  72. data/spec/lib/meshtastic/connection_status_spec.rb +3 -0
  73. data/spec/lib/meshtastic/deviceonly_legacy_pb_spec.rb +1 -1
  74. data/spec/lib/meshtastic/deviceonly_pb_spec.rb +1 -1
  75. data/spec/lib/meshtastic/deviceonly_spec.rb +3 -0
  76. data/spec/lib/meshtastic/localonly_pb_spec.rb +1 -1
  77. data/spec/lib/meshtastic/localonly_spec.rb +3 -0
  78. data/spec/lib/meshtastic/mesh_beacon_pb_spec.rb +1 -1
  79. data/spec/lib/meshtastic/mesh_pb_spec.rb +1 -1
  80. data/spec/lib/meshtastic/module_config_pb_spec.rb +1 -1
  81. data/spec/lib/meshtastic/module_config_spec.rb +21 -0
  82. data/spec/lib/meshtastic/mqtt_pb_spec.rb +1 -1
  83. data/spec/lib/meshtastic/paxcount_pb_spec.rb +1 -1
  84. data/spec/lib/meshtastic/paxcount_spec.rb +23 -0
  85. data/spec/lib/meshtastic/portnums_pb_spec.rb +1 -1
  86. data/spec/lib/meshtastic/portnums_spec.rb +4 -0
  87. data/spec/lib/meshtastic/position_spec.rb +33 -0
  88. data/spec/lib/meshtastic/remote_hardware_pb_spec.rb +1 -1
  89. data/spec/lib/meshtastic/remote_hardware_spec.rb +24 -0
  90. data/spec/lib/meshtastic/rtttl_pb_spec.rb +1 -1
  91. data/spec/lib/meshtastic/rtttl_spec.rb +21 -0
  92. data/spec/lib/meshtastic/storeforward_pb_spec.rb +1 -1
  93. data/spec/lib/meshtastic/storeforward_spec.rb +21 -0
  94. data/spec/lib/meshtastic/tcp_spec.rb +48 -0
  95. data/spec/lib/meshtastic/telemetry_pb_spec.rb +1 -1
  96. data/spec/lib/meshtastic/telemetry_spec.rb +21 -0
  97. data/spec/lib/meshtastic/traceroute_spec.rb +27 -0
  98. data/spec/lib/meshtastic/xmodem_pb_spec.rb +1 -1
  99. data/spec/lib/meshtastic/xmodem_spec.rb +6 -1
  100. data/spec/lib/meshtastic_spec.rb +3 -0
  101. metadata +38 -1
@@ -0,0 +1,15 @@
1
+ # Meshtastic::StreamInterface
2
+
3
+ Abstract UART helper left from the Python client layout. Instantiating it raises unless a subclass sets `@stream` (or `no_proto: true`).
4
+
5
+ Use [Meshtastic::Serial](serial.md) for USB/UART.
6
+
7
+ ```ruby
8
+ # raises: StreamInterface is now abstract (to update existing code use Meshtastic::Serial instead)
9
+ Meshtastic::StreamInterface.new
10
+ ```
11
+
12
+ ## Related
13
+
14
+ - [Meshtastic::Serial](serial.md)
15
+ - [Meshtastic::TCP](tcp.md)
@@ -0,0 +1,43 @@
1
+ # Meshtastic::TCP
2
+
3
+ Same framed Stream API as [Serial](serial.md), over TCP. Firmware default port is `4403`. Use `tcp_obj:` instead of `serial_obj:`. Internally reuses Serial’s RX thread and framing.
4
+
5
+ ## Methods
6
+
7
+ - `connect(host:, port:, socket:, want_config:, debug_out:)` — `host` default `127.0.0.1`, `port` default `4403`. `socket:` is for tests.
8
+ - `wait_for_config`
9
+ - `send_text` / `send_data` / `send_to_radio`
10
+ - `recv_from_radio` / `drain_from_radio`
11
+ - `subscribe`
12
+ - `disconnect`
13
+ - `help` / `authors`
14
+
15
+ ## Send / receive
16
+
17
+ ```ruby
18
+ require 'meshtastic'
19
+
20
+ tcp_obj = nil
21
+ begin
22
+ tcp_obj = Meshtastic::TCP.connect(host: '192.0.2.10', port: 4403)
23
+ Meshtastic::TCP.wait_for_config(tcp_obj: tcp_obj, timeout: 10)
24
+ Meshtastic::TCP.send_text(
25
+ tcp_obj: tcp_obj,
26
+ to: '!ffffffff',
27
+ channel: 0,
28
+ text: 'Hello over TCP!'
29
+ )
30
+ Meshtastic::TCP.subscribe(tcp_obj: tcp_obj, include: 'TEXT_MESSAGE_APP') do |message|
31
+ puts message.dig(:packet, :decoded, :payload)
32
+ end
33
+ ensure
34
+ Meshtastic::TCP.disconnect(tcp_obj: tcp_obj)
35
+ end
36
+ ```
37
+
38
+ Enable TCP in radio network settings. Feature modules accept `tcp_obj:` the same way as `serial_obj:`.
39
+
40
+ ## Related
41
+
42
+ - [Meshtastic::Serial](serial.md)
43
+ - [Meshtastic::Admin](admin.md)
@@ -0,0 +1,32 @@
1
+ # Meshtastic::Telemetry
2
+
3
+ Reopens the generated `Meshtastic::Telemetry` protobuf class. Requests metrics on `TELEMETRY_APP` (port 67) with `want_response: true`.
4
+
5
+ Use `build` / `request`, not `send` / `encode`.
6
+
7
+ ## Methods
8
+
9
+ - `build(time:)`
10
+ - `request(serial_obj:, to:, ...)`
11
+ - `help` / `authors`
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ Meshtastic::Telemetry.request(
17
+ serial_obj: serial_obj,
18
+ to: '!aabbccdd'
19
+ )
20
+
21
+ Meshtastic::Serial.subscribe(serial_obj: serial_obj, include: 'TELEMETRY_APP') do |message|
22
+ tel = Meshtastic::Telemetry.decode(message.dig(:packet, :decoded, :payload).to_s) rescue nil
23
+ p tel&.device_metrics
24
+ end
25
+ ```
26
+
27
+ Incoming payloads may include `device_metrics`, `environment_metrics`, `air_quality_metrics`, `power_metrics`, `local_stats`, `health_metrics`, `host_metrics`, `traffic_management_stats`, `soil_water_metrics`.
28
+
29
+ ## Related
30
+
31
+ - [Meshtastic::Position](position.md)
32
+ - [Meshtastic::Paxcount](paxcount.md)
@@ -0,0 +1,28 @@
1
+ # Meshtastic::Traceroute
2
+
3
+ Sends `RouteDiscovery` on `TRACEROUTE_APP` (port 70) with `want_response: true`.
4
+
5
+ ## Methods
6
+
7
+ - `encode(route:)` — optional hop list
8
+ - `send(serial_obj:, to:, ...)`
9
+ - `help` / `authors`
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ Meshtastic::Traceroute.send(
15
+ serial_obj: serial_obj,
16
+ to: '!aabbccdd',
17
+ want_ack: true
18
+ )
19
+
20
+ Meshtastic::Serial.subscribe(serial_obj: serial_obj, include: 'TRACEROUTE_APP') do |message|
21
+ p message.dig(:packet, :decoded)
22
+ end
23
+ ```
24
+
25
+ ## Related
26
+
27
+ - [Meshtastic::Serial](serial.md)
28
+ - Protobuf: `RouteDiscovery`, `Routing` in [protobufs.md](protobufs.md)
@@ -0,0 +1,27 @@
1
+ # Meshtastic::Util
2
+
3
+ Small helpers used by [MeshInterface](mesh-interface.md).
4
+
5
+ ## `Meshtastic::Util::Acknowledgement`
6
+
7
+ Flags: `received_ack`, `received_nak`, `received_impl_ack`, `received_trace_route`, `received_telemetry`, `received_position`, `received_waypoint`. `#reset` clears them.
8
+
9
+ ## `Meshtastic::Util::Timeout`
10
+
11
+ `expire_timeout` (default 20 seconds), `expire_time`, `sleep_interval` (0.1). `#reset` sets `expire_time` from now.
12
+
13
+ ## Module methods
14
+
15
+ - `authors` / `help`
16
+
17
+ ```ruby
18
+ ack = Meshtastic::Util::Acknowledgement.new
19
+ ack.reset
20
+
21
+ t = Meshtastic::Util::Timeout.new(expire_timeout: 10)
22
+ t.reset
23
+ ```
24
+
25
+ ## Related
26
+
27
+ - [Meshtastic::MeshInterface](mesh-interface.md)
@@ -0,0 +1,22 @@
1
+ # Meshtastic::Xmodem
2
+
3
+ Builds `Meshtastic::XModem` packets (`xmodem.proto`). Distinct from the generated class `Meshtastic::XModem`.
4
+
5
+ ## Methods
6
+
7
+ - `encode(control:, seq:, buffer:)`
8
+ - `help` / `authors`
9
+
10
+ `control` includes `:SOH` and other `XModem::Control` values.
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ packet = Meshtastic::Xmodem.encode(control: :SOH, seq: 1, buffer: 'A')
16
+ packet.control # => :SOH
17
+ packet.seq # => 1
18
+ ```
19
+
20
+ ## Related
21
+
22
+ - [Generated protobuf types](protobufs.md)
@@ -2,21 +2,79 @@
2
2
 
3
3
  require 'meshtastic/admin_pb'
4
4
 
5
- # Plugin used to interact with Meshtastic nodes
6
5
  module Meshtastic
7
6
  module Admin
8
- # Author(s):: 0day Inc. <support@0dayinc.com>
7
+ def self.encode(opts = {})
8
+ message = opts[:message] || Meshtastic::AdminMessage.new
9
+ opts.each do |key, value|
10
+ next if %i[message serial_obj bluetooth_obj tcp_obj to from channel want_ack hop_limit].include?(key)
11
+ next unless message.respond_to?("#{key}=")
9
12
 
10
- public_class_method def self.authors
11
- "AUTHOR(S):
12
- 0day Inc. <support@0dayinc.com>
13
- "
13
+ message.public_send("#{key}=", value)
14
+ end
15
+ message
16
+ end
17
+
18
+ def self.send(opts = {})
19
+ message = encode(opts)
20
+ data = Meshtastic::Data.new(
21
+ portnum: :ADMIN_APP,
22
+ payload: message.to_proto,
23
+ want_response: opts.fetch(:want_response, true)
24
+ )
25
+ Meshtastic.deliver_data(opts.merge(data: data, port_num: Meshtastic::PortNum::ADMIN_APP))
26
+ end
27
+
28
+ def self.reboot(opts = {})
29
+ send(opts.merge(reboot_seconds: opts.fetch(:seconds, 5)))
30
+ end
31
+
32
+ def self.shutdown(opts = {})
33
+ send(opts.merge(shutdown_seconds: opts.fetch(:seconds, 5)))
34
+ end
35
+
36
+ def self.set_owner(opts = {})
37
+ user = opts[:owner] || Meshtastic::User.new(long_name: opts[:long_name], short_name: opts[:short_name])
38
+ send(opts.merge(set_owner: user))
39
+ end
40
+
41
+ def self.get_owner(opts = {})
42
+ send(opts.merge(get_owner_request: true))
14
43
  end
15
44
 
16
- # Display Usage for this Module
45
+ def self.set_channel(opts = {})
46
+ send(opts.merge(set_channel: opts.fetch(:channel_settings)))
47
+ end
48
+
49
+ def self.get_channel(opts = {})
50
+ send(opts.merge(get_channel_request: opts.fetch(:index, 0)))
51
+ end
52
+
53
+ def self.get_config(opts = {})
54
+ send(opts.merge(get_config_request: opts.fetch(:config_type, :DEVICE_CONFIG)))
55
+ end
56
+
57
+ def self.set_config(opts = {})
58
+ send(opts.merge(set_config: opts.fetch(:config)))
59
+ end
60
+
61
+ def self.nodedb_reset(opts = {})
62
+ send(opts.merge(nodedb_reset: true))
63
+ end
64
+
65
+ def self.authors
66
+ "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
67
+ end
17
68
 
18
- public_class_method def self.help
69
+ def self.help
19
70
  puts "USAGE:
71
+ #{self}.reboot(serial_obj: serial_obj, seconds: 5)
72
+ #{self}.shutdown(serial_obj: serial_obj, seconds: 5)
73
+ #{self}.get_owner(serial_obj: serial_obj)
74
+ #{self}.set_owner(serial_obj: serial_obj, long_name: 'Node', short_name: 'N1')
75
+ #{self}.get_channel(serial_obj: serial_obj, index: 0)
76
+ #{self}.get_config(serial_obj: serial_obj, config_type: :LORA_CONFIG)
77
+ #{self}.nodedb_reset(serial_obj: serial_obj)
20
78
  #{self}.authors
21
79
  "
22
80
  end
@@ -2,21 +2,27 @@
2
2
 
3
3
  require 'meshtastic/apponly_pb'
4
4
 
5
- # Plugin used to interact with Meshtastic nodes
6
5
  module Meshtastic
7
6
  module Apponly
8
- # Author(s):: 0day Inc. <support@0dayinc.com>
7
+ def self.encode(opts = {})
8
+ set = Meshtastic::ChannelSet.new
9
+ Array(opts[:settings]).each { |channel| set.settings << channel }
10
+ set.lora_config = opts[:lora_config] if opts[:lora_config]
11
+ set
12
+ end
9
13
 
10
- public_class_method def self.authors
11
- "AUTHOR(S):
12
- 0day Inc. <support@0dayinc.com>
13
- "
14
+ def self.decode(bytes)
15
+ Meshtastic::ChannelSet.decode(bytes)
14
16
  end
15
17
 
16
- # Display Usage for this Module
18
+ def self.authors
19
+ "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
20
+ end
17
21
 
18
- public_class_method def self.help
22
+ def self.help
19
23
  puts "USAGE:
24
+ #{self}.encode(settings: [Meshtastic::ChannelSettings.new])
25
+ #{self}.decode(bytes)
20
26
  #{self}.authors
21
27
  "
22
28
  end
@@ -2,21 +2,34 @@
2
2
 
3
3
  require 'meshtastic/atak_pb'
4
4
 
5
- # Plugin used to interact with Meshtastic nodes
6
5
  module Meshtastic
7
6
  module ATAK
8
- # Author(s):: 0day Inc. <support@0dayinc.com>
7
+ def self.encode(opts = {})
8
+ packet = Meshtastic::TAKPacket.new
9
+ packet.is_compressed = opts.fetch(:is_compressed, false)
10
+ if opts[:chat]
11
+ packet.chat = opts[:chat]
12
+ elsif opts[:message]
13
+ packet.chat = Meshtastic::GeoChat.new(message: opts[:message])
14
+ end
15
+ packet
16
+ end
9
17
 
10
- public_class_method def self.authors
11
- "AUTHOR(S):
12
- 0day Inc. <support@0dayinc.com>
13
- "
18
+ def self.send(opts = {})
19
+ data = Meshtastic::Data.new(
20
+ portnum: :ATAK_PLUGIN,
21
+ payload: encode(opts).to_proto
22
+ )
23
+ Meshtastic.deliver_data(opts.merge(data: data, port_num: Meshtastic::PortNum::ATAK_PLUGIN))
14
24
  end
15
25
 
16
- # Display Usage for this Module
26
+ def self.authors
27
+ "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
28
+ end
17
29
 
18
- public_class_method def self.help
30
+ def self.help
19
31
  puts "USAGE:
32
+ #{self}.send(serial_obj: serial_obj, message: 'ATAK chat')
20
33
  #{self}.authors
21
34
  "
22
35
  end
@@ -2,21 +2,29 @@
2
2
 
3
3
  require 'meshtastic/cannedmessages_pb'
4
4
 
5
- # Plugin used to interact with Meshtastic nodes
6
5
  module Meshtastic
7
6
  module Cannedmessages
8
- # Author(s):: 0day Inc. <support@0dayinc.com>
7
+ def self.encode(opts = {})
8
+ config = Meshtastic::CannedMessageModuleConfig.new
9
+ config.messages = opts.fetch(:messages, '')
10
+ config
11
+ end
9
12
 
10
- public_class_method def self.authors
11
- "AUTHOR(S):
12
- 0day Inc. <support@0dayinc.com>
13
- "
13
+ def self.send(opts = {})
14
+ data = Meshtastic::Data.new(
15
+ portnum: :TEXT_MESSAGE_APP,
16
+ payload: encode(opts).messages.to_s.b
17
+ )
18
+ Meshtastic.deliver_data(opts.merge(data: data, port_num: Meshtastic::PortNum::TEXT_MESSAGE_APP))
14
19
  end
15
20
 
16
- # Display Usage for this Module
21
+ def self.authors
22
+ "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
23
+ end
17
24
 
18
- public_class_method def self.help
25
+ def self.help
19
26
  puts "USAGE:
27
+ #{self}.encode(messages: \"Yes\\nNo\\nMaybe\")
20
28
  #{self}.authors
21
29
  "
22
30
  end
@@ -2,21 +2,25 @@
2
2
 
3
3
  require 'meshtastic/channel_pb'
4
4
 
5
- # Plugin used to interact with Meshtastic nodes
6
5
  module Meshtastic
7
- module Channel
8
- # Author(s):: 0day Inc. <support@0dayinc.com>
6
+ class Channel
7
+ def self.get(opts = {})
8
+ Admin.get_channel(opts)
9
+ end
9
10
 
10
- public_class_method def self.authors
11
- "AUTHOR(S):
12
- 0day Inc. <support@0dayinc.com>
13
- "
11
+ def self.set(opts = {})
12
+ channel = opts[:channel] || opts[:channel_settings] || new
13
+ Admin.set_channel(opts.merge(channel_settings: channel))
14
14
  end
15
15
 
16
- # Display Usage for this Module
16
+ def self.authors
17
+ "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
18
+ end
17
19
 
18
- public_class_method def self.help
20
+ def self.help
19
21
  puts "USAGE:
22
+ #{self}.get(serial_obj: serial_obj, index: 0)
23
+ #{self}.set(serial_obj: serial_obj, channel: #{self}.new)
20
24
  #{self}.authors
21
25
  "
22
26
  end
@@ -2,21 +2,27 @@
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
- # Author(s):: 0day Inc. <support@0dayinc.com>
7
+ 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.authors
11
- "AUTHOR(S):
12
- 0day Inc. <support@0dayinc.com>
13
- "
14
+ def self.decode(bytes)
15
+ Meshtastic::DeviceProfile.decode(bytes)
14
16
  end
15
17
 
16
- # Display Usage for this Module
18
+ def self.authors
19
+ "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
20
+ end
17
21
 
18
- public_class_method def self.help
22
+ def self.help
19
23
  puts "USAGE:
24
+ #{self}.encode(long_name: 'Node', short_name: 'N1')
25
+ #{self}.decode(bytes)
20
26
  #{self}.authors
21
27
  "
22
28
  end
@@ -2,21 +2,24 @@
2
2
 
3
3
  require 'meshtastic/config_pb'
4
4
 
5
- # Plugin used to interact with Meshtastic nodes
6
5
  module Meshtastic
7
- module Config
8
- # Author(s):: 0day Inc. <support@0dayinc.com>
6
+ class Config
7
+ def self.get(opts = {})
8
+ Admin.get_config(opts)
9
+ end
9
10
 
10
- public_class_method def self.authors
11
- "AUTHOR(S):
12
- 0day Inc. <support@0dayinc.com>
13
- "
11
+ def self.set(opts = {})
12
+ Admin.set_config(opts.merge(config: opts.fetch(:config)))
14
13
  end
15
14
 
16
- # Display Usage for this Module
15
+ def self.authors
16
+ "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
17
+ end
17
18
 
18
- public_class_method def self.help
19
+ def self.help
19
20
  puts "USAGE:
21
+ #{self}.get(serial_obj: serial_obj, config_type: :LORA_CONFIG)
22
+ #{self}.set(serial_obj: serial_obj, config: #{self}.new)
20
23
  #{self}.authors
21
24
  "
22
25
  end
@@ -2,21 +2,19 @@
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
- # 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
- "
7
+ def self.decode(bytes)
8
+ Meshtastic::DeviceConnectionStatus.decode(bytes)
14
9
  end
15
10
 
16
- # Display Usage for this Module
11
+ def self.authors
12
+ "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
13
+ end
17
14
 
18
- public_class_method def self.help
15
+ def self.help
19
16
  puts "USAGE:
17
+ #{self}.decode(bytes)
20
18
  #{self}.authors
21
19
  "
22
20
  end
@@ -2,21 +2,24 @@
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
- # Author(s):: 0day Inc. <support@0dayinc.com>
7
+ def self.decode_state(bytes)
8
+ Meshtastic::DeviceState.decode(bytes)
9
+ end
9
10
 
10
- public_class_method def self.authors
11
- "AUTHOR(S):
12
- 0day Inc. <support@0dayinc.com>
13
- "
11
+ def self.decode_nodedb(bytes)
12
+ Meshtastic::NodeDatabase.decode(bytes)
14
13
  end
15
14
 
16
- # Display Usage for this Module
15
+ def self.authors
16
+ "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
17
+ end
17
18
 
18
- public_class_method def self.help
19
+ def self.help
19
20
  puts "USAGE:
21
+ #{self}.decode_state(bytes)
22
+ #{self}.decode_nodedb(bytes)
20
23
  #{self}.authors
21
24
  "
22
25
  end
@@ -2,21 +2,24 @@
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
- # Author(s):: 0day Inc. <support@0dayinc.com>
7
+ def self.decode_config(bytes)
8
+ Meshtastic::LocalConfig.decode(bytes)
9
+ end
9
10
 
10
- public_class_method def self.authors
11
- "AUTHOR(S):
12
- 0day Inc. <support@0dayinc.com>
13
- "
11
+ def self.decode_module_config(bytes)
12
+ Meshtastic::LocalModuleConfig.decode(bytes)
14
13
  end
15
14
 
16
- # Display Usage for this Module
15
+ def self.authors
16
+ "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
17
+ end
17
18
 
18
- public_class_method def self.help
19
+ def self.help
19
20
  puts "USAGE:
21
+ #{self}.decode_config(bytes)
22
+ #{self}.decode_module_config(bytes)
20
23
  #{self}.authors
21
24
  "
22
25
  end
@@ -2,21 +2,24 @@
2
2
 
3
3
  require 'meshtastic/module_config_pb'
4
4
 
5
- # Plugin used to interact with Meshtastic nodes
6
5
  module Meshtastic
7
- module ModuleConfig
8
- # Author(s):: 0day Inc. <support@0dayinc.com>
6
+ class ModuleConfig
7
+ 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.authors
11
- "AUTHOR(S):
12
- 0day Inc. <support@0dayinc.com>
13
- "
11
+ def self.set(opts = {})
12
+ Admin.send(opts.merge(set_module_config: opts.fetch(:module_config)))
14
13
  end
15
14
 
16
- # Display Usage for this Module
15
+ def self.authors
16
+ "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
17
+ end
17
18
 
18
- public_class_method def self.help
19
+ def self.help
19
20
  puts "USAGE:
21
+ #{self}.get(serial_obj: serial_obj, module_config_type: :MQTT_CONFIG)
22
+ #{self}.set(serial_obj: serial_obj, module_config: #{self}.new)
20
23
  #{self}.authors
21
24
  "
22
25
  end
@@ -2,21 +2,31 @@
2
2
 
3
3
  require 'meshtastic/paxcount_pb'
4
4
 
5
- # Plugin used to interact with Meshtastic nodes
6
5
  module Meshtastic
7
- module Paxcount
8
- # Author(s):: 0day Inc. <support@0dayinc.com>
6
+ class Paxcount
7
+ 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.authors
11
- "AUTHOR(S):
12
- 0day Inc. <support@0dayinc.com>
13
- "
15
+ 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
- # Display Usage for this Module
23
+ def self.authors
24
+ "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n "
25
+ end
17
26
 
18
- public_class_method def self.help
27
+ def self.help
19
28
  puts "USAGE:
29
+ #{self}.transmit(serial_obj: serial_obj, wifi: 3, ble: 2)
20
30
  #{self}.authors
21
31
  "
22
32
  end