Changeset 219 in tmcsimulator for branches/FEPSimulator
- Timestamp:
- 11/03/2017 12:32:34 PM (8 years ago)
- Location:
- branches/FEPSimulator
- Files:
-
- 2 edited
-
FEPSim.cpp (modified) (5 diffs)
-
network.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/FEPSimulator/FEPSim.cpp
r217 r219 33 33 vector<STATION*> ldsMap = highwaysParser.stations; 34 34 35 36 35 // Send one reply for every FEPLine 37 36 for (int i = 0; i < lines.size(); i++) { 38 37 fep_reply fepReply; 39 38 FEP_LINE * currLine = lines.at(i); 40 39 // populate reply 41 40 fepReply.reply = SHORTPOLL; 42 fepReply.schedule = lines.at(i)->schedule;43 fepReply.lineinfo = lines.at(i)->lineInfo;41 fepReply.schedule = currLine->schedule; 42 fepReply.lineinfo = currLine->lineInfo; 44 43 fepReply.kind = (enum polltype) 0; 45 44 fepReply.flag = (enum replykind) 0; 46 45 47 fepReply.schedule_sequence = lines.at(i)->schedleSeq;48 fepReply.global_sequence = lines.at(i)->globalSeq;46 fepReply.schedule_sequence = currLine->schedleSeq; 47 fepReply.global_sequence = currLine->globalSeq; 49 48 50 49 // using current unix time, may need to look at later 51 50 fepReply.schedule_time = time(NULL); 52 51 53 fepReply.user_info1 = lines.at(i)->lineNum;54 fepReply.user_info2 = lines.at(i)->lineNum;55 fepReply.system_key = lines.at(i)->systemKey;52 fepReply.user_info1 = currLine->lineNum; 53 fepReply.user_info2 = currLine->lineNum; 54 fepReply.system_key = currLine->systemKey; 56 55 57 56 fepReply.answers.size = 1; … … 59 58 60 59 // construct a shortanswer for each station in line 61 for (int j = 0; j < lines.at(i)->lds.size(); j++) {60 for (int j = 0; j < currLine->lds.size(); j++) { 62 61 fep_shortanswer fsa; 63 int index = lines.at(i)->ldsIndex.at(j);62 STATION * currStation = ldsMap.at(currLine->ldsIndex.at(j)); 64 63 65 // msg: oa, od, ldsMap.at(index).dataPack, od, ff66 fsa.msg.message_len = ldsMap.at(index)->length + 2;64 // msg: oa, od, currStation.dataPack, od, ff 65 fsa.msg.message_len = currStation->length + 2; 67 66 fsa.msg.message[0] = 0x0d; 68 67 fsa.msg.message[1] = 0x0a; 69 for (int k = 0; k < ldsMap.at(index)->length; k++) {70 //printf("Adding: %d %02X\n", k, ldsMap.at(index)->dataPack[k]);71 fsa.msg.message[2 + k] = ldsMap.at(index)->dataPack[k];68 for (int k = 0; k < currStation->length; k++) { 69 //printf("Adding: %d %02X\n", k, currStation->dataPack[k]); 70 fsa.msg.message[2 + k] = currStation->dataPack[k]; 72 71 } 73 int aa = ldsMap.at(index)->length;72 int aa = currStation->length; 74 73 fsa.msg.message[2 + aa] = 0x0d; 75 74 fsa.msg.message[3 + aa] = 0xff; … … 83 82 // info 84 83 fsa.info.poll_error_count = 0; 85 fsa.info.poll_user_info1 = ldsMap.at(index)->drop; // drop number84 fsa.info.poll_user_info1 = currStation->drop; // drop number 86 85 fsa.info.poll_user_info2 = 1; //always 1 87 86 fsa.info.retries = 0; … … 91 90 // send out data 92 91 93 FEPLogFile << "Sending fepReply for line #" << lines.at(i)->lineNum92 FEPLogFile << "Sending fepReply for line #" << currLine->lineNum 94 93 << " station number #" 95 << ldsMap.at( lines.at(i)->ldsIndex.at(j)) << endl;94 << ldsMap.at(currLine->ldsIndex.at(j)) << endl; 96 95 97 96 // Transfer the station data to ATMS and listen for response … … 190 189 exit(1); 191 190 } 192 191 // open log file 193 192 FEPLogFile.open(FEPLogFileName, ios::app); 194 193 // send data to atms 195 194 manageClientConnection(buffer); 196 FEPLogFile << "attempt" << endl;195 // close log file 197 196 FEPLogFile.close(); 198 197 } -
branches/FEPSimulator/network.h
r159 r219 84 84 }; 85 85 86 87 86 #endif
Note: See TracChangeset
for help on using the changeset viewer.
