Projet TTPA (Table Tennis Performance Analyser)  1.3
BTS SN 2019
ecran-TTPA/communicationbluetooth.h
Aller à la documentation de ce fichier.
1 #ifndef COMMUNICATIONBLUETOOTH_H
2 #define COMMUNICATIONBLUETOOTH_H
3 
4 #include <qglobal.h>
5 #include <QObject>
6 #include <QLabel>
7 #include <QBluetoothLocalDevice>
8 #include <QBluetoothDeviceInfo>
9 #include <QBluetoothDeviceDiscoveryAgent>
10 #include <QBluetoothSocket>
11 #include <QBluetoothServer>
12 #include <unistd.h> //usleep
13 
26 static const QString serviceUuid(QStringLiteral("00001101-0000-1000-8000-00805F9B34FB"));
27 static const QString serviceNom(QStringLiteral("raspberry"));
28 
29 class CommunicationBluetooth: public QObject
30 {
31  Q_OBJECT
32 
33  public:
34  CommunicationBluetooth(QObject *parent=nullptr);
36 
38  {
39  Initial = 0,
40  EnCours = 1,
43  };
44 
46  void demarrer();
47  void arreter();
48 
49  private:
50  QBluetoothLocalDevice monBluetooth;
51  QBluetoothServer *serveur;
52  QBluetoothSocket *socket;
53  QBluetoothServiceInfo serviceInfo;
54  QString nom;
55  QString adresse;
59 
60  void decoderTrame(QString trame);
61 
62  public slots:
63  void nouveauClient();
64  void socketConnected();
65  void socketDisconnected();
66  void socketReadyRead();
67  void socketErreur(QBluetoothSocket::SocketError error);
68  void deviceConnected(const QBluetoothAddress &adresse);
69  void deviceDisconnected(const QBluetoothAddress &adresse);
70  void error(QBluetoothLocalDevice::Error erreur);
71 
72  signals:
73  void connecte();
74  void erreur();
75  void impactZone(QString numeroZone);
76  void departSeance(QString nomJoueur, QString zoneObjectif, QString zoneRobot);
77  void mettreEnPauseSeance();
78  void repriseSeance();
79  void finSeance();
80  void resetSeance();
81 };
82 #endif // COMMUNICATIONBLUETOOTH_H
void mettreEnPauseSeance()
Met la séance en pause.
Definition: terminal-TTPA/communicationbluetooth.cpp:205
QString adresse
Definition: ecran-TTPA/communicationbluetooth.h:55
void socketConnected()
la socket est connecté
Definition: ecran-TTPA/communicationbluetooth.cpp:72
void socketReadyRead()
la socket est prête à lire les informations
Definition: ecran-TTPA/communicationbluetooth.cpp:98
void socketDisconnected()
la socket est déconnecté
Definition: ecran-TTPA/communicationbluetooth.cpp:85
EtatSeance getEtatSeance()
Definition: ecran-TTPA/communicationbluetooth.cpp:209
void impactZone(QString numeroZone)
static const QString serviceNom(QStringLiteral("raspberry"))
bool connexionErreur
Savoir si il a une erreur de connexion.
Definition: ecran-TTPA/communicationbluetooth.h:57
QBluetoothServiceInfo serviceInfo
Definition: ecran-TTPA/communicationbluetooth.h:53
QString nom
Definition: ecran-TTPA/communicationbluetooth.h:54
QBluetoothLocalDevice monBluetooth
Definition: ecran-TTPA/communicationbluetooth.h:50
Definition: ecran-TTPA/communicationbluetooth.h:40
void departSeance(QString nomJoueur, QString zoneObjectif, QString zoneRobot)
void demarrer()
demarre le serveur
Definition: ecran-TTPA/communicationbluetooth.cpp:218
EtatSeance
Definition: ecran-TTPA/communicationbluetooth.h:37
Definition: ecran-TTPA/communicationbluetooth.h:39
QBluetoothSocket * socket
la socket
Definition: ecran-TTPA/communicationbluetooth.h:52
EtatSeance etatSeance
Definition: ecran-TTPA/communicationbluetooth.h:58
void deviceConnected(const QBluetoothAddress &adresse)
Definition: ecran-TTPA/communicationbluetooth.cpp:271
CommunicationBluetooth()
Définition du constructeur la classe CommunicationBluetooth.
Definition: terminal-TTPA/communicationbluetooth.cpp:19
QBluetoothServer * serveur
Definition: ecran-TTPA/communicationbluetooth.h:51
void decoderTrame(QString trame)
permet de décoder la trame émise par le terminal mobile
Definition: ecran-TTPA/communicationbluetooth.cpp:123
Definition: ecran-TTPA/communicationbluetooth.h:41
Assure la détection des périphériques TTPA, leur connexion (et déconnexion) et une communication (env...
Definition: ecran-TTPA/communicationbluetooth.h:29
void deviceDisconnected(const QBluetoothAddress &adresse)
Definition: ecran-TTPA/communicationbluetooth.cpp:276
void arreter()
arrete le serveur
Definition: ecran-TTPA/communicationbluetooth.cpp:235
Definition: ecran-TTPA/communicationbluetooth.h:42
void nouveauClient()
Definition: ecran-TTPA/communicationbluetooth.cpp:255
bool etatConnexion
L&#39;état de connexion.
Definition: ecran-TTPA/communicationbluetooth.h:56
void socketErreur(QBluetoothSocket::SocketError error)
la socket indique une erreur de connexion
Definition: ecran-TTPA/communicationbluetooth.cpp:202
void error(QBluetoothLocalDevice::Error erreur)
Definition: ecran-TTPA/communicationbluetooth.cpp:281
static const QString serviceUuid(QStringLiteral("00001101-0000-1000-8000-00805F9B34FB"))
~CommunicationBluetooth()
Définition du destructeur la classe CommunicationBluetooth.
Definition: ecran-TTPA/communicationbluetooth.cpp:60