summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2014-03-11 16:11:29 +0100
committerSzymon Janc <szymon.janc@tieto.com>2014-03-11 16:27:50 +0100
commitd5419070cfcf74e32b2b10bcff0b90196d7bee86 (patch)
tree5d1e9cf6ec55606cd300a644bc747be119b67b9d
parente76cdcc8eec27cb91af9e39a15acfb4de9e0cd07 (diff)
downloadbluez-d5419070cfcf74e32b2b10bcff0b90196d7bee86.tar.gz
android/handsfree: Fix sending +CLCC
Phone number can be present for all call states in CLCC response. Also phone number should be quoted string.
-rw-r--r--android/handsfree.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/android/handsfree.c b/android/handsfree.c
index 28d5dde6f..b71c28e3b 100644
--- a/android/handsfree.c
+++ b/android/handsfree.c
@@ -1708,6 +1708,7 @@ static void handle_clcc_resp(const void *buf, uint16_t len)
{
const struct hal_cmd_handsfree_clcc_response *cmd = buf;
uint8_t status;
+ char *number;
if (len != sizeof(*cmd) + cmd->number_len || (cmd->number_len != 0 &&
cmd->number[cmd->number_len - 1] != '\0')) {
@@ -1725,30 +1726,28 @@ static void handle_clcc_resp(const void *buf, uint16_t len)
goto done;
}
+ number = cmd->number_len ? (char *) cmd->number : "";
+
switch (cmd->state) {
- /* according to comment in HAL only those can have number and type */
case HAL_HANDSFREE_CALL_STATE_INCOMING:
case HAL_HANDSFREE_CALL_STATE_WAITING:
- if (cmd->number_len) {
- hfp_gw_send_info(device.gw,
- "+CLCC: %u,%u,%u,%u,%u,%s,%u",
- cmd->index, cmd->dir,
- cmd->state, cmd->mode,
- cmd->mpty, cmd->number,
- cmd->type);
-
- status = HAL_STATUS_SUCCESS;
- break;
- }
-
- /* fall through */
case HAL_HANDSFREE_CALL_STATE_ACTIVE:
case HAL_HANDSFREE_CALL_STATE_HELD:
case HAL_HANDSFREE_CALL_STATE_DIALING:
case HAL_HANDSFREE_CALL_STATE_ALERTING:
- hfp_gw_send_info(device.gw, "+CLCC: %u,%u,%u,%u,%u",
+ if (cmd->type == HAL_HANDSFREE_CALL_ADDRTYPE_INTERNATIONAL &&
+ number[0] != '+')
+ hfp_gw_send_info(device.gw,
+ "+CLCC: %u,%u,%u,%u,%u,\"+%s\",%u",
+ cmd->index, cmd->dir, cmd->state,
+ cmd->mode, cmd->mpty, number,
+ cmd->type);
+ else
+ hfp_gw_send_info(device.gw,
+ "+CLCC: %u,%u,%u,%u,%u,\"%s\",%u",
cmd->index, cmd->dir, cmd->state,
- cmd->mode, cmd->mpty);
+ cmd->mode, cmd->mpty, number,
+ cmd->type);
status = HAL_STATUS_SUCCESS;
break;