Wed, 29 Jan 2020 16:58:04 +0100
Added COLOR_METHOD, IBU_METHOD, MAGNESIUM fields.
0 | 1 | /** |
2 | * @file mysql.h | |
3 | */ | |
4 | #ifndef _MYSQL_H | |
5 | #define _MYSQL_H | |
6 | ||
7 | ||
8 | /** | |
9 | * @brief Connect to the MySQL server and select the database. All parameters must be | |
10 | * set in the $HOME/.bms/bms.conf file. | |
11 | * @return 0 if success, any other value if the connection failed. | |
12 | */ | |
13 | int bms_mysql_init(void); | |
14 | ||
15 | /** | |
16 | * @brief Close MySQL connection and free resources. | |
17 | */ | |
18 | void bms_mysql_end(void); | |
19 | ||
20 | /** | |
405
ef3f0274a1ea
Added a private mysql_query function that does try to reconnect a lost MySQL connection.
Michiel Broek <mbroek@mbse.eu>
parents:
194
diff
changeset
|
21 | * @brief Send query to the MySQL server with one reconnect attempt. |
ef3f0274a1ea
Added a private mysql_query function that does try to reconnect a lost MySQL connection.
Michiel Broek <mbroek@mbse.eu>
parents:
194
diff
changeset
|
22 | * @param query The SQL query to send. |
ef3f0274a1ea
Added a private mysql_query function that does try to reconnect a lost MySQL connection.
Michiel Broek <mbroek@mbse.eu>
parents:
194
diff
changeset
|
23 | * @return Return 0 if no error, else the error code. |
ef3f0274a1ea
Added a private mysql_query function that does try to reconnect a lost MySQL connection.
Michiel Broek <mbroek@mbse.eu>
parents:
194
diff
changeset
|
24 | */ |
ef3f0274a1ea
Added a private mysql_query function that does try to reconnect a lost MySQL connection.
Michiel Broek <mbroek@mbse.eu>
parents:
194
diff
changeset
|
25 | int bms_mysql_query(const char *query); |
ef3f0274a1ea
Added a private mysql_query function that does try to reconnect a lost MySQL connection.
Michiel Broek <mbroek@mbse.eu>
parents:
194
diff
changeset
|
26 | |
ef3f0274a1ea
Added a private mysql_query function that does try to reconnect a lost MySQL connection.
Michiel Broek <mbroek@mbse.eu>
parents:
194
diff
changeset
|
27 | /** |
0 | 28 | * @brief Ping MySQL connection and try to reconnect if the connection is broken. |
29 | */ | |
30 | void bms_mysql_ping(void); | |
31 | ||
32 | void node_mysql_insert(sys_node_list *node); | |
33 | void node_mysql_update(sys_node_list *node); | |
34 | void node_mysql_death(char *node); | |
35 | ||
36 | void fermenter_mysql_insert(sys_fermenter_list *fermenter); | |
37 | void fermenter_mysql_update(sys_fermenter_list *fermenter); | |
38 | void fermenter_mysql_death(char *node, char *alias); | |
39 | ||
502
a8a6901b5a99
Added CO2 meter units to the daemon.
Michiel Broek <mbroek@mbse.eu>
parents:
405
diff
changeset
|
40 | void co2meter_mysql_insert(sys_co2meter_list *co2meter); |
a8a6901b5a99
Added CO2 meter units to the daemon.
Michiel Broek <mbroek@mbse.eu>
parents:
405
diff
changeset
|
41 | void co2meter_mysql_update(sys_co2meter_list *co2meter); |
a8a6901b5a99
Added CO2 meter units to the daemon.
Michiel Broek <mbroek@mbse.eu>
parents:
405
diff
changeset
|
42 | void co2meter_mysql_death(char *node, char *alias); |
a8a6901b5a99
Added CO2 meter units to the daemon.
Michiel Broek <mbroek@mbse.eu>
parents:
405
diff
changeset
|
43 | |
567
6bf0afc33e70
Initial code for iSpindel support in the daemon
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
44 | void ispindel_mysql_insert(sys_ispindel_list *ispindel); |
6bf0afc33e70
Initial code for iSpindel support in the daemon
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
45 | void ispindel_mysql_update(sys_ispindel_list *ispindel); |
6bf0afc33e70
Initial code for iSpindel support in the daemon
Michiel Broek <mbroek@mbse.eu>
parents:
502
diff
changeset
|
46 | void ispindel_mysql_death(char *alias); |
0 | 47 | |
579
1253a237b620
Added check for database changes for iSpindels such as a new beer, or changing mode. Added denity in Plato and SG to the iSpindel web screen. The iSpindels must be calibrated in Plato! A bit of documentation updated.
Michiel Broek <mbroek@mbse.eu>
parents:
567
diff
changeset
|
48 | /** |
1253a237b620
Added check for database changes for iSpindels such as a new beer, or changing mode. Added denity in Plato and SG to the iSpindel web screen. The iSpindels must be calibrated in Plato! A bit of documentation updated.
Michiel Broek <mbroek@mbse.eu>
parents:
567
diff
changeset
|
49 | * @brief Check state changes in the database for all iSpindels and |
1253a237b620
Added check for database changes for iSpindels such as a new beer, or changing mode. Added denity in Plato and SG to the iSpindel web screen. The iSpindels must be calibrated in Plato! A bit of documentation updated.
Michiel Broek <mbroek@mbse.eu>
parents:
567
diff
changeset
|
50 | * update the internal memory array. Called every 5 seconds from |
1253a237b620
Added check for database changes for iSpindels such as a new beer, or changing mode. Added denity in Plato and SG to the iSpindel web screen. The iSpindels must be calibrated in Plato! A bit of documentation updated.
Michiel Broek <mbroek@mbse.eu>
parents:
567
diff
changeset
|
51 | * the main server thread. |
1253a237b620
Added check for database changes for iSpindels such as a new beer, or changing mode. Added denity in Plato and SG to the iSpindel web screen. The iSpindels must be calibrated in Plato! A bit of documentation updated.
Michiel Broek <mbroek@mbse.eu>
parents:
567
diff
changeset
|
52 | */ |
1253a237b620
Added check for database changes for iSpindels such as a new beer, or changing mode. Added denity in Plato and SG to the iSpindel web screen. The iSpindels must be calibrated in Plato! A bit of documentation updated.
Michiel Broek <mbroek@mbse.eu>
parents:
567
diff
changeset
|
53 | void ispindel_mysql_check(void); |
1253a237b620
Added check for database changes for iSpindels such as a new beer, or changing mode. Added denity in Plato and SG to the iSpindel web screen. The iSpindels must be calibrated in Plato! A bit of documentation updated.
Michiel Broek <mbroek@mbse.eu>
parents:
567
diff
changeset
|
54 | |
1253a237b620
Added check for database changes for iSpindels such as a new beer, or changing mode. Added denity in Plato and SG to the iSpindel web screen. The iSpindels must be calibrated in Plato! A bit of documentation updated.
Michiel Broek <mbroek@mbse.eu>
parents:
567
diff
changeset
|
55 | |
0 | 56 | #endif |