![]() |
QBluetoothZero
2.0
|
00001 /* 00002 * QBtObjectExchangeClient.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 QBTOBJECTEXCHANGECLIENT_H_ 00021 #define QBTOBJECTEXCHANGECLIENT_H_ 00022 00023 #include <QBtGlobal.h> 00024 #include <QBtTypes.h> 00025 #include <QBtServiceAdvertiser.h> 00026 #include <QtCore/QObject> 00027 00028 QBT_NAMESPACE_BEGIN 00029 00030 //forward declaration 00031 class QBtObjectExchangeClientPrivate; 00032 00075 class DLL_EXPORT QBtObjectExchangeClient : public QObject 00076 { 00077 Q_OBJECT 00078 00079 public: 00080 enum ErrorCode{ 00081 OBEXClientConnectionError, 00082 OBEXClientSendError, 00083 OBEXClientReceiveError, 00084 OBEXClientDisconnected, 00085 OBEXClientInUse, 00086 OBEXClientInternalError, 00087 OBEXClientNoSelectedDevice, 00088 OBEXClientNoSelectedService, 00089 OBEXClientUnableToSetPath, 00090 OBEXFeatureNotSupported, 00091 OBEXClientBrowseError 00092 }; 00093 00094 public: 00095 QBtObjectExchangeClient(QObject* parent); 00096 ~QBtObjectExchangeClient(); 00097 00115 void connectToServer(const QBtDevice& remoteDevice, const QBtService& remoteService); 00116 00125 void getFile(const QString& remoteFileAbsolutePath, const QString& destinationFolder); 00126 00133 void getByteBuffer(const QString& dataName); 00134 00142 void putFile(const QString& fileName); 00143 00152 void putByteBuffer(const QByteArray& data, const QString& bufferName); 00153 00159 void abort(); 00160 00167 void setPath(const QString & path); 00168 00176 QString getWorkingPath(); 00177 00190 QList<QBtRemoteFileInfo*> initiateFolderBrowsing(const QString& folderPath = ""); 00191 00207 QList<QBtRemoteFileInfo*> locateFiles(QRegExp* regex=0, QString folder=""); 00208 00222 void batchFileRetrieval(const QList<QBtRemoteFileInfo*>& files, 00223 const QString destinationFolder, 00224 bool retrieveOnlyNewFiles = false); 00225 00230 QBtService& getTransmittingService(); 00231 00236 QBtDevice& getServerDevice(); 00237 00238 00242 bool isBusy() const; 00243 00247 bool isConnected() const; 00248 00249 public slots: 00250 void disconnect(); 00251 00252 signals: 00253 00257 void error(QBtObjectExchangeClient::ErrorCode code); 00258 00262 void connectedToServer(); 00263 00267 void disconnectedFromServer(); 00268 00272 void objectSent(); 00273 00278 void fileReceived (const QString & fileName); 00279 00283 void dataReceived (const QByteArray & data); 00284 00288 void remotePathSet (const QString & pathName); 00289 00296 void folderBrowsingResultElement(const QBtRemoteFileInfo& file); 00297 00298 private: 00299 friend class QBtObjectExchangeClientPrivate; 00300 QBtObjectExchangeClientPrivate* _implPtr; 00301 }; 00302 00303 QBT_NAMESPACE_END 00304 00305 //Q_DECLARE_METATYPE(QBT_PREPEND_NAMESPACE(QBtObjectExchangeClient)) 00306 00307 #endif /* QBTOBJECTEXCHANGECLIENT_H_ */