Changeset 69 for vtcross/branches/trnewman/CR_shell
- Timestamp:
- 11/21/08 13:34:28 (16 years ago)
- Location:
- vtcross/branches/trnewman/CR_shell/src
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/branches/trnewman/CR_shell/src/main_cognitive_engine.cpp
r68 r69 15 15 16 16 struct Utility { 17 char name[ 20];18 char units[ 20];19 char goal[ 20];17 char name[50]; 18 char units[50]; 19 char goal[50]; 20 20 /* string name; 21 21 string units; … … 33 33 /*string name; 34 34 string units;*/ 35 char name[ 20];36 char units[ 20];35 char name[50]; 36 char units[50]; 37 37 float min; 38 38 int numAffects; … … 44 44 struct Observable { 45 45 //string name; 46 char name[ 20];46 char name[50]; 47 47 Affect affection_list[10]; 48 48 int numAffects; … … 90 90 error("ERROR connecting");*/ 91 91 92 /*// send to server 92 93 printf("Please enter the message: "); 93 94 bzero(buffer,256); … … 96 97 if (n < 0) 97 98 error("ERROR writing to socket"); 98 bzero(buffer,256); 99 bzero(buffer,256);*/ 99 100 100 101 // read back xml information 101 int counter,i;102 int i; 102 103 Utility * uList[10]; 103 104 Parameter * pList[10]; … … 135 136 strcpy(uList[i]->units, buffer); 136 137 137 bzero(buffer,256);138 /*bzero(buffer,256); 138 139 n = recv(sockfd,buffer,255,0); 139 140 if (n < 0) 140 141 error("ERROR reading from socket"); 141 142 printf("%s ", buffer); 142 strcpy(uList[i]->goal, buffer); 143 strcpy(uList[i]->goal, buffer);*/ 143 144 144 145 /*bzero(buffer,256); … … 147 148 error("ERROR reading from socket"); 148 149 printf("%s ", buffer); 149 strcpy(uList[i]->target,buffer);*/150 uList[i]->target, atof(buffer);*/ 150 151 } 151 152 -
vtcross/branches/trnewman/CR_shell/src/main_cognitive_radio.cpp
r66 r69 239 239 // Write message back to client 240 240 n = send(socketfd,message.c_str(),(message.size()+1),MSG_NOSIGNAL); 241 if (n<0) 242 error("Error sending to client\n"); 243 printf("sent: %s\n", message.c_str()); 241 244 242 245 return n; … … 249 252 250 253 251 while(1) {254 // while(1) { 252 255 // Send parameters from struct 253 256 sprintf(counter,"%d",ce_info->numUtilities); … … 256 259 // utilities 257 260 for(i = 0; i < ce_info->numUtilities; i++) { 261 //for(i = 0; i < 1; i++) { 258 262 SendMessage(socketfd,uList[i]->name); 259 263 SendMessage(socketfd,uList[i]->units); … … 263 267 } 264 268 265 / / parameters269 /*// parameters 266 270 sprintf(counter,"%i",ce_info->numParameters); 267 271 SendMessage(socketfd,counter); … … 296 300 SendMessage(socketfd,oList[i]->affection_list[j].relation); 297 301 } 298 } 302 }*/ 299 303 300 304 … … 316 320 }*/ 317 321 318 }322 // } 319 323 } 320 324 … … 384 388 cout << "Configuration file parsing completed." << endl; 385 389 386 pid = fork(); 390 print_current_config(uList, pList, oList, &ce_info); 391 392 pid = fork(); 387 393 if(pid == 0) { 388 394 // In child process - open policy engine port.