Class: XInputWrapperPlus

Inherits:
XInputWrapper
  • Object
show all
Defined in:
lib/xinput_wrapperplus.rb

Instance Method Summary collapse

Constructor Details

#initialize(device: '3', host: 'sps', port: '59000', topic: 'input/keyboard', verbose: true, lookup: {}, debug: false) ⇒ XInputWrapperPlus

Returns a new instance of XInputWrapperPlus.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/xinput_wrapperplus.rb', line 12

def initialize(device: '3', host: 'sps', port: '59000', 
               topic: 'input/keyboard', verbose: true, lookup: {}, 
               debug: false)

  super(device: device, verbose: verbose, lookup: lookup, 
        debug: debug)
  @topic = topic
  @sps = SPSPub.new host: host, port: port
  @sk = SecretKnock.new short_delay: 0.25, long_delay: 0.5, 
                            external: self, verbose: verbose, debug: debug
  @sk.detect timeout: 0.7
end

Instance Method Details

#knockObject



26
27
28
# File 'lib/xinput_wrapperplus.rb', line 26

def knock()
  puts 'knock' if @verbose
end

#message(msg) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/xinput_wrapperplus.rb', line 30

def message(msg)
  
  puts ':: ' + msg.inspect if @verbose        
  
  return if msg.strip.empty?
  
  @sps.notice "%s: %s" % [@topic, msg]
  
end