Translation update done using Pootle.
[wammu.git] / Wammu / BluezDiscovery.py
blobd382cb0b2c1d0b42dd68e783cce96a239ceefe07
1 # -*- coding: UTF-8 -*-
2 # vim: expandtab sw=4 ts=4 sts=4:
3 '''
4 Wammu - Phone manager
5 Bluetooth discovery helper
6 '''
7 __author__ = 'Michal Čihař'
8 __email__ = 'michal@cihar.com'
9 __license__ = '''
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
19 more details.
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
24 '''
26 import bluetooth
28 class Discovery(bluetooth.DeviceDiscoverer):
29 '''
30 Discovery helper class. It just passes all found devices to parent
31 AllSearchThread.
32 '''
33 def __init__(self, parent):
34 bluetooth.DeviceDiscoverer.__init__(self)
35 self.parent = parent
37 def device_discovered(self, address, device_class, name):
38 '''
39 Called when device is iscovered, checks device class and if it is
40 phone, it calls search_bt_device method of parent.
41 '''
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
45 if major_class == 2:
46 self.parent.search_bt_device(address, name)
48 def inquiry_complete(self):
49 '''
50 Called when discovery is completed, does nothing.
51 '''
52 return