Changeset 219 in tmcsimulator


Ignore:
Timestamp:
11/03/2017 12:32:34 PM (8 years ago)
Author:
jtorres
Message:

FEPSim.cpp: simplified line and station variable names in sendReplys() method

Location:
branches/FEPSimulator
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/FEPSimulator/FEPSim.cpp

    r217 r219  
    3333    vector<STATION*> ldsMap = highwaysParser.stations; 
    3434 
    35      
    3635    // Send one reply for every FEPLine 
    3736    for (int i = 0; i < lines.size(); i++) { 
    3837        fep_reply fepReply; 
    39          
     38        FEP_LINE * currLine = lines.at(i); 
    4039        // populate reply 
    4140        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; 
    4443        fepReply.kind = (enum polltype) 0; 
    4544        fepReply.flag = (enum replykind) 0; 
    4645 
    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; 
    4948 
    5049        // using current unix time, may need to look at later 
    5150        fepReply.schedule_time = time(NULL); 
    5251 
    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; 
    5655 
    5756        fepReply.answers.size = 1; 
     
    5958         
    6059        // 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++) { 
    6261            fep_shortanswer fsa; 
    63             int index = lines.at(i)->ldsIndex.at(j); 
     62            STATION * currStation = ldsMap.at(currLine->ldsIndex.at(j)); 
    6463 
    65             // msg: oa, od, ldsMap.at(index).dataPack, od, ff 
    66             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; 
    6766            fsa.msg.message[0] = 0x0d; 
    6867            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]; 
    7271            } 
    73             int aa = ldsMap.at(index)->length; 
     72            int aa = currStation->length; 
    7473            fsa.msg.message[2 + aa] = 0x0d; 
    7574            fsa.msg.message[3 + aa] = 0xff; 
     
    8382            // info 
    8483            fsa.info.poll_error_count = 0; 
    85             fsa.info.poll_user_info1 = ldsMap.at(index)->drop; // drop number 
     84            fsa.info.poll_user_info1 = currStation->drop; // drop number 
    8685            fsa.info.poll_user_info2 = 1; //always 1 
    8786            fsa.info.retries = 0; 
     
    9190            // send out data 
    9291             
    93             FEPLogFile << "Sending fepReply for line #" << lines.at(i)->lineNum  
     92            FEPLogFile << "Sending fepReply for line #" << currLine->lineNum  
    9493                    << " station number #"  
    95                     << ldsMap.at(lines.at(i)->ldsIndex.at(j)) << endl; 
     94                    << ldsMap.at(currLine->ldsIndex.at(j)) << endl; 
    9695             
    9796            // Transfer the station data to ATMS and listen for response 
     
    190189            exit(1); 
    191190        } 
    192          
     191        // open log file 
    193192        FEPLogFile.open(FEPLogFileName, ios::app); 
    194193        // send data to atms 
    195194        manageClientConnection(buffer); 
    196         FEPLogFile << "attempt" << endl; 
     195        // close log file 
    197196        FEPLogFile.close(); 
    198197    } 
  • branches/FEPSimulator/network.h

    r159 r219  
    8484}; 
    8585 
    86  
    8786#endif 
Note: See TracChangeset for help on using the changeset viewer.