in android v, I want to send two data to the framework. such as proximity,i need to send two data to the framework. In previous versions,We modify it in the hardware: in hardware/interfaces / sensors/1.0/default/convert.cpp in convertFromSensorEvent function: convertFromSensorEvent {
case SensorType::PROXIMITY: {
dst->u.data[0] = src.data[0];
dst->u.data[1] = src.data[1];
break;
}
}
in convertToSensorEvent function: convertToSensorEvent { case SensorType::PROXIMITY:{ dst->data[0] = src.u.data[0]; dst->data[1] = src.u.data[1]; break; }
but in android v, in hardware ,This modification method doesn't work. If aidl is used instead of hidl, and two values need to be passed to the hardware, what should the hardware do?
I tried modifying the file in aidl, convert.cpp
in convertFromSensorEvent function:
convertFromSensorEvent
{
case SensorType::PROXIMITY:
Event::EventPayload::Data data;
memcpy(data.values.data(), src.data, 2 * sizeof(float));
dst->payload.set<Event::EventPayload::Tag::data>(data);
break;
}
in convertToSensorEvent function: convertToSensorEvent { case SensorType::PROXIMITY: memcpy(dst->data, src.payload.getEvent::EventPayload::data().values.data(), 16 * sizeof(float)); break; }
This modification will cause the machine to restart.