|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 //#define LOG_NDEBUG 0 |
|
8 #define LOG_TAG "IMediaResourceManagerClient" |
|
9 #include <utils/Log.h> |
|
10 |
|
11 #include <stdint.h> |
|
12 #include <sys/types.h> |
|
13 |
|
14 #include <binder/Parcel.h> |
|
15 |
|
16 #include "IMediaResourceManagerClient.h" |
|
17 |
|
18 namespace android { |
|
19 |
|
20 enum { |
|
21 STATUS_CHANGED = IBinder::FIRST_CALL_TRANSACTION |
|
22 }; |
|
23 |
|
24 class BpMediaResourceManagerClient : public BpInterface<IMediaResourceManagerClient> |
|
25 { |
|
26 public: |
|
27 BpMediaResourceManagerClient(const sp<IBinder>& impl) |
|
28 : BpInterface<IMediaResourceManagerClient>(impl) |
|
29 { |
|
30 } |
|
31 |
|
32 void statusChanged(int event) |
|
33 { |
|
34 Parcel data, reply; |
|
35 data.writeInterfaceToken(IMediaResourceManagerClient::getInterfaceDescriptor()); |
|
36 data.writeInt32(event); |
|
37 remote()->transact(STATUS_CHANGED, data, &reply, IBinder::FLAG_ONEWAY); |
|
38 } |
|
39 }; |
|
40 |
|
41 IMPLEMENT_META_INTERFACE(MediaResourceManagerClient, "android.media.IMediaResourceManagerClient"); |
|
42 |
|
43 // ---------------------------------------------------------------------- |
|
44 |
|
45 status_t BnMediaResourceManagerClient::onTransact( |
|
46 uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) |
|
47 { |
|
48 switch(code) { |
|
49 case STATUS_CHANGED: { |
|
50 CHECK_INTERFACE(IMediaResourceManagerClient, data, reply); |
|
51 int event = data.readInt32(); |
|
52 statusChanged(event); |
|
53 return NO_ERROR; |
|
54 } break; |
|
55 default: |
|
56 return BBinder::onTransact(code, data, reply, flags); |
|
57 } |
|
58 } |
|
59 |
|
60 // ---------------------------------------------------------------------------- |
|
61 |
|
62 }; // namespace android |