hfp: remove trailing newline/carriage return in custom command event

This commit is contained in:
Matthias Ringwald 2023-05-30 15:25:32 +02:00
parent c8149263fa
commit 8deec6605c
3 changed files with 8 additions and 5 deletions

View File

@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- AVRCP: re-register for notification
- HFP: fix setup/accept of synchronous connection
- HFP: use mandatory safe settings considering BR/EDR Secure Connections to accept synchronous connections
- HFP: remove trailing newline/carriage return in custom command event
- PBAP Client: make pbap_set_property_selector work for Pull Phonebook
- esp32: fix power amplifier control on Lyra T v4.3

View File

@ -1529,7 +1529,9 @@ static bool hfp_parse_byte(hfp_connection_t * hfp_connection, uint8_t byte, int
return true;
case HFP_PARSER_CUSTOM_COMMAND:
hfp_parser_store_byte(hfp_connection, byte);
if (hfp_parser_is_end_of_line(byte) == false){
hfp_parser_store_byte(hfp_connection, byte);
}
return true;
default:

View File

@ -608,7 +608,7 @@ TEST(HFPParser, custom_command_hf){
hfp_register_custom_hf_command(&custom_hf_command);
parse_hf(custom_hf_command_string);
CHECK_EQUAL(1, context.custom_at_command_id);
STRCMP_EQUAL("+FOO:1,2,3\r", (const char *)context.line_buffer);
STRCMP_EQUAL("+FOO:1,2,3", (const char *)context.line_buffer);
hfp_at_parser_test_dump_line_buffer();
}
@ -621,7 +621,7 @@ TEST(HFPParser, custom_command_ag_with_colon){
hfp_register_custom_ag_command(&custom_ag_command);
parse_ag(custom_hf_command_string);
CHECK_EQUAL(2, context.custom_at_command_id);
STRCMP_EQUAL("AT+FOO:1,2,3\r", (const char *)context.line_buffer);
STRCMP_EQUAL("AT+FOO:1,2,3", (const char *)context.line_buffer);
hfp_at_parser_test_dump_line_buffer();
}
@ -634,7 +634,7 @@ TEST(HFPParser, custom_command_ag_with_question){
hfp_register_custom_ag_command(&custom_ag_command);
parse_ag(custom_hf_command_string);
CHECK_EQUAL(3, context.custom_at_command_id);
STRCMP_EQUAL("AT+FOO?\r", (const char *)context.line_buffer);
STRCMP_EQUAL("AT+FOO?", (const char *)context.line_buffer);
hfp_at_parser_test_dump_line_buffer();
}
@ -647,7 +647,7 @@ TEST(HFPParser, custom_command_hf_with_assignment){
hfp_register_custom_ag_command(&custom_ag_command);
parse_ag(custom_hf_command_string);
CHECK_EQUAL(3, context.custom_at_command_id);
STRCMP_EQUAL("AT+TEST=ABCDE\r", (const char *)context.line_buffer);
STRCMP_EQUAL("AT+TEST=ABCDE", (const char *)context.line_buffer);
hfp_at_parser_test_dump_line_buffer();
}