Sha256: 95fe9a6f1cbfd910b64ebfe4ba9641b97c3b9daa4c0555b7c550d388861bf4e7

Contents?: true

Size: 466 Bytes

Versions: 2

Compression:

Stored size: 466 Bytes

Contents

require 'movingsign_api/commands/write_control_command'

module MovingsignApi
  # Sets the sound on/off property of the sign
  class SetSoundCommand < WriteControlCommand
    attr_accessor :on

    # @param sound_on [Boolean] +true+ to turn sound on, +false+ otherwise
    def initialize(sound_on)
      @on = sound_on
    end

    def subcommand_code
      'J'
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
movingsign_api-0.0.2 lib/movingsign_api/commands/set_sound_command.rb
movingsign_api-0.0.1 lib/movingsign_api/commands/set_sound_command.rb