Class: MovingsignApi::SetSoundCommand

Inherits:
WriteControlCommand show all
Defined in:
lib/movingsign_api/commands/set_sound_command.rb

Overview

Sets the sound on/off property of the sign

Instance Attribute Summary collapse

Attributes inherited from Command

#receiver, #sender

Instance Method Summary collapse

Methods inherited from WriteControlCommand

#command_code

Methods inherited from Command

#command_code, #to_bytes

Constructor Details

#initialize(sound_on) ⇒ SetSoundCommand

Returns a new instance of SetSoundCommand.

Parameters:

  • sound_on (Boolean)

    true to turn sound on, false otherwise



9
10
11
# File 'lib/movingsign_api/commands/set_sound_command.rb', line 9

def initialize(sound_on)
  @on = sound_on
end

Instance Attribute Details

#onObject

Returns the value of attribute on.



6
7
8
# File 'lib/movingsign_api/commands/set_sound_command.rb', line 6

def on
  @on
end

Instance Method Details

#subcommand_codeObject



13
14
15
# File 'lib/movingsign_api/commands/set_sound_command.rb', line 13

def subcommand_code
  'J'
end

#subcommand_payload_bytesObject



17
18
19
# File 'lib/movingsign_api/commands/set_sound_command.rb', line 17

def subcommand_payload_bytes
  string_to_ascii_bytes(@on ? '1' : '0')
end