8 #ifndef META_OCEAN_DEVICES_ANDROID_ANDROID_SENSOR_H
9 #define META_OCEAN_DEVICES_ANDROID_ANDROID_SENSOR_H
19 #include <android/sensor.h>
77 ALooper* looper_ =
nullptr;
89 AST_ACCELEROMETER = 1,
91 AST_MAGNETIC_FIELD = 2,
107 AST_LINEAR_ACCELERATION = 10,
109 AST_ROTATION_VECTOR = 11,
111 AST_RELATIVE_HUMIDITY = 12,
113 AST_AMBIENT_TEMPERATURE = 13,
114 AST_MAGNETIC_FIELD_UNCALIBRATED = 14,
115 AST_GAME_ROTATION_VECTOR = 15,
116 AST_GYROSCOPE_UNCALIBRATED = 16,
117 AST_SIGNIFICANT_MOTION = 17,
118 AST_STEP_DETECTOR = 18,
119 AST_STEP_COUNTER = 19,
120 AST_GEOMAGNETIC_ROTATION_VECTOR = 20,
123 AST_STATIONARY_DETECT = 29,
124 AST_MOTION_DETECT = 30,
184 static inline int onEventFunctionStatic(
int fd,
int events,
void* data);
192 ASensorManager* sensorManager_ =
nullptr;
195 const ASensor* sensor_ =
nullptr;
198 ASensorEventQueue* eventQueue_ =
nullptr;
201 bool isStarted_ =
false;
213 if (androidDevice ==
nullptr)
219 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:50
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:41
AndroidSensor(const std::string &name, const DeviceType type)
Creates a new sensor by its name and type.
static ASensorManager * sensorManager()
Returns the instance of the sensor manager.
bool pause() override
Pauses the device.
static int onEventFunctionStatic(int fd, int events, void *data)
The static event function.
Definition: AndroidSensor.h:204
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:87
virtual int onEventFunction()=0
The actual event function of this device.
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
const ObjectId invalidObjectId
Definition of an invalid object id.
Definition: rendering/Rendering.h:65
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15