Changeset 208
- Timestamp:
- 03/26/09 12:21:13 (15 years ago)
- Location:
- vtcross/trunk/src
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/trunk/src/include/vtcross/components.h
r207 r208 343 343 bool CE_present; 344 344 345 345 int32_t numberOfCognitiveEngines; 346 346 int16_t primaryPort; 347 347 int16_t policyPort; -
vtcross/trunk/src/shell/CognitiveRadioShell.cpp
r207 r208 124 124 numberOfCognitiveEngines--; 125 125 if(numberOfCognitiveEngines == 0) 126 126 CE_present = false; 127 127 128 128 SendMessage(socketFD, "deregister_ack"); … … 216 216 const char *uName = pChild->Attribute("name"); 217 217 if(uName) 218 uList[item_count].name = uName; 218 uList[item_count].name = uName; 219 219 220 220 const char *uUnits = pChild->Attribute("units"); … … 232 232 } 233 233 234 radio_info->numUtilities = item_count; 234 radio_info->numUtilities = item_count; 235 235 LOG("Cognitive Radio Shell:: Parsed %d utilities.\n", radioInfo->numUtilities); 236 236 … … 245 245 if(oName) 246 246 oList[item_count].name = oName; 247 247 248 248 affect_count = 0; 249 249 for(pSecondChild = pChild->FirstChildElement("affect"); pSecondChild; \ … … 273 273 } 274 274 else 275 match_found = false; 275 match_found = false; 276 276 } 277 277 oList[item_count].numAffects = affect_count; … … 279 279 } 280 280 281 radioInfo->numObservables = item_count; 281 radioInfo->numObservables = item_count; 282 282 LOG("Cognitive Radio Shell:: Parsed %d observables.\n", radioInfo->numObservables); 283 283 284 284 pElem = hRoot.FirstChild("parameters").Element(); 285 285 pChild1 = hRoot.Child("parameters", count).Element(); 286 286 287 287 item_count = 0; 288 288 for(pChild = pChild1->FirstChildElement("parameter"); pChild; \ … … 291 291 const char *pName = pChild->Attribute("name"); 292 292 if(pName) 293 pList[item_count].name = pName; 293 pList[item_count].name = pName; 294 294 295 295 const char *pUnits = pChild->Attribute("units"); … … 305 305 if(pChild->QueryFloatAttribute("step", &pList[item_count].step) != TIXML_SUCCESS) 306 306 pList[item_count].step = -1; 307 307 308 308 affect_count = 0; 309 309 for(pSecondChild = pChild->FirstChildElement("affect"); pSecondChild; \ … … 317 317 if(uList[attribute_count].name == pUtilName) 318 318 { 319 pList[item_count].affection_list[affect_count].u = &uList[attribute_count]; 319 pList[item_count].affection_list[affect_count].u = &uList[attribute_count]; 320 320 321 321 const char *pRelate = pSecondChild->Attribute("relationship"); … … 338 338 } 339 339 340 match_found = false; 340 match_found = false; 341 341 } 342 342 … … 367 367 368 368 if(strcmp(buffer,"register_engine_cognitive") == 0) { 369 369 RegisterCognitiveEngine(socketFD); 370 370 } else if(strcmp(buffer,"deregister_engine_cognitive") == 0) { 371 371 DeregisterCognitiveEngine(socketFD); 372 372 } else if(strcmp(buffer,"register_engine_policy") == 0) { 373 373 RegisterPolicyEngine(socketFD); 374 374 } else if(strcmp(buffer,"deregister_engine_policy") == 0) { 375 375 DeregisterPolicyEngine(socketFD); 376 376 } else if(strcmp(buffer,"register_sml") == 0) { 377 377 RegisterSML(socketFD); 378 378 } else if(strcmp(buffer,"deregister_sml") == 0) { 379 379 DeregisterSML(socketFD); 380 380 } else if(strcmp(buffer,"optimize") == 0) { 381 382 381 /* Receive optimization request and current environment */ 382 GetOptimalParameters(socketFD); 383 383 } 384 384 } … … 407 407 408 408 if(InitializeTCPServerPort(servSock[primary]) == -1) { 409 410 409 ERROR(1,"Error initializing primary port\n"); 410 return; 411 411 } 412 412 413 413 if(InitializeTCPServerPort(servSock[policy]) == -1) { 414 415 414 ERROR(1,"Error initializing policy port\n"); 415 return; 416 416 } 417 417 418 418 if(InitializeTCPServerPort(servSock[command]) == -1) { 419 420 419 ERROR(1,"Error initializing command port\n"); 420 return; 421 421 } 422 422 … … 446 446 if (FD_ISSET(port, &sockSet)) 447 447 { 448 448 desc_ready -= 1; 449 449 450 450 /* Check if request is new or on an existing open descriptor */