mirror of
https://gitlab.com/manzerbredes/ina260-zmq-publisher.git
synced 2025-04-07 04:16:26 +02:00
Minor changes
This commit is contained in:
parent
3da360332b
commit
97e167da1b
2 changed files with 18 additions and 3 deletions
|
@ -63,7 +63,7 @@ int main (int argc, char *argv [])
|
||||||
for(int i=0;i<1;i++){
|
for(int i=0;i<1;i++){
|
||||||
interval=INTERVAL(__loginterval);
|
interval=INTERVAL(__loginterval);
|
||||||
*logfilepath='\0';
|
*logfilepath='\0';
|
||||||
sprintf(logfilepath,"%s/%ld",__logdir);
|
sprintf(logfilepath,"%s/%ld",__logdir,interval);
|
||||||
logptr=fopen(logfilepath,"w");
|
logptr=fopen(logfilepath,"w");
|
||||||
fprintf(logptr,"timestamp,power\n");
|
fprintf(logptr,"timestamp,power\n");
|
||||||
// Log current interval
|
// Log current interval
|
||||||
|
|
|
@ -24,15 +24,30 @@ int main (int argc, char *argv [])
|
||||||
__logdir=argv[1];
|
__logdir=argv[1];
|
||||||
__loginterval=atoi(argv[2]);
|
__loginterval=atoi(argv[2]);
|
||||||
|
|
||||||
|
|
||||||
|
//----- Start publisher
|
||||||
DIR *dr = opendir(__logdir);
|
DIR *dr = opendir(__logdir);
|
||||||
struct dirent *de; // Pointer for directory entry
|
struct dirent *de; // Pointer for directory entry
|
||||||
for(int i=0;i<0;i++){
|
for(int i=0;i<=0;i++){
|
||||||
int interval=INTERVAL(__loginterval);
|
int interval=INTERVAL(__loginterval);
|
||||||
int interval_next=INTERVAL_NEXT(__loginterval);
|
int interval_next=INTERVAL_NEXT(__loginterval);
|
||||||
while ((de = readdir(dr)) != NULL){
|
while ((de = readdir(dr)) != NULL){
|
||||||
if(strcmp(de->d_name,".") && strcmp(de->d_name,"..")){
|
if(strcmp(de->d_name,".") && strcmp(de->d_name,"..")){
|
||||||
char *client=de->d_name;
|
char *client=de->d_name;
|
||||||
printf("aa%s\n",client);
|
char logfile[255];
|
||||||
|
char logfile_next[255];
|
||||||
|
sprintf(logfile,"%s/%s/%ld",__logdir,client,interval);
|
||||||
|
sprintf(logfile_next,"%s/%s/%ld",__logdir,client,interval_next);
|
||||||
|
// As long as next logfile is not available, we should wait
|
||||||
|
// for sending the current one
|
||||||
|
printf("Waiting for %s...%s\n",client,logfile_next);
|
||||||
|
while(!FILE_EXISTS(logfile_next)){
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
// Send current one
|
||||||
|
if(FILE_EXISTS(logfile)){
|
||||||
|
printf("Sending....\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue