diff options
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/1.0/default/wifi_legacy_hal.cpp | 14 | ||||
-rw-r--r-- | wifi/1.0/default/wifi_legacy_hal.h | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.0/default/wifi_legacy_hal.cpp index 678ebb1a31..d65052e639 100644 --- a/wifi/1.0/default/wifi_legacy_hal.cpp +++ b/wifi/1.0/default/wifi_legacy_hal.cpp @@ -741,8 +741,20 @@ wifi_error WifiLegacyHal::registerRingBufferCallbackHandler( on_user_data_callback(ring_name, buffer_vector, *status); } }; - return global_func_table_.wifi_set_log_handler( + wifi_error status = global_func_table_.wifi_set_log_handler( 0, wlan_interface_handle_, {onRingBufferData}); + if (status != WIFI_SUCCESS) { + on_ring_buffer_data_internal_callback = nullptr; + } + return status; +} + +wifi_error WifiLegacyHal::deregisterRingBufferCallbackHandler() { + if (!on_ring_buffer_data_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + on_ring_buffer_data_internal_callback = nullptr; + return global_func_table_.wifi_reset_log_handler(0, wlan_interface_handle_); } std::pair<wifi_error, std::vector<wifi_ring_buffer_status>> diff --git a/wifi/1.0/default/wifi_legacy_hal.h b/wifi/1.0/default/wifi_legacy_hal.h index c846fc8da1..b5853147ab 100644 --- a/wifi/1.0/default/wifi_legacy_hal.h +++ b/wifi/1.0/default/wifi_legacy_hal.h @@ -192,6 +192,7 @@ class WifiLegacyHal { std::pair<wifi_error, WakeReasonStats> getWakeReasonStats(); wifi_error registerRingBufferCallbackHandler( const on_ring_buffer_data_callback& on_data_callback); + wifi_error deregisterRingBufferCallbackHandler(); std::pair<wifi_error, std::vector<wifi_ring_buffer_status>> getRingBuffersStatus(); wifi_error startRingBufferLogging(const std::string& ring_name, |