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