diff options
author | Gowtham Anandha Babu <gowtham.ab@samsung.com> | 2015-12-08 16:30:52 +0530 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2016-01-19 08:01:14 +0100 |
commit | deae2cd6c2af58c13da4d7be90de18b49dffee20 (patch) | |
tree | f0b3db7af83c8acc67f7efba287cb60e364f58ac /test | |
parent | e81aeaea21db84042ee0c30159290ca56d250111 (diff) | |
download | bluez-deae2cd6c2af58c13da4d7be90de18b49dffee20.tar.gz |
test: Add device discovery filter
This patch adds the below mentioned device discovery
filters.
UUIDs, RSSI, Pathloss, Transport.
Diffstat (limited to 'test')
-rwxr-xr-x | test/test-discovery | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/test-discovery b/test/test-discovery index 9a2c6b95c..cea77683d 100755 --- a/test/test-discovery +++ b/test/test-discovery @@ -115,6 +115,18 @@ if __name__ == '__main__': option_list = [ make_option("-i", "--device", action="store", type="string", dest="dev_id"), + make_option("-u", "--uuids", action="store", + type="string", dest="uuids", + help="Filtered service UUIDs [uuid1,uuid2,...]"), + make_option("-r", "--rssi", action="store", + type="int", dest="rssi", + help="RSSI threshold value"), + make_option("-p", "--pathloss", action="store", + type="int", dest="pathloss", + help="Pathloss threshold value"), + make_option("-t", "--transport", action="store", + type="string", dest="transport", + help="Type of scan to run (le/bredr/auto)"), make_option("-c", "--compact", action="store_true", dest="compact"), ] @@ -144,6 +156,26 @@ if __name__ == '__main__': if "org.bluez.Device1" in interfaces: devices[path] = interfaces["org.bluez.Device1"] + scan_filter = dict() + + if options.uuids: + uuids = [] + uuid_list = options.uuids.split(',') + for uuid in uuid_list: + uuids.append(uuid) + + scan_filter.update({ "UUIDs": uuids }) + + if options.rssi: + scan_filter.update({ "RSSI": dbus.Int16(options.rssi) }) + + if options.pathloss: + scan_filter.update({ "Pathloss": dbus.UInt16(options.pathloss) }) + + if options.transport: + scan_filter.update({ "Transport": options.transport }) + + adapter.SetDiscoveryFilter(scan_filter) adapter.StartDiscovery() mainloop = GObject.MainLoop() |