doc/adapter-api.txt: StartServiceDiscovery method.
PATCH v2 1/1 doc/adapter-api.txt: StartServiceDiscovery method.
This patch proposes new method, StartServiceDiscovery to D-Bus Adapter API for desktop bluetoothd. It will allow for rapid discovery of nearby devices that advertise services.
--- doc/adapter-api.txt | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
doc/adapter-api.txt +38 -0
@@ -22,6 +22,44 @@ Methods void StartDiscovery() Possible errors: org.bluez.Error.NotReady org.bluez.Error.Failed + void StartServiceDiscovery(string mode, dict filter) + + This method starts the device discovery session with + filtering by uuids, and rssi or pathloss value. Use + StopDiscovery to release the sessions acquired. + + mode parameter: + "LE" - le only scan + "BR/EDR" - br/edr inquiry + "INTERLEAVED" - interleaved scan + + Parameters that can be set in filter dictionary include + the following: + + string UUID : filtered service UUID (required) + string RSSI : RSSI threshold value (optional) + string pathloss : Pathloss threshold value + (optional) + + When a device is found that advertise UUID, it will be + reported if: + - pathloss and RSSI are both empty + - only pathloss param is set, device advertise TX pwer, + and computed pathloss is less than pathloss param, + - only RSSI param is set, and received RSSI is higher + than RSSI param, + - both pathloss and RSSI is set. Then if TX power is + advertised, pathloss condition must be met, otherwise + RSSI condition must be met. + + This process will start creating Device objects as new + devices matching criteria are discovered. It will also + emit PropertiesChanged signal for already existing + Device objects, with updated RSSI value. + + Possible errors: org.bluez.Error.NotReady + org.bluez.Error.Failed + void StopDiscovery() This method will cancel any previous StartDiscovery
Signature · 1 line
2.2.0.rc0.207.ga3a616c
Hi Jakub,
Quoted 6 lines · Jakub Pawlowski
This patch proposes new method, StartServiceDiscovery to D-Bus Adapter API for desktop bluetoothd. It will allow for rapid discovery of nearby devices that advertise services.
Signed-off-by Jakub Pawlowski <[email protected]>
Omit "signed-off by" please.
Quoted 9 lines
--- doc/adapter-api.txt | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)doc/adapter-api.txt +0
-0
doc/adapter-api.txt Methods void StartDiscovery() · line 26
Quoted 5 lines
doc/adapter-api.txt +2
-0@@ -22,6 +22,44 @@ Methods void StartDiscovery() Possible errors: org.bluez.Error.NotReady org.bluez.Error.Failed + void StartServiceDiscovery(string mode, dict filter) +
I mentioned this before during the mgmt API patches (though I didn't feel strongly about it) and I'm mentioning it now (this time I feel more strongly) that I don't like the term "ServiceDiscovery" here. It makes me immediately think of ATT/SDP, which is not what this API doing. What's more, I can easily imagine that we potentially extend this API to filter by other types of parameters, such as the manufacturer data field for instance, so maybe it's better to rename this to something more generic like "RequestDevice" or "ScanDevicesWithFilter" (or something along those lines).
The behavior of this API with respect to simultaneous use by multiple applications should be defined here as well. When more than one application calls this, is the behavior basically "adding a new UUID filter to the ongoing scan"?
Also, earlier we were talking about a one-shot API that would return the object paths of devices that the application is particularly concerned with. Is that the approach we should take here? Or are we basically saying that applications should rely on InterfacesAdded signals and then do their additional filtering on top of that based on Device properties?
doc/adapter-api.txt Methods void StartDiscovery() · line 30
Quoted 4 lines
doc/adapter-api.txt +4
-0+ This method starts the device discovery session with + filtering by uuids, and rssi or pathloss value. Use + StopDiscovery to release the sessions acquired. +
You should document the behavior of this method if StartDiscovery was called earlier. Does it just fail in that case or is it a no-op?
doc/adapter-api.txt Methods void StartDiscovery() · line 34
Quoted 4 lines
doc/adapter-api.txt +4
-0+ mode parameter: + "LE" - le only scan + "BR/EDR" - br/edr inquiry + "INTERLEAVED" - interleaved scan
This parameter looks to MGMT-like. Why do we need an "interlaved" flag? Should an application care about which technology is being used? Should this just be automatically determined by bluetoothd?
Quoted 34 lines
doc/adapter-api.txt +28
-1+ + Parameters that can be set in filter dictionary include + the following: + + string UUID : filtered service UUID (required) + string RSSI : RSSI threshold value (optional) + string pathloss : Pathloss threshold value + (optional) + + When a device is found that advertise UUID, it will be + reported if: + - pathloss and RSSI are both empty + - only pathloss param is set, device advertise TX pwer, + and computed pathloss is less than pathloss param, + - only RSSI param is set, and received RSSI is higher + than RSSI param, + - both pathloss and RSSI is set. Then if TX power is + advertised, pathloss condition must be met, otherwise + RSSI condition must be met. + + This process will start creating Device objects as new + devices matching criteria are discovered. It will also + emit PropertiesChanged signal for already existing + Device objects, with updated RSSI value. + + Possible errors: org.bluez.Error.NotReady + org.bluez.Error.Failed + void StopDiscovery() This method will cancel any previous StartDiscovery --2.2.0.rc0.207.ga3a616c
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks,
Arman
Marcel Holtmann
maintainerHi Arman,
Quoted 39 lines
Quoted 6 lines · Jakub Pawlowski
This patch proposes new method, StartServiceDiscovery to D-Bus Adapter API for desktop bluetoothd. It will allow for rapid discovery of nearby devices that advertise services.
Signed-off-by Jakub Pawlowski <[email protected]>Omit "signed-off by" please.
Quoted 9 lines
---
doc/adapter-api.txt| 38 ++++++++++++++++++++++++++++++++++++++1 file changed, 38 insertions(+)doc/adapter-api.txt +0
-0doc/adapter-api.txt Methods void StartDiscovery() · line 26
Quoted 5 lines
doc/adapter-api.txt +2
-0@@ -22,6 +22,44 @@ Methods void StartDiscovery() Possible errors: org.bluez.Error.NotReady org.bluez.Error.Failed + void StartServiceDiscovery(string mode, dict filter) +I mentioned this before during the mgmt API patches (though I didn't feel strongly about it) and I'm mentioning it now (this time I feel more strongly) that I don't like the term "ServiceDiscovery" here. It makes me immediately think of ATT/SDP, which is not what this API doing. What's more, I can easily imagine that we potentially extend this API to filter by other types of parameters, such as the manufacturer data field for instance, so maybe it's better to rename this to something more generic like "RequestDevice" or "ScanDevicesWithFilter" (or something along those lines).
The behavior of this API with respect to simultaneous use by multiple applications should be defined here as well. When more than one application calls this, is the behavior basically "adding a new UUID filter to the ongoing scan"?
Quoted 6 lines
Also, earlier we were talking about a one-shot API that would return the object paths of devices that the application is particularly concerned with. Is that the approach we should take here? Or are we basically saying that applications should rely on InterfacesAdded signals and then do their additional filtering on top of that based on Device properties?
I think that can be achieved by something simple like DiscoverDevices which will return an array of device objects. It is more for the simple application that knows exactly what it is looking for.
The only real difference is that StartDiscovery and alike will keep running until it is stopped, while a one-shot trigger will just stop once devices are found or when it has been cancelled.
If a DiscoverDevices is enough for your use case, then I say, lets go that direction. It is simpler and a lot easier. Per each application we could allow one DiscoverDevices running at the same time. When called from multiple application then bluetoothd will take care of combining the filter and multiplexing it. The DiscoverDevices will run until it finds at least one device with the matching filter parameters or CancelDiscoverDevices is called. Then the caller can decide to run it again or connect to that found device.
Quoted 8 lines
doc/adapter-api.txt Methods void StartDiscovery() · line 30
Quoted 4 lines
doc/adapter-api.txt +4
-0+ This method starts the device discovery session with + filtering by uuids, and rssi or pathloss value. Use + StopDiscovery to release the sessions acquired. +You should document the behavior of this method if StartDiscovery was called earlier. Does it just fail in that case or is it a no-op?
Quoted 8 lines
doc/adapter-api.txt Methods void StartDiscovery() · line 34
Quoted 4 lines
doc/adapter-api.txt +4
-0+ mode parameter: + "LE" - le only scan + "BR/EDR" - br/edr inquiry + "INTERLEAVED" - interleaved scanThis parameter looks to MGMT-like. Why do we need an "interlaved" flag? Should an application care about which technology is being used? Should this just be automatically determined by bluetoothd?
I think we want to call it Bearer or Transport. And it should essentially be specified "le" or "bredr" or "auto" as possible modes. The interleaved / auto should be assumed by just leaving the parameter out.
Quoted 6 lines
doc/adapter-api.txt Methods void StartDiscovery() · line 39
Quoted 6 lines
doc/adapter-api.txt +5
-0+ + Parameters that can be set in filter dictionary include + the following: + + string UUID : filtered service UUID (required)
We obviously want a list of UUIDs so this should be an array{string}.
Quoted 1 line
doc/adapter-api.txt Methods void StartDiscovery() · line 40
Quoted 1 line
doc/adapter-api.txt +1
-0+ string RSSI : RSSI threshold value (optional)
RSSI should be a int16 like we have with the other properties.
Quoted 2 lines
doc/adapter-api.txt Methods void StartDiscovery() · line 42
Quoted 2 lines
doc/adapter-api.txt +2
-0+ string pathloss : Pathloss threshold value + (optional)
And Pathloss should also be int16 if it needs to be signed or uint8/byte if it doesn't. I would need to look this up again.
Quoted 11 lines
doc/adapter-api.txt Methods void StartDiscovery() · line 53
Quoted 11 lines
doc/adapter-api.txt +11
-0+ + When a device is found that advertise UUID, it will be + reported if: + - pathloss and RSSI are both empty + - only pathloss param is set, device advertise TX pwer, + and computed pathloss is less than pathloss param, + - only RSSI param is set, and received RSSI is higher + than RSSI param, + - both pathloss and RSSI is set. Then if TX power is + advertised, pathloss condition must be met, otherwise + RSSI condition must be met.
Personally I would say either RSSI or Pathloss can be specified. If both are specified, then an error will be returned. Obviously devices without TX Power field will be ignored.
Quoted 11 lines
Quoted 11 lines
doc/adapter-api.txt +9
-0+ + This process will start creating Device objects as new + devices matching criteria are discovered. It will also + emit PropertiesChanged signal for already existing + Device objects, with updated RSSI value. + + Possible errors: org.bluez.Error.NotReady + org.bluez.Error.Failed + void StopDiscovery()
Quoted 1 line
doc/adapter-api.txt Methods void StartDiscovery() · line 65
Quoted 1 line
doc/adapter-api.txt +0
-0This method will cancel any previous StartDiscovery
Regards
Marcel
On Thu, Dec 11, 2014 at 5:07 PM, Marcel Holtmann <[email protected]> wrot= e:
Quoted 5 lines
Hi Arman,
Quoted 1 line
Quoted 1 line
On Thu, Dec 11, 2014 at 5:45 AM, Jakub Pawlowski <[email protected]=
Quoted 1 line · wrote:
Quoted 1 line
This patch proposes new method, StartServiceDiscovery to D-Bus Adapter =
API for
Quoted 1 line
Quoted 1 line
Quoted 1 line
desktop bluetoothd. It will allow for rapid discovery of nearby devices=
that
Quoted 36 lines
Quoted 36 lines
Quoted 3 lines
advertise services.
Signed-off-by Jakub Pawlowski <[email protected]>Omit "signed-off by" please.
Quoted 9 lines
---
doc/adapter-api.txt| 38 ++++++++++++++++++++++++++++++++++++++1 file changed, 38 insertions(+)doc/adapter-api.txt +0
-0doc/adapter-api.txt Methods void StartDiscovery() · line 26
Quoted 5 lines
doc/adapter-api.txt +2
-0@@ -22,6 +22,44 @@ Methods void StartDiscovery() Possible errors: org.bluez.Error.NotReady org.bluez.Error.Failed + void StartServiceDiscovery(string mode, dict filter) +I mentioned this before during the mgmt API patches (though I didn't feel strongly about it) and I'm mentioning it now (this time I feel more strongly) that I don't like the term "ServiceDiscovery" here. It makes me immediately think of ATT/SDP, which is not what this API doing. What's more, I can easily imagine that we potentially extend this API to filter by other types of parameters, such as the manufacturer data field for instance, so maybe it's better to rename this to something more generic like "RequestDevice" or "ScanDevicesWithFilter" (or something along those lines).
The behavior of this API with respect to simultaneous use by multiple applications should be defined here as well. When more than one application calls this, is the behavior basically "adding a new UUID filter to the ongoing scan"?
Quoted 8 lines
Quoted 6 lines
Also, earlier we were talking about a one-shot API that would return the object paths of devices that the application is particularly concerned with. Is that the approach we should take here? Or are we basically saying that applications should rely on InterfacesAdded signals and then do their additional filtering on top of that based on Device properties?
I think that can be achieved by something simple like DiscoverDevices whi=
ch will return an array of device objects. It is more for the simple applic= ation that knows exactly what it is looking for.
Quoted 2 lines
The only real difference is that StartDiscovery and alike will keep runni=
ng until it is stopped, while a one-shot trigger will just stop once device= s are found or when it has been cancelled.
Quoted 2 lines
If a DiscoverDevices is enough for your use case, then I say, lets go tha=
t direction. It is simpler and a lot easier. Per each application we could = allow one DiscoverDevices running at the same time. When called from multip= le application then bluetoothd will take care of combining the filter and m= ultiplexing it. The DiscoverDevices will run until it finds at least one de= vice with the matching filter parameters or CancelDiscoverDevices is called= . Then the caller can decide to run it again or connect to that found devic= e.
Quoted 1 line
So let's name this new method StartFilteredDiscovery
Here's how I want this method to work and why:
You call StartFilteredDiscovery, and it returns immediately, devices are returned just like when running StartDiscovery - by creating or updating Device1 object.
Then the caller will stop the filtered scan by running StopDiscovery.
I don't want to have this method block on call and return a device or array of devices because:
* how do I decide wether to stop after one or n devices being discovered ? If we use same approach as with StartDiscovery you can just call StopDiscovery, and each app might decide when it's happy with results
* if I decide to stop after one device, and then restart scan how do I make sure that the scan would return next, not same device ?
* when we filter by RSSI or Pathloss, we might want to do something fancy in the future to smooth the values a little bit, because raw RSSI values sometimes have noises and spikes that we want to get rid of. If we have Start/Stop approach, we have peroid in which we monitor RSSI values and feed them to 'smoothing' algorithm. If we restart scan multiple times it all get compilcated.
Quoted 1 line
Quoted 1 line
doc/adapter-api.txt Methods void StartDiscovery() · line 27
Quoted 1 line
doc/adapter-api.txt +1
-0+ This method starts the device discovery session=
with
Quoted 1 line
Quoted 1 line
doc/adapter-api.txt Methods void StartDiscovery() · line 28
Quoted 1 line
doc/adapter-api.txt +1
-0+ filtering by uuids, and rssi or pathloss value.=
Use
Quoted 6 lines
Quoted 6 lines
doc/adapter-api.txt Methods void StartDiscovery() · line 30
Quoted 2 lines
doc/adapter-api.txt +2
-0+ StopDiscovery to release the sessions acquired. +You should document the behavior of this method if StartDiscovery was called earlier. Does it just fail in that case or is it a no-op?
Quoted 8 lines
Quoted 8 lines
doc/adapter-api.txt Methods void StartDiscovery() · line 34
Quoted 4 lines
doc/adapter-api.txt +4
-0+ mode parameter: + "LE" - le only scan + "BR/EDR" - br/edr inquiry + "INTERLEAVED" - interleaved scanThis parameter looks to MGMT-like. Why do we need an "interlaved" flag? Should an application care about which technology is being used? Should this just be automatically determined by bluetoothd?
Yes we care alot. If we i.e. want to discover LE only devices, using interleaved scan like in StartDiscovery will scan LE for 10 seconds, then do Classic inquiry for 10 seconds and repeat until StopDiscovery is called.
That will leave you with 10 second where you don't report LE devices, and that's very bad for my use case. If you specify you want LE only, you'll scan all the times.
Quoted 2 lines
I think we want to call it Bearer or Transport. And it should essentially=
be specified "le" or "bredr" or "auto" as possible modes. The interleaved =
/ auto should be assumed by just leaving the parameter out.
Quoted 4 lines
Quoted 4 lines
doc/adapter-api.txt Methods void StartDiscovery() · line 36
Quoted 4 lines
doc/adapter-api.txt +2
-0+ + Parameters that can be set in filter dictionary=
include
Quoted 3 lines
Quoted 3 lines
doc/adapter-api.txt Methods void StartDiscovery()
Quoted 3 lines
doc/adapter-api.txt +3
-0+ the following: + + string UUID : filtered service UUID (re=
quired)
Quoted 4 lines
We obviously want a list of UUIDs so this should be an array{string}.
Quoted 1 line
Quoted 1 line
doc/adapter-api.txt +1
-0+ string RSSI : RSSI threshold value (opt=
ional)
Quoted 4 lines
RSSI should be a int16 like we have with the other properties.
Quoted 1 line
Quoted 1 line
doc/adapter-api.txt +1
-0+ string pathloss : Pathloss threshold va=
lue
Quoted 3 lines
Quoted 1 line
doc/adapter-api.txt Methods void StartDiscovery() · line 42
Quoted 1 line
doc/adapter-api.txt +1
-0+ (optional)And Pathloss should also be int16 if it needs to be signed or uint8/byte =
if it doesn't. I would need to look this up again.
Quoted 1 line
It needs to be uint8, but there's no uint8 in D-Bus so I'll leave it as uin= t16
Quoted 2 lines
Quoted 2 lines
doc/adapter-api.txt Methods void StartDiscovery() · line 44
Quoted 2 lines
doc/adapter-api.txt +2
-0+ + When a device is found that advertise UUID, it =
will be
Quoted 3 lines
Quoted 3 lines
doc/adapter-api.txt Methods void StartDiscovery()
Quoted 3 lines
doc/adapter-api.txt +3
-0+ reported if: + - pathloss and RSSI are both empty + - only pathloss param is set, device advertise =
TX pwer,
Quoted 1 line
Quoted 1 line
doc/adapter-api.txt Methods void StartDiscovery() · line 48
Quoted 1 line
doc/adapter-api.txt +1
-0+ and computed pathloss is less than pathloss p=
aram,
Quoted 1 line
Quoted 1 line
doc/adapter-api.txt Methods void StartDiscovery() · line 49
Quoted 1 line
doc/adapter-api.txt +1
-0+ - only RSSI param is set, and received RSSI is =
higher
Quoted 2 lines
Quoted 2 lines
doc/adapter-api.txt Methods void StartDiscovery() · line 51
Quoted 2 lines
doc/adapter-api.txt +2
-0+ than RSSI param, + - both pathloss and RSSI is set. Then if TX pow=
er is
Quoted 1 line
Quoted 1 line
doc/adapter-api.txt Methods void StartDiscovery() · line 52
Quoted 1 line
doc/adapter-api.txt +1
-0+ advertised, pathloss condition must be met, o=
therwise
Quoted 3 lines
Quoted 1 line
doc/adapter-api.txt Methods void StartDiscovery() · line 53
Quoted 1 line
doc/adapter-api.txt +1
-0+ RSSI condition must be met.Personally I would say either RSSI or Pathloss can be specified. If both =
are specified, then an error will be returned. Obviously devices without TX=
Power field will be ignored.
Quoted 3 lines
Quoted 3 lines
doc/adapter-api.txt Methods void StartDiscovery() · line 55
Quoted 3 lines
doc/adapter-api.txt +2
-0+ + This process will start creating Device objects=
as new
Quoted 1 line
Quoted 1 line
doc/adapter-api.txt Methods void StartDiscovery() · line 56
Quoted 1 line
doc/adapter-api.txt +1
-0+ devices matching criteria are discovered. It wi=
ll also
Quoted 1 line
Quoted 1 line
doc/adapter-api.txt Methods void StartDiscovery() · line 57
Quoted 1 line
doc/adapter-api.txt +1
-0+ emit PropertiesChanged signal for already exist=
ing
Quoted 8 lines
Quoted 8 lines
doc/adapter-api.txt Methods void StartDiscovery()
Quoted 8 lines
doc/adapter-api.txt +5
-0+ Device objects, with updated RSSI value. + + Possible errors: org.bluez.Error.NotReady + org.bluez.Error.Failed + void StopDiscovery() This method will cancel any previous StartDiscov=
ery
Quoted 5 lines
Regards
Marcel