blob: f837a14da701d8a1aecf57426d8210fe24fefe9c [file] [log] [blame]
Alok Kediya601e9b52013-09-27 11:55:10 +05301/*
2** Copyright (c) 2012, The Linux Foundation. All rights reserved.
3** Not a Contribution.
4**
5** Copyright 2007, The Android Open Source Project
6**
7** Licensed under the Apache License, Version 2.0 (the "License");
8** you may not use this file except in compliance with the License.
9** You may obtain a copy of the License at
10**
11** http://www.apache.org/licenses/LICENSE-2.0
12**
13** Unless required by applicable law or agreed to in writing, software
14** distributed under the License is distributed on an "AS IS" BASIS,
15** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16** See the License for the specific language governing permissions and
17** limitations under the License.
18*/
19
20#include <utils/RefBase.h>
21#include <binder/IInterface.h>
22#include <binder/Parcel.h>
23
24#include <media/IDirectTrackClient.h>
25
26namespace android {
27
28enum {
29 NOTIFY = IBinder::FIRST_CALL_TRANSACTION,
30};
31
32class BpDirectTrackClient: public BpInterface<IDirectTrackClient>
33{
34public:
35 BpDirectTrackClient(const sp<IBinder>& impl)
36 : BpInterface<IDirectTrackClient>(impl)
37 {
38 }
39
40 virtual void notify(int msg)
41 {
42 Parcel data, reply;
43 data.writeInterfaceToken(IDirectTrackClient::getInterfaceDescriptor());
44 data.writeInt32(msg);
45 remote()->transact(NOTIFY, data, &reply, IBinder::FLAG_ONEWAY);
46 }
47};
48
49IMPLEMENT_META_INTERFACE(DirectTrackClient, "android.media.IDirectTrackClient");
50
51// ----------------------------------------------------------------------
52
53status_t BnDirectTrackClient::onTransact(
54 uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
55{
56 switch (code) {
57 case NOTIFY: {
58 CHECK_INTERFACE(IDirectTrackClient, data, reply);
59 int msg = data.readInt32();
60 notify(msg);
61 return NO_ERROR;
62 } break;
63 default:
64 return BBinder::onTransact(code, data, reply, flags);
65 }
66}
67
68}; // namespace android