diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index 42e4c6b..2a09658 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
context->offset++;
}
-static bool call_prefix_handler(struct hfp_gw *hfp, const char *data)
+static void handle_unknown_at_command(struct hfp_gw *hfp,
+ const char *data)
+{
+ if (hfp->command_callback) {
+ hfp->command_callback(data, hfp->command_data);
+ hfp->result_pending = true;
+ } else {
+ hfp_gw_send_result(hfp, HFP_RESULT_ERROR);
+ }
+}
+
+static bool handle_at_command(struct hfp_gw *hfp, const char *data)
{
struct cmd_handler *handler;
const char *separators = ";?=\0";
handler = queue_find(hfp->cmd_handlers, match_handler_prefix,
lookup_prefix);
- if (!handler)
- return false;
+ if (!handler) {
+ handle_unknown_at_command(hfp, data);
+ return true;
+ }
handler->callback(&context, type, handler->user_data);
*ptr = '\0';
}
- if (!call_prefix_handler(hfp, str)) {
- if (hfp->command_callback) {
- hfp->command_callback(str, hfp->command_data);
- hfp->result_pending = true;
- } else {
- hfp_gw_send_result(hfp, HFP_RESULT_ERROR);
- }
- }
+ handle_at_command(hfp, str);
len = ringbuf_drain(hfp->read_buf, count + 1);