Changeset 217 in tmcsimulator for branches/FEPSimulator
- Timestamp:
- 11/02/2017 10:53:38 PM (9 years ago)
- Location:
- branches/FEPSimulator
- Files:
-
- 4 edited
-
FEPSim.cpp (modified) (8 diffs)
-
FEPSim.h (modified) (4 diffs)
-
HighwaysParser.cpp (modified) (1 diff)
-
nbproject/private/private.xml (modified) (1 diff)
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 } -
branches/FEPSimulator/FEPSim.h
r214 r217 33 33 #include "fep.h" 34 34 #include <iostream> 35 #include <fstream> 35 36 #include <stdio.h> 36 37 #include <stdlib.h> … … 44 45 45 46 const int BUFF_SIZE = 1266341; 46 47 const string FEPLogFileName = "FEPSimLog.txt"; 48 static ofstream FEPLogFile; 49 47 50 class FEPSim { 48 51 public: … … 84 87 int FEP_REV; 85 88 int SOCK_PORT; 86 89 87 90 /** 88 91 * Handler for the ATMS RPC Response (to the client RPC Call) … … 102 105 */ 103 106 void sendReplys(char * xml); 104 107 105 108 }; 106 109 -
branches/FEPSimulator/HighwaysParser.cpp
r209 r217 99 99 newStation->length = newStation->loops.size() * 2 + CONTROL_DATA_LEN; 100 100 newStation->dataPack = DataPacker::packData(newStation); 101 for(int byte = 0; byte < newStation->length; byte++)102 {103 printf("%02X", (unsigned char) newStation->dataPack[byte]);104 }105 printf("\n");106 101 107 102 this->stations.push_back(newStation); -
branches/FEPSimulator/nbproject/private/private.xml
r212 r217 8 8 <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> 9 9 <group> 10 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/network.h</file> 11 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/FEPSim.cpp</file> 12 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/fep.h</file> 13 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/FEPSim.h</file> 10 14 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/HighwaysParser.cpp</file> 11 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/fep.h</file>12 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/DataPacker.cpp</file>13 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/HighwaysParser.h</file>14 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/FEPSim.cpp</file>15 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/network.h</file>16 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/Makefile</file>17 <file>file:/Users/jtorres/tmcsimulator/branches/FEPSimulator/tests/HighwaysParserTest.cpp</file>18 15 </group> 19 16 </open-files>
Note: See TracChangeset
for help on using the changeset viewer.
