Version FC
Dependencies: DmTftLibrary eeprom SX1280Lib filesystem mbed
Fork of MSNV2-Terminal_V1-5 by
Component.hpp
- Committer:
- patrick_duc
- Date:
- 2018-10-16
- Branch:
- Integration
- Revision:
- 37:b565750d9978
- Parent:
- 32:3bef9b81f639
- Child:
- 38:9b43b2415093
File content as of revision 37:b565750d9978:
#ifndef __COMPONENT_HPP__ #define __COMPONENT_HPP__ #include "Context.h" #include <vector> #include <sstream> #include "Service.hpp" namespace misnet { class Component; } class misnet::Component { public: enum COMPONENT_ID { HTS221 = 1, LPS22HB = 2, LSM303A = 3, LSM6DSL = 4, BME280 = 5, DS18B20 = 6 }; Component(COMPONENT_ID id, std::vector<misnet::Service*>& services) { this->id = id; this->services = services; } std::vector<misnet::Service*>& getServices() { return this->services; } COMPONENT_ID getId() { return this->id; } // Loop on all component services to read their value void readValues(std::vector<misnet::Service *> servicesWithAsynchronousRead) { for (std::vector<misnet::Service*>::iterator srvIt = this->services.begin(); srvIt != this->services.end(); srvIt++) { (*srvIt)->readValue(servicesWithAsynchronousRead); } } std::string toString() { std::ostringstream stringStream; stringStream << "Component id : " << this->id << std::endl; for (std::vector<misnet::Service*>::iterator it = services.begin(); it != services.end(); it++) { misnet::Service * service = *it; stringStream << service->toString() << std::endl; } return stringStream.str(); } private: COMPONENT_ID id; std::vector<misnet::Service*> services; }; #endif // __COMPONENT_HPP__