Merge "set a Sensor's version properly" into jb-dev

This commit is contained in:
Mathias Agopian 2012-05-04 16:30:27 -07:00 committed by Android (Google) Code Review
commit 23789ae95f

View File

@ -40,6 +40,7 @@ Sensor::Sensor(struct sensor_t const* hwSensor)
{
mName = hwSensor->name;
mVendor = hwSensor->vendor;
mVersion = hwSensor->version;
mHandle = hwSensor->handle;
mType = hwSensor->type;
mMinValue = 0; // FIXME: minValue
@ -101,7 +102,7 @@ size_t Sensor::getFlattenedSize() const
{
return sizeof(int32_t) + ((mName.length() + 3) & ~3) +
sizeof(int32_t) + ((mVendor.length() + 3) & ~3) +
sizeof(int32_t) * 2 +
sizeof(int32_t) * 3 +
sizeof(float) * 4 +
sizeof(int32_t);
}
@ -140,6 +141,7 @@ status_t Sensor::flatten(void* buffer, size_t size,
offset += write(buffer, offset, mName);
offset += write(buffer, offset, int32_t(mVendor.length()));
offset += write(buffer, offset, mVendor);
offset += write(buffer, offset, mVersion);
offset += write(buffer, offset, mHandle);
offset += write(buffer, offset, mType);
offset += write(buffer, offset, mMinValue);
@ -178,6 +180,7 @@ status_t Sensor::unflatten(void const* buffer, size_t size,
offset += read(buffer, offset, &mName, len);
offset += read(buffer, offset, &len);
offset += read(buffer, offset, &mVendor, len);
offset += read(buffer, offset, &mVersion);
offset += read(buffer, offset, &mHandle);
offset += read(buffer, offset, &mType);
offset += read(buffer, offset, &mMinValue);