2 * Copyright (C) 2011 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 //#define LOG_NDEBUG 0
18 #define LOG_TAG "ICameraRecordingProxyListener"
19 #include <camera/ICameraRecordingProxyListener.h>
20 #include <binder/IMemory.h>
21 #include <binder/Parcel.h>
22 #include <utils/Log.h>
27 DATA_CALLBACK_TIMESTAMP = IBinder::FIRST_CALL_TRANSACTION,
30 class BpCameraRecordingProxyListener: public BpInterface<ICameraRecordingProxyListener>
33 BpCameraRecordingProxyListener(const sp<IBinder>& impl)
34 : BpInterface<ICameraRecordingProxyListener>(impl)
38 void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& imageData)
40 ALOGV("dataCallback");
42 data.writeInterfaceToken(ICameraRecordingProxyListener::getInterfaceDescriptor());
43 data.writeInt64(timestamp);
44 data.writeInt32(msgType);
45 data.writeStrongBinder(imageData->asBinder());
46 remote()->transact(DATA_CALLBACK_TIMESTAMP, data, &reply, IBinder::FLAG_ONEWAY);
50 IMPLEMENT_META_INTERFACE(CameraRecordingProxyListener, "android.hardware.ICameraRecordingProxyListener");
52 // ----------------------------------------------------------------------
54 status_t BnCameraRecordingProxyListener::onTransact(
55 uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
58 case DATA_CALLBACK_TIMESTAMP: {
59 ALOGV("DATA_CALLBACK_TIMESTAMP");
60 CHECK_INTERFACE(ICameraRecordingProxyListener, data, reply);
61 nsecs_t timestamp = data.readInt64();
62 int32_t msgType = data.readInt32();
63 sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder());
64 dataCallbackTimestamp(timestamp, msgType, imageData);
68 return BBinder::onTransact(code, data, reply, flags);
72 // ----------------------------------------------------------------------------
74 }; // namespace android