Changeset 217 in tmcsimulator for branches/FEPSimulator/FEPSim.cpp
- Timestamp:
- 11/02/2017 10:53:38 PM (9 years ago)
- File:
-
- 1 edited
-
branches/FEPSimulator/FEPSim.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/FEPSimulator/FEPSim.cpp
r215 r217 7 7 this->FEP_REV = FEP_REV; 8 8 this->SOCK_PORT = SOCK_PORT; 9 10 // clear log file 11 FEPLogFile.open(FEPLogFileName, ios::trunc); 12 FEPLogFile.close(); 9 13 } 10 14 11 FEPSim::~FEPSim() { 15 FEPSim::~FEPSim() { 16 FEPLogFile.close(); 12 17 } 13 18 14 19 void FEPSim::handleCallResponse(void *response) { 15 20 // Failed RPC Call 16 if (response == NULL) { clnt_perror(clnt, "RPC call failed"); 21 if (response == NULL) { 22 clnt_perror(clnt, "RPC call failed"); 17 23 } 18 24 // Successful RPC Call 19 else { cout << "Successful RPC call to ATMS..." << endl; 25 else { 26 FEPLogFile << "Successful RPC call to ATMS..." << endl; 20 27 } 21 28 } … … 30 37 for (int i = 0; i < lines.size(); i++) { 31 38 fep_reply fepReply; 32 cout << "Sending fepReply for line #" << lines.at(i)->lineNum << endl;39 33 40 // populate reply 34 41 fepReply.reply = SHORTPOLL; … … 37 44 fepReply.kind = (enum polltype) 0; 38 45 fepReply.flag = (enum replykind) 0; 39 40 /***********************************41 * We might need to handle this on the java side if its an42 * issue43 lines.at(i).schedleSeq += 1;44 lines.at(i).globalSeq += 51;45 */46 46 47 47 fepReply.schedule_sequence = lines.at(i)->schedleSeq; … … 90 90 fepReply.answers.fep_answer_list_u.shortp.answers[0] = fsa; 91 91 // send out data 92 //printf("Transferring line=%d, lds_drop_no=%d...\n", lines.at(i)->lineNum, (int)ldsMap.at(index)->drop); 93 // Make RPC Call and handle response 94 // printf("Handling ATMS response...\n"); 92 93 FEPLogFile << "Sending fepReply for line #" << lines.at(i)->lineNum 94 << " station number #" 95 << ldsMap.at(lines.at(i)->ldsIndex.at(j)) << endl; 96 95 97 // Transfer the station data to ATMS and listen for response 96 98 handleCallResponse(fep_reply_xfer_32(&fepReply, clnt)); 97 unsigned int sleepseconds = 50000;98 usleep(sleepseconds);99 99 } 100 100 } … … 108 108 // Prepare and send the highway status as FEP replies 109 109 sendReplys(buffer); 110 cout<< "Destroying client..." << endl;110 FEPLogFile << "Destroying client..." << endl; 111 111 clnt_destroy(clnt); 112 112 int startTime = time(NULL); 113 cout<< "time is: " << startTime << endl;113 FEPLogFile << "time is: " << startTime << endl; 114 114 } 115 115 } … … 127 127 success = false; 128 128 } else { 129 cout<< "Client created" << endl;129 FEPLogFile << "Client created" << endl; 130 130 } 131 131 return success; … … 185 185 totBytes += n; 186 186 } 187 HighwaysParser highwaysParser = HighwaysParser(buffer);188 189 187 190 188 if (n < 0) { … … 192 190 exit(1); 193 191 } 194 192 193 FEPLogFile.open(FEPLogFileName, ios::app); 195 194 // send data to atms 196 195 manageClientConnection(buffer); 196 FEPLogFile << "attempt" << endl; 197 FEPLogFile.close(); 197 198 } 198 199 }
Note: See TracChangeset
for help on using the changeset viewer.
