Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Cc: linux-bluetooth@vger.kernel.org, luiz.dentz@gmail.com
Subject: Re: [PATCH v2 03/16] android/hf-client: Add hf-client daemon skeleton
Date: Thu, 11 Sep 2014 13:45:47 +0200	[thread overview]
Message-ID: <9866556.BU1bIVAFtI@uw000953> (raw)
In-Reply-To: <1410348854-26249-4-git-send-email-lukasz.rymanowski@tieto.com>

Hi Łukasz,

On Wednesday 10 of September 2014 13:34:01 Lukasz Rymanowski wrote:
> ---
>  android/Makefile.am |  1 +
>  android/hf-client.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  android/hf-client.h | 25 +++++++++++++++++++
>  android/main.c      |  9 +++++++
>  4 files changed, 104 insertions(+)
>  create mode 100644 android/hf-client.c
>  create mode 100644 android/hf-client.h
> 
> diff --git a/android/Makefile.am b/android/Makefile.am
> index 49fbddc..e92ccf1 100644
> --- a/android/Makefile.am
> +++ b/android/Makefile.am
> @@ -52,6 +52,7 @@ android_bluetoothd_SOURCES = android/main.c \
>  				android/socket.h android/socket.c \
>  				android/pan.h android/pan.c \
>  				android/handsfree.h android/handsfree.c \
> +				android/hf-client.c android/hf-client.h \

Should be named handsfree-client.{ch}.

>  				android/gatt.h android/gatt.c \
>  				android/health.h android/health.c \
>  				android/mcap-lib.h android/mcap-lib.c \
> diff --git a/android/hf-client.c b/android/hf-client.c
> new file mode 100644
> index 0000000..f1566d0
> --- /dev/null
> +++ b/android/hf-client.c
> @@ -0,0 +1,69 @@
> +/*
> + *
> + *  BlueZ - Bluetooth protocol stack for Linux
> + *
> + *  Copyright (C) 2014  Intel Corporation. All rights reserved.
> + *
> + *
> + *  This library is free software; you can redistribute it and/or
> + *  modify it under the terms of the GNU Lesser General Public
> + *  License as published by the Free Software Foundation; either
> + *  version 2.1 of the License, or (at your option) any later version.
> + *
> + *  This library is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + *  Lesser General Public License for more details.
> + *
> + *  You should have received a copy of the GNU Lesser General Public
> + *  License along with this library; if not, write to the Free Software
> + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> + *
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
> +#include <stdlib.h>
> +#include <stdbool.h>
> +#include <errno.h>
> +#include <unistd.h>
> +#include <glib.h>
> +
> +#include "lib/bluetooth.h"
> +#include "ipc.h"
> +#include "ipc-common.h"
> +#include "src/log.h"
> +#include "utils.h"
> +
> +#include "hal-msg.h"
> +#include "hf-client.h"
> +
> +static bdaddr_t adapter_addr;
> +
> +static struct ipc *hal_ipc = NULL;
> +
> +static const struct ipc_handler cmd_handlers[] = {
> +};
> +
> +bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
> +{
> +	DBG("");
> +
> +	bacpy(&adapter_addr, addr);
> +
> +	hal_ipc = ipc;
> +	ipc_register(hal_ipc, HAL_SERVICE_ID_HF_CLIENT, cmd_handlers,
> +						G_N_ELEMENTS(cmd_handlers));
> +
> +	return true;
> +}
> +
> +void bt_hf_client_unregister(void)
> +{
> +	DBG("");
> +
> +	ipc_unregister(hal_ipc, HAL_SERVICE_ID_HANDSFREE);
> +	hal_ipc = NULL;
> +}
> diff --git a/android/hf-client.h b/android/hf-client.h
> new file mode 100644
> index 0000000..1eb69ff
> --- /dev/null
> +++ b/android/hf-client.h
> @@ -0,0 +1,25 @@
> +/*
> + *
> + *  BlueZ - Bluetooth protocol stack for Linux
> + *
> + *  Copyright (C) 2014  Intel Corporation. All rights reserved.
> + *
> + *
> + *  This library is free software; you can redistribute it and/or
> + *  modify it under the terms of the GNU Lesser General Public
> + *  License as published by the Free Software Foundation; either
> + *  version 2.1 of the License, or (at your option) any later version.
> + *
> + *  This library is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + *  Lesser General Public License for more details.
> + *
> + *  You should have received a copy of the GNU Lesser General Public
> + *  License along with this library; if not, write to the Free Software
> + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> + *
> + */
> +
> +bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr);
> +void bt_hf_client_unregister(void);
> diff --git a/android/main.c b/android/main.c
> index b03a2df..49257d4 100644
> --- a/android/main.c
> +++ b/android/main.c
> @@ -60,6 +60,7 @@
>  #include "handsfree.h"
>  #include "gatt.h"
>  #include "health.h"
> +#include "hf-client.h"
>  
>  #define STARTUP_GRACE_SECONDS 5
>  #define SHUTDOWN_GRACE_SECONDS 10
> @@ -145,6 +146,14 @@ static void service_register(const void *buf, uint16_t len)
>  		}
>  
>  		break;
> +	case HAL_SERVICE_ID_HF_CLIENT:
> +		if (!bt_hf_client_register(hal_ipc, &adapter_bdaddr)) {
> +			status = HAL_STATUS_FAILED;
> +			goto failed;
> +		}
> +
> +		break;
> +
>  	default:
>  		DBG("service %u not supported", m->service_id);
>  		status = HAL_STATUS_FAILED;
> 

-- 
Best regards, 
Szymon Janc

  reply	other threads:[~2014-09-11 11:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
2014-09-10 11:33 ` [PATCH v2 01/16] android/hf-client: Add hf-client ID Lukasz Rymanowski
2014-09-11 11:43   ` Szymon Janc
2014-09-10 11:34 ` [PATCH v2 02/16] android/hardware: Add HFP Client Interface ID Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 03/16] android/hf-client: Add hf-client daemon skeleton Lukasz Rymanowski
2014-09-11 11:45   ` Szymon Janc [this message]
2014-09-10 11:34 ` [PATCH v2 04/16] android/hf-client: Add hf-client HAL skeleton Lukasz Rymanowski
2014-09-11 11:48   ` Szymon Janc
2014-09-10 11:34 ` [PATCH v2 05/16] android/hf-client: Add hf-client to Android build Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 06/16] android/readme: Add information about hf-client Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 07/16] android/hf-client: Add Connect/Disconnect commands Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 08/16] android/hf-client: Add Audio " Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 09/16] android/hf-client: Add Start/Stop Voice Recognition command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 10/16] android/hf-client: Add Volume Control command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 11/16] android/hf-client: Add Dial and Dial Memory command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 12/16] android/hf-client: Add Call Action command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 13/16] android/hf-client: Add Query Current Call and Operator Name command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 14/16] android/hf-client: Add Retrieve Subscriber Info command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 15/16] android/hf-client: Add Send DTMF command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 16/16] android/hf-client: Add Get Last Voice Tag Number command Lukasz Rymanowski

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=9866556.BU1bIVAFtI@uw000953 \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=lukasz.rymanowski@tieto.com \
    /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