summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Janssen <jamuraa@chromium.org>2015-04-03 15:02:10 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2015-04-07 18:04:00 +0300
commit4cb6151466db4eb833a9cc5801a631ec6cc4b19d (patch)
tree06387b4e9414b6b7778413bc9e6a24a07e144862 /test
parente2cad2d15b78888ecaafe1c4c3a1d40bd827695d (diff)
downloadbluez-4cb6151466db4eb833a9cc5801a631ec6cc4b19d.tar.gz
test: improvements to example-advertisement
Improves the example-advertisement script in two ways: It uses 16-bit service UUIDs so that it does not overflow the Advertisement Data It turns the adapter's power on so that it works out of the box.
Diffstat (limited to 'test')
-rwxr-xr-xtest/example-advertisement12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/example-advertisement b/test/example-advertisement
index 98aeafa41..6e4739118 100755
--- a/test/example-advertisement
+++ b/test/example-advertisement
@@ -113,11 +113,10 @@ class TestAdvertisement(Advertisement):
def __init__(self, bus, index):
Advertisement.__init__(self, bus, index, 'broadcast')
- self.add_service_uuid('0000180D-0000-1000-8000-00805F9B34FB')
- self.add_service_uuid('0000180F-0000-1000-8000-00805F9B34FB')
+ self.add_service_uuid('180D')
+ self.add_service_uuid('180F')
self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03, 0x04])
- self.add_service_data('00009999-0000-1000-8000-00805F9B34FB',
- [0x00, 0x01, 0x02, 0x03, 0x04])
+ self.add_service_data('9999', [0x00, 0x01, 0x02, 0x03, 0x04])
def register_ad_cb():
@@ -153,6 +152,11 @@ def main():
print 'LEAdvertisingManager1 interface not found'
return
+ adapter_props = dbus.Interface(bus.get_object(BLUEZ_SERVICE_NAME, adapter),
+ "org.freedesktop.DBus.Properties");
+
+ adapter_props.Set("org.bluez.Adapter1", "Powered", dbus.Boolean(1))
+
ad_manager = dbus.Interface(bus.get_object(BLUEZ_SERVICE_NAME, adapter),
LE_ADVERTISING_MANAGER_IFACE)