8#ifndef META_OCEAN_DEVICES_ANDROID_ANDROID_EVENT_DEVICE_H
9#define META_OCEAN_DEVICES_ANDROID_ANDROID_EVENT_DEVICE_H
20#include <android/sensor.h>
250 if (androidDevice ==
nullptr)
256 ocean_assert(androidEventDevice !=
nullptr);
258 if (androidEventDevice)
AndroidDevice(const std::string &name, const DeviceType type)
Creates a new device by is name.
void threadRun() override
Thread run function.
LooperManager()
Creates a new manager object and creates a looper.
ALooper * looper_
The looper of this manager.
Definition AndroidEventDevice.h:78
ALooper * looper()
Returns the looper of the manager.
bool registerForEventFunction(ASensorManager *sensorManager)
Registers this sensor for the event function.
TimestampConverter & timestampConverter_
The timestamp converter of this sensor.
Definition AndroidEventDevice.h:238
virtual int onEventFunction()=0
The actual event function of this device.
AndroidEventDevice(const std::string &name, const DeviceType type)
Creates a new event device by its name and type.
bool isStarted_
True, if this sensor is started.
Definition AndroidEventDevice.h:235
Timestamp convertTimestamp(const ASensorEvent &sensorEvent, Timestamp &relativeTimestamp)
Returns the relative and unix timestamp of an Android sensor event.
static int onEventFunctionStatic(int fd, int events, void *data)
The static event function.
Definition AndroidEventDevice.h:241
ASensorManager * sensorManager_
The sensor manager of this device.
Definition AndroidEventDevice.h:226
const ASensor * sensor_
The Android NDK sensor of this device.
Definition AndroidEventDevice.h:229
AndroidSensorType
Definition of Android sensor types as defined by the Android API.
Definition AndroidEventDevice.h:88
@ AST_HINGE_ANGLE
Definition AndroidEventDevice.h:131
@ AST_ROTATION_VECTOR
Measures the orientation of a device by providing the three elements of the device's rotation vector.
Definition AndroidEventDevice.h:110
@ AST_SIGNIFICANT_MOTION
Definition AndroidEventDevice.h:118
@ AST_STATIONARY_DETECT
Definition AndroidEventDevice.h:124
@ AST_GYROSCOPE
Measures a device's rate of rotation in rad/s around each of the three physical axes (x,...
Definition AndroidEventDevice.h:96
@ AST_DYNAMIC_SENSOR_META
Definition AndroidEventDevice.h:127
@ AST_STEP_COUNTER
Definition AndroidEventDevice.h:120
@ AST_ACCELEROMETER_LIMITED_AXES
Definition AndroidEventDevice.h:133
@ AST_ACCELEROMETER_UNCALIBRATED
Definition AndroidEventDevice.h:130
@ AST_HEAD_TRACKER
Definition AndroidEventDevice.h:132
@ AST_MAGNETIC_FIELD_UNCALIBRATED
Definition AndroidEventDevice.h:115
@ AST_LINEAR_ACCELERATION
Measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x,...
Definition AndroidEventDevice.h:108
@ AST_END
Definition AndroidEventDevice.h:139
@ AST_ADDITIONAL_INFO
Definition AndroidEventDevice.h:128
@ AST_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED
Definition AndroidEventDevice.h:135
@ AST_RELATIVE_HUMIDITY
Measures the relative ambient humidity in percent (%).
Definition AndroidEventDevice.h:112
@ AST_LIGHT
Measures the ambient light level (illumination) in lx.
Definition AndroidEventDevice.h:98
@ AST_AMBIENT_TEMPERATURE
Measures the ambient room temperature in degrees Celsius.
Definition AndroidEventDevice.h:114
@ AST_HEADING
Definition AndroidEventDevice.h:137
@ AST_ACCELEROMETER
Measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x,...
Definition AndroidEventDevice.h:90
@ AST_HEART_RATE
Definition AndroidEventDevice.h:122
@ AST_GEOMAGNETIC_ROTATION_VECTOR
Definition AndroidEventDevice.h:121
@ AST_GYROSCOPE_LIMITED_AXES
Definition AndroidEventDevice.h:134
@ AST_ORIENTATION
Measures degrees of rotation that a device makes around all three physical axes (x,...
Definition AndroidEventDevice.h:94
@ AST_MAGNETIC_FIELD
Measures the ambient geomagnetic field for all three physical axes (x, y, z) in microT.
Definition AndroidEventDevice.h:92
@ AST_MOTION_DETECT
Definition AndroidEventDevice.h:125
@ AST_GYROSCOPE_UNCALIBRATED
Definition AndroidEventDevice.h:117
@ AST_STEP_DETECTOR
Definition AndroidEventDevice.h:119
@ AST_POSE_6DOF
Definition AndroidEventDevice.h:123
@ AST_PRESSURE
Measures the ambient air pressure in hPa or mbar.
Definition AndroidEventDevice.h:100
@ AST_LOW_LATENCY_OFFBODY_DETECT
Definition AndroidEventDevice.h:129
@ AST_GRAVITY
Measures the force of gravity in m/s2 that is applied to a device on all three physical axes (x,...
Definition AndroidEventDevice.h:106
@ AST_GAME_ROTATION_VECTOR
Definition AndroidEventDevice.h:116
@ AST_TEMPERATURE
Measures the temperature of the device in degrees Celsius. This sensor implementation varies across d...
Definition AndroidEventDevice.h:102
@ AST_PROXIMITY
Measures the proximity of an object in cm relative to the view screen of a device....
Definition AndroidEventDevice.h:104
@ AST_HEART_BEAT
Definition AndroidEventDevice.h:126
@ AST_GYROSCOPE_LIMITED_AXES_UNCALIBRATED
Definition AndroidEventDevice.h:136
bool start() override
Starts the device.
ASensorEventQueue * eventQueue_
The Android NDK event queue of this device.
Definition AndroidEventDevice.h:232
bool pause() override
Pauses the device.
ObjectId sensorObjectId_
The object id of this sensor.
Definition AndroidEventDevice.h:223
bool stop() override
Stops the device.
static ASensorManager * sensorManager()
Returns the instance of the sensor manager.
static TimestampConverter & timestampConverter()
Returns the timestamp converter for all android sensors.
bool isStarted() const override
Returns whether this device is active.
Definition of a class holding the major and minor device type.
Definition devices/Device.h:62
DeviceType type() const
Returns the major and minor type of this device.
Definition devices/Device.h:345
const std::string & name() const
Returns the name of this device.
Definition devices/Device.h:340
static constexpr ObjectId invalidObjectId()
Returns an invalid object id.
Definition Measurement.h:631
uint32_t ObjectId
Definition of an object id.
Definition Measurement.h:47
Measurement(const std::string &name, const DeviceType type)
Creates a new measurement object.
Thread(const std::string &name=std::string())
Creates a new thread object.
This class is a helper class allowing to converter timestamps defined in a specific time domain to un...
Definition Timestamp.h:313
This class implements a timestamp.
Definition Timestamp.h:64
Namespace of the Devices Android library.
Definition devices/android/Android.h:20
Namespace of the Devices library.
Definition AccelerationSensor3DOF.h:24
The namespace covering the entire Ocean framework.
Definition Accessor.h:15