Module: Meshtastic::RemoteHardware
- Defined in:
- lib/meshtastic/remote_hardware.rb
Class Method Summary collapse
- .authors ⇒ Object
- .encode(opts = {}) ⇒ Object
- .help ⇒ Object
- .read_gpios(opts = {}) ⇒ Object
- .send(opts = {}) ⇒ Object
- .watch_gpios(opts = {}) ⇒ Object
- .write_gpios(opts = {}) ⇒ Object
Class Method Details
.authors ⇒ Object
36 37 38 |
# File 'lib/meshtastic/remote_hardware.rb', line 36 public_class_method def self. "AUTHOR(S):\n 0day Inc. <[email protected]>\n " end |
.encode(opts = {}) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/meshtastic/remote_hardware.rb', line 7 public_class_method def self.encode(opts = {}) = Meshtastic::HardwareMessage.new .type = opts.fetch(:type, :READ_GPIOS) .gpio_mask = opts.fetch(:gpio_mask, 0) .gpio_value = opts[:gpio_value].to_i if opts[:gpio_value] end |
.help ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/meshtastic/remote_hardware.rb', line 40 public_class_method def self.help puts " USAGE: # Run the encode class method for this module. #{self}.encode( gpio_value: 'optional - value for gpio_value passed into encode' ) # Run the send class method for this module. #{self}.send # Run the read_gpios class method for this module. #{self}.read_gpios # Run the write_gpios class method for this module. #{self}.write_gpios # Run the watch_gpios class method for this module. #{self}.watch_gpios # Run the authors class method for this module. #{self}.authors " end |
.read_gpios(opts = {}) ⇒ Object
24 25 26 |
# File 'lib/meshtastic/remote_hardware.rb', line 24 public_class_method def self.read_gpios(opts = {}) send(opts.merge(type: :READ_GPIOS)) end |
.send(opts = {}) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/meshtastic/remote_hardware.rb', line 15 public_class_method def self.send(opts = {}) data = Meshtastic::Data.new( portnum: :REMOTE_HARDWARE_APP, payload: encode(opts).to_proto, want_response: opts.fetch(:want_response, true) ) Meshtastic.deliver_data(opts.merge(data: data, port_num: Meshtastic::PortNum::REMOTE_HARDWARE_APP)) end |
.watch_gpios(opts = {}) ⇒ Object
32 33 34 |
# File 'lib/meshtastic/remote_hardware.rb', line 32 public_class_method def self.watch_gpios(opts = {}) send(opts.merge(type: :WATCH_GPIOS)) end |
.write_gpios(opts = {}) ⇒ Object
28 29 30 |
# File 'lib/meshtastic/remote_hardware.rb', line 28 public_class_method def self.write_gpios(opts = {}) send(opts.merge(type: :WRITE_GPIOS, want_response: false)) end |