bmsd/nodes.h

Fri, 22 Jul 2022 12:15:05 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 22 Jul 2022 12:15:05 +0200
changeset 799
cf145b35d65f
parent 795
9472106a3143
permissions
-rw-r--r--

Version 0.3.41. Use INSERT IGNORE .. for insert log messages from fermenters, co2meters and ispindels. Connect to MySQL servers with MYSQL_OPT_RECONNECT instead of manual working around the connection lost problem if a mysql server is restarted. Removed unused bms_mysql_ping function.

/**
 * @file nodes.h
 */

#ifndef _NODES_H
#define _NODES_H

void node_dump(sys_node_list *node);

/**
 * @brief Birth of a node or data update. Create it in the database if 
 *        never seen before, else just update the database entry.
 * @param topic The MQTT topic string, contains the node type and name.
 * @param payload The JSON formatted payload with the node details.
 */
void node_birth_data(char *topic, char *payload);

/**
 * @brief Death of a node. Mark it offline in the database.
 * @param topic The MQTT topic string, contains the node type and name.
 */
void node_death(char *topic);

/**
 * @brief Check if nodes are still online and mark them offline if not
 *        been seen for twice the node interval time plus a few seconds..
 */
void nodes_check_online(void);

/**
 * @brief Process received command from a websocket.
 * @param payload The received data in JSON format.
 */
void node_ws_receive(char *payload);

#endif

mercurial