runloop: pass enable/disable callbacks to run loop impl

This commit is contained in:
Matthias Ringwald 2016-03-24 22:19:26 +01:00
parent 24ced5a6f6
commit 0d70dd6280
6 changed files with 26 additions and 4 deletions

View File

@ -203,6 +203,8 @@ static const btstack_run_loop_t btstack_run_loop_cocoa = {
&btstack_run_loop_cocoa_init,
&btstack_run_loop_cocoa_add_data_source,
&btstack_run_loop_cocoa_remove_data_source,
NULL,
NULL,
&btstack_run_loop_cocoa_set_timer,
&btstack_run_loop_cocoa_add_timer,
&btstack_run_loop_cocoa_remove_timer,

View File

@ -268,6 +268,8 @@ static const btstack_run_loop_t btstack_run_loop_embedded = {
&btstack_run_loop_embedded_init,
&btstack_run_loop_embedded_add_data_source,
&btstack_run_loop_embedded_remove_data_source,
NULL,
NULL,
&btstack_run_loop_embedded_set_timer,
&btstack_run_loop_embedded_add_timer,
&btstack_run_loop_embedded_remove_timer,

View File

@ -267,6 +267,8 @@ static const btstack_run_loop_t btstack_run_loop_posix = {
&btstack_run_loop_posix_init,
&btstack_run_loop_posix_add_data_source,
&btstack_run_loop_posix_remove_data_source,
NULL,
NULL,
&btstack_run_loop_posix_set_timer,
&btstack_run_loop_posix_add_timer,
&btstack_run_loop_posix_remove_timer,

View File

@ -168,6 +168,8 @@ static const btstack_run_loop_t btstack_run_loop_wiced = {
&btstack_run_loop_wiced_btstack_run_loop_init,
NULL,
NULL,
NULL,
NULL,
&btstack_run_loop_wiced_set_timer,
&btstack_run_loop_wiced_add_timer,
&btstack_run_loop_wiced_remove_timer,

View File

@ -79,10 +79,22 @@ int btstack_run_loop_get_data_source_fd(btstack_data_source_t *ds){
return ds->fd;
}
void btstack_run_loop_enable_data_source_callbacks(btstack_data_source_t *data_source, uint16_t callbacks){
void btstack_run_loop_enable_data_source_callbacks(btstack_data_source_t *ds, uint16_t callbacks){
btstack_run_loop_assert();
if (the_run_loop->enable_data_source_callbacks){
return the_run_loop->enable_data_source_callbacks(ds, callbacks);
} else {
log_error("btstack_run_loop_remove_data_source not implemented");
}
}
void btstack_run_loop_disable_data_source_callbacks(btstack_data_source_t *data_source, uint16_t callbacks){
void btstack_run_loop_disable_data_source_callbacks(btstack_data_source_t *ds, uint16_t callbacks){
btstack_run_loop_assert();
if (the_run_loop->disable_data_source_callbacks){
return the_run_loop->disable_data_source_callbacks(ds, callbacks);
} else {
log_error("btstack_run_loop_disable_data_source_callbacks not implemented");
}
}
/**

View File

@ -94,8 +94,10 @@ typedef struct btstack_timer_source {
typedef struct btstack_run_loop {
void (*init)(void);
void (*add_data_source)(btstack_data_source_t *dataSource);
int (*remove_data_source)(btstack_data_source_t *dataSource);
void (*add_data_source)(btstack_data_source_t * data_source);
int (*remove_data_source)(btstack_data_source_t * data_source);
void (*enable_data_source_callbacks)(btstack_data_source_t * data_source, uint16_t callbacks);
void (*disable_data_source_callbacks)(btstack_data_source_t * data_source, uint16_t callbacks);
void (*set_timer)(btstack_timer_source_t * timer, uint32_t timeout_in_ms);
void (*add_timer)(btstack_timer_source_t *timer);
int (*remove_timer)(btstack_timer_source_t *timer);