aimitakeshi | 27ed8ad | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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 | #ifndef __IDRM_IO_SERVICE_H__ |
| 18 | #define __IDRM_IO_SERVICE_H__ |
| 19 | |
| 20 | #include <utils/RefBase.h> |
| 21 | #include <binder/IInterface.h> |
| 22 | #include <binder/Parcel.h> |
| 23 | |
| 24 | namespace android { |
| 25 | |
| 26 | /** |
| 27 | * This is the interface class for DRM IO service. |
| 28 | * |
| 29 | */ |
| 30 | class IDrmIOService : public IInterface |
| 31 | { |
| 32 | public: |
| 33 | enum { |
| 34 | WRITE_TO_FILE = IBinder::FIRST_CALL_TRANSACTION, |
| 35 | READ_FROM_FILE |
| 36 | }; |
| 37 | |
| 38 | public: |
| 39 | DECLARE_META_INTERFACE(DrmIOService); |
| 40 | |
| 41 | public: |
| 42 | /** |
| 43 | * Writes the data into the file path provided |
| 44 | * |
| 45 | * @param[in] filePath Path of the file |
| 46 | * @param[in] dataBuffer Data to write |
| 47 | */ |
| 48 | virtual void writeToFile(const String8& filePath, const String8& dataBuffer) = 0; |
| 49 | |
| 50 | /** |
| 51 | * Reads the data from the file path provided |
| 52 | * |
| 53 | * @param[in] filePath Path of the file |
| 54 | * @return Data read from the file |
| 55 | */ |
| 56 | virtual String8 readFromFile(const String8& filePath) = 0; |
| 57 | }; |
| 58 | |
| 59 | /** |
| 60 | * This is the Binder implementation class for DRM IO service. |
| 61 | */ |
| 62 | class BpDrmIOService: public BpInterface<IDrmIOService> |
| 63 | { |
| 64 | public: |
| 65 | BpDrmIOService(const sp<IBinder>& impl) |
| 66 | : BpInterface<IDrmIOService>(impl) {} |
| 67 | |
| 68 | virtual void writeToFile(const String8& filePath, const String8& dataBuffer); |
| 69 | |
| 70 | virtual String8 readFromFile(const String8& filePath); |
| 71 | }; |
| 72 | |
| 73 | /** |
| 74 | * This is the Binder implementation class for DRM IO service. |
| 75 | */ |
| 76 | class BnDrmIOService: public BnInterface<IDrmIOService> |
| 77 | { |
| 78 | public: |
| 79 | virtual status_t onTransact( |
| 80 | uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); |
| 81 | }; |
| 82 | |
| 83 | }; |
| 84 | |
| 85 | #endif /* __IDRM_IO_SERVICE_H__ */ |
| 86 | |