daemon: remove unneccessary events

This commit is contained in:
Matthias Ringwald 2016-02-18 17:23:42 +01:00
parent 15a95bd5aa
commit e2334cdccc
3 changed files with 15 additions and 32 deletions

View File

@ -1347,9 +1347,6 @@ static int daemon_client_handler(connection_t *connection, uint16_t packet_type,
start_power_off_timer();
}
break;
case DAEMON_NR_CONNECTIONS_CHANGED:
log_info("Nr Connections changed, new %u\n",data[1]);
break;
default:
break;
}
@ -1605,14 +1602,7 @@ static void daemon_packet_handler(void * connection, uint8_t packet_type, uint16
default:
break;
}
case DAEMON_EVENT_PACKET:
switch (packet[0]){
case DAEMON_EVENT_NEW_RFCOMM_CREDITS:
daemon_retry_parked();
break;
default:
break;
}
break;
case L2CAP_DATA_PACKET:
connection = connection_for_l2cap_cid(channel);
if (!connection) return;

View File

@ -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);
}
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) {
connection_t *conn = (connection_t *) ds;
@ -220,7 +208,6 @@ int socket_connection_hci_process(struct btstack_data_source *ds) {
// free connection
socket_connection_free_connection(conn);
socket_connection_emit_nr_connections();
return 0;
}
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);
socket_connection_emit_connection_opened(connection);
socket_connection_emit_nr_connections();
return 0;
}

View File

@ -285,22 +285,29 @@ typedef uint8_t sm_key_t[16];
#define DAEMON_EVENT_VERSION 0x63
// data: system bluetooth on/off (bool)
/**
* @format 1
* param system_bluetooth_enabled
*/
#define DAEMON_EVENT_SYSTEM_BLUETOOTH_ENABLED 0x64
// 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
// data: event(8)
#define DAEMON_EVENT_CONNECTION_OPENED 0x68
// internal daemon events
// data: event(8)
#define DAEMON_EVENT_CONNECTION_CLOSED 0x69
// data: event(8), nr_connections(8)
#define DAEMON_NR_CONNECTIONS_CHANGED 0x6A
#define DAEMON_EVENT_CONNECTION_OPENED 0x67
// data: event(8)
#define DAEMON_EVENT_NEW_RFCOMM_CREDITS 0x6B
#define DAEMON_EVENT_CONNECTION_CLOSED 0x68
// additional HCI events