- sensorOff(int type) : void
- Turns off sensor
- sensorOn(String type, double period, [Function callback]) : void
Turn on the sensor and produce data no faster than the specific period. Optional callback name that is called at most once per period of the form function callback(data) with data being an object with the properties:
Unique sensor name (uses Android name if one exists)
Unique sensor type (uses Android type if one exists), convert between them using WS.sensor(name) -> type
Epoch seconds from when we get the sensor sample (use this instead of Raw unless you know better)
Potentially differs per sensor (we use what they give us if available), but currently all but the light sensor are nanosec from device uptime
Array of float values (see WS.sensor docs for description)
- For the Android built in sensors see the Android docs for their values, custom values are:
- battery: Values [battery_percentage] (same as displayed in the Glass settings)
- pupil: Values [pupil_y, pupil_x, radius]
- gps: Values [lat, lon]
- WS.beacon(fn range, fn enter, fn exit) : void
- Starts scanning for beacons and performs callbacks. The fields in the callback are channel_name, UUID, powerLevel, majorNum, and minorNum.
Sensors have unique names and integer types that are used internally and can be used as WS.sensor(‘light’) which returns 5. The standard Android sensor types are positive and custom types are given negative numbers.