mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 05:49:27 +00:00
Merge "Wifi: Chip level API to set the country code"
This commit is contained in:
@@ -216,4 +216,22 @@ interface IWifiChip extends @1.4::IWifiChip {
|
||||
setCoexUnsafeChannels(
|
||||
vec<CoexUnsafeChannel> unsafeChannels, bitfield<CoexRestriction> restrictions)
|
||||
generates (WifiStatus status);
|
||||
|
||||
/**
|
||||
* Set country code for this Wifi chip.
|
||||
*
|
||||
* Country code is global setting across the Wifi chip and not Wifi
|
||||
* interface (STA or AP) specific. Legacy HAL API's for country code in
|
||||
* @1.0::ISupplicantStaIface::setCountryCode &
|
||||
* @1.0::IWifiApIface:setCountryCode are deprecated in favor of this
|
||||
* chip level API.
|
||||
*
|
||||
* @param code 2 byte country code (as defined in ISO 3166) to set.
|
||||
* @return status Status of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.FAILURE_UNKNOWN|,
|
||||
* |WifiStatusCode.FAILURE_IFACE_INVALID|
|
||||
*/
|
||||
setCountryCode(int8_t[2] code) generates (WifiStatus status);
|
||||
};
|
||||
|
||||
@@ -731,6 +731,13 @@ Return<void> WifiChip::setCoexUnsafeChannels(
|
||||
hidl_status_cb, unsafeChannels, restrictions);
|
||||
}
|
||||
|
||||
Return<void> WifiChip::setCountryCode(const hidl_array<int8_t, 2>& code,
|
||||
setCountryCode_cb hidl_status_cb) {
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiChip::setCountryCodeInternal, hidl_status_cb,
|
||||
code);
|
||||
}
|
||||
|
||||
void WifiChip::invalidateAndRemoveAllIfaces() {
|
||||
invalidateAndClearBridgedApAll();
|
||||
invalidateAndClearAll(ap_ifaces_);
|
||||
@@ -1478,6 +1485,12 @@ WifiStatus WifiChip::setCoexUnsafeChannelsInternal(
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiChip::setCountryCodeInternal(const std::array<int8_t, 2>& code) {
|
||||
auto legacy_status =
|
||||
legacy_hal_.lock()->setCountryCode(getFirstActiveWlanIfaceName(), code);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiChip::handleChipConfiguration(
|
||||
/* NONNULL */ std::unique_lock<std::recursive_mutex>* lock,
|
||||
ChipModeId mode_id) {
|
||||
|
||||
@@ -178,6 +178,8 @@ class WifiChip : public V1_5::IWifiChip {
|
||||
const hidl_vec<CoexUnsafeChannel>& unsafe_channels,
|
||||
hidl_bitfield<IfaceType> restrictions,
|
||||
setCoexUnsafeChannels_cb hidl_status_cb) override;
|
||||
Return<void> setCountryCode(const hidl_array<int8_t, 2>& code,
|
||||
setCountryCode_cb _hidl_cb) override;
|
||||
|
||||
private:
|
||||
void invalidateAndRemoveAllIfaces();
|
||||
@@ -258,7 +260,7 @@ class WifiChip : public V1_5::IWifiChip {
|
||||
WifiStatus setMultiStaUseCaseInternal(MultiStaUseCase use_case);
|
||||
WifiStatus setCoexUnsafeChannelsInternal(
|
||||
std::vector<CoexUnsafeChannel> unsafe_channels, uint32_t restrictions);
|
||||
|
||||
WifiStatus setCountryCodeInternal(const std::array<int8_t, 2>& code);
|
||||
WifiStatus handleChipConfiguration(
|
||||
std::unique_lock<std::recursive_mutex>* lock, ChipModeId mode_id);
|
||||
WifiStatus registerDebugRingBufferCallback();
|
||||
|
||||
@@ -173,6 +173,20 @@ TEST_P(WifiChipHidlTest, setCoexUnsafeChannels) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* SetCountryCode:
|
||||
* Ensures that a call to set the country code will return with a success
|
||||
* status code.
|
||||
*/
|
||||
TEST_P(WifiChipHidlTest, setCountryCode) {
|
||||
const android::hardware::hidl_array<int8_t, 2> kCountryCode{
|
||||
std::array<int8_t, 2>{{0x55, 0x53}}};
|
||||
|
||||
configureChipForIfaceType(IfaceType::STA, true);
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(wifi_chip_, setCountryCode, kCountryCode).code);
|
||||
}
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiChipHidlTest);
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiChipHidlTest,
|
||||
|
||||
Reference in New Issue
Block a user