debug dtatFill gestion
This commit is contained in:
parent
a7ce786b92
commit
1f350d095d
BIN
Code-C/main
BIN
Code-C/main
Binary file not shown.
|
@ -35,15 +35,15 @@ char *createNewRawDataFileName(){
|
||||||
char *fileNumber = convertIntegerToChar(cptFile);
|
char *fileNumber = convertIntegerToChar(cptFile);
|
||||||
|
|
||||||
char fileNameNumber[strlen(fileName)+strlen(fileNumber)];
|
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 );
|
strcpy( fileNameNumber, fileName );
|
||||||
strcat( fileNameNumber, fileNumber );
|
strcat( fileNameNumber, fileNumber );
|
||||||
|
|
||||||
strcpy( fullFillName, fileNameNumber );
|
strcpy( fullFileName, fileNameNumber );
|
||||||
strcat( fullFillName, extension );
|
strcat( fullFileName, extension );
|
||||||
|
|
||||||
return fullFillName;
|
return fullFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
int intInArray(int number , int *array , int N){
|
int intInArray(int number , int *array , int N){
|
||||||
|
@ -66,7 +66,7 @@ int64_t millis()
|
||||||
timespec_get(&now, TIME_UTC);
|
timespec_get(&now, TIME_UTC);
|
||||||
return ((int64_t) now.tv_sec) * 1000 + ((int64_t) now.tv_nsec) / 1000000;
|
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 buff[26];
|
||||||
char buff2[18];
|
char buff2[18];
|
||||||
int32_t values[8];
|
int32_t values[8];
|
||||||
|
@ -75,7 +75,7 @@ bool writeOneRawData(FILE *rawDataFill){
|
||||||
|
|
||||||
|
|
||||||
if(fread(&buff, 26, 1, stdin)) {
|
if(fread(&buff, 26, 1, stdin)) {
|
||||||
fprintf(rawDataFill , "%d,", millis());
|
fprintf(rawDataFile , "%d,", millis());
|
||||||
if (strncmp(buff, "#################\n", (size_t)18) == 0) {
|
if (strncmp(buff, "#################\n", (size_t)18) == 0) {
|
||||||
if (!(fread(&buff2, 18, 1, stdin))) {
|
if (!(fread(&buff2, 18, 1, stdin))) {
|
||||||
fprintf(stderr, "Erreur lecture après ###...#");
|
fprintf(stderr, "Erreur lecture après ###...#");
|
||||||
|
@ -98,10 +98,10 @@ bool writeOneRawData(FILE *rawDataFill){
|
||||||
|
|
||||||
|
|
||||||
if(i==maxCApteurNb){
|
if(i==maxCApteurNb){
|
||||||
fprintf(rawDataFill, "%d\n", values[i]/256);
|
fprintf(rawDataFile, "%d\n", values[i]/256);
|
||||||
}
|
}
|
||||||
else{
|
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){
|
void *simulateFlux(void *vargp){
|
||||||
|
char *fileName = createNewRawDataFileName();
|
||||||
char *fillName = createNewRawDataFileName();
|
FILE *rawDataFile = fopen(fileName,"w+");
|
||||||
FILE *rawDataFill = fopen(fillName,"w+");
|
while(writeOneRawData(rawDataFile)){
|
||||||
while(writeOneRawData(rawDataFill)){
|
|
||||||
if(cptData == nRow){
|
if(cptData == nRow){
|
||||||
|
fclose(rawDataFile);
|
||||||
cptData = 0;
|
cptData = 0;
|
||||||
cptFile++;
|
cptFile++;
|
||||||
fillName = createNewRawDataFileName();
|
//create struct here
|
||||||
FILE *rawDataFill = fopen(fillName,"w+");
|
char *fileName = createNewRawDataFileName();
|
||||||
|
printf(fileName);
|
||||||
|
printf("\n");
|
||||||
|
FILE *rawDataFile = fopen(fileName,"w+");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue