Version FC

Dependencies:   DmTftLibrary eeprom SX1280Lib filesystem mbed

Fork of MSNV2-Terminal_V1-5 by Francis CHATAIN

DataBase.cpp

Committer:
patrick_duc
Date:
2018-08-30
Revision:
19:4b147d8f9164
Parent:
18:d5e7e56b0a0d
Child:
20:b0281e8a375a

File content as of revision 19:4b147d8f9164:

/*
 * MISNet   
 *
 *  Frame:   Gestionnaire de fabrication des messages et décodage des messages recus 
 *
 *  Created on: August 17, 2018       Author: Francis CHATAIN
 *
 */

// =====================================  Includes

//#include "main.h"
#include "DataBase.h"

// =====================================  Method of class


// =====================================  Constructor 
DataBase::DataBase () {} 
DataBase::~DataBase () {} 

void DataBase::init () {}


void DataBase::getRadioParameter (uint32_t              &rfFrequency, 
                        RadioLoRaBandwidths_t           &loraBw,
                        RadioLoRaSpreadingFactors_t     &loraSf ,
                        int8_t                          &txOutputPower,
                        uint8_t                         &bufferSizeMax,
                        int16_t                         &timer) 
{                            
    rfFrequency     =    _RF_FREQUENCY           ;   
    loraBw          =    _LORA_BW                ;   
    loraSf          =    _LORA_SF                ;   
    txOutputPower   =    _TX_OUTPUT_POWER        ;   
    bufferSizeMax   =    _BUFFER_SIZE_MAX        ;   
    timer           =    _TIMER                  ;   
}


void DataBase::setRadioParameter ( uint32_t             rfFrequency, 
                        RadioLoRaBandwidths_t           loraBw,
                        RadioLoRaSpreadingFactors_t     loraSf ,
                        int8_t                          txOutputPower,
                        uint8_t                         bufferSizeMax,
                        int16_t                         timer) 
{
    _RF_FREQUENCY = rfFrequency   ;   
    _LORA_BW = loraBw             ;   
    _LORA_SF = loraSf             ;   
    _TX_OUTPUT_POWER = txOutputPower      ;   
    _BUFFER_SIZE_MAX  = bufferSizeMax     ;   
    _TIMER  = timer                       ;    
    
     
     printf( "*** DTB ***  setRadioParameter   %ld %d %d %d %d %d \r\n",_RF_FREQUENCY, _LORA_BW, _LORA_SF, _TX_OUTPUT_POWER, 
     _BUFFER_SIZE_MAX,_TIMER );                              
}

short DataBase::getNbService(Service::DEVICE_TYPE deviceType) {
    short result = 0;

    std::vector<Service*> channels = this->_payload->getServices();

    for(std::vector<Service*>::iterator it = channels.begin(); it != channels.end(); it++) {
        Service* channel = *it;
        if (channel->getDeviceType() == deviceType) {
            result++;
        }
    }

    return result;
}

Service::DEVICE_TYPE DataBase::getServiceType (short channelRank) {
    return this->_payload->getServiceByRank(channelRank)->getDeviceType();
}