bmsd/nodes.h

Wed, 20 May 2020 21:49:09 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 20 May 2020 21:49:09 +0200
changeset 684
ccb9f24d0fe9
parent 384
442d23455ae4
child 686
ca1fbb3bd3db
permissions
-rw-r--r--

Report any online status change via websocket broadcast. When starting, load all in memory tables sorted. The websocket status on the web pages has it's own panel. Prepared the menu system for dynamic updates.

/**
 * @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 Report status change of nodes so that the client menus are updated.
 */
void status_change(void);

#endif

mercurial