8#ifndef META_OCEAN_DEVICES_ANDROID_ANDROID_SENSOR_H
9#define META_OCEAN_DEVICES_ANDROID_ANDROID_SENSOR_H
20#include <android/sensor.h>
78 ALooper* looper_ =
nullptr;
90 AST_ACCELEROMETER = 1,
92 AST_MAGNETIC_FIELD = 2,
108 AST_LINEAR_ACCELERATION = 10,
110 AST_ROTATION_VECTOR = 11,
112 AST_RELATIVE_HUMIDITY = 12,
114 AST_AMBIENT_TEMPERATURE = 13,
115 AST_MAGNETIC_FIELD_UNCALIBRATED = 14,
116 AST_GAME_ROTATION_VECTOR = 15,
117 AST_GYROSCOPE_UNCALIBRATED = 16,
118 AST_SIGNIFICANT_MOTION = 17,
119 AST_STEP_DETECTOR = 18,
120 AST_STEP_COUNTER = 19,
121 AST_GEOMAGNETIC_ROTATION_VECTOR = 20,
124 AST_STATIONARY_DETECT = 29,
125 AST_MOTION_DETECT = 30,
127 AST_DYNAMIC_SENSOR_META = 32,
128 AST_ADDITIONAL_INFO = 33,
129 AST_LOW_LATENCY_OFFBODY_DETECT = 34,
130 AST_ACCELEROMETER_UNCALIBRATED = 35,
131 AST_HINGE_ANGLE = 36,
132 AST_HEAD_TRACKER = 37,
133 AST_ACCELEROMETER_LIMITED_AXES = 38,
134 AST_GYROSCOPE_LIMITED_AXES = 39,
135 AST_ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = 40,
136 AST_GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41,
206 static inline int onEventFunctionStatic(
int fd,
int events,
void* data);
220 ASensorManager* sensorManager_ =
nullptr;
223 const ASensor* sensor_ =
nullptr;
226 ASensorEventQueue* eventQueue_ =
nullptr;
229 bool isStarted_ =
false;
244 if (androidDevice ==
nullptr)
250 ocean_assert(androidSensor !=
nullptr);
This class implements a device for the Android library.
Definition AndroidDevice.h:29
This class implements the manager for the looper thread.
Definition AndroidSensor.h:51
ALooper * looper()
Returns the looper of the manager.
LooperManager()
Creates a new manager object and creates a looper.
void threadRun() override
Thread run function.
This class implements a sensor for the Android library.
Definition AndroidSensor.h:42
static Timestamp::TimestampConverter & timestampConverter()
Returns the timestamp converter for all android sensors.
AndroidSensor(const std::string &name, const DeviceType type)
Creates a new sensor by its name and type.
bool pause() override
Pauses the device.
static int onEventFunctionStatic(int fd, int events, void *data)
The static event function.
Definition AndroidSensor.h:235
bool start() override
Starts the device.
bool stop() override
Stops the device.
bool registerForEventFunction(ASensorManager *sensorManager)
Registers this sensor for the event function.
AndroidSensorType
Definition of Android sensor types as defined by the Android API.
Definition AndroidSensor.h:88
virtual int onEventFunction()=0
The actual event function of this device.
Timestamp convertTimestamp(const ASensorEvent &sensorEvent, Timestamp &relativeTimestamp)
Returns the relative and unix timestamp of an Android sensor event.
static ASensorManager * sensorManager()
Returns the instance of the sensor manager.
Definition of a class holding the major and minor device type.
Definition devices/Device.h:62
unsigned int ObjectId
Definition of an object id.
Definition Measurement.h:46
This class implements the base class for all sensors.
Definition Sensor.h:36
This template class is the base class for all singleton objects.
Definition Singleton.h:71
This class implements a thread.
Definition Thread.h:115
This class is a helper class allowing to converter timestamps defined in a specific time domain to un...
Definition Timestamp.h:54
This class implements a timestamp.
Definition Timestamp.h:47
The namespace covering the entire Ocean framework.
Definition Accessor.h:15