public class Glove
extends java.lang.Object
In this class gestures are simplified to letters, which may be composed of a single/double tap (input) or vibration (output).
High level user-interaction events can be handled by a custom implementation and register of the inner static class Glove.GloveListener.
| Modifier and Type | Class and Description |
|---|---|
static class |
Glove.GloveListener
A glove listener receives notifications of new data available in the
Glove object. |
| Constructor and Description |
|---|
Glove()
Constructs a glove adapter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(Glove.GloveListener gloveListener)
Adds a listener to the current set of event listeners of this adapter.
|
protected java.lang.String |
buildLetterGestureMessage(char letter)
Constructs a gesture for the passed letter.
|
void |
connect(Context appContext)
Connects this adapter to the Tact-Tiles runtime service,
which handles the bluetooth communication and device access.
|
java.lang.Thread |
draw(java.lang.String text)
Draws a text as a series of vibration gestures.
|
Device |
getDevice()
Returns the core device of this class.
|
char |
getLetter(int symbol)
Converts a received symbol into a letter.
|
int |
getTileId(char letter)
Returns the index of the tile that is used as input for the passed letter.
|
void |
removeListener(Glove.GloveListener gloveListener)
Removes a listener from the set listening to this adapter.
|
void |
setGloveIOMap(int[] map)
The glove I/O map is a array containing the tile indexes for each of the 26 letters of the alphabet.
|
void |
setSpaceChar(char spaceChar)
Set the space character as the inverse gesture of the passed letter.
|
void |
setup(int delayL,
int delayW,
int singleH,
int doubleH,
int doubleL)
Set the default values used while drawing the letter gestures.
|
public Device getDevice()
public void addListener(Glove.GloveListener gloveListener)
gloveListener - The listener to be added to the current set of listeners on this adapter.public void removeListener(Glove.GloveListener gloveListener)
gloveListener - The listener to be removed to the current set of listeners on this adapter.public void setup(int delayL,
int delayW,
int singleH,
int doubleH,
int doubleL)
delayL - Delay in ms between letters, default = 250 ms.delayW - Delay in ms between words, default = 250 ms.singleH - Single vibration duration in ms, default = 150 ms.doubleH - Vibration duration in ms for double tap letters, default = 150 ms.doubleL - Delay between vibrations in double tap letters, default = 100 ms.public void connect(Context appContext)
appContext - The current context of this application.public void setGloveIOMap(int[] map)
map - An array containing the tile indexes for each letter of the alphabet.public void setSpaceChar(char spaceChar)
spaceChar - The new space character, default is 'w'.public char getLetter(int symbol)
symbol - Symbol coded as a positive or negative tile index.public int getTileId(char letter)
letter - A character in the range of [a - z] or space ' '.protected java.lang.String buildLetterGestureMessage(char letter)
Device.send(String).letter - a char in the range [97,122] or space ' '.public java.lang.Thread draw(java.lang.String text)
Glove.GloveListener.onLetterDraw(int, char[]), if everything goes as planed.text - the text to be drawn.