Version FC

Dependencies:   DmTftLibrary eeprom SX1280Lib filesystem mbed

Fork of MSNV2-Terminal_V1-5 by Francis CHATAIN

Revision:
20:b0281e8a375a
Parent:
19:4b147d8f9164
Child:
21:8524d815c587
--- a/Component.hpp	Thu Aug 30 08:48:19 2018 +0000
+++ b/Component.hpp	Sun Sep 02 22:24:14 2018 +0000
@@ -1,10 +1,20 @@
 #ifndef __COMPONENT_HPP__
 #define __COMPONENT_HPP__
 
+#include "Context.h"
+
 #include <vector>
+#include <sstream>
+
 #include "Service.hpp"
 
-class Component {
+
+namespace misnet {
+    class Component;
+}
+
+
+class misnet::Component {
 
     public:
         enum COMPONENT_ID {
@@ -16,25 +26,35 @@
             DS18B20   = 6 
         } ;
 
-        Component(COMPONENT_ID id, std::vector<Service*>& channels) {
+        Component(COMPONENT_ID id, std::vector<Service*>& services) {
             this->id = id;
-            this->channels = channels;
+            this->services = services;
         }
 
         std::vector<Service*>& getServices() {
-            return this->channels;
+            return this->services;
         }
 
         COMPONENT_ID getId() {
             return this->id;
         }
 
-        friend std::ostream& operator<<(std::ostream&, const Component &);
+        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*>   channels;
+        std::vector<Service*>   services;
 };
 
 #endif // __COMPONENT_HPP__