android: Simplify thread RPC with Object::invokeMethod()

Replace the manual implementation of asynchronous method invocation
through a custom message with Object::invokeMethod(). This simplifies
the thread RPC implementation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Laurent Pinchart 2019-08-12 05:30:06 +03:00
parent 778f6b1d70
commit 0c32433d8c
5 changed files with 8 additions and 45 deletions

View file

@ -9,6 +9,8 @@
#include <system/camera_metadata.h>
#include <libcamera/object.h>
#include "log.h"
#include "message.h"
#include "utils.h"
@ -185,10 +187,6 @@ int CameraProxy::processCaptureRequest(camera3_capture_request_t *request)
void CameraProxy::threadRpcCall(ThreadRpc &rpcRequest)
{
std::unique_ptr<ThreadRpcMessage> message =
utils::make_unique<ThreadRpcMessage>();
message->rpc = &rpcRequest;
cameraDevice_->postMessage(std::move(message));
cameraDevice_->invokeMethod(&CameraDevice::call, &rpcRequest);
rpcRequest.waitDelivery();
}