|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread lejos.addon.keyboard.Keyboard
public class Keyboard
This class will only work with SPP keyboards, not standard HID keyboards. If it doesn't say it supports Bluetooth SPP then it will not work. There are currently only two known SPP models (also available on eBay or Amazon):
The SPP keyboards transmit keystrokes as one byte, not two like normal HID keyboards. For this reason, this class won't work properly with a regular HID keyboard as written. With modifications it could be made to work with both SPP and HID keyboards since the key tables are mostly the same.
Note: This class is currently only tested with Freedom Universal. If you have problems with the iTech Virtual Keyboard, write to bbagnall@mts.net and I will try my best to adapt this class.
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
Keyboard()
Makes Bluetooth connection to SPP keyboard. |
|
Keyboard(InputStream in,
OutputStream out)
Creates a new Keyboard instance using streams from the keyboard. |
Method Summary | |
---|---|
void |
addKeyListener(KeyListener kl)
Starts a KeyListener listening for events from the keyboard. |
int |
getTypematicDelay()
Typematic delay is the time after a key is held down that characters start repeating. |
double |
getTypematicRate()
Typematic rate is the rate characters repeat when a key is held down. |
boolean |
isCapsLock()
Indicates whether or not caps lock is enabled for the keyboard. |
void |
removeKeylistener(KeyListener kl)
Removes the specified KeyListener from the Keyboard so it will no longer notify the listener of new events. |
void |
run()
When an object implementing interface Runnable is used
to create a thread, starting the thread causes the object's
run method to be called in that separately executing
thread. |
void |
setTypematicDelay(int delay)
Typematic delay is the time after a key is held down that characters start repeating. |
void |
setTypematicRate(int rate)
Typematic rate is the rate characters repeat when a key is held down. |
Methods inherited from class java.lang.Thread |
---|
currentThread, getName, getPriority, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, setDaemon, setName, setPriority, sleep, start, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Keyboard(InputStream in, OutputStream out)
in
- out
- public Keyboard() throws BluetoothStateException
BluetoothStateException
- If it doesn't find an SPP device to connect to.Method Detail |
---|
public void setTypematicDelay(int delay)
delay
- 250 ms to 1000 ms (500ms default)public int getTypematicDelay()
public void setTypematicRate(int rate)
rate
- 2.0 cps (characters per second) to 30.0 cps (10.9 default)public double getTypematicRate()
public void addKeyListener(KeyListener kl)
kl
- public void removeKeylistener(KeyListener kl)
kl
- public void run()
Runnable
Runnable
is used
to create a thread, starting the thread causes the object's
run
method to be called in that separately executing
thread.
public boolean isCapsLock()
Caps Lock
key.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |