Sha256: 077b36b72a44c69bf20f24cb0e20b6c3e72b910afef4fad392a163eeb71ab7e8

Contents?: true

Size: 808 Bytes

Versions: 4

Compression:

Stored size: 808 Bytes

Contents

require 'tamashii/agent/component'
require 'tamashii/agent/event'

module Tamashii
  module Agent
    class Buzzer < Component
      def initialize(name, master, options = {})
        super
        @buzzer = initialize_device
      end

      def default_device_name
        'Dummy'
      end

      def get_device_class_name(device_name)
        "Buzzer::#{device_name}"
      end

      def process_event(event)
        case event.type
        when Event::BEEP
          logger.debug "Beep: #{event.body}"
          case event.body
          when "ok"
            @buzzer.play_ok
          when "no"
            @buzzer.play_no
          when "error"
            @buzzer.play_error
          end
        end
      end

      def clean_up
        super
        @buzzer.shutdown
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tamashii-agent-0.4.0 lib/tamashii/agent/buzzer.rb
tamashii-agent-0.3.4 lib/tamashii/agent/buzzer.rb
tamashii-agent-0.3.3 lib/tamashii/agent/buzzer.rb
tamashii-agent-0.3.1 lib/tamashii/agent/buzzer.rb