mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-13 04:13:54 +00:00
runloop: set ds->process via setter
This commit is contained in:
parent
390cf48d42
commit
835c167141
@ -315,7 +315,7 @@ int socket_connection_create_tcp(int port){
|
|||||||
btstack_data_source_t *ds = malloc( sizeof(btstack_data_source_t));
|
btstack_data_source_t *ds = malloc( sizeof(btstack_data_source_t));
|
||||||
if (ds == NULL) return -1;
|
if (ds == NULL) return -1;
|
||||||
ds->fd = 0;
|
ds->fd = 0;
|
||||||
ds->process = socket_connection_accept;
|
btstack_run_loop_set_data_source_handler(ds, &socket_connection_accept);
|
||||||
|
|
||||||
// create tcp socket
|
// create tcp socket
|
||||||
if ((ds->fd = socket (PF_INET, SOCK_STREAM, 0)) < 0) {
|
if ((ds->fd = socket (PF_INET, SOCK_STREAM, 0)) < 0) {
|
||||||
@ -369,7 +369,7 @@ void socket_connection_launchd_register_fd_array(launch_data_t listening_fd_arra
|
|||||||
// create btstack_data_source_t for fd
|
// create btstack_data_source_t for fd
|
||||||
btstack_data_source_t *ds = malloc( sizeof(btstack_data_source_t));
|
btstack_data_source_t *ds = malloc( sizeof(btstack_data_source_t));
|
||||||
if (ds == NULL) return;
|
if (ds == NULL) return;
|
||||||
ds->process = socket_connection_accept;
|
btstack_run_loop_set_data_source_handler(ds, &socket_connection_accept);
|
||||||
ds->fd = listening_fd;
|
ds->fd = listening_fd;
|
||||||
btstack_run_loop_add_data_source(ds);
|
btstack_run_loop_add_data_source(ds);
|
||||||
}
|
}
|
||||||
@ -456,7 +456,7 @@ int socket_connection_create_unix(char *path){
|
|||||||
btstack_data_source_t *ds = malloc( sizeof(btstack_data_source_t));
|
btstack_data_source_t *ds = malloc( sizeof(btstack_data_source_t));
|
||||||
if (ds == NULL) return -1;
|
if (ds == NULL) return -1;
|
||||||
ds->fd = 0;
|
ds->fd = 0;
|
||||||
ds->process = socket_connection_accept;
|
btstack_run_loop_set_data_source_handler(ds, &socket_connection_accept);
|
||||||
|
|
||||||
// create unix socket
|
// create unix socket
|
||||||
if ((ds->fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) {
|
if ((ds->fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||||
|
@ -213,7 +213,7 @@ static int h4_open(void){
|
|||||||
if (!hci_transport_h4->ds) return -1;
|
if (!hci_transport_h4->ds) return -1;
|
||||||
hci_transport_h4->uart_fd = fd;
|
hci_transport_h4->uart_fd = fd;
|
||||||
hci_transport_h4->ds->fd = fd;
|
hci_transport_h4->ds->fd = fd;
|
||||||
hci_transport_h4->ds->process = h4_process;
|
btstack_run_loop_set_data_source_handler(hci_transport_h4, &h4_process);
|
||||||
btstack_run_loop_add_data_source(hci_transport_h4->ds);
|
btstack_run_loop_add_data_source(hci_transport_h4->ds);
|
||||||
|
|
||||||
// also set baudrate
|
// also set baudrate
|
||||||
|
@ -225,7 +225,7 @@ static int h4_open(void)
|
|||||||
hci_transport_h4->uart_fd = fd;
|
hci_transport_h4->uart_fd = fd;
|
||||||
|
|
||||||
hci_transport_h4->ds->fd = fd;
|
hci_transport_h4->ds->fd = fd;
|
||||||
hci_transport_h4->ds->process = h4_process;
|
btstack_run_loop_set_data_source_handler(hci_transport_h4, &h4_process);
|
||||||
btstack_run_loop_add_data_source(hci_transport_h4->ds);
|
btstack_run_loop_add_data_source(hci_transport_h4->ds);
|
||||||
|
|
||||||
// init state machine
|
// init state machine
|
||||||
|
@ -844,7 +844,7 @@ static int usb_open(void){
|
|||||||
for (r = 0 ; r < num_pollfds ; r++) {
|
for (r = 0 ; r < num_pollfds ; r++) {
|
||||||
btstack_data_source_t *ds = &pollfd_data_sources[r];
|
btstack_data_source_t *ds = &pollfd_data_sources[r];
|
||||||
ds->fd = pollfd[r]->fd;
|
ds->fd = pollfd[r]->fd;
|
||||||
ds->process = usb_process_ds;
|
btstack_run_loop_set_data_source_handler(ds, &usb_process_ds);
|
||||||
btstack_run_loop_add_data_source(ds);
|
btstack_run_loop_add_data_source(ds);
|
||||||
log_info("%u: %p fd: %u, events %x", r, pollfd[r], pollfd[r]->fd, pollfd[r]->events);
|
log_info("%u: %p fd: %u, events %x", r, pollfd[r], pollfd[r]->fd, pollfd[r]->events);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ static int h4_open(void){
|
|||||||
hci_transport_h4->ds = (btstack_data_source_t*) malloc(sizeof(btstack_data_source_t));
|
hci_transport_h4->ds = (btstack_data_source_t*) malloc(sizeof(btstack_data_source_t));
|
||||||
if (!hci_transport_h4->ds) return -1;
|
if (!hci_transport_h4->ds) return -1;
|
||||||
hci_transport_h4->ds->fd = fd;
|
hci_transport_h4->ds->fd = fd;
|
||||||
hci_transport_h4->ds->process = h4_process;
|
btstack_run_loop_set_data_source_handler(hci_transport_h4->ds, &h4_process);
|
||||||
btstack_run_loop_add_data_source(hci_transport_h4->ds);
|
btstack_run_loop_add_data_source(hci_transport_h4->ds);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user