liaison bluetooth entre gros robot -> panneau ou gros robot -> petit robot
Fork of liaison_Bluetooth by
Liaison_Bluetooth_panneau_grosRob.h@0:f39d89bfe442, 2018-04-11 (annotated)
- Committer:
- duperoux_j
- Date:
- Wed Apr 11 12:29:00 2018 +0000
- Revision:
- 0:f39d89bfe442
first commit
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:f39d89bfe442 | 4 | #define MARQUEUR_DEBUT_TRAME 0x2 |
duperoux_j | 0:f39d89bfe442 | 5 | #define MARQUEUR_FIN_TRAME 0x4 |
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 | 0:f39d89bfe442 | 13 | #include "mbed.h" |
duperoux_j | 0:f39d89bfe442 | 14 | |
duperoux_j | 0:f39d89bfe442 | 15 | typedef struct { |
duperoux_j | 0:f39d89bfe442 | 16 | int identifiant; |
duperoux_j | 0:f39d89bfe442 | 17 | char *data; |
duperoux_j | 0:f39d89bfe442 | 18 | } PaquetDomotique; |
duperoux_j | 0:f39d89bfe442 | 19 | |
duperoux_j | 0:f39d89bfe442 | 20 | class LiaisonBluetooth { |
duperoux_j | 0:f39d89bfe442 | 21 | private: |
duperoux_j | 0:f39d89bfe442 | 22 | Serial m_bluetooth; |
duperoux_j | 0:f39d89bfe442 | 23 | DigitalIn m_state; |
duperoux_j | 0:f39d89bfe442 | 24 | |
duperoux_j | 0:f39d89bfe442 | 25 | public: |
duperoux_j | 0:f39d89bfe442 | 26 | LiaisonBluetooth(Serial bluetooth, DigitalIn state); |
duperoux_j | 0:f39d89bfe442 | 27 | |
duperoux_j | 0:f39d89bfe442 | 28 | bool paquet_en_attente(); |
duperoux_j | 0:f39d89bfe442 | 29 | PaquetDomotique *lire(); |
duperoux_j | 0:f39d89bfe442 | 30 | |
duperoux_j | 0:f39d89bfe442 | 31 | void envoyer(char idenfitiant, int longueur_data, char *data); |
duperoux_j | 0:f39d89bfe442 | 32 | }; |
duperoux_j | 0:f39d89bfe442 | 33 | |
duperoux_j | 0:f39d89bfe442 | 34 | PaquetDomotique *creer_paquetdomotique(int identifiant, char *data); |
duperoux_j | 0:f39d89bfe442 | 35 | void detruire_paquetdomotique(PaquetDomotique *paquet); |
duperoux_j | 0:f39d89bfe442 | 36 | |
duperoux_j | 0:f39d89bfe442 | 37 | char *convertir_int_en_4char(int integer); |
duperoux_j | 0:f39d89bfe442 | 38 | int convertir_4char_en_int(char *data); |
duperoux_j | 0:f39d89bfe442 | 39 | |
duperoux_j | 0:f39d89bfe442 | 40 | #endif |