Changeset 248 for vtcross/branches
- Timestamp:
- 05/13/09 16:40:44 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/branches/wrodgers/ServiceManagementLayer.cpp
r247 r248 6 6 7 7 /* DESCRIPTION OF FILE. 8 */ multiple clients8 */ 9 9 10 10 … … 13 13 #include <stdint.h> 14 14 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> 21 45 22 46 uint32_t Current_ID = 0; … … 30 54 shellSocketFD = -1; 31 55 LoadConfiguration(); 56 numberOfCognitiveEngines = 0; 32 57 } 33 58 … … 102 127 else if(strcmp(buffer, "query_component_type") == 0) { 103 128 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 } 105 136 } 106 137 … … 120 151 121 152 void 122 CognitiveRadioShell::RegisterCognitiveEngine(int32_t ID)153 ServiceManagementLayer::RegisterCognitiveEngine(int32_t ID) 123 154 { 124 155 LOG("Cognitive Radio Shell:: Received registration message from Cognitive Engine.\n"); 125 156 126 157 TransferRadioConfiguration(ID); 127 Transfer RadioExperience(ID);158 TransferExperience(ID); 128 159 129 160 numberOfCognitiveEngines++; … … 133 164 134 165 void 135 CognitiveRadioShell::DeregisterCognitiveEngine(int32_t socketFD)166 ServiceManagementLayer::DeregisterCognitiveEngine(int32_t socketFD) 136 167 { 137 168 LOG("Cognitive Radio Shell:: Received deregistration message from Cognitive Engine.\n"); … … 146 177 LOG("Cognitive Radio Shell:: Socket closed.\n"); 147 178 } 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 }157 179 158 180 … … 237 259 238 260 void 239 CognitiveRadioShell::RegisterCognitiveEngine(int32_t socketFD)261 ServiceManagementLayer::RegisterCognitiveEngine(int32_t socketFD) 240 262 { 241 263 SendMessage(commandSocketFD, "register_engine_cognitive"); … … 243 265 244 266 TransferRadioConfiguration(socketFD); 245 Transfer RadioExperience(socketFD);267 TransferExperience(socketFD); 246 268 247 269 numberOfCognitiveEngines++; … … 251 273 252 274 void 253 CognitiveRadioShell::DeregisterCognitiveEngine(int32_t socketFD)275 ServiceManagementLayer::DeregisterCognitiveEngine(int32_t socketFD) 254 276 { 255 277 LOG("Cognitive Radio Shell:: Received deregistration message from Cognitive Engine.\n"); … … 266 288 267 289 void 268 CognitiveRadioShell::StartSMLServer()290 ServiceManagementLayer::StartSMLServer() 269 291 { 270 292 struct timeval selTimeout; … … 278 300 int32_t maxDescriptor = cogEngSrv; 279 301 280 if(Initia lizeTCPServerPort(cogEngSrv) == -1)302 if(InitianumberOfCognitiveEngineslizeTCPServerPort(cogEngSrv) == -1) 281 303 ERROR(1,"Error initializing primary port\n"); 282 304