bmsd/websocket.h

Tue, 31 Aug 2021 20:48:37 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 31 Aug 2021 20:48:37 +0200
changeset 774
92e1e8f175a2
parent 671
4b54d6f79d25
permissions
-rw-r--r--

Split batch, adjust mash step volume. In the duplicated log_brew handle the missing values. In save product, round the mash step sg to 4 decimals. In prod_edit, ingredients are stored as strings, not arrays. This triggered a memory corruption that only happened in rare circumstances. Don't fix mash step fields in the javascript, it is already done during load from the database. Calculation of the mash volume is rounded to 6 decimals. Enter mash step Brix/Plato value, the SG result is rounded to 4 decimals.

/**
 * @file websocket.h
 */

#ifndef _WEBSOCKET_H
#define	_WEBSOCKET_H


struct per_session_data__lws_mirror {
        struct lws *wsi;
        int ringbuffer_tail;
};

/**
 * @brief Broadcast messages to all connected websocket clients.
 * @param msg The message to send. Messages are placed in a ringbuffer queue.
 */
void ws_broadcast(char *msg);

/**
 * @brief Check if a connection is idle for 45 seconds and if so send a ping like
 *        message to keep the connection alive. Call this function at regular intervals.
 */
void ws_check(void);

/**
 * @brief The websockets server thread.
 */
void *ws_loop(void *);

#endif

mercurial