1e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown/*
2e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown * Copyright (C) 2012 The Android Open Source Project
3e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown *
4e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown * Licensed under the Apache License, Version 2.0 (the "License");
5e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown * you may not use this file except in compliance with the License.
6e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown * You may obtain a copy of the License at
7e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown *
8e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown *      http://www.apache.org/licenses/LICENSE-2.0
9e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown *
10e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown * Unless required by applicable law or agreed to in writing, software
11e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown * distributed under the License is distributed on an "AS IS" BASIS,
12e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown * See the License for the specific language governing permissions and
14e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown * limitations under the License.
15e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown */
16e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown
17e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown#include <stdint.h>
18e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown#include <sys/types.h>
19e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown
20e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown#include <media/IRemoteDisplay.h>
21e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown
22e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brownnamespace android {
23e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown
24e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brownenum {
25455d02eca342d8159637af317a5d83219d267812Jeff Brown    DISPOSE = IBinder::FIRST_CALL_TRANSACTION,
26e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown};
27e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown
28e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brownclass BpRemoteDisplay: public BpInterface<IRemoteDisplay>
29e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown{
30e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brownpublic:
31e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown    BpRemoteDisplay(const sp<IBinder>& impl)
32e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown        : BpInterface<IRemoteDisplay>(impl)
33e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown    {
34e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown    }
35e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown
36455d02eca342d8159637af317a5d83219d267812Jeff Brown    status_t dispose()
37e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown    {
38e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown        Parcel data, reply;
39e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown        data.writeInterfaceToken(IRemoteDisplay::getInterfaceDescriptor());
40455d02eca342d8159637af317a5d83219d267812Jeff Brown        remote()->transact(DISPOSE, data, &reply);
41e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown        return reply.readInt32();
42e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown    }
43e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown};
44e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown
45e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff BrownIMPLEMENT_META_INTERFACE(RemoteDisplay, "android.media.IRemoteDisplay");
46e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown
47e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown// ----------------------------------------------------------------------
48e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown
49e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brownstatus_t BnRemoteDisplay::onTransact(
50e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
51e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown{
52e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown    switch (code) {
53455d02eca342d8159637af317a5d83219d267812Jeff Brown        case DISPOSE: {
54e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown            CHECK_INTERFACE(IRemoteDisplay, data, reply);
55455d02eca342d8159637af317a5d83219d267812Jeff Brown            reply->writeInt32(dispose());
56e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown            return NO_ERROR;
57e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown        }
58e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown        default:
59e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown            return BBinder::onTransact(code, data, reply, flags);
60e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown    }
61e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown}
62e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown
63e104596061b219e9bce6d4db49a9d15242f8d2e5Jeff Brown}; // namespace android
64