Version FC

Dependencies:   DmTftLibrary eeprom SX1280Lib filesystem mbed

Fork of MSNV2-Terminal_V1-5 by Francis CHATAIN

Revision:
13:5414193da1de
Parent:
10:1b37e3b41947
Child:
18:d5e7e56b0a0d
--- a/DataBase.cpp	Thu Aug 23 14:23:46 2018 +0000
+++ b/DataBase.cpp	Mon Aug 27 16:32:50 2018 +0000
@@ -9,7 +9,7 @@
 
 // =====================================  Includes
 
-#include "main.h"
+//#include "main.h"
 #include "DataBase.h"
 
 // =====================================  Method of class
@@ -35,10 +35,9 @@
     txOutputPower   =    _TX_OUTPUT_POWER        ;   
     bufferSizeMax   =    _BUFFER_SIZE_MAX        ;   
     timer           =    _TIMER                  ;   
-} 
+}
 
-  
-                        
+
 void DataBase::setRadioParameter ( uint32_t             rfFrequency, 
                         RadioLoRaBandwidths_t           loraBw,
                         RadioLoRaSpreadingFactors_t     loraSf ,
@@ -58,9 +57,29 @@
      _BUFFER_SIZE_MAX,_TIMER );                              
 }
 
+short DataBase::getNbChannel(Channel::DEVICE_TYPE deviceType) {
+    short result = 0;
 
-void DataBase::createChannel        (
-                                        int                     id , 
+    std::vector<Channel*> channels = this->_payload->getChannels();
+
+    for(std::vector<Channel*>::iterator it = channels.begin(); it != channels.end(); it++) {
+        Channel* channel = *it;
+        if (channel->getDeviceType() == deviceType) {
+            result++;
+        }
+    }
+
+    return result;
+}
+
+Channel::DEVICE_TYPE DataBase::getChannelType (short channelRank) {
+    return Channel::SENSOR;
+    //return this->payload.getChannel(channelRank).getDeviceType();
+}
+
+/*
+Channel& DataBase::createChannel        (
+                                        int                     id ,
                                         CHANNEL_DEVICE_TYPE     typeDevice, 
                                         CHANNEL_COMPONENT_ID    componentID, 
                                         CHANNEL_GROUP           group,
@@ -82,5 +101,6 @@
                                         CHANNEL_ACTION          action, 
                                         CHANNEL_OUTPUT          ouputType
                                         ) {
+    Channel channel = new Channel();
 }
-
+*/