From: Szymon Janc <szymon.janc@tieto.com>
To: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/2] android/health: Add handling incoming connection
Date: Mon, 30 Jun 2014 11:35:08 +0200 [thread overview]
Message-ID: <2253548.JBL4HLj2DM@uw000953> (raw)
In-Reply-To: <1404116096-21971-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Monday 30 of June 2014 11:14:55 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Add support for normal data channel creation. Also add search helper for
> searching apps for suitable mdepid.
> ---
> android/health.c | 56 +++++++++++++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 45 insertions(+), 11 deletions(-)
>
> diff --git a/android/health.c b/android/health.c
> index 709e621..83ae107 100644
> --- a/android/health.c
> +++ b/android/health.c
> @@ -329,6 +329,38 @@ static struct health_channel *search_channel_by_id(uint16_t id)
> return search.channel;
> }
>
> +struct app_search {
> + uint8_t mdepid;
> + struct health_app *app;
> +};
> +
> +static void app_search_mdep(void *data, void *user_data)
> +{
> + struct health_app *app = data;
> + struct app_search *search = user_data;
> +
> + if (search->app)
> + return;
> +
> + if (queue_find(app->mdeps, match_mdep_by_id,
> + INT_TO_PTR(search->mdepid)))
> + search->app = app;
> +}
> +
> +static struct health_app *search_app_by_mdepid(uint8_t mdepid)
> +{
> + struct app_search search;
> +
> + DBG("");
> +
> + search.mdepid = mdepid;
> + search.app = NULL;
> +
> + queue_foreach(apps, app_search_mdep, &search);
> +
> + return search.app;
> +}
> +
> static int register_service_protocols(sdp_record_t *rec,
> struct health_app *app)
> {
> @@ -1281,22 +1313,24 @@ static struct health_channel *connect_channel(struct mcap_mcl *mcl,
>
> mcap_mcl_get_addr(mcl, &addr);
>
> - /* TODO: Search app for mdepid */
> -
> - if (mdepid == MDEP_ECHO) {
> + if (mdepid == MDEP_ECHO)
> /* For echo service take last app */
> app = queue_peek_tail(apps);
> - if (!app)
> - return NULL;
> -
> - device = get_device(app, (uint8_t *) &addr);
> - if (!device)
> - return NULL;
> + else
> + app = search_app_by_mdepid(mdepid);
>
> - channel = create_channel(app, mdepid, device);
> + if (!app) {
> + DBG("No app found for mdepid %u", mdepid);
> + return NULL;
> }
>
> - /* Device is created here */
> + device = get_device(app, (uint8_t *) &addr);
> + if (!device)
> + return NULL;
> +
> + channel = create_channel(app, mdepid, device);
> +
> + /* Channel is assigned here after creation */
> mcl->cb->user_data = channel;
>
> return channel;
>
Patch 1/2 applied, thanks.
--
Best regards,
Szymon Janc
prev parent reply other threads:[~2014-06-30 9:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-30 8:14 [PATCH 1/2] android/health: Add handling incoming connection Andrei Emeltchenko
2014-06-30 8:14 ` [PATCH 2/2] android/health: Set L2CAP mode for MCAP channels Andrei Emeltchenko
2014-06-30 9:35 ` Szymon Janc [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2253548.JBL4HLj2DM@uw000953 \
--to=szymon.janc@tieto.com \
--cc=Andrei.Emeltchenko.news@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox