@@ -449,6 +449,68 @@ class drvBase {
449
449
*/
450
450
virtual bool getEventMagneticField (sensors_event_t *magneticEvent) { return false ; }
451
451
452
+ /* !
453
+ @brief Gets a sensor's gravity vector value.
454
+ @param gravityEvent
455
+ The gravity vector (x, y, z) in m/s^2.
456
+ @returns True if the sensor value was obtained successfully, False
457
+ otherwise.
458
+ */
459
+ virtual bool getEventGravity (sensors_event_t *gravityEvent) { return false ; }
460
+
461
+ /* !
462
+ @brief Gets a sensor's linear acceleration vector value.
463
+ @param linearAccelEvent
464
+ The linear acceleration vector (x, y, z) in m/s^2.
465
+ @returns True if the sensor value was obtained successfully, False
466
+ otherwise.
467
+ */
468
+ virtual bool getEventLinearAcceleration (sensors_event_t *linearAccelEvent) { return false ; }
469
+
470
+ /* !
471
+ @brief Gets a sensor's rotation vector value.
472
+ @param rotationEvent
473
+ The rotation vector (x, y, z, w) in radians.
474
+ @returns True if the sensor value was obtained successfully, False
475
+ otherwise.
476
+ */
477
+ virtual bool getEventRotationVector (sensors_event_t *rotationEvent) { return false ; }
478
+
479
+ /* !
480
+ @brief Gets a sensor's gyroscope value.
481
+ @param gyroEvent
482
+ The gyroscope vector (x, y, z) in rad/s.
483
+ @returns True if the sensor value was obtained successfully, False
484
+ otherwise.
485
+ */
486
+ virtual bool getEventGyroscope (sensors_event_t *gyroEvent) { return false ; }
487
+ /* !
488
+ @brief Gets a sensor's accelerometer value.
489
+ @param accelEvent
490
+ The accelerometer vector (x, y, z) in m/s^2.
491
+ @returns True if the sensor value was obtained successfully, False
492
+ otherwise.
493
+ */
494
+ virtual bool getEventAccelerometer (sensors_event_t *accelEvent) { return false ; }
495
+
496
+ /* !
497
+ @brief Gets a sensor's orientation value.
498
+ @param orientationEvent
499
+ The orientation vector (x, y, z) in degrees.
500
+ @returns True if the sensor value was obtained successfully, False
501
+ otherwise.
502
+ */
503
+ virtual bool getEventOrientation (sensors_event_t *orientationEvent) { return false ; }
504
+
505
+ /* !
506
+ @brief Gets a sensor's rotation vector value.
507
+ @param rotationEvent
508
+ The rotation vector (x, y, z, w) in radians.
509
+ @returns True if the sensor value was obtained successfully, False
510
+ otherwise.
511
+ */
512
+ virtual bool getEventRotationVector (sensors_event_t *rotationEvent) { return false ; }
513
+
452
514
/* !
453
515
@brief Gets a sensor's Raw value.
454
516
@param rawEvent
@@ -678,7 +740,32 @@ class drvBase {
678
740
{wippersnapper_sensor_SensorType_SENSOR_TYPE_MAGNETIC_FIELD,
679
741
[this ](sensors_event_t *event) -> bool {
680
742
return this ->getEventMagneticField (event);
681
- }}}; // /< SensorType to function call map
743
+ }},
744
+ {wippersnapper_sensor_SensorType_SENSOR_TYPE_ACCELEROMETER,
745
+ [this ](sensors_event_t *event) -> bool {
746
+ return this ->getEventAccelerometer (event);
747
+ }},
748
+ {wippersnapper_sensor_SensorType_SENSOR_TYPE_GYROSCOPE,
749
+ [this ](sensors_event_t *event) -> bool {
750
+ return this ->getEventGyroscope (event);
751
+ }},
752
+ {wippersnapper_sensor_SensorType_SENSOR_TYPE_ORIENTATION,
753
+ [this ](sensors_event_t *event) -> bool {
754
+ return this ->getEventOrientation (event);
755
+ }},
756
+ {wippersnapper_sensor_SensorType_SENSOR_TYPE_GRAVITY,
757
+ [this ](sensors_event_t *event) -> bool {
758
+ return this ->getEventGravity (event);
759
+ }},
760
+ {wippersnapper_sensor_SensorType_SENSOR_TYPE_LINEAR_ACCELERATION,
761
+ [this ](sensors_event_t *event) -> bool {
762
+ return this ->getEventLinearAcceleration (event);
763
+ }},
764
+ {wippersnapper_sensor_SensorType_SENSOR_TYPE_ROTATION_VECTOR,
765
+ [this ](sensors_event_t *event) -> bool {
766
+ return this ->getEventRotationVector (event);
767
+ }}
768
+ }; // /< SensorType to function call map
682
769
683
770
wippersnapper_sensor_SensorType
684
771
_sensors[15 ]; // /< Sensors attached to the device.
0 commit comments