diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2014-06-27 18:16:08 +0300 |
---|---|---|
committer | Szymon Janc <szymon.janc@tieto.com> | 2014-06-29 14:17:19 +0200 |
commit | da667c204bff4bca133e51decf59daeb43a1043d (patch) | |
tree | 3d596367a121b92ebfbf804269c07498dc0daf23 /android/health.c | |
parent | 6dafdbdf54c261ae80ba3ac76f9d488985d7a101 (diff) | |
download | bluez-da667c204bff4bca133e51decf59daeb43a1043d.tar.gz |
android/health: Create mdep for ECHO channel
Diffstat (limited to 'android/health.c')
-rw-r--r-- | android/health.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/android/health.c b/android/health.c index 378650433..2d968ce10 100644 --- a/android/health.c +++ b/android/health.c @@ -1157,7 +1157,6 @@ static struct health_channel *create_channel(struct health_app *app, { struct mdep_cfg *mdep; struct health_channel *channel; - uint8_t index; static unsigned int channel_id = 1; DBG("mdep %u", mdep_index); @@ -1165,10 +1164,23 @@ static struct health_channel *create_channel(struct health_app *app, if (!dev || !app) return NULL; - index = mdep_index + 1; - mdep = queue_find(app->mdeps, match_mdep_by_id, INT_TO_PTR(index)); - if (!mdep) - return NULL; + mdep = queue_find(app->mdeps, match_mdep_by_id, INT_TO_PTR(mdep_index)); + if (!mdep) { + if (mdep_index == MDEP_ECHO) { + mdep = new0(struct mdep_cfg, 1); + if (!mdep) + return NULL; + + /* Leave other configuration zeroes */ + mdep->id = MDEP_ECHO; + + if (!queue_push_tail(app->mdeps, mdep)) { + free_mdep_cfg(mdep); + return NULL; + } + } else + return NULL; + } /* create channel and push it to device */ channel = new0(struct health_channel, 1); |