bmsd/fermenters.h

Mon, 18 May 2020 11:00:59 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 18 May 2020 11:00:59 +0200
changeset 679
48f8f3fce7c0
parent 0
033898178630
permissions
-rw-r--r--

Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.

/**
 * @file fermenters.h
 */

#ifndef _FERMENTERS_H
#define _FERMENTERS_H

void fermenter_dump(sys_fermenter_list *fermenter);

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

/**
 * @brief Birth of a fermenter 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 fermenter type and name.
 * @param payload The JSON formatted payload with the fermenter details.
 */
void fermenter_birth_data(char *topic, char *payload);

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

/**
 * @brief Data logging from fermenters.
 * @param topic The MQTT topic string, contains the fermenter type and name.
 * @param payload The JSON formatted payload with the fermenter details.
 */
void fermenter_log(char *topic, char *payload);


#endif

mercurial