NAME
AAC::Pvoice::Input - A class that handles the input that controls a pVoice-like application
SYNOPSIS
# this module will normally not be called directly. It's called from
# AAC::Pvoice::Panel by default
DESCRIPTION
AAC::Pvoice::Input allows one or two button operation of an AAC::Pvoice based application. The module uses Device::ParallelPort, so it should be able to run on Win32 as well as Linux platforms.
USAGE
new($window)
This constructor takes the window (AAC::Pvoice::Panel typically) on which the events and timer will be called as a parameter. If the configuration (read using Wx::ConfigBase::Get) has a key called 'Device' (which can be set to 'icon', 'keys' , 'mouse' or 'adremo') is set to 'adremo', it will start polling the parallel port every x milliseconds, where x is the value of the configuration key 'Interval'. This setting is only useful if you connect an "Adremo" electrical wheelchair to the parallel port of your PC (for more information see http://www.adremo.nl). If the key 'Device' is set to 'icon' it will respond to the left and right mouse button, and if it's set to 'keys' it will respond to the configuration keys 'SelectKey' and 'NextKey' (which are the keyboard codes for the 'select' and 'next' events respectively.
AAC::Pvoice::Input has the ability to operate with either one or two buttons. If you want to use only one button, you need to set the configuration key "Buttons" to 1, and it will automatically invoke the subroutine you pass to Next() at an interval of the value set in the configuration key OneButtonInterval (set in milliseconds).
The default for is to operate in two button mode, and if OneButtonInterval is not set, it will use a default of 2000 milliseconds if "Buttons" is set to 1.
newchild($window)
This semi-constructor takes the window (usually a child of the panel you passed to the new() constructor, on which the events will be called as a parameter. It doesn't start the timers for polling the parallel port and automatic invocation of the Next() subroutine, because those timers otherwise would be started multiple times. Apart from starting those timers, this method works exactly like the new()
Next(sub)
This method takes a coderef as parameter. This coderef will be invoked when the 'Next' event happens.
If the Device (see 'new') is set to 'icon', and a right mousebutton is clicked, a 'Next' event is generated. If the Device is set to 'adremo' and the headsupport of the wheelchair is moved to the right, that will also generate a 'Next' event. If the Device is set to 'keys' and a key is pressed that corresponds with the keycode set in the 'NextKey', this will generate a 'Next' event too.
Select(sub)
This method takes a coderef as parameter. This coderef will be invoked when the 'Select' event happens.
If the Device (see 'new') is set to 'icon', and a left mousebutton is clicked, a 'Select' event is generated. If the Device is set to 'adremo' and the headsupport of the wheelchair is moved to the left, that will also generate a 'Select' event. If the Device is set to 'keys' and a key is pressed that corresponds with the keycode set in the 'SelectKey', this will generate a 'Select' event too.
GetDevice
This method will return the value of the configuration key called 'Device'
SetupMouse($window, $subgetfocus, $subup, $sublosefocus)
This method is used to setup a button for normal mouse input (when configuration key 'Device' is set to 'mouse'). It takes the wxWindow (typically a Wx::BitmapButton) that should respond to this way of input as the first parameter. $subgetfocus is the coderef that should be invoked when the mousecursor hovers over this $window (EVT_ENTER). $subup is the coderef that should be invoked when the left mousebutton is released (EVT_LEFT_UP). $sublosefocus is the coderef that should be invoked when the $window loses focus (EVT_LEAVE).
StartMonitor
This method will start polling the the parallel port for input of the Adremo Electrical Wheelchair.
QuitMonitor
This method will stop the timer that monitors the parallel port.
PauseMonitor($bool)
This method will pause ($bool is set to 1) or restart ($bool is set to 0) the timer that monitors the parallel port.
StartAutoscan
This method will start the timer that invokes the Next() event every n milliseconds.
QuitAutoscan
This method will stop the timer that invokes the Next() method.
PauseAutoscan($bool)
This method will pause ($bool is set to 1) or restart ($bool is set to 0) the timer that invokes the Next() method.
BUGS
probably a lot, patches welcome!
AUTHOR
Jouke Visser
jouke@pvoice.org
http://jouke.pvoice.org
COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
SEE ALSO
perl(1), Wx