bmsd/mysql.h

Thu, 12 Oct 2023 14:19:46 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 12 Oct 2023 14:19:46 +0200
changeset 849
16079aef4c4c
parent 799
cf145b35d65f
permissions
-rw-r--r--

Version 0.3.44. Moved iSpindel Plato calculation from the php script to bmsd. This uses calibration data in the mon_ispindels table. Setup of this data will be done by the bmsapp applications. Default settings are stored in MySQL. From now on you don't need to store calibration data in the iSpindel.

/**
 * @file mysql.h
 */
#ifndef _MYSQL_H
#define _MYSQL_H


/**
 * @brief Connect to the MySQL server and select the database. All parameters must be
 *        set in the $HOME/.bms/bms.conf file.
 * @return 0 if success, any other value if the connection failed.
 */
int  bms_mysql_init(void);

/**
 * @brief Close MySQL connection and free resources.
 */
void bms_mysql_end(void);

/**
 * @brief Send query to the MySQL server with one reconnect attempt.
 * @param query The SQL query to send.
 * @return Return 0 if no error, else the error code.
 */
int bms_mysql_query(const char *query);

void node_mysql_insert(sys_node_list *node);
void node_mysql_update(sys_node_list *node);
void node_mysql_death(char *node);

void fermenter_mysql_insert(sys_fermenter_list *fermenter);
void fermenter_mysql_update(sys_fermenter_list *fermenter);
void fermenter_mysql_death(char *node, char *alias);

void co2meter_mysql_insert(sys_co2meter_list *co2meter);
void co2meter_mysql_update(sys_co2meter_list *co2meter);
void co2meter_mysql_death(char *node, char *alias);

double ispindel_mysql_plato(char *uuid, double angle);
void ispindel_mysql_insert(sys_ispindel_list *ispindel);
void ispindel_mysql_update(sys_ispindel_list *ispindel);
void ispindel_mysql_death(char *alias);


#endif

mercurial