remove BTSTACK_EVENT_WORKING. Use BTSTACK_EVENT_STATE with state == HCI_STATE_WORKING instead

This commit is contained in:
matthias.ringwald 2009-09-30 20:29:30 +00:00
parent b48a17ffb3
commit b360b6ad92
6 changed files with 7 additions and 15 deletions

View File

@ -53,8 +53,7 @@ void data_handler(uint8_t *packet, uint16_t size){
void event_handler(uint8_t *packet, uint16_t size){
// bt stack activated, get started - set local name
if (packet[0] == BTSTACK_EVENT_WORKING ||
(packet[0] == BTSTACK_EVENT_STATE && packet[2] == HCI_STATE_WORKING)) {
if (packet[0] == BTSTACK_EVENT_STATE && packet[2] == HCI_STATE_WORKING) {
bt_send_cmd(&hci_write_local_name, NAME);
}
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_local_name) ) {

View File

@ -59,8 +59,7 @@ void event_handler(uint8_t *packet, uint16_t size){
}
// bt stack activated, get started - set local name
if (packet[0] == BTSTACK_EVENT_WORKING ||
(packet[0] == BTSTACK_EVENT_STATE && packet[2] == HCI_STATE_WORKING)) {
if (packet[0] == BTSTACK_EVENT_STATE && packet[2] == HCI_STATE_WORKING) {
bt_send_cmd(&hci_write_local_name, "BTstack-Test");
}

View File

@ -41,8 +41,7 @@ void event_handler(uint8_t *packet, uint16_t size){
}
// bt stack activated, get started - set local name
if (packet[0] == BTSTACK_EVENT_WORKING ||
(packet[0] == BTSTACK_EVENT_STATE && packet[2] == HCI_STATE_WORKING)) {
if (packet[0] == BTSTACK_EVENT_STATE && packet[2] == HCI_STATE_WORKING) {
bt_send_cmd(&hci_write_local_name, "BTstack-Test");
}

View File

@ -46,14 +46,13 @@
// events 0x50-0x5f are used internally
// events from BTstack for application/client lib
#define BTSTACK_EVENT_WORKING 0x60
#define BTSTACK_EVENT_STATE 0x61
#define BTSTACK_EVENT_STATE 0x60
// data: event(8), len(8), nr hci connections
#define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 0x62
#define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 0x61
// data: none
#define BTSTACK_EVENT_POWERON_FAILED 0x63
#define BTSTACK_EVENT_POWERON_FAILED 0x62
// data: event (8), len(8), address(48), handle (16), psm (16), source_cid(16), dest_cid (16)
#define L2CAP_EVENT_CHANNEL_OPENED 0x70

View File

@ -143,9 +143,6 @@ static int daemon_client_handler(connection_t *connection, uint16_t packet_type,
static void daemon_event_handler(uint8_t *packet, uint16_t size){
// handle state event
if (packet[0] == BTSTACK_EVENT_WORKING){
bluetooth_status_handler(BLUETOOTH_ON);
}
if (packet[0] == BTSTACK_EVENT_STATE){
if (packet[2] == HCI_STATE_WORKING) {
bluetooth_status_handler(BLUETOOTH_ON);

View File

@ -331,8 +331,7 @@ void hci_run(){
case 4:
// done.
hci_stack.state = HCI_STATE_WORKING;
micro_packet = BTSTACK_EVENT_WORKING;
hci_stack.event_packet_handler(&micro_packet, 1);
hci_emit_state();
break;
default:
break;