forward more events to app, fix race-condition for synchronous transport

This commit is contained in:
Matthias Ringwald 2015-11-12 23:09:54 +01:00
parent b72fa70e38
commit 8e852fa320

View File

@ -319,12 +319,15 @@ static void hsp_run(void){
}
if (hs_send_button_press){
hs_send_button_press = 0;
if (hsp_state == HSP_W4_USER_ACTION){
err = hsp_hs_send_str_over_rfcomm(rfcomm_cid, HSP_HS_AT_CKPD);
} else {
err = hsp_hs_send_str_over_rfcomm(rfcomm_cid, HSP_HS_BUTTON_PRESS);
}
if (!err) hs_send_button_press = 0;
if (err) {
hs_send_button_press = 1;
}
return;
}
@ -420,6 +423,7 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha
if (packet[2] == HCI_STATE_WORKING){
printf("BTstack activated, get started .\n");
}
hsp_hs_callback(packet, size);
break;
case HCI_EVENT_PIN_CODE_REQUEST:
@ -447,7 +451,6 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha
if (status != 0){
log_error("(e)SCO Connection is not established, status %u", status);
exit(0);
break;
}
switch (link_type){
@ -523,6 +526,7 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha
}
break;
case DAEMON_EVENT_HCI_PACKET_SENT:
case HCI_EVENT_NUMBER_OF_COMPLETED_PACKETS:
case RFCOMM_EVENT_CREDITS:
hsp_hs_callback(packet, size);
break;