Loading wifi/1.6/default/hidl_callback_util.h +6 −3 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <set> #include <hidl/HidlSupport.h> #include <hidl/HidlTransportSupport.h> namespace { // Type of callback invoked by the death handler. Loading Loading @@ -68,10 +69,12 @@ class HidlCallbackHandler { // (callback proxy's raw pointer) to track the death of individual // clients. uint64_t cookie = reinterpret_cast<uint64_t>(cb.get()); if (cb_set_.find(cb) != cb_set_.end()) { LOG(WARNING) << "Duplicate death notification registration"; for (const auto& s : cb_set_) { if (interfacesEqual(cb, s)) { LOG(ERROR) << "Duplicate death notification registration"; return true; } } if (!cb->linkToDeath(death_handler_, cookie)) { LOG(ERROR) << "Failed to register death notification"; return false; Loading wifi/1.6/default/wifi_legacy_hal.cpp +34 −0 Original line number Diff line number Diff line Loading @@ -357,6 +357,15 @@ void onAsyncTwtEventDeviceNotify(TwtDeviceNotify* event) { } } // Callback to report current CHRE NAN state std::function<void(chre_nan_rtt_state)> on_chre_nan_rtt_internal_callback; void onAsyncChreNanRttState(chre_nan_rtt_state state) { const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_chre_nan_rtt_internal_callback) { on_chre_nan_rtt_internal_callback(state); } } // End of the free-standing "C" style callbacks. WifiLegacyHal::WifiLegacyHal(const std::weak_ptr<wifi_system::InterfaceTool> iface_tool, Loading Loading @@ -1551,6 +1560,30 @@ WifiLegacyHal::getSupportedRadioCombinationsMatrix() { return {status, radio_combination_matrix_ptr}; } wifi_error WifiLegacyHal::chreNanRttRequest(const std::string& iface_name, bool enable) { if (enable) return global_func_table_.wifi_nan_rtt_chre_enable_request(0, getIfaceHandle(iface_name), NULL); else return global_func_table_.wifi_nan_rtt_chre_disable_request(0, getIfaceHandle(iface_name)); } wifi_error WifiLegacyHal::chreRegisterHandler(const std::string& iface_name, const ChreCallbackHandlers& handler) { if (on_chre_nan_rtt_internal_callback) { return WIFI_ERROR_NOT_AVAILABLE; } on_chre_nan_rtt_internal_callback = handler.on_wifi_chre_nan_rtt_state; wifi_error status = global_func_table_.wifi_chre_register_handler(getIfaceHandle(iface_name), {onAsyncChreNanRttState}); if (status != WIFI_SUCCESS) { on_chre_nan_rtt_internal_callback = nullptr; } return status; } void WifiLegacyHal::invalidate() { global_handle_ = nullptr; iface_name_to_handle_.clear(); Loading Loading @@ -1586,6 +1619,7 @@ void WifiLegacyHal::invalidate() { on_twt_event_teardown_completion_callback = nullptr; on_twt_event_info_frame_received_callback = nullptr; on_twt_event_device_notify_callback = nullptr; on_chre_nan_rtt_internal_callback = nullptr; } } // namespace legacy_hal Loading wifi/1.6/default/wifi_legacy_hal.h +13 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ namespace implementation { namespace legacy_hal { // Import all the types defined inside the legacy HAL header files into this // namespace. using ::chre_nan_rtt_state; using ::frame_info; using ::frame_type; using ::FRAME_TYPE_80211_MGMT; Loading Loading @@ -458,6 +459,12 @@ struct TwtCallbackHandlers { std::function<void(const TwtDeviceNotify&)> on_device_notify; }; // CHRE response and event callbacks struct. struct ChreCallbackHandlers { // Callback for CHRE NAN RTT std::function<void(chre_nan_rtt_state)> on_wifi_chre_nan_rtt_state; }; /** * Class that encapsulates all legacy HAL interactions. * This class manages the lifetime of the event loop thread used by legacy HAL. Loading Loading @@ -670,6 +677,12 @@ class WifiLegacyHal { std::pair<wifi_error, wifi_radio_combination_matrix*> getSupportedRadioCombinationsMatrix(); // CHRE NAN RTT function wifi_error chreNanRttRequest(const std::string& iface_name, bool enable); wifi_error chreRegisterHandler(const std::string& iface_name, const ChreCallbackHandlers& handler); private: // Retrieve interface handles for all the available interfaces. wifi_error retrieveIfaceHandles(); Loading wifi/1.6/default/wifi_legacy_hal_stubs.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,9 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_trigger_subsystem_restart); populateStubFor(&hal_fn->wifi_set_indoor_state); populateStubFor(&hal_fn->wifi_get_supported_radio_combinations_matrix); populateStubFor(&hal_fn->wifi_nan_rtt_chre_enable_request); populateStubFor(&hal_fn->wifi_nan_rtt_chre_disable_request); populateStubFor(&hal_fn->wifi_chre_register_handler); return true; } } // namespace legacy_hal Loading Loading
wifi/1.6/default/hidl_callback_util.h +6 −3 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <set> #include <hidl/HidlSupport.h> #include <hidl/HidlTransportSupport.h> namespace { // Type of callback invoked by the death handler. Loading Loading @@ -68,10 +69,12 @@ class HidlCallbackHandler { // (callback proxy's raw pointer) to track the death of individual // clients. uint64_t cookie = reinterpret_cast<uint64_t>(cb.get()); if (cb_set_.find(cb) != cb_set_.end()) { LOG(WARNING) << "Duplicate death notification registration"; for (const auto& s : cb_set_) { if (interfacesEqual(cb, s)) { LOG(ERROR) << "Duplicate death notification registration"; return true; } } if (!cb->linkToDeath(death_handler_, cookie)) { LOG(ERROR) << "Failed to register death notification"; return false; Loading
wifi/1.6/default/wifi_legacy_hal.cpp +34 −0 Original line number Diff line number Diff line Loading @@ -357,6 +357,15 @@ void onAsyncTwtEventDeviceNotify(TwtDeviceNotify* event) { } } // Callback to report current CHRE NAN state std::function<void(chre_nan_rtt_state)> on_chre_nan_rtt_internal_callback; void onAsyncChreNanRttState(chre_nan_rtt_state state) { const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_chre_nan_rtt_internal_callback) { on_chre_nan_rtt_internal_callback(state); } } // End of the free-standing "C" style callbacks. WifiLegacyHal::WifiLegacyHal(const std::weak_ptr<wifi_system::InterfaceTool> iface_tool, Loading Loading @@ -1551,6 +1560,30 @@ WifiLegacyHal::getSupportedRadioCombinationsMatrix() { return {status, radio_combination_matrix_ptr}; } wifi_error WifiLegacyHal::chreNanRttRequest(const std::string& iface_name, bool enable) { if (enable) return global_func_table_.wifi_nan_rtt_chre_enable_request(0, getIfaceHandle(iface_name), NULL); else return global_func_table_.wifi_nan_rtt_chre_disable_request(0, getIfaceHandle(iface_name)); } wifi_error WifiLegacyHal::chreRegisterHandler(const std::string& iface_name, const ChreCallbackHandlers& handler) { if (on_chre_nan_rtt_internal_callback) { return WIFI_ERROR_NOT_AVAILABLE; } on_chre_nan_rtt_internal_callback = handler.on_wifi_chre_nan_rtt_state; wifi_error status = global_func_table_.wifi_chre_register_handler(getIfaceHandle(iface_name), {onAsyncChreNanRttState}); if (status != WIFI_SUCCESS) { on_chre_nan_rtt_internal_callback = nullptr; } return status; } void WifiLegacyHal::invalidate() { global_handle_ = nullptr; iface_name_to_handle_.clear(); Loading Loading @@ -1586,6 +1619,7 @@ void WifiLegacyHal::invalidate() { on_twt_event_teardown_completion_callback = nullptr; on_twt_event_info_frame_received_callback = nullptr; on_twt_event_device_notify_callback = nullptr; on_chre_nan_rtt_internal_callback = nullptr; } } // namespace legacy_hal Loading
wifi/1.6/default/wifi_legacy_hal.h +13 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ namespace implementation { namespace legacy_hal { // Import all the types defined inside the legacy HAL header files into this // namespace. using ::chre_nan_rtt_state; using ::frame_info; using ::frame_type; using ::FRAME_TYPE_80211_MGMT; Loading Loading @@ -458,6 +459,12 @@ struct TwtCallbackHandlers { std::function<void(const TwtDeviceNotify&)> on_device_notify; }; // CHRE response and event callbacks struct. struct ChreCallbackHandlers { // Callback for CHRE NAN RTT std::function<void(chre_nan_rtt_state)> on_wifi_chre_nan_rtt_state; }; /** * Class that encapsulates all legacy HAL interactions. * This class manages the lifetime of the event loop thread used by legacy HAL. Loading Loading @@ -670,6 +677,12 @@ class WifiLegacyHal { std::pair<wifi_error, wifi_radio_combination_matrix*> getSupportedRadioCombinationsMatrix(); // CHRE NAN RTT function wifi_error chreNanRttRequest(const std::string& iface_name, bool enable); wifi_error chreRegisterHandler(const std::string& iface_name, const ChreCallbackHandlers& handler); private: // Retrieve interface handles for all the available interfaces. wifi_error retrieveIfaceHandles(); Loading
wifi/1.6/default/wifi_legacy_hal_stubs.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,9 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_trigger_subsystem_restart); populateStubFor(&hal_fn->wifi_set_indoor_state); populateStubFor(&hal_fn->wifi_get_supported_radio_combinations_matrix); populateStubFor(&hal_fn->wifi_nan_rtt_chre_enable_request); populateStubFor(&hal_fn->wifi_nan_rtt_chre_disable_request); populateStubFor(&hal_fn->wifi_chre_register_handler); return true; } } // namespace legacy_hal Loading