TTPA (Écran)  1.1
BTS SN-IR La Salle Avignon 2018
communicationbluetooth.h
Aller à la documentation de ce fichier.
00001 #ifndef COMMUNICATIONBLUETOOTH_H
00002 #define COMMUNICATIONBLUETOOTH_H
00003 
00012 #include <QtCore>
00013 #include <QApplication>
00014 #include "QextSerialPort/qextserialport.h"
00015 #include "const.h"
00016 
00017 #define PERIODE_SURVEILLANCE    200 
00024 class CommunicationBluetooth : public QObject
00025 {
00026     Q_OBJECT
00027 public:
00032     enum Mode
00033     {
00034         Scrutation,
00035         Evenement
00036     };
00044     explicit CommunicationBluetooth(QString nomPort = "rfcomm0", Mode mode = Scrutation, QObject *parent = 0);
00050     ~CommunicationBluetooth();
00051 
00057     void ouvrir();
00063     void fermer();
00069     int getEtatRFCOMM();
00070 
00071 private:
00072     QextSerialPort *m_pPortSerie; 
00073     bool fini; 
00074     QMutex mutex; 
00075     QWaitCondition waitCondition; 
00076     int periode; 
00077     int etatRFCOMM; 
00078     QTimer* timerSurveillance; 
00086     void msleep(unsigned long sleepMS)
00087     {
00088         waitCondition.wait(&mutex, sleepMS);
00089     }
00095     void annuler()
00096     {
00097         waitCondition.wakeAll();
00098     }
00104     void attendrePeriode();
00110     void demarrerRFCOMM();
00116     void redemarrerRFCOMM();
00123     QString lireEtatRFCOMM();
00124     QString lireEtatServiceRFCOMM();
00130     void arreterRFCOMM();    
00136     void recupererNomBluetooth();
00137 
00138 signals:
00145     void nouvellesDonneesRecues(QString donneesRecues);
00151     void deconnecterJoueur();
00157     void connecterJoueur();
00164     void setNomPeripherique(QString nom);
00165 
00166 public slots:
00172     void main();
00178     void finir();
00184     void terminer();
00190     void lirePort();
00196     void surveillerConnexion();
00197 };
00198 
00199 #endif // COMMUNICATIONBLUETOOTH_H
 Tout Classes Fichiers Fonctions Variables Énumérations Valeurs énumérées Macros