# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # Principle (WIN-DESKTOP): On windows, sensors are used through handlers (callbacks) whiches react to 3 different events (OnDataUpdated, OnStateChanged, OnLeave). A manager is used to store the list of all available sensors. It is also this manager that can attach a handler to the event "OnSensorEnter". We also can get data by synchrone method 'GetData' on each sensor. It returns the last data report. An API Reference is at this adress (05-28-2015) : https://msdn.microsoft.com/en-us/library/windows/desktop/dd318966(v=vs.85).aspx Principle (ANDROID): Android sensor api (NDK) is more complex than windows's. Sensor management are based on Loopers. Loopers are objects attached to a thread to sequentialy handle messages. Here these messages will be sensor events. Each message processed by a looper correspond to an Identifier. 3 Looper Identifiers are given by android_native_app_glue.h: . LOOPER_ID_MAIN, which correspond to activity lifecycle events (pause, resume, ...) . LOOPER_ID_INPUT, which correspond to input events . LOOPER_ID_USER, which is an identifier that can be user by the user for any purpose. Each activity has a default Looper, corresponding to its thread. This Looper process activity lifecycle and input events (coreesponding to LOOPER_ID_MAIN and LOOPER_ID_INPUT). The developper can define new Looper Identifiers to be more implicit, as long as new Identifiers are superior to LOOPER_ID_USER. For example, we could define and use "LOOPER_ID_SENSOR = LOOPER_ID_USER + 1" to identify every sensor event. We could also define an identifier for each sensor. But I'm not sure it would be a great idea. So basicaly on android, we create a SensorEventQueue attached to a Looper. It will send the looper messages (events) for every sensor we enable in this SensorEventQueue. We have to define the Looper Identifier the Looper will use to sort these messages. If we define a callback to process messages, this identifier must be: ALOOPER_POLL_CALLBACK. It seems possible to create as many SensorEventQueue as we want. But I'm not sure making too much of them would be good. There is two ways to process sensor events. It is possible to design a callback to call on each message from the SensorEventQueue received by the Looper. This callback should be typed "ALooper_callbackFunc". We also can pull events one by one from the queue to process them. Ps: SensorEventQueue are file descriptors given to the Looper. # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # Manager (WIN-DESKTOP): ISensorManager . get sensor by ID, CATEGORY, TYPE . request user permission to access sensor data . definable callback to take care of added (or enabled) sensors after init Manager (ANDROID): ASensorManager . get the list of all available sensors on the device . get the default sensor of the given type (possibility to filter by a given "wakeUp" setting) . create or destroy EventQueue(s) # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # Sensor (WIN-DESKTOP): ISensor . category . the most recent data report . event interest settings . friendly sensor name (string) . unique identifier . state . supported data fields . type ID Sensor (ANDROID): ASensor . name . vendor . type (string or int) . resolution . minimal delay between events . wakeUp . batch size and batch max size (hardware FIFO) . reporting mode # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # Sensor States (WIN-DESKTOP): > enum SensorState < SENSOR_STATE_MIN . Minimum enumerated sensor state. Use SENSOR_STATE_READY instead. SENSOR_STATE_READY . Ready to send sensor data. SENSOR_STATE_NOT_AVAILABLE . The sensor is not available for use. SENSOR_STATE_NO_DATA . The sensor is available but does not have data. SENSOR_STATE_INITIALIZING . The sensor is available, but performing initialization. Try again later. SENSOR_STATE_ACCESS_DENIED . The sensor is available, but the user account does not have permission to access the sensor data. For more information about permissions, see Managing User Permissions. SENSOR_STATE_ERROR . The sensor has raised an error. SENSOR_STATE_MAX . Maximum enumerated sensor state. Not a valid value Sensor Connection Type (WIN-DESKTOP): > enum SensorConnectionType < SENSOR_CONNECTION_TYPE_PC_INTEGRATED . The sensor device is built into the computer. SENSOR_CONNECTION_TYPE_PC_ATTACHED . The sensor device is attached to the computer, such as through a peripheral device. SENSOR_CONNECTION_TYPE_PC_EXTERNAL . The sensor device is connected by external means, such as through a network connection. # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # Sensor Category (WIN-DESKTOP): SENSOR_CATEGORY_ALL SENSOR_CATEGORY_BIOMETRIC . SENSOR_TYPE_HUMAN_PRESENCE ....................... SENSOR_DATA_TYPE_HUMAN_PRESENCE ...................................... VT_BOOL ............ BOOL . SENSOR_TYPE_HUMAN_PROXIMITY ...................... SENSOR_DATA_TYPE_HUMAN_PROXIMITY_METERS .............................. VT_R4 .............. METERS . SENSOR_TYPE_TOUCH ................................ SENSOR_DATA_TYPE_TOUCH_STATE ......................................... VT_BOOL ............ BOOL SENSOR_CATEGORY_ELECTRICAL . SENSOR_TYPE_CAPACITANCE .......................... SENSOR_DATA_TYPE_CAPACITANCE_FARAD ................................... VT_R8 .............. FARADS . SENSOR_TYPE_CURRENT .............................. SENSOR_DATA_TYPE_CURRENT_AMPS ........................................ VT_R8 .............. AMPERES . SENSOR_TYPE_ELECTRICAL_POWER ..................... SENSOR_DATA_TYPE_ELECTRICAL_POWER_WATTS .............................. VT_R8 .............. WATTS . SENSOR_TYPE_FREQUENCY ............................ SENSOR_DATA_TYPE_ELECTRICAL_FREQUENCY_HERTZ .......................... VT_R8 .............. HERTZ . SENSOR_TYPE_INDUCTANCE ........................... SENSOR_DATA_TYPE_INDUCTANCE_HENRY .................................... VT_R8 .............. HENRIES . SENSOR_TYPE_POTENTIOMETER ........................ SENSOR_DATA_TYPE_ELECTRICAL_PERCENT_OF_RANGE ......................... VT_R8 .............. PERCENTAGE OF RANGE . SENSOR_TYPE_RESISTANCE ........................... SENSOR_DATA_TYPE_RESISTANCE_OHMS ..................................... VT_R8 .............. OHMS . SENSOR_TYPE_VOLTAGE .............................. SENSOR_DATA_TYPE_VOLTAGE_VOLTS ....................................... VT_R8 .............. VOLTS SENSOR_CATEGORY_ENVIRONMENTAL . SENSOR_TYPE_ENVIRONMENTAL_ATMOSPHERIC_PRESSURE ... SENSOR_DATA_TYPE_ATMOSPHERIC_PRESSURE_BAR ............................ VT_R4 .............. BARS . SENSOR_TYPE_ENVIRONMENTAL_HUMIDITY ............... SENSOR_DATA_TYPE_RELATIVE_HUMIDITY_PERCENT ........................... VT_R4 .............. PERCENTAGE . SENSOR_TYPE_ENVIRONMENTAL_TEMPERATURE ............ SENSOR_DATA_TYPE_TEMPERATURE_CELSIUS ................................. VT_R4 .............. CELCIUS . SENSOR_TYPE_ENVIRONMENTAL_WIND_DIRECTION ......... SENSOR_DATA_TYPE_WIND_DIRECTION_DEGREES_ANTICLOCKWISE ................ VT_R4 .............. DEGREES (N = 0.0 and is top of x axis, anticlockwise) . SENSOR_TYPE_ENVIRONMENTAL_WIND_SPEED ............. SENSOR_DATA_TYPE_WIND_SPEED_METERS_PER_SECOND ........................ VT_R4 .............. METERS PER SECOND SENSOR_CATEGORY_LIGHT . SENSOR_TYPE_AMBIENT_LIGHT ........................ SENSOR_DATA_TYPE_LIGHT_CHROMACITY .................................... VT_VECTOR|VT_UI1 ... [VT_R4] ......................... ........................ SENSOR_DATA_TYPE_LIGHT_LEVEL_LUX ..................................... VT_R4 .............. LUX ......................... ........................ SENSOR_DATA_TYPE_LIGHT_TEMPERATURE_KELVIN ............................ VT_R4 .............. KELVIN SENSOR_CATEGORY_MECHANICAL . SENSOR_TYPE_BOOLEAN_SWITCH ....................... SENSOR_DATA_TYPE_BOOLEAN_SWITCH_STATE ................................ VT_BOOL ............ BOOL . SENSOR_TYPE_BOOLEAN_SWITCH_ARRAY ................. SENSOR_DATA_TYPE_BOOLEAN_SWITCH_ARRAY_STATES ......................... VT_UI4 ............. [BOOL] . SENSOR_TYPE_FORCE ................................ SENSOR_DATA_TYPE_FORCE_NEWTONS ....................................... VT_R8 .............. NEWTONS . SENSOR_TYPE_MULTIVALUE_SWITCH .................... SENSOR_DATA_TYPE_MULTIVALUE_SWITCH_STATE ............................. VT_R8 .............. STATE FIELD . SENSOR_TYPE_PRESSURE ............................. SENSOR_DATA_TYPE_GAUGE_PRESSURE_PASCAL ............................... VT_R8 .............. PASCALS .................... ............................. SENSOR_DATA_TYPE_ABSOLUTE_PRESSURE_PASCAL ............................ VT_R8 .............. PASCALS . SENSOR_TYPE_SCALE ................................ SENSOR_DATA_TYPE_WEIGHT_KILOGRAMS .................................... VT_R8 .............. KILOGRAMS . SENSOR_TYPE_STRAIN ............................... SENSOR_DATA_TYPE_STRAIN .............................................. VT_R8 .............. STRAIN SENSOR_CATEGORY_MOTION . SENSOR_TYPE_ACCELEROMETER_1D ..................... SENSOR_DATA_TYPE_ACCELERATION_X_G .................................... VT_R8 .............. G (X-Axis) ............................ ..................... SENSOR_DATA_TYPE_ACCELERATION_Y_G .................................... VT_R8 .............. G (Y-Axis) ............................ ..................... SENSOR_DATA_TYPE_ACCELERATION_Z_G .................................... VT_R8 .............. G (Z-Axis) . SENSOR_TYPE_ACCELEROMETER_2D ..................... SENSOR_DATA_TYPE_ACCELERATION_X_G .................................... VT_R8 .............. G (X-Axis) ............................ ..................... SENSOR_DATA_TYPE_ACCELERATION_Y_G .................................... VT_R8 .............. G (Y-Axis) ............................ ..................... SENSOR_DATA_TYPE_ACCELERATION_Z_G .................................... VT_R8 .............. G (Z-Axis) . SENSOR_TYPE_ACCELEROMETER_3D ..................... SENSOR_DATA_TYPE_ACCELERATION_X_G .................................... VT_R8 .............. G (X-Axis) ............................ ..................... SENSOR_DATA_TYPE_ACCELERATION_Y_G .................................... VT_R8 .............. G (Y-Axis) ............................ ..................... SENSOR_DATA_TYPE_ACCELERATION_Z_G .................................... VT_R8 .............. G (Z-Axis) . SENSOR_TYPE_GYROMETER_1D ......................... SENSOR_DATA_TYPE_ANGULAR_ACCELERATION_X_DEGREES_PER_SECOND_SQUARED ... VT_R8 .............. DEGREES PER SECOND SQUARED (X-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_ACCELERATION_Y_DEGREES_PER_SECOND_SQUARED ... VT_R8 .............. DEGREES PER SECOND SQUARED (Y-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_ACCELERATION_Z_DEGREES_PER_SECOND_SQUARED ... VT_R8 .............. DEGREES PER SECOND SQUARED (Z-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_VELOCITY_X_DEGREES_PER_SECOND ............... VT_R8 .............. DEGREES PER SECOND (X-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_VELOCITY_Y_DEGREES_PER_SECOND ............... VT_R8 .............. DEGREES PER SECOND (Y-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_VELOCITY_Z_DEGREES_PER_SECOND ............... VT_R8 .............. DEGREES PER SECOND (Z-Axis) . SENSOR_TYPE_GYROMETER_2D ......................... SENSOR_DATA_TYPE_ANGULAR_ACCELERATION_X_DEGREES_PER_SECOND_SQUARED ... VT_R8 .............. DEGREES PER SECOND SQUARED (X-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_ACCELERATION_Y_DEGREES_PER_SECOND_SQUARED ... VT_R8 .............. DEGREES PER SECOND SQUARED (Y-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_ACCELERATION_Z_DEGREES_PER_SECOND_SQUARED ... VT_R8 .............. DEGREES PER SECOND SQUARED (Z-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_VELOCITY_X_DEGREES_PER_SECOND ............... VT_R8 .............. DEGREES PER SECOND (X-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_VELOCITY_Y_DEGREES_PER_SECOND ............... VT_R8 .............. DEGREES PER SECOND (Y-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_VELOCITY_Z_DEGREES_PER_SECOND ............... VT_R8 .............. DEGREES PER SECOND (Z-Axis) . SENSOR_TYPE_GYROMETER_3D ......................... SENSOR_DATA_TYPE_ANGULAR_ACCELERATION_X_DEGREES_PER_SECOND_SQUARED ... VT_R8 .............. DEGREES PER SECOND SQUARED (X-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_ACCELERATION_Y_DEGREES_PER_SECOND_SQUARED ... VT_R8 .............. DEGREES PER SECOND SQUARED (Y-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_ACCELERATION_Z_DEGREES_PER_SECOND_SQUARED ... VT_R8 .............. DEGREES PER SECOND SQUARED (Z-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_VELOCITY_X_DEGREES_PER_SECOND ............... VT_R8 .............. DEGREES PER SECOND (X-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_VELOCITY_Y_DEGREES_PER_SECOND ............... VT_R8 .............. DEGREES PER SECOND (Y-Axis) ........................ ......................... SENSOR_DATA_TYPE_ANGULAR_VELOCITY_Z_DEGREES_PER_SECOND ............... VT_R8 .............. DEGREES PER SECOND (Z-Axis) . SENSOR_TYPE_MOTION_DETECTOR ...................... SENSOR_DATA_TYPE_MOTION_STATE ........................................ VT_BOOL ............ BOOL . SENSOR_TYPE_SPEEDOMETER .......................... SENSOR_DATA_TYPE_SPEED_METERS_PER_SECOND ............................. VT_R8 .............. METERS PER SECOND SENSOR_CATEGORY_ORIENTATION .................................................. SENSOR_DATA_TYPE_MAGNETOMETER_ACCURACY ............................... VT_I4 .............. ENUM . SENSOR_TYPE_AGGREGATED_DEVICE_ORIENTATION ........ SENSOR_DATA_TYPE_QUATERNION .......................................... VT_VECTOR|VT_UI1 ... [VT_R4] ......................................... ........ SENSOR_DATA_TYPE_ROTATION_MATRIX ..................................... VT_VECTOR|VT_UI1 ... [VT_R4] . SENSOR_TYPE_AGGREGATED_QUADRANT_ORIENTATION ...... SENSOR_DATA_TYPE_QUADRANT_ANGLE_DEGREES .............................. VT_R8 .............. DEGREES . SENSOR_TYPE_AGGREGATED_SIMPLE_DEVICE_ORIENTATION . SENSOR_DATA_TYPE_SIMPLE_DEVICE_ORIENTATION ........................... VT_UI4 ............. ENUM (one of four quadrants) . SENSOR_TYPE_COMPASS_1D ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_X_DEGREES .......................... VT_R4 .............. DEGREES ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_Y_DEGREES .......................... VT_R4 .............. DEGREES ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_Z_DEGREES .......................... VT_R4 .............. DEGREES ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_COMPENSATED_MAGNETIC_NORTH_DEGREES . VT_R8 .............. DEGREES * ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_COMPENSATED_TRUE_NORTH_DEGREES ..... VT_R8 .............. DEGREES ** ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_MAGNETIC_NORTH_DEGREES ............. VT_R8 .............. DEGREES *** ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_TRUE_NORTH_DEGREES.................. VT_R8 .............. DEGREES **** . SENSOR_TYPE_COMPASS_2D ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_X_DEGREES .......................... VT_R4 .............. DEGREES ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_Y_DEGREES .......................... VT_R4 .............. DEGREES ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_Z_DEGREES .......................... VT_R4 .............. DEGREES ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_COMPENSATED_MAGNETIC_NORTH_DEGREES . VT_R8 .............. DEGREES * ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_COMPENSATED_TRUE_NORTH_DEGREES ..... VT_R8 .............. DEGREES ** ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_MAGNETIC_NORTH_DEGREES ............. VT_R8 .............. DEGREES *** ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_TRUE_NORTH_DEGREES.................. VT_R8 .............. DEGREES **** . SENSOR_TYPE_COMPASS_3D ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_X_DEGREES .......................... VT_R4 .............. DEGREES ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_Y_DEGREES .......................... VT_R4 .............. DEGREES ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_Z_DEGREES .......................... VT_R4 .............. DEGREES ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_COMPENSATED_MAGNETIC_NORTH_DEGREES . VT_R8 .............. DEGREES * ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_COMPENSATED_TRUE_NORTH_DEGREES ..... VT_R8 .............. DEGREES ** ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_MAGNETIC_NORTH_DEGREES ............. VT_R8 .............. DEGREES *** ...................... ........................... SENSOR_DATA_TYPE_MAGNETIC_HEADING_TRUE_NORTH_DEGREES.................. VT_R8 .............. DEGREES **** . SENSOR_TYPE_DISTANCE_1D .......................... SENSOR_DATA_TYPE_DISTANCE_X_METERS ................................... VT_R4 .............. METERS ....................... .......................... SENSOR_DATA_TYPE_DISTANCE_Y_METERS ................................... VT_R4 .............. METERS ....................... .......................... SENSOR_DATA_TYPE_DISTANCE_Z_METERS ................................... VT_R4 .............. METERS . SENSOR_TYPE_DISTANCE_2D .......................... SENSOR_DATA_TYPE_DISTANCE_X_METERS ................................... VT_R4 .............. METERS ....................... .......................... SENSOR_DATA_TYPE_DISTANCE_Y_METERS ................................... VT_R4 .............. METERS ....................... .......................... SENSOR_DATA_TYPE_DISTANCE_Z_METERS ................................... VT_R4 .............. METERS . SENSOR_TYPE_DISTANCE_3D .......................... SENSOR_DATA_TYPE_DISTANCE_X_METERS ................................... VT_R4 .............. METERS ....................... .......................... SENSOR_DATA_TYPE_DISTANCE_Y_METERS ................................... VT_R4 .............. METERS ....................... .......................... SENSOR_DATA_TYPE_DISTANCE_Z_METERS ................................... VT_R4 .............. METERS . SENSOR_TYPE_INCLINOMETER_1D ...................... SENSOR_DATA_TYPE_TILT_X_DEGREES ...................................... VT_R4 .............. DEGREES ........................... ...................... SENSOR_DATA_TYPE_TILT_Y_DEGREES ...................................... VT_R4 .............. DEGREES ........................... ...................... SENSOR_DATA_TYPE_TILT_Z_DEGREES ...................................... VT_R4 .............. DEGREES . SENSOR_TYPE_INCLINOMETER_2D ...................... SENSOR_DATA_TYPE_TILT_X_DEGREES ...................................... VT_R4 .............. DEGREES ........................... ...................... SENSOR_DATA_TYPE_TILT_Y_DEGREES ...................................... VT_R4 .............. DEGREES ........................... ...................... SENSOR_DATA_TYPE_TILT_Z_DEGREES ...................................... VT_R4 .............. DEGREES . SENSOR_TYPE_INCLINOMETER_3D ...................... SENSOR_DATA_TYPE_TILT_X_DEGREES ...................................... VT_R4 .............. DEGREES ........................... ...................... SENSOR_DATA_TYPE_TILT_Y_DEGREES ...................................... VT_R4 .............. DEGREES ........................... ...................... SENSOR_DATA_TYPE_TILT_Z_DEGREES ...................................... VT_R4 .............. DEGREES SENSOR_CATEGORY_SCANNER . SENSOR_TYPE_BARCODE_SCANNER .................................................................................................................. . SENSOR_TYPE_RFID_SCANNER ......................... SENSOR_DATA_TYPE_RFID_TAG_40_BIT ..................................... VT_UI8 ............. 40-bit radio frequency ID tag value SENSOR_CATEGORY_LOCATION (see https://msdn.microsoft.com/en-us/library/windows/desktop/dd318981(v=vs.85).aspx) . SENSOR_TYPE_LOCATION_BROADCAST . SENSOR_TYPE_LOCATION_DEAD_RECKONING . SENSOR_TYPE_LOCATION_GPS . SENSOR_TYPE_LOCATION_LOOKUP . SENSOR_TYPE_LOCATION_OTHER . SENSOR_TYPE_LOCATION_STATIC . SENSOR_TYPE_LOCATION_TRIANGULATION >---- * Compensated compass heading relative to magnetic North in degrees. This compensation causes the measurement of the heading angle to be represented as if a compass device is laying flat on level ground where the PC is located. ** Compensated compass heading relative to true North in degrees. This compensation causes the measurement of the heading angle to be represented as if a compass device is laying flat on level ground where the PC is located. *** Uncompensated compass heading relative to magnetic North in degrees. The measurement of the heading angle is represented as measured on the plane that the compass device is installed relative to. **** Uncompensated compass heading relative to true North in degrees. The measurement of the heading angle is represented as measured on the plane that the compass device is installed relative to. >---- Values type (WIN-DESKTOP): typedef struct PROPVARIANT { VARTYPE vt; // ........................... Value type tag WORD wReserved1; // ................... Reserved for future use WORD wReserved2; // ................... Reserved for future use WORD wReserved3; // ................... Reserved for future use union { CHAR cVal; // ............. VT_I1 (Version 1) UCHAR bVal; // ............. VT_UI1 SHORT iVal; // ............. VT_I2 USHORT uiVal; // ............ VT_UI2 LONG lVal; // ............. VT_I4 ULONG ulVal; // ............ VT_UI4 INT intVal; // ........... VT_INT (Version 1) UINT uintVal; // .......... VT_UINT (Version 1) LARGE_INTEGER hVal; // ............. VT_I8 ULARGE_INTEGER uhVal; // ............ VT_UI8 FLOAT fltVal; // ........... VT_R4 DOUBLE dblVal; // ........... VT_R8 VARIANT_BOOL boolVal; // .......... VT_BOOL SCODE scode; // ............ VT_ERROR CY cyVal; // ............ VT_CY DATE date; // ............. VT_DATE FILETIME filetime; // ......... VT_FILETIME CLSID *puuid; // ........... VT_CLSID CLIPDATA *pclipdata; // ....... VT_CF BSTR bstrVal; // .......... VT_BSTR BSTRBLOB bstrblobVal; // ...... VT_BSTR_BLOB BLOB blob; // ............. VT_BLOB, VT_BLOBOBJECT LPSTR pszVal; // ........... VT_LPSTR LPWSTR pwszVal; // .......... VT_LPWSTR IUnknown *punkVal; // ......... VT_UNKNOWN IDispatch *pdispVal; // ........ VT_DISPATCH IStream *pStream; // ......... VT_STREAM, VT_STREAMED_OBJECT IStorage *pStorage; // ........ VT_STORAGE, VT_STORED_OBJECT LPVERSIONEDSTREAM pVersionedStream; // . VT_VERSIONED_STREAM LPSAFEARRAY parray; // ........... VT_ARRAY | VT_* (Version 1) CAC cac; // .............. VT_VECTOR | VT_I1 (Version 1) CAUB caub; // ............. VT_VECTOR | VT_UI1 CAI cai; // .............. VT_VECTOR | VT_I2 CAUI caui; // ............. VT_VECTOR | VT_UI2 CAL cal; // .............. VT_VECTOR | VT_I4 CAUL caul; // ............. VT_VECTOR | VT_UI4 CAH cah; // .............. VT_VECTOR | VT_I8 CAUH cauh; // ............. VT_VECTOR | VT_UI8 CAFLT caflt; // ............ VT_VECTOR | VT_R4 CADBL cadbl; // ............ VT_VECTOR | VT_R8 CABOOL cabool; // ........... VT_VECTOR | VT_BOOL CASCODE cascode; // .......... VT_VECTOR | VT_ERROR CACY cacy; // ............. VT_VECTOR | VT_CY CADATE cadate; // ........... VT_VECTOR | VT_DATE CAFILETIME cafiletime; // ....... VT_VECTOR | VT_FILETIME CACLSID cauuid; // ........... VT_VECTOR | VT_CLSID CACLIPDATA caclipdata; // ....... VT_VECTOR | VT_CF CABSTR cabstr; // ........... VT_VECTOR | VT_BSTR CABSTRBLOB cabstrblob; // ....... VT_VECTOR | VT_BSTR_BLOB CALPSTR calpstr; // .......... VT_VECTOR | VT_LPSTR CALPWSTR calpwstr; // ......... VT_VECTOR | VT_LPWSTR CAPROPVARIANT capropvar; // ........ VT_VECTOR | VT_VARIANT CHAR *pcVal; // ........... VT_BYREF | VT_I1 (Version 1) UCHAR *pbVal; // ........... VT_BYREF | VT_UI1 (Version 1) SHORT *piVal; // ........... VT_BYREF | VT_I2 (Version 1) USHORT *puiVal; // .......... VT_BYREF | VT_UI2 (Version 1) LONG *plVal; // ........... VT_BYREF | VT_I4 (Version 1) ULONG *pulVal; // .......... VT_BYREF | VT_UI4 (Version 1) INT *pintVal; // ......... VT_BYREF | VT_INT (Version 1) UINT *puintVal; // ........ VT_BYREF | VT_UINT (Version 1) FLOAT *pfltVal; // ......... VT_BYREF | VT_R4 (Version 1) DOUBLE *pdblVal; // ......... VT_BYREF | VT_R8 (Version 1) VARIANT_BOOL *pboolVal; // ........ VT_BYREF | VT_BOOL (Version 1) DECIMAL *pdecVal; // ......... VT_BYREF | VT_DECIMAL (Version 1) SCODE *pscode; // .......... VT_BYREF | VT_ERROR (Version 1) CY *pcyVal; // .......... VT_BYREF | VT_CY (Version 1) DATE *pdate; // ........... VT_BYREF | VT_DATE (Version 1) BSTR *pbstrVal; // ........ VT_BYREF | VT_BSTR (Version 1) IUnknown **ppunkVal; // ....... VT_BYREF | VT_UNKNOWN (Version 1) IDispatch **ppdispVal; // ...... VT_BYREF | VT_DISPATCH (Version 1) LPSAFEARRAY *pparray; // ......... VT_BYREF | VT_ARRAY (Version 1) PROPVARIANT *pvarVal; // ......... VT_BYREF | VT_VARIANT (Version 1) }; } PROPVARIANT; Propvariant ......... Propvariant ...... Value type ................ member ........... representation ..................... .................. ................ VT_EMPTY ............ None ............. A property with a type indicator of VT_EMPTY has no data associated with it; that is, the size of the value is zero. VT_NULL ............. None ............. This is like a pointer to NULL. VT_I1 ............... cVal ............. 1-byte signed integer. VT_UI1 .............. bVal ............. 1-byte unsigned integer. VT_I2 ............... iVal ............. Two bytes representing a 2-byte signed integer value. VT_UI2 .............. uiVal ............ 2-byte unsigned integer. VT_I4 ............... lVal ............. 4-byte signed integer value. VT_UI4 .............. ulVal ............ 4-byte unsigned integer. VT_INT .............. intVal ........... 4-byte signed integer value (equivalent to VT_I4). VT_UINT ............. uintVal .......... 4-byte unsigned integer (equivalent to VT_UI4). VT_I8 ............... hVal ............. 8-byte signed integer. VT_UI8 .............. uhVal ............ 8-byte unsigned integer. VT_R4 ............... fltVal ........... 32-bit IEEE floating point value. VT_R8 ............... dblVal ........... 64-bit IEEE floating point value. VT_BOOL ............. boolVal .......... (bool in earlier designs) Boolean value, a WORD that contains 0 (FALSE) or -1 (TRUE). VT_ERROR ............ scode ............ A DWORD that contains a status code. VT_CY ............... cyVal ............ 8-byte two's complement integer (scaled by 10,000). This type is commonly used for currency amounts. VT_DATE ............. date ............ A 64-bit floating point number representing the number of days (not seconds) since December 31, 1899. For example, January 1, 1900, is 2.0, January 2, 1900, is 3.0, and so on). This is stored in the same representation as VT_R8. VT_FILETIME ......... filetime ......... 64-bit FILETIME structure as defined by Win32. It is recommended that all times be stored in Universal Coordinate Time (UTC). VT_CLSID ............ puuid ............ Pointer to a class identifier (CLSID) (or other globally unique identifier (GUID)). VT_CF ............... pclipdata ........ Pointer to a CLIPDATA structure, described above. VT_BSTR ............. bstrVal .......... Pointer to a null-terminated Unicode string. The string is immediately preceded by a DWORD representing the byte count, but bstrVal points past this DWORD to the first character of the string. BSTRs must be allocated and freed using the Automation SysAllocString and SysFreeString calls. VT_BSTR_BLOB ........ bstrblobVal ...... For system use only. VT_BLOB ............. blob ............. DWORD count of bytes, followed by that many bytes of data. The byte count does not include the four bytes for the length of the count itself; an empty blob member would have a count of zero, followed by zero bytes. This is similar to the value VT_BSTR, but does not guarantee a null byte at the end of the data. VT_BLOBOBJECT ....... blob ............. A blob member that contains a serialized object in the same representation that would appear in VT_STREAMED_OBJECT. That is, a DWORD byte count (where the byte count does not include the size of itself) which is in the format of a class identifier followed by initialization data for that class. The only significant difference between VT_BLOB_OBJECT and VT_STREAMED_OBJECT is that the former does not have the system-level storage overhead that the latter would have, and is therefore more suitable for scenarios involving numbers of small objects. VT_LPSTR ............ pszVal ........... A pointer to a null-terminated ANSI string in the system default code page. VT_LPWSTR ........... pwszVal .......... A pointer to a null-terminated Unicode string in the user default locale. VT_UNKNOWN .......... punkVal .......... New. VT_DISPATCH ......... pdispVal ......... New. VT_STREAM ........... pStream .......... A pointer to an IStream interface that represents a stream which is a sibling to the "Contents" stream. VT_STREAMED_OBJECT .. pStream .......... As in VT_STREAM, but indicates that the stream contains a serialized object, which is a CLSID followed by initialization data for the class. The stream is a sibling to the "Contents" stream that contains the property set. VT_STORAGE .......... pStorage ......... A pointer to an IStorage interface, representing a storage object that is a sibling to the "Contents" stream. VT_STORED_OBJECT .... pStorage ......... As in VT_STORAGE, but indicates that the designated IStorage contains a loadable object. VT_VERSIONED_STREAM . pVersionedStream . A stream with a GUID version. VT_DECIMAL .......... decVal ........... A DECIMAL structure. VT_VECTOR ........... ca* .............. If the type indicator is combined with VT_VECTOR by using an OR operator, the value is one of the counted array values. This creates a DWORD count of elements, followed by a pointer to the specified repetitions of the value. For example, a type indicator of VT_LPSTR|VT_VECTOR has a DWORD element count, followed by a pointer to an array of LPSTR elements. VT_ARRAY ............ Parray ........... If the type indicator is combined with VT_ARRAY by an OR operator, the value is a pointer to a SAFEARRAY. VT_ARRAY can use the OR with the following data types: VT_I1, VT_UI1, VT_I2, VT_UI2, VT_I4, VT_UI4, VT_INT, VT_UINT, VT_R4, VT_R8, VT_BOOL, VT_DECIMAL, VT_ERROR, VT_CY, VT_DATE, VT_BSTR, VT_DISPATCH, VT_UNKNOWN, and VT_VARIANT. VT_ARRAY cannot use OR with VT_VECTOR. VT_BYREF ............ p* ............... If the type indicator is combined with VT_BYREF by an OR operator, the value is a reference. Reference types are interpreted as a reference to data, similar to the reference type in C++ (for example, "int&"). VT_VARIANT .......... capropvar ........ A DWORD type indicator followed by the corresponding value. VT_VARIANT can be used only with VT_VECTOR or VT_BYREF. >---- VT_BYREF .... can use OR with the following types: VT_I1, VT_UI1, VT_I2, VT_UI2, VT_I4, VT_UI4, VT_INT, VT_UINT, VT_R4, VT_R8, VT_BOOL, VT_DECIMAL, VT_ERROR, VT_CY, VT_DATE, VT_BSTR, VT_UNKNOWN, VT_DISPATCH, VT_ARRAY, and VT_VARIANT. VT_VECTOR ... can be combined by an OR operator with the following types: VT_I1, VT_UI1, VT_I2, VT_UI2, VT_BOOL, VT_I4, VT_UI4, VT_R4, VT_R8, VT_ERROR, VT_I8, VT_UI8, VT_CY, VT_DATE, VT_FILETIME, VT_CLSID, VT_CF, VT_BSTR, VT_LPSTR, VT_LPWSTR, and VT_VARIANT. VT_VECTOR can also be combined by an OR operation with VT_BSTR_BLOB, however it is for system use only. VT_TYPEMASK . Used as a mask for VT_VECTOR and other modifiers to extract the raw VT value. >---- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # Sensor Types (ANDROID): TYPE_ACCELEROMETER ............... METERS PER SECOND SQUARED (X axis - Y axis - Z axis) TYPE_AMBIENT_TEMPERATURE ......... CELCIUS TYPE_GAME_ROTATION_VECTOR ........ METERS PER SECOND SQUARED (X axis - Y axis - Z axis) TYPE_GEOMAGNETIC_ROTATION_VECTOR . TYPE_GRAVITY ..................... TYPE_GYROSCOPE ................... RADS PER SECOND (X axis - Y axis - Z axis) TYPE_GYROSCOPE_UNCALIBRATED ...... RADS PER SECOND (X axis - Y axis - Z axis) TYPE_HEART_RATE .................. TYPE_LIGHT ....................... ILLUMINANCE (LUX) TYPE_LINEAR_ACCELERATION ......... METERS PER SECOND SQUARED (X axis - Y axis - Z axis) TYPE_MAGNETIC_FIELD .............. µTESLA (X axis - Y axis - Z axis) TYPE_MAGNETIC_FIELD_UNCALIBRATED . TYPE_ORIENTATION ................. azimuth, pitch, roll TYPE_PRESSURE .................... hPa or mbar TYPE_PROXIMITY ................... cm relative to the view screen of a device TYPE_RELATIVE_HUMIDITY ........... % TYPE_ROTATION_VECTOR ............. the three elements of the device's rotation vector TYPE_SIGNIFICANT_MOTION .......... TYPE_STEP_COUNTER ................ TYPE_STEP_DETECTOR ............... # ----- # ----- # ----- # Sensor Event (Android): typedef struct ASensorEvent { int32_t version; /* sizeof(struct ASensorEvent) */ int32_t sensor; int32_t type; int32_t reserved0; int64_t timestamp; union { union { float data[16]; ASensorVector vector; ASensorVector acceleration; ASensorVector magnetic; float temperature; float distance; float light; float pressure; float relative_humidity; AUncalibratedEvent uncalibrated_gyro; AUncalibratedEvent uncalibrated_magnetic; AMetaDataEvent meta_data; AHeartRateEvent heart_rate; }; union { uint64_t data[8]; uint64_t step_counter; } u64; }; uint32_t flags; int32_t reserved1[3]; } ASensorEvent; # ----- # ----- # ----- # Sensor Vector (Android): typedef struct ASensorVector { union { float v[3]; // thanks to the union, we can access first data by the name x, or v[0], or azimuth. doesn't change anything struct { float x; float y; float z; }; struct { float azimuth; // Z-axis (clockwise from north) float pitch; // X-axis float roll; // Y-axis }; }; int8_t status; uint8_t reserved[3]; } ASensorVector; # ----- # ----- # ----- # MetaData Event (Android): typedef struct AMetaDataEvent { int32_t what; int32_t sensor; } AMetaDataEvent; # ----- # ----- # ----- # Uncalibrated Event (Android): typedef struct AUncalibratedEvent { union { float uncalib[3]; struct { float x_uncalib; float y_uncalib; float z_uncalib; }; }; union { float bias[3]; struct { float x_bias; float y_bias; float z_bias; }; }; } AUncalibratedEvent; # ----- # ----- # ----- # HeartRate Event (Android): typedef struct AHeartRateEvent { float bpm; int8_t status; } AHeartRateEvent; # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # Definition of the axis (ANDROID): Android API is relative to the screen of the device in its default orientation, that is, if the device can be used in portrait or landscape, this API is only relative to the NATURAL orientation of the screen. In other words, the axis are not swapped when the device's screen orientation changes. Higher level services /may/ perform this transformation. x<0 x>0 ^ | +-----------+--> y>0 | | | | | | | | / z<0 | | / | | / O-----------+/ |[] [ ] []/ +----------/+ y<0 / / |/ z>0 (toward the sky) O: Origin (x=0,y=0,z=0) # ----- # ----- # ----- # Orientation (ANDROID): All values are angles in degrees. azimuth: angle between the magnetic north direction and the Y axis, around the Z axis (0<=azimuth<360). 0=North, 90=East, 180=South, 270=West pitch: Rotation around X axis (-180<=pitch<=180), with positive values when the z-axis moves toward the y-axis. roll: Rotation around Y axis (-90<=roll<=90), with positive values when the x-axis moves AWAY from the z-axis. Note: This definition is different from yaw, pitch and roll used in aviation where the X axis is along the long side of the plane (tail to nose). # ----- # ----- # ----- # Acceleration All values are in SI units (m/s^2) and measure the acceleration of the device minus the force of gravity. x: Acceleration minus Gx on the x-axis y: Acceleration minus Gy on the y-axis z: Acceleration minus Gz on the z-axis Examples: When the device lies flat on a table and is pushed on its left side toward the right, the x acceleration value is positive. When the device lies flat on a table, the acceleration value is +9.81, which correspond to the acceleration of the device (0 m/s^2) minus the force of gravity (-9.81 m/s^2). When the device lies flat on a table and is pushed toward the sky, the acceleration value is greater than +9.81, which correspond to the acceleration of the device (+A m/s^2) minus the force of gravity (-9.81 m/s^2). # ----- # ----- # ----- # Magnetic Field All values are in micro-Tesla (uT) and measure the ambient magnetic field in the X, Y and Z axis. ------------------------------------------------------------------------------ Vocabulary IMU : Inertial Measurement Units MEMS : Micro-Electro-Mechanical-Systems http://www.pieter-jan.com/node/11 The gyrometer signal drifts. The accelerometer is subject to gravity noise. The magnetometer is subject to magnetic noise. 100 Hz pour la callback des capteurs: - antivomitif (réactif) ATTENTION: windows convertir les G en m/s²