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 #include <VtsHalHidlTargetCallbackBase.h> 18 #include <android-base/logging.h> 19 20 #undef NAN // NAN is defined in bionic/libc/include/math.h:38 21 22 #include <android/hardware/wifi/1.4/IWifi.h> 23 #include <android/hardware/wifi/1.4/IWifiApIface.h> 24 #include <android/hardware/wifi/1.4/IWifiChip.h> 25 #include <gtest/gtest.h> 26 #include <hidl/GtestPrinter.h> 27 #include <hidl/ServiceManagement.h> 28 29 #include "wifi_hidl_call_util.h" 30 #include "wifi_hidl_test_utils.h" 31 32 using ::android::sp; 33 using ::android::hardware::hidl_string; 34 using ::android::hardware::hidl_vec; 35 using ::android::hardware::Return; 36 using ::android::hardware::Void; 37 using ::android::hardware::wifi::V1_0::ChipModeId; 38 using ::android::hardware::wifi::V1_0::IfaceType; 39 using ::android::hardware::wifi::V1_4::IWifiApIface; 40 using ::android::hardware::wifi::V1_4::IWifiChip; 41 getWifiChip_1_4(const std::string & instance_name)42sp<IWifiChip> getWifiChip_1_4(const std::string& instance_name) { 43 return IWifiChip::castFrom(getWifiChip(instance_name)); 44 } 45 getWifiApIface_1_4(const std::string & instance_name)46sp<IWifiApIface> getWifiApIface_1_4(const std::string& instance_name) { 47 LOG(INFO) << "getWifiApIface_1_4"; 48 ChipModeId mode_id; 49 sp<IWifiChip> wifi_chip_ = getWifiChip_1_4(instance_name); 50 configureChipToSupportIfaceType(wifi_chip_, IfaceType::AP, &mode_id); 51 const auto& status_and_iface = HIDL_INVOKE(wifi_chip_, createApIface); 52 LOG(INFO) << "getWifiApIface_1_4 done to status_and_iface"; 53 return IWifiApIface::castFrom(status_and_iface.second); 54 } 55