Ocean
Loading...
Searching...
No Matches
Sensor.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_SENSOR_H
9#define META_OCEAN_DEVICES_SENSOR_H
10
13
14namespace Ocean
15{
16
17namespace Devices
18{
19
20// Forward declaration.
21class Sensor;
22
23/**
24 * Definition of a sensor reference object.
25 * @see Sensor.
26 * @ingroup devices
27 */
29
30/**
31 * This class implements the base class for all sensors.
32 * Sensor provides measurement values, their types depend on the sensors.
33 * @ingroup devices
34 */
35class OCEAN_DEVICES_EXPORT Sensor : virtual public Measurement
36{
37 public:
38
39 /**
40 * Definition of different sensor types.
41 */
42 enum SensorType : uint32_t
43 {
44 /// Invalid sensor.
45 SENSOR_INVALID = MINOR_INVALID,
46 /// 3DOF acceleration sensor.
48 /// 3DOF linear acceleration sensor (excluding gravity).
50 /// 3DOF gyro sensor (raw samples).
52 /// 3DOF gyro sensor (unbiased samples).
53 SENSOR_GYRO_UNBIASED_3DOF
54 };
55
56 /**
57 * Translates the sensor type to a readable string.
58 * @param sensorType The sensor type to translate
59 * @return The readable string, empty if the type is unknown
60 */
61 static std::string translateSensorType(const SensorType sensorType);
62
63 /**
64 * Translates the sensor type from a readable string to a value.
65 * @param sensorType The sensor type to translate
66 * @return The tanslated value
67 */
68 static SensorType translateSensorType(const std::string& sensorType);
69
70 protected:
71
72 /**
73 * Creates a new sensor object.
74 * @param name The name of the sensor
75 * @param type Major and minor device type of the device
76 */
77 Sensor(const std::string& name, const DeviceType type);
78
79 /**
80 * Destructs a sensor object.
81 */
82 virtual ~Sensor();
83};
84
85}
86
87}
88
89#endif // META_OCEAN_DEVICES_SENSOR_H
Definition of a class holding the major and minor device type.
Definition devices/Device.h:62
This class implements the base class for all devices providing measurement samples.
Definition Measurement.h:40
This class implements the base class for all sensors.
Definition Sensor.h:36
virtual ~Sensor()
Destructs a sensor object.
static std::string translateSensorType(const SensorType sensorType)
Translates the sensor type to a readable string.
static SensorType translateSensorType(const std::string &sensorType)
Translates the sensor type from a readable string to a value.
Sensor(const std::string &name, const DeviceType type)
Creates a new sensor object.
SensorType
Definition of different sensor types.
Definition Sensor.h:43
@ SENSOR_ACCELERATION_3DOF
3DOF acceleration sensor.
Definition Sensor.h:47
@ SENSOR_LINEAR_ACCELERATION_3DOF
3DOF linear acceleration sensor (excluding gravity).
Definition Sensor.h:49
@ SENSOR_GYRO_RAW_3DOF
3DOF gyro sensor (raw samples).
Definition Sensor.h:51
This template class implements a smart object reference which is a specialization of an ObjectRef obj...
Definition SmartObjectRef.h:90
SmartObjectRef< Sensor, Device > SensorRef
Definition of a sensor reference object.
Definition Sensor.h:28
The namespace covering the entire Ocean framework.
Definition Accessor.h:15