mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-16 08:42:28 +00:00
daemon: remove unneccessary events
This commit is contained in:
parent
15a95bd5aa
commit
e2334cdccc
@ -1347,9 +1347,6 @@ static int daemon_client_handler(connection_t *connection, uint16_t packet_type,
|
|||||||
start_power_off_timer();
|
start_power_off_timer();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DAEMON_NR_CONNECTIONS_CHANGED:
|
|
||||||
log_info("Nr Connections changed, new %u\n",data[1]);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1605,14 +1602,7 @@ static void daemon_packet_handler(void * connection, uint8_t packet_type, uint16
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DAEMON_EVENT_PACKET:
|
break;
|
||||||
switch (packet[0]){
|
|
||||||
case DAEMON_EVENT_NEW_RFCOMM_CREDITS:
|
|
||||||
daemon_retry_parked();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case L2CAP_DATA_PACKET:
|
case L2CAP_DATA_PACKET:
|
||||||
connection = connection_for_l2cap_cid(channel);
|
connection = connection_for_l2cap_cid(channel);
|
||||||
if (!connection) return;
|
if (!connection) return;
|
||||||
|
@ -197,18 +197,6 @@ void static socket_connection_emit_connection_closed(connection_t *connection){
|
|||||||
(*socket_connection_packet_callback)(connection, DAEMON_EVENT_PACKET, 0, (uint8_t *) &event, 1);
|
(*socket_connection_packet_callback)(connection, DAEMON_EVENT_PACKET, 0, (uint8_t *) &event, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void static socket_connection_emit_nr_connections(void){
|
|
||||||
btstack_linked_item_t *it;
|
|
||||||
uint8_t nr_connections = 0;
|
|
||||||
for (it = (btstack_linked_item_t *) connections; it != NULL ; it = it->next, nr_connections++);
|
|
||||||
|
|
||||||
uint8_t event[2];
|
|
||||||
event[0] = DAEMON_NR_CONNECTIONS_CHANGED;
|
|
||||||
event[1] = nr_connections;
|
|
||||||
(*socket_connection_packet_callback)(NULL, DAEMON_EVENT_PACKET, 0, (uint8_t *) &event, 2);
|
|
||||||
// log_info("Nr connections changed,.. new %u", nr_connections);
|
|
||||||
}
|
|
||||||
|
|
||||||
int socket_connection_hci_process(struct btstack_data_source *ds) {
|
int socket_connection_hci_process(struct btstack_data_source *ds) {
|
||||||
connection_t *conn = (connection_t *) ds;
|
connection_t *conn = (connection_t *) ds;
|
||||||
|
|
||||||
@ -220,7 +208,6 @@ int socket_connection_hci_process(struct btstack_data_source *ds) {
|
|||||||
// free connection
|
// free connection
|
||||||
socket_connection_free_connection(conn);
|
socket_connection_free_connection(conn);
|
||||||
|
|
||||||
socket_connection_emit_nr_connections();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
conn->bytes_read += bytes_read;
|
conn->bytes_read += bytes_read;
|
||||||
@ -313,7 +300,6 @@ static int socket_connection_accept(struct btstack_data_source *socket_ds) {
|
|||||||
|
|
||||||
connection_t * connection = socket_connection_register_new_connection(fd);
|
connection_t * connection = socket_connection_register_new_connection(fd);
|
||||||
socket_connection_emit_connection_opened(connection);
|
socket_connection_emit_connection_opened(connection);
|
||||||
socket_connection_emit_nr_connections();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -285,22 +285,29 @@ typedef uint8_t sm_key_t[16];
|
|||||||
#define DAEMON_EVENT_VERSION 0x63
|
#define DAEMON_EVENT_VERSION 0x63
|
||||||
|
|
||||||
// data: system bluetooth on/off (bool)
|
// data: system bluetooth on/off (bool)
|
||||||
|
/**
|
||||||
|
* @format 1
|
||||||
|
* param system_bluetooth_enabled
|
||||||
|
*/
|
||||||
#define DAEMON_EVENT_SYSTEM_BLUETOOTH_ENABLED 0x64
|
#define DAEMON_EVENT_SYSTEM_BLUETOOTH_ENABLED 0x64
|
||||||
|
|
||||||
// data: event (8), len(8), status (8) == 0, address (48), name (1984 bits = 248 bytes)
|
// data: event (8), len(8), status (8) == 0, address (48), name (1984 bits = 248 bytes)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @format 1BT
|
||||||
|
* @param status == 0 to match read_remote_name_request
|
||||||
|
* @param address
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
#define DAEMON_EVENT_REMOTE_NAME_CACHED 0x65
|
#define DAEMON_EVENT_REMOTE_NAME_CACHED 0x65
|
||||||
|
|
||||||
// data: event(8)
|
// internal daemon events
|
||||||
#define DAEMON_EVENT_CONNECTION_OPENED 0x68
|
|
||||||
|
|
||||||
// data: event(8)
|
// data: event(8)
|
||||||
#define DAEMON_EVENT_CONNECTION_CLOSED 0x69
|
#define DAEMON_EVENT_CONNECTION_OPENED 0x67
|
||||||
|
|
||||||
// data: event(8), nr_connections(8)
|
|
||||||
#define DAEMON_NR_CONNECTIONS_CHANGED 0x6A
|
|
||||||
|
|
||||||
// data: event(8)
|
// data: event(8)
|
||||||
#define DAEMON_EVENT_NEW_RFCOMM_CREDITS 0x6B
|
#define DAEMON_EVENT_CONNECTION_CLOSED 0x68
|
||||||
|
|
||||||
|
|
||||||
// additional HCI events
|
// additional HCI events
|
||||||
|
Loading…
x
Reference in New Issue
Block a user