Android Sensor¶
- class enamlnative.android.android_sensors.Sensor(*args, **kwargs)[source]¶
Bases:
enamlnative.android.bridge.JavaBridgeObject
A wrapper for an Android sensor. This should be retrieved using the Sensor.get(sensor_type) method.
Examples
# In a function with an @inlineCallbacks or @coroutine decorator def on_data(data):
# Handle data here… # data is a dict with keys # {‘acc’: <accuracy>, ‘data’: [v1, v2, …], ‘sensor’: id, ‘time’: t}
- def on_ready(sensor):
- if sensor is not None:
sensor.start(callback=on_data) # … sensor.stop()
- manager¶
Reference to the sensor manager
- type¶
Sensor type
- started¶
Sensor state
- async classmethod get(sensor_type: int) Optional[enamlnative.android.android_sensors.Sensor] [source]¶
Shortcut that acquires the default Sensor of a given type.
- Parameters
sensor_type (int) – Type of sensor to get.
- Returns
result – A future that resolves to an instance of the Sensor or None if the sensor is not present or access is not allowed.
- Return type
Future