Ocean
AndroidGravityTracker3DOF.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_DEVICES_ANDROID_ANDROID_GRAVITY_TRACKER_3_DOF_H
9 #define META_OCEAN_DEVICES_ANDROID_ANDROID_GRAVITY_TRACKER_3_DOF_H
10 
13 
15 
16 namespace Ocean
17 {
18 
19 namespace Devices
20 {
21 
22 namespace Android
23 {
24 
25 /**
26  * This class implements a tracker providing the gravity direction as 3-DOF orientation.
27  * The resulting transformation (3DOF orientation) is defined w.r.t. the device's coordinate system and rotates the negative y-axis so that it points towards gravity (the rotated positive y-axis points towards sky).<br>
28  * @ingroup devicesandroid
29  */
30 class OCEAN_DEVICES_EXPORT AndroidGravityTracker3DOF :
31  virtual public AndroidSensor,
32  virtual public OrientationTracker3DOF
33 {
34  friend class AndroidFactory;
35 
36  public:
37 
38  /**
39  * Returns the name of this tracker.
40  * @return The tracker's name
41  */
42  static inline std::string deviceNameAndroidGravityTracker3DOF();
43 
44  protected:
45 
46  /**
47  * Creates a new 3DOF gravity tracker device.
48  * @param sensor The Android sensor providing the sensor measurements, must be valid
49  */
50  explicit AndroidGravityTracker3DOF(const ASensor* sensor);
51 
52  /**
53  * Destructs a 3DOF gravity tracker device.
54  */
56 
57  /**
58  * The actual event function of this device.
59  * @see AndroidDevice::onEventFunction().
60  */
61  int onEventFunction() override;
62 
63  protected:
64 
65  /// The Android event timestamp of the first sensor event.
66  int64_t firstAndroidEventTimestamp_ = 0ll;
67 
68  /// The Unix event timestamp of the first sensor event.
69  Timestamp firstUnixEventTimestamp_ = Timestamp(false);
70 };
71 
73 {
74  return std::string("Android 3DOF Gravity Tracker");
75 }
76 
77 }
78 
79 }
80 
81 }
82 
83 #endif // META_OCEAN_DEVICES_ANDROID_ANDROID_GRAVITY_TRACKER_3_DOF_H
This class implements a device factory for the Android feature based tracking system.
Definition: AndroidFactory.h:31
This class implements a tracker providing the gravity direction as 3-DOF orientation.
Definition: AndroidGravityTracker3DOF.h:33
static std::string deviceNameAndroidGravityTracker3DOF()
Returns the name of this tracker.
Definition: AndroidGravityTracker3DOF.h:72
~AndroidGravityTracker3DOF() override
Destructs a 3DOF gravity tracker device.
AndroidGravityTracker3DOF(const ASensor *sensor)
Creates a new 3DOF gravity tracker device.
int onEventFunction() override
The actual event function of this device.
This class implements a sensor for the Android library.
Definition: AndroidSensor.h:41
This class is the base class for all 3DOF orientation tracker objects.
Definition: OrientationTracker3DOF.h:38
This class implements a timestamp.
Definition: Timestamp.h:36
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15