summaryrefslogtreecommitdiff
path: root/android/handsfree.c
diff options
context:
space:
mode:
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>2014-11-13 16:52:50 +0100
committerSzymon Janc <szymon.janc@tieto.com>2014-11-13 18:22:43 +0100
commitecab9f08bba46f05a0cfde4778339c51f3b30edf (patch)
treed7cb2e14b9be37107fa8d1251ed856830a221461 /android/handsfree.c
parenta0a577041cb9f7ff267fa987e5bdd98d49f246a3 (diff)
downloadbluez-ecab9f08bba46f05a0cfde4778339c51f3b30edf.tar.gz
android/handsfree: Send indicator notif to all connected devices
Diffstat (limited to 'android/handsfree.c')
-rw-r--r--android/handsfree.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/android/handsfree.c b/android/handsfree.c
index 9a2fdd0f4..0001eb62f 100644
--- a/android/handsfree.c
+++ b/android/handsfree.c
@@ -2038,24 +2038,31 @@ static void update_indicator(struct hf_device *dev, int ind, uint8_t val)
hfp_gw_send_info(dev->gw, "+CIEV: %u,%u", ind + 1, val);
}
+static void device_status_notif(void *data, void *user_data)
+{
+ struct hf_device *dev = data;
+ struct hal_cmd_handsfree_device_status_notif *cmd = user_data;
+
+ update_indicator(dev, IND_SERVICE, cmd->state);
+ update_indicator(dev, IND_ROAM, cmd->type);
+ update_indicator(dev, IND_SIGNAL, cmd->signal);
+ update_indicator(dev, IND_BATTCHG, cmd->battery);
+}
+
static void handle_device_status_notif(const void *buf, uint16_t len)
{
const struct hal_cmd_handsfree_device_status_notif *cmd = buf;
- struct hf_device *dev;
uint8_t status;
DBG("");
- dev = find_default_device();
- if (!dev) {
+ if (queue_isempty(devices)) {
status = HAL_STATUS_FAILED;
goto done;
}
- update_indicator(dev, IND_SERVICE, cmd->state);
- update_indicator(dev, IND_ROAM, cmd->type);
- update_indicator(dev, IND_SIGNAL, cmd->signal);
- update_indicator(dev, IND_BATTCHG, cmd->battery);
+ /* Cast cmd to void as queue api needs that */
+ queue_foreach(devices, device_status_notif, (void *) cmd);
status = HAL_STATUS_SUCCESS;