blob: da25a15d3c065b7e5db2aab1207d2d800753dea5 [file] [log] [blame]
Jeff Brown2013a542012-09-04 21:38:42 -07001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17#include <stdint.h>
18#include <sys/types.h>
19
20#include <media/IRemoteDisplay.h>
21
22namespace android {
23
24enum {
Jeff Brownced24b32012-09-05 17:48:03 -070025 DISPOSE = IBinder::FIRST_CALL_TRANSACTION,
Jeff Brown2013a542012-09-04 21:38:42 -070026};
27
28class BpRemoteDisplay: public BpInterface<IRemoteDisplay>
29{
30public:
31 BpRemoteDisplay(const sp<IBinder>& impl)
32 : BpInterface<IRemoteDisplay>(impl)
33 {
34 }
35
Jeff Brownced24b32012-09-05 17:48:03 -070036 status_t dispose()
Jeff Brown2013a542012-09-04 21:38:42 -070037 {
38 Parcel data, reply;
39 data.writeInterfaceToken(IRemoteDisplay::getInterfaceDescriptor());
Jeff Brownced24b32012-09-05 17:48:03 -070040 remote()->transact(DISPOSE, data, &reply);
Jeff Brown2013a542012-09-04 21:38:42 -070041 return reply.readInt32();
42 }
43};
44
45IMPLEMENT_META_INTERFACE(RemoteDisplay, "android.media.IRemoteDisplay");
46
47// ----------------------------------------------------------------------
48
49status_t BnRemoteDisplay::onTransact(
50 uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
51{
52 switch (code) {
Jeff Brownced24b32012-09-05 17:48:03 -070053 case DISPOSE: {
Jeff Brown2013a542012-09-04 21:38:42 -070054 CHECK_INTERFACE(IRemoteDisplay, data, reply);
Jeff Brownced24b32012-09-05 17:48:03 -070055 reply->writeInt32(dispose());
Jeff Brown2013a542012-09-04 21:38:42 -070056 return NO_ERROR;
57 }
58 default:
59 return BBinder::onTransact(code, data, reply, flags);
60 }
61}
62
63}; // namespace android