mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-06 21:40:04 +00:00
hfp: handle multiple commands/responses in single rfcomm data packet
This commit is contained in:
parent
0cef86faed
commit
e0d09929fa
@ -1826,6 +1826,10 @@ static hfp_generic_status_indicator_t *get_hf_indicator_by_number(int number){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int hfp_parser_is_end_of_line(uint8_t byte){
|
||||
return byte == '\n' || byte == '\r';
|
||||
}
|
||||
|
||||
static void hfp_ag_handle_rfcomm_data(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type); // ok: only called with RFCOMM_DATA_PACKET
|
||||
|
||||
@ -1842,6 +1846,9 @@ static void hfp_ag_handle_rfcomm_data(uint8_t packet_type, uint16_t channel, uin
|
||||
for (pos = 0; pos < size ; pos++){
|
||||
hfp_parse(hfp_connection, packet[pos], 0);
|
||||
|
||||
// parse until end of line
|
||||
if (!hfp_parser_is_end_of_line(packet[pos])) continue;
|
||||
|
||||
int value;
|
||||
hfp_generic_status_indicator_t * indicator;
|
||||
switch(hfp_connection->command){
|
||||
|
@ -983,6 +983,10 @@ static void hfp_hf_switch_on_ok(hfp_connection_t *hfp_connection){
|
||||
hfp_connection->command = HFP_CMD_NONE;
|
||||
}
|
||||
|
||||
static int hfp_parser_is_end_of_line(uint8_t byte){
|
||||
return byte == '\n' || byte == '\r';
|
||||
}
|
||||
|
||||
static void hfp_hf_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(packet_type); // ok: only called with RFCOMM_DATA_PACKET
|
||||
|
||||
@ -999,6 +1003,9 @@ static void hfp_hf_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, ui
|
||||
for (pos = 0; pos < size ; pos++){
|
||||
hfp_parse(hfp_connection, packet[pos], 1);
|
||||
|
||||
// parse until end of line
|
||||
if (!hfp_parser_is_end_of_line(packet[pos])) continue;
|
||||
|
||||
int value;
|
||||
int i;
|
||||
switch (hfp_connection->command){
|
||||
|
Loading…
x
Reference in New Issue
Block a user