debug dtatFill gestion

This commit is contained in:
quentin.perret 2022-06-10 11:13:03 +02:00
parent a7ce786b92
commit 1f350d095d
2 changed files with 18 additions and 15 deletions

Binary file not shown.

View file

@ -35,15 +35,15 @@ char *createNewRawDataFileName(){
char *fileNumber = convertIntegerToChar(cptFile);
char fileNameNumber[strlen(fileName)+strlen(fileNumber)];
char *fullFillName = malloc( (strlen(fileNameNumber)+strlen(extension)) * sizeof(char*) );
char *fullFileName = malloc( (strlen(fileNameNumber)+strlen(extension)) * sizeof(char*) );
strcpy( fileNameNumber, fileName );
strcat( fileNameNumber, fileNumber );
strcpy( fullFillName, fileNameNumber );
strcat( fullFillName, extension );
strcpy( fullFileName, fileNameNumber );
strcat( fullFileName, extension );
return fullFillName;
return fullFileName;
}
int intInArray(int number , int *array , int N){
@ -66,7 +66,7 @@ int64_t millis()
timespec_get(&now, TIME_UTC);
return ((int64_t) now.tv_sec) * 1000 + ((int64_t) now.tv_nsec) / 1000000;
}
bool writeOneRawData(FILE *rawDataFill){
bool writeOneRawData(FILE *rawDataFile){
char buff[26];
char buff2[18];
int32_t values[8];
@ -75,7 +75,7 @@ bool writeOneRawData(FILE *rawDataFill){
if(fread(&buff, 26, 1, stdin)) {
fprintf(rawDataFill , "%d,", millis());
fprintf(rawDataFile , "%d,", millis());
if (strncmp(buff, "#################\n", (size_t)18) == 0) {
if (!(fread(&buff2, 18, 1, stdin))) {
fprintf(stderr, "Erreur lecture après ###...#");
@ -98,10 +98,10 @@ bool writeOneRawData(FILE *rawDataFill){
if(i==maxCApteurNb){
fprintf(rawDataFill, "%d\n", values[i]/256);
fprintf(rawDataFile, "%d\n", values[i]/256);
}
else{
fprintf(rawDataFill, "%d,", values[i]/256);
fprintf(rawDataFile, "%d,", values[i]/256);
}
}
}
@ -115,15 +115,18 @@ bool writeOneRawData(FILE *rawDataFill){
}
void *simulateFlux(void *vargp){
char *fillName = createNewRawDataFileName();
FILE *rawDataFill = fopen(fillName,"w+");
while(writeOneRawData(rawDataFill)){
char *fileName = createNewRawDataFileName();
FILE *rawDataFile = fopen(fileName,"w+");
while(writeOneRawData(rawDataFile)){
if(cptData == nRow){
fclose(rawDataFile);
cptData = 0;
cptFile++;
fillName = createNewRawDataFileName();
FILE *rawDataFill = fopen(fillName,"w+");
//create struct here
char *fileName = createNewRawDataFileName();
printf(fileName);
printf("\n");
FILE *rawDataFile = fopen(fileName,"w+");
}
}
}
}