QBluetoothZero  2.0
QBtDeviceDiscoverer.h
Go to the documentation of this file.
00001 /*
00002  * QBtDeviceDiscoverer.h
00003  *
00004  *      Author: Ftylitakis Nikolaos, Luis Valente
00005  *
00006  * Licensed under the Apache License, Version 2.0 (the "License");
00007  * you may not use this file except in compliance with the License.
00008  * You may obtain a copy of the License at
00009  *
00010  *      http://www.apache.org/licenses/LICENSE-2.0
00011  *
00012  * Unless required by applicable law or agreed to in writing, software
00013  * distributed under the License is distributed on an "AS IS" BASIS,
00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  * See the License for the specific language governing permissions and
00016  * limitations under the License.
00017  */
00018 
00019 #ifndef QBTDEVICEDISCOVERER_H_
00020 #define QBTDEVICEDISCOVERER_H_
00021 
00022 #include <QBtGlobal.h>
00023 #include <QtCore/QObject>
00024 #include <QBtTypes.h>
00025 
00026 QBT_NAMESPACE_BEGIN
00027 
00028 //Forward declaration
00029 class QBtDeviceDiscovererPrivate;
00030 
00042 class DLL_EXPORT QBtDeviceDiscoverer : public QObject
00043 {
00044 Q_OBJECT
00045 
00046 public: //enums
00047     enum DeviceDiscoveryErrors
00048         { BluetoothNotSupported, BluetoothInUse, BluetoothAlreadyStopped, BluetoothNotReady,
00049         DiscoveryCancelled, UnknownError };
00050 
00051 public:
00052     QBtDeviceDiscoverer(QObject* parent = 0);
00053     virtual ~QBtDeviceDiscoverer();
00054 
00060     Q_INVOKABLE const QBtDevice::List& getInquiredDevices() const;
00061     
00062     
00066     bool isBusy () const;
00067 
00068         Q_INVOKABLE void emitDummySignalTest();
00069 
00070 public slots:
00078     void startDiscovery();
00079 
00086     void stopDiscovery();
00087 
00088 signals:
00093         void newDeviceFound (QBtDevice remoteDevice);
00094         
00095         //changed to the above because @ emit the classes already written, pass as argument
00096         // a local variable QBtDevice so i am not sure if the reference will continue to make senses
00097         // (may be the variable will be destroyed). Alternative we could return a *(new QBtDevice())
00098         //  but that would lead to memory leak.
00099         //void newDeviceFound (const QBtDevice & remoteDevice);
00100 
00104     void discoveryStopped();
00105 
00109     void discoveryStarted();
00110 
00116     void error(QBtDeviceDiscoverer::DeviceDiscoveryErrors error);
00117 
00118 private:        
00119     
00120     QBtDeviceDiscovererPrivate *_implPtr;    
00121     friend class QBtDeviceDiscovererPrivate;
00122     
00123 };
00124 
00125 QBT_NAMESPACE_END
00126 
00127 //Q_DECLARE_METATYPE(QBT_PREPEND_NAMESPACE(QBtDeviceDiscoverer))
00128 
00129 #endif /* QBTDEVICEDISCOVERER_H_ */