Package-level declarations
Types
Reads the TYPE_ACCELEROMETER sensor (x/y/z acceleration in m/s2). No permissions. With duration_ms (1-5000) it collects a series of samples; otherwise it captures a single reading. See sampleSensor for the sampling/timeout mechanics. Output: latest x, y, z, accuracy, timestamp, plus a readings list of {x,y,z,timestamp}. Returns ToolResult.error (with distinct messages) if no reading arrives in time or when the device has no accelerometer.
Reads the TYPE_GYROSCOPE sensor (x/y/z angular rate in rad/s). No permissions. With duration_ms (1-5000) it collects a series of samples; otherwise a single reading. See sampleSensor. Output: latest x, y, z, accuracy, timestamp, plus a readings list of {x,y,z,timestamp}. Returns ToolResult.error (with distinct messages) if no reading arrives in time or when the device has no gyroscope.
Reads the TYPE_LIGHT ambient-light sensor (illuminance in lux). No permissions. With duration_ms (1-5000) it collects a series of samples; otherwise a single reading. See sampleSensor. Output: latest lux, accuracy, timestamp, plus a readings list of {lux,timestamp}. Returns ToolResult.error (with distinct messages) if no reading arrives in time or when the device has no light sensor.
Reads the TYPE_PROXIMITY sensor. No permissions. Many devices report only binary near/far rather than a true centimetre distance. With duration_ms (1-5000) it collects a series of samples; otherwise a single reading. See sampleSensor. Output: latest distance_cm, is_near (distance < 5cm), accuracy, timestamp, plus a readings list of {distance_cm,is_near,timestamp}. Returns ToolResult.error (with distinct messages) if no reading arrives in time or when the device has no proximity sensor.
A single sensor sample captured by sampleSensor.
Outcome of sampleSensor: distinguishes a missing sensor from one that stayed silent.
Provider for the motion/environment sensor tools (accelerometer, gyroscope, light, proximity). None of these require any permission.
Functions
Backwards-compatible wrapper over sampleSensor: returns the readings, or null if the sensor is absent or produced no reading in time. Prefer sampleSensor, which distinguishes the two.
Registers a listener on the default sensor of sensorType and collects readings.