linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@gmail.com>
To: Szymon Janc <szymon.janc@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] android/gatt: Add support for fake read RSSI
Date: Wed, 09 Apr 2014 23:31:56 +0200	[thread overview]
Message-ID: <1439178.XRzOTKglYP@athlon> (raw)
In-Reply-To: <1395747330-22919-1-git-send-email-szymon.janc@tieto.com>

On Tuesday 25 March 2014 12:35:30 Szymon Janc wrote:
> This will ease testing until kernel support is added.
> ---
>  android/gatt.c | 27 ++++++++++++++++++++++++++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/android/gatt.c b/android/gatt.c
> index 0414c4f..f488e17 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -943,10 +943,35 @@ static void
> handle_client_deregister_for_notification(const void *buf,
> 
>  static void handle_client_read_remote_rssi(const void *buf, uint16_t len)
>  {
> +	const struct hal_cmd_gatt_client_read_remote_rssi *cmd = buf;
> +	struct hal_ev_gatt_client_read_remote_rssi ev;
> +	static int32_t fake_rssi = -71;
> +	uint8_t status;
> +
>  	DBG("");
> 
> +	if (!queue_find(gatt_clients, match_client_by_id,
> +						INT_TO_PTR(cmd->client_if))) {
> +		status = HAL_STATUS_FAILED;
> +		goto failed;
> +	}
> +
> +	/* TODO fake RSSI until kernel support is added */
> +	ev.client_if = cmd->client_if;
> +	memcpy(ev.address, cmd->bdaddr, sizeof(ev.address));
> +	ev.status = HAL_STATUS_SUCCESS;
> +	ev.rssi = fake_rssi;
> +
> +	fake_rssi = fake_rssi == -71 ? -83 : -71;
> +
> +	ipc_send_notif(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_EV_GATT_CLIENT_READ_REMOTE_RSSI, sizeof(ev), &ev);
> +
> +	status = HAL_STATUS_SUCCESS;
> +
> +failed:
>  	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> -			HAL_OP_GATT_CLIENT_READ_REMOTE_RSSI, HAL_STATUS_FAILED);
> +			HAL_OP_GATT_CLIENT_READ_REMOTE_RSSI, status);
>  }
> 
>  static void handle_client_get_device_type(const void *buf, uint16_t len)

Updated patch pushed.

-- 
Szymon K. Janc
szymon.janc@gmail.com

      reply	other threads:[~2014-04-09 21:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-25 11:35 [PATCH] android/gatt: Add support for fake read RSSI Szymon Janc
2014-04-09 21:31 ` 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=1439178.XRzOTKglYP@athlon \
    --to=szymon.janc@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=szymon.janc@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;
as well as URLs for NNTP newsgroup(s).