| 1 |
///////////////PAMELA PACKETS READER///////////////////////////////// |
///////////////PAMELA PACKETS READER///////////////////////////////// |
| 2 |
#include "descript.h" |
#include "descript.h" |
| 3 |
|
#include "flag.h" |
| 4 |
|
|
| 5 |
#include "CRC.h" |
#include "CRC.h" |
| 6 |
|
|
| 8 |
|
|
| 9 |
void verify(char fni[], char inf[], char log[], char pam[], |
void verify(char fni[], char inf[], char log[], char pam[], |
| 10 |
char fno[], char path[], char name_ini[], char name_in[], int packet_type[], |
char fno[], char path[], char name_ini[], char name_in[], int packet_type[], |
| 11 |
int GLOBAL_LEN_ER, float IndexQ, int r_counter, int real_route[]) |
float IndexQ, int r_counter, int real_route[]) |
| 12 |
{ |
{ |
| 13 |
FILE *fo_log, *fo_inf, *fo_work, *fo_miss, *fo_row; |
FILE *fo_log, *fo_inf, *fo_work, *fo_miss, *fo_row; |
| 14 |
|
|
| 15 |
time_t seconds; |
time_t seconds; |
| 16 |
|
|
| 17 |
struct tm *timeinfo; |
struct tm *timeinfo; |
| 18 |
char time_year[5], time_month[5], time_day[5]; |
char time_year[5], time_month[5], time_day[5]; |
| 19 |
char data_time[80]; |
char data_time[80]; |
| 20 |
char cirquit_no[10], route_no[80], name_path[80], name_cln2[80]; |
char cirquit_no[10], route_no[80], name_path[80], name_cln2[80]; |
| 21 |
bool file_ready, file_deleted, file_archived, file_proces; |
bool file_ready, file_deleted, file_archived, file_proces; |
| 22 |
int flag_to_transmit=0; |
int flag_to_transmit=0; |
| 23 |
int flag_sec_trans=0; /*Second transmission flag*/ |
int flag_sec_trans=0; /*Second transmission flag*/ |
| 24 |
int num_rows=0; |
int num_rows=0; |
| 25 |
int current_route=0; |
int current_route=0; |
| 78 |
unsigned long int k=0, j=0; |
unsigned long int k=0, j=0; |
| 79 |
int i; |
int i; |
| 80 |
//initialization , all =0 |
//initialization , all =0 |
| 81 |
|
float process, transmit; |
| 82 |
|
int output; |
| 83 |
|
char str[80]; |
| 84 |
|
|
| 85 |
|
FILE *fpar; |
| 86 |
|
fpar=fopen("/home/pamelaprod/rawreader/bin/parameters.dat","r"); |
| 87 |
|
fscanf(fpar,"%f %s %s %s",&process,str,str,str); |
| 88 |
|
fscanf(fpar,"%f %s %s %s",&transmit,str,str,str); |
| 89 |
|
fscanf(fpar,"%i",&output); |
| 90 |
|
fclose(fpar); |
| 91 |
|
|
| 92 |
stringstream oss, oss1; |
stringstream oss, oss1; |
| 93 |
|
|
| 134 |
|
|
| 135 |
ifstream fin; |
ifstream fin; |
| 136 |
ofstream fo_pam; |
ofstream fo_pam; |
|
|
|
| 137 |
/**********************OPEN NECESSARY FILES************************/ |
/**********************OPEN NECESSARY FILES************************/ |
| 138 |
/******************************************************************/ |
/******************************************************************/ |
| 139 |
fin.open(fni, ios::binary); // open input file "mmm_counter_nnnnn__cln1.pam" |
fin.open(fni, ios::binary); // open input file "xxx_mmm_nnnnn__cln1.pam" |
| 140 |
if(fin.good()==0) {cerr<<"can not open input file"; exit(1);} |
if(fin.good()==0) {cerr<<"can not open input file "<<fni<<"\n"; exit(1);} |
| 141 |
|
|
| 142 |
fo_work=fopen(fno, "wb"); //open output help file "work.dat" |
fo_work=fopen(fno, "wb"); //open output help file "work.dat" |
| 143 |
if(fo_work==NULL) {cerr<<"can not open outputfile"; exit(1);} |
if(fo_work==NULL) {cerr<<"can not open outputfile"; exit(1);} |
| 144 |
|
|
| 145 |
fo_log=fopen(log, "wb"); //open output file "Route_cln2.log" |
fo_log=fopen(log, "wb"); //open output file "xxx_mmm_nnnnn_cln2.log" |
| 146 |
if(fo_log==NULL) {cerr<<"can not open log file"; exit(1);} |
if(fo_log==NULL) {cerr<<"can not open log file"; exit(1);} |
| 147 |
|
|
| 148 |
fo_pam.open(pam, ios::binary); //open output file "Route_cln2.pam" |
fo_pam.open(pam, ios::binary); //open output file "xxx_mmm_nnnnn_cln2.pam" |
| 149 |
if(fo_pam.good()==0) {cerr<<"can not open pam file"; exit(1);} |
if(fo_pam.good()==0) {cerr<<"can not open pam file"; exit(1);} |
| 150 |
|
|
| 151 |
fo_inf=fopen(inf, "wb"); //open output file "mmm_conter_nnnnn_cln2.inf" |
fo_inf=fopen(inf, "wb"); //open output file "xxx_mmm_nnnnn_cln2.inf" |
| 152 |
if(fo_inf==NULL) {cerr<<"can not open inf file"; exit(1);} |
if(fo_inf==NULL) {cerr<<"can not open inf file"; exit(1);} |
| 153 |
|
|
| 154 |
strcpy(miss_file,path); |
strcpy(miss_file,path); |
| 155 |
strncat(miss_file,name_in,strlen(name_in)-8); |
strncat(miss_file,name_in,strlen(name_in)-8); |
| 156 |
fo_miss=fopen(strcat(miss_file,"mis_cln2.dat"), "wb"); |
fo_miss=fopen(strcat(miss_file,"mis_cln2.dat"), "wb"); |
| 157 |
//open output file "mmm_nnnnn_mis_cln2.dat" |
//open output file "xxx_mmm_nnnnn_mis_cln2.dat" |
| 158 |
if(fo_miss==NULL) {cerr<<"can not open miss file"; exit(1);} |
if(fo_miss==NULL) {cerr<<"can not open miss file"; exit(1);} |
| 159 |
/******************************************************************/ |
/******************************************************************/ |
| 160 |
/******************************************************************/ |
/******************************************************************/ |
| 161 |
|
|
| 162 |
//Write proccessed filename in help file |
//Write proccessed filename in help file |
| 163 |
fprintf(fo_work,"file name=%s\n",name_in); |
// fprintf(fo_work,"file name=%s\n",name_in); |
| 164 |
|
|
| 165 |
/******************************************************************/ |
/******************************************************************/ |
| 166 |
/******************MAIN READING CYCLE BEGIN************************/ |
/******************MAIN READING CYCLE BEGIN************************/ |
| 167 |
/******************************************************************/ |
/******************************************************************/ |
| 175 |
|
|
| 176 |
/*******************temporary packet number************************/ |
/*******************temporary packet number************************/ |
| 177 |
tmpP=(long int)(unsigned char)(Name_Buf[7])+ |
tmpP=(long int)(unsigned char)(Name_Buf[7])+ |
| 178 |
256*(long int)(unsigned char)(Name_Buf[6])+ |
256*(long int)(unsigned char)(Name_Buf[6])+ |
| 179 |
256*256*(long int)(unsigned char)(Name_Buf[5]); |
256*256*(long int)(unsigned char)(Name_Buf[5]); |
| 180 |
|
|
| 181 |
if (N1==0) numP[2]=tmpP-1; //initial packet identification |
if (N1==0) numP[2]=tmpP-1; //initial packet identification |
| 201 |
(tmpP==numP[2]+1)&&num_type!=0)|| |
(tmpP==numP[2]+1)&&num_type!=0)|| |
| 202 |
((int)(unsigned char)Name_Buf[0]==CODE_BYTE1&& |
((int)(unsigned char)Name_Buf[0]==CODE_BYTE1&& |
| 203 |
(int)(unsigned char)Name_Buf[1]==CODE_BYTE2&& |
(int)(unsigned char)Name_Buf[1]==CODE_BYTE2&& |
| 204 |
(int)(unsigned char)Name_Buf[2]==CODE_BYTE3&&num_type1!=0&&num_type2!=0)|| |
(int)(unsigned char)Name_Buf[2]==CODE_BYTE3&&num_type1!=0&&num_type1==num_type2)|| |
| 205 |
((int)(unsigned char)Name_Buf[0]==CODE_BYTE1&& |
((int)(unsigned char)Name_Buf[0]==CODE_BYTE1&& |
| 206 |
(int)(unsigned char)Name_Buf[1]==CODE_BYTE2&& |
(int)(unsigned char)Name_Buf[1]==CODE_BYTE2&& |
| 207 |
(int)(unsigned char)Name_Buf[2]==CODE_BYTE3&& |
(int)(unsigned char)Name_Buf[2]==CODE_BYTE3&& |
| 210 |
N1+=1; FLAG_BIG=0; |
N1+=1; FLAG_BIG=0; |
| 211 |
if (N1==1) {icount+=8;} |
if (N1==1) {icount+=8;} |
| 212 |
packet_counter[num_type]+=1; //count packet number for each type |
packet_counter[num_type]+=1; //count packet number for each type |
| 213 |
if ((fmod((float)(tmpP),(float)(1000.))==0.)&&(tmpP!=0)) cout<<"verifying "<<tmpP<<"\n"; |
// if ((fmod((float)(tmpP),(float)(1000.))==0.)&&(tmpP!=0)) cout<<"verifying "<<tmpP<<"\n"; |
| 214 |
|
|
| 215 |
if (N1!=1) |
if (N1!=1) |
| 216 |
{ |
{ |
| 217 |
/**************PAMELA PREVIOUS PACKET END DISPLACEMENT*************/ |
/**************PAMELA PREVIOUS PACKET END DISPLACEMENT*************/ |
| 218 |
if ((icount-8-adr_first[2]+1-LenP[2]-16)<=Limit) {adr_last[2]=icount-8;} //end byte for previous packet |
if ((icount-8-adr_first[2]+1-LenP[2]-16)<=Limit) {adr_last[2]=icount-8;} //end byte for previous packet |
| 219 |
else if ((icount-8-adr_first[2]+1-LenP[2]-16)>Limit) {adr_last[2]=adr_first[2]+Limit;} //end byte for previous packet |
else if ((icount-8-adr_first[2]+1-LenP[2]-16)>Limit) {adr_last[2]=adr_first[2]+Limit;} //end byte for previous packet |
|
|
|
| 220 |
/**************PAMELA PACKET LENGTH ERROR ANALYSIS*****************/ |
/**************PAMELA PACKET LENGTH ERROR ANALYSIS*****************/ |
| 221 |
if ( (flag_CRC_H[2]==1)&&(GLOBAL_LEN_ER>0)&& |
if ( (flag_CRC_H[2]==1)&&(GLOBAL_LEN_ER>0)&& |
| 222 |
( ((adr_last[2]-adr_first[2]+1)<(LenP[2]+16)) |
( ((adr_last[2]-adr_first[2]+1)<(LenP[2]+16)) |
| 223 |
||((adr_last[2]-adr_first[2]+1-LenP[2]-16)>64) ) ) |
||((adr_last[2]-adr_first[2]+1-LenP[2]-16)>64) ) ) |
| 224 |
{flag_len[2]=1; |
{flag_len[2]=1; |
| 225 |
cout<<"pack num "<<numP[2]<<" len="<<LenP[2]<<" true len="<< |
// cout<<"pack num "<<numP[2]<<" len="<<LenP[2]<<" true len="<<adr_last[2]-adr_first[2]-16<<" Type="<<num_type<<"\n"; |
| 226 |
adr_last[2]-adr_first[2]-16<<" Type="<<num_type<<"\n";} |
} |
| 227 |
if ( (flag_CRC_H[2]==0)&&(GLOBAL_LEN_ER>0)&& |
if ( (flag_CRC_H[2]==0)&&(GLOBAL_LEN_ER>0)&& |
| 228 |
( ((adr_last[2]-adr_first[2]+1)<(LenP[2]+16))||((adr_last[2]-adr_first[2]+1-LenP[2]-16)>64) ) ) |
( ((adr_last[2]-adr_first[2]+1)<(LenP[2]+16))||((adr_last[2]-adr_first[2]+1-LenP[2]-16)>64) ) ) |
| 229 |
{flag_len_weak[2]=1; |
{flag_len_weak[2]=1; |
| 230 |
cout<<"weak length error; pack num "<<numP[2]<<" len="<<LenP[2]<<" true len="<< |
// cout<<"weak length error; pack num "<<numP[2]<<" len="<<LenP[2]<<" true len="<<adr_last[2]-adr_first[2]-16<<" Type="<<num_type<<"\n"; |
| 231 |
adr_last[2]-adr_first[2]-16<<" Type="<<num_type<<"\n";} |
} |
| 232 |
|
|
| 233 |
if ((GLOBAL_LEN_ER>0)&&(flag_len[2]==1)) |
if ((GLOBAL_LEN_ER>0)&&(flag_len[2]==1)) |
| 234 |
{ |
{ |
| 235 |
//Write data in file "mmm_counter_nnnnn_cln2.pam" |
//Write data in file "xxx_mmm_nnnnn_cln2.pam" |
| 236 |
for (i=0;i<adr_last[2]-adr_first[2]+1;i++) |
for (i=0;i<adr_last[2]-adr_first[2]+1;i++) |
| 237 |
{fo_pam<< buffer[i];} |
{fo_pam<< buffer[i];} |
| 238 |
} |
} |
| 239 |
else if ((GLOBAL_LEN_ER>0)&&(flag_len[2]!=1)) |
else if ((GLOBAL_LEN_ER>0)&&(flag_len[2]!=1)&&(flag_len_weak[2]!=1)) |
| 240 |
{ |
{ |
| 241 |
//Write data in file "mmm_counter_nnnnn_cln2.pam" |
//Write data in file "xxx_mmm_nnnnn_cln2.pam" |
| 242 |
for (i=0;i<LenP[2]+16;i++) |
for (i=0;i<LenP[2]+16;i++) |
| 243 |
{fo_pam<< buffer[i];} |
{fo_pam<< buffer[i];} |
| 244 |
adr_last[2]=adr_first[2]+LenP[2]+15; |
adr_last[2]=adr_first[2]+LenP[2]+15; |
| 245 |
icount=adr_first[2]+15+LenP[2]+8; |
icount=adr_first[2]+15+LenP[2]+8; |
| 246 |
} |
} |
| 247 |
|
else if ((GLOBAL_LEN_ER>0)&&(flag_len[2]!=1)&&(flag_len_weak[2]==1)) |
| 248 |
|
{ |
| 249 |
|
//Write data in file "xxx_mmm_nnnnn_cln2.pam" |
| 250 |
|
for (i=0;i<adr_last[2]-adr_first[2]+1;i++) |
| 251 |
|
{fo_pam<< buffer[i];} |
| 252 |
|
} |
| 253 |
else if ((GLOBAL_LEN_ER==0)&&(adr_last[2]-adr_first[2]+1-LenP[2]-16>=0)) |
else if ((GLOBAL_LEN_ER==0)&&(adr_last[2]-adr_first[2]+1-LenP[2]-16>=0)) |
| 254 |
{ |
{ |
| 255 |
for (i=0;i<LenP[2]+16;i++) |
for (i=0;i<LenP[2]+16;i++) |
| 268 |
{Byte_adr2[3-i]=(int)(temp[1]/(long int)(pow(256.,3-i))); |
{Byte_adr2[3-i]=(int)(temp[1]/(long int)(pow(256.,3-i))); |
| 269 |
temp[1]=temp[1]-(long int)pow(256.,3-i)* |
temp[1]=temp[1]-(long int)pow(256.,3-i)* |
| 270 |
(int)(temp[1]/(long int)(pow(256.,3-i)));}} |
(int)(temp[1]/(long int)(pow(256.,3-i)));}} |
| 271 |
//Write previous packet end displacement in mmm_counter_nnnnn_cln2.log file |
//Write previous packet end displacement in xxx_mmm_nnnnn_cln2.log file |
| 272 |
for (i=0;i<4;i++) fprintf(fo_log,"%1c",char(Byte_adr2[i])); |
for (i=0;i<4;i++) fprintf(fo_log,"%1c",char(Byte_adr2[i])); |
| 273 |
} |
} |
| 274 |
/*********************reading remaining header********************/ |
/*********************reading remaining header********************/ |
| 281 |
pack_length=(long int)(unsigned char)(Name_Buf_add[6])+ |
pack_length=(long int)(unsigned char)(Name_Buf_add[6])+ |
| 282 |
256*(long int)(unsigned char)(Name_Buf_add[5])+ |
256*(long int)(unsigned char)(Name_Buf_add[5])+ |
| 283 |
256*256*(long int)(unsigned char)(Name_Buf_add[4]); |
256*256*(long int)(unsigned char)(Name_Buf_add[4]); |
|
// cout<<pack_length<<" "<<tmpP<<" "<<icount_total<<"\n"; |
|
| 284 |
/***********PACKET HEADER DATA ANALYSIS****************************/ |
/***********PACKET HEADER DATA ANALYSIS****************************/ |
| 285 |
switch (N1) |
switch (N1) |
| 286 |
{ |
{ |
| 365 |
|
|
| 366 |
CalcCheckSum=(short int)(unsigned char)CM_Compute_CRC16(0, (unsigned char*)&buff, 15); |
CalcCheckSum=(short int)(unsigned char)CM_Compute_CRC16(0, (unsigned char*)&buff, 15); |
| 367 |
if (CalcCheckSum!=(short int)(unsigned char)(Name_Buf_add[7])) |
if (CalcCheckSum!=(short int)(unsigned char)(Name_Buf_add[7])) |
| 368 |
{cerr<<"checksum error "<<N1<<" Pack="<<numP[2]<< |
{cerr<<"checksum error "<<N1<<" Pack="<<numP[2]<<" "<<num_type<<" "<<bitset<8>(CalcCheckSum)<< |
| 369 |
" "<<num_type<<" "<<bitset<8>(CalcCheckSum)<< |
" CRC="<<bitset<8>((int)(unsigned char)(Name_Buf_add[7]))<<"\n"; |
|
" CRC="<<bitset<8>((int)(unsigned char)(Name_Buf_add[7]))<<"\n"; |
|
|
// cout<<(int)(unsigned char)(Name_Buf[0])<<" " |
|
|
// <<(int)(unsigned char)(Name_Buf[1])<<" " |
|
|
// <<(int)(unsigned char)(Name_Buf[2]) |
|
|
// <<" "<<num_type<<" "<<num_type1<<" "<<num_type2<<" "<<tmpP<<"\n"; |
|
| 370 |
CRC_bad_pack[2]=numP[2]; |
CRC_bad_pack[2]=numP[2]; |
| 371 |
flag_CRC_H[2]=1;} |
flag_CRC_H[2]=1;} |
| 372 |
/*********packet counter error analysis****************************/ |
/*********packet counter error analysis****************************/ |
| 401 |
} |
} |
| 402 |
/*********************Missing packet analysis**********************/ |
/*********************Missing packet analysis**********************/ |
| 403 |
/**packet numbers: 10 11 (12 15 19) 20 ****************************/ |
/**packet numbers: 10 11 (12 15 19) 20 ****************************/ |
| 404 |
/***********missed kadrs: 16 17 18 ********************************/ |
/***********missed packets: 16 17 18 ********************************/ |
| 405 |
if ((numP[1]>numP[0]+1)&&(numP[1]<numP[2]-1)&& |
if ((numP[1]>numP[0]+1)&&(numP[1]<numP[2]-1)&& |
| 406 |
(flag_pack[0]==0)&&(flag_pack[1]==0)&&(flag_pack[2]==0)) |
(flag_pack[0]==0)&&(flag_pack[1]==0)&&(flag_pack[2]==0)) |
| 407 |
{Mis_group+=1; |
{Mis_group+=1; |
| 408 |
fprintf(fo_miss,"%9i%9i\n",numP[1]+1,numP[2]-1); |
fprintf(fo_miss,"%9i%9i\n",numP[1]+1,numP[2]-1); |
| 409 |
count_miss+=numP[2]-numP[1]-1;} |
count_miss+=numP[2]-numP[1]-1;} |
| 410 |
/**packet numbers: 10 (11 12 15) 19 20 ****************************/ |
/**packet numbers: 10 (11 12 15) 19 20 ****************************/ |
| 411 |
/***********missed kadrs: 13 14 ***********************************/ |
/***********missed packets: 13 14 ***********************************/ |
| 412 |
else if ((numP[1]>=numP[0]+1)&&(numP[1]<numP[2]-1)&& |
else if ((numP[1]>=numP[0]+1)&&(numP[1]<numP[2]-1)&& |
| 413 |
(flag_pack[2]==0)&&(flag_pack[1]==0)&&(flag_pack[0]==0)) |
(flag_pack[2]==0)&&(flag_pack[1]==0)&&(flag_pack[0]==0)) |
| 414 |
{Mis_group+=1; |
{Mis_group+=1; |
| 415 |
fprintf(fo_miss,"%9i%9i\n",numP[0]+2,numP[2]-1); |
fprintf(fo_miss,"%9i%9i\n",numP[0]+2,numP[2]-1); |
| 416 |
count_miss+=numP[2]-numP[1]-1;} |
count_miss+=numP[2]-numP[1]-1;} |
| 417 |
/**packet numbers: 10 (11 20 15) 16 17 ****************************/ |
/**packet numbers: 10 (11 20 15) 16 17 ****************************/ |
| 418 |
/********missed kadrs number =2 ***********************************/ |
/********missed packets number =2 ***********************************/ |
| 419 |
else if ((numP[0]<numP[2]-2)&& |
else if ((numP[0]<numP[2]-2)&& |
| 420 |
(flag_pack[2]==0)&&(flag_pack[1]==1)&&(flag_pack[0]==0)) |
(flag_pack[2]==0)&&(flag_pack[1]==1)&&(flag_pack[0]==0)) |
|
|
|
| 421 |
{Mis_group+=1; |
{Mis_group+=1; |
| 422 |
fprintf(fo_miss,"%9i%9i%9i\n",numP[0]+1,numP[1],numP[2]-1); |
fprintf(fo_miss,"%9i%9i%9i\n",numP[0]+1,numP[1],numP[2]-1); |
| 423 |
count_miss+=numP[2]-numP[0]-2;} |
count_miss+=numP[2]-numP[0]-2;} |
| 499 |
fin.get(ch); |
fin.get(ch); |
| 500 |
if (fin.eof()) {break;} |
if (fin.eof()) {break;} |
| 501 |
icount_total+=1; |
icount_total+=1; |
| 502 |
if (fmod( double(icount_total), double(100000000.))==double(0.)) {cout<<"Mbytes="<<icount_total/1000000.<<"\n";} |
// if (fmod( double(icount_total), double(100000000.))==double(0.)) {cout<<"Mbytes="<<icount_total/1000000.<<"\n";} |
| 503 |
if ((N1>0)&&(FLAG_BIG==0)) icount+=1; |
if ((N1>0)&&(FLAG_BIG==0)) icount+=1; |
| 504 |
for (i=0;i<7;i++) Name_Buf[i]=Name_Buf[i+1]; |
for (i=0;i<7;i++) Name_Buf[i]=Name_Buf[i+1]; |
| 505 |
Name_Buf[7]=ch; /*for(i=0;i<8;i++) printf("%x",(int)(unsigned char)Name_Buf[i]); printf("\n");*/ |
Name_Buf[7]=ch; /*for(i=0;i<8;i++) printf("%x",(int)(unsigned char)Name_Buf[i]); printf("\n");*/ |
| 507 |
{buffer[icount-adr_first[2]]=ch;} |
{buffer[icount-adr_first[2]]=ch;} |
| 508 |
else |
else |
| 509 |
{flag_len[2]=1; |
{flag_len[2]=1; |
| 510 |
if (FLAG_BIG==0) {cout<<"too long packet "<<numP[2]<<"\n";} |
// if (FLAG_BIG==0) {cout<<"too long packet "<<numP[2]<<"\n";} |
| 511 |
FLAG_BIG=1; |
FLAG_BIG=1; |
| 512 |
} |
} |
| 513 |
} |
} |
| 590 |
for (i=0;i<strlen(pam)-22;i++) |
for (i=0;i<strlen(pam)-22;i++) |
| 591 |
{name_path[i]=pam[i];} |
{name_path[i]=pam[i];} |
| 592 |
name_path[strlen(pam)-22]='\0'; |
name_path[strlen(pam)-22]='\0'; |
| 593 |
for (i=8;i<13;i++) |
for (i=0;i<5;i++) |
| 594 |
{cirquit_no[i-8]=name_cln2[i];} |
{cirquit_no[i]=name_cln2[i];} |
| 595 |
cirquit_no[5]='\0'; |
cirquit_no[5]='\0'; |
| 596 |
for (i=0;i<3;i++) |
for (i=10;i<13;i++) |
| 597 |
{route_no[i]=name_cln2[i];} |
{route_no[i-10]=name_cln2[i];} |
| 598 |
route_no[3]='\0'; |
route_no[3]='\0'; |
| 599 |
file_ready=1; |
file_ready=1; |
| 600 |
file_deleted=0; |
file_deleted=0; |
| 601 |
file_archived=0; |
file_archived=0; |
| 602 |
file_proces=0; |
file_proces=0; |
| 603 |
if (IndexQ>0.9) file_proces=1; |
if (IndexQ>process) file_proces=1; |
| 604 |
|
|
|
/* printf("cirquit=%s \n", cirquit_no); |
|
|
printf("route=%s \n", route_no); |
|
|
printf("quality=%f \n", IndexQ); |
|
|
printf("ready=%i \n", file_ready); |
|
|
printf("deleted=%i \n", file_deleted); |
|
|
printf("data=%s \n", data_time); |
|
|
printf("achived=%i \n", file_archived); |
|
|
printf("path=%s \n", name_path); |
|
|
printf("name=%s \n", name_cln2); |
|
|
printf("processed=%i \n", file_proces);*/ |
|
| 605 |
|
|
| 606 |
if (IndexQ>0.999) {flag_to_transmit=1;} |
if (IndexQ>transmit) {flag_to_transmit=1;} |
| 607 |
else {flag_to_transmit=0;} |
else {flag_to_transmit=0;} |
| 608 |
oss.str(""); |
oss.str(""); |
| 609 |
oss << "INSERT INTO FILES (cirquit_n, route_n, counter, qual_index, ready, deleted, date," |
oss << "INSERT INTO FILES (cirquit_n, route_n, counter, qual_index, ready, deleted, date," |
| 612 |
<< file_ready << "','"<< file_deleted << "','"<< data_time << "','"<< file_archived << "','" |
<< file_ready << "','"<< file_deleted << "','"<< data_time << "','"<< file_archived << "','" |
| 613 |
<< name_path << "', '" << name_cln2 << "', '" << file_proces << "','" |
<< name_path << "', '" << name_cln2 << "', '" << file_proces << "','" |
| 614 |
<< flag_to_transmit << "')"; |
<< flag_to_transmit << "')"; |
| 615 |
cout<<oss.str().c_str()<<" table FILES\n"; |
// cout<<oss.str().c_str()<<" table FILES\n"; |
| 616 |
TSQLResult *res=sqlServer->Query(oss.str().c_str()); |
TSQLResult *res=sqlServer->Query(oss.str().c_str()); |
| 617 |
|
|
| 618 |
flag_sec_trans=0; |
flag_sec_trans=0; |
| 623 |
<<" VALUES ('"<<current_route<<"','"<<name_ini<<"','"<<icount<<"','"<<cirquit_no<<"','" |
<<" VALUES ('"<<current_route<<"','"<<name_ini<<"','"<<icount<<"','"<<cirquit_no<<"','" |
| 624 |
<<route_no<<"','"<<real_route[r_counter]<<"','"<<r_counter |
<<route_no<<"','"<<real_route[r_counter]<<"','"<<r_counter |
| 625 |
<<"','"<<time_p[2]<<"','"<<N1<<"','"<<packet_counter[28]<<"','"<<flag_sec_trans<<"')"; |
<<"','"<<time_p[2]<<"','"<<N1<<"','"<<packet_counter[28]<<"','"<<flag_sec_trans<<"')"; |
| 626 |
cout<<oss1.str().c_str()<<" table FILES1\n"; |
// cout<<oss1.str().c_str()<<" table FILES1\n"; |
| 627 |
TSQLResult *res3=sqlServer->Query(oss1.str().c_str()); |
TSQLResult *res3=sqlServer->Query(oss1.str().c_str()); |
| 628 |
|
|
| 629 |
// if (conn->Query(oss.str().c_str()) == 0) |
// if (conn->Query(oss.str().c_str()) == 0) |