Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e72046f authored by Peng Xu's avatar Peng Xu
Browse files

Implementation of sensor additional info report

This implements a mechanism for sensor hardware/HAL to deliver additional information beside sensor
readings to application. It includes internal temperature reading, untracked delay of sample,
location and pose of sensor device placement in phone frame, etc. This is also a very expandable
frame to account for future need.

Change-Id: Ib7780ac765f24d14eaed72b9862cd84b76054d74
parent c19f9a1f
Loading
Loading
Loading
Loading
+28 −18
Original line number Diff line number Diff line
@@ -208,10 +208,19 @@ typedef struct AHeartRateEvent {
} AHeartRateEvent;

typedef struct ADynamicSensorEvent {
    bool  connected;
    int   handle;
    int32_t  connected;
    int32_t  handle;
} ADynamicSensorEvent;

typedef struct {
    int32_t type;
    int32_t serial;
    union {
        int32_t data_int32[14];
        float   data_float[14];
    };
} AAdditionalInfoEvent;

/* NOTE: Must match hardware/sensors.h */
typedef struct ASensorEvent {
    int32_t version; /* sizeof(struct ASensorEvent) */
@@ -235,6 +244,7 @@ typedef struct ASensorEvent {
            AMetaDataEvent meta_data;
            AHeartRateEvent heart_rate;
            ADynamicSensorEvent dynamic_sensor_meta;
            AAdditionalInfoEvent additional_info;
        };
        union {
            uint64_t        data[8];
+1 −0
Original line number Diff line number Diff line
@@ -755,6 +755,7 @@ void SensorService::recordLastValueLocked(
    for (size_t i = 0; i < count; i++) {
        if (buffer[i].type == SENSOR_TYPE_META_DATA ||
            buffer[i].type == SENSOR_TYPE_DYNAMIC_SENSOR_META ||
            buffer[i].type == SENSOR_TYPE_ADDITIONAL_INFO ||
            mLastEventSeen.indexOfKey(buffer[i].sensor) <0 ) {
            continue;
        }