Ocean
Loading...
Searching...
No Matches
IOSGyroSensor3DOF.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_IOS_IOS_GYRO_SENSOR_3_DOF_H
9#define META_OCEAN_DEVICES_IOS_IOS_GYRO_SENSOR_3_DOF_H
10
14
16
17namespace Ocean
18{
19
20namespace Devices
21{
22
23namespace IOS
24{
25
26/**
27 * This class implements all 3DOF gyro sensors (including the raw and unbiased gyro sensors).
28 * @ingroup devicesios
29 */
30class OCEAN_DEVICES_IOS_EXPORT IOSGyroSensor3DOF :
31 virtual public IOSSensor,
32 virtual public GyroSensor3DOF
33{
34 friend class IOSFactory;
35
36 public:
37
38 /**
39 * Starts the device.
40 * @see Device::start().
41 */
42 virtual bool start();
43
44 /**
45 * Pauses the device.
46 * @see Device::pause().
47 */
48 virtual bool pause();
49
50 /**
51 * Stops the device.
52 * @see Device::stop().
53 */
54 virtual bool stop();
55
56 /**
57 * Returns the name of this sensor.
58 * @param sensorType The type of the sensor (the subtype of the device), can be SENSOR_GYRO_RAW_3DOF or SENSOR_GYRO_UNBIASED_3DOF
59 * @return The sensor's name
60 */
61 static inline std::string deviceNameIOSGyroSensor3DOF(const SensorType sensorType);
62
63 /**
64 * Returns the device type of this sensor.
65 * @param sensorType The type of the sensor (the subtype of the device), can be SENSOR_GYRO_RAW_3DOF or SENSOR_GYRO_UNBIASED_3DOF
66 * @return The sensor's device type
67 */
68 static inline DeviceType deviceTypeIOSGyroSensor3DOF(const SensorType sensorType);
69
70 protected:
71
72 /**
73 * Creates a new 3DOF gyro sensor device.
74 * @param sensorType The type of the sensor (the subtype of the device), can be SENSOR_GYRO_RAW_3DOF or SENSOR_GYRO_UNBIASED_3DOF
75 */
76 IOSGyroSensor3DOF(const SensorType sensorType);
77
78 /**
79 * Destructs a 3DOF gyro sensor device.
80 */
82
83 private:
84
85 /**
86 * Callback function when using SENSOR_GYRO_UNBIASED_3DOF.
87 * @param deviceMotion iOS DeviceMotion readout
88 */
89 void onDeviceMotion(CMDeviceMotion* deviceMotion);
90
91 private:
92
93 // Callback id when using SENSOR_GYRO_UNBIASED_3DOF.
94 MotionManager::ListenerId deviceMotionListenerId_ = MotionManager::invalidListenerId();
95};
96
98{
99 ocean_assert(sensorType == SENSOR_GYRO_RAW_3DOF || sensorType == SENSOR_GYRO_UNBIASED_3DOF);
100
101 if (sensorType == SENSOR_GYRO_RAW_3DOF)
102 {
103 return std::string("IOS 3DOF Gyro Raw Sensor");
104 }
105
106 return std::string("IOS 3DOF Gyro Unbiased Sensor");
107}
108
110{
111 ocean_assert(sensorType == SENSOR_GYRO_RAW_3DOF || sensorType == SENSOR_GYRO_UNBIASED_3DOF);
112
113 return deviceTypeGyroSensor3DOF(sensorType);
114}
115
116}
117
118}
119
120}
121
122#endif // META_OCEAN_DEVICES_IOS_IOS_GYRO_SENSOR_3_DOF_H
Definition of a class holding the major and minor device type.
Definition devices/Device.h:62
This class is the base class for all 3DOF gyro sensors.
Definition GyroSensor3DOF.h:40
static DeviceType deviceTypeGyroSensor3DOF(const SensorType sensorType)
Returns this device type.
Definition GyroSensor3DOF.h:116
This class implements a device factory for the IOS feature based tracking system.
Definition IOSFactory.h:29
This class implements all 3DOF gyro sensors (including the raw and unbiased gyro sensors).
Definition IOSGyroSensor3DOF.h:33
virtual ~IOSGyroSensor3DOF()
Destructs a 3DOF gyro sensor device.
virtual bool start()
Starts the device.
virtual bool pause()
Pauses the device.
IOSGyroSensor3DOF(const SensorType sensorType)
Creates a new 3DOF gyro sensor device.
static DeviceType deviceTypeIOSGyroSensor3DOF(const SensorType sensorType)
Returns the device type of this sensor.
Definition IOSGyroSensor3DOF.h:109
static std::string deviceNameIOSGyroSensor3DOF(const SensorType sensorType)
Returns the name of this sensor.
Definition IOSGyroSensor3DOF.h:97
virtual bool stop()
Stops the device.
void onDeviceMotion(CMDeviceMotion *deviceMotion)
Callback function when using SENSOR_GYRO_UNBIASED_3DOF.
This class implements a sensor for the IOS library.
Definition IOSSensor.h:36
unsigned int ListenerId
Definition of a listener id for a registered callbacks.
Definition MotionManager.h:43
SensorType
Definition of different sensor types.
Definition Sensor.h:43
@ SENSOR_GYRO_RAW_3DOF
3DOF gyro sensor (raw samples).
Definition Sensor.h:51
@ SENSOR_GYRO_UNBIASED_3DOF
3DOF gyro sensor (unbiased samples).
Definition Sensor.h:53
The namespace covering the entire Ocean framework.
Definition Accessor.h:15