1 # -*- coding: UTF-8 -*-
2 # vim: expandtab sw=4 ts=4 sts=4:
5 Bluetooth discovery helper
7 __author__
= 'Michal Čihař'
8 __email__
= 'michal@cihar.com'
10 Copyright © 2003 - 2010 Michal Čihař
12 This program is free software; you can redistribute it and/or modify it
13 under the terms of the GNU General Public License version 2 as published by
14 the Free Software Foundation.
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 class Discovery(bluetooth
.DeviceDiscoverer
):
30 Discovery helper class. It just passes all found devices to parent
33 def __init__(self
, parent
):
34 bluetooth
.DeviceDiscoverer
.__init
__(self
)
37 def device_discovered(self
, address
, device_class
, name
):
39 Called when device is iscovered, checks device class and if it is
40 phone, it calls search_bt_device method of parent.
42 major_class
= ( device_class
& 0xf00 ) >> 8
43 # We want only devices with phone class
44 # See https://www.bluetooth.org/apps/content/?doc_id=49706
46 self
.parent
.search_bt_device(address
, name
)
48 def inquiry_complete(self
):
50 Called when discovery is completed, does nothing.