diff options
author | Haamed Gheibi <haamed@google.com> | 2022-02-09 14:35:06 -0800 |
---|---|---|
committer | Haamed Gheibi <haamed@google.com> | 2022-02-09 14:41:16 -0800 |
commit | ab52181d73b04e131fd72e32d69b5123a5d6892b (patch) | |
tree | 0ac86b537180b6fb97716b3058dfae44af9eaac7 /wifi/1.6/default/wifi_nan_iface.cpp | |
parent | f99b35c293439db0b7436b47b939eb8c7bf21b51 (diff) | |
parent | 4d2548cfa7b86b79a516be9b60f6b666cc9af682 (diff) |
Merge TP1A.220126.001
Change-Id: Ibf6bd2c20d9927fde8b2a05dde2b58bd8faea20f
Diffstat (limited to 'wifi/1.6/default/wifi_nan_iface.cpp')
-rw-r--r-- | wifi/1.6/default/wifi_nan_iface.cpp | 43 |
1 files changed, 37 insertions, 6 deletions
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 |