From d4db70a7b8b2d136c46c50f89b276f8150be5fc2 Mon Sep 17 00:00:00 2001 From: Jani Suonpera Date: Fri, 9 Oct 2015 11:45:57 +0300 Subject: DO NOT MERGE ANYWHERE Add new interface for sensor physical data This is special solution only for emerald branch. Changes including new const char* value/interface for sensor physical data. Sensor service and manager does not take care of content, structure or other details of string. Sensor HAL is taking care of parsing data from string and setting values to Sensor HW. Change-Id: I3abc3ddc7c6adc4b32a40b9a43f2a94c5af7b2b0 Signed-off-by: Ben Fennema --- services/sensorservice/SensorDevice.cpp | 15 +++++++++++++++ services/sensorservice/SensorDevice.h | 1 + services/sensorservice/SensorService.cpp | 8 ++++++++ services/sensorservice/SensorService.h | 1 + 4 files changed, 25 insertions(+) (limited to 'services') diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp index dd1bccf..48ae2fb 100644 --- a/services/sensorservice/SensorDevice.cpp +++ b/services/sensorservice/SensorDevice.cpp @@ -407,6 +407,21 @@ status_t SensorDevice::setMode(uint32_t mode) { return mSensorModule->set_operation_mode(mode); } +status_t SensorDevice::setSensorPhysicalData(const char* physicaldata) +{ + //ALOGD("SensorDevice::setSensorPhysicalData(%s)",physicaldata); + Mutex::Autolock _l(mLock); + if((mSensorModule->set_sensor_physical_data == NULL) || (getHalDeviceVersion() < SENSORS_DEVICE_API_VERSION_1_3_5)) + { + return NO_INIT; + } + else + { + return mSensorModule->set_sensor_physical_data(physicaldata); + } +} + + // --------------------------------------------------------------------------- int SensorDevice::Info::numActiveClients() { diff --git a/services/sensorservice/SensorDevice.h b/services/sensorservice/SensorDevice.h index c484849..f658497 100644 --- a/services/sensorservice/SensorDevice.h +++ b/services/sensorservice/SensorDevice.h @@ -104,6 +104,7 @@ public: void autoDisable(void *ident, int handle); status_t injectSensorData(const sensors_event_t *event); void dump(String8& result); + status_t setSensorPhysicalData(const char* physicaldata); }; // --------------------------------------------------------------------------- diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index fd72b23..2548a3e 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -735,6 +735,14 @@ Vector SensorService::getSensorList(const String16& opPackageName) return accessibleSensorList; } +status_t SensorService::setSensorPhysicalData(const char* physicaldata) +{ + SensorDevice& dev(SensorDevice::getInstance()); + + //ALOGD("SensorService::setSensorPhysicalData(%s)",physicaldata); + return dev.setSensorPhysicalData(physicaldata); +} + sp SensorService::createSensorEventConnection(const String8& packageName, int requestedMode, const String16& opPackageName) { // Only 2 modes supported for a SensorEventConnection ... NORMAL and DATA_INJECTION. diff --git a/services/sensorservice/SensorService.h b/services/sensorservice/SensorService.h index 9a573ae..3a1ffb2 100644 --- a/services/sensorservice/SensorService.h +++ b/services/sensorservice/SensorService.h @@ -130,6 +130,7 @@ class SensorService : virtual sp createSensorEventConnection(const String8& packageName, int requestedMode, const String16& opPackageName); virtual int isDataInjectionEnabled(); + virtual status_t setSensorPhysicalData(const char* physicaldata); virtual status_t dump(int fd, const Vector& args); class SensorEventConnection : public BnSensorEventConnection, public LooperCallback { -- cgit v1.1