Class: Meshtastic::Telemetry

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

Class Method Summary collapse

Class Method Details

.authorsObject



22
23
24
# File 'lib/meshtastic/telemetry.rb', line 22

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

.build(opts = {}) ⇒ Object



7
8
9
10
11
# File 'lib/meshtastic/telemetry.rb', line 7

public_class_method def self.build(opts = {})
  telemetry = new
  telemetry.time = opts[:time].to_i if opts[:time]
  telemetry
end

.helpObject



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

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

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

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

  "
end

.request(opts = {}) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/meshtastic/telemetry.rb', line 13

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