hfp: rewrite parse sequence

This commit is contained in:
Milanka Ringwald 2015-08-14 15:01:30 +02:00
parent 8acae519b0
commit 211b60e2b1

View File

@ -605,16 +605,14 @@ void hfp_parse(hfp_connection_t * context, uint8_t byte){
case HFP_PARSER_CMD_SEQUENCE: // parse comma separated sequence, ignore breacktes
if (byte == '"'){ // indicators
context->parser_state = HFP_PARSER_CMD_INDICATOR_NAME;
context->line_size = 0;
break;
}
if (byte == '(' ){ // tuple separated mit comma
if (!hfp_parser_found_separator(context, byte)){
hfp_parser_store_byte(context, byte);
break;
}
if (byte == ',' || byte == '\n' || byte == '\r' || byte == ')'){
context->line_buffer[context->line_size] = 0;
if (hfp_parser_buffer_empty(context)) break;
switch (context->command){
case HFP_CMD_SUPPORTED_FEATURES:
@ -716,17 +714,14 @@ void hfp_parse(hfp_connection_t * context, uint8_t byte){
default:
break;
}
context->line_size = 0;
context->line_size = 0;
if (byte == '\n' || byte == '\r'){
context->parser_state = HFP_PARSER_CMD_HEADER;
context->parser_item_index = 0;
break;
}
break;
}
context->line_buffer[context->line_size++] = byte;
break;
case HFP_PARSER_SECOND_ITEM:
if (!hfp_parser_found_separator(context, byte)){