gluon-status-page-api: neighbours-batadv: use batman-adv-visdata, increase interval
This commit is contained in:
		
							parent
							
								
									90a64ca87f
								
							
						
					
					
						commit
						939087cec9
					
				| @ -12,7 +12,7 @@ define Package/gluon-status-page-api | |||||||
|   SECTION:=gluon |   SECTION:=gluon | ||||||
|   CATEGORY:=Gluon |   CATEGORY:=Gluon | ||||||
|   TITLE:=API for gluon-status-page |   TITLE:=API for gluon-status-page | ||||||
|   DEPENDS:=+gluon-core +uhttpd +sse-multiplex +gluon-neighbour-info +gluon-announced +libiwinfo +libjson-c |   DEPENDS:=+gluon-core +uhttpd +sse-multiplex +batman-adv-visdata +gluon-neighbour-info +gluon-announced +libiwinfo +libjson-c | ||||||
| endef | endef | ||||||
| 
 | 
 | ||||||
| define Build/Prepare | define Build/Prepare | ||||||
|  | |||||||
| @ -12,12 +12,10 @@ static json_object *neighbours(void) { | |||||||
| 
 | 
 | ||||||
|   FILE *f; |   FILE *f; | ||||||
| 
 | 
 | ||||||
|   f = fopen("/sys/kernel/debug/batman_adv/bat0/originators" , "r"); |   f = fopen("/tmp/batman-adv-visdata/bat0/originators" , "r"); | ||||||
| 
 | 
 | ||||||
|   if (f == NULL) { |   if (f == NULL) | ||||||
|     perror("Can not open bat0/originators"); |     return NULL; | ||||||
|     exit(1); |  | ||||||
|   } |  | ||||||
| 
 | 
 | ||||||
|   while (!feof(f)) { |   while (!feof(f)) { | ||||||
|     char mac1[18]; |     char mac1[18]; | ||||||
| @ -55,10 +53,12 @@ int main(void) { | |||||||
| 
 | 
 | ||||||
|   while (1) { |   while (1) { | ||||||
|     obj = neighbours(); |     obj = neighbours(); | ||||||
|     printf("data: %s\n\n", json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PLAIN)); |     if (obj) { | ||||||
|     fflush(stdout); |       printf("data: %s\n\n", json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PLAIN)); | ||||||
|     json_object_put(obj); |       fflush(stdout); | ||||||
|     sleep(1); |       json_object_put(obj); | ||||||
|  |     } | ||||||
|  |     sleep(10); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   return 0; |   return 0; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user