implementação do sgam_mdw baseado na placa NUCLEO FZ429ZI para ser testada
Dependencies: MPU6050 Grove_temperature
ControlImpl.cpp@14:5ab232a10f33, 2019-07-13 (annotated)
- Committer:
- AndersonIctus
- Date:
- Sat Jul 13 15:21:57 2019 +0000
- Revision:
- 14:5ab232a10f33
- Parent:
- 7:8db3e62ac4e2
- Child:
- 15:11e13881c385
- refactory
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AndersonIctus | 1:f21c2f775f15 | 1 | #include "sgam_mdw.h" |
AndersonIctus | 3:f67352c85fd7 | 2 | #include "mbed.h" |
AndersonIctus | 3:f67352c85fd7 | 3 | |
AndersonIctus | 0:681d98ff3681 | 4 | #include "ControlImpl.h" |
AndersonIctus | 3:f67352c85fd7 | 5 | #include "Temperature.h" |
AndersonIctus | 5:fa36c3288be8 | 6 | #include "Gyroscope.h" |
AndersonIctus | 14:5ab232a10f33 | 7 | #include "LoRaWanComm.h" |
AndersonIctus | 3:f67352c85fd7 | 8 | |
AndersonIctus | 3:f67352c85fd7 | 9 | I2C i2c(I2C_SDA, I2C_SCL); |
AndersonIctus | 3:f67352c85fd7 | 10 | |
AndersonIctus | 6:806043bf1a2c | 11 | ControlImpl::ControlImpl() { |
AndersonIctus | 7:8db3e62ac4e2 | 12 | // Incluindo os Protocolos |
AndersonIctus | 7:8db3e62ac4e2 | 13 | // includeSensor( new Protocol() ) |
AndersonIctus | 7:8db3e62ac4e2 | 14 | |
AndersonIctus | 7:8db3e62ac4e2 | 15 | // Incluindo os Sensores |
AndersonIctus | 7:8db3e62ac4e2 | 16 | includeSensor( (Sensor<void*>*) new Temperature(A1) ); |
AndersonIctus | 7:8db3e62ac4e2 | 17 | includeSensor( (Sensor<void*>*) new Gyroscope(i2c) ); |
AndersonIctus | 7:8db3e62ac4e2 | 18 | |
AndersonIctus | 7:8db3e62ac4e2 | 19 | // Incluindo Comunicacoes |
AndersonIctus | 7:8db3e62ac4e2 | 20 | includeCommunication( (Communication<void*>*)new LoRAWanComm("") ); |
AndersonIctus | 6:806043bf1a2c | 21 | } |
AndersonIctus | 3:f67352c85fd7 | 22 | |
AndersonIctus | 6:806043bf1a2c | 23 | ControlImpl::~ControlImpl() { |
AndersonIctus | 3:f67352c85fd7 | 24 | } |
AndersonIctus | 3:f67352c85fd7 | 25 | |
AndersonIctus | 1:f21c2f775f15 | 26 | void ControlImpl::initialize() { |
AndersonIctus | 3:f67352c85fd7 | 27 | // possiveis inicializacoes no sistema ! |
AndersonIctus | 6:806043bf1a2c | 28 | D_LOG("Inicializando o Controler !\r\n"); |
AndersonIctus | 6:806043bf1a2c | 29 | |
AndersonIctus | 6:806043bf1a2c | 30 | // INICIALIZANDO ... |
AndersonIctus | 6:806043bf1a2c | 31 | // protocolos ... |
AndersonIctus | 7:8db3e62ac4e2 | 32 | // for (std::map<std::string, Protocol*>::iterator it=mp_protocols.begin(); it!=mp_protocols.end(); ++it) |
AndersonIctus | 7:8db3e62ac4e2 | 33 | // it->second->initialize(); |
AndersonIctus | 6:806043bf1a2c | 34 | |
AndersonIctus | 7:8db3e62ac4e2 | 35 | // // sensores ... |
AndersonIctus | 7:8db3e62ac4e2 | 36 | // for (std::map<std::string, Sensor<void*>*>::iterator it=mp_sensors.begin(); it!=mp_sensors.end(); ++it) |
AndersonIctus | 7:8db3e62ac4e2 | 37 | // it->second->initialize(); |
AndersonIctus | 6:806043bf1a2c | 38 | |
AndersonIctus | 7:8db3e62ac4e2 | 39 | // // comunicacoes ... |
AndersonIctus | 7:8db3e62ac4e2 | 40 | // for (std::map<std::string, Communication<void*>*>::iterator it=mp_communications.begin(); it!=mp_communications.end(); ++it) |
AndersonIctus | 7:8db3e62ac4e2 | 41 | // it->second->initialize(); |
AndersonIctus | 3:f67352c85fd7 | 42 | } |
AndersonIctus | 1:f21c2f775f15 | 43 | |
AndersonIctus | 3:f67352c85fd7 | 44 | void ControlImpl::finalize() { |
AndersonIctus | 7:8db3e62ac4e2 | 45 | // // comunicacoes ... |
AndersonIctus | 7:8db3e62ac4e2 | 46 | // for (std::map<std::string, Communication<void*>*>::iterator it=mp_communications.begin(); it!=mp_communications.end(); ++it) |
AndersonIctus | 7:8db3e62ac4e2 | 47 | // it->second->finalize(); |
AndersonIctus | 7:8db3e62ac4e2 | 48 | |
AndersonIctus | 7:8db3e62ac4e2 | 49 | // // sensores ... |
AndersonIctus | 7:8db3e62ac4e2 | 50 | // for (std::map<std::string, Sensor<void*>*>::iterator it=mp_sensors.begin(); it!=mp_sensors.end(); ++it) |
AndersonIctus | 7:8db3e62ac4e2 | 51 | // it->second->finalize(); |
AndersonIctus | 7:8db3e62ac4e2 | 52 | |
AndersonIctus | 7:8db3e62ac4e2 | 53 | // // protocolos ... |
AndersonIctus | 7:8db3e62ac4e2 | 54 | // for (std::map<std::string, Protocol*>::iterator it=mp_protocols.begin(); it!=mp_protocols.end(); ++it) |
AndersonIctus | 7:8db3e62ac4e2 | 55 | // it->second->finalize(); |
AndersonIctus | 3:f67352c85fd7 | 56 | } |
AndersonIctus | 1:f21c2f775f15 | 57 | |
AndersonIctus | 7:8db3e62ac4e2 | 58 | // metodo de instancia unica |
AndersonIctus | 1:f21c2f775f15 | 59 | Control* ControlImpl::getControler() { |
AndersonIctus | 1:f21c2f775f15 | 60 | return this; |
AndersonIctus | 1:f21c2f775f15 | 61 | } |