diff options
author | Wu-cheng Li <wuchengli@google.com> | 2009-09-28 16:14:58 -0700 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2009-10-06 13:25:10 -0700 |
commit | 36f68b8f24df906c969581b0b8e1a47f95dc03cb (patch) | |
tree | b1c8987ccd5b30c5527fc9abcfe275f163d8d8c5 /libs | |
parent | 5bba632d877c2878384ff21566c8eb6a1a22f37b (diff) | |
download | frameworks_base-36f68b8f24df906c969581b0b8e1a47f95dc03cb.zip frameworks_base-36f68b8f24df906c969581b0b8e1a47f95dc03cb.tar.gz frameworks_base-36f68b8f24df906c969581b0b8e1a47f95dc03cb.tar.bz2 |
Add zoom functions and sendCommand.
b2060030
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ui/Camera.cpp | 9 | ||||
-rw-r--r-- | libs/ui/ICamera.cpp | 21 |
2 files changed, 30 insertions, 0 deletions
diff --git a/libs/ui/Camera.cpp b/libs/ui/Camera.cpp index 0c6d340..09a36f1 100644 --- a/libs/ui/Camera.cpp +++ b/libs/ui/Camera.cpp @@ -278,6 +278,15 @@ String8 Camera::getParameters() const return params; } +// send command to camera driver +status_t Camera::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) +{ + LOGD("sendCommand"); + sp <ICamera> c = mCamera; + if (c == 0) return NO_INIT; + return c->sendCommand(cmd, arg1, arg2); +} + void Camera::setListener(const sp<CameraListener>& listener) { Mutex::Autolock _l(mLock); diff --git a/libs/ui/ICamera.cpp b/libs/ui/ICamera.cpp index fd7e084..e1b3ec7 100644 --- a/libs/ui/ICamera.cpp +++ b/libs/ui/ICamera.cpp @@ -36,6 +36,7 @@ enum { TAKE_PICTURE, SET_PARAMETERS, GET_PARAMETERS, + SEND_COMMAND, CONNECT, LOCK, UNLOCK, @@ -205,6 +206,17 @@ public: remote()->transact(GET_PARAMETERS, data, &reply); return reply.readString8(); } + virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) + { + LOGD("sendCommand"); + Parcel data, reply; + data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); + data.writeInt32(cmd); + data.writeInt32(arg1); + data.writeInt32(arg2); + remote()->transact(SEND_COMMAND, data, &reply); + return reply.readInt32(); + } virtual status_t connect(const sp<ICameraClient>& cameraClient) { Parcel data, reply; @@ -331,6 +343,15 @@ status_t BnCamera::onTransact( reply->writeString8(getParameters()); return NO_ERROR; } break; + case SEND_COMMAND: { + LOGD("SEND_COMMAND"); + CHECK_INTERFACE(ICamera, data, reply); + int command = data.readInt32(); + int arg1 = data.readInt32(); + int arg2 = data.readInt32(); + reply->writeInt32(sendCommand(command, arg1, arg2)); + return NO_ERROR; + } break; case CONNECT: { CHECK_INTERFACE(ICamera, data, reply); sp<ICameraClient> cameraClient = interface_cast<ICameraClient>(data.readStrongBinder()); |