diff options
author | Sathish Narasimman <sathish.narasimman@intel.com> | 2017-01-04 19:57:27 +0530 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2017-01-28 08:43:41 +0200 |
commit | 730b4f89d269b2a604aeb0d707964292b2e531aa (patch) | |
tree | fa54db5b10e33972b89ad539d54f6919d1a09fae | |
parent | 1806804ad83237b76e61d5123235c63b260e8086 (diff) |
Bluetooth: HFP HF: Handle +CIEV reponse
The +CIEV reponse received from the AG is handle and value is
updated to the application.
> ACL Data RX: Handle 256 flags 0x02 dlen 22 [hci0] 114.667753
Channel: 64 len 18 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x0b cr 1 dlci 0x02
Control: 0xef poll/final 0
Length: 14
FCS: 0x9a
0d 0a 2b 43 49 45 56 3a 20 32 2c 30 0d 0a 9a ..+CIEV: 2,0...
Change-Id: I771cdb422d201293d356151fa33ec485083b2356
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
-rw-r--r-- | subsys/bluetooth/host/hfp_hf.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/subsys/bluetooth/host/hfp_hf.c b/subsys/bluetooth/host/hfp_hf.c index 8da777bcd..2274de423 100644 --- a/subsys/bluetooth/host/hfp_hf.c +++ b/subsys/bluetooth/host/hfp_hf.c @@ -211,7 +211,7 @@ int cind_resp(struct at_client *hf_at, struct net_buf *buf) } void ag_indicator_handle_values(struct at_client *hf_at, uint32_t index, - uint32_t value) + uint32_t value) { struct bt_hfp_hf *hf = CONTAINER_OF(hf_at, struct bt_hfp_hf, at); struct bt_conn *conn = hf->rfcomm_dlc.session->br_chan.chan.conn; @@ -308,8 +308,40 @@ int cind_status_resp(struct at_client *hf_at, struct net_buf *buf) return 0; } +int ciev_handle(struct at_client *hf_at) +{ + uint32_t index, value; + int ret; + + ret = at_get_number(hf_at, &index); + if (ret < 0) { + BT_ERR("could not get the Index"); + return ret; + } + /* The first element of the list shall have 1 */ + if (!index) { + BT_ERR("Invalid index value '0'"); + return 0; + } + + ret = at_get_number(hf_at, &value); + if (ret < 0) { + BT_ERR("could not get the value"); + return ret; + } + + ag_indicator_handle_values(hf_at, (index - 1), value); + + return 0; +} + int unsolicited_cb(struct at_client *hf_at, struct net_buf *buf) { + if (!at_parse_cmd_input(hf_at, buf, "CIEV", ciev_handle, + AT_CMD_TYPE_UNSOLICITED)) { + return 0; + } + return -EINVAL; } |