Changeset 99
- Timestamp:
- 02/16/09 17:03:33 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/trunk/CR_engines/CBR/src/main_cognitive_engine.c
r95 r99 73 73 if (n < 0) 74 74 error("ERROR reading from socket"); 75 //printf("ReadMessage:%s %d\n",buffer,n);75 //printf("ReadMessage:%s %d\n",buffer,n); 76 76 } 77 77 … … 398 398 "log10_ber", "mod_scheme", "tx_power", "SNR", "utility"};*/ 399 399 //char cols[num_cols][50]; 400 400 401 401 402 char **cols; 402 403 cols = (char **)malloc(sizeof(char)*num_cols); … … 423 424 cols[j] = "utility"; 424 425 425 printf("column names:");426 for (i = 0; i<num_cols; i++){427 printf(" %s",cols[i]);428 }429 printf("\n");426 //printf("column names:"); 427 //for (i = 0; i<num_cols; i++){ 428 // printf(" %s",cols[i]); 429 //} 430 //printf("\n"); 430 431 431 432 int rc; … … 530 531 } 531 532 533 int RegisterCE(int sockfd, struct Utility uList[], struct Parameter pList[], 534 struct Observable oList[], struct CE_Info *ce_info) 535 { 536 // Send register message to cognitive radio 537 SendMessage(sockfd, "c_register"); 538 return 1; 539 540 541 542 return 1; 543 } 532 544 533 545 // main client socket … … 538 550 struct Observable oList[10]; 539 551 struct CE_Info ce_info; 552 char buffer[256]; 540 553 541 554 // setup client socket connection 542 555 int sockfd; 543 556 sockfd = ClientSocket(argc, argv); 544 557 558 RegisterCE(sockfd,uList,pList,oList,&ce_info); 545 559 // get xml info from server 546 560 GetXMLFromServer(sockfd, uList, pList, oList, &ce_info); … … 548 562 //print_current_config(uList, pList, oList, &ce_info); 549 563 550 551 564 // get experience size from server 552 565 int num_rows, num_cols; 553 566 GetExperienceSize(sockfd, &num_rows, &num_cols); 554 567 555 568 // get experience 556 569 int i, j; … … 558 571 GetExperience(sockfd, num_rows, num_cols, past_exp); 559 572 printf("Received Previous Radio Experience from Server Successfully.\n\n"); 560 561 // calculate utility562 563 573 // cbr operation 564 574 //unsigned int num_cols; … … 567 577 num_cols = num_cols + ce_info.numObservables; 568 578 num_cols = num_cols + 1; // overall utility 569 570 579 //while(1) { 571 580 … … 574 583 //GetRequest(sockfd); 575 584 //printf("Received optimization request from server\n\n"); 576 RunCBREngine(uList, pList, oList, &ce_info, num_cols, num_rows, 577 past_exp); 585 RunCBREngine(uList, pList, oList, &ce_info, num_cols, num_rows, past_exp); 578 586 579 587 printf("Sending optimization results to server.\n\n"); 580 588 // send results back to server 581 589 SendCEResults(sockfd, uList, pList, oList, &ce_info); 590 582 591 //} 583 592