codes in progress

Dependents:   RUCHE2-CODES RUCHE2-CODES_correctionpoids RUCHE2-CODES

Committer:
Sidibe
Date:
Fri Jan 18 14:15:55 2019 +0000
Revision:
0:db9f881dd501
Child:
2:330f063d8cfa
corps du message

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sidibe 0:db9f881dd501 1 #ifndef MESSAGE_1_H
Sidibe 0:db9f881dd501 2 #define MESSAGE_1_H
Sidibe 0:db9f881dd501 3
Sidibe 0:db9f881dd501 4 #include "mbed.h"
Sidibe 0:db9f881dd501 5 #include "message.h"
Sidibe 0:db9f881dd501 6
Sidibe 0:db9f881dd501 7 class Message_1 : public Message {
Sidibe 0:db9f881dd501 8 public:
Sidibe 0:db9f881dd501 9 //Methodes:
Sidibe 0:db9f881dd501 10
Sidibe 0:db9f881dd501 11 //constructeur
Sidibe 0:db9f881dd501 12 Message_1(int messageType, int tempExt, int tempInt, int humidite, float masse):Message(messageType){
Sidibe 0:db9f881dd501 13 this->m_tempExt = this->parseToUint16_t(tempExt);
Sidibe 0:db9f881dd501 14 this->m_tempInt = this->parseToUint16_t(tempInt);
Sidibe 0:db9f881dd501 15 this->m_humidite = this->parseToUint16_t(humidite);
Sidibe 0:db9f881dd501 16 this->m_masse = this->parseToUint16_t(masse);
Sidibe 0:db9f881dd501 17 };
Sidibe 0:db9f881dd501 18
Sidibe 0:db9f881dd501 19 void send(){
Sidibe 0:db9f881dd501 20 char donnee[] = "AT$SF=";
Sidibe 0:db9f881dd501 21 this->sigfox.printf(donnee);
Sidibe 0:db9f881dd501 22 this->writeInSendBuffer(this->m_tempExt);
Sidibe 0:db9f881dd501 23 this->writeInSendBuffer(this->m_tempInt);
Sidibe 0:db9f881dd501 24 this->writeInSendBuffer(this->m_humidite);
Sidibe 0:db9f881dd501 25 this->writeInSendBuffer(this->m_masse);
Sidibe 0:db9f881dd501 26 this->sigfox.printf("\r");
Sidibe 0:db9f881dd501 27 };
Sidibe 0:db9f881dd501 28
Sidibe 0:db9f881dd501 29 //Accesseurs
Sidibe 0:db9f881dd501 30 int getTempExt() const{
Sidibe 0:db9f881dd501 31 return this->m_tempExt;
Sidibe 0:db9f881dd501 32 };
Sidibe 0:db9f881dd501 33
Sidibe 0:db9f881dd501 34 int getTempInt() const{
Sidibe 0:db9f881dd501 35 return this->m_tempInt;
Sidibe 0:db9f881dd501 36 };
Sidibe 0:db9f881dd501 37
Sidibe 0:db9f881dd501 38 int getHumidite() const{
Sidibe 0:db9f881dd501 39 return this->m_humidite;
Sidibe 0:db9f881dd501 40 };
Sidibe 0:db9f881dd501 41
Sidibe 0:db9f881dd501 42 float getMasse() const{
Sidibe 0:db9f881dd501 43 return this->m_masse;
Sidibe 0:db9f881dd501 44 };
Sidibe 0:db9f881dd501 45
Sidibe 0:db9f881dd501 46 private:
Sidibe 0:db9f881dd501 47 int16_t m_tempExt;
Sidibe 0:db9f881dd501 48 int16_t m_tempInt;
Sidibe 0:db9f881dd501 49 int16_t m_humidite;
Sidibe 0:db9f881dd501 50 int16_t m_masse;
Sidibe 0:db9f881dd501 51 };
Sidibe 0:db9f881dd501 52
Sidibe 0:db9f881dd501 53
Sidibe 0:db9f881dd501 54 #endif