Changeset 71 in tmcsimulator for branches/fep_client_cpp
- Timestamp:
- 09/07/2017 12:59:00 AM (9 years ago)
- Location:
- branches/fep_client_cpp
- Files:
-
- 2 added
- 1 deleted
- 4 edited
-
build (modified) (1 diff)
-
dummyserver/dumbserver (deleted)
-
dummyserver/fep.h (added)
-
dummyserver/server (added)
-
fep_client.cpp (modified) (9 diffs)
-
network.h (modified) (1 diff)
-
network_factory.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/fep_client_cpp/build
r70 r71 1 1 #!/bin/bash 2 2 3 g++ -g fep_client.cpp fep_clnt.c fep_xdr.c control.cpp -o client && gcc fep_server.c fep_svc.c fep_xdr.c -oserver3 g++ -g fep_client.cpp fep_clnt.c fep_xdr.c -o client && gcc ./dummyserver/fep_server.c ./dummyserver/fep_svc.c fep_xdr.c -o ./dummyserver/server -
branches/fep_client_cpp/fep_client.cpp
r70 r71 32 32 { 33 33 int i, j; // i == line_index, j == lds_index 34 34 void *rv; 35 35 // Send one reply for every "line" in the FEP 36 36 for (i = 0; i < lines_size; i++) … … 40 40 // populate reply 41 41 fepReply.reply = SHORTPOLL; 42 fepReply.schedule = fepLine[i].schedule;43 fepReply.lineinfo = fepLine[i].lineInfo;42 fepReply.schedule = lines[i].schedule; 43 fepReply.lineinfo = lines[i].lineInfo; 44 44 fepReply.kind = (enum polltype) 0; 45 45 fepReply.flag = (enum replykind) 0; … … 47 47 /*********************************** 48 48 This is an update to an extern, this should happen on the Java driver side?? 49 fepLine[i].schedleSeq += 1;50 fepLine[i].globalSeq += 51;49 lines[i].schedleSeq += 1; 50 lines[i].globalSeq += 51; 51 51 */ 52 52 53 fepReply.schedule_sequence = fepLine[i].schedleSeq;54 fepReply.global_sequence = fepLine[i].globalSeq;53 fepReply.schedule_sequence = lines[i].schedleSeq; 54 fepReply.global_sequence = lines[i].globalSeq; 55 55 /************************************ 56 56 Need to find out what appropriate schedule time is: look at uci_unix_simulation_time src code … … 58 58 uci_unix_simulation_time(uci_simulation_time()); // GMT time 59 59 */ 60 fepReply.user_info1 = fepLine[i].lineNum;61 fepReply.user_info2 = fepLine[i].lineNum;62 fepReply.system_key = fepLine[i].systemKey;60 fepReply.user_info1 = lines[i].lineNum; 61 fepReply.user_info2 = lines[i].lineNum; 62 fepReply.system_key = lines[i].systemKey; 63 63 64 64 fepReply.answers.size = 1; … … 66 66 67 67 /* for each LDS in the Line.... (constructs the short_answer message) */ 68 for (j = 0; j < fepLine[i].ldsNum; j++)68 for (j = 0; j < lines[i].ldsNum; j++) 69 69 { 70 70 fep_shortanswer fsa; 71 int index = fepLine[i].ldsIndex[j];71 int index = lines[i].ldsIndex[j]; 72 72 73 73 // msg: oa, od, ldsMap[index].dataPack, od, ff … … 90 90 fsa.info.poll_user_info2 = 1; //always 1 91 91 fsa.info.retries = 0; 92 fsa.info.status = REPLY_DONE;92 fsa.info.status = (enum replystatus) 1; 93 93 94 94 //fepReply.answers.fep_answer_list_u.shortp.answers[j] = fsa; … … 96 96 97 97 // send out data 98 printf("line=%d, lds=%d\n", fepLine[i].lineNum, ldsMap[index].drop);98 printf("line=%d, lds=%d\n", lines[i].lineNum, ldsMap[index].drop); 99 99 rv = fep_reply_xfer_32(&fepReply, clnt); 100 100 … … 107 107 108 108 /* Creates an RPC Client which communicates with the ATMS through RPC Calls */ 109 CLIENT * create_client( )109 CLIENT * create_client(char *host) 110 110 { 111 111 CLIENT *clnt; … … 131 131 void update_ATMS(char *host) 132 132 { 133 CLIENT *clnt = create_client( );133 CLIENT *clnt = create_client(host); 134 134 135 135 /* Load data to be xfered to ATMS */ 136 FEP_LINE_LDS *lines;137 int lines_size = load_lines(&lines, "./lines_atms.txt");138 FEP_LDS*ldsMap = load_lds("./lds_atms.txt");136 int lines_size; 137 FEP_LINE_LDS *lines = load_lines(&lines_size, "./lines_atms.txt"); 138 LDS_LOOP *ldsMap = load_lds("./lds_atms.txt"); 139 139 140 140 /* Transfer data to ATMS */ 141 141 xfer_replys(clnt, lines, lines_size, ldsMap); 142 143 /* Free allocated memory */ 144 free(lines); 145 free(ldsMap); 142 146 143 147 /* Destroy client */ -
branches/fep_client_cpp/network.h
r70 r71 1 1 #ifndef NETWORK_H 2 2 #define NETWORK_H 3 #include <vector> 4 using namespace std; 3 5 4 6 typedef struct loopagg LOOPAGG; -
branches/fep_client_cpp/network_factory.cpp
r70 r71 3 3 FEP_LINE_LDS * load_lines(int *size, const char * fName) 4 4 { 5 FEP_LINE_LDS lines[1];5 FEP_LINE_LDS *lines = (FEP_LINE_LDS *) malloc(sizeof(FEP_LINE_LDS)); 6 6 *size = 1; 7 7 return lines; 8 8 } 9 9 10 FEP_LDS* load_lds(const char * fName)10 LDS_LOOP * load_lds(const char * fName) 11 11 { 12 FEP_LDS lds[1];13 return lds ;12 LDS_LOOP *lds_map = (LDS_LOOP *) malloc(sizeof(LDS_LOOP)); 13 return lds_map; 14 14 }
Note: See TracChangeset
for help on using the changeset viewer.
