File: discover.py

package info (click to toggle)
pygattlib 0~20201113-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 448 kB
  • sloc: ansic: 5,028; cpp: 1,685; python: 389; makefile: 46; sh: 1
file content (15 lines) | stat: -rwxr-xr-x 402 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/python
# -*- mode: python; coding: utf-8 -*-

# Copyright (C) 2014, Oscar Acena <oscaracena@gmail.com>
# This software is under the terms of Apache License v2 or later.

from gattlib import DiscoveryService

service = DiscoveryService("hci0")
devices = service.discover(4)

for address, name in list(devices.items()):
    print("name: {}, address: {}".format(name, address))

print("Done.")