summaryrefslogtreecommitdiff
path: root/libs/ui/ICameraClient.cpp
diff options
context:
space:
mode:
author Android (Google) Code Review <android-gerrit@google.com> 2009-05-07 17:47:54 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2009-05-07 17:47:54 -0700
commit538bcd702c0053772245dfbb634c266959cf6af9 (patch)
tree03c691c53c943844bb1c6b0b76c45eca26ce5160 /libs/ui/ICameraClient.cpp
parent881c4c25f1f807952a6740ecad1680a8241b4de4 (diff)
parent2a04aefdf03abbdabb035f89c8a1df636c168de0 (diff)
Merge change 1164 into donut
* changes: Add new binder methods to camera client to support generic callbacks This is the first step in a multi-step change to move from the old specific callbacks to a generic callback. This will allow future flexibility in the interface without requiring binder rewrites. Bug 1837832
Diffstat (limited to 'libs/ui/ICameraClient.cpp')
-rw-r--r--libs/ui/ICameraClient.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/libs/ui/ICameraClient.cpp b/libs/ui/ICameraClient.cpp
index 4bec9d2ae6c3..ae07b67a8ead 100644
--- a/libs/ui/ICameraClient.cpp
+++ b/libs/ui/ICameraClient.cpp
@@ -32,6 +32,8 @@ enum {
ERROR_CALLBACK,
AUTOFOCUS_CALLBACK,
RECORDING_CALLBACK,
+ NOTIFY_CALLBACK,
+ DATA_CALLBACK,
};
class BpCameraClient: public BpInterface<ICameraClient>
@@ -110,6 +112,30 @@ public:
data.writeInt32(focused);
remote()->transact(AUTOFOCUS_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY);
}
+
+ // generic callback from camera service to app
+ void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2)
+ {
+ LOGV("notifyCallback");
+ Parcel data, reply;
+ data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
+ data.writeInt32(msgType);
+ data.writeInt32(ext1);
+ data.writeInt32(ext2);
+ remote()->transact(NOTIFY_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY);
+ }
+
+ // generic data callback from camera service to app with image data
+ void dataCallback(int32_t msgType, const sp<IMemory>& imageData)
+ {
+ LOGV("dataCallback");
+ Parcel data, reply;
+ data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
+ data.writeInt32(msgType);
+ data.writeStrongBinder(imageData->asBinder());
+ remote()->transact(DATA_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY);
+ }
+
};
IMPLEMENT_META_INTERFACE(CameraClient, "android.hardware.ICameraClient");
@@ -174,6 +200,23 @@ status_t BnCameraClient::onTransact(
autoFocusCallback(focused);
return NO_ERROR;
} break;
+ case NOTIFY_CALLBACK: {
+ LOGV("NOTIFY_CALLBACK");
+ CHECK_INTERFACE(ICameraClient, data, reply);
+ int32_t msgType = data.readInt32();
+ int32_t ext1 = data.readInt32();
+ int32_t ext2 = data.readInt32();
+ notifyCallback(msgType, ext1, ext2);
+ return NO_ERROR;
+ } break;
+ case DATA_CALLBACK: {
+ LOGV("RAW_CALLBACK");
+ CHECK_INTERFACE(ICameraClient, data, reply);
+ int32_t msgType = data.readInt32();
+ sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder());
+ dataCallback(msgType, imageData);
+ return NO_ERROR;
+ } break;
default:
return BBinder::onTransact(code, data, reply, flags);
}