QBluetoothZero  2.0
QBtServiceDiscovererForAll.h
Go to the documentation of this file.
00001 /*
00002  * QBtServiceDiscoverer.h
00003  *
00004  *
00005  *      Author: Ftylitakis Nikolaos
00006  *
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may not use this file except in compliance with the License.
00009  * You may obtain a copy of the License at
00010  *
00011  *      http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  * Unless required by applicable law or agreed to in writing, software
00014  * distributed under the License is distributed on an "AS IS" BASIS,
00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  * See the License for the specific language governing permissions and
00017  * limitations under the License.
00018  */
00019 
00020 #ifndef QBTSERVICEPROBER_H_
00021 #define QBTSERVICEPROBER_H_
00022 
00023 #include <QBtGlobal.h>
00024 #include <QtCore/QObject>
00025 #include <QBtTypes.h>
00026 #include <QBtDeviceDiscoverer.h>
00027 #include <QBtServiceDiscoverer.h>
00028 
00029 QBT_NAMESPACE_BEGIN
00030 
00048 class DLL_EXPORT QBtServiceDiscovererForAll : public QObject
00049 {
00050     Q_OBJECT
00051 
00052 public:
00053     QBtServiceDiscovererForAll(QObject* parent = 0);
00054     virtual ~QBtServiceDiscovererForAll();
00055 
00060     const QBtDevice::List & getDeviceList() const;
00061 
00065     bool isBusy () const;
00066 
00067 
00071     int getNumberOfFoundDevices () const;
00072 
00073 
00077     bool foundDevices() const;
00078 
00079 
00080 public slots:
00081 
00082 
00087    void startDiscovery ();
00088 
00089 
00095    void startObexDiscovery ();
00096 
00101    void startRfcommDiscovery ();
00102 
00103 
00104 
00110    void startDiscovery (const QBtUuid & uuid);
00111 
00112 
00118    void startDiscovery (const QList <QBtUuid> & uuids);
00119 
00120 
00125    void stopDiscovery();
00126 
00127 
00128 signals:
00129 
00133    void discoveryStarted();
00134 
00138    void discoveryEnded ();
00139 
00140 
00145    void newDeviceFound (const QBtDevice & device);
00146 
00147 
00152    void serviceDiscoveyError (const QBtDevice & device, QBtServiceDiscoverer::ServiceDiscoveryError error);
00153 
00157    void deviceDiscoveryError (QBtDeviceDiscoverer::DeviceDiscoveryErrors error);
00158 
00159 private slots:
00160 
00161    void sd_newServiceFound (const QBtDevice &targetDevice, const QBtService & service);
00162    void sd_serviceDiscoveryStarted ();
00163    void sd_serviceDiscoveryEnded ();
00164    void sd_error (QBtServiceDiscoverer::ServiceDiscoveryError error);
00165 
00166 
00167    //
00168    void dd_discoveryEnded ();
00169    void dd_discoveryStarted ();
00170    void dd_newDeviceFound (const QBtDevice & remoteDevice);
00171    void dd_error (QBtDeviceDiscoverer::DeviceDiscoveryErrors error );
00172 
00173 private:
00174 
00175    void _startDiscovery ();
00176 
00177 private:
00178 
00179     QBtDeviceDiscoverer    _deviceDiscoverer;
00180     QBtServiceDiscoverer   _serviceDiscoverer;
00181     QList<QBtUuid>         _targetServices;
00182 
00183     QList <QBtDevice>      _deviceList;
00184 
00185     int                    _deviceIndex;
00186     bool                   _aborted;
00187     
00188 
00189 };
00190 
00191 QBT_NAMESPACE_END
00192 
00193 #endif /* QBTSERVICEDISCOVERER_H_ */