Sha256: 2b40a055ce14bd5d3cd74fcdd4a4b6aa0cf400d8256d4841be730ba0c6ed5c36

Contents?: true

Size: 782 Bytes

Versions: 1

Compression:

Stored size: 782 Bytes

Contents

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

module Tamashii
  module Agent
    class Keyboard < Component
      def initialize(name, master, options = {})
        options[:watch] = true # Force enable watch mode
        super
        @kb = initialize_device
        @kb.on_key_down do |key|
          logger.debug "Key down: #{key+1}"
          @master.send_event(Event.new(Event::LCD_MESSAGE, "Key pressed: #{key+1} "))
        end
      end

      def default_device_name
        'Dummy'
      end

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

      # override
      def process_event(event)
        # silent is gold
      end

      def clean_up
        super
        @kb.shutdown
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tamashii-agent-0.3.3 lib/tamashii/agent/keyboard.rb