btstack_run_loop_base: add btstack_run_loop_base_poll_data_sources

This commit is contained in:
Matthias Ringwald 2021-03-04 16:04:49 +01:00
parent 9111a8ae53
commit 3af29ae530
2 changed files with 17 additions and 0 deletions

View File

@ -126,3 +126,15 @@ int32_t btstack_run_loop_base_get_time_until_timeout(uint32_t now){
}
return delta;
}
void btstack_run_loop_base_poll_data_sources(void){
// poll data sources
btstack_data_source_t *ds;
btstack_data_source_t *next;
for (ds = (btstack_data_source_t *) btstack_run_loop_base_data_sources; ds != NULL ; ds = next){
next = (btstack_data_source_t *) ds->item.next; // cache pointer to next data_source to allow data source to remove itself
if (ds->flags & DATA_SOURCE_CALLBACK_POLL){
ds->process(ds, DATA_SOURCE_CALLBACK_POLL);
}
}
}

View File

@ -120,6 +120,11 @@ void btstack_run_loop_base_enable_data_source_callbacks(btstack_data_source_t *
*/
void btstack_run_loop_base_disable_data_source_callbacks(btstack_data_source_t * data_source, uint16_t callbacks);
/**
* @brief Poll data sources. It calls the procss function for all data sources where DATA_SOURCE_CALLBACK_POLL is set
*/
void btstack_run_loop_base_poll_data_sources(void);
#if defined __cplusplus
}
#endif