diff options
Diffstat (limited to 'wifi')
25 files changed, 1420 insertions, 169 deletions
diff --git a/wifi/1.6/Android.bp b/wifi/1.6/Android.bp index d293c73a79..14cb2e0466 100644 --- a/wifi/1.6/Android.bp +++ b/wifi/1.6/Android.bp @@ -14,6 +14,13 @@ hidl_interface { root: "android.hardware", srcs: [ "IWifi.hal", + "IWifiChip.hal", + "IWifiNanIface.hal", + "IWifiNanIfaceEventCallback.hal", + "IWifiRttController.hal", + "IWifiRttControllerEventCallback.hal", + "IWifiStaIface.hal", + "types.hal", ], interfaces: [ "android.hardware.wifi@1.0", diff --git a/wifi/1.6/IWifiChip.hal b/wifi/1.6/IWifiChip.hal new file mode 100644 index 0000000000..301bd82ca5 --- /dev/null +++ b/wifi/1.6/IWifiChip.hal @@ -0,0 +1,90 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi@1.6; + +import @1.0::IWifiIface; +import @1.0::WifiStatus; +import @1.5::WifiBand; +import @1.5::IWifiChip; +import @1.5::WifiIfaceMode; +import IWifiRttController; + +/** + * Interface that represents a chip that must be configured as a single unit. + */ +interface IWifiChip extends @1.5::IWifiChip { + + /** + * Create a RTTController instance. + * + * RTT controller can be either: + * a) Bound to a specific iface by passing in the corresponding |IWifiIface| + * object in |iface| param, OR + * b) Let the implementation decide the iface to use for RTT operations by + * passing null in |iface| param. + * + * @param boundIface HIDL interface object representing the iface if + * the responder must be bound to a specific iface, null otherwise. + * @return status WifiStatus of the operation. + * Possible status codes: + * |WifiStatusCode.SUCCESS|, + * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID| + */ + createRttController_1_6(IWifiIface boundIface) + generates (WifiStatus status, IWifiRttController rtt); + + /** + * Retrieve list of usable Wifi channels for the specified band & + * operational modes. + * + * The list of usable Wifi channels in a given band depends on factors + * like current country code, operational mode (e.g. STA, SAP, WFD-CLI, + * WFD-GO, TDLS, NAN) and other restrictons due to DFS, cellular coexistence + * and conncurency state of the device. + * + * @param band |WifiBand| for which list of usable channels is requested. + * @param ifaceModeMask Bitmask of the modes represented by |WifiIfaceMode| + * Bitmask respresents all the modes that the caller is interested + * in (e.g. STA, SAP, CLI, GO, TDLS, NAN). E.g. If the caller is + * interested in knowing usable channels for P2P CLI, P2P GO & NAN, + * ifaceModeMask would be set to + * IFACE_MODE_P2P_CLIENT|IFACE_MODE_P2P_GO|IFACE_MODE_NAN. + * @param filterMask Bitmask of filters represented by + * |UsableChannelFilter|. Specifies whether driver should filter + * channels based on additional criteria. If no filter is specified + * driver should return usable channels purely based on regulatory + * constraints. + * @return status WifiStatus of the operation. + * Possible status codes: + * |WifiStatusCode.SUCCESS|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_INVALID_ARGS|, + * |WifiStatusCode.FAILURE_UNKNOWN| + * @return channels List of channels represented by |WifiUsableChannel| + * Each entry represents a channel frequency, bandwidth and + * bitmask of modes (e.g. STA, SAP, CLI, GO, TDLS, NAN) that are + * allowed on that channel. E.g. If only STA mode can be supported + * on an indoor channel, only the IFACE_MODE_STA bit would be set + * for that channel. If 5GHz SAP cannot be supported, then none of + * the 5GHz channels will have IFACE_MODE_SOFTAP bit set. + * Note: Bits do not represent concurrency state. Each bit only + * represents whether particular mode is allowed on that channel. + */ + getUsableChannels_1_6(WifiBand band, bitfield<WifiIfaceMode> ifaceModeMask, + bitfield<UsableChannelFilter> filterMask) + generates (WifiStatus status, vec<WifiUsableChannel> channels); +}; diff --git a/wifi/1.6/IWifiNanIface.hal b/wifi/1.6/IWifiNanIface.hal new file mode 100644 index 0000000000..b92a880364 --- /dev/null +++ b/wifi/1.6/IWifiNanIface.hal @@ -0,0 +1,43 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi@1.6; + +import @1.0::WifiStatus; +import @1.5::IWifiNanIface; +import IWifiNanIfaceEventCallback; + +/** + * Interface used to represent a single NAN (Neighbour Aware Network) iface. + * + * References to "NAN Spec" are to the Wi-Fi Alliance "Wi-Fi Neighbor Awareness + * Networking (NAN) Technical Specification". + */ +interface IWifiNanIface extends @1.5::IWifiNanIface { + /** + * Requests notifications of significant events on this iface. Multiple calls + * to this must register multiple callbacks each of which must receive all + * events. + * + * @param callback An instance of the |IWifiNanIfaceEventCallback| HIDL interface + * object. + * @return status WifiStatus of the operation. + * Possible status codes: + * |WifiStatusCode.SUCCESS|, + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID| + */ + registerEventCallback_1_6(IWifiNanIfaceEventCallback callback) generates (WifiStatus status); +}; diff --git a/wifi/1.6/IWifiNanIfaceEventCallback.hal b/wifi/1.6/IWifiNanIfaceEventCallback.hal new file mode 100644 index 0000000000..05b8ddfa52 --- /dev/null +++ b/wifi/1.6/IWifiNanIfaceEventCallback.hal @@ -0,0 +1,48 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi@1.6; + +import @1.0::CommandIdShort; +import @1.0::WifiNanStatus; +import @1.5::IWifiNanIfaceEventCallback; + +/** + * NAN Response and Asynchronous Event Callbacks. + * + * References to "NAN Spec" are to the Wi-Fi Alliance "Wi-Fi Neighbor Awareness + * Networking (NAN) Technical Specification". + */ +interface IWifiNanIfaceEventCallback extends @1.5::IWifiNanIfaceEventCallback { + /** + * Asynchronous callback indicating a data-path (NDP) setup has been completed: received by + * both Initiator and Responder. + * + * Note: supersedes the @1.0::IWifiNanIfaceEventCallback.eventDataPathConfirm() method which is + * deprecated as of HAL version 1.2. + * + * @param event: NanDataPathConfirmInd containing event details. + */ + oneway eventDataPathConfirm_1_6(NanDataPathConfirmInd event); + + /** + * Asynchronous callback indicating a data-path (NDP) schedule has been updated (e.g. channels + * have been changed). + * + * @param event: NanDataPathScheduleUpdateInd containing event details. + */ + oneway eventDataPathScheduleUpdate_1_6(NanDataPathScheduleUpdateInd event); +}; diff --git a/wifi/1.6/IWifiRttController.hal b/wifi/1.6/IWifiRttController.hal new file mode 100644 index 0000000000..0db1d2c72b --- /dev/null +++ b/wifi/1.6/IWifiRttController.hal @@ -0,0 +1,100 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi@1.6; + +import @1.0::CommandId; +import @1.0::WifiStatus; +import @1.4::IWifiRttController; +import IWifiRttControllerEventCallback; +/** + * Interface used to perform RTT(Round trip time) operations. + */ +interface IWifiRttController extends @1.4::IWifiRttController { + /** + * Requests notifications of significant events on this rtt controller. + * Multiple calls to this must register multiple callbacks each of which must + * receive all events. + * + * @param callback An instance of the |IWifiRttControllerEventCallback| HIDL + * interface object. + * @return status WifiStatus of the operation. + * Possible status codes: + * |WifiStatusCode.SUCCESS|, + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID| + */ + registerEventCallback_1_6(IWifiRttControllerEventCallback callback) + generates (WifiStatus status); + + /** + * API to request RTT measurement. + * + * @param cmdId command Id to use for this invocation. + * @param rttConfigs Vector of |RttConfig| parameters. + * @return status WifiStatus of the operation. + * Possible status codes: + * |WifiStatusCode.SUCCESS|, + * |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|, + * |WifiStatusCode.ERROR_INVALID_ARGS|, + * |WifiStatusCode.ERROR_NOT_AVAILABLE|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + rangeRequest_1_6(CommandId cmdId, vec<RttConfig> rttConfigs) generates (WifiStatus status); + + /** + * Get RTT responder information e.g. WiFi channel to enable responder on. + * + * @return status WifiStatus of the operation. + * Possible status codes: + * |WifiStatusCode.SUCCESS|, + * |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|, + * |WifiStatusCode.ERROR_NOT_AVAILABLE|, + * |WifiStatusCode.ERROR_UNKNOWN| + * @return info Instance of |RttResponderInfo|. + */ + getResponderInfo_1_6() generates (WifiStatus status, RttResponder info); + + /** + * Enable RTT responder mode. + * + * @param cmdId command Id to use for this invocation. + * @parm channelHint Hint of the channel information where RTT responder must + * be enabled on. + * @param maxDurationInSeconds Timeout of responder mode. + * @param info Instance of |RttResponderInfo|. + * @return status WifiStatus of the operation. + * Possible status codes: + * |WifiStatusCode.SUCCESS|, + * |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|, + * |WifiStatusCode.ERROR_INVALID_ARGS|, + * |WifiStatusCode.ERROR_NOT_AVAILABLE|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + enableResponder_1_6(CommandId cmdId, WifiChannelInfo channelHint, + uint32_t maxDurationInSeconds, RttResponder info) generates (WifiStatus status); + + /** + * RTT capabilities of the device. + * + * @return status WifiStatus of the operation. + * Possible status codes: + * |WifiStatusCode.SUCCESS|, + * |WifiStatusCode.ERROR_WIFI_RTT_CONTROLLER_INVALID|, + * |WifiStatusCode.ERROR_UNKNOWN| + * @return capabilities Instance of |RttCapabilities|. + */ + getCapabilities_1_6() generates (WifiStatus status, RttCapabilities capabilities); +}; diff --git a/wifi/1.6/IWifiRttControllerEventCallback.hal b/wifi/1.6/IWifiRttControllerEventCallback.hal new file mode 100644 index 0000000000..0857b66038 --- /dev/null +++ b/wifi/1.6/IWifiRttControllerEventCallback.hal @@ -0,0 +1,33 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi@1.6; + +import @1.4::IWifiRttControllerEventCallback; +import @1.0::CommandId; + +/** + * RTT Response and Event Callbacks. + */ +interface IWifiRttControllerEventCallback extends @1.4::IWifiRttControllerEventCallback { + /* + * Invoked when an RTT result is available. + * + * @param cmdId command Id corresponding to the original request. + * @param results Vector of |RttResult| instances. + */ + oneway onResults_1_6(CommandId cmdId, vec<RttResult> results); +}; diff --git a/wifi/1.6/IWifiStaIface.hal b/wifi/1.6/IWifiStaIface.hal new file mode 100644 index 0000000000..c26e1a0981 --- /dev/null +++ b/wifi/1.6/IWifiStaIface.hal @@ -0,0 +1,44 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi@1.6; + +import @1.0::WifiStatus; +import @1.5::IWifiStaIface; + +/** + * Interface used to represent a single STA iface. + * + * IWifiChip.createStaIface() must return a @1.6::IWifiStaIface when supported. + */ +interface IWifiStaIface extends @1.5::IWifiStaIface { + /** + * Retrieve the latest link layer stats. + * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set or if + * link layer stats collection hasn't been explicitly enabled. + * + * @return status WifiStatus of the operation. + * Possible status codes: + * |WifiStatusCode.SUCCESS|, + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_NOT_STARTED|, + * |WifiStatusCode.ERROR_NOT_AVAILABLE|, + * |WifiStatusCode.ERROR_UNKNOWN| + * @return stats Instance of |LinkLayerStats|. + */ + getLinkLayerStats_1_6() generates (WifiStatus status, StaLinkLayerStats stats); +}; diff --git a/wifi/1.6/default/hidl_struct_util.cpp b/wifi/1.6/default/hidl_struct_util.cpp index 3489c9e4d3..2a6b13199b 100644 --- a/wifi/1.6/default/hidl_struct_util.cpp +++ b/wifi/1.6/default/hidl_struct_util.cpp @@ -438,7 +438,7 @@ uint32_t convertHidlUsableChannelFilterToLegacy(uint32_t hidl_filter_mask) { bool convertLegacyWifiUsableChannelToHidl( const legacy_hal::wifi_usable_channel& legacy_usable_channel, - V1_5::WifiUsableChannel* hidl_usable_channel) { + V1_6::WifiUsableChannel* hidl_usable_channel) { if (!hidl_usable_channel) { return false; } @@ -454,13 +454,13 @@ bool convertLegacyWifiUsableChannelToHidl( bool convertLegacyWifiUsableChannelsToHidl( const std::vector<legacy_hal::wifi_usable_channel>& legacy_usable_channels, - std::vector<V1_5::WifiUsableChannel>* hidl_usable_channels) { + std::vector<V1_6::WifiUsableChannel>* hidl_usable_channels) { if (!hidl_usable_channels) { return false; } *hidl_usable_channels = {}; for (const auto& legacy_usable_channel : legacy_usable_channels) { - V1_5::WifiUsableChannel hidl_usable_channel; + V1_6::WifiUsableChannel hidl_usable_channel; if (!convertLegacyWifiUsableChannelToHidl(legacy_usable_channel, &hidl_usable_channel)) { return false; } @@ -894,28 +894,28 @@ bool convertLegacyVectorOfDebugRxPacketFateToHidl( bool convertLegacyLinkLayerRadioStatsToHidl( const legacy_hal::LinkLayerRadioStats& legacy_radio_stat, - V1_5::StaLinkLayerRadioStats* hidl_radio_stat) { + V1_6::StaLinkLayerRadioStats* hidl_radio_stat) { if (!hidl_radio_stat) { return false; } *hidl_radio_stat = {}; hidl_radio_stat->radioId = legacy_radio_stat.stats.radio; - hidl_radio_stat->V1_3.V1_0.onTimeInMs = legacy_radio_stat.stats.on_time; - hidl_radio_stat->V1_3.V1_0.txTimeInMs = legacy_radio_stat.stats.tx_time; - hidl_radio_stat->V1_3.V1_0.rxTimeInMs = legacy_radio_stat.stats.rx_time; - hidl_radio_stat->V1_3.V1_0.onTimeInMsForScan = legacy_radio_stat.stats.on_time_scan; - hidl_radio_stat->V1_3.V1_0.txTimeInMsPerLevel = legacy_radio_stat.tx_time_per_levels; - hidl_radio_stat->V1_3.onTimeInMsForNanScan = legacy_radio_stat.stats.on_time_nbd; - hidl_radio_stat->V1_3.onTimeInMsForBgScan = legacy_radio_stat.stats.on_time_gscan; - hidl_radio_stat->V1_3.onTimeInMsForRoamScan = legacy_radio_stat.stats.on_time_roam_scan; - hidl_radio_stat->V1_3.onTimeInMsForPnoScan = legacy_radio_stat.stats.on_time_pno_scan; - hidl_radio_stat->V1_3.onTimeInMsForHs20Scan = legacy_radio_stat.stats.on_time_hs20; - - std::vector<V1_3::WifiChannelStats> hidl_channel_stats; + hidl_radio_stat->V1_0.onTimeInMs = legacy_radio_stat.stats.on_time; + hidl_radio_stat->V1_0.txTimeInMs = legacy_radio_stat.stats.tx_time; + hidl_radio_stat->V1_0.rxTimeInMs = legacy_radio_stat.stats.rx_time; + hidl_radio_stat->V1_0.onTimeInMsForScan = legacy_radio_stat.stats.on_time_scan; + hidl_radio_stat->V1_0.txTimeInMsPerLevel = legacy_radio_stat.tx_time_per_levels; + hidl_radio_stat->onTimeInMsForNanScan = legacy_radio_stat.stats.on_time_nbd; + hidl_radio_stat->onTimeInMsForBgScan = legacy_radio_stat.stats.on_time_gscan; + hidl_radio_stat->onTimeInMsForRoamScan = legacy_radio_stat.stats.on_time_roam_scan; + hidl_radio_stat->onTimeInMsForPnoScan = legacy_radio_stat.stats.on_time_pno_scan; + hidl_radio_stat->onTimeInMsForHs20Scan = legacy_radio_stat.stats.on_time_hs20; + + std::vector<V1_6::WifiChannelStats> hidl_channel_stats; for (const auto& channel_stat : legacy_radio_stat.channel_stats) { - V1_3::WifiChannelStats hidl_channel_stat; + V1_6::WifiChannelStats hidl_channel_stat; hidl_channel_stat.onTimeInMs = channel_stat.on_time; hidl_channel_stat.ccaBusyTimeInMs = channel_stat.cca_busy_time; /* @@ -929,13 +929,13 @@ bool convertLegacyLinkLayerRadioStatsToHidl( hidl_channel_stats.push_back(hidl_channel_stat); } - hidl_radio_stat->V1_3.channelStats = hidl_channel_stats; + hidl_radio_stat->channelStats = hidl_channel_stats; return true; } bool convertLegacyLinkLayerStatsToHidl(const legacy_hal::LinkLayerStats& legacy_stats, - V1_5::StaLinkLayerStats* hidl_stats) { + V1_6::StaLinkLayerStats* hidl_stats) { if (!hidl_stats) { return false; } @@ -1010,9 +1010,9 @@ bool convertLegacyLinkLayerStatsToHidl(const legacy_hal::LinkLayerStats& legacy_ hidl_stats->iface.timeSliceDutyCycleInPercent = legacy_stats.iface.info.time_slicing_duty_cycle_percent; // peer info legacy_stats conversion. - std::vector<V1_5::StaPeerInfo> hidl_peers_info_stats; + std::vector<V1_6::StaPeerInfo> hidl_peers_info_stats; for (const auto& legacy_peer_info_stats : legacy_stats.peers) { - V1_5::StaPeerInfo hidl_peer_info_stats; + V1_6::StaPeerInfo hidl_peer_info_stats; if (!convertLegacyPeerInfoStatsToHidl(legacy_peer_info_stats, &hidl_peer_info_stats)) { return false; } @@ -1020,9 +1020,9 @@ bool convertLegacyLinkLayerStatsToHidl(const legacy_hal::LinkLayerStats& legacy_ } hidl_stats->iface.peers = hidl_peers_info_stats; // radio legacy_stats conversion. - std::vector<V1_5::StaLinkLayerRadioStats> hidl_radios_stats; + std::vector<V1_6::StaLinkLayerRadioStats> hidl_radios_stats; for (const auto& legacy_radio_stats : legacy_stats.radios) { - V1_5::StaLinkLayerRadioStats hidl_radio_stats; + V1_6::StaLinkLayerRadioStats hidl_radio_stats; if (!convertLegacyLinkLayerRadioStatsToHidl(legacy_radio_stats, &hidl_radio_stats)) { return false; } @@ -1036,7 +1036,7 @@ bool convertLegacyLinkLayerStatsToHidl(const legacy_hal::LinkLayerStats& legacy_ } bool convertLegacyPeerInfoStatsToHidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, - V1_5::StaPeerInfo* hidl_peer_info_stats) { + V1_6::StaPeerInfo* hidl_peer_info_stats) { if (!hidl_peer_info_stats) { return false; } @@ -1044,9 +1044,9 @@ bool convertLegacyPeerInfoStatsToHidl(const legacy_hal::WifiPeerInfo& legacy_pee hidl_peer_info_stats->staCount = legacy_peer_info_stats.peer_info.bssload.sta_count; hidl_peer_info_stats->chanUtil = legacy_peer_info_stats.peer_info.bssload.chan_util; - std::vector<V1_5::StaRateStat> hidlRateStats; + std::vector<V1_6::StaRateStat> hidlRateStats; for (const auto& legacy_rate_stats : legacy_peer_info_stats.rate_stats) { - V1_5::StaRateStat rateStat; + V1_6::StaRateStat rateStat; if (!convertLegacyWifiRateInfoToHidl(legacy_rate_stats.rate, &rateStat.rateInfo)) { return false; } @@ -2134,7 +2134,7 @@ bool convertLegacyNanDataPathRequestIndToHidl(const legacy_hal::NanDataPathReque } bool convertLegacyNdpChannelInfoToHidl(const legacy_hal::NanChannelInfo& legacy_struct, - V1_2::NanDataPathChannelInfo* hidl_struct) { + V1_6::NanDataPathChannelInfo* hidl_struct) { if (!hidl_struct) { LOG(ERROR) << "convertLegacyNdpChannelInfoToHidl: hidl_struct is null"; return false; @@ -2150,7 +2150,7 @@ bool convertLegacyNdpChannelInfoToHidl(const legacy_hal::NanChannelInfo& legacy_ } bool convertLegacyNanDataPathConfirmIndToHidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, - V1_2::NanDataPathConfirmInd* hidl_ind) { + V1_6::NanDataPathConfirmInd* hidl_ind) { if (!hidl_ind) { LOG(ERROR) << "convertLegacyNanDataPathConfirmIndToHidl: hidl_ind is null"; return false; @@ -2166,9 +2166,9 @@ bool convertLegacyNanDataPathConfirmIndToHidl(const legacy_hal::NanDataPathConfi hidl_ind->V1_0.status.status = convertLegacyNanStatusTypeToHidl(legacy_ind.reason_code); hidl_ind->V1_0.status.description = ""; // TODO: b/34059183 - std::vector<V1_2::NanDataPathChannelInfo> channelInfo; + std::vector<V1_6::NanDataPathChannelInfo> channelInfo; for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { - V1_2::NanDataPathChannelInfo hidl_struct; + V1_6::NanDataPathChannelInfo hidl_struct; if (!convertLegacyNdpChannelInfoToHidl(legacy_ind.channel_info[i], &hidl_struct)) { return false; } @@ -2181,7 +2181,7 @@ bool convertLegacyNanDataPathConfirmIndToHidl(const legacy_hal::NanDataPathConfi bool convertLegacyNanDataPathScheduleUpdateIndToHidl( const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, - V1_2::NanDataPathScheduleUpdateInd* hidl_ind) { + V1_6::NanDataPathScheduleUpdateInd* hidl_ind) { if (!hidl_ind) { LOG(ERROR) << "convertLegacyNanDataPathScheduleUpdateIndToHidl: " "hidl_ind is null"; @@ -2190,9 +2190,9 @@ bool convertLegacyNanDataPathScheduleUpdateIndToHidl( *hidl_ind = {}; hidl_ind->peerDiscoveryAddress = hidl_array<uint8_t, 6>(legacy_ind.peer_mac_addr); - std::vector<V1_2::NanDataPathChannelInfo> channelInfo; + std::vector<V1_6::NanDataPathChannelInfo> channelInfo; for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { - V1_2::NanDataPathChannelInfo hidl_struct; + V1_6::NanDataPathChannelInfo hidl_struct; if (!convertLegacyNdpChannelInfoToHidl(legacy_ind.channel_info[i], &hidl_struct)) { return false; } @@ -2260,13 +2260,16 @@ legacy_hal::wifi_channel_width convertHidlWifiChannelWidthToLegacy(WifiChannelWi return legacy_hal::WIFI_CHAN_WIDTH_5; case WifiChannelWidthInMhz::WIDTH_10: return legacy_hal::WIFI_CHAN_WIDTH_10; + case V1_6::WifiChannelWidthInMhz::WIDTH_320: + return legacy_hal::WIFI_CHAN_WIDTH_320; case WifiChannelWidthInMhz::WIDTH_INVALID: return legacy_hal::WIFI_CHAN_WIDTH_INVALID; }; CHECK(false); } -WifiChannelWidthInMhz convertLegacyWifiChannelWidthToHidl(legacy_hal::wifi_channel_width type) { +V1_6::WifiChannelWidthInMhz convertLegacyWifiChannelWidthToHidl( + legacy_hal::wifi_channel_width type) { switch (type) { case legacy_hal::WIFI_CHAN_WIDTH_20: return WifiChannelWidthInMhz::WIDTH_20; @@ -2282,35 +2285,41 @@ WifiChannelWidthInMhz convertLegacyWifiChannelWidthToHidl(legacy_hal::wifi_chann return WifiChannelWidthInMhz::WIDTH_5; case legacy_hal::WIFI_CHAN_WIDTH_10: return WifiChannelWidthInMhz::WIDTH_10; + case legacy_hal::WIFI_CHAN_WIDTH_320: + return V1_6::WifiChannelWidthInMhz::WIDTH_320; default: return WifiChannelWidthInMhz::WIDTH_INVALID; }; } -legacy_hal::wifi_rtt_preamble convertHidlRttPreambleToLegacy(V1_4::RttPreamble type) { +legacy_hal::wifi_rtt_preamble convertHidlRttPreambleToLegacy(V1_6::RttPreamble type) { switch (type) { - case V1_4::RttPreamble::LEGACY: + case V1_6::RttPreamble::LEGACY: return legacy_hal::WIFI_RTT_PREAMBLE_LEGACY; - case V1_4::RttPreamble::HT: + case V1_6::RttPreamble::HT: return legacy_hal::WIFI_RTT_PREAMBLE_HT; - case V1_4::RttPreamble::VHT: + case V1_6::RttPreamble::VHT: return legacy_hal::WIFI_RTT_PREAMBLE_VHT; - case V1_4::RttPreamble::HE: + case V1_6::RttPreamble::HE: return legacy_hal::WIFI_RTT_PREAMBLE_HE; + case V1_6::RttPreamble::EHT: + return legacy_hal::WIFI_RTT_PREAMBLE_EHT; }; CHECK(false); } -V1_4::RttPreamble convertLegacyRttPreambleToHidl(legacy_hal::wifi_rtt_preamble type) { +V1_6::RttPreamble convertLegacyRttPreambleToHidl(legacy_hal::wifi_rtt_preamble type) { switch (type) { case legacy_hal::WIFI_RTT_PREAMBLE_LEGACY: - return V1_4::RttPreamble::LEGACY; + return V1_6::RttPreamble::LEGACY; case legacy_hal::WIFI_RTT_PREAMBLE_HT: - return V1_4::RttPreamble::HT; + return V1_6::RttPreamble::HT; case legacy_hal::WIFI_RTT_PREAMBLE_VHT: - return V1_4::RttPreamble::VHT; + return V1_6::RttPreamble::VHT; case legacy_hal::WIFI_RTT_PREAMBLE_HE: - return V1_4::RttPreamble::HE; + return V1_6::RttPreamble::HE; + case legacy_hal::WIFI_RTT_PREAMBLE_EHT: + return V1_6::RttPreamble::EHT; }; CHECK(false) << "Unknown legacy type: " << type; } @@ -2329,6 +2338,8 @@ legacy_hal::wifi_rtt_bw convertHidlRttBwToLegacy(RttBw type) { return legacy_hal::WIFI_RTT_BW_80; case RttBw::BW_160MHZ: return legacy_hal::WIFI_RTT_BW_160; + case RttBw::BW_320MHZ: + return legacy_hal::WIFI_RTT_BW_320; }; CHECK(false); } @@ -2347,6 +2358,8 @@ RttBw convertLegacyRttBwToHidl(legacy_hal::wifi_rtt_bw type) { return RttBw::BW_80MHZ; case legacy_hal::WIFI_RTT_BW_160: return RttBw::BW_160MHZ; + case legacy_hal::WIFI_RTT_BW_320: + return RttBw::BW_320MHZ; }; CHECK(false) << "Unknown legacy type: " << type; } @@ -2363,20 +2376,22 @@ legacy_hal::wifi_motion_pattern convertHidlRttMotionPatternToLegacy(RttMotionPat CHECK(false); } -V1_4::WifiRatePreamble convertLegacyWifiRatePreambleToHidl(uint8_t preamble) { +V1_6::WifiRatePreamble convertLegacyWifiRatePreambleToHidl(uint8_t preamble) { switch (preamble) { case 0: - return V1_4::WifiRatePreamble::OFDM; + return V1_6::WifiRatePreamble::OFDM; case 1: - return V1_4::WifiRatePreamble::CCK; + return V1_6::WifiRatePreamble::CCK; case 2: - return V1_4::WifiRatePreamble::HT; + return V1_6::WifiRatePreamble::HT; case 3: - return V1_4::WifiRatePreamble::VHT; + return V1_6::WifiRatePreamble::VHT; case 4: - return V1_4::WifiRatePreamble::HE; + return V1_6::WifiRatePreamble::HE; + case 5: + return V1_6::WifiRatePreamble::EHT; default: - return V1_4::WifiRatePreamble::RESERVED; + return V1_6::WifiRatePreamble::RESERVED; }; CHECK(false) << "Unknown legacy preamble: " << preamble; } @@ -2464,7 +2479,7 @@ bool convertLegacyWifiChannelInfoToHidl(const legacy_hal::wifi_channel_info& leg return true; } -bool convertHidlRttConfigToLegacy(const V1_4::RttConfig& hidl_config, +bool convertHidlRttConfigToLegacy(const V1_6::RttConfig& hidl_config, legacy_hal::wifi_rtt_config* legacy_config) { if (!legacy_config) { return false; @@ -2491,7 +2506,7 @@ bool convertHidlRttConfigToLegacy(const V1_4::RttConfig& hidl_config, } bool convertHidlVectorOfRttConfigToLegacy( - const std::vector<V1_4::RttConfig>& hidl_configs, + const std::vector<V1_6::RttConfig>& hidl_configs, std::vector<legacy_hal::wifi_rtt_config>* legacy_configs) { if (!legacy_configs) { return false; @@ -2542,7 +2557,7 @@ bool convertHidlRttLcrInformationToLegacy(const RttLcrInformation& hidl_info, return true; } -bool convertHidlRttResponderToLegacy(const V1_4::RttResponder& hidl_responder, +bool convertHidlRttResponderToLegacy(const V1_6::RttResponder& hidl_responder, legacy_hal::wifi_rtt_responder* legacy_responder) { if (!legacy_responder) { return false; @@ -2556,7 +2571,7 @@ bool convertHidlRttResponderToLegacy(const V1_4::RttResponder& hidl_responder, } bool convertLegacyRttResponderToHidl(const legacy_hal::wifi_rtt_responder& legacy_responder, - V1_4::RttResponder* hidl_responder) { + V1_6::RttResponder* hidl_responder) { if (!hidl_responder) { return false; } @@ -2570,7 +2585,7 @@ bool convertLegacyRttResponderToHidl(const legacy_hal::wifi_rtt_responder& legac bool convertLegacyRttCapabilitiesToHidl( const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, - V1_4::RttCapabilities* hidl_capabilities) { + V1_6::RttCapabilities* hidl_capabilities) { if (!hidl_capabilities) { return false; } @@ -2582,17 +2597,19 @@ bool convertLegacyRttCapabilitiesToHidl( hidl_capabilities->responderSupported = legacy_capabilities.responder_supported; hidl_capabilities->preambleSupport = 0; for (const auto flag : {legacy_hal::WIFI_RTT_PREAMBLE_LEGACY, legacy_hal::WIFI_RTT_PREAMBLE_HT, - legacy_hal::WIFI_RTT_PREAMBLE_VHT, legacy_hal::WIFI_RTT_PREAMBLE_HE}) { + legacy_hal::WIFI_RTT_PREAMBLE_VHT, legacy_hal::WIFI_RTT_PREAMBLE_HE, + legacy_hal::WIFI_RTT_PREAMBLE_EHT}) { if (legacy_capabilities.preamble_support & flag) { hidl_capabilities->preambleSupport |= - static_cast<std::underlying_type<V1_4::RttPreamble>::type>( + static_cast<std::underlying_type<V1_6::RttPreamble>::type>( convertLegacyRttPreambleToHidl(flag)); } } hidl_capabilities->bwSupport = 0; for (const auto flag : {legacy_hal::WIFI_RTT_BW_5, legacy_hal::WIFI_RTT_BW_10, legacy_hal::WIFI_RTT_BW_20, - legacy_hal::WIFI_RTT_BW_40, legacy_hal::WIFI_RTT_BW_80, legacy_hal::WIFI_RTT_BW_160}) { + legacy_hal::WIFI_RTT_BW_40, legacy_hal::WIFI_RTT_BW_80, legacy_hal::WIFI_RTT_BW_160, + legacy_hal::WIFI_RTT_BW_320}) { if (legacy_capabilities.bw_support & flag) { hidl_capabilities->bwSupport |= static_cast<std::underlying_type<RttBw>::type>(convertLegacyRttBwToHidl(flag)); @@ -2603,7 +2620,7 @@ bool convertLegacyRttCapabilitiesToHidl( } bool convertLegacyWifiRateInfoToHidl(const legacy_hal::wifi_rate& legacy_rate, - V1_4::WifiRateInfo* hidl_rate) { + V1_6::WifiRateInfo* hidl_rate) { if (!hidl_rate) { return false; } @@ -2618,7 +2635,7 @@ bool convertLegacyWifiRateInfoToHidl(const legacy_hal::wifi_rate& legacy_rate, } bool convertLegacyRttResultToHidl(const legacy_hal::wifi_rtt_result& legacy_result, - V1_4::RttResult* hidl_result) { + V1_6::RttResult* hidl_result) { if (!hidl_result) { return false; } @@ -2660,13 +2677,13 @@ bool convertLegacyRttResultToHidl(const legacy_hal::wifi_rtt_result& legacy_resu bool convertLegacyVectorOfRttResultToHidl( const std::vector<const legacy_hal::wifi_rtt_result*>& legacy_results, - std::vector<V1_4::RttResult>* hidl_results) { + std::vector<V1_6::RttResult>* hidl_results) { if (!hidl_results) { return false; } *hidl_results = {}; for (const auto legacy_result : legacy_results) { - V1_4::RttResult hidl_result; + V1_6::RttResult hidl_result; if (!convertLegacyRttResultToHidl(*legacy_result, &hidl_result)) { return false; } diff --git a/wifi/1.6/default/hidl_struct_util.h b/wifi/1.6/default/hidl_struct_util.h index 15a3205847..7f0266a478 100644 --- a/wifi/1.6/default/hidl_struct_util.h +++ b/wifi/1.6/default/hidl_struct_util.h @@ -25,8 +25,8 @@ #include <android/hardware/wifi/1.3/types.h> #include <android/hardware/wifi/1.4/IWifiChipEventCallback.h> #include <android/hardware/wifi/1.4/types.h> -#include <android/hardware/wifi/1.5/IWifiChip.h> -#include <android/hardware/wifi/1.5/types.h> +#include <android/hardware/wifi/1.6/IWifiChip.h> +#include <android/hardware/wifi/1.6/types.h> #include "wifi_legacy_hal.h" @@ -95,7 +95,7 @@ bool convertLegacyVectorOfCachedGscanResultsToHidl( const std::vector<legacy_hal::wifi_cached_scan_results>& legacy_cached_scan_results, std::vector<StaScanData>* hidl_scan_datas); bool convertLegacyLinkLayerStatsToHidl(const legacy_hal::LinkLayerStats& legacy_stats, - V1_5::StaLinkLayerStats* hidl_stats); + V1_6::StaLinkLayerStats* hidl_stats); bool convertLegacyRoamingCapabilitiesToHidl( const legacy_hal::wifi_roaming_capabilities& legacy_caps, StaRoamingCapabilities* hidl_caps); @@ -156,40 +156,40 @@ bool convertLegacyNanFollowupIndToHidl(const legacy_hal::NanFollowupInd& legacy_ bool convertLegacyNanDataPathRequestIndToHidl(const legacy_hal::NanDataPathRequestInd& legacy_ind, NanDataPathRequestInd* hidl_ind); bool convertLegacyNanDataPathConfirmIndToHidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, - V1_2::NanDataPathConfirmInd* hidl_ind); + V1_6::NanDataPathConfirmInd* hidl_ind); bool convertLegacyNanDataPathScheduleUpdateIndToHidl( const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, - V1_2::NanDataPathScheduleUpdateInd* hidl_ind); + V1_6::NanDataPathScheduleUpdateInd* hidl_ind); // RTT controller conversion methods. -bool convertHidlVectorOfRttConfigToLegacy(const std::vector<V1_4::RttConfig>& hidl_configs, +bool convertHidlVectorOfRttConfigToLegacy(const std::vector<V1_6::RttConfig>& hidl_configs, std::vector<legacy_hal::wifi_rtt_config>* legacy_configs); bool convertHidlRttLciInformationToLegacy(const RttLciInformation& hidl_info, legacy_hal::wifi_lci_information* legacy_info); bool convertHidlRttLcrInformationToLegacy(const RttLcrInformation& hidl_info, legacy_hal::wifi_lcr_information* legacy_info); -bool convertHidlRttResponderToLegacy(const V1_4::RttResponder& hidl_responder, +bool convertHidlRttResponderToLegacy(const V1_6::RttResponder& hidl_responder, legacy_hal::wifi_rtt_responder* legacy_responder); -bool convertHidlWifiChannelInfoToLegacy(const WifiChannelInfo& hidl_info, +bool convertHidlWifiChannelInfoToLegacy(const V1_6::WifiChannelInfo& hidl_info, legacy_hal::wifi_channel_info* legacy_info); bool convertLegacyRttResponderToHidl(const legacy_hal::wifi_rtt_responder& legacy_responder, - V1_4::RttResponder* hidl_responder); + V1_6::RttResponder* hidl_responder); bool convertLegacyRttCapabilitiesToHidl( const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, - V1_4::RttCapabilities* hidl_capabilities); + V1_6::RttCapabilities* hidl_capabilities); bool convertLegacyVectorOfRttResultToHidl( const std::vector<const legacy_hal::wifi_rtt_result*>& legacy_results, - std::vector<V1_4::RttResult>* hidl_results); + std::vector<V1_6::RttResult>* hidl_results); uint32_t convertHidlWifiBandToLegacyMacBand(V1_5::WifiBand band); uint32_t convertHidlWifiIfaceModeToLegacy(uint32_t hidl_iface_mask); uint32_t convertHidlUsableChannelFilterToLegacy(uint32_t hidl_filter_mask); bool convertLegacyWifiUsableChannelsToHidl( const std::vector<legacy_hal::wifi_usable_channel>& legacy_usable_channels, - std::vector<V1_5::WifiUsableChannel>* hidl_usable_channels); + std::vector<V1_6::WifiUsableChannel>* hidl_usable_channels); bool convertLegacyPeerInfoStatsToHidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, - V1_5::StaPeerInfo* hidl_peer_info_stats); + V1_6::StaPeerInfo* hidl_peer_info_stats); bool convertLegacyWifiRateInfoToHidl(const legacy_hal::wifi_rate& legacy_rate, - V1_4::WifiRateInfo* hidl_rate); + V1_6::WifiRateInfo* hidl_rate); } // namespace hidl_struct_util } // namespace implementation } // namespace V1_6 diff --git a/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp b/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp index 1182a58dbd..077c6cc8cd 100644 --- a/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp +++ b/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp @@ -37,7 +37,7 @@ namespace wifi { namespace V1_6 { namespace implementation { using namespace android::hardware::wifi::V1_0; -using ::android::hardware::wifi::V1_0::WifiChannelWidthInMhz; +using ::android::hardware::wifi::V1_6::WifiChannelWidthInMhz; class HidlStructUtilTest : public Test {}; @@ -216,7 +216,7 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { peer.rate_stats.push_back(rate_stat2); } - V1_5::StaLinkLayerStats converted{}; + V1_6::StaLinkLayerStats converted{}; hidl_struct_util::convertLegacyLinkLayerStatsToHidl(legacy_stats, &converted); EXPECT_EQ(legacy_stats.iface.beacon_rx, converted.iface.V1_0.beaconRx); EXPECT_EQ(legacy_stats.iface.rssi_mgmt, converted.iface.V1_0.avgRssiMgmt); @@ -294,43 +294,42 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { EXPECT_EQ(legacy_stats.radios.size(), converted.radios.size()); for (size_t i = 0; i < legacy_stats.radios.size(); i++) { EXPECT_EQ(legacy_stats.radios[i].stats.radio, converted.radios[i].radioId); - EXPECT_EQ(legacy_stats.radios[i].stats.on_time, converted.radios[i].V1_3.V1_0.onTimeInMs); - EXPECT_EQ(legacy_stats.radios[i].stats.tx_time, converted.radios[i].V1_3.V1_0.txTimeInMs); - EXPECT_EQ(legacy_stats.radios[i].stats.rx_time, converted.radios[i].V1_3.V1_0.rxTimeInMs); + EXPECT_EQ(legacy_stats.radios[i].stats.on_time, converted.radios[i].V1_0.onTimeInMs); + EXPECT_EQ(legacy_stats.radios[i].stats.tx_time, converted.radios[i].V1_0.txTimeInMs); + EXPECT_EQ(legacy_stats.radios[i].stats.rx_time, converted.radios[i].V1_0.rxTimeInMs); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_scan, - converted.radios[i].V1_3.V1_0.onTimeInMsForScan); + converted.radios[i].V1_0.onTimeInMsForScan); EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels.size(), - converted.radios[i].V1_3.V1_0.txTimeInMsPerLevel.size()); + converted.radios[i].V1_0.txTimeInMsPerLevel.size()); for (size_t j = 0; j < legacy_stats.radios[i].tx_time_per_levels.size(); j++) { EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels[j], - converted.radios[i].V1_3.V1_0.txTimeInMsPerLevel[j]); + converted.radios[i].V1_0.txTimeInMsPerLevel[j]); } EXPECT_EQ(legacy_stats.radios[i].stats.on_time_nbd, - converted.radios[i].V1_3.onTimeInMsForNanScan); + converted.radios[i].onTimeInMsForNanScan); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_gscan, - converted.radios[i].V1_3.onTimeInMsForBgScan); + converted.radios[i].onTimeInMsForBgScan); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_roam_scan, - converted.radios[i].V1_3.onTimeInMsForRoamScan); + converted.radios[i].onTimeInMsForRoamScan); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_pno_scan, - converted.radios[i].V1_3.onTimeInMsForPnoScan); + converted.radios[i].onTimeInMsForPnoScan); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_hs20, - converted.radios[i].V1_3.onTimeInMsForHs20Scan); + converted.radios[i].onTimeInMsForHs20Scan); EXPECT_EQ(legacy_stats.radios[i].channel_stats.size(), - converted.radios[i].V1_3.channelStats.size()); + converted.radios[i].channelStats.size()); for (size_t k = 0; k < legacy_stats.radios[i].channel_stats.size(); k++) { auto& legacy_channel_st = legacy_stats.radios[i].channel_stats[k]; EXPECT_EQ(WifiChannelWidthInMhz::WIDTH_20, - converted.radios[i].V1_3.channelStats[k].channel.width); + converted.radios[i].channelStats[k].channel.width); EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq), - converted.radios[i].V1_3.channelStats[k].channel.centerFreq); + converted.radios[i].channelStats[k].channel.centerFreq); EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq0), - converted.radios[i].V1_3.channelStats[k].channel.centerFreq0); + converted.radios[i].channelStats[k].channel.centerFreq0); EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq1), - converted.radios[i].V1_3.channelStats[k].channel.centerFreq1); + converted.radios[i].channelStats[k].channel.centerFreq1); EXPECT_EQ(legacy_channel_st.cca_busy_time, - converted.radios[i].V1_3.channelStats[k].ccaBusyTimeInMs); - EXPECT_EQ(legacy_channel_st.on_time, - converted.radios[i].V1_3.channelStats[k].onTimeInMs); + converted.radios[i].channelStats[k].ccaBusyTimeInMs); + EXPECT_EQ(legacy_channel_st.on_time, converted.radios[i].channelStats[k].onTimeInMs); } } diff --git a/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp b/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp index 53904116cf..542b180482 100644 --- a/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp +++ b/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp @@ -238,7 +238,7 @@ class WifiChipTest : public Test { bool createRttController() { bool success = false; - chip_->createRttController_1_4( + chip_->createRttController_1_6( NULL, [&success](const WifiStatus& status, const sp<IWifiRttController>& rtt) { if (WifiStatusCode::SUCCESS == status.code) { ASSERT_NE(rtt.get(), nullptr); @@ -716,7 +716,7 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveRttControllerOnS // Create RTT controller sp<IWifiRttController> rtt_controller; - chip_->createRttController_1_4( + chip_->createRttController_1_6( NULL, [&rtt_controller](const WifiStatus& status, const sp<IWifiRttController>& rtt) { if (WifiStatusCode::SUCCESS == status.code) { ASSERT_NE(rtt.get(), nullptr); diff --git a/wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp index c7c566bec1..13b2849209 100644 --- a/wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp +++ b/wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp @@ -85,8 +85,13 @@ class MockNanIfaceEventCallback : public V1_5::IWifiNanIfaceEventCallback { MOCK_METHOD1(eventDataPathConfirm, Return<void>(const android::hardware::wifi::V1_0::NanDataPathConfirmInd&)); MOCK_METHOD1(eventDataPathTerminated, Return<void>(uint32_t)); - MOCK_METHOD1(eventDataPathConfirm_1_2, Return<void>(const NanDataPathConfirmInd&)); - MOCK_METHOD1(eventDataPathScheduleUpdate, Return<void>(const NanDataPathScheduleUpdateInd&)); + MOCK_METHOD1(eventDataPathConfirm_1_2, + Return<void>(const android::hardware::wifi::V1_2::NanDataPathConfirmInd&)); + MOCK_METHOD1(eventDataPathConfirm_1_6, Return<void>(const NanDataPathConfirmInd&)); + MOCK_METHOD1(eventDataPathScheduleUpdate, + Return<void>(const android::hardware::wifi::V1_2::NanDataPathScheduleUpdateInd&)); + MOCK_METHOD1(eventDataPathScheduleUpdate_1_6, + Return<void>(const NanDataPathScheduleUpdateInd&)); MOCK_METHOD3(notifyCapabilitiesResponse_1_5, Return<void>(uint16_t, const WifiNanStatus&, const V1_5::NanCapabilities&)); }; diff --git a/wifi/1.6/default/wifi_chip.cpp b/wifi/1.6/default/wifi_chip.cpp index c1ce766a4f..11512f46e0 100644 --- a/wifi/1.6/default/wifi_chip.cpp +++ b/wifi/1.6/default/wifi_chip.cpp @@ -707,6 +707,21 @@ Return<void> WifiChip::triggerSubsystemRestart(triggerSubsystemRestart_cb hidl_s &WifiChip::triggerSubsystemRestartInternal, hidl_status_cb); } +Return<void> WifiChip::createRttController_1_6(const sp<IWifiIface>& bound_iface, + createRttController_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::createRttControllerInternal_1_6, hidl_status_cb, bound_iface); +} + +Return<void> WifiChip::getUsableChannels_1_6( + WifiBand band, hidl_bitfield<V1_5::WifiIfaceMode> ifaceModeMask, + hidl_bitfield<V1_5::IWifiChip::UsableChannelFilter> filterMask, + getUsableChannels_1_6_cb _hidl_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getUsableChannelsInternal_1_6, _hidl_cb, band, ifaceModeMask, + filterMask); +} + void WifiChip::invalidateAndRemoveAllIfaces() { invalidateAndClearBridgedApAll(); invalidateAndClearAll(ap_ifaces_); @@ -1114,7 +1129,7 @@ WifiStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) { return createWifiStatus(WifiStatusCode::SUCCESS); } -std::pair<WifiStatus, sp<V1_5::IWifiStaIface>> WifiChip::createStaIfaceInternal() { +std::pair<WifiStatus, sp<V1_6::IWifiStaIface>> WifiChip::createStaIfaceInternal() { if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::STA)) { return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } @@ -1144,7 +1159,7 @@ std::pair<WifiStatus, std::vector<hidl_string>> WifiChip::getStaIfaceNamesIntern return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(sta_ifaces_)}; } -std::pair<WifiStatus, sp<V1_5::IWifiStaIface>> WifiChip::getStaIfaceInternal( +std::pair<WifiStatus, sp<V1_6::IWifiStaIface>> WifiChip::getStaIfaceInternal( const std::string& ifname) { const auto iface = findUsingName(sta_ifaces_, ifname); if (!iface.get()) { @@ -1351,16 +1366,9 @@ std::pair<WifiStatus, uint32_t> WifiChip::getCapabilitiesInternal_1_5() { } std::pair<WifiStatus, sp<V1_4::IWifiRttController>> WifiChip::createRttControllerInternal_1_4( - const sp<IWifiIface>& bound_iface) { - if (sta_ifaces_.size() == 0 && !canCurrentModeSupportIfaceOfType(IfaceType::STA)) { - LOG(ERROR) << "createRttControllerInternal_1_4: Chip cannot support STAs " - "(and RTT by extension)"; - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; - } - sp<WifiRttController> rtt = - new WifiRttController(getFirstActiveWlanIfaceName(), bound_iface, legacy_hal_); - rtt_controllers_.emplace_back(rtt); - return {createWifiStatus(WifiStatusCode::SUCCESS), rtt}; + const sp<IWifiIface>& /*bound_iface*/) { + LOG(ERROR) << "createRttController_1_4 is not supported on this HAL"; + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; } WifiStatus WifiChip::registerEventCallbackInternal_1_4( @@ -1409,7 +1417,31 @@ WifiStatus WifiChip::setCountryCodeInternal(const std::array<int8_t, 2>& code) { return createWifiStatusFromLegacyError(legacy_status); } -std::pair<WifiStatus, std::vector<WifiUsableChannel>> WifiChip::getUsableChannelsInternal( +std::pair<WifiStatus, std::vector<V1_5::WifiUsableChannel>> WifiChip::getUsableChannelsInternal( + WifiBand /*band*/, uint32_t /*ifaceModeMask*/, uint32_t /*filterMask*/) { + LOG(ERROR) << "getUsableChannels is not supported on this HAL"; + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +} + +WifiStatus WifiChip::triggerSubsystemRestartInternal() { + auto legacy_status = legacy_hal_.lock()->triggerSubsystemRestart(); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair<WifiStatus, sp<V1_6::IWifiRttController>> WifiChip::createRttControllerInternal_1_6( + const sp<IWifiIface>& bound_iface) { + if (sta_ifaces_.size() == 0 && !canCurrentModeSupportIfaceOfType(IfaceType::STA)) { + LOG(ERROR) << "createRttControllerInternal_1_6: Chip cannot support STAs " + "(and RTT by extension)"; + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; + } + sp<WifiRttController> rtt = + new WifiRttController(getFirstActiveWlanIfaceName(), bound_iface, legacy_hal_); + rtt_controllers_.emplace_back(rtt); + return {createWifiStatus(WifiStatusCode::SUCCESS), rtt}; +} + +std::pair<WifiStatus, std::vector<V1_6::WifiUsableChannel>> WifiChip::getUsableChannelsInternal_1_6( WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask) { legacy_hal::wifi_error legacy_status; std::vector<legacy_hal::wifi_usable_channel> legacy_usable_channels; @@ -1421,7 +1453,7 @@ std::pair<WifiStatus, std::vector<WifiUsableChannel>> WifiChip::getUsableChannel if (legacy_status != legacy_hal::WIFI_SUCCESS) { return {createWifiStatusFromLegacyError(legacy_status), {}}; } - std::vector<WifiUsableChannel> hidl_usable_channels; + std::vector<V1_6::WifiUsableChannel> hidl_usable_channels; if (!hidl_struct_util::convertLegacyWifiUsableChannelsToHidl(legacy_usable_channels, &hidl_usable_channels)) { return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; @@ -1429,11 +1461,6 @@ std::pair<WifiStatus, std::vector<WifiUsableChannel>> WifiChip::getUsableChannel return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_usable_channels}; } -WifiStatus WifiChip::triggerSubsystemRestartInternal() { - auto legacy_status = legacy_hal_.lock()->triggerSubsystemRestart(); - return createWifiStatusFromLegacyError(legacy_status); -} - WifiStatus WifiChip::handleChipConfiguration( /* NONNULL */ std::unique_lock<std::recursive_mutex>* lock, ChipModeId mode_id) { // If the chip is already configured in a different mode, stop diff --git a/wifi/1.6/default/wifi_chip.h b/wifi/1.6/default/wifi_chip.h index 8a068985d1..73bdf3ada1 100644 --- a/wifi/1.6/default/wifi_chip.h +++ b/wifi/1.6/default/wifi_chip.h @@ -22,8 +22,9 @@ #include <mutex> #include <android-base/macros.h> -#include <android/hardware/wifi/1.4/IWifiRttController.h> -#include <android/hardware/wifi/1.5/IWifiChip.h> +#include <android/hardware/wifi/1.6/IWifiChip.h> +#include <android/hardware/wifi/1.6/IWifiRttController.h> +#include <android/hardware/wifi/1.6/IWifiStaIface.h> #include "hidl_callback_util.h" #include "ringbuffer.h" @@ -43,14 +44,13 @@ namespace V1_6 { namespace implementation { using namespace android::hardware::wifi::V1_0; using V1_5::WifiBand; -using V1_5::WifiUsableChannel; /** * HIDL interface object used to control a Wifi HAL chip instance. * Since there is only a single chip instance used today, there is no * identifying handle information stored here. */ -class WifiChip : public V1_5::IWifiChip { +class WifiChip : public V1_6::IWifiChip { public: WifiChip(ChipId chip_id, bool is_primary, const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal, @@ -154,6 +154,12 @@ class WifiChip : public V1_5::IWifiChip { hidl_bitfield<UsableChannelFilter> filterMask, getUsableChannels_cb _hidl_cb) override; Return<void> triggerSubsystemRestart(triggerSubsystemRestart_cb hidl_status_cb) override; + Return<void> createRttController_1_6(const sp<IWifiIface>& bound_iface, + createRttController_1_6_cb hidl_status_cb) override; + Return<void> getUsableChannels_1_6(WifiBand band, + hidl_bitfield<V1_5::WifiIfaceMode> ifaceModeMask, + hidl_bitfield<UsableChannelFilter> filterMask, + getUsableChannels_1_6_cb _hidl_cb) override; private: void invalidateAndRemoveAllIfaces(); @@ -191,9 +197,9 @@ class WifiChip : public V1_5::IWifiChip { std::pair<WifiStatus, std::vector<hidl_string>> getP2pIfaceNamesInternal(); std::pair<WifiStatus, sp<IWifiP2pIface>> getP2pIfaceInternal(const std::string& ifname); WifiStatus removeP2pIfaceInternal(const std::string& ifname); - std::pair<WifiStatus, sp<V1_5::IWifiStaIface>> createStaIfaceInternal(); + std::pair<WifiStatus, sp<V1_6::IWifiStaIface>> createStaIfaceInternal(); std::pair<WifiStatus, std::vector<hidl_string>> getStaIfaceNamesInternal(); - std::pair<WifiStatus, sp<V1_5::IWifiStaIface>> getStaIfaceInternal(const std::string& ifname); + std::pair<WifiStatus, sp<V1_6::IWifiStaIface>> getStaIfaceInternal(const std::string& ifname); WifiStatus removeStaIfaceInternal(const std::string& ifname); std::pair<WifiStatus, sp<V1_0::IWifiRttController>> createRttControllerInternal( const sp<IWifiIface>& bound_iface); @@ -225,13 +231,12 @@ class WifiChip : public V1_5::IWifiChip { WifiStatus setCoexUnsafeChannelsInternal(std::vector<CoexUnsafeChannel> unsafe_channels, uint32_t restrictions); WifiStatus setCountryCodeInternal(const std::array<int8_t, 2>& code); - std::pair<WifiStatus, std::vector<WifiUsableChannel>> getUsableChannelsInternal( + std::pair<WifiStatus, std::vector<V1_5::WifiUsableChannel>> getUsableChannelsInternal( WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask); WifiStatus handleChipConfiguration(std::unique_lock<std::recursive_mutex>* lock, ChipModeId mode_id); WifiStatus registerDebugRingBufferCallback(); WifiStatus registerRadioModeChangeCallback(); - std::vector<V1_4::IWifiChip::ChipIfaceCombination> getCurrentModeIfaceCombinations(); std::map<IfaceType, size_t> getCurrentIfaceCombination(); std::vector<std::map<IfaceType, size_t>> expandIfaceCombinations( @@ -258,6 +263,10 @@ class WifiChip : public V1_5::IWifiChip { void invalidateAndClearBridgedAp(const std::string& br_name); bool findUsingNameFromBridgedApInstances(const std::string& name); WifiStatus triggerSubsystemRestartInternal(); + std::pair<WifiStatus, sp<V1_6::IWifiRttController>> createRttControllerInternal_1_6( + const sp<IWifiIface>& bound_iface); + std::pair<WifiStatus, std::vector<V1_6::WifiUsableChannel>> getUsableChannelsInternal_1_6( + WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask); ChipId chip_id_; std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_; diff --git a/wifi/1.6/default/wifi_legacy_hal.h b/wifi/1.6/default/wifi_legacy_hal.h index d87242cdd5..7dc6bd643e 100644 --- a/wifi/1.6/default/wifi_legacy_hal.h +++ b/wifi/1.6/default/wifi_legacy_hal.h @@ -216,6 +216,7 @@ using ::wifi_cached_scan_results; using ::WIFI_CHAN_WIDTH_10; using ::WIFI_CHAN_WIDTH_160; using ::WIFI_CHAN_WIDTH_20; +using ::WIFI_CHAN_WIDTH_320; using ::WIFI_CHAN_WIDTH_40; using ::WIFI_CHAN_WIDTH_5; using ::WIFI_CHAN_WIDTH_80; @@ -289,12 +290,14 @@ using ::wifi_rtt_bw; using ::WIFI_RTT_BW_10; using ::WIFI_RTT_BW_160; using ::WIFI_RTT_BW_20; +using ::WIFI_RTT_BW_320; using ::WIFI_RTT_BW_40; using ::WIFI_RTT_BW_5; using ::WIFI_RTT_BW_80; using ::wifi_rtt_capabilities; using ::wifi_rtt_config; using ::wifi_rtt_preamble; +using ::WIFI_RTT_PREAMBLE_EHT; using ::WIFI_RTT_PREAMBLE_HE; using ::WIFI_RTT_PREAMBLE_HT; using ::WIFI_RTT_PREAMBLE_LEGACY; diff --git a/wifi/1.6/default/wifi_nan_iface.cpp b/wifi/1.6/default/wifi_nan_iface.cpp index 236cb64e32..1add6dce5c 100644 --- a/wifi/1.6/default/wifi_nan_iface.cpp +++ b/wifi/1.6/default/wifi_nan_iface.cpp @@ -378,15 +378,15 @@ WifiNanIface::WifiNanIface(const std::string& ifname, bool is_dedicated_iface, LOG(ERROR) << "Callback invoked on an invalid object"; return; } - V1_2::NanDataPathConfirmInd hidl_struct; + V1_6::NanDataPathConfirmInd hidl_struct; if (!hidl_struct_util::convertLegacyNanDataPathConfirmIndToHidl(msg, &hidl_struct)) { LOG(ERROR) << "Failed to convert nan capabilities response"; return; } - for (const auto& callback : shared_ptr_this->getEventCallbacks_1_2()) { - if (!callback->eventDataPathConfirm_1_2(hidl_struct).isOk()) { + for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { + if (!callback->eventDataPathConfirm_1_6(hidl_struct).isOk()) { LOG(ERROR) << "Failed to invoke the callback"; } } @@ -430,15 +430,15 @@ WifiNanIface::WifiNanIface(const std::string& ifname, bool is_dedicated_iface, LOG(ERROR) << "Callback invoked on an invalid object"; return; } - V1_2::NanDataPathScheduleUpdateInd hidl_struct; + V1_6::NanDataPathScheduleUpdateInd hidl_struct; if (!hidl_struct_util::convertLegacyNanDataPathScheduleUpdateIndToHidl( msg, &hidl_struct)) { LOG(ERROR) << "Failed to convert nan capabilities response"; return; } - for (const auto& callback : shared_ptr_this->getEventCallbacks_1_2()) { - if (!callback->eventDataPathScheduleUpdate(hidl_struct).isOk()) { + for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { + if (!callback->eventDataPathScheduleUpdate_1_6(hidl_struct).isOk()) { LOG(ERROR) << "Failed to invoke the callback"; } } @@ -510,6 +510,10 @@ std::set<sp<V1_5::IWifiNanIfaceEventCallback>> WifiNanIface::getEventCallbacks_1 return event_cb_handler_1_5_.getCallbacks(); } +std::set<sp<V1_6::IWifiNanIfaceEventCallback>> WifiNanIface::getEventCallbacks_1_6() { + return event_cb_handler_1_6_.getCallbacks(); +} + Return<void> WifiNanIface::getName(getName_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, &WifiNanIface::getNameInternal, hidl_status_cb); @@ -703,6 +707,14 @@ std::pair<WifiStatus, IfaceType> WifiNanIface::getTypeInternal() { return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::NAN}; } +Return<void> WifiNanIface::registerEventCallback_1_6( + const sp<V1_6::IWifiNanIfaceEventCallback>& callback, + registerEventCallback_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::registerEventCallback_1_6Internal, hidl_status_cb, + callback); +} + WifiStatus WifiNanIface::registerEventCallbackInternal( const sp<V1_0::IWifiNanIfaceEventCallback>& callback) { if (!event_cb_handler_.addCallback(callback)) { @@ -898,6 +910,25 @@ WifiStatus WifiNanIface::configRequest_1_5Internal(uint16_t cmd_id, return createWifiStatusFromLegacyError(legacy_status); } +WifiStatus WifiNanIface::registerEventCallback_1_6Internal( + const sp<V1_6::IWifiNanIfaceEventCallback>& callback) { + sp<V1_0::IWifiNanIfaceEventCallback> callback_1_0 = callback; + if (!event_cb_handler_.addCallback(callback_1_0)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + sp<V1_2::IWifiNanIfaceEventCallback> callback_1_2 = callback; + if (!event_cb_handler_1_2_.addCallback(callback_1_2)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + sp<V1_5::IWifiNanIfaceEventCallback> callback_1_5 = callback; + if (!event_cb_handler_1_5_.addCallback(callback_1_5)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + if (!event_cb_handler_1_6_.addCallback(callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return createWifiStatus(WifiStatusCode::SUCCESS); +} } // namespace implementation } // namespace V1_6 } // namespace wifi diff --git a/wifi/1.6/default/wifi_nan_iface.h b/wifi/1.6/default/wifi_nan_iface.h index c445afc541..b732ef1371 100644 --- a/wifi/1.6/default/wifi_nan_iface.h +++ b/wifi/1.6/default/wifi_nan_iface.h @@ -18,8 +18,8 @@ #define WIFI_NAN_IFACE_H_ #include <android-base/macros.h> -#include <android/hardware/wifi/1.5/IWifiNanIface.h> -#include <android/hardware/wifi/1.5/IWifiNanIfaceEventCallback.h> +#include <android/hardware/wifi/1.6/IWifiNanIface.h> +#include <android/hardware/wifi/1.6/IWifiNanIfaceEventCallback.h> #include "hidl_callback_util.h" #include "wifi_iface_util.h" @@ -36,7 +36,7 @@ using namespace android::hardware::wifi::V1_2; /** * HIDL interface object used to control a NAN Iface instance. */ -class WifiNanIface : public V1_5::IWifiNanIface { +class WifiNanIface : public V1_6::IWifiNanIface { public: WifiNanIface(const std::string& ifname, bool is_dedicated_iface, const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal, @@ -104,6 +104,8 @@ class WifiNanIface : public V1_5::IWifiNanIface { configRequest_1_4_cb hidl_status_cb) override; Return<void> getCapabilitiesRequest_1_5(uint16_t cmd_id, getCapabilitiesRequest_cb hidl_status_cb) override; + Return<void> registerEventCallback_1_6(const sp<V1_6::IWifiNanIfaceEventCallback>& callback, + registerEventCallback_1_6_cb hidl_status_cb) override; private: // Corresponding worker functions for the HIDL methods. @@ -145,6 +147,8 @@ class WifiNanIface : public V1_5::IWifiNanIface { WifiStatus configRequest_1_5Internal(uint16_t cmd_id, const V1_4::NanConfigRequest& msg, const V1_5::NanConfigRequestSupplemental& msg2); WifiStatus getCapabilitiesRequest_1_5Internal(uint16_t cmd_id); + WifiStatus registerEventCallback_1_6Internal( + const sp<V1_6::IWifiNanIfaceEventCallback>& callback); // all 1_0 and descendant callbacks std::set<sp<V1_0::IWifiNanIfaceEventCallback>> getEventCallbacks(); @@ -152,6 +156,8 @@ class WifiNanIface : public V1_5::IWifiNanIface { std::set<sp<V1_2::IWifiNanIfaceEventCallback>> getEventCallbacks_1_2(); // all 1_5 and descendant callbacks std::set<sp<V1_5::IWifiNanIfaceEventCallback>> getEventCallbacks_1_5(); + // all 1_6 and descendant callbacks + std::set<sp<V1_6::IWifiNanIfaceEventCallback>> getEventCallbacks_1_6(); std::string ifname_; bool is_dedicated_iface_; @@ -161,6 +167,7 @@ class WifiNanIface : public V1_5::IWifiNanIface { hidl_callback_util::HidlCallbackHandler<V1_0::IWifiNanIfaceEventCallback> event_cb_handler_; hidl_callback_util::HidlCallbackHandler<V1_2::IWifiNanIfaceEventCallback> event_cb_handler_1_2_; hidl_callback_util::HidlCallbackHandler<V1_5::IWifiNanIfaceEventCallback> event_cb_handler_1_5_; + hidl_callback_util::HidlCallbackHandler<V1_6::IWifiNanIfaceEventCallback> event_cb_handler_1_6_; DISALLOW_COPY_AND_ASSIGN(WifiNanIface); }; diff --git a/wifi/1.6/default/wifi_rtt_controller.cpp b/wifi/1.6/default/wifi_rtt_controller.cpp index f5e1d5aafc..b328f311ab 100644 --- a/wifi/1.6/default/wifi_rtt_controller.cpp +++ b/wifi/1.6/default/wifi_rtt_controller.cpp @@ -43,7 +43,7 @@ bool WifiRttController::isValid() { return is_valid_; } -std::vector<sp<V1_4::IWifiRttControllerEventCallback>> WifiRttController::getEventCallbacks() { +std::vector<sp<V1_6::IWifiRttControllerEventCallback>> WifiRttController::getEventCallbacks() { return event_callbacks_; } @@ -102,7 +102,7 @@ Return<void> WifiRttController::getResponderInfo(getResponderInfo_cb hidl_status } Return<void> WifiRttController::enableResponder(uint32_t cmd_id, - const WifiChannelInfo& channel_hint, + const V1_0::WifiChannelInfo& channel_hint, uint32_t max_duration_seconds, const V1_0::RttResponder& info, enableResponder_cb hidl_status_cb) { @@ -144,7 +144,7 @@ Return<void> WifiRttController::getResponderInfo_1_4(getResponderInfo_1_4_cb hid } Return<void> WifiRttController::enableResponder_1_4(uint32_t cmd_id, - const WifiChannelInfo& channel_hint, + const V1_0::WifiChannelInfo& channel_hint, uint32_t max_duration_seconds, const V1_4::RttResponder& info, enableResponder_1_4_cb hidl_status_cb) { @@ -153,6 +153,42 @@ Return<void> WifiRttController::enableResponder_1_4(uint32_t cmd_id, channel_hint, max_duration_seconds, info); } +Return<void> WifiRttController::registerEventCallback_1_6( + const sp<V1_6::IWifiRttControllerEventCallback>& callback, + registerEventCallback_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::registerEventCallbackInternal_1_6, hidl_status_cb, + callback); +} + +Return<void> WifiRttController::rangeRequest_1_6(uint32_t cmd_id, + const hidl_vec<V1_6::RttConfig>& rtt_configs, + rangeRequest_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::rangeRequestInternal_1_6, hidl_status_cb, cmd_id, + rtt_configs); +} + +Return<void> WifiRttController::getCapabilities_1_6(getCapabilities_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getCapabilitiesInternal_1_6, hidl_status_cb); +} + +Return<void> WifiRttController::getResponderInfo_1_6(getResponderInfo_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getResponderInfoInternal_1_6, hidl_status_cb); +} + +Return<void> WifiRttController::enableResponder_1_6(uint32_t cmd_id, + const V1_6::WifiChannelInfo& channel_hint, + uint32_t max_duration_seconds, + const V1_6::RttResponder& info, + enableResponder_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::enableResponderInternal_1_6, hidl_status_cb, cmd_id, + channel_hint, max_duration_seconds, info); +} + std::pair<WifiStatus, sp<IWifiIface>> WifiRttController::getBoundIfaceInternal() { return {createWifiStatus(WifiStatusCode::SUCCESS), bound_iface_}; } @@ -210,10 +246,9 @@ std::pair<WifiStatus, V1_0::RttResponder> WifiRttController::getResponderInfoInt return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; } -WifiStatus WifiRttController::enableResponderInternal(uint32_t /* cmd_id */, - const WifiChannelInfo& /* channel_hint */, - uint32_t /* max_duration_seconds */, - const V1_0::RttResponder& /* info */) { +WifiStatus WifiRttController::enableResponderInternal( + uint32_t /* cmd_id */, const V1_0::WifiChannelInfo& /* channel_hint */, + uint32_t /* max_duration_seconds */, const V1_0::RttResponder& /* info */) { // Deprecated support for this api return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED)}; } @@ -224,14 +259,43 @@ WifiStatus WifiRttController::disableResponderInternal(uint32_t cmd_id) { } WifiStatus WifiRttController::registerEventCallbackInternal_1_4( - const sp<V1_4::IWifiRttControllerEventCallback>& callback) { + const sp<V1_4::IWifiRttControllerEventCallback>& /* callback */) { + // Deprecated support for this api + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiRttController::rangeRequestInternal_1_4( + uint32_t /* cmd_id */, const std::vector<V1_4::RttConfig>& /* rtt_configs */) { + // Deprecated support for this api + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +std::pair<WifiStatus, V1_4::RttCapabilities> WifiRttController::getCapabilitiesInternal_1_4() { + // Deprecated support for this api + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +} + +std::pair<WifiStatus, V1_4::RttResponder> WifiRttController::getResponderInfoInternal_1_4() { + // Deprecated support for this api + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +} + +WifiStatus WifiRttController::enableResponderInternal_1_4( + uint32_t /* cmd_id */, const V1_0::WifiChannelInfo& /* channel_hint */, + uint32_t /* max_duration_seconds */, const V1_4::RttResponder& /* info */) { + // Deprecated support for this api + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED)}; +} + +WifiStatus WifiRttController::registerEventCallbackInternal_1_6( + const sp<V1_6::IWifiRttControllerEventCallback>& callback) { // TODO(b/31632518): remove the callback when the client is destroyed event_callbacks_.emplace_back(callback); return createWifiStatus(WifiStatusCode::SUCCESS); } -WifiStatus WifiRttController::rangeRequestInternal_1_4( - uint32_t cmd_id, const std::vector<V1_4::RttConfig>& rtt_configs) { +WifiStatus WifiRttController::rangeRequestInternal_1_6( + uint32_t cmd_id, const std::vector<V1_6::RttConfig>& rtt_configs) { std::vector<legacy_hal::wifi_rtt_config> legacy_configs; if (!hidl_struct_util::convertHidlVectorOfRttConfigToLegacy(rtt_configs, &legacy_configs)) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); @@ -245,14 +309,14 @@ WifiStatus WifiRttController::rangeRequestInternal_1_4( LOG(ERROR) << "Callback invoked on an invalid object"; return; } - std::vector<V1_4::RttResult> hidl_results; + std::vector<V1_6::RttResult> hidl_results; if (!hidl_struct_util::convertLegacyVectorOfRttResultToHidl(results, &hidl_results)) { LOG(ERROR) << "Failed to convert rtt results to HIDL structs"; return; } for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - callback->onResults_1_4(id, hidl_results); + callback->onResults_1_6(id, hidl_results); } }; legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRttRangeRequest( @@ -260,38 +324,38 @@ WifiStatus WifiRttController::rangeRequestInternal_1_4( return createWifiStatusFromLegacyError(legacy_status); } -std::pair<WifiStatus, V1_4::RttCapabilities> WifiRttController::getCapabilitiesInternal_1_4() { +std::pair<WifiStatus, V1_6::RttCapabilities> WifiRttController::getCapabilitiesInternal_1_6() { legacy_hal::wifi_error legacy_status; legacy_hal::wifi_rtt_capabilities legacy_caps; std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRttCapabilities(ifname_); if (legacy_status != legacy_hal::WIFI_SUCCESS) { return {createWifiStatusFromLegacyError(legacy_status), {}}; } - V1_4::RttCapabilities hidl_caps; + V1_6::RttCapabilities hidl_caps; if (!hidl_struct_util::convertLegacyRttCapabilitiesToHidl(legacy_caps, &hidl_caps)) { return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; } return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; } -std::pair<WifiStatus, V1_4::RttResponder> WifiRttController::getResponderInfoInternal_1_4() { +std::pair<WifiStatus, V1_6::RttResponder> WifiRttController::getResponderInfoInternal_1_6() { legacy_hal::wifi_error legacy_status; legacy_hal::wifi_rtt_responder legacy_responder; std::tie(legacy_status, legacy_responder) = legacy_hal_.lock()->getRttResponderInfo(ifname_); if (legacy_status != legacy_hal::WIFI_SUCCESS) { return {createWifiStatusFromLegacyError(legacy_status), {}}; } - V1_4::RttResponder hidl_responder; + V1_6::RttResponder hidl_responder; if (!hidl_struct_util::convertLegacyRttResponderToHidl(legacy_responder, &hidl_responder)) { return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; } return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_responder}; } -WifiStatus WifiRttController::enableResponderInternal_1_4(uint32_t cmd_id, - const WifiChannelInfo& channel_hint, +WifiStatus WifiRttController::enableResponderInternal_1_6(uint32_t cmd_id, + const V1_6::WifiChannelInfo& channel_hint, uint32_t max_duration_seconds, - const V1_4::RttResponder& info) { + const V1_6::RttResponder& info) { legacy_hal::wifi_channel_info legacy_channel_info; if (!hidl_struct_util::convertHidlWifiChannelInfoToLegacy(channel_hint, &legacy_channel_info)) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); diff --git a/wifi/1.6/default/wifi_rtt_controller.h b/wifi/1.6/default/wifi_rtt_controller.h index b4a2116f2b..fd5f68b6a8 100644 --- a/wifi/1.6/default/wifi_rtt_controller.h +++ b/wifi/1.6/default/wifi_rtt_controller.h @@ -19,8 +19,8 @@ #include <android-base/macros.h> #include <android/hardware/wifi/1.0/IWifiIface.h> -#include <android/hardware/wifi/1.4/IWifiRttController.h> -#include <android/hardware/wifi/1.4/IWifiRttControllerEventCallback.h> +#include <android/hardware/wifi/1.6/IWifiRttController.h> +#include <android/hardware/wifi/1.6/IWifiRttControllerEventCallback.h> #include "wifi_legacy_hal.h" @@ -33,14 +33,14 @@ namespace implementation { /** * HIDL interface object used to control all RTT operations. */ -class WifiRttController : public V1_4::IWifiRttController { +class WifiRttController : public V1_6::IWifiRttController { public: WifiRttController(const std::string& iface_name, const sp<IWifiIface>& bound_iface, const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal); // Refer to |WifiChip::invalidate()|. void invalidate(); bool isValid(); - std::vector<sp<V1_4::IWifiRttControllerEventCallback>> getEventCallbacks(); + std::vector<sp<V1_6::IWifiRttControllerEventCallback>> getEventCallbacks(); std::string getIfaceName(); // HIDL methods exposed. @@ -57,7 +57,7 @@ class WifiRttController : public V1_4::IWifiRttController { Return<void> setLcr(uint32_t cmd_id, const RttLcrInformation& lcr, setLcr_cb hidl_status_cb) override; Return<void> getResponderInfo(getResponderInfo_cb hidl_status_cb) override; - Return<void> enableResponder(uint32_t cmd_id, const WifiChannelInfo& channel_hint, + Return<void> enableResponder(uint32_t cmd_id, const V1_0::WifiChannelInfo& channel_hint, uint32_t max_duration_seconds, const V1_0::RttResponder& info, enableResponder_cb hidl_status_cb) override; Return<void> disableResponder(uint32_t cmd_id, disableResponder_cb hidl_status_cb) override; @@ -68,9 +68,19 @@ class WifiRttController : public V1_4::IWifiRttController { rangeRequest_1_4_cb hidl_status_cb) override; Return<void> getCapabilities_1_4(getCapabilities_1_4_cb hidl_status_cb) override; Return<void> getResponderInfo_1_4(getResponderInfo_1_4_cb hidl_status_cb) override; - Return<void> enableResponder_1_4(uint32_t cmd_id, const WifiChannelInfo& channel_hint, + Return<void> enableResponder_1_4(uint32_t cmd_id, const V1_0::WifiChannelInfo& channel_hint, uint32_t max_duration_seconds, const V1_4::RttResponder& info, enableResponder_1_4_cb hidl_status_cb) override; + Return<void> registerEventCallback_1_6( + const sp<V1_6::IWifiRttControllerEventCallback>& callback, + registerEventCallback_1_6_cb hidl_status_cb) override; + Return<void> rangeRequest_1_6(uint32_t cmd_id, const hidl_vec<V1_6::RttConfig>& rtt_configs, + rangeRequest_1_6_cb hidl_status_cb) override; + Return<void> getCapabilities_1_6(getCapabilities_1_6_cb hidl_status_cb) override; + Return<void> getResponderInfo_1_6(getResponderInfo_1_6_cb hidl_status_cb) override; + Return<void> enableResponder_1_6(uint32_t cmd_id, const V1_6::WifiChannelInfo& channel_hint, + uint32_t max_duration_seconds, const V1_6::RttResponder& info, + enableResponder_1_6_cb hidl_status_cb) override; private: // Corresponding worker functions for the HIDL methods. @@ -85,7 +95,7 @@ class WifiRttController : public V1_4::IWifiRttController { WifiStatus setLciInternal(uint32_t cmd_id, const RttLciInformation& lci); WifiStatus setLcrInternal(uint32_t cmd_id, const RttLcrInformation& lcr); std::pair<WifiStatus, V1_0::RttResponder> getResponderInfoInternal(); - WifiStatus enableResponderInternal(uint32_t cmd_id, const WifiChannelInfo& channel_hint, + WifiStatus enableResponderInternal(uint32_t cmd_id, const V1_0::WifiChannelInfo& channel_hint, uint32_t max_duration_seconds, const V1_0::RttResponder& info); WifiStatus disableResponderInternal(uint32_t cmd_id); @@ -95,14 +105,25 @@ class WifiRttController : public V1_4::IWifiRttController { const std::vector<V1_4::RttConfig>& rtt_configs); std::pair<WifiStatus, V1_4::RttCapabilities> getCapabilitiesInternal_1_4(); std::pair<WifiStatus, V1_4::RttResponder> getResponderInfoInternal_1_4(); - WifiStatus enableResponderInternal_1_4(uint32_t cmd_id, const WifiChannelInfo& channel_hint, + WifiStatus enableResponderInternal_1_4(uint32_t cmd_id, + const V1_0::WifiChannelInfo& channel_hint, uint32_t max_duration_seconds, const V1_4::RttResponder& info); + WifiStatus registerEventCallbackInternal_1_6( + const sp<V1_6::IWifiRttControllerEventCallback>& callback); + WifiStatus rangeRequestInternal_1_6(uint32_t cmd_id, + const std::vector<V1_6::RttConfig>& rtt_configs); + std::pair<WifiStatus, V1_6::RttCapabilities> getCapabilitiesInternal_1_6(); + std::pair<WifiStatus, V1_6::RttResponder> getResponderInfoInternal_1_6(); + WifiStatus enableResponderInternal_1_6(uint32_t cmd_id, + const V1_6::WifiChannelInfo& channel_hint, + uint32_t max_duration_seconds, + const V1_6::RttResponder& info); std::string ifname_; sp<IWifiIface> bound_iface_; std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_; - std::vector<sp<V1_4::IWifiRttControllerEventCallback>> event_callbacks_; + std::vector<sp<V1_6::IWifiRttControllerEventCallback>> event_callbacks_; bool is_valid_; DISALLOW_COPY_AND_ASSIGN(WifiRttController); diff --git a/wifi/1.6/default/wifi_sta_iface.cpp b/wifi/1.6/default/wifi_sta_iface.cpp index f852d36689..dd11839c97 100644 --- a/wifi/1.6/default/wifi_sta_iface.cpp +++ b/wifi/1.6/default/wifi_sta_iface.cpp @@ -150,6 +150,11 @@ Return<void> WifiStaIface::getLinkLayerStats_1_5(getLinkLayerStats_1_5_cb hidl_s &WifiStaIface::getLinkLayerStatsInternal_1_5, hidl_status_cb); } +Return<void> WifiStaIface::getLinkLayerStats_1_6(getLinkLayerStats_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getLinkLayerStatsInternal_1_6, hidl_status_cb); +} + Return<void> WifiStaIface::startRssiMonitoring(uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi, startRssiMonitoring_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, @@ -422,13 +427,17 @@ std::pair<WifiStatus, V1_3::StaLinkLayerStats> WifiStaIface::getLinkLayerStatsIn } std::pair<WifiStatus, V1_5::StaLinkLayerStats> WifiStaIface::getLinkLayerStatsInternal_1_5() { + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +} + +std::pair<WifiStatus, V1_6::StaLinkLayerStats> WifiStaIface::getLinkLayerStatsInternal_1_6() { legacy_hal::wifi_error legacy_status; legacy_hal::LinkLayerStats legacy_stats; std::tie(legacy_status, legacy_stats) = legacy_hal_.lock()->getLinkLayerStats(ifname_); if (legacy_status != legacy_hal::WIFI_SUCCESS) { return {createWifiStatusFromLegacyError(legacy_status), {}}; } - V1_5::StaLinkLayerStats hidl_stats; + V1_6::StaLinkLayerStats hidl_stats; if (!hidl_struct_util::convertLegacyLinkLayerStatsToHidl(legacy_stats, &hidl_stats)) { return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; } diff --git a/wifi/1.6/default/wifi_sta_iface.h b/wifi/1.6/default/wifi_sta_iface.h index 37358a5fb0..c01c50b612 100644 --- a/wifi/1.6/default/wifi_sta_iface.h +++ b/wifi/1.6/default/wifi_sta_iface.h @@ -19,7 +19,7 @@ #include <android-base/macros.h> #include <android/hardware/wifi/1.0/IWifiStaIfaceEventCallback.h> -#include <android/hardware/wifi/1.5/IWifiStaIface.h> +#include <android/hardware/wifi/1.6/IWifiStaIface.h> #include "hidl_callback_util.h" #include "wifi_iface_util.h" @@ -35,7 +35,7 @@ using namespace android::hardware::wifi::V1_0; /** * HIDL interface object used to control a STA Iface instance. */ -class WifiStaIface : public V1_5::IWifiStaIface { +class WifiStaIface : public V1_6::IWifiStaIface { public: WifiStaIface(const std::string& ifname, const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal, @@ -71,6 +71,7 @@ class WifiStaIface : public V1_5::IWifiStaIface { Return<void> getLinkLayerStats(getLinkLayerStats_cb hidl_status_cb) override; Return<void> getLinkLayerStats_1_3(getLinkLayerStats_1_3_cb hidl_status_cb) override; Return<void> getLinkLayerStats_1_5(getLinkLayerStats_1_5_cb hidl_status_cb) override; + Return<void> getLinkLayerStats_1_6(getLinkLayerStats_1_6_cb hidl_status_cb) override; Return<void> startRssiMonitoring(uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi, startRssiMonitoring_cb hidl_status_cb) override; Return<void> stopRssiMonitoring(uint32_t cmd_id, stopRssiMonitoring_cb hidl_status_cb) override; @@ -116,6 +117,7 @@ class WifiStaIface : public V1_5::IWifiStaIface { std::pair<WifiStatus, V1_0::StaLinkLayerStats> getLinkLayerStatsInternal(); std::pair<WifiStatus, V1_3::StaLinkLayerStats> getLinkLayerStatsInternal_1_3(); std::pair<WifiStatus, V1_5::StaLinkLayerStats> getLinkLayerStatsInternal_1_5(); + std::pair<WifiStatus, V1_6::StaLinkLayerStats> getLinkLayerStatsInternal_1_6(); WifiStatus startRssiMonitoringInternal(uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi); WifiStatus stopRssiMonitoringInternal(uint32_t cmd_id); std::pair<WifiStatus, StaRoamingCapabilities> getRoamingCapabilitiesInternal(); diff --git a/wifi/1.6/types.hal b/wifi/1.6/types.hal new file mode 100644 index 0000000000..f1d9d458ee --- /dev/null +++ b/wifi/1.6/types.hal @@ -0,0 +1,670 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.wifi@1.6; + +import @1.0::MacAddress; +import @1.0::NanDataPathConfirmInd; +import @1.0::Rssi; +import @1.0::RttBw; +import @1.0::RttPeerType; +import @1.0::RttStatus; +import @1.0::RttType; +import @1.0::StaLinkLayerIfaceStats; +import @1.0::StaLinkLayerRadioStats; +import @1.0::TimeSpanInPs; +import @1.0::TimeStampInUs; +import @1.0::TimeStampInMs; +import @1.0::WifiChannelInMhz; +import @1.0::WifiChannelWidthInMhz; +import @1.0::WifiInformationElement; +import @1.0::WifiRateNss; +import @1.4::RttPreamble; +import @1.4::WifiRatePreamble; +import @1.5::StaLinkLayerIfaceContentionTimeStats; +import @1.5::WifiIfaceMode; + +/** + * Channel operating width in Mhz. + */ +enum WifiChannelWidthInMhz : @1.0::WifiChannelWidthInMhz { + /** + * 320 MHz + */ + WIDTH_320 = 7, +}; + +/** + * RTT Measurement Bandwidth. + */ +enum RttBw : @1.0::RttBw { + BW_320MHZ = 0x40, +}; + +/** + * RTT Measurement Preamble. + */ +enum RttPreamble : @1.4::RttPreamble { + /** + * Preamble type for 11be + */ + EHT = 0x10, +}; + +/** + * Wifi Rate Preamble + */ +enum WifiRatePreamble : @1.4::WifiRatePreamble { + /** + * Preamble type for 11be + */ + EHT = 6, +}; + +/** + * Channel information. + */ +struct WifiChannelInfo { + /** + * Channel width (20, 40, 80, 80+80, 160, 320). + */ + WifiChannelWidthInMhz width; + /** + * Primary 20 MHz channel. + */ + WifiChannelInMhz centerFreq; + /** + * Center frequency (MHz) first segment. + */ + WifiChannelInMhz centerFreq0; + /** + * Center frequency (MHz) second segment. + */ + WifiChannelInMhz centerFreq1; +}; + +/** + * RTT configuration. + */ +struct RttConfig { + /** + * Peer device mac address. + */ + MacAddress addr; + + /** + * 1-sided or 2-sided RTT. + */ + RttType type; + + /** + * Optional - peer device hint (STA, P2P, AP). + */ + RttPeerType peer; + + /** + * Required for STA-AP mode, optional for P2P, NBD etc. + */ + WifiChannelInfo channel; + + /** + * Time interval between bursts (units: 100 ms). + * Applies to 1-sided and 2-sided RTT multi-burst requests. + * Range: 0-31, 0: no preference by initiator (2-sided RTT). + */ + uint32_t burstPeriod; + + /** + * Total number of RTT bursts to be executed. It will be + * specified in the same way as the parameter "Number of + * Burst Exponent" found in the FTM frame format. It + * applies to both: 1-sided RTT and 2-sided RTT. Valid + * values are 0 to 15 as defined in 802.11mc std. + * 0 means single shot + * The implication of this parameter on the maximum + * number of RTT results is the following: + * for 1-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst) + * for 2-sided RTT: max num of RTT results = (2^num_burst)*(num_frames_per_burst - 1) + */ + uint32_t numBurst; + + /** + * Num of frames per burst. + * Minimum value = 1, Maximum value = 31 + * For 2-sided this equals the number of FTM frames + * to be attempted in a single burst. This also + * equals the number of FTM frames that the + * initiator will request that the responder send + * in a single frame. + */ + uint32_t numFramesPerBurst; + + /** + * Number of retries for a failed RTT frame. + * Applies to 1-sided RTT only. Minimum value = 0, Maximum value = 3 + */ + uint32_t numRetriesPerRttFrame; + + /** + * Following fields are only valid for 2-side RTT. + * + * + * Maximum number of retries that the initiator can + * retry an FTMR frame. + * Minimum value = 0, Maximum value = 3 + */ + uint32_t numRetriesPerFtmr; + + /** + * Whether to request location civic info or not. + */ + bool mustRequestLci; + + /** + * Whether to request location civic records or not. + */ + bool mustRequestLcr; + + /** + * Applies to 1-sided and 2-sided RTT. Valid values will + * be 2-11 and 15 as specified by the 802.11mc std for + * the FTM parameter burst duration. In a multi-burst + * request, if responder overrides with larger value, + * the initiator will return failure. In a single-burst + * request if responder overrides with larger value, + * the initiator will sent TMR_STOP to terminate RTT + * at the end of the burst_duration it requested. + */ + uint32_t burstDuration; + + /** + * RTT preamble to be used in the RTT frames. + */ + RttPreamble preamble; + + /** + * RTT BW to be used in the RTT frames. + */ + RttBw bw; +}; + +/** + * RTT Responder information + */ +struct RttResponder { + WifiChannelInfo channel; + + RttPreamble preamble; +}; + +struct WifiChannelStats { + /** + * Channel information. + */ + WifiChannelInfo channel; + /** + * Total time for which the radio is awake on this channel. + */ + uint32_t onTimeInMs; + /** + * Total time for which CCA is held busy on this channel. + */ + uint32_t ccaBusyTimeInMs; +}; + +struct StaLinkLayerRadioStats { + /** + * Baseline information as defined in HAL 1.0. + */ + @1.0::StaLinkLayerRadioStats V1_0; + + /** + * Total time for which the radio is awake due to NAN scan since boot or crash. + */ + uint32_t onTimeInMsForNanScan; + + /** + * Total time for which the radio is awake due to background scan since boot or crash. + */ + uint32_t onTimeInMsForBgScan; + + /** + * Total time for which the radio is awake due to roam scan since boot or crash. + */ + uint32_t onTimeInMsForRoamScan; + + /** + * Total time for which the radio is awake due to PNO scan since boot or crash. + */ + uint32_t onTimeInMsForPnoScan; + + /** + * Total time for which the radio is awake due to Hotspot 2.0 scans and GAS exchange since boot + * or crash. + */ + uint32_t onTimeInMsForHs20Scan; + + /** + * List of channel stats associated with this radio + */ + vec<WifiChannelStats> channelStats; + + /** + * Radio ID: An implementation specific value identifying the radio interface for which the + * stats are produced. Framework must not interpret this value. It must use this value for + * persistently identifying the statistics between calls, + * e.g. if the HAL provides them in different order. + */ + int32_t radioId; +}; + +/** + * Per peer statistics. The types of peer include the Access Point (AP), the Tunneled Direct Link + * Setup (TDLS), the Group Owner (GO), the Neighbor Awareness Networking (NAN), etc. + */ +struct StaPeerInfo { + /** + * Station count: The total number of stations currently associated with the peer. + */ + uint16_t staCount; + /** + * Channel utilization: The percentage of time (normalized to 255, i.e., x% corresponds to + * (int) x * 255 / 100) that the medium is sensed as busy measured by either physical or + * virtual carrier sense (CS) mechanism. + */ + uint16_t chanUtil; + /** + * Per rate statistics + */ + vec<StaRateStat> rateStats; +}; + +/** + * Iface statistics for the current connection. + */ +struct StaLinkLayerIfaceStats { + /** + * Baseline information as defined in HAL 1.0. + */ + @1.0::StaLinkLayerIfaceStats V1_0; + + /** + * Duty cycle for the iface. + * if this iface is being served using time slicing on a radio with one or more ifaces + * (i.e MCC), then the duty cycle assigned to this iface in %. + * If not using time slicing (i.e SCC or DBS), set to 100. + */ + uint8_t timeSliceDutyCycleInPercent; + + /** + * WME Best Effort (BE) Access Category (AC) contention time statistics. + */ + StaLinkLayerIfaceContentionTimeStats wmeBeContentionTimeStats; + + /** + * WME Background (BK) Access Category (AC) contention time statistics. + */ + StaLinkLayerIfaceContentionTimeStats wmeBkContentionTimeStats; + + /** + * WME Video (VI) Access Category (AC) contention time statistics. + */ + StaLinkLayerIfaceContentionTimeStats wmeViContentionTimeStats; + + /** + * WME Voice (VO) Access Category (AC) contention time statistics. + */ + StaLinkLayerIfaceContentionTimeStats wmeVoContentionTimeStats; + + /** + * Per peer statistics. + */ + vec<StaPeerInfo> peers; +}; + +/** + * Link layer stats retrieved via |getLinkLayerStats|. + */ +struct StaLinkLayerStats { + StaLinkLayerIfaceStats iface; + + vec<StaLinkLayerRadioStats> radios; + + /** + * TimeStamp for each stats sample. + * This is the absolute milliseconds from boot when these stats were + * sampled. + */ + TimeStampInMs timeStampInMs; +}; + +/** + * Wifi rate info. + */ +struct WifiRateInfo { + /** + * Preamble used for RTT measurements. + */ + WifiRatePreamble preamble; + + /** + * Number of spatial streams. + */ + WifiRateNss nss; + + /** + * Bandwidth of channel. + */ + WifiChannelWidthInMhz bw; + + /** + * OFDM/CCK rate code would be as per ieee std in the units of 0.5mbps. + * HT/VHT/HE/EHT it would be mcs index. + */ + uint8_t rateMcsIdx; + + /** + * Bitrate in units of 100 Kbps. + */ + uint32_t bitRateInKbps; +}; + +/** + * Per rate statistics. The rate is characterized by the combination of preamble, number of spatial + * streams, transmission bandwidth, and modulation and coding scheme (MCS). + */ +struct StaRateStat{ + /** + * Wifi rate information: preamble, number of spatial streams, bandwidth, MCS, etc. + */ + WifiRateInfo rateInfo; + /** + * Number of successfully transmitted data packets (ACK received) + */ + uint32_t txMpdu; + /** + * Number of received data packets + */ + uint32_t rxMpdu; + /** + * Number of data packet losses (no ACK) + */ + uint32_t mpduLost; + /** + * Number of data packet retries + */ + uint32_t retries; +}; + +/** + * RTT results. + */ +struct RttResult { + /** + * Peer device mac address. + */ + MacAddress addr; + + /** + * Burst number in a multi-burst request. + */ + uint32_t burstNum; + + /** + * Total RTT measurement frames attempted. + */ + uint32_t measurementNumber; + + /** + * Total successful RTT measurement frames. + */ + uint32_t successNumber; + + /** + * Maximum number of "FTM frames per burst" supported by + * the responder STA. Applies to 2-sided RTT only. + * If reponder overrides with larger value: + * - for single-burst request initiator will truncate the + * larger value and send a TMR_STOP after receiving as + * many frames as originally requested. + * - for multi-burst request, initiator will return + * failure right away. + */ + uint8_t numberPerBurstPeer; + + /** + * Ranging status. + */ + RttStatus status; + + /** + * When status == RTT_STATUS_FAIL_BUSY_TRY_LATER, + * this will be the time provided by the responder as to + * when the request can be tried again. Applies to 2-sided + * RTT only. In sec, 1-31sec. + */ + uint8_t retryAfterDuration; + + /** + * RTT type. + */ + RttType type; + + /** + * Average rssi in 0.5 dB steps e.g. 143 implies -71.5 dB. + */ + Rssi rssi; + + /** + * Rssi spread in 0.5 dB steps e.g. 5 implies 2.5 dB spread (optional). + */ + Rssi rssiSpread; + + /** + * 1-sided RTT: TX rate of RTT frame. + * 2-sided RTT: TX rate of initiator's Ack in response to FTM frame. + */ + WifiRateInfo txRate; + + /** + * 1-sided RTT: TX rate of Ack from other side. + * 2-sided RTT: TX rate of FTM frame coming from responder. + */ + WifiRateInfo rxRate; + + /** + * Round trip time in picoseconds + */ + TimeSpanInPs rtt; + + /** + * Rtt standard deviation in picoseconds. + */ + TimeSpanInPs rttSd; + + /** + * Difference between max and min rtt times recorded in picoseconds. + */ + TimeSpanInPs rttSpread; + + /** + * Distance in mm (optional). + */ + int32_t distanceInMm; + + /** + * Standard deviation in mm (optional). + */ + int32_t distanceSdInMm; + + /** + * Difference between max and min distance recorded in mm (optional). + */ + int32_t distanceSpreadInMm; + + /** + * Time of the measurement (in microseconds since boot). + */ + TimeStampInUs timeStampInUs; + + /** + * in ms, actual time taken by the FW to finish one burst + * measurement. Applies to 1-sided and 2-sided RTT. + */ + uint32_t burstDurationInMs; + + /** + * Number of bursts allowed by the responder. Applies + * to 2-sided RTT only. + */ + uint32_t negotiatedBurstNum; + + /** + * for 11mc only. + */ + WifiInformationElement lci; + + /** + * for 11mc only. + */ + WifiInformationElement lcr; +}; + +/** + * NAN data path channel information provided to the framework. + */ +struct NanDataPathChannelInfo { + /** + * Channel frequency in MHz. + */ + WifiChannelInMhz channelFreq; + /** + * Channel bandwidth in MHz. + */ + WifiChannelWidthInMhz channelBandwidth; + /** + * Number of spatial streams used in the channel. + */ + uint32_t numSpatialStreams; +}; + +/** + * NAN Data path confirmation Indication structure. + * Event indication is received on both initiator and responder side when negotiation for a + * data-path finish: on success or failure. + */ +struct NanDataPathConfirmInd { + /** + * Baseline information as defined in HAL 1.0. + */ + @1.0::NanDataPathConfirmInd V1_0; + /** + * The channel(s) on which the NDP is scheduled to operate. + * Updates to the operational channels are provided using the |eventDataPathScheduleUpdate| + * event. + */ + vec<NanDataPathChannelInfo> channelInfo; +}; + +/** + * NAN data path channel information update indication structure. + * Event indication is received by all NDP owners whenever the channels on which the NDP operates + * are updated. + * Note: multiple NDPs may share the same schedule, the indication specifies all NDPs to which it + * applies. + */ +struct NanDataPathScheduleUpdateInd { + /** + * The discovery address (NMI) of the peer to which the NDP is connected. + */ + MacAddress peerDiscoveryAddress; + /** + * The updated channel(s) information. + */ + vec<NanDataPathChannelInfo> channelInfo; + /** + * The list of NDPs to which this update applies. + */ + vec<uint32_t> ndpInstanceIds; +}; + +/** + * Wifi usable channel information. + */ +struct WifiUsableChannel { + /** + * Wifi channel freqeuncy in MHz. + */ + WifiChannelInMhz channel; + + /** + * Wifi channel bandwidth in MHz. + */ + WifiChannelWidthInMhz channelBandwidth; + + /** + * Iface modes feasible on this channel. + */ + bitfield<WifiIfaceMode> ifaceModeMask; +}; + +/** + * RTT Capabilities. + */ +struct RttCapabilities { + /** + * if 1-sided rtt data collection is supported. + */ + bool rttOneSidedSupported; + + /** + * if ftm rtt data collection is supported. + */ + bool rttFtmSupported; + + /** + * if initiator supports LCI request. Applies to 2-sided RTT. + */ + bool lciSupported; + + /** + * if initiator supports LCR request. Applies to 2-sided RTT. + */ + bool lcrSupported; + + /** + * if 11mc responder mode is supported. + */ + bool responderSupported; + + /** + * Bit mask indicates what preamble is supported by initiator. + * Combination of |RttPreamble| values. + */ + bitfield<RttPreamble> preambleSupport; + + /** + * Bit mask indicates what BW is supported by initiator. + * Combination of |RttBw| values. + */ + bitfield<RttBw> bwSupport; + + /** + * Draft 11mc spec version supported by chip. + * For instance, version 4.0 must be 40 and version 4.3 must be 43 etc. + */ + uint8_t mcVersion; +}; diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl index 18baea6961..bdc5f3483c 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl @@ -125,6 +125,7 @@ interface ISupplicantStaNetwork { void setWapiCertSuite(in String suite); void setWepKey(in int keyIdx, in byte[] wepKey); void setWepTxKeyIdx(in int keyIdx); + void setRoamingConsortiumSelection(in byte[] selectedRcoi); const int SSID_MAX_LEN_IN_BYTES = 32; const int PSK_PASSPHRASE_MIN_LEN_IN_BYTES = 8; const int PSK_PASSPHRASE_MAX_LEN_IN_BYTES = 63; diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl index 603e2add6e..1a2087dbe1 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl @@ -1092,4 +1092,17 @@ interface ISupplicantStaNetwork { * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| */ void setWepTxKeyIdx(in int keyIdx); + + /** + * Set the roaming consortium selection. + * + * @param selectedRcoi Indicates the roaming consortium selection. This is a + * 3 or 5-octet long byte array that indicates the selected RCOI + * used for a Passpoint connection. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_ARGS_INVALID|, + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| + */ + void setRoamingConsortiumSelection(in byte[] selectedRcoi); } diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp index 0a35f666f4..c6dd98152d 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp @@ -784,6 +784,14 @@ TEST_P(SupplicantStaNetworkAidlTest, GetWpsNfcConfigurationToken) { EXPECT_NE(retrievedToken.size(), 0); } +/* + * SetRoamingConsortiumSelection + */ +TEST_P(SupplicantStaNetworkAidlTest, SetRoamingConsortiumSelection) { + const std::vector<uint8_t> testSelection = std::vector<uint8_t>({0x11, 0x21, 0x33, 0x44}); + EXPECT_TRUE(sta_network_->setRoamingConsortiumSelection(testSelection).isOk()); +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SupplicantStaNetworkAidlTest); INSTANTIATE_TEST_SUITE_P(Supplicant, SupplicantStaNetworkAidlTest, testing::ValuesIn(android::getAidlHalInstanceNames( |