Module: Meshtastic::Cannedmessages

Defined in:
lib/meshtastic/cannedmessages.rb

Class Method Summary collapse

Class Method Details

.authorsObject



21
22
23
# File 'lib/meshtastic/cannedmessages.rb', line 21

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

.encode(opts = {}) ⇒ Object



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

public_class_method def self.encode(opts = {})
  config = Meshtastic::CannedMessageModuleConfig.new
  config.messages = opts.fetch(:messages, '')
  config
end

.helpObject



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/meshtastic/cannedmessages.rb', line 25

public_class_method def self.help
  puts "        USAGE:
    # Run the encode class method for this module.
    #{self}.encode

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

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

  "
end

.send(opts = {}) ⇒ Object



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

public_class_method def self.send(opts = {})
  data = Meshtastic::Data.new(
    portnum: :TEXT_MESSAGE_APP,
    payload: encode(opts).messages.to_s.b
  )
  Meshtastic.deliver_data(opts.merge(data: data, port_num: Meshtastic::PortNum::TEXT_MESSAGE_APP))
end