2014-03-28 09:37:46

by Lukasz Rymanowski

[permalink] [raw]
Subject: [RFC v3] Add Support for Read Remote RSSI

v2: Idea in this version is to start/stop read remote RSSI only
when device is connected.
In this version there is possibility to read one time RSSI value.

v3: Idea is to register/unregister for RSSI Changed event any time.
Kernel to handle polling and notify userspace if given threshold has
been exceeded.

If we go with v3, then in Android case we will need to add more logic
to bluetoothd to cover case when Application calles Read Remote Rssi
only once. We just need to avoid letting kernel to poll without the reason.
However I do expect android application to call this read remote rssi in
a loop anyway.

To consider in v3: Do we need Unregister command or we can use Register
command with threshold equal to 0 as a unregister ?

Lukasz Rymanowski (1):
mgmt-api: Add support for Read Remote RSSI

doc/mgmt-api.txt | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)

--
1.8.4



2014-03-28 11:34:20

by Anderson Lizardo

[permalink] [raw]
Subject: Re: [RFC v3] Add Support for Read Remote RSSI

Hi Lukasz,

On Fri, Mar 28, 2014 at 5:37 AM, Lukasz Rymanowski
<[email protected]> wrote:
> If we go with v3, then in Android case we will need to add more logic
> to bluetoothd to cover case when Application calles Read Remote Rssi
> only once. We just need to avoid letting kernel to poll without the reason.
> However I do expect android application to call this read remote rssi in
> a loop anyway.

One way to do that is to have a "timeout" timer (e.g. 5 seconds) that
is reset on each read_remote_rssi call from HAL. On this timer
expires, Unregister is called.

Note that the comment I made on the patch itself regarding configuring
the period for readings apply here: I think there should be some way
to set this period. Otherwise, a two small period (say, 1s) will be
wasting power for an application that reads only every 5s or 10s. Or
the contrary, a too long timer will make applications which read more
frequent receive inaccurate readings.

Best Regards,
--
Anderson Lizardo
http://www.indt.org/?lang=en
INdT - Manaus - Brazil

2014-03-28 11:32:34

by Lukasz Rymanowski

[permalink] [raw]
Subject: Re: [RFC v3] mgmt-api: Add support for Read Remote RSSI

Hi Anderson,

On 28 March 2014 12:27, Anderson Lizardo <[email protected]> wrote:
> Hi Lukasz,
>
> On Fri, Mar 28, 2014 at 5:37 AM, Lukasz Rymanowski
> <[email protected]> wrote:
>> +Register Remote RSSI Change Command
>> +===================================
>> +
>> + Command Code: 0x0031
>> + Controller Index: <controller id>
>> + Command Parameters: Address (6 Octets)
>> + Address_Type (1 Octet)
>> + Threshold (1 Octet)
>> + Return Parameters: Address (6 Octets)
>> + Address_Type (1 Octet)
>> +
>> + This command is used to register on Remote RSSI Change with given
>> + threshold. If threshold is exceeded then Remote RSSI Changed event
>> + is sent.
>> +
>> + Threshold shall be greater than 0.
>> +
>> + Threshold will be remembered during power down/up toggles.
>> +
>> + This command generates a Command Complete event on success
>> + and on failure.
>> +
>> + Possible errors: Invalid Parameters
>> + Invalid Index
>
> What should happen if you attempt a Register again for the same address?

We could use it to update the thershold.

>
> I wonder also how can you tune the period for the readings (at least a
> debugfs entry should be provided for this). E.g. every 1s , every 10s
> etc.
>
Definitely I see here a place debugfs entry for fine tuning of
polling timeout.

>> +Unregister Remote RSSI Change Command
>> +=====================================
>> +
>> + Command Code: 0x0032
>> + Controller Index: <controller id>
>> + Command Parameters: Address (6 Octets)
>> + Address_Type (1 Octet)
>> + Return Parametes: Address (6 Octets)
>> + Address_Type (1 Octet)
>> +
>> + This command is used to unregister from Remote RSSI Change event
>> + started with Register Remote RSSI Change command.
>> +
>> + This command generates Command Complete event on success
>> + and on failure.
>> +
>> + Possible errors: Rejected
>> + Invalid Parameters
>> + Invalid Index
>
> In which case "Rejected" will be reported?
In case there was no registration for such address.

>
> Best Regards,
> --
> Anderson Lizardo
> http://www.indt.org/?lang=en
> INdT - Manaus - Brazil

BR
Lukasz

2014-03-28 11:27:51

by Anderson Lizardo

[permalink] [raw]
Subject: Re: [RFC v3] mgmt-api: Add support for Read Remote RSSI

Hi Lukasz,

On Fri, Mar 28, 2014 at 5:37 AM, Lukasz Rymanowski
<[email protected]> wrote:
> +Register Remote RSSI Change Command
> +===================================
> +
> + Command Code: 0x0031
> + Controller Index: <controller id>
> + Command Parameters: Address (6 Octets)
> + Address_Type (1 Octet)
> + Threshold (1 Octet)
> + Return Parameters: Address (6 Octets)
> + Address_Type (1 Octet)
> +
> + This command is used to register on Remote RSSI Change with given
> + threshold. If threshold is exceeded then Remote RSSI Changed event
> + is sent.
> +
> + Threshold shall be greater than 0.
> +
> + Threshold will be remembered during power down/up toggles.
> +
> + This command generates a Command Complete event on success
> + and on failure.
> +
> + Possible errors: Invalid Parameters
> + Invalid Index

What should happen if you attempt a Register again for the same address?

I wonder also how can you tune the period for the readings (at least a
debugfs entry should be provided for this). E.g. every 1s , every 10s
etc.

> +Unregister Remote RSSI Change Command
> +=====================================
> +
> + Command Code: 0x0032
> + Controller Index: <controller id>
> + Command Parameters: Address (6 Octets)
> + Address_Type (1 Octet)
> + Return Parametes: Address (6 Octets)
> + Address_Type (1 Octet)
> +
> + This command is used to unregister from Remote RSSI Change event
> + started with Register Remote RSSI Change command.
> +
> + This command generates Command Complete event on success
> + and on failure.
> +
> + Possible errors: Rejected
> + Invalid Parameters
> + Invalid Index

In which case "Rejected" will be reported?

Best Regards,
--
Anderson Lizardo
http://www.indt.org/?lang=en
INdT - Manaus - Brazil

2014-03-28 09:37:47

by Lukasz Rymanowski

[permalink] [raw]
Subject: [RFC v3] mgmt-api: Add support for Read Remote RSSI

Two commands has been introduced:
Register Read Remote RSSI Change Command
Unregister Read Remote RSSI Change Command

And one Event:
Remote RSSI Changed Event
---
doc/mgmt-api.txt | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)

diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 78f0bd2..ffe24fe 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
@@ -1668,6 +1668,53 @@ Load Identity Resolving Keys Command
Invalid Index


+Register Remote RSSI Change Command
+===================================
+
+ Command Code: 0x0031
+ Controller Index: <controller id>
+ Command Parameters: Address (6 Octets)
+ Address_Type (1 Octet)
+ Threshold (1 Octet)
+ Return Parameters: Address (6 Octets)
+ Address_Type (1 Octet)
+
+ This command is used to register on Remote RSSI Change with given
+ threshold. If threshold is exceeded then Remote RSSI Changed event
+ is sent.
+
+ Threshold shall be greater than 0.
+
+ Threshold will be remembered during power down/up toggles.
+
+ This command generates a Command Complete event on success
+ and on failure.
+
+ Possible errors: Invalid Parameters
+ Invalid Index
+
+
+Unregister Remote RSSI Change Command
+=====================================
+
+ Command Code: 0x0032
+ Controller Index: <controller id>
+ Command Parameters: Address (6 Octets)
+ Address_Type (1 Octet)
+ Return Parametes: Address (6 Octets)
+ Address_Type (1 Octet)
+
+ This command is used to unregister from Remote RSSI Change event
+ started with Register Remote RSSI Change command.
+
+ This command generates Command Complete event on success
+ and on failure.
+
+ Possible errors: Rejected
+ Invalid Parameters
+ Invalid Index
+
+
Command Complete Event
======================

@@ -2257,3 +2304,29 @@ New Signature Resolving Key Event

The provided Address and Address_Type are the identity of
a device. So either its public address or static random address.
+
+
+Remote RSSI Changed Event
+=========================
+
+ Event Code: 0x0020
+ Controller Index: <controller id>
+ Event Parameters: Address (6 Octets)
+ Address_Type (1 Octet)
+ RSSI (1 Octet)
+
+ This event indicates that a remote RSSI has exceed threshold
+ given on Start Read Remote RSSI command.
+
+ Possible values for the Address_Type parameter:
+ 0 BR/EDR
+ 1 LE Public
+ 2 LE Random
+
+ Possible RSSI values:
+ BR/EDR
+ Range: -128 <= N <= 127 (signed integer)
+ Units: dB
+ LE:
+ Range: -127 to 20, 127 (signed integer)
+ Units: dBm
--
1.8.4


2014-04-22 10:29:19

by Lukasz Rymanowski

[permalink] [raw]
Subject: Re: [RFC v3] Add Support for Read Remote RSSI

Ping

On 28 March 2014 10:37, Lukasz Rymanowski <[email protected]> wrote:
> v2: Idea in this version is to start/stop read remote RSSI only
> when device is connected.
> In this version there is possibility to read one time RSSI value.
>
> v3: Idea is to register/unregister for RSSI Changed event any time.
> Kernel to handle polling and notify userspace if given threshold has
> been exceeded.
>
> If we go with v3, then in Android case we will need to add more logic
> to bluetoothd to cover case when Application calles Read Remote Rssi
> only once. We just need to avoid letting kernel to poll without the reason.
> However I do expect android application to call this read remote rssi in
> a loop anyway.
>
> To consider in v3: Do we need Unregister command or we can use Register
> command with threshold equal to 0 as a unregister ?
>
> Lukasz Rymanowski (1):
> mgmt-api: Add support for Read Remote RSSI
>
> doc/mgmt-api.txt | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 73 insertions(+)
>
> --
> 1.8.4
>
\Ɓukasz