meshtastic 0.0.182 → 0.0.184

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/README.md +5 -0
  3. data/documentation/admin-backup.md +369 -0
  4. data/documentation/admin-channel.md +6 -6
  5. data/documentation/admin-config.md +5 -5
  6. data/documentation/admin-firmware-hex.md +57 -0
  7. data/documentation/admin-firmware-serial.md +1 -1
  8. data/documentation/admin-firmware-uf2.md +94 -0
  9. data/documentation/admin-firmware.md +52 -10
  10. data/documentation/admin.md +12 -2
  11. data/documentation/module-config.md +8 -4
  12. data/documentation/rtttl.md +8 -4
  13. data/lib/meshtastic/admin/backup.rb +560 -0
  14. data/lib/meshtastic/admin/channel.rb +6 -3
  15. data/lib/meshtastic/admin/config.rb +14 -14
  16. data/lib/meshtastic/admin/firmware/hex.rb +209 -0
  17. data/lib/meshtastic/admin/firmware/uf2.rb +166 -0
  18. data/lib/meshtastic/admin/firmware.rb +55 -13
  19. data/lib/meshtastic/admin.rb +60 -23
  20. data/lib/meshtastic/config_pb.rb +1 -1
  21. data/lib/meshtastic/mesh_pb.rb +1 -1
  22. data/lib/meshtastic/module_config.rb +22 -4
  23. data/lib/meshtastic/module_config_pb.rb +2 -1
  24. data/lib/meshtastic/rtttl.rb +22 -4
  25. data/lib/meshtastic/version.rb +1 -1
  26. data/spec/lib/meshtastic/admin/backup_spec.rb +704 -0
  27. data/spec/lib/meshtastic/admin/channel_spec.rb +23 -9
  28. data/spec/lib/meshtastic/admin/config_spec.rb +28 -12
  29. data/spec/lib/meshtastic/admin/firmware/hex_spec.rb +160 -0
  30. data/spec/lib/meshtastic/admin/firmware/uf2_spec.rb +234 -0
  31. data/spec/lib/meshtastic/admin/firmware_spec.rb +106 -3
  32. data/spec/lib/meshtastic/admin_spec.rb +106 -40
  33. data/spec/lib/meshtastic/module_config_spec.rb +47 -0
  34. data/spec/lib/meshtastic/rtttl_spec.rb +47 -0
  35. metadata +10 -1
@@ -11,11 +11,25 @@ module Meshtastic
11
11
  end
12
12
 
13
13
  public_class_method def self.set(opts = {})
14
- Admin.send(opts.merge(set_ringtone_message: opts.fetch(:ringtone)))
14
+ Admin.send(admin_options(opts).merge(set_ringtone_message: opts.fetch(:ringtone)))
15
15
  end
16
16
 
17
17
  public_class_method def self.get(opts = {})
18
- Admin.send(opts.merge(get_ringtone_request: true))
18
+ Admin.send(admin_options(opts).merge(get_ringtone_request: true))
19
+ end
20
+
21
+ # Keep the external transport aliases out of the Admin API.
22
+ private_class_method def self.admin_options(opts = {})
23
+ options = opts.merge({})
24
+ keys = %i[transport_obj serial_obj bluetooth_obj tcp_obj mqtt_obj]
25
+ selected = keys.reject { |name| options[name].nil? }
26
+ raise ArgumentError, 'provide exactly one transport connection' if selected.length > 1
27
+
28
+ key = selected.first
29
+ connection = options[key] if key
30
+ keys.each { |name| options.delete(name) }
31
+ options[:transport_obj] = connection if key
32
+ options
19
33
  end
20
34
 
21
35
  public_class_method def self.authors
@@ -28,10 +42,14 @@ module Meshtastic
28
42
  #{self}.encode
29
43
 
30
44
  # Run the set class method for this module.
31
- #{self}.set
45
+ #{self}.set(transport_obj: connection, ringtone: ringtone)
32
46
 
33
47
  # Run the get class method for this module.
34
- #{self}.get
48
+ #{self}.get(transport_obj: connection)
49
+
50
+ # Legacy serial_obj:, bluetooth_obj:, tcp_obj:, mqtt_obj: remain accepted.
51
+ # Supply one non-nil connection only; mixed connection options are rejected.
52
+ # Remote setters inherit Admin automatic sessions, not persistence readback.
35
53
 
36
54
  # Run the authors class method for this module.
37
55
  #{self}.authors
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Meshtastic
4
- VERSION = '0.0.182'
4
+ VERSION = '0.0.184'
5
5
  end