Changeset 248

Show
Ignore:
Timestamp:
05/13/09 16:40:44 (15 years ago)
Author:
wrodgers
Message:

s

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vtcross/branches/wrodgers/ServiceManagementLayer.cpp

    r247 r248  
    66 
    77/* DESCRIPTION OF FILE. 
    8  */ multiple clients 
     8 */ 
    99 
    1010 
     
    1313#include <stdint.h> 
    1414 
    15 #include "../include/vtcross/common.h" 
    16 #include "../include/vtcross/components.h" 
    17 #include "../include/vtcross/containers.h" 
    18 #include "../include/vtcross/debug.h" 
    19 #include "../include/vtcross/error.h" 
    20 #include "../include/vtcross/socketcomm.h" 
     15#include "../../trunk/src/include/vtcross/common.h" 
     16#include "../../trunk/src/include/vtcross/components.h" 
     17#include "../../trunk/src/include/vtcross/containers.h" 
     18#include "../../trunk/src/include/vtcross/debug.h" 
     19#include "../../trunk/src/include/vtcross/error.h" 
     20#include "../../trunk/src/include/vtcross/socketcomm.h" 
     21 
     22 
     23#include <cstdlib> 
     24#include <cstring> 
     25#include <stdint.h> 
     26#include <math.h> 
     27 
     28 
     29#include <arpa/inet.h> 
     30#include <iostream> 
     31#include <netinet/in.h> 
     32#include <netdb.h> 
     33#include <fcntl.h> 
     34#include <sys/ioctl.h> 
     35#include <sys/mman.h> 
     36#include <sys/socket.h> 
     37#include <sys/types.h> 
     38#include <sys/wait.h> 
     39 
     40#include "tinyxml/tinyxml.h" 
     41#include "tinyxml/tinystr.h" 
     42 
     43#include <sqlite3.h> 
     44#include <sqlite3ext.h> 
    2145 
    2246uint32_t Current_ID = 0; 
     
    3054    shellSocketFD = -1; 
    3155    LoadConfiguration(); 
     56    numberOfCognitiveEngines = 0; 
    3257} 
    3358 
     
    102127    else if(strcmp(buffer, "query_component_type") == 0) { 
    103128        SendComponentType(); 
    104      } 
     129    } 
     130    else if(strcmp(buffer, "reset_sml") == 0) { 
     131        Reset(); 
     132    } 
     133    else if(strcmp(buffer, "shutdown_sml") == 0) { 
     134        Shutdown(); 
     135    } 
    105136} 
    106137 
     
    120151 
    121152void 
    122 CognitiveRadioShell::RegisterCognitiveEngine(int32_t ID) 
     153ServiceManagementLayer::RegisterCognitiveEngine(int32_t ID) 
    123154{ 
    124155    LOG("Cognitive Radio Shell:: Received registration message from Cognitive Engine.\n"); 
    125156    
    126157    TransferRadioConfiguration(ID); 
    127     TransferRadioExperience(ID); 
     158    TransferExperience(ID); 
    128159 
    129160    numberOfCognitiveEngines++; 
     
    133164 
    134165void  
    135 CognitiveRadioShell::DeregisterCognitiveEngine(int32_t socketFD) 
     166ServiceManagementLayer::DeregisterCognitiveEngine(int32_t socketFD) 
    136167{ 
    137168    LOG("Cognitive Radio Shell:: Received deregistration message from Cognitive Engine.\n"); 
     
    146177    LOG("Cognitive Radio Shell:: Socket closed.\n"); 
    147178} 
    148         } 
    149         else if(strcmp(buffer, "reset_sml") == 0) { 
    150             Reset(); 
    151         } 
    152         else if(strcmp(buffer, "shutdown_sml") == 0) { 
    153             Shutdown(); 
    154         } 
    155     } 
    156 } 
    157179 
    158180 
     
    237259 
    238260void 
    239 CognitiveRadioShell::RegisterCognitiveEngine(int32_t socketFD) 
     261ServiceManagementLayer::RegisterCognitiveEngine(int32_t socketFD) 
    240262{ 
    241263    SendMessage(commandSocketFD, "register_engine_cognitive"); 
     
    243265 
    244266    TransferRadioConfiguration(socketFD); 
    245     TransferRadioExperience(socketFD); 
     267    TransferExperience(socketFD); 
    246268 
    247269    numberOfCognitiveEngines++; 
     
    251273 
    252274void  
    253 CognitiveRadioShell::DeregisterCognitiveEngine(int32_t socketFD) 
     275ServiceManagementLayer::DeregisterCognitiveEngine(int32_t socketFD) 
    254276{ 
    255277    LOG("Cognitive Radio Shell:: Received deregistration message from Cognitive Engine.\n"); 
     
    266288 
    267289void 
    268 CognitiveRadioShell::StartSMLServer() 
     290ServiceManagementLayer::StartSMLServer() 
    269291{ 
    270292    struct timeval selTimeout; 
     
    278300    int32_t maxDescriptor = cogEngSrv; 
    279301 
    280     if(InitializeTCPServerPort(cogEngSrv) == -1) 
     302    if(InitianumberOfCognitiveEngineslizeTCPServerPort(cogEngSrv) == -1) 
    281303        ERROR(1,"Error initializing primary port\n"); 
    282304