diff options
author | Marco Residori <marco.residori@xse.de> | 2014-04-24 13:43:52 +0200 |
---|---|---|
committer | Marco Residori <marco.residori@xse.de> | 2014-04-24 13:43:52 +0200 |
commit | a02572b0d478ef021e1f9365ad5865232eabd131 (patch) | |
tree | 747b9606a23c50b466e9985c7b391ba54461d4f7 /sensors-service/api | |
download | positioning-a02572b0d478ef021e1f9365ad5865232eabd131.tar.gz |
GT-3001: Migrate LBS-Positioning (commit-ID c8125a06f44c96cf4af27b5849486d830a613e5f) to new Git repository
Diffstat (limited to 'sensors-service/api')
-rw-r--r-- | sensors-service/api/acceleration.h | 224 | ||||
-rw-r--r-- | sensors-service/api/gyroscope.h | 226 | ||||
-rw-r--r-- | sensors-service/api/inclination.h | 127 | ||||
-rw-r--r-- | sensors-service/api/odometer.h | 121 | ||||
-rw-r--r-- | sensors-service/api/reverse-gear.h | 113 | ||||
-rw-r--r-- | sensors-service/api/slip-angle.h | 116 | ||||
-rw-r--r-- | sensors-service/api/sns-meta-data.h | 82 | ||||
-rw-r--r-- | sensors-service/api/sns.h | 58 | ||||
-rw-r--r-- | sensors-service/api/steering-angle.h | 134 | ||||
-rw-r--r-- | sensors-service/api/vehicle-data.h | 143 | ||||
-rw-r--r-- | sensors-service/api/vehicle-speed.h | 109 | ||||
-rw-r--r-- | sensors-service/api/vehicle-state.h | 118 | ||||
-rw-r--r-- | sensors-service/api/wheel.h | 322 |
13 files changed, 1893 insertions, 0 deletions
diff --git a/sensors-service/api/acceleration.h b/sensors-service/api/acceleration.h new file mode 100644 index 0000000..db040ac --- /dev/null +++ b/sensors-service/api/acceleration.h @@ -0,0 +1,224 @@ +/************************************************************************** + * @licence app begin@ + * + * SPDX-License-Identifier: MPL-2.0 + * + * \ingroup SensorsService + * \brief Compliance Level: Abstract Component + * \copyright Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH + * + * \license + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * @licence end@ + **************************************************************************/ + +#ifndef INCLUDED_GENIVI_ACCELERATION +#define INCLUDED_GENIVI_ACCELERATION + +#include "sns-meta-data.h" +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * TAccelerationConfiguration::validityBits provides information about the currently valid signals of the acceleration configuration data. + * It is a or'ed bitmask of the EAccelerationConfigValidityBits values. + */ +typedef enum { + ACCELERATION_CONFIG_DISTX_VALID = 0x00000001, /**< Validity bit for field TAccelerationConfiguration::dist2RefPointX. */ + ACCELERATION_CONFIG_DISTY_VALID = 0x00000002, /**< Validity bit for field TAccelerationConfiguration::dist2RefPointY. */ + ACCELERATION_CONFIG_DISTZ_VALID = 0x00000004, /**< Validity bit for field TAccelerationConfiguration::dist2RefPointZ. */ + ACCELERATION_CONFIG_ANGLEYAW_VALID = 0x00000008, /**< Validity bit for field TAccelerationConfiguration::angleYaw. */ + ACCELERATION_CONFIG_ANGLEPITCH_VALID= 0x00000010, /**< Validity bit for field TAccelerationConfiguration::anglePitch. */ + ACCELERATION_CONFIG_ANGLEROLL_VALID = 0x00000020, /**< Validity bit for field TAccelerationConfiguration::angleRoll. */ + ACCELERATION_CONFIG_SIGMAX_VALID = 0x00000040, /**< Validity bit for field TAccelerationConfiguration::sigmaX. */ + ACCELERATION_CONFIG_SIGMAY_VALID = 0x00000080, /**< Validity bit for field TAccelerationConfiguration::sigmaX. */ + ACCELERATION_CONFIG_SIGMAZ_VALID = 0x00000100, /**< Validity bit for field TAccelerationConfiguration::sigmaZ. */ + ACCELERATION_CONFIG_TYPE_VALID = 0x00000200 /**< Validity bit for field TAccelerationConfiguration::typeBits. */ +} EAccelerationConfigValidityBits; + + +/** + * Accelerometer type + * TAccelerationConfiguration::typeBits provides information about the type of the accelerometer and the interpretation of the signals. + * It is a or'ed bitmask of the EGyroscopeTypeBits values. + */ +typedef enum { + ACCELERATION_X_PROVIDED = 0x00000001, /**< An acceleration measurement for the x-axis is provided */ + ACCELERATION_Y_PROVIDED = 0x00000002, /**< An acceleration measurement for the y-axis is provided */ + ACCELERATION_Z_PROVIDED = 0x00000004, /**< An acceleration measurement for the z-axis is provided */ + ACCELERATION_TEMPERATURE_PROVIDED = 0x00000008 /**< A measurement for the temperature is provided */ +} EAccelerationTypeBits; + + +/** + * Static configuration data for the acceleration sensor service. + * + * BEGIN Explanation of the angleYaw, anglePitch angleRoll parameters + * The orientation of the accelerometer hardware (Xa, Ya, Za) + * with respect to the vehicle axis system (Xv, Yv, Zv) + * can be described using the angles (angleYaw, anglePitch, angleRoll) + * following the approach defined in ISO 8855:2011, section 5.2, table 1 + * Apply 3 rotations on the vehicle axis system until it matches the accelerometer axis system + * The rotation sequence is as follows + * - first rotate by angleYaw about the Zv axis + * - second rotate by anglePitch about the new (intermediate) Y axis + * - third rotate by angleRoll about the new X axis + * Notes + * - the angles are frequently called "Euler angles" and the rotations "Euler rotations" + * - a different order of the rotations would lead to a different orientation + * - as the vehicle axis system is right-handed, also the accelerometer axis system must be right-handed + * + * The vehicle axis system as defined in ISO 8855:2011(E). + * In this system, the axes (Xv, Yv, Zv) are oriented as follows + * - Xv is in the horizontal plane, pointing forwards + * - Yv is in the horizontal plane, pointing to the left + * - Zv is perpendicular to the horizontal plane, pointing upwards + * For an illustration, see https://collab.genivi.org/wiki/display/genivi/LBSSensorServiceRequirementsBorg#LBSSensorServiceRequirementsBorg-ReferenceSystem + * + * When the accelerometer axes are not aligned with the vehicle axes, i.e. + * if any of the angles (angleYaw, anglePitch, angleRoll) is not zero + * then the raw measurement values of the accelerometer X, Y, Z axes may have to be be transformed + * to the vehicle axis system by the client of this interface, depending on the type of application. + * Raw measurements are provided in @TAccelerationData instead of already transformed values, because + * - for accelerometers with less than 3 axes, the transformation is mathematically not well-defined + * - some types of calibration operations are better performed on raw data + * + * Implementors hint: The mathematics of this kind of transformation, + * like the derivation of the rotation matrixes is described in literature on strapdown navigation + * E.g. "Strapdown Inertial Navigation Technology", 2nd Edition by David Titterton and John Weston, section 3.6 + * END Explanation of the angleYaw, anglePitch angleRoll parameters */ +typedef struct { + float dist2RefPointX; /**< Distance of acceleration sensor from vehicle reference point (x-coordinate) [m]. */ + float dist2RefPointY; /**< Distance of acceleration sensor from vehicle reference point (y-coordinate) [m]. */ + float dist2RefPointZ; /**< Distance of acceleration sensor from vehicle reference point (z-coordinate) [m]. */ + float angleYaw; /**< Euler angle of first rotation, around yaw axis, to describe acceleration sensor orientation [degree]. For details, see above. */ + float anglePitch; /**< Euler angle of second rotation, around pitch axis, to describe acceleration sensor orientation [degree]. For details, see above. */ + float angleRoll; /**< Euler angle of third rotation, around roll axis, to describe acceleration sensor orientation [degree]. For details, see above. */ + float sigmaX; /**< Standard error estimate of the x-acceleration [m/s^2]. */ + float sigmaY; /**< Standard error estimate of the y-acceleration [m/s^2]. */ + float sigmaZ; /**< Standard error estimate of the z-acceleration [m/s^2]. */ + EAccelerationTypeBits typeBits;/**< Bit mask indicating the type of the used gyroscope. */ + uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value. + [bitwise or'ed @ref EAccelerationConfigValidityBits values]. + Must be checked before usage. */ +} TAccelerationConfiguration; + +/** + * TAccelerationData::validityBits provides information about the currently valid signals of the acceleration data. + * It is a or'ed bitmask of the EAccelerationValidityBits values. + * Note: + * - The general availability of the signals is provided per TAccelerationConfiguration::typeBits. + * - If a signal is generally provided but temporarily not available, then the corresponding typeBit will be set but not the validityBit + */ +typedef enum { + ACCELERATION_X_VALID = 0x00000001, /**< Validity bit for field TAccelerationData::x. */ + ACCELERATION_Y_VALID = 0x00000002, /**< Validity bit for field TAccelerationData::y. */ + ACCELERATION_Z_VALID = 0x00000004, /**< Validity bit for field TAccelerationData::z. */ + ACCELERATION_TEMPERATURE_VALID = 0x00000008 /**< Validity bit for field TAccelerationData::temperature. */ +} EAccelerationValidityBits; + +/** + * The AccelerationData delivers the sensor values of the accelerometer. + * The coordinate system is the axis system of the accelerometer sensor, + * i.e. the x, y, z values are raw measurements + * without any conversion except probably averaging of multiple + * sensor readings over the measurement interval. + * + * @see TAccelerationConfiguration for an explanation how to convert these values to the vehicle axis system + * + * It is possible that not all values are populated, e.g. when only a 1-axis accelerometer is used. + * You must check the valid bits before usage. + */ +typedef struct { + uint64_t timestamp; /**< Timestamp of the acquisition of the accelerometer signal [ms]. + All sensor/GNSS timestamps must be based on the same time source. */ + float x; /**< The acceleration in direction of the X-axis of the accelerometer sensor [m/s^2].*/ + float y; /**< The acceleration in direction of the Y-axis of the accelerometer sensor [m/s^2].*/ + float z; /**< The acceleration in direction of the Z-axis of the accelerometer sensor [m/s^2]. */ + float temperature; /**< Temperature reading of the accelerometer sensor. + If available it can be used for temperature compensation. + The measurement unit is unspecified. + Degrees celsius are preferred but any value linearly dependent on the temperature is fine.*/ + uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value. + [bitwise or'ed @ref EAccelerationValidityBits values]. + Must be checked before usage. */ +} TAccelerationData; + +/** + * Callback type for acceleration sensor service. + * Use this type of callback if you want to register for acceleration data. + * This callback may return buffered data (numElements >1) for different reasons + * for (large) portions of data buffered at startup + * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency) + * If the array contains (numElements >1), the elements will be ordered with rising timestamps + * @param accelerationData pointer to an array of TAccelerationData with size numElements + * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided. + */ +typedef void (*AccelerationCallback)(const TAccelerationData accelerationData[], uint16_t numElements); + +/** + * Initialization of the acceleration sensor service. + * Must be called before using the acceleration sensor service to set up the service. + * @return True if initialization has been successfull. + */ +bool snsAccelerationInit(); + +/** + * Destroy the acceleration sensor service. + * Must be called after using the acceleration sensor service to shut down the service. + * @return True if shutdown has been successfull. + */ +bool snsAccelerationDestroy(); + +/** + * Provide meta information about sensor service. + * The meta data of a sensor service provides information about it's name, version, type, subtype, sampling frequency etc. + * @param data Meta data content about the sensor service. + * @return True if meta data is available. + */ +bool snsAccelerationGetMetaData(TSensorMetaData *data); + +/** + * Accessing static configuration information about the acceleration sensor. + * @param config After calling the method the currently available acceleration configuration data is written into this parameter. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsAccelerationGetAccelerationConfiguration(TAccelerationConfiguration* config); + +/** + * Method to get the acceleration data at a specific point in time. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param accelerationData After calling the method the currently available acceleration data is written into accelerationData. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsAccelerationGetAccelerationData(TAccelerationData* accelerationData); + +/** + * Register acceleration callback. + * This is the recommended method for continuously accessing the acceleration data. + * The callback will be invoked when new acceleration data is available. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param callback The callback which should be registered. + * @return True if callback has been registered successfully. + */ +bool snsAccelerationRegisterCallback(AccelerationCallback callback); + +/** + * Deregister acceleration callback. + * After calling this method no new acceleration data will be delivered to the client. + * @param callback The callback which should be deregistered. + * @return True if callback has been deregistered successfully. + */ +bool snsAccelerationDeregisterCallback(AccelerationCallback callback); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDED_GENIVI_ACCELERATION */ diff --git a/sensors-service/api/gyroscope.h b/sensors-service/api/gyroscope.h new file mode 100644 index 0000000..404a896 --- /dev/null +++ b/sensors-service/api/gyroscope.h @@ -0,0 +1,226 @@ +/************************************************************************** + * @licence app begin@ + * + * SPDX-License-Identifier: MPL-2.0 + * + * \ingroup SensorsService + * \brief Compliance Level: Abstract Component + * \copyright Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH + * + * \license + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * @licence end@ + **************************************************************************/ + +#ifndef INCLUDE_GENIVI_GYROSCOPE +#define INCLUDE_GENIVI_GYROSCOPE + +#include "sns-meta-data.h" +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * TGyroscopeConfiguration::validityBits provides information about the currently valid signals of the gyroscope configuration data. + * It is a or'ed bitmask of the EGyroscopeConfigValidityBits values. + */ +typedef enum { + GYROSCOPE_CONFIG_ANGLEYAW_VALID = 0x00000001, /**< Validity bit for field TGyroscopeConfiguration::angleYaw. */ + GYROSCOPE_CONFIG_ANGLEPITCH_VALID = 0x00000002, /**< Validity bit for field TGyroscopeConfiguration::anglePitch. */ + GYROSCOPE_CONFIG_ANGLEROLL_VALID = 0x00000004, /**< Validity bit for field TGyroscopeConfiguration::angleRoll. */ + GYROSCOPE_CONFIG_MOMENTYAW_VALID = 0x00000008, /**< Validity bit for field TGyroscopeConfiguration::momentOfYawInertia. */ + GYROSCOPE_CONFIG_SIGMAGYROSCOPE_VALID = 0x00000010, /**< Validity bit for field TGyroscopeConfiguration::sigmaGyroscope. */ + GYROSCOPE_CONFIG_TYPE_VALID = 0x00000020 /**< Validity bit for field TGyroscopeConfiguration::typeBits. */ +} EGyroscopeConfigValidityBits; + +/** + * Gyroscope type + * TGyroscopeConfiguration::typeBits provides information about the type of the gyroscope and the interpretation of the signals. + * It is a or'ed bitmask of the EGyroscopeTypeBits values. + */ +typedef enum { + GYROSCOPE_TEMPERATURE_COMPENSATED = 0x00000001, /**< Temperature bias compensation already applied to gyroscope signals. */ + GYROSCOPE_YAWRATE_PROVIDED = 0x00000002, /**< A measurement for the z/yaw-axis is provided */ + GYROSCOPE_PITCHRATE_PROVIDED = 0x00000004, /**< A measurement for the y/pitch-axis is provided */ + GYROSCOPE_ROLLRATE_PROVIDED = 0x00000008, /**< A measurement for the x/roll-axis is provided */ + GYROSCOPE_TEMPERATURE_PROVIDED = 0x00000010 /**< A measurement for the temperature is provided */ +} EGyroscopeTypeBits; + +/** + * Static configuration data for the gyroscope sensor service. + * + * BEGIN Explanation of the angleYaw, anglePitch angleRoll parameters + * The orientation of the gyroscope hardware (Xg, Yg, Zg) + * with respect to the vehicle axis system (Xv, Yv, Zv) + * can be described using the angles (angleYaw, anglePitch, angleRoll) + * following the approach defined in ISO 8855:2011, section 5.2, table 1 + * Apply 3 rotations on the vehicle axis system until it matches the gyroscope axis system + * The rotation sequence is as follows + * - first rotate by angleYaw about the Zv axis + * - second rotate by anglePitch about the new (intermediate) Y axis + * - third rotate by angleRoll about the new X axis + * Notes + * - the angles are frequently called "Euler angles" and the rotations "Euler rotations" + * - a different order of the rotations would lead to a different orientation + * - as the vehicle axis system is right-handed, also the gyroscope axis system must be right-handed + * + * The vehicle axis system as defined in ISO 8855:2011(E). + * In this system, the axes (Xv, Yv, Zv) are oriented as follows + * - Xv is in the horizontal plane, pointing forwards + * - Yv is in the horizontal plane, pointing to the left + * - Zv is perpendicular to the horizontal plane, pointing upwards + * For an illustration, see https://collab.genivi.org/wiki/display/genivi/LBSSensorServiceRequirementsBorg#LBSSensorServiceRequirementsBorg-ReferenceSystem + * + * When the gyroscope axes are not aligned with the vehicle axes, i.e. + * if any of the angles (angleYaw, anglePitch, angleRoll) is not zero + * then the raw measurement values of the gyroscope Z, Y, X axes may have to be be transformed + * to the vehicle axis system by the client of this interface, depending on the type of application. + * Raw measurements are provided in @TGyroscopeData instead of already transformed values, because + * - for gyroscopes with less than 3 axes, the transformation is mathematically not well-defined + * - some types of calibration operations are better performed on raw data + * + * Implementors hint: The mathematics of this kind of transformation, + * like the derivation of the rotation matrixes is described in literature on strapdown navigation + * E.g. "Strapdown Inertial Navigation Technology", 2nd Edition by David Titterton and John Weston, section 3.6 + * END Explanation of the angleYaw, anglePitch angleRoll parameters + * + */ +typedef struct { + float angleYaw; /**< Euler angle of first rotation, around yaw axis, to describe gyroscope orientation [degree]. For details, see above. */ + float anglePitch; /**< Euler angle of second rotation, around pitch axis, to describe gyroscope orientation [degree]. For details, see above. */ + float angleRoll; /**< Euler angle of third rotation, around roll axis, to describe gyroscope orientation [degree]. For details, see above. */ + float momentOfYawInertia; /**< Moment of yaw inertia. The pitch and roll inertia moments are not provided as they are not relevant for positioning. [kg*m^2] */ + float sigmaGyroscope; /**< Standard error estimate of the gyroscope for all directions. [degree/s] */ + EGyroscopeTypeBits typeBits;/**< Bit mask indicating the type of the used gyroscope. */ + uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value. + [bitwise or'ed @ref EGyroscopeConfigValidityBits values]. + Must be checked before usage. */ +} TGyroscopeConfiguration; + +/** + * TGyroscopeData::validityBits provides information which fields in TGyroscopeData contain valid measurement data. + * It is a or'ed bitmask of the EGyroscopeValidityBits values. + * Note: + * - The general availability of the signals is provided per TGyroscopeConfiguration::typeBits. + * - If a signal is generally provided but temporarily not available, then the corresponding typeBit will be set but not the validityBit + */ +typedef enum { + GYROSCOPE_YAWRATE_VALID = 0x00000001, /**< Validity bit for field TGyroscopeData::yawRate. */ + GYROSCOPE_PITCHRATE_VALID = 0x00000002, /**< Validity bit for field TGyroscopeData::pitchRate. */ + GYROSCOPE_ROLLRATE_VALID = 0x00000004, /**< Validity bit for field TGyroscopeData::rollRate. */ + GYROSCOPE_TEMPERATURE_VALID = 0x00000008 /**< Validity bit for field TGyroscopeData::temperature. */ +} EGyroscopeValidityBits; + +/** + * The GyroscopeData delivers the sensor values of the gyroscope. + * The coordinate system is the axis system of the gyroscope sensor, + * i.e. the yawRate, pitchRate, rollRate values are raw measurements + * without any conversion except probably averaging of multiple + * sensor readings over the measurement interval. + * + * @see TGyroscopeConfiguration for an explanation how to convert these values to the vehicle axis system + * + * It is possible that not all values are populated, e.g. when only a 1-axis gyroscope is used. + * You must check the valid bits before usage. + */ +typedef struct { + uint64_t timestamp; /**< Timestamp of the acquisition of the gyroscope signal [ms]. + All sensor/GNSS timestamps must be based on the same time source. */ + float yawRate; /**< Current angular rate measurement around the z/yaw-axis of the gyroscope sensor [degree/s]. + Value range -100 / +100 degree/s. Frequency of at least 5Hz. Preferrably 50Hz. + A rotation to the left is indicated by a positive sign. */ + float pitchRate; /**< Current angular rate measurement around the y/pitch-axis of the gyroscope sensor [degree/s]. + Value range -100 / +100 degree/s. Frequency of at least 5Hz. Preferrably 50Hz. + A rotation front down is indicated by a positive sign. */ + float rollRate; /**< Current angular rate measurement around the x/roll-axis of the gyroscope sensor [degree/s]. + Value range -100 / +100 degree/s. Frequency of at least 5Hz. Preferrably 50Hz. + A rotation right down is indicated by a positive sign. */ + float temperature; /**< Temperature reading of the gyroscope sensor. + If available it can be used for temperature compensation. + The measurement unit is unspecified. + Degrees celsius are preferred but any value linearly dependent on the temperature is fine.*/ + uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value. + [bitwise or'ed @ref EGyroscopeValidityBits values]. + Must be checked before usage. */ +} TGyroscopeData; + +/** + * Callback type for gyroscope sensor service. + * Use this type of callback if you want to register for gyroscope data. + * This callback may return buffered data (numElements >1) for different reasons + * for (large) portions of data buffered at startup + * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency) + * If the array contains (numElements >1), the elements will be ordered with rising timestamps + * @param gyroData pointer to an array of TGyroscopeData with size numElements + * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided. + */ +typedef void (*GyroscopeCallback)(const TGyroscopeData gyroData[], uint16_t numElements); + +/** + * Initialization of the gyroscope sensor service. + * Must be called before using the gyroscope sensor service to set up the service. + * @return True if initialization has been successfull. + */ +bool snsGyroscopeInit(); + +/** + * Destroy the gyroscope sensor service. + * Must be called after using the gyroscope sensor service to shut down the service. + * @return True if shutdown has been successfull. + */ +bool snsGyroscopeDestroy(); + +/** + * Provide meta information about sensor service. + * @param data Meta data content about the sensor service. + * @return True if meta data is available. + */ +bool snsGyroscopeGetMetaData(TSensorMetaData *data); + +/** + * Accessing static configuration information about the gyroscope sensor. + * @param gyroConfig After calling the method the currently available gyroscope configuration data is written into gyroConfig. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsGyroscopeGetConfiguration(TGyroscopeConfiguration* gyroConfig); + +/** + * Method to get the gyroscope data at a specific point in time. + * Be careful when using this method to read data often enough as gyro data are rotation rates per second. + * The recommended usage for the gyroscope data is the callback interface. + * The get method is provided for consistency reasons of the sensor service API and might be used + * for determining the rotation rate in certain situations. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param gyroData After calling the method the currently available gyroscope data is written into gyroData. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsGyroscopeGetGyroscopeData(TGyroscopeData* gyroData); + +/** + * Register gyroscope callback. + * This is the recommended method for continuously accessing the gyroscope data, i.e. rotation rates. + * The callback will be invoked when new gyroscope data is available. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param callback The callback which should be registered. + * @return True if callback has been registered successfully. + */ +bool snsGyroscopeRegisterCallback(GyroscopeCallback callback); + +/** + * Deregister gyroscope callback. + * After calling this method no new gyroscope data will be delivered to the client. + * @param callback The callback which should be deregistered. + * @return True if callback has been deregistered successfully. + */ +bool snsGyroscopeDeregisterCallback(GyroscopeCallback callback); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDE_GENIVI_GYROSCOPE */ diff --git a/sensors-service/api/inclination.h b/sensors-service/api/inclination.h new file mode 100644 index 0000000..d89cbe2 --- /dev/null +++ b/sensors-service/api/inclination.h @@ -0,0 +1,127 @@ +/************************************************************************** + * @licence app begin@ + * + * SPDX-License-Identifier: MPL-2.0 + * + * \ingroup SensorsService + * \brief Compliance Level: Abstract Component + * \copyright Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH + * + * \license + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * @licence end@ + **************************************************************************/ + +#ifndef INCLUDED_GENIVI_INCLINATION +#define INCLUDED_GENIVI_INCLINATION + +#include "sns-meta-data.h" +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Current status of the inclination sensors signals. + */ +typedef enum { + INCLINATION_INITIALIZING, /**< System is currently in the initialization phase. */ + INCLINATION_SENSOR_BASED, /**< Signals are available and are based on sensors. */ + INCLINATION_UNSTABLE_DRIVING_CONDITION, /**< Unstable driving conditions (limited accuracy). */ + INCLINATION_MODEL_BASED, /**< Signals are available and are based on a model. */ + INCLINATION_NOT_AVAILABLE /**< Signals are not available. */ +} EInclinationSensorStatus; + +/** + * TInclinationData::validityBits provides information about the currently valid signals of the inclination data. + * It is a or'ed bitmask of the EInclinationValidityBits values. + */ +typedef enum { + INCLINATION_LONGITUDINAL_VALID = 0x00000001, /**< Validity bit for field TInclinationData::longitudinalGradientRoadway. */ + INCLINATION_TRAVERSE_VALID = 0x00000002, /**< Validity bit for field TInclinationData::traverseGradientRoadway. */ + INCLINATION_STATUS_VALID = 0x00000004 /**< Validity bit for field TInclinationData::status. */ +} EInclinationValidityBits; + +/** + * Inclination sensor service provides the inclination values. + */ +typedef struct { + uint64_t timestamp; /**< Timestamp of the acquisition of the inclination signal [ms]. + All sensor/GNSS timestamps must be based on the same time source. */ + float longitudinalGradientRoadway; /**< The inclination of the road in longitudinal direction, i.e. in the direction of movement [degree]. In instable driving situations this value might not be available. */ + float traverseGradientRoadway; /**< Estimated gradient of the road in transverse direction [degree]. In instable driving situations this value might not be available. */ + EInclinationSensorStatus status; /**< Status of the signals. */ + uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value. + [bitwise or'ed @ref EInclinationValidityBits values]. + Must be checked before usage. */ +} TInclinationData; + +/** + * Callback type for inclination sensor service. + * Use this type of callback if you want to register for inclination data. + * This callback may return buffered data (numElements >1) for different reasons + * for (large) portions of data buffered at startup + * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency) + * If the array contains (numElements >1), the elements will be ordered with rising timestamps + * @param inclinationData pointer to an array of TInclinationData with size numElements + * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided. + */ +typedef void (*InclinationCallback)(const TInclinationData inclinationData[], uint16_t numElements); + +/** + * Initialization of the inclination sensor service. + * Must be called before using the inclination sensor service to set up the service. + * @return True if initialization has been successfull. + */ +bool snsInclinationInit(); + +/** + * Destroy the inclination sensor service. + * Must be called after using the inclination sensor service to shut down the service. + * @return True if shutdown has been successfull. + */ +bool snsInclinationDestroy(); + +/** + * Provide meta information about sensor service. + * The meta data of a sensor service provides information about it's name, version, type, subtype, sampling frequency etc. + * @param data Meta data content about the sensor service. + * @return True if meta data is available. + */ +bool snsInclinationGetMetaData(TSensorMetaData *data); + +/** + * Method to get the inclination data at a specific point in time. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param inclination After calling the method the currently available inclination data is written into this parameter. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsInclinationGetInclinationData(TInclinationData* inclination); + +/** + * Register inclination callback. + * This is the recommended method for continuously accessing the inclination data. + * The callback will be invoked when new inclination data is available. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param callback The callback which should be registered. + * @return True if callback has been registered successfully. + */ +bool snsInclinationRegisterCallback(InclinationCallback callback); + +/** + * Deregister inclination callback. + * After calling this method no new inclination data will be delivered to the client. + * @param callback The callback which should be deregistered. + * @return True if callback has been deregistered successfully. + */ +bool snsInclinationDeregisterCallback(InclinationCallback callback); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDED_GENIVI_INCLINATION */ diff --git a/sensors-service/api/odometer.h b/sensors-service/api/odometer.h new file mode 100644 index 0000000..b504af8 --- /dev/null +++ b/sensors-service/api/odometer.h @@ -0,0 +1,121 @@ +/************************************************************************** + * @licence app begin@ + * + * SPDX-License-Identifier: MPL-2.0 + * + * \ingroup SensorsService + * \brief Compliance Level: Abstract Component + * \copyright Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH + * + * \license + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * @licence end@ + **************************************************************************/ + +#ifndef INCLUDE_GENIVI_ODOMETER +#define INCLUDE_GENIVI_ODOMETER + +#include "sns-meta-data.h" +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * TOdometerData::validityBits provides information about the currently valid signals of the odometer data. + * It is a or'ed bitmask of the EOdometerValidityBits values. + */ +typedef enum { + ODOMETER_TRAVELLEDDISTANCE_VALID = 0x00000001 /**< Validity bit for field TOdometerData::travelledDistance. */ +} EOdometerValidityBits; + +/** + * Odometer sensor service provides the travelled distance. + */ +typedef struct { + uint64_t timestamp; /**< Timestamp of the acquisition of the odometer signal [ms]. + All sensor/GNSS timestamps must be based on the same time source. */ + uint16_t travelledDistance; /**< Distance in [cm] with at least 5Hz. Implemented as a running counter + with overflow to support multiple clients and getter methods. + As the representation of this value is done using 16 Bits the value can provide + distances up 32767cm or 327.67m before overflowing. */ + uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value. + [bitwise or'ed @ref EOdometerValidityBits values]. + Must be checked before usage. */ +} TOdometerData; + +/** + * Callback type for odometer sensor service. + * Use this type of callback if you want to register for odometer data. + * This callback may return buffered data (numElements >1) for different reasons + * for (large) portions of data buffered at startup + * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency) + * If the array contains (numElements >1), the elements will be ordered with rising timestamps + * @param odometerData pointer to an array of TOdometerData with size numElements + * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided. + */ +typedef void (*OdometerCallback)(const TOdometerData odometerData[], uint16_t numElements); + +/** + * Initialization of the odometer sensor service. + * Must be called before using the odometer sensor service to set up the service. + * @return True if initialization has been successfull. + * */ +bool snsOdometerInit(); + +/** + * Destroy the odometer sensor service. + * Must be called after using the odometer sensor service to shut down the service. + * @return True if shutdown has been successfull. + */ +bool snsOdometerDestroy(); + +/** + * Provide meta information about sensor service. + * The meta data of a sensor service provides information about it's name, version, type, subtype, sampling frequency etc. + * @param data Meta data content about the sensor service. + * @return True if meta data is available. + */ +bool snsOdometerGetMetaData(TSensorMetaData *data); + +/** + * Method to get the odometer data at a specific point in time. + * Be careful when using this method to read data often enough to avoid missing an overflow. + * With reasonable car speeds it should be enough to read the data every 3s. + * The recommended usage for the odometer data is the callback interface. + * The get method is provided for consistency reasons of the sensor service API and might be used + * for determining the distance between a few points in time. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param odometer After calling the method the currently available odometer data is written into this parameter. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsOdometerGetOdometerData(TOdometerData* odometer); + +/** + * Register odometer callback. + * This is the recommended method for continuously accessing the odometer data. + * The callback will be invoked when new odometer data is available. + * Overflow handling must be done by the caller. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param callback The callback which should be registered. + * @return True if callback has been registered successfully. + */ +bool snsOdometerRegisterCallback(OdometerCallback callback); + +/** + * Deregister odometer callback. + * After calling this method no new odometer data will be delivered to the client. + * @param callback The callback which should be deregistered. + * @return True if callback has been deregistered successfully. + */ +bool snsOdometerDeregisterCallback(OdometerCallback callback); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDE_GENIVI_ODOMETER */ diff --git a/sensors-service/api/reverse-gear.h b/sensors-service/api/reverse-gear.h new file mode 100644 index 0000000..63f3c16 --- /dev/null +++ b/sensors-service/api/reverse-gear.h @@ -0,0 +1,113 @@ +/************************************************************************** + * @licence app begin@ + * + * SPDX-License-Identifier: MPL-2.0 + * + * \ingroup SensorsService + * \brief Compliance Level: Abstract Component + * \copyright Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH + * + * \license + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * @licence end@ + **************************************************************************/ + +#ifndef INCLUDED_GENIVI_REVERSEGEAR +#define INCLUDED_GENIVI_REVERSEGEAR + +#include "sns-meta-data.h" +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * TReverseGearData::validityBits provides information about the currently valid signals of the reverse gear data. + * It is a or'ed bitmask of the EReverseGearValidityBits values. + */ +typedef enum { + REVERSEGEAR_REVERSEGEAR_VALID = 0x00000001 /**< Validity bit for field TReverseGearData::isReverseGear. */ +} EReverseGearValidityBits; + +/** + * Reverse gear sensor service provides the current status of the reverse gear of the vehicle. + * This information is explicitly restricted to provide only the information if the reverse gear is engaged. + * The direction of movement is provided by the direction of the vehicle speed. + */ +typedef struct { + uint64_t timestamp; /**< Timestamp of the acquisition of the reverse gear signal [ms]. + All sensor/GNSS timestamps must be based on the same time source. */ + bool isReverseGear; /**< True if the reverse gear is currently used. False otherwise. */ + uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value. + [bitwise or'ed @ref EReverseGearValidityBits values]. + Must be checked before usage. */ +} TReverseGearData; + +/** + * Callback type for reverse gear sensor service. + * Use this type of callback if you want to register for reverse gear data. + * This callback may return buffered data (numElements >1) for different reasons + * for (large) portions of data buffered at startup + * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency) + * If the array contains (numElements >1), the elements will be ordered with rising timestamps + * @param reverseGearData pointer to an array of TReverseGearData with size numElements + * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided. + */ +typedef void (*ReverseGearCallback)(const TReverseGearData reverseGearData[], uint16_t numElements); + +/** + * Initialization of the reverse gear sensor service. + * Must be called before using the reverse gear sensor service to set up the service. + * @return True if initialization has been successfull. + */ +bool snsReverseGearInit(); + +/** + * Destroy the ReverseGear sensor service. + * Must be called after using the ReverseGear sensor service to shut down the service. + * @return True if shutdown has been successfull. + */ +bool snsReverseGearDestroy(); + +/** + * Provide meta information about sensor service. + * The meta data of a sensor service provides information about it's name, version, type, subtype, sampling frequency etc. + * @param data Meta data content about the sensor service. + * @return True if meta data is available. + */ +bool snsReverseGearGetMetaData(TSensorMetaData *data); + +/** + * Method to get the reverse gear data at a specific point in time. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param reverseGear After calling the method the currently available reverse gear data is written into reverseGear. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsReverseGearGetReverseGearData(TReverseGearData* reverseGear); + +/** + * Register reverse gear callback. + * The callback will be invoked when new reverse gear data is available. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param callback The callback which should be registered. + * @return True if callback has been registered successfully. + */ +bool snsReverseGearRegisterCallback(ReverseGearCallback callback); + +/** + * Deregister reverse gear callback. + * After calling this method no new reverse gear data will be delivered to the client. + * @param callback The callback which should be deregistered. + * @return True if callback has been deregistered successfully. + */ +bool snsReverseGearDeregisterCallback(ReverseGearCallback callback); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDED_GENIVI_REVERSEGEAR */ diff --git a/sensors-service/api/slip-angle.h b/sensors-service/api/slip-angle.h new file mode 100644 index 0000000..9262568 --- /dev/null +++ b/sensors-service/api/slip-angle.h @@ -0,0 +1,116 @@ +/************************************************************************** + * @licence app begin@ + * + * SPDX-License-Identifier: MPL-2.0 + * + * \ingroup SensorsService + * \brief Compliance Level: Abstract Component + * \copyright Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH + * + * \license + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * @licence end@ + **************************************************************************/ + +#ifndef INCLUDE_GENIVI_SLIP_ANGLE +#define INCLUDE_GENIVI_SLIP_ANGLE + +#include "sns-meta-data.h" +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * TSlipAngleData::validityBits provides information about the currently valid signals of the slip angle data. + * It is a or'ed bitmask of the ESlipAngleValidityBits values. + */ +typedef enum { + SLIPANGLE_SLIPANGLE_VALID = 0x00000001 /**< Validity bit for field TSlipAngleData::slipAngle. */ +} ESlipAngleValidityBits; + +/** + * Slip angle sensor service provides the slip angle value. + * The reference coordinate system for the slip angle is defined here: + * https://collab.genivi.org/wiki/display/genivi/LBSSensorServiceRequirementsBorg#LBSSensorServiceRequirementsBorg-ReferenceSystem + */ +typedef struct { + uint64_t timestamp; /**< Timestamp of the acquisition of the slip angle signal [ms]. + All sensor/GNSS timestamps must be based on the same time source. */ + float slipAngle; /**< Delivers the value slip angle in [degrees]. + It is defined as the angle between the fixed car axis (direction of driving) and the real direction of vehicle movement. + The direction and sign is defined equal to the yaw rate. */ + uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value. + [bitwise or'ed @ref ESlipAngleValidityBits values]. + Must be checked before usage. */ +} TSlipAngleData; + +/** + * Callback type for slip angle sensor service. + * Use this type of callback if you want to register for slip angle data. + * This callback may return buffered data (numElements >1) for different reasons + * for (large) portions of data buffered at startup + * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency) + * If the array contains (numElements >1), the elements will be ordered with rising timestamps + * @param slipAngleData pointer to an array of TSlipAngleData with size numElements + * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided. + */ +typedef void (*SlipAngleCallback)(const TSlipAngleData slipAngleData[], uint16_t numElements); + +/** + * Initialization of the slip angle sensor service. + * Must be called before using the slip angle sensor service to set up the service. + * @return True if initialization has been successfull. + */ +bool snsSlipAngleInit(); + +/** + * Destroy the SlipAngle sensor service. + * Must be called after using the SlipAngle sensor service to shut down the service. + * @return True if shutdown has been successfull. + */ +bool snsSlipAngleDestroy(); + +/** + * Provide meta information about sensor service. + * The meta data of a sensor service provides information about it's name, version, type, subtype, sampling frequency etc. + * @param data Meta data content about the sensor service. + * @return True if meta data is available. + */ +bool snsSlipAngleGetMetaData(TSensorMetaData *data); + +/** + * Method to get the slip angle data at a specific point in time. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param data After calling the method the currently available inclination data is written into this parameter. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsSlipAngleGetSlipAngleData(TSlipAngleData* data); + +/** + * Register slip angle callback. + * This is the recommended method for continuously accessing the slip angle data. + * The callback will be invoked when new slip angle data is available. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param callback The callback which should be registered. + * @return True if callback has been registered successfully. + */ +bool snsSlipAngleRegisterCallback(SlipAngleCallback callback); + +/** + * Deregister slip angle callback. + * After calling this method no new slip angle data will be delivered to the client. + * @param callback The callback which should be deregistered. + * @return True if callback has been deregistered successfully. + */ +bool snsSlipAngleDeregisterCallback(SlipAngleCallback callback); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDE_GENIVI_SLIP_ANGLE */ diff --git a/sensors-service/api/sns-meta-data.h b/sensors-service/api/sns-meta-data.h new file mode 100644 index 0000000..a91e301 --- /dev/null +++ b/sensors-service/api/sns-meta-data.h @@ -0,0 +1,82 @@ +/************************************************************************** + * @licence app begin@ + * + * SPDX-License-Identifier: MPL-2.0 + * + * \ingroup SensorsService + * \brief Compliance Level: Abstract Component + * \copyright Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH + * + * \license + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * @licence end@ + **************************************************************************/ + +#ifndef INCLUDE_SNS_METADATA +#define INCLUDE_SNS_METADATA + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * The sensor category introduces the concept that sensor information can also be derived information + * computed by combining several signals. + */ +typedef enum { + SENSOR_CATEGORY_UNKNOWN, /**< Unknown category. Should not be used. */ + SENSOR_CATEGORY_LOGICAL, /**< A logical sensor can combine signals of several sensors. */ + SENSOR_CATEGORY_PHYSICAL /**< A physical sensor provides signals from physically available sensors. */ +} ESensorCategory; + +/** + * The sensor type identifies which physical quantity is measured. + * For each sensor type, there is a corresponding API header with data structures, callback notifications and getter functions defined + * Note that for all 3 wheel sensor types there is a combined API header. + * + */ +typedef enum { + SENSOR_TYPE_UNKNOWN, /**< Unknown sensor type. Should not be used. */ + SENSOR_TYPE_ACCELERATION, /**< Acceleration sensor*/ + SENSOR_TYPE_GYROSCOPE, /**< Gyroscope sensor*/ + SENSOR_TYPE_INCLINATION, /**< Inclination sensor*/ + SENSOR_TYPE_ODOMETER, /**< Odometer sensor*/ + SENSOR_TYPE_REVERSE_GEAR, /**< Reverse gear sensor*/ + SENSOR_TYPE_SLIP_ANGLE, /**< Slip angle sensor*/ + SENSOR_TYPE_STEERING_ANGLE, /**< Steering angle sensor*/ + SENSOR_TYPE_VEHICLE_SPEED, /**< Vehicle speed sensor*/ + SENSOR_TYPE_VEHICLE_STATE, /**< Vehicle state sensor*/ + SENSOR_TYPE_WHEELTICK, /**< Wheel tick sensor*/ + SENSOR_TYPE_WHEELSPEEDANGULAR, /**< Wheel speed angular sensor*/ + SENSOR_TYPE_WHEELSPEED, /**< Wheel speed sensor*/ +} ESensorType; + +/** + * The software platform provides the following information about the Sensor and the related output Signals. + * Sensor clients need the meta data information in order to correctly handle data provided by sensor service and + * to adapt to the variation in the signal data delivery. + */ +typedef struct { + uint32_t version; /**< Version of the sensor service. */ + ESensorCategory category; /**< Sensor Category (Physical/Logical). */ + ESensorType type; /**< Sensor Type (Odometer, Gyroscope, etc.). */ + uint32_t cycleTime; /**< Sensor cycle time (update interval) in ms. 0 for irregular updates */ +} TSensorMetaData; + +/** + * Retrieve the metadata of all available sensors. + * @param metadata returns a a pointer an array of TSensorMetaData (maybe NULL if no metadata is available) + * @return number of elements in the array of TSensorMetaData + */ +int32_t getSensorMetaDataList(const TSensorMetaData** metadata); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDE_SNS_METADATA */ diff --git a/sensors-service/api/sns.h b/sensors-service/api/sns.h new file mode 100644 index 0000000..026d6ed --- /dev/null +++ b/sensors-service/api/sns.h @@ -0,0 +1,58 @@ +/************************************************************************** + * Component Name: SensorsService + * Compliance Level: Abstract Component + * Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH + * License: + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + **************************************************************************/ + +#ifndef INCLUDE_GENIVI_SNS +#define INCLUDE_GENIVI_SNS + +// API Version +#define GENIVI_SNS_API_MAJOR 2 +#define GENIVI_SNS_API_MINOR 0 +#define GENIVI_SNS_API_MICRO 0 + +#include <stdint.h> +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Initialization of the sensor service system infrastructure. + * Must be called before using any of the sensor services to set up general structures and connections + * to the sensors or signal providers. + * If not called before a sensor init the system behaviour is not defined. + * @return True if initialization has been successful. + */ +bool snsInit(); + +/** + * Destroy the sensor services. + * Must be called after using the sensor services for shut down. + * After this call no sensor will be able to receive sensor data. + * The individual sensors must be shut down before this call. Otherwise system behaviour is not defined. + * @return True if shutdown has been successful. + */ +bool snsDestroy(); + +/** + * Sensor services version information. + * This information is for the sensor services system structure. + * The version information for each sensor can be obtained via the metadata. + * @param major Major version number. Changes in this number are used for incompatible API change. + * @param minor Minor version number. Changes in this number are used for compatible API change. + * @param micro Micro version number. Changes in this number are used for minor changes. + */ +void snsGetVersion(int *major, int *minor, int *micro); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDE_GENIVI_SNS */ diff --git a/sensors-service/api/steering-angle.h b/sensors-service/api/steering-angle.h new file mode 100644 index 0000000..fab2007 --- /dev/null +++ b/sensors-service/api/steering-angle.h @@ -0,0 +1,134 @@ +/************************************************************************** + * @licence app begin@ + * + * SPDX-License-Identifier: MPL-2.0 + * + * \ingroup SensorsService + * \brief Compliance Level: Abstract Component + * \copyright Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH + * + * \license + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * @licence end@ + **************************************************************************/ + +#ifndef INCLUDE_GENIVI_STEERINGANGLE +#define INCLUDE_GENIVI_STEERINGANGLE + +#include "sns-meta-data.h" +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * TSteeringAngleData::validityBits provides information about the currently valid signals of the steering angle data. + * It is a or'ed bitmask of the ESteeringAngleValidityBits values. + */ +typedef enum { + STEERINGANGLE_FRONT_VALID = 0x00000001, /**< Validity bit for field TSteeringAngleData::front. */ + STEERINGANGLE_REAR_VALID = 0x00000002, /**< Validity bit for field TSteeringAngleData::rear. */ + STEERINGANGLE_STEERINGWHEEL_VALID = 0x00000004 /**< Validity bit for field TSteeringAngleData::steeringWheel. */ +} ESteeringAngleValidityBits; + +/** + * The SteeringAngle delivers the sensor values of the steering angle. + * You must check the valid bits before usage. + */ +typedef struct { + uint64_t timestamp; /**< Timestamp of the acquisition of the steering angle signal [ms]. + All sensor/GNSS timestamps must be based on the same time source. */ + float front; /**< Returns the steering angle of the front wheels [degree]. */ + float rear; /**< Returns the steering angle of the rear wheels [degree]. This is only useful for vehicles with a steerable rear axis. */ + float steeringWheel; /**< Returns the angle of the steering wheel [degree]. Useful for vehicles where the wheel angles are not available. + Must be used in combination with the steeringRatio. */ + uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value. + [bitwise or'ed @ref ESteeringAngleValidityBits values]. + Must be checked before usage. */ +} TSteeringAngleData; + +/** + * The SteeringAngleConfiguration delivers the static configuration values of the steering wheel sensor service. + */ +typedef struct { + float sigmaSteeringAngle; /**< Standard deviation of the steering front angle in [degree]. */ + float sigmaSteeringWheelAngle; /**< Standard deviation of the steering wheel angle in [degree]. */ + float steeringRatio; /**< Steering ratio between steering wheel and wheels. Only valid when static: Unit: [-] */ +} TSteeringAngleConfiguration; + +/** + * Callback type for steering angle sensor service. + * Use this type of callback if you want to register for steering angle data. + * This callback may return buffered data (numElements >1) for different reasons + * for (large) portions of data buffered at startup + * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency) + * If the array contains (numElements >1), the elements will be ordered with rising timestamps + * @param steeringAngleData pointer to an array of TSteeringAngleData with size numElements + * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided. + */ +typedef void (*SteeringAngleCallback)(const TSteeringAngleData steeringAngleData[], uint16_t numElements); + +/** + * Initialization of the steering angle sensor service. + * Must be called before using the steering angle sensor service to set up the service. + * @return True if initialization has been successfull. + */ +bool snsSteeringAngleInit(); + +/** + * Destroy the SteeringAngle sensor service. + * Must be called after using the SteeringAngle sensor service to shut down the service. + * @return True if shutdown has been successfull. + */ +bool snsSteeringAngleDestroy(); + +/** + * Provide meta information about sensor service. + * The meta data of a sensor service provides information about it's name, version, type, subtype, sampling frequency etc. + * @param data Meta data content about the sensor service. + * @return True if meta data is available. + */ +bool snsSteeringAngleGetMetaData(TSensorMetaData *data); + +/** + * Method to get the steering angle data at a specific point in time. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param angleData After calling the method the currently available steering angle data is written into angleData. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsSteeringAngleGetSteeringAngleData(TSteeringAngleData* angleData); + +/** + * Accessing static configuration information about the steering angle sensor. + * @param config After calling the method the currently available static steering angle configuration data is written into config. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsSteeringAngleGetConfiguration(TSteeringAngleConfiguration* config); + +/** + * Register steering angle callback. + * This is the recommended method for continuously accessing the steering angle data. + * The callback will be invoked when new steering angle data is available. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param callback The callback which should be registered. + * @return True if callback has been registered successfully. + */ +bool snsSteeringAngleRegisterCallback(SteeringAngleCallback callback); + +/** + * Deregister steering angle callback. + * After calling this method no new steering angle data will be delivered to the client. + * @param callback The callback which should be deregistered. + * @return True if callback has been deregistered successfully. + */ +bool snsSteeringAngleDeregisterCallback(SteeringAngleCallback callback); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDE_GENIVI_STEERINGANGLE */ diff --git a/sensors-service/api/vehicle-data.h b/sensors-service/api/vehicle-data.h new file mode 100644 index 0000000..df6149c --- /dev/null +++ b/sensors-service/api/vehicle-data.h @@ -0,0 +1,143 @@ +/************************************************************************** + * @licence app begin@ + * + * SPDX-License-Identifier: MPL-2.0 + * + * \ingroup SensorsService + * \brief Compliance Level: Abstract Component + * \copyright Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH + * + * \license + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * @licence end@ + **************************************************************************/ + +#ifndef INCLUDE_GENIVI_VEHICLE_DATA +#define INCLUDE_GENIVI_VEHICLE_DATA + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> +#include <stdbool.h> + +/** + * Description of driven axles. This is currently restricted to passenger cars. + */ +typedef enum { + SNS_AXLE_UNKNOWN = 0, /**< It is not known which axles are driven. */ + SNS_AXLE_FRONT = 1, /**< Only the front axle is driven. */ + SNS_AXLE_REAR = 2, /**< Only the rear axle is driven. */ + SNS_AXLE_BOTH = 3 /**< Both axles are driven (4 wheel drive). */ +} EAxleType; + +/** + * Description of the vehicle type. This is for future extensions. + * Currently the specification is based mostly on cars. Other vehicle types are just referenced for future extensions. + */ +typedef enum { + SNS_CAR = 0, /**< Passenger car with 4 wheels. */ + SNS_TRUCK = 1, /**< Truck */ + SNS_MOTORBIKE = 2, /**< Motorbike with 2 wheels. */ + SNS_BUS = 3 /**< Passenger bus. */ +} EVehicleType; + +/** + * 3 dimensional distance used for description of geometric descriptions within the vehicle reference system. + */ +typedef struct { + float x; /**< Distance in x direction in [m] according to the reference coordinate system. */ + float y; /**< Distance in y direction in [m] according to the reference coordinate system. */ + float z; /**< Distance in z direction in [m] according to the reference coordinate system. */ +} TDistance3D; + + +/** + * Type of the vehicle. This is a static configuration. + * @param type The vehicle type is written to this parameter as a result as defined in the enumeration. + * @return True if the configuration value is available. If false no value could be provided. + */ +bool vehicleDataGetVehicleType(EVehicleType* type); + +/** + * Type of the driven axles of the vehicle as provided in the official documents. This is a static configuration. + * @param axles The driven axles type is written to this parameter as a result as defined in the enumeration. + * @return True if the configuration value is available. If false no value could be provided. + */ +bool vehicleDataGetDrivenAxles(EAxleType* axles); + +/** + * Number of seats of the vehicle as provided in the official documents. This is a static configuration. + * @param seatCount The number of seats is written to this parameter as a result. + * @return True if the configuration value is available. If false no value could be provided. + */ +bool vehicleDataGetSeatCount(uint8_t* seatCount); + +/** + * Track width of the vehicle as provided in the official documents. This is a static configuration. Unit: [m]. + * If the vehicle has different track widths at the front and rear axles, the rear axle track is referred to. + * @param width The vehicle track width in m is written to this parameter as a result. + * @return True if the configuration value is available. If false no value could be provided. + */ +bool vehicleDataGetTrackWidth(float* width); + +/** + * Front axle track width of the vehicle as provided in the official documents. This is a static configuration. Unit: [m]. + * @param width The vehicle track width of the front axle in m is written to this parameter as a result. + * @return True if the configuration value is available. If false no value could be provided. + */ +bool vehicleDataGetFrontAxleTrackWidth(float* width); + +/** + * Wheel base of the vehicle as provided in the official documents. This is a static configuration. Unit: [m]. + * The wheel base is basically the distance between the front axle and the rear axle. + * For an exact definition, see ISO 8855. + * @param width The wheel base in m is written to this parameter as a result. + * @return True if the configuration value is available. If false no value could be provided. + */ +bool vehicleDataGetWheelBase(float* wheelbase); + +/** + * Mass of the vehicle as provided in the official documents. This is a static configuration value and does not include the current load. Unit: [kg]. + * @param mass The vehicle mass in kg is written to this parameter as a result. + * @return True if the configuration value is available. If false no value could be provided. + */ +bool vehicleDataGetVehicleMass(float* mass); + +/** + * Width of the vehicle as provided in the official documents. This is a static configuration. Unit: [m]. + * @param width The vehicle width in m is written to this parameter as a result. + * @return True if the configuration value is available. If false no value could be provided. + */ +bool vehicleDataGetVehicleWidth(float* width); + +/** + * Distance of the center of gravity to the reference point in 3 dimensions. Unit: [m]. + * @param dist The distance result in 3 dimensions is written to this parameter. + * @return True if the configuration value is available. If false no value could be provided. + */ +bool vehicleDataGetDistCoG2RefPoint(TDistance3D *dist); + +/** + * Distance of front axle to the reference point in 3 dimensions. Unit: [m]. + * @param dist The distance result in 3 dimensions is written to this parameter. + * @return True if the configuration value is available. If false no value could be provided. + */ +bool vehicleDataGetDistFrontAxle2RefPoint(TDistance3D *dist); + +/** + * Distance of rear axle to the reference point in 3 dimensions. Unit: [m]. + * @param dist The distance result in 3 dimensions is written to this parameter. + * @return True if the configuration value is available. If false no value could be provided. + */ +bool vehicleDataGetDistRearAxle2RefPoint(TDistance3D *dist); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDE_GENIVI_VEHICLE_DATA */ diff --git a/sensors-service/api/vehicle-speed.h b/sensors-service/api/vehicle-speed.h new file mode 100644 index 0000000..ade85d9 --- /dev/null +++ b/sensors-service/api/vehicle-speed.h @@ -0,0 +1,109 @@ +/************************************************************************** + * @licence app begin@ + * + * SPDX-License-Identifier: MPL-2.0 + * + * \ingroup SensorsService + * \brief Compliance Level: Abstract Component + * \copyright Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH + * + * \license + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * @licence end@ + **************************************************************************/ + +#ifndef INCLUDED_GENIVI_VEHICLESPEED +#define INCLUDED_GENIVI_VEHICLESPEED + +#include "sns-meta-data.h" +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * TVehicleSpeedData::validityBits provides information about the currently valid signals of the vehicle speed data. + * It is a or'ed bitmask of the EVehicleSpeedValidityBits values. + */ +typedef enum { + VEHICLESPEED_VEHICLESPEED_VALID = 0x00000001 /**< Validity bit for field TVehicleSpeedData::vehicleSpeed. */ +} EVehicleSpeedValidityBits; + +/** + * Vehicle speed sensor service provides the current speed of the vehicle. + */ +typedef struct { + uint64_t timestamp; /**< Timestamp of the acquisition of the vehicle speed signal [ms]. + All sensor/GNSS timestamps must be based on the same time source. */ + float vehicleSpeed; /**< Filtered vehicle speed in [m/s] with a frequency of at least 5Hz. Direction is given by the sign of this value.*/ + uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value. + [bitwise or'ed @ref EVehicleSpeedValidityBits values]. + Must be checked before usage. */ +} TVehicleSpeedData; + +/** + * Callback type for vehicle speed sensor service. + * Use this type of callback if you want to register for vehicle speed data. + * This callback may return buffered data (numElements >1) for different reasons + * for (large) portions of data buffered at startup + * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency) + * If the array contains (numElements >1), the elements will be ordered with rising timestamps + * @param vehicleSpeedData pointer to an array of TVehicleSpeedData with size numElements + * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided. + */ +typedef void (*VehicleSpeedCallback)(const TVehicleSpeedData vehicleSpeedData[], uint16_t numElements); + +/** + * Initialization of the vehicle speed sensor service. + * Must be called before using the vehicle speed sensor service to set up the service. + * @return True if initialization has been successfull. + */ +bool snsVehicleSpeedInit(); + +/** + * Destroy the VehicleSpeed sensor service. + * Must be called after using the VehicleSpeed sensor service to shut down the service. + * @return True if shutdown has been successfull. + */ +bool snsVehicleSpeedDestroy(); + +/** + * Provide meta information about sensor service. + * The meta data of a sensor service provides information about it's name, version, type, subtype, sampling frequency etc. + * @param data Meta data content about the sensor service. + * @return True if meta data is available. + */ +bool snsVehicleSpeedGetMetaData(TSensorMetaData *data); + +/** + * Method to get the vehicle speed data at a specific point in time. + * @param vehicleSpeed After calling the method the currently available vehicle speed data is written into vehicleSpeed. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsVehicleSpeedGetVehicleSpeedData(TVehicleSpeedData* vehicleSpeed); + +/** + * Register vehicle speed callback. + * The callback will be invoked when new vehicle speed data is available. + * @param callback The callback which should be registered. + * @return True if callback has been registered successfully. + */ +bool snsVehicleSpeedRegisterCallback(VehicleSpeedCallback callback); + +/** + * Deregister vehicle speed callback. + * After calling this method no new vehicle speed data will be delivered to the client. + * @param callback The callback which should be deregistered. + * @return True if callback has been deregistered successfully. + */ +bool snsVehicleSpeedDeregisterCallback(VehicleSpeedCallback callback); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDED_GENIVI_VEHICLESPEED */ diff --git a/sensors-service/api/vehicle-state.h b/sensors-service/api/vehicle-state.h new file mode 100644 index 0000000..3b9f984 --- /dev/null +++ b/sensors-service/api/vehicle-state.h @@ -0,0 +1,118 @@ +/************************************************************************** + * @licence app begin@ + * + * SPDX-License-Identifier: MPL-2.0 + * + * \ingroup SensorsService + * \brief Compliance Level: Abstract Component + * \copyright Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH + * + * \license + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * @licence end@ + **************************************************************************/ + +#ifndef INCLUDED_GENIVI_VEHICLESTATE +#define INCLUDED_GENIVI_VEHICLESTATE + +#include "sns-meta-data.h" +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * TVehicleStateData::validityBits provides information about the currently valid signals of the vehicle state data. + * It is a or'ed bitmask of the EVehicleStateValidityBits values. + */ +typedef enum { + VEHICLESTATE_ANTILOCKBRAKESYSTEMACTIVE_VALID = 0x00000001, /**< Validity bit for field antiLockBrakeSystemActive::antiLockBrakeSystemActive. */ + VEHICLESTATE_BRAKEACTIVE_VALID = 0x00000002, /**< Validity bit for field antiLockBrakeSystemActive::brakeActive. */ + VEHICLESTATE_ELECTRONICSTABILITYPROGRAMACTIVE_VALID = 0x00000004, /**< Validity bit for field antiLockBrakeSystemActive::electronicStabilityProgramActive. */ + VEHICLESTATE_TRACTIONCONTROLACTIVE_VALID = 0x00000008, /**< Validity bit for field antiLockBrakeSystemActive::tractionControlActive. */ +} EVehicleStateValidityBits; + +/** + * The VehicleStateData delivers the sensor values of the vehicle state. + * You must check the valid bits before usage. + */ +typedef struct { + uint64_t timestamp; /**< Timestamp of the acquisition of the accelerometer signal [ms]. + All sensor/GNSS timestamps must be based on the same time source. */ + bool antiLockBrakeSystemActive; /**< If true and signal is valid the ABS is currently engaged. */ + bool brakeActive; /**< If true and signal is valid the brakes are currently engaged. */ + bool electronicStabilityProgramActive; /**< If true and signal is valid the electronic stability system (ESP or DSC) is currently engaged. */ + bool tractionControlActive; /**< If true and signal is valid the traction control (ASR) is currently engaged. */ + uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value. + [bitwise or'ed @ref EVehicleStateValidityBits values]. + Must be checked before usage. */ +} TVehicleStateData; + +/** + * Callback type for vehicle state sensor service. + * Use this type of callback if you want to register for vehicle state data. + * This callback may return buffered data (numElements >1) for different reasons + * for (large) portions of data buffered at startup + * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency) + * If the array contains (numElements >1), the elements will be ordered with rising timestamps + * @param vehicleSpeedData pointer to an array of TVehicleStateData with size numElements + * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided. + */ +typedef void (*VehicleStateCallback)(const TVehicleStateData vehicleState[], uint16_t numElements); + +/** + * Initialization of the vehicle state sensor service. + * Must be called before using the vehicle state sensor service to set up the service. + * @return True if initialization has been successfull. + */ +bool snsVehicleStateInit(); + +/** + * Destroy the VehicleState sensor service. + * Must be called after using the VehicleState sensor service to shut down the service. + * @return True if shutdown has been successfull. + */ +bool snsVehicleStateDestroy(); + +/** + * Provide meta information about sensor service. + * The meta data of a sensor service provides information about it's name, version, type, subtype, sampling frequency etc. + * @param data Meta data content about the sensor service. + * @return True if meta data is available. + */ +bool snsVehicleStateGetMetaData(TSensorMetaData *data); + +/** + * Method to get the vehicle state data at a specific point in time. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param vehicleState After calling the method the currently available vehicle state data is written into vehicleState. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsVehicleStateGetVehicleStateData(TVehicleStateData* vehicleState); + +/** + * Register vehicle state callback. + * This is the recommended method for continuously accessing the vehicle state data. + * The callback will be invoked when new vehicle state data is available. + * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true. + * @param callback The callback which should be registered. + * @return True if callback has been registered successfully. + */ +bool snsVehicleStateRegisterCallback(VehicleStateCallback callback); + +/** + * Deregister vehicle state callback. + * After calling this method no new vehicle state data will be delivered to the client. + * @param callback The callback which should be deregistered. + * @return True if callback has been deregistered successfully. + */ +bool snsVehicleStateDeregisterCallback(VehicleStateCallback callback); + +#ifdef __cplusplus +} +#endif +#endif /* INCLUDED_GENIVI_VEHICLESTATE */ diff --git a/sensors-service/api/wheel.h b/sensors-service/api/wheel.h new file mode 100644 index 0000000..b40c879 --- /dev/null +++ b/sensors-service/api/wheel.h @@ -0,0 +1,322 @@ +/************************************************************************** + * @licence app begin@ + * + * SPDX-License-Identifier: MPL-2.0 + * + * \ingroup SensorsService + * \brief Compliance Level: Abstract Component + * \copyright Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH + * + * \license + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * @licence end@ + **************************************************************************/ + +#ifndef INCLUDE_GENIVI_WHEELTICK +#define INCLUDE_GENIVI_WHEELTICK + +#include "sns-meta-data.h" +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Defines the type for which the wheel tick information is provided. + * Usually wheel ticks are either provided for the non-driven axle or for each wheel individually. + */ +typedef enum { + WHEEL_INVALID = 0, /**< Wheel tick data is invalid / the field is unused. */ + WHEEL_UNKNOWN = 1, /**< No information available where the wheel tick data is from. */ + WHEEL_AXLE_NONDRIVEN = 2, /**< Wheel tick data is an average from the non driven axle. Can be front or rear depending on the type of drivetrain. */ + WHEEL_AXLE_FRONT = 3, /**< Wheel tick data is an average from the front axle. */ + WHEEL_AXLE_REAR = 4, /**< Wheel tick data is an average from the rear axle. */ + WHEEL_LEFT_FRONT = 5, /**< Wheel tick data is from the left front wheel. */ + WHEEL_RIGHT_FRONT = 6, /**< Wheel tick data is from the right front wheel. */ + WHEEL_LEFT_REAR = 7, /**< Wheel tick data is from the left rear wheel. */ + WHEEL_RIGHT_REAR = 8 /**< Wheel tick data is from the right rear wheel. */ +} EWheelId; + +/** + * Maximum number of wheel elements per structure. + * A fix value is used because a flat data structure has advantages like simple copying, indexed access. + */ +#define WHEEL_NUM_ELEMENTS 4 + +/** + * A single wheel tick information. + * No valid flags are provided for the wheel ticks as this information is transferred as an array. + * If data is not valid the data is simply omitted from transfer. + */ +typedef struct { + EWheelId wheeltickIdentifier; /**< Type for which this tick information is provided. */ + uint32_t wheeltickCounter; /**< The actual wheel tick counter which provides the ticks for the type + specified in wheeltickIdentifier. + This is a running counter which overflows only at a vehicle specific threshold. + This must be tracked by the client. + The threshold value can be determined by calling snsWheeltickGetWheelticksCountMax() */ +} TWheeltickDetail; + +/** + * Wheel tick information for multiple wheels. + * Container with timestamp as used by callback and get function. + */ +typedef struct { + uint64_t timestamp; /**< Timestamp of the acquisition of this wheel tick signal [ms]. + All sensor/GNSS timestamps must be based on the same time source. */ + TWheeltickDetail elements[WHEEL_NUM_ELEMENTS]; /**< The array of wheeltick elements. */ +} TWheelticks; + +/** + * Callback type for wheel tick sensor service. + * Use this type of callback if you want to register for wheel tick data. + * Wheel tick data can be provided for multiple WheelIds. E.g. data can be provided for all 4 wheels. + * This callback may return buffered data (numElements >1) for different reasons + * for (large) portions of data buffered at startup + * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency) + * If the array contains (numElements >1), the elements will be ordered with rising timestamps + * @param ticks pointer to an array of TWheelticks with size numElements + * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided. + */ +typedef void (*WheeltickCallback)(const TWheelticks ticks[], uint16_t numElements); + +/** + * Initialization of the wheel tick sensor service. + * Must be called before using the wheel tick sensor service to set up the service. + * @return True if initialization has been successfull. + */ +bool snsWheeltickInit(); + +/** + * Destroy the wheel tick sensor service. + * Must be called after using the wheel tick sensor service to shut down the service. + * @return True if shutdown has been successfull. + */ +bool snsWheeltickDestroy(); + +/** + * Provide meta information about sensor service. + * The meta data of a sensor service provides information about it's name, version, type, subtype, sampling frequency etc. + * @param data Meta data content about the sensor service. + * @return True if meta data is available. + */ +bool snsWheelTickGetMetaData(TSensorMetaData *data); + +/** + * Wheel ticks per revolution + * Static configuration value that specifies how many wheel ticks there are per a single revolution of one wheel. + * @param ticks The number of ticks for a single revolution of one wheel + * @return True if configuration data is available. + */ +bool snsWheeltickGetWheelticksPerRevolution(uint16_t* ticks); + +/** + * Maximum value of vehicle specific wheel tick rolling counters + * Static configuration value that specifies _after_ which value the wheel tick counter will roll over. + * Some examples + * if full 15bit are used for the vehicle specifc rolling wheel counters, the maximum value would be 0x7FFF = 32767 + * if 15bit are used but the last value 0x7FFF is reserved as SNA then the maximum value would be 0x7FFE = 32766 + * @param max_count The maximum value of wheel tick rolling counters + * @return True if configuration data is available. If false no value could be provided and an overflow only at the uint32 size shall be assumed. + */ +bool snsWheeltickGetWheelticksCountMax(uint32_t* max_count); + +/** + * Method to get the wheel tick data at a specific point in time. + * @param ticks After calling the method the currently available wheel tick data is written into the array. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsWheeltickGetWheelticks(TWheelticks *ticks); + +/** + * Register callback for multiple wheel tick information. + * This is the recommended method for continuously accessing the wheel tick data. + * The callback will be invoked when new wheel tick data is available. + * @param callback The callback which should be registered. + * @return True if callback has been registered successfully. + */ +bool snsWheeltickRegisterCallback(WheeltickCallback callback); + +/** + * Deregister multiple wheel tick callback. + * After calling this method no new wheel tick data will be delivered to the client. + * @param callback The callback which should be deregistered. + * @return True if callback has been deregistered successfully. + */ +bool snsWheeltickDeregisterCallback(WheeltickCallback callback); + +/** + * A single angular wheel speed information. + * No valid flags are provided for the angular wheel speeds as this information is transferred as an array. + * If data is not valid the data is simply omitted from transfer. + */ +typedef struct { + EWheelId id; + float rotations; /**< unit is [1/s] rotation per seconds */ +} TWheelspeedAngularDetail; + +/** + * Angular wheel speed information for multiple wheels. + * Container with timestamp as used by callback and get function. + */ +typedef struct { + uint64_t timestamp; /**< Timestamp of the acquisition of this angular wheel speed signal [ms]. + All sensor/GNSS timestamps must be based on the same time source. */ + TWheelspeedAngularDetail elements[WHEEL_NUM_ELEMENTS]; /**< The array of angular wheel speed elements. */ +} TWheelspeedAngular; + +/** + * Callback type for angular wheel speed sensor service. + * Use this type of callback if you want to register for angular wheel speed data. + * Wheel tick data can be provided for multiple WheelIds. E.g. data can be provided for all 4 wheels. + * This callback may return buffered data (numElements >1) for different reasons + * for (large) portions of data buffered at startup + * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency) + * If the array contains (numElements >1), the elements will be ordered with rising timestamps + * @param ticks pointer to an array of TWheelspeedAngular with size numElements + * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided. + */ +typedef void (*WheelspeedAngularCallback)(const TWheelspeedAngular rotations[], uint16_t numElements); + +/** + * Initialization of the angular wheel speed sensor service. + * Must be called before using the angular wheel speed sensor service to set up the service. + * @return True if initialization has been successfull. + */ +bool snsWheelspeedAngularInit(); + +/** + * Destroy the angular wheel speed sensor service. + * Must be called after using the angular wheel speed sensor service to shut down the service. + * @return True if shutdown has been successfull. + */ +bool snsWheelspeedAngularDestroy(); + +/** + * Provide meta information about sensor service. + * The meta data of a sensor service provides information about it's name, version, type, subtype, sampling frequency etc. + * @param data Meta data content about the sensor service. + * @return True if meta data is available. + */ +bool snsWheelspeedAngularGetMetaData(TSensorMetaData *data); + +/** + * Method to get the angular wheel speed data at a specific point in time. + * @param wsa After calling the method the currently available angular wheel speed data is written into the array. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsWheelspeedAngularGet(TWheelspeedAngular* wsa); + +/** + * Register callback for multiple angular wheel speed information. + * This is the recommended method for continuously accessing the angular wheel speed data. + * The callback will be invoked when new angular wheel speed data is available. + * @param callback The callback which should be registered. + * @return True if callback has been registered successfully. + */ +bool snsWheelspeedAngularRegisterCallback(WheelspeedAngularCallback callback); + +/** + * Deregister multiple angular wheel speed callback. + * After calling this method no new angular wheel speed will be delivered to the client. + * @param callback The callback which should be deregistered. + * @return True if callback has been deregistered successfully. + */ +bool snsWheelspeedAngularDeregisterCallback(WheelspeedAngularCallback callback); + +/** + * A single wheel speed information. + * No valid flags are provided for the wheel speeds as this information is transferred as an array. + * If data is not valid the data is simply omitted from transfer. + */ +typedef struct { + EWheelId id; + float speedOfWheel; /**< [m/s] */ +} TWheelspeedDetail; +/** + * Wheel speed information for multiple wheels. + * Container with timestamp as used by callback and get function. + */ +typedef struct { + uint64_t timestamp; /**< Timestamp of the acquisition of this wheel speed signal [ms]. + All sensor/GNSS timestamps must be based on the same time source. */ + TWheelspeedDetail elements[WHEEL_NUM_ELEMENTS]; /**< The array of wheel speed elements. */ +} TWheelspeed; + +/** + * Callback type for wheel speed sensor service. + * Use this type of callback if you want to register for wheel speed data. + * Wheel tick data can be provided for multiple WheelIds. E.g. data can be provided for all 4 wheels. + * This callback may return buffered data (numElements >1) for different reasons + * for (large) portions of data buffered at startup + * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency) + * If the array contains (numElements >1), the elements will be ordered with rising timestamps + * @param wheelspeed pointer to an array of TWheelspeed with size numElements + * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided. + */ +typedef void (*WheelspeedCallback)(const TWheelspeed wheelspeed[], uint16_t numElements); + +/** + * Initialization of the wheel speed sensor service. + * Must be called before using the wheel tick sensor service to set up the service. + * @return True if initialization has been successfull. + */ +bool snsWheelspeedInit(); + +/** + * Destroy the wheel tick sensor service. + * Must be called after using the wheel speed sensor service to shut down the service. + * @return True if shutdown has been successfull. + */ +bool snsWheelspeedDestroy(); + +/** + * Provide meta information about sensor service. + * The meta data of a sensor service provides information about it's name, version, type, subtype, sampling frequency etc. + * @param data Meta data content about the sensor service. + * @return True if meta data is available. + */ +bool snsWheelspeedGetMetaData(TSensorMetaData *data); + +/** + * Method to get the wheel speed data at a specific point in time. + * @param wheelspeed After calling the method the currently available wheel speed data is written into the array. + * @return Is true if data can be provided and false otherwise, e.g. missing initialization + */ +bool snsWheelspeedGet(TWheelspeed* wheelspeed); + +/** + * Register callback for multiple wheel speed information. + * This is the recommended method for continuously accessing the wheel speed data. + * The callback will be invoked when new angular wheel speed data is available. + * @param callback The callback which should be registered. + * @return True if callback has been registered successfully. + */ +bool snsWheelspeedRegisterCallback(WheelspeedCallback callback); + +/** + * Deregister multiple wheel speed callback. + * After calling this method no new wheel speed will be delivered to the client. + * @param callback The callback which should be deregistered. + * @return True if callback has been deregistered successfully. + */ +bool snsWheelspeedDeregisterCallback(WheelspeedCallback callback); + +/** + * Tire rolling circumference as provided in the official documents. This is a static configuration. Unit: [m]. + * Static configuration value that specifies the distance travelled on the ground per a single revolution of one wheel. + * This may be useful for calculations based on wheel ticks or angular wheel speeds + * @param circumference The tire rolling circumference in m is written to this parameter as a result. + * @return True if configuration data is available. If false no value could be provided. + */ +bool snsWheelGetTireRollingCircumference(float* circumference); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDE_GENIVI_WHEELTICK */ |