00001 /***************************************************************************** 00002 * Copyright (C) 2011 by Benjamin Hadorn (b_hadorn@bluewin.ch) 00003 ***************************************************************************** 00004 * Project : Zeus Base Library 00005 * Module : BluetoothDevice 00006 * Package : Zeus.ZeusBase.Net.Bluetooth 00007 * Author : Benjamin Hadorn 00008 * Date : 27.12.2011 00009 * System : Zeus-Framework 00010 ***************************************************************************** 00011 * Licence: * 00012 * This library is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU Lesser General Public License as * 00014 * published by the Free Software Foundation; either version * 00015 * 2.1 of the License, or (at your option) any later version. * 00016 * * 00017 * This library is distributed in the hope that it will be useful, * 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00020 * GNU Lesser General Public License for more details. * 00021 * * 00022 * You should have received a copy of the GNU Lesser General Public * 00023 * License along with this library; if not, write to the Free Software * 00024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA * 00025 *****************************************************************************/ 00026 00027 /***************************************************************************** 00028 * Changes: 00029 * 27.12.2011 bha: created zeus 2.0 00030 *****************************************************************************/ 00031 00032 #ifndef BluetoothDeviceH 00033 #define BluetoothDeviceH 00034 00035 #include <zeusbase/System/ZObject.h> 00036 #include <zeusbase/System/SingleLinkedList.hpp> 00037 #include <zeusbase/Net/Bluetooth/BTDefines.hpp> 00038 00039 BEGIN_NAMESPACE_Zeus 00040 00041 class TBTAddress; 00042 00043 /****************************************************************************/ 00046 /****************************************************************************/ 00047 zeusbase_class TBluetoothDevice : public TZObject 00048 { 00049 public: 00050 TBluetoothDevice(); 00051 00052 #ifdef ENABLE_WIN32_BLUETOOTH 00053 TBluetoothDevice(BLUETOOTH_RADIO_INFO& rRadioStruct, 00054 BLUETOOTH_DEVICE_INFO& rDeviceStruct); 00055 #elif defined(ENABLE_BLUEZ_BLUETOOTH) 00056 TBluetoothDevice(int iHCSock, inquiry_info& rInfo); 00057 #endif 00058 00059 TString getName() const; 00060 TString getFormatedAddress() const; 00061 Retval getAddress(TBTAddress*& rpAddress) const; 00062 00063 bool isConnected() const; 00064 bool isAuthenticated() const; 00065 00066 static void findAllDevices(TSingleLinkedList<TBluetoothDevice*>& rList, Int iQueryTimeOut = 15); 00067 static Retval findNamedDevices(const TString& rName, TBluetoothDevice*& rpDevice, Int iQueryTimeOut = 15); 00068 00069 protected: 00070 virtual ~TBluetoothDevice(); 00071 00072 private: 00074 TString m_strRadioName; 00076 Uint64 m_uldRadioAddress; 00078 TString m_strDeviceName; 00080 Uint64 m_uldDeviceAddress; 00082 bool m_bAuthenticated; 00084 bool m_bConnected; 00085 00086 }; 00087 00088 /****************************************************************************/ 00091 /****************************************************************************/ 00092 inline TString TBluetoothDevice::getName() const 00093 { 00094 return m_strDeviceName; 00095 } 00096 00097 /****************************************************************************/ 00100 /****************************************************************************/ 00101 inline bool TBluetoothDevice::isConnected() const 00102 { 00103 return m_bConnected; 00104 } 00105 00106 /****************************************************************************/ 00109 /****************************************************************************/ 00110 inline bool TBluetoothDevice::isAuthenticated() const 00111 { 00112 return m_bAuthenticated; 00113 } 00114 00115 END_NAMESPACE_Zeus 00116 00117 #endif