Class: MINT::Mouse
- Defined in:
- lib/MINT-core/model/ir/mouse.rb
Constant Summary
Constants inherited from Interactor
Interactor::PUBLISH_ATTRIBUTES
Instance Method Summary collapse
Methods inherited from Pointer
#cache_coordinates, #restart_timeout, #start_timeout, #stop_timeout
Methods inherited from Interactor
class_from_channel_name, #create_attribute_channel_name, create_channel_name, #create_channel_w_name, get, getModel, get_dm, #init_statemachine, #is_in?, #new_states, notify, #process_event, #process_event!, #process_event_vars, #publish_update, #states, #states=, #sync_event, #sync_states, #to_dot, wait
Methods included from InteractorHelpers
#restart_timeout, #start_timeout, #stop_timeout
Instance Method Details
#consume(id) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/MINT-core/model/ir/mouse.rb', line 9 def consume(id) subscription = "data:"+self.class.create_channel_name+"."+id.to_s+":*" redis = RedisConnector.redis redis.pubsub.psubscribe(subscription) { |key,| # if (key.eql? subscription) data = MultiJson.decode if data["cmd"].eql? "pointer" x,y = data["data"] cache_coordinates x,y process_event("move") if not is_in? :moving restart_timeout else #button case data["data"] when "LEFT_PRESSED" process_event :press_left when "LEFT_RELEASED" process_event :release_left when "RIGHT_PRESSED" process_event :press_right when "RIGHT_RELEASED" process_event :release_right end end # end } end |
#getSCXML ⇒ Object
5 6 7 |
# File 'lib/MINT-core/model/ir/mouse.rb', line 5 def getSCXML "#{File.dirname(__FILE__)}/mouse.scxml" end |