Version FC

Dependencies:   DmTftLibrary eeprom SX1280Lib filesystem mbed

Fork of MSNV2-Terminal_V1-5 by Francis CHATAIN

Component.hpp

Committer:
patrick_duc
Date:
2018-09-02
Revision:
20:b0281e8a375a
Parent:
19:4b147d8f9164
Child:
21:8524d815c587

File content as of revision 20:b0281e8a375a:

#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<Service*>& services) {
            this->id = id;
            this->services = services;
        }

        std::vector<Service*>& getServices() {
            return this->services;
        }

        COMPONENT_ID getId() {
            return this->id;
        }

        std::string toString() {
            std::ostringstream stringStream;
            stringStream << "Component id : " << this->id << std::endl;

            for(std::vector<Service*>::iterator it = services.begin(); it != services.end(); it++) {
                Service * service = *it;
                stringStream << service->toString() << std::endl;
            }

            return stringStream.str();
        }


    private:
        COMPONENT_ID            id;
        std::vector<Service*>   services;
};

#endif // __COMPONENT_HPP__