[WifiCoex] Add enum for wifi coex restrictions
Add custom enum for wifi coex restrictions since IfaceType is not
suitable for use as a bitmask flag since it does not represent bit
positions.
Bug: 153651001
Test: build
Change-Id: I15575ea12784a778a3b358eea1b05b75319aa95b
diff --git a/wifi/1.5/default/wifi_chip.cpp b/wifi/1.5/default/wifi_chip.cpp
index 1b0353b..44cd5cf 100644
--- a/wifi/1.5/default/wifi_chip.cpp
+++ b/wifi/1.5/default/wifi_chip.cpp
@@ -724,7 +724,7 @@
Return<void> WifiChip::setCoexUnsafeChannels(
const hidl_vec<CoexUnsafeChannel>& unsafeChannels,
- hidl_bitfield<IfaceType> restrictions,
+ hidl_bitfield<CoexRestriction> restrictions,
setCoexUnsafeChannels_cb hidl_status_cb) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
&WifiChip::setCoexUnsafeChannelsInternal,
@@ -1463,8 +1463,18 @@
unsafe_channels, &legacy_unsafe_channels)) {
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
+ uint32_t legacy_restrictions = 0;
+ if (restrictions & CoexRestriction::WIFI_DIRECT) {
+ legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_DIRECT;
+ }
+ if (restrictions & CoexRestriction::SOFTAP) {
+ legacy_restrictions |= legacy_hal::wifi_coex_restriction::SOFTAP;
+ }
+ if (restrictions & CoexRestriction::WIFI_AWARE) {
+ legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_AWARE;
+ }
auto legacy_status = legacy_hal_.lock()->setCoexUnsafeChannels(
- legacy_unsafe_channels, restrictions);
+ legacy_unsafe_channels, legacy_restrictions);
return createWifiStatusFromLegacyError(legacy_status);
}