summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/ISensorServer.cpp21
-rw-r--r--libs/gui/SensorManager.cpp17
2 files changed, 37 insertions, 1 deletions
diff --git a/libs/gui/ISensorServer.cpp b/libs/gui/ISensorServer.cpp
index f581b5c..8cd1725 100644
--- a/libs/gui/ISensorServer.cpp
+++ b/libs/gui/ISensorServer.cpp
@@ -35,7 +35,8 @@ namespace android {
enum {
GET_SENSOR_LIST = IBinder::FIRST_CALL_TRANSACTION,
CREATE_SENSOR_EVENT_CONNECTION,
- ENABLE_DATA_INJECTION
+ ENABLE_DATA_INJECTION,
+ SET_SENSOR_PHYSICAL_DATA,
};
class BpSensorServer : public BpInterface<ISensorServer>
@@ -83,6 +84,16 @@ public:
remote()->transact(ENABLE_DATA_INJECTION, data, &reply);
return reply.readInt32();
}
+
+ virtual status_t setSensorPhysicalData(const char* physicaldata)
+ {
+ Parcel data, reply;
+ //ALOGD("ISensorManager::SetSensorPhysicalData(%s)",physicaldata);
+ data.writeInterfaceToken(ISensorServer::getInterfaceDescriptor());
+ data.writeCString(physicaldata);
+ remote()->transact(SET_SENSOR_PHYSICAL_DATA, data, &reply);
+ return reply.readInt32();
+ }
};
// Out-of-line virtual method definition to trigger vtable emission in this
@@ -124,6 +135,14 @@ status_t BnSensorServer::onTransact(
reply->writeInt32(static_cast<int32_t>(ret));
return NO_ERROR;
}
+ case SET_SENSOR_PHYSICAL_DATA: {
+ CHECK_INTERFACE(ISensorServer, data, reply);
+ const char* physicaldata = data.readCString();
+ //ALOGD("ISensorManager, BnSensorServer::onTransact, physicaldata is: (%s)",physicaldata);
+ status_t result = setSensorPhysicalData(physicaldata);
+ reply->writeInt32(result);
+ return NO_ERROR;
+ }
}
return BBinder::onTransact(code, data, reply, flags);
}
diff --git a/libs/gui/SensorManager.cpp b/libs/gui/SensorManager.cpp
index 33608b5..343131f 100644
--- a/libs/gui/SensorManager.cpp
+++ b/libs/gui/SensorManager.cpp
@@ -227,5 +227,22 @@ bool SensorManager::isDataInjectionEnabled() {
return false;
}
+bool SensorManager::SetPhysicalData(const char* data)
+{
+ status_t reply;
+ //ALOGD("SensorManager::SetPhysicalData(%s)",data);
+
+ reply = mSensorServer->setSensorPhysicalData(data);
+
+ if(reply == NO_ERROR)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
// ----------------------------------------------------------------------------
}; // namespace android