• 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 #pragma once
18 
19 #include <VtsCoreUtil.h>
20 
21 #include <aidl/android/hardware/wifi/IWifi.h>
22 #include <aidl/android/hardware/wifi/IWifiChip.h>
23 #include <android/binder_manager.h>
24 #include <wifi_system/interface_tool.h>
25 
26 using aidl::android::hardware::wifi::IfaceConcurrencyType;
27 using aidl::android::hardware::wifi::IWifi;
28 using aidl::android::hardware::wifi::IWifiApIface;
29 using aidl::android::hardware::wifi::IWifiChip;
30 using aidl::android::hardware::wifi::IWifiNanIface;
31 using aidl::android::hardware::wifi::IWifiStaIface;
32 using aidl::android::hardware::wifi::WifiStatusCode;
33 
34 // Helper functions to obtain references to the various AIDL interface objects.
35 std::shared_ptr<IWifi> getWifi(const char* instance_name);
36 std::shared_ptr<IWifiChip> getWifiChip(const char* instance_name);
37 std::shared_ptr<IWifiStaIface> getWifiStaIface(const char* instance_name);
38 std::shared_ptr<IWifiNanIface> getWifiNanIface(const char* instance_name);
39 std::shared_ptr<IWifiApIface> getWifiApIface(const char* instance_name);
40 std::shared_ptr<IWifiApIface> getBridgedWifiApIface(const char* instance_name);
41 std::shared_ptr<IWifiApIface> getBridgedWifiApIface(std::shared_ptr<IWifiChip> wifi_chip);
42 // Configure the chip in a mode to support the creation of the provided iface type.
43 bool configureChipToSupportConcurrencyType(const std::shared_ptr<IWifiChip>& wifi_chip,
44                                            IfaceConcurrencyType type, int* configured_mode_id);
45 // Used to trigger IWifi.stop() at the end of every test.
46 void stopWifiService(const char* instance_name);
47 int32_t getChipFeatureSet(const std::shared_ptr<IWifiChip>& wifi_chip);
48 bool checkStatusCode(ndk::ScopedAStatus* status, WifiStatusCode expected_code);
49 bool isAidlServiceAvailable(const char* instance_name);
50