• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 <aidl/android/hardware/wifi/BnWifiP2pIface.h>
21 #include <android-base/macros.h>
22 
23 #include "wifi_legacy_hal.h"
24 
25 namespace aidl {
26 namespace android {
27 namespace hardware {
28 namespace wifi {
29 
30 /**
31  * AIDL interface object used to control a P2P Iface instance.
32  */
33 class WifiP2pIface : public BnWifiP2pIface {
34   public:
35     WifiP2pIface(const std::string& ifname,
36                  const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
37     // Refer to |WifiChip::invalidate()|.
38     void invalidate();
39     bool isValid();
40     std::string getName();
41 
42     // AIDL methods exposed.
43     ndk::ScopedAStatus getName(std::string* _aidl_return) override;
44 
45   private:
46     // Corresponding worker functions for the AIDL methods.
47     std::pair<std::string, ndk::ScopedAStatus> getNameInternal();
48 
49     std::string ifname_;
50     std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
51     bool is_valid_;
52 
53     DISALLOW_COPY_AND_ASSIGN(WifiP2pIface);
54 };
55 
56 }  // namespace wifi
57 }  // namespace hardware
58 }  // namespace android
59 }  // namespace aidl
60 
61 #endif  // WIFI_P2P_IFACE_H_
62