Module: Meshtastic::Admin::Config
- Defined in:
- lib/meshtastic/admin/config.rb
Class Method Summary collapse
- .authors ⇒ Object
- .get(opts = {}) ⇒ Object
- .get_bluetooth(opts = {}) ⇒ Object
- .get_device(opts = {}) ⇒ Object
- .get_device_ui(opts = {}) ⇒ Object
- .get_display(opts = {}) ⇒ Object
- .get_lora(opts = {}) ⇒ Object
- .get_network(opts = {}) ⇒ Object
- .get_position(opts = {}) ⇒ Object
- .get_power(opts = {}) ⇒ Object
- .get_security(opts = {}) ⇒ Object
- .get_sessionkey(opts = {}) ⇒ Object
- .help ⇒ Object
- .set(opts = {}) ⇒ Object
- .set_bluetooth(opts = {}) ⇒ Object
- .set_device(opts = {}) ⇒ Object
- .set_device_ui(opts = {}) ⇒ Object
- .set_display(opts = {}) ⇒ Object
- .set_lora(opts = {}) ⇒ Object
- .set_network(opts = {}) ⇒ Object
- .set_position(opts = {}) ⇒ Object
- .set_power(opts = {}) ⇒ Object
- .set_security(opts = {}) ⇒ Object
- .set_sessionkey(opts = {}) ⇒ Object
Class Method Details
.authors ⇒ Object
103 104 105 |
# File 'lib/meshtastic/admin/config.rb', line 103 public_class_method def self. "AUTHOR(S):\n 0day Inc. <[email protected]>\n " end |
.get(opts = {}) ⇒ Object
8 9 10 |
# File 'lib/meshtastic/admin/config.rb', line 8 public_class_method def self.get(opts = {}) Admin.get_config(opts.merge(config_type: opts[:config_type] || :DEVICE_CONFIG)) end |
.get_bluetooth(opts = {}) ⇒ Object
47 48 49 |
# File 'lib/meshtastic/admin/config.rb', line 47 public_class_method def self.get_bluetooth(opts = {}) get(opts.merge(config_type: :BLUETOOTH_CONFIG)) end |
.get_device(opts = {}) ⇒ Object
23 24 25 |
# File 'lib/meshtastic/admin/config.rb', line 23 public_class_method def self.get_device(opts = {}) get(opts.merge(config_type: :DEVICE_CONFIG)) end |
.get_device_ui(opts = {}) ⇒ Object
59 60 61 |
# File 'lib/meshtastic/admin/config.rb', line 59 public_class_method def self.get_device_ui(opts = {}) Admin.get_ui_config(opts.merge({})) end |
.get_display(opts = {}) ⇒ Object
39 40 41 |
# File 'lib/meshtastic/admin/config.rb', line 39 public_class_method def self.get_display(opts = {}) get(opts.merge(config_type: :DISPLAY_CONFIG)) end |
.get_lora(opts = {}) ⇒ Object
43 44 45 |
# File 'lib/meshtastic/admin/config.rb', line 43 public_class_method def self.get_lora(opts = {}) get(opts.merge(config_type: :LORA_CONFIG)) end |
.get_network(opts = {}) ⇒ Object
35 36 37 |
# File 'lib/meshtastic/admin/config.rb', line 35 public_class_method def self.get_network(opts = {}) get(opts.merge(config_type: :NETWORK_CONFIG)) end |
.get_position(opts = {}) ⇒ Object
27 28 29 |
# File 'lib/meshtastic/admin/config.rb', line 27 public_class_method def self.get_position(opts = {}) get(opts.merge(config_type: :POSITION_CONFIG)) end |
.get_power(opts = {}) ⇒ Object
31 32 33 |
# File 'lib/meshtastic/admin/config.rb', line 31 public_class_method def self.get_power(opts = {}) get(opts.merge(config_type: :POWER_CONFIG)) end |
.get_security(opts = {}) ⇒ Object
51 52 53 |
# File 'lib/meshtastic/admin/config.rb', line 51 public_class_method def self.get_security(opts = {}) get(opts.merge(config_type: :SECURITY_CONFIG)) end |
.get_sessionkey(opts = {}) ⇒ Object
55 56 57 |
# File 'lib/meshtastic/admin/config.rb', line 55 public_class_method def self.get_sessionkey(opts = {}) get(opts.merge(config_type: :SESSIONKEY_CONFIG)) end |
.help ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/meshtastic/admin/config.rb', line 107 public_class_method def self.help puts "USAGE: # Request a radio Config section by ConfigType. #{self}.get( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client', config_type: 'optional - :DEVICE_CONFIG or another ConfigType (default: :DEVICE_CONFIG)' ) # Write a Config protobuf to the node. #{self}.set( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client', config: 'required - Meshtastic::Config protobuf to write' ) # Request DEVICE_CONFIG from the node. #{self}.get_device( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client' ) # Request POSITION_CONFIG from the node. #{self}.get_position( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client' ) # Request POWER_CONFIG from the node. #{self}.get_power( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client' ) # Request NETWORK_CONFIG from the node. #{self}.get_network( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client' ) # Request DISPLAY_CONFIG from the node. #{self}.get_display( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client' ) # Request LORA_CONFIG from the node. #{self}.get_lora( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client' ) # Request BLUETOOTH_CONFIG from the node. #{self}.get_bluetooth( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client' ) # Request SECURITY_CONFIG from the node. #{self}.get_security( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client' ) # Request SESSIONKEY_CONFIG from the node. #{self}.get_sessionkey( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client' ) # Request DeviceUIConfig using dedicated firmware operation. #{self}.get_device_ui( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client' ) # Write DeviceConfig wrapped in a Config protobuf. #{self}.set_device( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client', device: 'required - DeviceConfig protobuf or complete section field Hash' ) # Write LoRaConfig wrapped in a Config protobuf. #{self}.set_lora( transport_obj: 'required - connected Serial, Bluetooth, TCP handle or MQTT client', lora: 'required - LoRaConfig protobuf or complete section field Hash' ) # Write position configuration to node. #{self}.set_position(position: 'required - PositionConfig protobuf or field hash') # Write power configuration to node. #{self}.set_power(power: 'required - PowerConfig protobuf or field hash') # Write network configuration to node. #{self}.set_network(network: 'required - NetworkConfig protobuf or field hash') # Write display configuration to node. #{self}.set_display(display: 'required - DisplayConfig protobuf or field hash') # Write Bluetooth configuration to node. #{self}.set_bluetooth(bluetooth: 'required - BluetoothConfig protobuf or field hash') # Write security configuration to node. #{self}.set_security(security: 'required - SecurityConfig protobuf or field hash') # Reject writes to request-only session key placeholder. #{self}.set_sessionkey(sessionkey: 'required - placeholder only; always raises ArgumentError') # Write device UI configuration to node. #{self}.set_device_ui(device_ui: 'required - DeviceUIConfig protobuf or field hash') # Print the AUTHOR(S) string for this module. #{self}.authors " end |
.set(opts = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/meshtastic/admin/config.rb', line 12 public_class_method def self.set(opts = {}) config = opts[:config] raise ArgumentError, 'config must contain one Config section' unless config.is_a?(Meshtastic::Config) && config.payload_variant raise ArgumentError, 'sessionkey is a request-only placeholder; use get_sessionkey' if config.payload_variant == :sessionkey section_keys = Meshtastic::Config.descriptor.map { |field| field.name.to_sym } return Admin.store_ui_config(opts.except(*section_keys, :config).merge(ui_config: config.device_ui)) if config.payload_variant == :device_ui Admin.set_config(opts.except(*section_keys).merge(config: config)) end |
.set_bluetooth(opts = {}) ⇒ Object
87 88 89 |
# File 'lib/meshtastic/admin/config.rb', line 87 public_class_method def self.set_bluetooth(opts = {}) set(opts.merge(config: Meshtastic::Config.new(bluetooth: opts.fetch(:bluetooth)))) end |
.set_device(opts = {}) ⇒ Object
63 64 65 |
# File 'lib/meshtastic/admin/config.rb', line 63 public_class_method def self.set_device(opts = {}) set(opts.merge(config: Meshtastic::Config.new(device: opts.fetch(:device)))) end |
.set_device_ui(opts = {}) ⇒ Object
99 100 101 |
# File 'lib/meshtastic/admin/config.rb', line 99 public_class_method def self.set_device_ui(opts = {}) set(opts.merge(config: Meshtastic::Config.new(device_ui: opts.fetch(:device_ui)))) end |
.set_display(opts = {}) ⇒ Object
83 84 85 |
# File 'lib/meshtastic/admin/config.rb', line 83 public_class_method def self.set_display(opts = {}) set(opts.merge(config: Meshtastic::Config.new(display: opts.fetch(:display)))) end |
.set_lora(opts = {}) ⇒ Object
67 68 69 |
# File 'lib/meshtastic/admin/config.rb', line 67 public_class_method def self.set_lora(opts = {}) set(opts.merge(config: Meshtastic::Config.new(lora: opts.fetch(:lora)))) end |
.set_network(opts = {}) ⇒ Object
79 80 81 |
# File 'lib/meshtastic/admin/config.rb', line 79 public_class_method def self.set_network(opts = {}) set(opts.merge(config: Meshtastic::Config.new(network: opts.fetch(:network)))) end |
.set_position(opts = {}) ⇒ Object
71 72 73 |
# File 'lib/meshtastic/admin/config.rb', line 71 public_class_method def self.set_position(opts = {}) set(opts.merge(config: Meshtastic::Config.new(position: opts.fetch(:position)))) end |
.set_power(opts = {}) ⇒ Object
75 76 77 |
# File 'lib/meshtastic/admin/config.rb', line 75 public_class_method def self.set_power(opts = {}) set(opts.merge(config: Meshtastic::Config.new(power: opts.fetch(:power)))) end |
.set_security(opts = {}) ⇒ Object
91 92 93 |
# File 'lib/meshtastic/admin/config.rb', line 91 public_class_method def self.set_security(opts = {}) set(opts.merge(config: Meshtastic::Config.new(security: opts.fetch(:security)))) end |
.set_sessionkey(opts = {}) ⇒ Object
95 96 97 |
# File 'lib/meshtastic/admin/config.rb', line 95 public_class_method def self.set_sessionkey(opts = {}) set(opts.merge(config: Meshtastic::Config.new(sessionkey: opts.fetch(:sessionkey)))) end |