blob: 0c576cf9f1d305f05ea32db1b17891965fef68e9
1 | /* |
2 | * Copyright (C) 2016 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 VENDOR_AMLOGIC_HARDWARE_DROIDVOLD_V1_0_DROIDVOLD_H |
18 | #define VENDOR_AMLOGIC_HARDWARE_DROIDVOLD_V1_0_DROIDVOLD_H |
19 | |
20 | #include <vendor/amlogic/hardware/droidvold/1.0/IDroidVold.h> |
21 | #include <hidl/MQDescriptor.h> |
22 | #include <hidl/Status.h> |
23 | |
24 | #include <utils/Mutex.h> |
25 | #include <vector> |
26 | |
27 | namespace vendor { |
28 | namespace amlogic { |
29 | namespace hardware { |
30 | namespace droidvold { |
31 | namespace V1_0 { |
32 | namespace implementation { |
33 | |
34 | using ::android::hidl::base::V1_0::DebugInfo; |
35 | using ::android::hidl::base::V1_0::IBase; |
36 | using ::vendor::amlogic::hardware::droidvold::V1_0::IDroidVold; |
37 | using ::vendor::amlogic::hardware::droidvold::V1_0::IDroidVoldCallback; |
38 | using ::vendor::amlogic::hardware::droidvold::V1_0::Result; |
39 | using ::android::hardware::hidl_array; |
40 | using ::android::hardware::hidl_memory; |
41 | using ::android::hardware::hidl_string; |
42 | using ::android::hardware::hidl_vec; |
43 | using ::android::hardware::Return; |
44 | using ::android::hardware::Void; |
45 | using ::android::sp; |
46 | |
47 | class DroidVold : public IDroidVold { |
48 | public: |
49 | DroidVold(); |
50 | virtual ~DroidVold(); |
51 | |
52 | // Methods from ::vendor::amlogic::hardware::droidvold::V1_0::IDroidVold follow. |
53 | Return<void> setCallback(const sp<IDroidVoldCallback>& callback) override; |
54 | Return<Result> reset() override; |
55 | Return<Result> shutdown() override; |
56 | Return<Result> mount(const hidl_string& id, uint32_t flag, uint32_t uid) override; |
57 | Return<Result> unmount(const hidl_string& id) override; |
58 | Return<Result> format(const hidl_string& id, const hidl_string& type) override; |
59 | Return<int32_t> getDiskFlag(const hidl_string &path) override; |
60 | |
61 | static DroidVold *Instance(); |
62 | void sendBroadcast(int event, const std::string& message); |
63 | |
64 | private: |
65 | //std::vector<sp<IDroidVoldCallback>> mClients; |
66 | sp<IDroidVoldCallback> mCallback; |
67 | mutable android::Mutex mLock; |
68 | }; |
69 | |
70 | } // namespace implementation |
71 | } // namespace V1_0 |
72 | } // namespace droidvold |
73 | } // namespace hardware |
74 | } // namespace amlogic |
75 | } // namespace vendor |
76 | |
77 | #endif // VENDOR_AMLOGIC_HARDWARE_DROIDVOLD_V1_0_DROIDVOLD_H |
78 |