Loading include/gui/Sensor.h +2 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ public: uint8_t b[16]; } uuid_t; Sensor(); Sensor(const char * name = ""); Sensor(struct sensor_t const* hwSensor, int halVersion = 0); ~Sensor(); Loading @@ -80,6 +80,7 @@ public: int32_t getMaxDelay() const; uint32_t getFlags() const; bool isWakeUpSensor() const; bool isDynamicSensor() const; int32_t getReportingMode() const; const uuid_t& getUuid() const; Loading libs/gui/Sensor.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -35,8 +35,8 @@ namespace android { // ---------------------------------------------------------------------------- Sensor::Sensor() : mHandle(0), mType(0), Sensor::Sensor(const char * name) : mName(name), mHandle(0), mType(0), mMinValue(0), mMaxValue(0), mResolution(0), mPower(0), mMinDelay(0), mVersion(0), mFifoReservedEventCount(0), mFifoMaxEventCount(0), mRequiredAppOp(0), Loading Loading @@ -390,6 +390,10 @@ bool Sensor::isWakeUpSensor() const { return mFlags & SENSOR_FLAG_WAKE_UP; } bool Sensor::isDynamicSensor() const { return mFlags & SENSOR_FLAG_DYNAMIC_SENSOR; } int32_t Sensor::getReportingMode() const { return ((mFlags & REPORTING_MODE_MASK) >> REPORTING_MODE_SHIFT); } Loading services/sensorservice/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ LOCAL_SRC_FILES:= \ SensorEventConnection.cpp \ MostRecentEventLogger.cpp \ SensorRecord.cpp \ SensorList.cpp \ LOCAL_CFLAGS:= -DLOG_TAG=\"SensorService\" Loading services/sensorservice/CorrectedGyroSensor.cpp +14 −13 Original line number Diff line number Diff line Loading @@ -39,6 +39,18 @@ CorrectedGyroSensor::CorrectedGyroSensor(sensor_t const* list, size_t count) break; } } sensor_t hwSensor; hwSensor.name = "Corrected Gyroscope Sensor"; hwSensor.vendor = "AOSP"; hwSensor.version = 1; hwSensor.handle = '_cgy'; hwSensor.type = SENSOR_TYPE_GYROSCOPE; hwSensor.maxRange = mGyro.getMaxValue(); hwSensor.resolution = mGyro.getResolution(); hwSensor.power = mSensorFusion.getPowerUsage(); hwSensor.minDelay = mGyro.getMinDelay(); mSensor = Sensor(&hwSensor); } bool CorrectedGyroSensor::process(sensors_event_t* outEvent, Loading Loading @@ -66,19 +78,8 @@ status_t CorrectedGyroSensor::setDelay(void* ident, int /*handle*/, int64_t ns) return mSensorFusion.setDelay(FUSION_9AXIS, ident, ns); } Sensor CorrectedGyroSensor::getSensor() const { sensor_t hwSensor; hwSensor.name = "Corrected Gyroscope Sensor"; hwSensor.vendor = "AOSP"; hwSensor.version = 1; hwSensor.handle = '_cgy'; hwSensor.type = SENSOR_TYPE_GYROSCOPE; hwSensor.maxRange = mGyro.getMaxValue(); hwSensor.resolution = mGyro.getResolution(); hwSensor.power = mSensorFusion.getPowerUsage(); hwSensor.minDelay = mGyro.getMinDelay(); Sensor sensor(&hwSensor); return sensor; const Sensor& CorrectedGyroSensor::getSensor() const { return mSensor; } // --------------------------------------------------------------------------- Loading services/sensorservice/CorrectedGyroSensor.h +6 −6 Original line number Diff line number Diff line Loading @@ -35,15 +35,15 @@ class CorrectedGyroSensor : public SensorInterface { SensorDevice& mSensorDevice; SensorFusion& mSensorFusion; Sensor mGyro; Sensor mSensor; public: CorrectedGyroSensor(sensor_t const* list, size_t count); virtual bool process(sensors_event_t* outEvent, const sensors_event_t& event); virtual status_t activate(void* ident, bool enabled); virtual status_t setDelay(void* ident, int handle, int64_t ns); virtual Sensor getSensor() const; virtual bool isVirtual() const { return true; } virtual bool process(sensors_event_t* outEvent, const sensors_event_t& event) override; virtual status_t activate(void* ident, bool enabled) override; virtual status_t setDelay(void* ident, int handle, int64_t ns) override; virtual const Sensor& getSensor() const override; virtual bool isVirtual() const override { return true; } }; // --------------------------------------------------------------------------- Loading Loading
include/gui/Sensor.h +2 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ public: uint8_t b[16]; } uuid_t; Sensor(); Sensor(const char * name = ""); Sensor(struct sensor_t const* hwSensor, int halVersion = 0); ~Sensor(); Loading @@ -80,6 +80,7 @@ public: int32_t getMaxDelay() const; uint32_t getFlags() const; bool isWakeUpSensor() const; bool isDynamicSensor() const; int32_t getReportingMode() const; const uuid_t& getUuid() const; Loading
libs/gui/Sensor.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -35,8 +35,8 @@ namespace android { // ---------------------------------------------------------------------------- Sensor::Sensor() : mHandle(0), mType(0), Sensor::Sensor(const char * name) : mName(name), mHandle(0), mType(0), mMinValue(0), mMaxValue(0), mResolution(0), mPower(0), mMinDelay(0), mVersion(0), mFifoReservedEventCount(0), mFifoMaxEventCount(0), mRequiredAppOp(0), Loading Loading @@ -390,6 +390,10 @@ bool Sensor::isWakeUpSensor() const { return mFlags & SENSOR_FLAG_WAKE_UP; } bool Sensor::isDynamicSensor() const { return mFlags & SENSOR_FLAG_DYNAMIC_SENSOR; } int32_t Sensor::getReportingMode() const { return ((mFlags & REPORTING_MODE_MASK) >> REPORTING_MODE_SHIFT); } Loading
services/sensorservice/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ LOCAL_SRC_FILES:= \ SensorEventConnection.cpp \ MostRecentEventLogger.cpp \ SensorRecord.cpp \ SensorList.cpp \ LOCAL_CFLAGS:= -DLOG_TAG=\"SensorService\" Loading
services/sensorservice/CorrectedGyroSensor.cpp +14 −13 Original line number Diff line number Diff line Loading @@ -39,6 +39,18 @@ CorrectedGyroSensor::CorrectedGyroSensor(sensor_t const* list, size_t count) break; } } sensor_t hwSensor; hwSensor.name = "Corrected Gyroscope Sensor"; hwSensor.vendor = "AOSP"; hwSensor.version = 1; hwSensor.handle = '_cgy'; hwSensor.type = SENSOR_TYPE_GYROSCOPE; hwSensor.maxRange = mGyro.getMaxValue(); hwSensor.resolution = mGyro.getResolution(); hwSensor.power = mSensorFusion.getPowerUsage(); hwSensor.minDelay = mGyro.getMinDelay(); mSensor = Sensor(&hwSensor); } bool CorrectedGyroSensor::process(sensors_event_t* outEvent, Loading Loading @@ -66,19 +78,8 @@ status_t CorrectedGyroSensor::setDelay(void* ident, int /*handle*/, int64_t ns) return mSensorFusion.setDelay(FUSION_9AXIS, ident, ns); } Sensor CorrectedGyroSensor::getSensor() const { sensor_t hwSensor; hwSensor.name = "Corrected Gyroscope Sensor"; hwSensor.vendor = "AOSP"; hwSensor.version = 1; hwSensor.handle = '_cgy'; hwSensor.type = SENSOR_TYPE_GYROSCOPE; hwSensor.maxRange = mGyro.getMaxValue(); hwSensor.resolution = mGyro.getResolution(); hwSensor.power = mSensorFusion.getPowerUsage(); hwSensor.minDelay = mGyro.getMinDelay(); Sensor sensor(&hwSensor); return sensor; const Sensor& CorrectedGyroSensor::getSensor() const { return mSensor; } // --------------------------------------------------------------------------- Loading
services/sensorservice/CorrectedGyroSensor.h +6 −6 Original line number Diff line number Diff line Loading @@ -35,15 +35,15 @@ class CorrectedGyroSensor : public SensorInterface { SensorDevice& mSensorDevice; SensorFusion& mSensorFusion; Sensor mGyro; Sensor mSensor; public: CorrectedGyroSensor(sensor_t const* list, size_t count); virtual bool process(sensors_event_t* outEvent, const sensors_event_t& event); virtual status_t activate(void* ident, bool enabled); virtual status_t setDelay(void* ident, int handle, int64_t ns); virtual Sensor getSensor() const; virtual bool isVirtual() const { return true; } virtual bool process(sensors_event_t* outEvent, const sensors_event_t& event) override; virtual status_t activate(void* ident, bool enabled) override; virtual status_t setDelay(void* ident, int handle, int64_t ns) override; virtual const Sensor& getSensor() const override; virtual bool isVirtual() const override { return true; } }; // --------------------------------------------------------------------------- Loading