Skip to content

Latest commit

 

History

History
79 lines (57 loc) · 3.43 KB

input.rst

File metadata and controls

79 lines (57 loc) · 3.43 KB

User Input

gestureCallback(String event, Function callback) : void

Register to get gesture events using the string of one of the events below (following GDK names, see below).

Event Types
onGesture(String gesture):The gestures that can be returned are listed here: LONG_PRESS, SWIPE_DOWN, SWIPE_LEFT, SWIPE_RIGHT, TAP, THREE_LONG_PRESS, THREE_TAP, TWO_LONG_PRESS, TWO_SWIPE_RIGHT, TWO_SWIPE_UP, TWO_TAP
onGesture<GESTURE>():Shorthand for a specific gesture (e.g., onGestureTAP).
onFingerCountChanged(int previousCount, int currentCount):
 see FingerListener in GDK
onScroll(float displacement, float delta, float velocity):
 see ScrollListener in GDK
onTwoFingerScroll(float displacement, float delta, float velocity):
 see TwoFingerScrollListener in GDK
onEyeGesture(String gesture):One of WINK, DOUBLE_WINK, DOUBLE_BLINK, DON, DOFF
onEyeGesture<GESTURE>:Shorthand for a specific gesture (e.g., onEyeGestureWINK)
WS.gestureCallback('onGesture', function (gesture) {
    WS.say(gesture);
});
WS.gestureCallback('onFingerCountChanged', function (i, i2) {
    WS.log('onFingerCountChanged: ' + i + ', ' + i2);
});
WS.gestureCallback('onScroll', function (v, v2, v3) {
    WS.log('onScroll: ' + v + ', ' + v2 + ', ' + v3);
});
WS.gestureCallback('onTwoFingerScroll', function (v, v2, v3) {
    WS.log('onTwoFingerScroll: ' + v + ', ' + v2 + ', ' + v3);
});
WS.gestureCallback('onGestureTAP', function () {
    WS.say('tapped');
});
WS.gestureCallback('onEyeGesture', function (gesture) {
    WS.say(gesture);
});
WS.gestureCallback('onEyeGestureDOUBLE_BLINK', function () {
    WS.say('double blink');
});
speechRecognize(String prompt, Function callback) : void

Displays the prompt and calls your callback with the recognized speech as a string

Callback of the form function mycallback(String recognizedText)

WS.speechRecognize('Say Something', function speech(data) {
    WS.say('you said ' + data);
});
qr(Function callback) : void

Open a QR scanner, return scan results via a callback from zxing

Callback of the form function mycallback(data, format)
String data:The scanned data (e.g., http://wearscript.com) is returned
String format:The format of the data (e.g., QR_CODE)
WS.qr(function (data) {
    WS.say(data);
});