mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-17 02:42:33 +00:00
runloop: replace struct btstack_data_source with btstack_data_source_t
This commit is contained in:
parent
3a5c43eebf
commit
c4ae7169b8
@ -268,7 +268,7 @@ static int tap_alloc(char *dev, bd_addr_t bd_addr)
|
||||
*/
|
||||
|
||||
/* LISTING_START(processTapData): Process incoming network packets */
|
||||
static int process_tap_dev_data(struct btstack_data_source *ds)
|
||||
static int process_tap_dev_data(btstack_data_source_t *ds)
|
||||
{
|
||||
ssize_t len;
|
||||
len = read(ds->fd, network_buffer, sizeof(network_buffer));
|
||||
|
@ -92,7 +92,7 @@ struct sockaddr_un {
|
||||
#define MAX_PENDING_CONNECTIONS 10
|
||||
|
||||
/** prototypes */
|
||||
static int socket_connection_hci_process(struct btstack_data_source *ds);
|
||||
static int socket_connection_hci_process(btstack_data_source_t *ds);
|
||||
static int socket_connection_dummy_handler(connection_t *connection, uint16_t packet_type, uint16_t channel, uint8_t *data, uint16_t length);
|
||||
|
||||
/** globals */
|
||||
@ -197,7 +197,7 @@ void static socket_connection_emit_connection_closed(connection_t *connection){
|
||||
(*socket_connection_packet_callback)(connection, DAEMON_EVENT_PACKET, 0, (uint8_t *) &event, 1);
|
||||
}
|
||||
|
||||
int socket_connection_hci_process(struct btstack_data_source *ds) {
|
||||
int socket_connection_hci_process(btstack_data_source_t *ds) {
|
||||
connection_t *conn = (connection_t *) ds;
|
||||
int fd = btstack_run_loop_get_data_source_fd(ds);
|
||||
int bytes_read = read(fd, &conn->buffer[conn->bytes_read], conn->bytes_to_read);
|
||||
@ -282,7 +282,7 @@ int socket_connection_has_parked_connections(void){
|
||||
return parked != NULL;
|
||||
}
|
||||
|
||||
static int socket_connection_accept(struct btstack_data_source *socket_ds) {
|
||||
static int socket_connection_accept(btstack_data_source_t *socket_ds) {
|
||||
struct sockaddr_storage ss;
|
||||
socklen_t slen = sizeof(ss);
|
||||
int socket_fd = btstack_run_loop_get_data_source_fd(ds);
|
||||
|
@ -102,7 +102,7 @@ typedef struct hci_transport_h4 {
|
||||
} hci_transport_h4_t;
|
||||
|
||||
// prototypes
|
||||
static int h4_process(struct btstack_data_source *ds);
|
||||
static int h4_process(btstack_data_source_t *ds);
|
||||
static void dummy_handler(uint8_t packet_type, uint8_t *packet, uint16_t size);
|
||||
static void h4_block_received(void);
|
||||
static void h4_block_sent(void);
|
||||
@ -387,7 +387,7 @@ static void h4_block_sent(void){
|
||||
}
|
||||
}
|
||||
|
||||
static int h4_process(struct btstack_data_source *ds) {
|
||||
static int h4_process(btstack_data_source_t *ds) {
|
||||
|
||||
// reset tx state before emitting packet sent event
|
||||
// to allow for positive can_send_now
|
||||
|
@ -83,7 +83,7 @@ typedef struct hci_transport_h4 {
|
||||
} hci_transport_h4_t;
|
||||
|
||||
// prototypes
|
||||
static int h4_process(struct btstack_data_source *ds);
|
||||
static int h4_process(btstack_data_source_t *ds);
|
||||
static void dummy_handler(uint8_t packet_type, uint8_t *packet, uint16_t size);
|
||||
static void h4_block_received(void);
|
||||
static void h4_block_sent(void);
|
||||
@ -243,7 +243,7 @@ static void h4_register_packet_handler(void (*handler)(uint8_t packet_type, uint
|
||||
packet_handler = handler;
|
||||
}
|
||||
|
||||
static int h4_process(struct btstack_data_source *ds) {
|
||||
static int h4_process(btstack_data_source_t *ds) {
|
||||
|
||||
// notify about packet sent
|
||||
if (tx_state == TX_DONE){
|
||||
|
@ -65,7 +65,7 @@
|
||||
#error HCI_OUTGOING_PRE_BUFFER_SIZE not defined. Please update hci.h
|
||||
#endif
|
||||
|
||||
static int h4_process(struct btstack_data_source *ds);
|
||||
static int h4_process(btstack_data_source_t *ds);
|
||||
static void dummy_handler(uint8_t packet_type, uint8_t *packet, uint16_t size);
|
||||
|
||||
typedef enum {
|
||||
@ -342,7 +342,7 @@ static void h4_statemachine(void){
|
||||
}
|
||||
}
|
||||
|
||||
static int h4_process(struct btstack_data_source *ds) {
|
||||
static int h4_process(btstack_data_source_t *ds) {
|
||||
if (hci_transport_h4->uart_fd == 0) return -1;
|
||||
|
||||
int read_now = bytes_to_read;
|
||||
|
@ -125,7 +125,7 @@ static void (*packet_handler)(uint8_t packet_type, uint8_t *packet, uint16_t si
|
||||
|
||||
|
||||
// Prototypes
|
||||
static int hci_transport_h5_process(struct btstack_data_source *ds);
|
||||
static int hci_transport_h5_process(btstack_data_source_t *ds);
|
||||
static void hci_transport_link_set_timer(uint16_t timeout_ms);
|
||||
static void hci_transport_link_timeout_handler(btstack_timer_source_t * timer);
|
||||
static int hci_transport_h5_outgoing_packet(void);
|
||||
@ -652,7 +652,7 @@ static int hci_transport_h5_close(void){
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hci_transport_h5_process(struct btstack_data_source *ds) {
|
||||
static int hci_transport_h5_process(btstack_data_source_t *ds) {
|
||||
if (hci_transport_h5_data_source.fd < 0) return -1;
|
||||
|
||||
// process data byte by byte
|
||||
|
@ -83,7 +83,7 @@
|
||||
#include "hci.h"
|
||||
#include "hci_transport.h"
|
||||
|
||||
static int h4_process(struct btstack_data_source *ds);
|
||||
static int h4_process(btstack_data_source_t *ds);
|
||||
static void dummy_handler(uint8_t packet_type, uint8_t *packet, uint16_t size);
|
||||
static hci_transport_config_uart_t *hci_transport_config_uart;
|
||||
|
||||
@ -336,7 +336,7 @@ static void h4_statemachine(void){
|
||||
}
|
||||
}
|
||||
|
||||
static int h4_process(struct btstack_data_source *ds) {
|
||||
static int h4_process(btstack_data_source_t *ds) {
|
||||
if (hci_transport_h4->uart_fd == 0) return -1;
|
||||
|
||||
int read_now = bytes_to_read;
|
||||
|
@ -400,7 +400,7 @@ static void handle_completed_transfer(struct libusb_transfer *transfer){
|
||||
}
|
||||
}
|
||||
|
||||
static int usb_process_ds(struct btstack_data_source *ds) {
|
||||
static int usb_process_ds(btstack_data_source_t *ds) {
|
||||
if (libusb_state != LIB_USB_TRANSFERS_ALLOCATED) return -1;
|
||||
|
||||
// log_info("begin usb_process_ds");
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include "hci.h"
|
||||
#include "hci_transport.h"
|
||||
|
||||
static int h4_process(struct btstack_data_source *ds);
|
||||
static int h4_process(btstack_data_source_t *ds);
|
||||
static void dummy_handler(uint8_t packet_type, uint8_t *packet, uint16_t size);
|
||||
|
||||
typedef struct hci_transport_h4 {
|
||||
@ -122,7 +122,7 @@ static void h4_register_packet_handler(void (*handler)(uint8_t packet_type, ui
|
||||
packet_handler = handler;
|
||||
}
|
||||
|
||||
static int h4_process(struct btstack_data_source *ds) {
|
||||
static int h4_process(btstack_data_source_t *ds) {
|
||||
if (hci_transport_h4->ds->fd == 0) return -1;
|
||||
|
||||
// read up to bytes_to_read data in
|
||||
|
@ -1598,7 +1598,7 @@ static void ui_process_command(char buffer){
|
||||
}
|
||||
}
|
||||
|
||||
static int stdin_process(struct btstack_data_source *ds){
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
|
||||
|
@ -711,7 +711,7 @@ static void update_auth_req(void){
|
||||
sm_set_authentication_requirements(auth_req);
|
||||
}
|
||||
|
||||
static int stdin_process(struct btstack_data_source *ds){
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
|
||||
|
@ -595,7 +595,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(struct btstack_data_source *ds){
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
|
||||
|
@ -473,7 +473,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(struct btstack_data_source *ds){
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
|
||||
|
@ -339,7 +339,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(struct btstack_data_source *ds){
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
read(ds->fd, &cmd, 1);
|
||||
switch (cmd){
|
||||
case 'a':
|
||||
|
@ -173,7 +173,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(struct btstack_data_source *ds){
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
read(ds->fd, &cmd, 1);
|
||||
|
||||
if (cmd >= '0' && cmd <= '9'){
|
||||
|
@ -94,7 +94,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(struct btstack_data_source *ds){
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
|
||||
|
@ -109,7 +109,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(struct btstack_data_source *ds){
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
|
||||
|
@ -65,7 +65,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(struct btstack_data_source *ds){
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
switch (buffer){
|
||||
|
@ -120,7 +120,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
static int stdin_process(struct btstack_data_source *ds){
|
||||
static int stdin_process(btstack_data_source_t *ds){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
switch (buffer){
|
||||
|
Loading…
x
Reference in New Issue
Block a user