liaison bluetooth entre gros robot -> panneau ou gros robot -> petit robot

Fork of liaison_Bluetooth by j d

Committer:
Sitkah
Date:
Wed May 09 19:36:00 2018 +0000
Revision:
16:1c3ff1ff1bc0
Parent:
15:7d159715eb14
pas en tenir compte;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
duperoux_j 0:f39d89bfe442 1 #ifndef LIAISON_BLUETOOTH_PANNEAU_GROSROB
duperoux_j 0:f39d89bfe442 2 #define LIAISON_BLUETOOTH_PANNEAU_GROSROB
duperoux_j 0:f39d89bfe442 3
duperoux_j 5:be0c602be047 4 #define MARQUEUR_DEBUT_TRAME '\x02'
duperoux_j 5:be0c602be047 5 #define MARQUEUR_FIN_TRAME '\x04'
duperoux_j 0:f39d89bfe442 6
duperoux_j 0:f39d89bfe442 7 #define PAQUET_IDENTIFIANT_RAFRAICHIRSCORE 0x30 //utilisé par le gros robot vers panneau domotique
duperoux_j 0:f39d89bfe442 8 #define PAQUET_IDENTIFIANT_FINMATCH 0x31 //utilisé par le gros robot vers panneau domotique
duperoux_j 0:f39d89bfe442 9 #define PAQUET_IDENTIFIANT_AJOUTERSCORE 0x32 //utilisé par le petit robot vers gros robot
duperoux_j 0:f39d89bfe442 10
duperoux_j 0:f39d89bfe442 11 #include <stdlib.h>
duperoux_j 0:f39d89bfe442 12 #include <string.h>
duperoux_j 5:be0c602be047 13 #include <math.h>
duperoux_j 0:f39d89bfe442 14 #include "mbed.h"
duperoux_j 0:f39d89bfe442 15
duperoux_j 0:f39d89bfe442 16 typedef struct {
duperoux_j 0:f39d89bfe442 17 int identifiant;
duperoux_j 5:be0c602be047 18 unsigned int longueur;
duperoux_j 0:f39d89bfe442 19 char *data;
duperoux_j 0:f39d89bfe442 20 } PaquetDomotique;
duperoux_j 0:f39d89bfe442 21
duperoux_j 5:be0c602be047 22 class LiaisonBluetooth
duperoux_j 5:be0c602be047 23 {
duperoux_j 5:be0c602be047 24 private:
duperoux_j 7:543d5548dbb9 25 Serial *m_bluetooth, *m_pc;
duperoux_j 5:be0c602be047 26 bool m_state;
duperoux_j 5:be0c602be047 27
duperoux_j 5:be0c602be047 28 public:
duperoux_j 7:543d5548dbb9 29 LiaisonBluetooth(Serial *bluetooth, Serial *pc);
duperoux_j 5:be0c602be047 30
duperoux_j 5:be0c602be047 31 bool paquet_en_attente();
duperoux_j 5:be0c602be047 32 PaquetDomotique *lire();
duperoux_j 15:7d159715eb14 33
duperoux_j 5:be0c602be047 34 void envoyer(char idenfitiant, int longueur_data, char *data);
duperoux_j 14:7118ea22e01f 35 void envoyer_short(char indentifiant, short data);
duperoux_j 0:f39d89bfe442 36 };
duperoux_j 0:f39d89bfe442 37
duperoux_j 5:be0c602be047 38 PaquetDomotique *creer_paquetdomotique(int identifiant, unsigned int longueur_data, char *data);
duperoux_j 0:f39d89bfe442 39 void detruire_paquetdomotique(PaquetDomotique *paquet);
duperoux_j 0:f39d89bfe442 40
duperoux_j 15:7d159715eb14 41 short convertir_score(PaquetDomotique *paquet);
duperoux_j 0:f39d89bfe442 42
duperoux_j 0:f39d89bfe442 43 #endif