mirror of
https://gitlab.com/manzerbredes/ina260-zmq-publisher.git
synced 2025-04-06 03:46:25 +02:00
Minor changes
This commit is contained in:
parent
a37251135e
commit
b80973cbd0
5 changed files with 15 additions and 8 deletions
5
Makefile
5
Makefile
|
@ -14,7 +14,10 @@ client: src/client.c
|
|||
logger: src/logger.c src/utils.c
|
||||
$(CC) $^ -o $@
|
||||
|
||||
start: publisher client
|
||||
$(error "Not yet implemented")
|
||||
|
||||
clean:
|
||||
rm -f logger client publisher
|
||||
|
||||
.PHONY: clean publisher client logger
|
||||
.PHONY: clean publisher client logger start
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
##### ZeroMQ
|
||||
PUBLISHER_PORT=5556
|
||||
PUBLISHER_ADDR=localhost
|
||||
LOGGER_DIR=./logs
|
||||
|
||||
##### Logger/Publisher
|
||||
LOGGERS_DIR=./logs
|
||||
LOG_INTERVAL=30
|
0
jean
0
jean
|
@ -60,7 +60,7 @@ int main (int argc, char *argv [])
|
|||
int power;
|
||||
time_t interval;
|
||||
|
||||
for(int i=0;i<1;i++){
|
||||
while(1){
|
||||
interval=INTERVAL(__loginterval);
|
||||
*logfilepath='\0';
|
||||
sprintf(logfilepath,"%s/%ld",__logdir,interval);
|
||||
|
|
|
@ -40,11 +40,11 @@ int main (int argc, char *argv [])
|
|||
}
|
||||
|
||||
//----- Start publisher
|
||||
DIR *dr = opendir(__logdir);
|
||||
struct dirent *de; // Pointer for directory entry
|
||||
for(int i=0;i<=0;i++){
|
||||
while(1){
|
||||
int interval=INTERVAL(__loginterval);
|
||||
int interval_next=INTERVAL_NEXT(__loginterval);
|
||||
DIR *dr = opendir(__logdir);
|
||||
while ((de = readdir(dr)) != NULL){
|
||||
if(strcmp(de->d_name,".") && strcmp(de->d_name,"..")){
|
||||
char *client=de->d_name;
|
||||
|
@ -61,12 +61,12 @@ int main (int argc, char *argv [])
|
|||
// Send current one
|
||||
if(FILE_EXISTS(logfile)){
|
||||
publish(logfile,client,interval);
|
||||
remove(logfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dr);
|
||||
}
|
||||
closedir(dr);
|
||||
|
||||
|
||||
zmq_close (publisher);
|
||||
zmq_ctx_destroy (context);
|
||||
|
@ -89,5 +89,5 @@ int main (int argc, char *argv [])
|
|||
}
|
||||
|
||||
void publish(char *filepath, char* client, int interval){
|
||||
|
||||
printf("Publish!\n");
|
||||
}
|
Loading…
Add table
Reference in a new issue