Пример #1
0
def scan_wunderbars():
    """
    Scan Wunderbar devices and show what we find about them.
    """
    
    devices = scan_ble_devices(name_filter='Wunderbar.*')
    for dev in devices:
        print("Discovered device: %(addr)s %(name)s " % dev)
        d = GattDevice(dev['addr'])
        chars = d.characteristics()
        for char in chars:
            if len(char['_uuid']) == 4:
                print('  characteristic uuid: %s' % char['uuid'])
                h = char['name_handle']
                dat = d.char_read_hnd(h)
                args = (h, dat, repr(data2str(dat)))
                print('    name handle: %s, data: %s, str: %s' % args)
                h = char['value_handle']
                dat = d.char_read_hnd(h)
                args = (h, dat, repr(data2str(dat)))
                print('    value handle: %s, data: %s, str: %s' % args)
        print('  device name: %s' % d.read_device_name())
        print('  battery level: %s' % d.read_battery_level())
        print('')
Пример #2
0
def scan_wunderbars():
    """
    Scan Wunderbar devices and show what we find about them.
    """

    devices = scan_ble_devices(name_filter='Wunderbar.*')
    for dev in devices:
        print("Discovered device: %(addr)s %(name)s " % dev)
        d = GattDevice(dev['addr'])
        chars = d.characteristics()
        for char in chars:
            if len(char['_uuid']) == 4:
                print('  characteristic uuid: %s' % char['uuid'])
                h = char['name_handle']
                dat = d.char_read_hnd(h)
                args = (h, dat, repr(data2str(dat)))
                print('    name handle: %s, data: %s, str: %s' % args)
                h = char['value_handle']
                dat = d.char_read_hnd(h)
                args = (h, dat, repr(data2str(dat)))
                print('    value handle: %s, data: %s, str: %s' % args)
        print('  device name: %s' % d.read_device_name())
        print('  battery level: %s' % d.read_battery_level())
        print('')
Пример #3
0
 def test_ble_scan(self):
     "Test BLE service discovery (needs switched on BLE devices!)."
     from relayr.ble import scan_ble_devices
     devs = scan_ble_devices(timeout=3)
     assert len(devs) > 0
Пример #4
0
 def test_ble_scan(self):
     "Test BLE service discovery (needs switched on BLE devices!)."
     from relayr.ble import scan_ble_devices
     devs = scan_ble_devices(timeout=3)
     assert len(devs) > 0