Class: Meshtastic::Paxcount

Inherits:
Object
  • Object
show all
Defined in:
lib/meshtastic/paxcount.rb

Class Method Summary collapse

Class Method Details

.authorsObject



23
24
25
# File 'lib/meshtastic/paxcount.rb', line 23

public_class_method def self.authors
  "AUTHOR(S):\n        0day Inc. <[email protected]>\n      "
end

.build(opts = {}) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/meshtastic/paxcount.rb', line 7

public_class_method def self.build(opts = {})
  count = new
  count.wifi = opts[:wifi].to_i if opts[:wifi]
  count.ble = opts[:ble].to_i if opts[:ble]
  count.uptime = opts[:uptime].to_i if opts[:uptime]
  count
end

.helpObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/meshtastic/paxcount.rb', line 27

public_class_method def self.help
  puts "        USAGE:
    # Run the build class method for this module.
    #{self}.build(
      wifi: 'optional - value for wifi passed into build',
      ble: 'optional - value for ble passed into build',
      uptime: 'optional - value for uptime passed into build'
    )

    # Run the transmit class method for this module.
    #{self}.transmit

    # Run the authors class method for this module.
    #{self}.authors

  "
end

.transmit(opts = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/meshtastic/paxcount.rb', line 15

public_class_method def self.transmit(opts = {})
  data = Meshtastic::Data.new(
    portnum: :PAXCOUNTER_APP,
    payload: build(opts).to_proto
  )
  Meshtastic.deliver_data(opts.merge(data: data, port_num: Meshtastic::PortNum::PAXCOUNTER_APP))
end