bluez5: backend-native: Add AT+CLCC support

This allows the HFP HF to retrieve the list of calls with their index,
state and remote number (if available).

This commit shared the list of calls between modemmanager.c and
backend-native.c, and switches call state storage from ModemManager
states to CLCC states
This commit is contained in:
Frédéric Danis 2022-09-23 16:26:07 +02:00 committed by Wim Taymans
parent 55075915ec
commit 20572a1789
3 changed files with 117 additions and 28 deletions

View file

@ -946,6 +946,28 @@ next_indicator:
str++;
}
rfcomm_send_reply(rfcomm, "OK");
} else if (spa_strstartswith(buf, "AT+CLCC")) {
struct spa_list *calls;
struct call *call;
unsigned int type;
if (backend->modemmanager) {
calls = mm_get_calls(backend->modemmanager);
spa_list_for_each(call, calls, link) {
if (!call->number) {
rfcomm_send_reply(rfcomm, "+CLCC: %u,%u,%u,0,%u", call->index, call->direction, call->state, call->multiparty);
} else {
if (spa_strstartswith(call->number, "+"))
type = INTERNATIONAL_NUMBER;
else
type = NATIONAL_NUMBER;
rfcomm_send_reply(rfcomm, "+CLCC: %u,%u,%u,0,%u,\"%s\",%d", call->index, call->direction, call->state,
call->multiparty, call->number, type);
}
}
}
rfcomm_send_reply(rfcomm, "OK");
} else if (sscanf(buf, "AT+CLIP=%u", &value) == 1) {
if (value > 1) {