bmsd/nodes.c

changeset 677
6e82fece1f8f
parent 675
a27af02ab16a
child 684
ccb9f24d0fe9
equal deleted inserted replaced
676:b0718965dcb1 677:6e82fece1f8f
316 if (strcmp(tmpf->node, tmpn->node) == 0) { 316 if (strcmp(tmpf->node, tmpn->node) == 0) {
317 if (tmpf->online) { 317 if (tmpf->online) {
318 syslog(LOG_NOTICE, "Timeout fermenter %s/%s", tmpf->node, tmpf->alias); 318 syslog(LOG_NOTICE, "Timeout fermenter %s/%s", tmpf->node, tmpf->alias);
319 tmpf->online = false; 319 tmpf->online = false;
320 fermenter_mysql_death(tmpf->node, tmpf->alias); 320 fermenter_mysql_death(tmpf->node, tmpf->alias);
321 msg = xstrcpy((char *)"{\"device\":\"fermenter\",\"node\":\""); 321 msg = xstrcpy((char *)"{\"device\":\"fermenters\",\"node\":\"");
322 msg = xstrcat(msg, tmpf->node); 322 msg = xstrcat(msg, tmpf->node);
323 msg = xstrcat(msg, (char *)"\",\"unit\":\""); 323 msg = xstrcat(msg, (char *)"\",\"unit\":\"");
324 msg = xstrcat(msg, tmpf->alias); 324 msg = xstrcat(msg, tmpf->alias);
325 msg = xstrcat(msg, (char *)"\",\"online\":0}"); 325 msg = xstrcat(msg, (char *)"\",\"online\":0}");
326 ws_broadcast(msg); 326 ws_broadcast(msg);
335 if (strcmp(tmpc->node, tmpn->node) == 0) { 335 if (strcmp(tmpc->node, tmpn->node) == 0) {
336 if (tmpc->online) { 336 if (tmpc->online) {
337 syslog(LOG_NOTICE, "Timeout co2meter %s/%s", tmpc->node, tmpc->alias); 337 syslog(LOG_NOTICE, "Timeout co2meter %s/%s", tmpc->node, tmpc->alias);
338 tmpc->online = false; 338 tmpc->online = false;
339 co2meter_mysql_death(tmpc->node, tmpc->alias); 339 co2meter_mysql_death(tmpc->node, tmpc->alias);
340 msg = xstrcpy((char *)"{\"device\":\"co2meter\",\"node\":\""); 340 msg = xstrcpy((char *)"{\"device\":\"co2meters\",\"node\":\"");
341 msg = xstrcat(msg, tmpc->node); 341 msg = xstrcat(msg, tmpc->node);
342 msg = xstrcat(msg, (char *)"\",\"unit\":\""); 342 msg = xstrcat(msg, (char *)"\",\"unit\":\"");
343 msg = xstrcat(msg, tmpc->alias); 343 msg = xstrcat(msg, tmpc->alias);
344 msg = xstrcat(msg, (char *)"\",\"online\":0}"); 344 msg = xstrcat(msg, (char *)"\",\"online\":0}");
345 ws_broadcast(msg); 345 ws_broadcast(msg);
354 if (strcmp(tmpi->node, tmpn->node) == 0) { 354 if (strcmp(tmpi->node, tmpn->node) == 0) {
355 if (tmpi->online) { 355 if (tmpi->online) {
356 syslog(LOG_NOTICE, "Timeout ispindel %s", tmpi->node); 356 syslog(LOG_NOTICE, "Timeout ispindel %s", tmpi->node);
357 tmpi->online = false; 357 tmpi->online = false;
358 ispindel_mysql_death(tmpi->node); 358 ispindel_mysql_death(tmpi->node);
359 msg = xstrcpy((char *)"{\"device\":\"ispindel\",\"node\":\""); 359 msg = xstrcpy((char *)"{\"device\":\"ispindels\",\"node\":\"");
360 msg = xstrcat(msg, tmpi->node); 360 msg = xstrcat(msg, tmpi->node);
361 msg = xstrcat(msg, (char *)"\",\"unit\":\""); 361 msg = xstrcat(msg, (char *)"\",\"unit\":\"");
362 msg = xstrcat(msg, tmpi->alias); 362 msg = xstrcat(msg, tmpi->alias);
363 msg = xstrcat(msg, (char *)"\",\"online\":0}"); 363 msg = xstrcat(msg, (char *)"\",\"online\":0}");
364 ws_broadcast(msg); 364 ws_broadcast(msg);

mercurial