00001 /* 00002 This file is part of the Opie Project 00003 Copyright (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> 00004 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 00005 .=l. 00006 .>+-= 00007 _;:, .> :=|. This program is free software; you can 00008 .> <`_, > . <= redistribute it and/or modify it under 00009 :`=1 )Y*s>-.-- : the terms of the GNU Library General Public 00010 .="- .-=="i, .._ License as published by the Free Software 00011 - . .-<_> .<> Foundation; version 2 of the License. 00012 ._= =} : 00013 .%`+i> _;_. 00014 .i_,=:_. -<s. This program is distributed in the hope that 00015 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 00016 : .. .:, . . . without even the implied warranty of 00017 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 00018 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 00019 ..}^=.= = ; Library General Public License for more 00020 ++= -. .` .: details. 00021 : = ...= . :.=- 00022 -. .:....=;==+<; You should have received a copy of the GNU 00023 -_. . . )=. = Library General Public License along with 00024 -- :-=` this library; see the file COPYING.LIB. 00025 If not, write to the Free Software Foundation, 00026 Inc., 59 Temple Place - Suite 330, 00027 Boston, MA 02111-1307, USA. 00028 */ 00029 00030 #ifndef OBLUETOOTH_H 00031 #define OBLUETOOTH_H 00032 00033 #include <qobject.h> 00034 #include <qdict.h> 00035 00036 namespace Opie { 00037 namespace Bluez { 00038 00039 class OBluetoothInterface; 00040 class OBluetoothDevice; 00041 00049 class OBluetooth : public QObject 00050 { 00051 Q_OBJECT 00052 00053 public: 00054 typedef QDict<OBluetoothInterface> InterfaceMap; 00055 typedef QDictIterator<OBluetoothInterface> InterfaceIterator; 00056 00057 public: 00061 int count() const; 00065 static OBluetooth* instance(); 00069 InterfaceIterator iterator() const; 00073 bool isPresent( const char* interface ) const; 00077 bool isWirelessInterface( const char* interface ) const; 00082 OBluetoothInterface* interface( const QString& interface ) const; 00088 void synchronize(); 00089 00090 protected: 00091 OBluetooth(); 00092 00093 private: 00094 static OBluetooth* _instance; 00095 InterfaceMap _interfaces; 00096 class OBluetoothPrivate; 00097 OBluetoothPrivate *d; 00098 int _fd; 00099 }; 00100 00101 /*====================================================================================== 00102 * OBluetoothInterface 00103 *======================================================================================*/ 00104 00115 class OBluetoothInterface : public QObject 00116 { 00117 Q_OBJECT 00118 public: 00119 typedef QDict<OBluetoothDevice> DeviceMap; 00120 typedef QDictIterator<OBluetoothDevice> DeviceIterator; 00121 00122 public: 00127 OBluetoothInterface( QObject* parent, const char* name, void* devinfo, int ctlfd ); 00131 virtual ~OBluetoothInterface(); 00135 QString macAddress() const; 00139 bool setUp( bool ); 00143 bool isUp() const; 00147 DeviceIterator neighbourhood(); 00148 00149 private: 00150 DeviceMap _devices; 00151 class Private; 00152 Private *d; 00153 }; 00154 00155 /*====================================================================================== 00156 * OBluetoothDevice 00157 *======================================================================================*/ 00158 00165 class OBluetoothDevice : public QObject 00166 { 00167 Q_OBJECT 00168 00169 public: 00173 OBluetoothDevice( QObject* parent, const char* name, void* inqinfo ); 00177 virtual ~OBluetoothDevice(); 00181 QString macAddress() const; 00185 QString deviceClass() const; 00189 QString getName(); 00190 00191 private: 00192 class Private; 00193 Private *d; 00194 }; 00195 00196 } 00197 } 00198 #endif 00199
1.4.2