Loading wifi/1.5/default/wifi_legacy_hal.cpp +105 −0 Original line number Diff line number Diff line Loading @@ -343,6 +343,43 @@ void onAsyncNanEventScheduleUpdate(NanDataPathScheduleUpdateInd* event) { on_nan_event_schedule_update_user_callback(*event); } } // Callbacks for the various TWT operations. std::function<void(const TwtSetupResponse&)> on_twt_event_setup_response_callback; void onAsyncTwtEventSetupResponse(TwtSetupResponse* event) { const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_twt_event_setup_response_callback && event) { on_twt_event_setup_response_callback(*event); } } std::function<void(const TwtTeardownCompletion&)> on_twt_event_teardown_completion_callback; void onAsyncTwtEventTeardownCompletion(TwtTeardownCompletion* event) { const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_twt_event_teardown_completion_callback && event) { on_twt_event_teardown_completion_callback(*event); } } std::function<void(const TwtInfoFrameReceived&)> on_twt_event_info_frame_received_callback; void onAsyncTwtEventInfoFrameReceived(TwtInfoFrameReceived* event) { const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_twt_event_info_frame_received_callback && event) { on_twt_event_info_frame_received_callback(*event); } } std::function<void(const TwtDeviceNotify&)> on_twt_event_device_notify_callback; void onAsyncTwtEventDeviceNotify(TwtDeviceNotify* event) { const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_twt_event_device_notify_callback && event) { on_twt_event_device_notify_callback(*event); } } // End of the free-standing "C" style callbacks. WifiLegacyHal::WifiLegacyHal( Loading Loading @@ -1529,6 +1566,70 @@ wifi_error WifiLegacyHal::setCoexUnsafeChannels( restrictions); } wifi_error WifiLegacyHal::setVoipMode(const std::string& iface_name, wifi_voip_mode mode) { return global_func_table_.wifi_set_voip_mode(getIfaceHandle(iface_name), mode); } wifi_error WifiLegacyHal::twtRegisterHandler( const std::string& iface_name, const TwtCallbackHandlers& user_callbacks) { on_twt_event_setup_response_callback = user_callbacks.on_setup_response; on_twt_event_teardown_completion_callback = user_callbacks.on_teardown_completion; on_twt_event_info_frame_received_callback = user_callbacks.on_info_frame_received; on_twt_event_device_notify_callback = user_callbacks.on_device_notify; return global_func_table_.wifi_twt_register_handler( getIfaceHandle(iface_name), {onAsyncTwtEventSetupResponse, onAsyncTwtEventTeardownCompletion, onAsyncTwtEventInfoFrameReceived, onAsyncTwtEventDeviceNotify}); } std::pair<wifi_error, TwtCapabilitySet> WifiLegacyHal::twtGetCapability( const std::string& iface_name) { TwtCapabilitySet capSet; wifi_error status = global_func_table_.wifi_twt_get_capability( getIfaceHandle(iface_name), &capSet); return {status, capSet}; } wifi_error WifiLegacyHal::twtSetupRequest(const std::string& iface_name, const TwtSetupRequest& msg) { TwtSetupRequest msgInternal(msg); return global_func_table_.wifi_twt_setup_request(getIfaceHandle(iface_name), &msgInternal); } wifi_error WifiLegacyHal::twtTearDownRequest(const std::string& iface_name, const TwtTeardownRequest& msg) { TwtTeardownRequest msgInternal(msg); return global_func_table_.wifi_twt_teardown_request( getIfaceHandle(iface_name), &msgInternal); } wifi_error WifiLegacyHal::twtInfoFrameRequest(const std::string& iface_name, const TwtInfoFrameRequest& msg) { TwtInfoFrameRequest msgInternal(msg); return global_func_table_.wifi_twt_info_frame_request( getIfaceHandle(iface_name), &msgInternal); } std::pair<wifi_error, TwtStats> WifiLegacyHal::twtGetStats( const std::string& iface_name, uint8_t configId) { TwtStats stats; wifi_error status = global_func_table_.wifi_twt_get_stats( getIfaceHandle(iface_name), configId, &stats); return {status, stats}; } wifi_error WifiLegacyHal::twtClearStats(const std::string& iface_name, uint8_t configId) { return global_func_table_.wifi_twt_clear_stats(getIfaceHandle(iface_name), configId); } void WifiLegacyHal::invalidate() { global_handle_ = nullptr; iface_name_to_handle_.clear(); Loading Loading @@ -1560,6 +1661,10 @@ void WifiLegacyHal::invalidate() { on_nan_event_range_request_user_callback = nullptr; on_nan_event_range_report_user_callback = nullptr; on_nan_event_schedule_update_user_callback = nullptr; on_twt_event_setup_response_callback = nullptr; on_twt_event_teardown_completion_callback = nullptr; on_twt_event_info_frame_received_callback = nullptr; on_twt_event_device_notify_callback = nullptr; } } // namespace legacy_hal Loading wifi/1.5/default/wifi_legacy_hal.h +34 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,18 @@ typedef struct { using on_radio_mode_change_callback = std::function<void(const std::vector<WifiMacInfo>&)>; // TWT response and event callbacks struct. struct TwtCallbackHandlers { // Callback for TWT setup response std::function<void(const TwtSetupResponse&)> on_setup_response; // Callback for TWT teardown completion std::function<void(const TwtTeardownCompletion&)> on_teardown_completion; // Callback for TWT info frame received event std::function<void(const TwtInfoFrameReceived&)> on_info_frame_received; // Callback for TWT notification from the device std::function<void(const TwtDeviceNotify&)> on_device_notify; }; /** * Class that encapsulates all legacy HAL interactions. * This class manages the lifetime of the event loop thread used by legacy HAL. Loading Loading @@ -391,6 +403,28 @@ class WifiLegacyHal { std::vector<wifi_coex_unsafe_channel> unsafe_channels, uint32_t restrictions); wifi_error setVoipMode(const std::string& iface_name, wifi_voip_mode mode); wifi_error twtRegisterHandler(const std::string& iface_name, const TwtCallbackHandlers& handler); std::pair<wifi_error, TwtCapabilitySet> twtGetCapability( const std::string& iface_name); wifi_error twtSetupRequest(const std::string& iface_name, const TwtSetupRequest& msg); wifi_error twtTearDownRequest(const std::string& iface_name, const TwtTeardownRequest& msg); wifi_error twtInfoFrameRequest(const std::string& iface_name, const TwtInfoFrameRequest& msg); std::pair<wifi_error, TwtStats> twtGetStats(const std::string& iface_name, uint8_t configId); wifi_error twtClearStats(const std::string& iface_name, uint8_t configId); private: // Retrieve interface handles for all the available interfaces. wifi_error retrieveIfaceHandles(); Loading wifi/1.5/default/wifi_legacy_hal_stubs.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -150,7 +150,14 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_multi_sta_set_primary_connection); populateStubFor(&hal_fn->wifi_multi_sta_set_use_case); populateStubFor(&hal_fn->wifi_set_coex_unsafe_channels); populateStubFor(&hal_fn->wifi_set_voip_mode); populateStubFor(&hal_fn->wifi_twt_register_handler); populateStubFor(&hal_fn->wifi_twt_get_capability); populateStubFor(&hal_fn->wifi_twt_setup_request); populateStubFor(&hal_fn->wifi_twt_teardown_request); populateStubFor(&hal_fn->wifi_twt_info_frame_request); populateStubFor(&hal_fn->wifi_twt_get_stats); populateStubFor(&hal_fn->wifi_twt_clear_stats); return true; } } // namespace legacy_hal Loading Loading
wifi/1.5/default/wifi_legacy_hal.cpp +105 −0 Original line number Diff line number Diff line Loading @@ -343,6 +343,43 @@ void onAsyncNanEventScheduleUpdate(NanDataPathScheduleUpdateInd* event) { on_nan_event_schedule_update_user_callback(*event); } } // Callbacks for the various TWT operations. std::function<void(const TwtSetupResponse&)> on_twt_event_setup_response_callback; void onAsyncTwtEventSetupResponse(TwtSetupResponse* event) { const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_twt_event_setup_response_callback && event) { on_twt_event_setup_response_callback(*event); } } std::function<void(const TwtTeardownCompletion&)> on_twt_event_teardown_completion_callback; void onAsyncTwtEventTeardownCompletion(TwtTeardownCompletion* event) { const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_twt_event_teardown_completion_callback && event) { on_twt_event_teardown_completion_callback(*event); } } std::function<void(const TwtInfoFrameReceived&)> on_twt_event_info_frame_received_callback; void onAsyncTwtEventInfoFrameReceived(TwtInfoFrameReceived* event) { const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_twt_event_info_frame_received_callback && event) { on_twt_event_info_frame_received_callback(*event); } } std::function<void(const TwtDeviceNotify&)> on_twt_event_device_notify_callback; void onAsyncTwtEventDeviceNotify(TwtDeviceNotify* event) { const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_twt_event_device_notify_callback && event) { on_twt_event_device_notify_callback(*event); } } // End of the free-standing "C" style callbacks. WifiLegacyHal::WifiLegacyHal( Loading Loading @@ -1529,6 +1566,70 @@ wifi_error WifiLegacyHal::setCoexUnsafeChannels( restrictions); } wifi_error WifiLegacyHal::setVoipMode(const std::string& iface_name, wifi_voip_mode mode) { return global_func_table_.wifi_set_voip_mode(getIfaceHandle(iface_name), mode); } wifi_error WifiLegacyHal::twtRegisterHandler( const std::string& iface_name, const TwtCallbackHandlers& user_callbacks) { on_twt_event_setup_response_callback = user_callbacks.on_setup_response; on_twt_event_teardown_completion_callback = user_callbacks.on_teardown_completion; on_twt_event_info_frame_received_callback = user_callbacks.on_info_frame_received; on_twt_event_device_notify_callback = user_callbacks.on_device_notify; return global_func_table_.wifi_twt_register_handler( getIfaceHandle(iface_name), {onAsyncTwtEventSetupResponse, onAsyncTwtEventTeardownCompletion, onAsyncTwtEventInfoFrameReceived, onAsyncTwtEventDeviceNotify}); } std::pair<wifi_error, TwtCapabilitySet> WifiLegacyHal::twtGetCapability( const std::string& iface_name) { TwtCapabilitySet capSet; wifi_error status = global_func_table_.wifi_twt_get_capability( getIfaceHandle(iface_name), &capSet); return {status, capSet}; } wifi_error WifiLegacyHal::twtSetupRequest(const std::string& iface_name, const TwtSetupRequest& msg) { TwtSetupRequest msgInternal(msg); return global_func_table_.wifi_twt_setup_request(getIfaceHandle(iface_name), &msgInternal); } wifi_error WifiLegacyHal::twtTearDownRequest(const std::string& iface_name, const TwtTeardownRequest& msg) { TwtTeardownRequest msgInternal(msg); return global_func_table_.wifi_twt_teardown_request( getIfaceHandle(iface_name), &msgInternal); } wifi_error WifiLegacyHal::twtInfoFrameRequest(const std::string& iface_name, const TwtInfoFrameRequest& msg) { TwtInfoFrameRequest msgInternal(msg); return global_func_table_.wifi_twt_info_frame_request( getIfaceHandle(iface_name), &msgInternal); } std::pair<wifi_error, TwtStats> WifiLegacyHal::twtGetStats( const std::string& iface_name, uint8_t configId) { TwtStats stats; wifi_error status = global_func_table_.wifi_twt_get_stats( getIfaceHandle(iface_name), configId, &stats); return {status, stats}; } wifi_error WifiLegacyHal::twtClearStats(const std::string& iface_name, uint8_t configId) { return global_func_table_.wifi_twt_clear_stats(getIfaceHandle(iface_name), configId); } void WifiLegacyHal::invalidate() { global_handle_ = nullptr; iface_name_to_handle_.clear(); Loading Loading @@ -1560,6 +1661,10 @@ void WifiLegacyHal::invalidate() { on_nan_event_range_request_user_callback = nullptr; on_nan_event_range_report_user_callback = nullptr; on_nan_event_schedule_update_user_callback = nullptr; on_twt_event_setup_response_callback = nullptr; on_twt_event_teardown_completion_callback = nullptr; on_twt_event_info_frame_received_callback = nullptr; on_twt_event_device_notify_callback = nullptr; } } // namespace legacy_hal Loading
wifi/1.5/default/wifi_legacy_hal.h +34 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,18 @@ typedef struct { using on_radio_mode_change_callback = std::function<void(const std::vector<WifiMacInfo>&)>; // TWT response and event callbacks struct. struct TwtCallbackHandlers { // Callback for TWT setup response std::function<void(const TwtSetupResponse&)> on_setup_response; // Callback for TWT teardown completion std::function<void(const TwtTeardownCompletion&)> on_teardown_completion; // Callback for TWT info frame received event std::function<void(const TwtInfoFrameReceived&)> on_info_frame_received; // Callback for TWT notification from the device std::function<void(const TwtDeviceNotify&)> on_device_notify; }; /** * Class that encapsulates all legacy HAL interactions. * This class manages the lifetime of the event loop thread used by legacy HAL. Loading Loading @@ -391,6 +403,28 @@ class WifiLegacyHal { std::vector<wifi_coex_unsafe_channel> unsafe_channels, uint32_t restrictions); wifi_error setVoipMode(const std::string& iface_name, wifi_voip_mode mode); wifi_error twtRegisterHandler(const std::string& iface_name, const TwtCallbackHandlers& handler); std::pair<wifi_error, TwtCapabilitySet> twtGetCapability( const std::string& iface_name); wifi_error twtSetupRequest(const std::string& iface_name, const TwtSetupRequest& msg); wifi_error twtTearDownRequest(const std::string& iface_name, const TwtTeardownRequest& msg); wifi_error twtInfoFrameRequest(const std::string& iface_name, const TwtInfoFrameRequest& msg); std::pair<wifi_error, TwtStats> twtGetStats(const std::string& iface_name, uint8_t configId); wifi_error twtClearStats(const std::string& iface_name, uint8_t configId); private: // Retrieve interface handles for all the available interfaces. wifi_error retrieveIfaceHandles(); Loading
wifi/1.5/default/wifi_legacy_hal_stubs.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -150,7 +150,14 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_multi_sta_set_primary_connection); populateStubFor(&hal_fn->wifi_multi_sta_set_use_case); populateStubFor(&hal_fn->wifi_set_coex_unsafe_channels); populateStubFor(&hal_fn->wifi_set_voip_mode); populateStubFor(&hal_fn->wifi_twt_register_handler); populateStubFor(&hal_fn->wifi_twt_get_capability); populateStubFor(&hal_fn->wifi_twt_setup_request); populateStubFor(&hal_fn->wifi_twt_teardown_request); populateStubFor(&hal_fn->wifi_twt_info_frame_request); populateStubFor(&hal_fn->wifi_twt_get_stats); populateStubFor(&hal_fn->wifi_twt_clear_stats); return true; } } // namespace legacy_hal Loading