bmsd/ispindels.c

changeset 850
26cc7ea0f790
parent 849
16079aef4c4c
child 852
71f0fa38b634
equal deleted inserted replaced
849:16079aef4c4c 850:26cc7ea0f790
87 msg = xstrcat(msg, (char *)",\"og_gravity\":"); 87 msg = xstrcat(msg, (char *)",\"og_gravity\":");
88 snprintf(buf, 64, "%.6f", ispindel->og_gravity); 88 snprintf(buf, 64, "%.6f", ispindel->og_gravity);
89 msg = xstrcat(msg, buf); 89 msg = xstrcat(msg, buf);
90 msg = xstrcat(msg, (char *)",\"alarm\":"); 90 msg = xstrcat(msg, (char *)",\"alarm\":");
91 snprintf(buf, 64, "%d", ispindel->alarm); 91 snprintf(buf, 64, "%d", ispindel->alarm);
92 msg = xstrcat(msg, buf);
93 msg = xstrcat(msg, (char *)",\"lastseen\":");
94 snprintf(buf, 64, "%ld", ispindel->lastseen);
92 msg = xstrcat(msg, buf); 95 msg = xstrcat(msg, buf);
93 msg = xstrcat(msg, (char *)"}"); 96 msg = xstrcat(msg, (char *)"}");
94 ws_broadcast(msg); 97 ws_broadcast(msg);
95 free(msg); 98 free(msg);
96 msg = NULL; 99 msg = NULL;
231 char *datetime, buf[65], *line, *logfile, *query = malloc(512); 234 char *datetime, buf[65], *line, *logfile, *query = malloc(512);
232 struct tm *mytime; 235 struct tm *mytime;
233 time_t timestamp; 236 time_t timestamp;
234 FILE *fp; 237 FILE *fp;
235 238
236 syslog(LOG_NOTICE, "ispindel_set: %s %s", node, payload); 239 //syslog(LOG_NOTICE, "ispindel_set: %s %s", node, payload);
237 240
238 /* 241 /*
239 * Search ispindel record in the memory array and use it if found. 242 * Search ispindel record in the memory array and use it if found.
240 */ 243 */
241 if (ispindels) { 244 if (ispindels) {

mercurial