Roshan Pius | 3e2d671 | 2016-10-06 13:16:23 -0700 | [diff] [blame] | 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 WIFI_P2P_IFACE_H_ |
| 18 | #define WIFI_P2P_IFACE_H_ |
| 19 | |
| 20 | #include <android-base/macros.h> |
| 21 | #include <android/hardware/wifi/1.0/IWifiP2pIface.h> |
| 22 | |
| 23 | #include "wifi_legacy_hal.h" |
| 24 | |
| 25 | namespace android { |
| 26 | namespace hardware { |
| 27 | namespace wifi { |
Roshan Pius | dbd83ef | 2017-06-20 12:05:40 -0700 | [diff] [blame^] | 28 | namespace V1_1 { |
Roshan Pius | 3e2d671 | 2016-10-06 13:16:23 -0700 | [diff] [blame] | 29 | namespace implementation { |
Roshan Pius | dbd83ef | 2017-06-20 12:05:40 -0700 | [diff] [blame^] | 30 | using namespace android::hardware::wifi::V1_0; |
Roshan Pius | 3e2d671 | 2016-10-06 13:16:23 -0700 | [diff] [blame] | 31 | |
| 32 | /** |
| 33 | * HIDL interface object used to control a P2P Iface instance. |
| 34 | */ |
Roshan Pius | dbd83ef | 2017-06-20 12:05:40 -0700 | [diff] [blame^] | 35 | class WifiP2pIface : public V1_0::IWifiP2pIface { |
Roshan Pius | 3e2d671 | 2016-10-06 13:16:23 -0700 | [diff] [blame] | 36 | public: |
| 37 | WifiP2pIface(const std::string& ifname, |
Roshan Pius | 6cedc97 | 2016-10-28 10:11:17 -0700 | [diff] [blame] | 38 | const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal); |
Roshan Pius | 3e2d671 | 2016-10-06 13:16:23 -0700 | [diff] [blame] | 39 | // Refer to |WifiChip::invalidate()|. |
| 40 | void invalidate(); |
Roshan Pius | 907d4a2 | 2016-10-27 12:48:12 -0700 | [diff] [blame] | 41 | bool isValid(); |
Roshan Pius | 3e2d671 | 2016-10-06 13:16:23 -0700 | [diff] [blame] | 42 | |
| 43 | // HIDL methods exposed. |
Roshan Pius | 734fea0 | 2016-10-11 08:30:28 -0700 | [diff] [blame] | 44 | Return<void> getName(getName_cb hidl_status_cb) override; |
| 45 | Return<void> getType(getType_cb hidl_status_cb) override; |
Roshan Pius | 3e2d671 | 2016-10-06 13:16:23 -0700 | [diff] [blame] | 46 | |
| 47 | private: |
Roshan Pius | 907d4a2 | 2016-10-27 12:48:12 -0700 | [diff] [blame] | 48 | // Corresponding worker functions for the HIDL methods. |
| 49 | std::pair<WifiStatus, std::string> getNameInternal(); |
| 50 | std::pair<WifiStatus, IfaceType> getTypeInternal(); |
| 51 | |
Roshan Pius | 3e2d671 | 2016-10-06 13:16:23 -0700 | [diff] [blame] | 52 | std::string ifname_; |
Roshan Pius | 6cedc97 | 2016-10-28 10:11:17 -0700 | [diff] [blame] | 53 | std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_; |
Roshan Pius | 3e2d671 | 2016-10-06 13:16:23 -0700 | [diff] [blame] | 54 | bool is_valid_; |
| 55 | |
| 56 | DISALLOW_COPY_AND_ASSIGN(WifiP2pIface); |
| 57 | }; |
| 58 | |
| 59 | } // namespace implementation |
Roshan Pius | dbd83ef | 2017-06-20 12:05:40 -0700 | [diff] [blame^] | 60 | } // namespace V1_1 |
Roshan Pius | 3e2d671 | 2016-10-06 13:16:23 -0700 | [diff] [blame] | 61 | } // namespace wifi |
| 62 | } // namespace hardware |
| 63 | } // namespace android |
| 64 | |
| 65 | #endif // WIFI_P2P_IFACE_H_ |