IRemoteDisplay.cpp revision 455d02eca342d8159637af317a5d83219d267812
1/*
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 {
25    DISPOSE = IBinder::FIRST_CALL_TRANSACTION,
26};
27
28class BpRemoteDisplay: public BpInterface<IRemoteDisplay>
29{
30public:
31    BpRemoteDisplay(const sp<IBinder>& impl)
32        : BpInterface<IRemoteDisplay>(impl)
33    {
34    }
35
36    status_t dispose()
37    {
38        Parcel data, reply;
39        data.writeInterfaceToken(IRemoteDisplay::getInterfaceDescriptor());
40        remote()->transact(DISPOSE, data, &reply);
41        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) {
53        case DISPOSE: {
54            CHECK_INTERFACE(IRemoteDisplay, data, reply);
55            reply->writeInt32(dispose());
56            return NO_ERROR;
57        }
58        default:
59            return BBinder::onTransact(code, data, reply, flags);
60    }
61}
62
63}; // namespace android
64