Class: StartProgram

Inherits:
DirectCommand show all
Includes:
MessageTranslator
Defined in:
lib/telegrams/commands/direct/start_program.rb

Constant Summary

Constants included from MessageTranslator

MessageTranslator::FILENAME_MAX_LENGTH

Instance Attribute Summary collapse

Attributes inherited from RespondableTelegram

#command

Attributes inherited from Telegram

#type

Instance Method Summary collapse

Methods included from MessageTranslator

#add_default_extension_if_missing, #boolean_as_bytes, #boolean_from_bytes, #integer_as_bytes, #integer_as_ulong_bytes, #integer_as_uword_bytes, #integer_from_bytes, #string_as_bytes, #string_from_bytes

Methods inherited from RespondableTelegram

#require_response=, #require_response?

Methods inherited from Telegram

#max_size_in_bytes

Constructor Details

#initialize(program_name, require_response = true) ⇒ StartProgram

Returns a new instance of StartProgram.

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
# File 'lib/telegrams/commands/direct/start_program.rb', line 9

def initialize(program_name, require_response=true)
  raise ArgumentError, "program_name is required" if program_name.nil?

  super(require_response)
  @command = 0x00  # startprogram
  @name = adjust_program_name(program_name)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/telegrams/commands/direct/start_program.rb', line 7

def name
  @name
end

Instance Method Details

#as_bytesObject



17
18
19
20
# File 'lib/telegrams/commands/direct/start_program.rb', line 17

def as_bytes
 bytes = super
 bytes.concat program_name_as_bytes
end