2017-10-18 15:00:34

by Matt Hazley

[permalink] [raw]
Subject: BlueZ Peripheral: Detect Connection from Remote Device and Read RSSI

Hi everyone,

I have a simple, BLE peripheral using BlueZ 5.47, its written in Python.

My question is this - when using BlueZ and operating as a peripheral,
is there a way to detect that a central has connected to me? Is there
a way to read the RSSI of the connection between us?

Regarding the RSSI, I did try executing the following:

"hcitool rssi <central-bdaddr>"

when I knew the central was connected to me but this failed and
replied "Get connection info failed: No such file or directory."

Any help appreciated.

Regards,
Matt


2017-10-19 10:19:49

by Matt Hazley

[permalink] [raw]
Subject: Re: BlueZ Peripheral: Detect Connection from Remote Device and Read RSSI

Thanks for your comment.

> It seems to me that all the events and value changes result in DBus messages around. You can watch them with dbus-monitor first, and write your own app listening and filtering them later.

I will play with this idea but I am unsure if any dbus messages make
it into userspace before a characteristic interaction takes place.

Regards,
Matt

2017-10-19 07:01:55

by Libor Peltan

[permalink] [raw]
Subject: AW: BlueZ Peripheral: Detect Connection from Remote Device and Read RSSI

SGkgTWF0dCwNCkknbSBhIG5vb2IgaGVyZSwgYnV0IGp1c3QgYW4gaWRlYTogaG93IGFib3V0IGlu
dm9sdmluZyBEQnVzPw0KDQpJdCBzZWVtcyB0byBtZSB0aGF0IGFsbCB0aGUgZXZlbnRzIGFuZCB2
YWx1ZSBjaGFuZ2VzIHJlc3VsdCBpbiBEQnVzIG1lc3NhZ2VzIGFyb3VuZC4gWW91IGNhbiB3YXRj
aCB0aGVtIHdpdGggZGJ1cy1tb25pdG9yIGZpcnN0LCBhbmQgd3JpdGUgeW91ciBvd24gYXBwIGxp
c3RlbmluZyBhbmQgZmlsdGVyaW5nIHRoZW0gbGF0ZXIuDQoNCkFueWJvZHkgbW9yZSBleHBlcmll
bmNlZCwgbWF5IGdpdmUgeW91IGJldHRlciBhbnN3ZXIgOikNCg0KTGlib3INCg0KLS0tLS1VcnNw
csO8bmdsaWNoZSBOYWNocmljaHQtLS0tLQ0KVm9uOiBsaW51eC1ibHVldG9vdGgtb3duZXJ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