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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'socket'
|
|
5
|
+
|
|
6
|
+
describe Meshtastic::TCP do
|
|
7
|
+
def with_tcp_link(opts = {})
|
|
8
|
+
local, remote = UNIXSocket.pair
|
|
9
|
+
tcp_obj = described_class.connect({ socket: local, host: '127.0.0.1', port: 4403, want_config: false }.merge(opts))
|
|
10
|
+
begin
|
|
11
|
+
yield tcp_obj, remote
|
|
12
|
+
ensure
|
|
13
|
+
described_class.disconnect(tcp_obj: tcp_obj)
|
|
14
|
+
remote.close unless remote.closed?
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def radio_frame(message)
|
|
19
|
+
body = message.to_proto
|
|
20
|
+
[Meshtastic::START1, Meshtastic::START2, body.bytesize].pack('CCn') + body
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'writes a decoded ToRadio mesh packet over TCP without MQTT encryption' do
|
|
24
|
+
with_tcp_link do |tcp_obj, remote|
|
|
25
|
+
described_class.send_text(tcp_obj: tcp_obj, text: 'ping', to: '!ffffffff', channel: 0)
|
|
26
|
+
expect(remote.read(32)).to eq(([Meshtastic::START2] * 32).pack('C*'))
|
|
27
|
+
header = remote.read(4)
|
|
28
|
+
packet = Meshtastic::ToRadio.decode(remote.read(header.unpack('CCn').last)).packet
|
|
29
|
+
expect(packet.decoded.payload).to eq('ping')
|
|
30
|
+
expect(packet.encrypted.to_s).to eq('')
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'receives a framed FromRadio over TCP' do
|
|
35
|
+
with_tcp_link do |tcp_obj, remote|
|
|
36
|
+
remote.read(32)
|
|
37
|
+
message = Meshtastic::FromRadio.new(packet: Meshtastic::MeshPacket.new(
|
|
38
|
+
from: 123, decoded: Meshtastic::Data.new(portnum: :TEXT_MESSAGE_APP, payload: 'hello')
|
|
39
|
+
))
|
|
40
|
+
remote.write(radio_frame(message))
|
|
41
|
+
expect(described_class.recv_from_radio(tcp_obj: tcp_obj, timeout: 1)).to eq(message)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'prints usage without raising' do
|
|
46
|
+
expect { described_class.help }.to output(/USAGE/).to_stdout
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -3,4 +3,25 @@
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
5
|
describe Meshtastic::Telemetry do
|
|
6
|
+
def fake_serial_obj
|
|
7
|
+
written = +''.b
|
|
8
|
+
serial_conn = Object.new
|
|
9
|
+
serial_conn.define_singleton_method(:write) do |b|
|
|
10
|
+
written << b
|
|
11
|
+
b.bytesize
|
|
12
|
+
end
|
|
13
|
+
serial_conn.define_singleton_method(:flush) { true }
|
|
14
|
+
serial_conn.define_singleton_method(:closed?) { false }
|
|
15
|
+
serial_conn.define_singleton_method(:close) { true }
|
|
16
|
+
{ serial_conn: serial_conn, written: written, my_node_num: 0xb0b }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'requests TELEMETRY_APP with want_response' do
|
|
20
|
+
serial_obj = fake_serial_obj
|
|
21
|
+
described_class.request(serial_obj: serial_obj, to: '!aabbccdd')
|
|
22
|
+
frame = serial_obj[:written]
|
|
23
|
+
packet = Meshtastic::ToRadio.decode(frame.byteslice(4, (frame.getbyte(2) << 8) + frame.getbyte(3))).packet
|
|
24
|
+
expect(packet.decoded.portnum).to eq(:TELEMETRY_APP)
|
|
25
|
+
expect(packet.decoded.want_response).to be true
|
|
26
|
+
end
|
|
6
27
|
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe Meshtastic::Traceroute do
|
|
6
|
+
def fake_serial_obj
|
|
7
|
+
written = +''.b
|
|
8
|
+
serial_conn = Object.new
|
|
9
|
+
serial_conn.define_singleton_method(:write) do |b|
|
|
10
|
+
written << b
|
|
11
|
+
b.bytesize
|
|
12
|
+
end
|
|
13
|
+
serial_conn.define_singleton_method(:flush) { true }
|
|
14
|
+
serial_conn.define_singleton_method(:closed?) { false }
|
|
15
|
+
serial_conn.define_singleton_method(:close) { true }
|
|
16
|
+
{ serial_conn: serial_conn, written: written, my_node_num: 0xb0b }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'sends an empty RouteDiscovery on TRACEROUTE_APP' do
|
|
20
|
+
serial_obj = fake_serial_obj
|
|
21
|
+
described_class.send(serial_obj: serial_obj, to: '!aabbccdd')
|
|
22
|
+
frame = serial_obj[:written]
|
|
23
|
+
packet = Meshtastic::ToRadio.decode(frame.byteslice(4, (frame.getbyte(2) << 8) + frame.getbyte(3))).packet
|
|
24
|
+
expect(packet.decoded.portnum).to eq(:TRACEROUTE_APP)
|
|
25
|
+
expect(Meshtastic::RouteDiscovery.decode(packet.decoded.payload)).to be_a(Meshtastic::RouteDiscovery)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -2,5 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
|
-
describe Meshtastic::
|
|
5
|
+
describe Meshtastic::Xmodem do
|
|
6
|
+
it 'encodes an XModem SOH packet' do
|
|
7
|
+
packet = described_class.encode(control: :SOH, seq: 1, buffer: 'A')
|
|
8
|
+
expect(packet.control).to eq(:SOH)
|
|
9
|
+
expect(packet.seq).to eq(1)
|
|
10
|
+
end
|
|
6
11
|
end
|
data/spec/lib/meshtastic_spec.rb
CHANGED
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.
|
|
4
|
+
version: 0.0.180
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- 0day Inc.
|
|
@@ -284,9 +284,46 @@ files:
|
|
|
284
284
|
- Rakefile
|
|
285
285
|
- bin/meshtastic_autoinc_version
|
|
286
286
|
- build_gem.sh
|
|
287
|
+
- documentation/README.md
|
|
288
|
+
- documentation/admin-channel.md
|
|
289
|
+
- documentation/admin-config.md
|
|
290
|
+
- documentation/admin-firmware.md
|
|
291
|
+
- documentation/admin.md
|
|
292
|
+
- documentation/apponly.md
|
|
293
|
+
- documentation/atak.md
|
|
294
|
+
- documentation/bluetooth-bluez.md
|
|
295
|
+
- documentation/bluetooth.md
|
|
296
|
+
- documentation/cannedmessages.md
|
|
297
|
+
- documentation/channel.md
|
|
298
|
+
- documentation/clientonly.md
|
|
299
|
+
- documentation/config.md
|
|
300
|
+
- documentation/connection-status.md
|
|
301
|
+
- documentation/deviceonly.md
|
|
302
|
+
- documentation/localonly.md
|
|
303
|
+
- documentation/mesh-interface.md
|
|
304
|
+
- documentation/meshtastic.md
|
|
305
|
+
- documentation/module-config.md
|
|
306
|
+
- documentation/mqtt.md
|
|
307
|
+
- documentation/paxcount.md
|
|
308
|
+
- documentation/portnums.md
|
|
309
|
+
- documentation/position.md
|
|
310
|
+
- documentation/protobufs.md
|
|
311
|
+
- documentation/remote-hardware.md
|
|
312
|
+
- documentation/rtttl.md
|
|
313
|
+
- documentation/serial.md
|
|
314
|
+
- documentation/storeforward.md
|
|
315
|
+
- documentation/stream-interface.md
|
|
316
|
+
- documentation/tcp.md
|
|
317
|
+
- documentation/telemetry.md
|
|
318
|
+
- documentation/traceroute.md
|
|
319
|
+
- documentation/util.md
|
|
320
|
+
- documentation/xmodem.md
|
|
287
321
|
- git_commit.sh
|
|
288
322
|
- lib/meshtastic.rb
|
|
289
323
|
- lib/meshtastic/admin.rb
|
|
324
|
+
- lib/meshtastic/admin/channel.rb
|
|
325
|
+
- lib/meshtastic/admin/config.rb
|
|
326
|
+
- lib/meshtastic/admin/firmware.rb
|
|
290
327
|
- lib/meshtastic/admin_pb.rb
|
|
291
328
|
- lib/meshtastic/apponly.rb
|
|
292
329
|
- lib/meshtastic/apponly_pb.rb
|
|
@@ -323,6 +360,7 @@ files:
|
|
|
323
360
|
- lib/meshtastic/paxcount_pb.rb
|
|
324
361
|
- lib/meshtastic/portnums.rb
|
|
325
362
|
- lib/meshtastic/portnums_pb.rb
|
|
363
|
+
- lib/meshtastic/position.rb
|
|
326
364
|
- lib/meshtastic/powermon_pb.rb
|
|
327
365
|
- lib/meshtastic/remote_hardware.rb
|
|
328
366
|
- lib/meshtastic/remote_hardware_pb.rb
|
|
@@ -333,8 +371,10 @@ files:
|
|
|
333
371
|
- lib/meshtastic/storeforward.rb
|
|
334
372
|
- lib/meshtastic/storeforward_pb.rb
|
|
335
373
|
- lib/meshtastic/stream_interface.rb
|
|
374
|
+
- lib/meshtastic/tcp.rb
|
|
336
375
|
- lib/meshtastic/telemetry.rb
|
|
337
376
|
- lib/meshtastic/telemetry_pb.rb
|
|
377
|
+
- lib/meshtastic/traceroute.rb
|
|
338
378
|
- lib/meshtastic/util.rb
|
|
339
379
|
- lib/meshtastic/version.rb
|
|
340
380
|
- lib/meshtastic/xmodem.rb
|
|
@@ -343,6 +383,10 @@ files:
|
|
|
343
383
|
- meshtastic.gemspec
|
|
344
384
|
- reinstall_gemset.sh
|
|
345
385
|
- sig/meshtastic.rbs
|
|
386
|
+
- spec/conventions_spec.rb
|
|
387
|
+
- spec/lib/meshtastic/admin/channel_spec.rb
|
|
388
|
+
- spec/lib/meshtastic/admin/config_spec.rb
|
|
389
|
+
- spec/lib/meshtastic/admin/firmware_spec.rb
|
|
346
390
|
- spec/lib/meshtastic/admin_pb_spec.rb
|
|
347
391
|
- spec/lib/meshtastic/admin_spec.rb
|
|
348
392
|
- spec/lib/meshtastic/apponly_pb_spec.rb
|
|
@@ -380,6 +424,7 @@ files:
|
|
|
380
424
|
- spec/lib/meshtastic/paxcount_spec.rb
|
|
381
425
|
- spec/lib/meshtastic/portnums_pb_spec.rb
|
|
382
426
|
- spec/lib/meshtastic/portnums_spec.rb
|
|
427
|
+
- spec/lib/meshtastic/position_spec.rb
|
|
383
428
|
- spec/lib/meshtastic/powermon_pb_spec.rb
|
|
384
429
|
- spec/lib/meshtastic/remote_hardware_pb_spec.rb
|
|
385
430
|
- spec/lib/meshtastic/remote_hardware_spec.rb
|
|
@@ -390,8 +435,10 @@ files:
|
|
|
390
435
|
- spec/lib/meshtastic/storeforward_pb_spec.rb
|
|
391
436
|
- spec/lib/meshtastic/storeforward_spec.rb
|
|
392
437
|
- spec/lib/meshtastic/stream_interface_spec.rb
|
|
438
|
+
- spec/lib/meshtastic/tcp_spec.rb
|
|
393
439
|
- spec/lib/meshtastic/telemetry_pb_spec.rb
|
|
394
440
|
- spec/lib/meshtastic/telemetry_spec.rb
|
|
441
|
+
- spec/lib/meshtastic/traceroute_spec.rb
|
|
395
442
|
- spec/lib/meshtastic/util_spec.rb
|
|
396
443
|
- spec/lib/meshtastic/version_spec.rb
|
|
397
444
|
- spec/lib/meshtastic/xmodem_pb_spec.rb
|