Sha256: 63210a566d3069d8cfce0e5342c3095cb022377eaac370232615f2ac2bfed8f8

Contents?: true

Size: 708 Bytes

Versions: 5

Compression:

Stored size: 708 Bytes

Contents

require 'tamashii/agent/component'
require 'tamashii/agent/adapter/buzzer'

module Tamashii
  module Agent
    class Buzzer < Component
      def initialize
        super
        @buzzer = Adapter::Buzzer.object
        logger.debug "Using buzzer instance: #{@buzzer.class}"
      end

      def process_event(ev_type, ev_body)
        case ev_type
        when EVENT_BEEP
          logger.debug "Beep: #{ev_body}"
          case ev_body
          when "ok"
            @buzzer.play_ok
          when "no"
            @buzzer.play_no
          when "error"
            @buzzer.play_error
          end
        end
      end

      def clean_up
        super
        @buzzer.stop
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tamashii-agent-0.1.11 lib/tamashii/agent/buzzer.rb
tamashii-agent-0.1.10 lib/tamashii/agent/buzzer.rb
tamashii-agent-0.1.9 lib/tamashii/agent/buzzer.rb
tamashii-agent-0.1.8 lib/tamashii/agent/buzzer.rb
tamashii-agent-0.1.7 lib/tamashii/agent/buzzer.rb