bmsd/bms.h

branch
stable
changeset 665
4d01937ae7af
parent 578
e75ce5bbda73
child 671
4b54d6f79d25
--- a/bmsd/bms.h	Fri Oct 18 13:20:35 2019 +0200
+++ b/bmsd/bms.h	Fri May 01 16:37:31 2020 +0200
@@ -45,7 +45,12 @@
 #include <libxml/encoding.h>
 #include <libxml/xmlwriter.h>
 #include <mosquitto.h>
+#ifdef HAVE_MYSQL_MYSQL_H
 #include <mysql/mysql.h>
+#endif
+#ifdef HAVE_MARIADB_MYSQL_H
+#include <mariadb/mysql.h>
+#endif
 #include <json-c/json.h>
 
 
@@ -53,7 +58,7 @@
 
 
 #define MQTT_NODE_CONTROL	0x0001			///< Show node control
-
+#define LOWBATT			3.3			///< Low battery voltage
 
 
 /**
@@ -100,6 +105,7 @@
     char			*net_address;		///< IPv4 or IPv6 address
     char			*net_ifname;		///< Interface name
     int				net_rssi;		///< RSSI value if wireless.
+    int				interval;		///< Update interval
 } sys_node_list;
 
 
@@ -146,6 +152,7 @@
 {
     ALARM_FLAG_DOOR	= 0x0001,	///< Door open
     ALARM_FLAG_PSU	= 0x0002,	///< PSU problem
+    ALARM_FLAG_BATTERY	= 0x0004,	///< Low battery
     ALARM_FLAG_CHILLER	= 0x0100,	///< Chiller too warm
 } ALARM_FLAGS;
 
@@ -237,7 +244,7 @@
     int		fan_power;		///< Fan power 0 or 100
     uint64_t	fan_usage;		///< Fan usage counter in seconds
     float	setpoint_low;		///< Target temperature low
-    float	setpoint_high;		///< Tarhet temperature high
+    float	setpoint_high;		///< Target temperature high
     char	*mode;			///< Working mode.
     char	*stage;			///< Fermentation stage
     char	*event;			///< Optional event
@@ -275,7 +282,7 @@
 
 
 /**
- * @brief Strcuture holding a co2 pressure log entry.
+ * @brief Structure holding a co2 pressure log entry.
  */
 typedef struct co2meter_log {
     char			*datetime;		///< Date/time stamp
@@ -300,35 +307,25 @@
 } brewer_list;
 
 
-// Make it universal and make it connectable with a fermenter.
+// Make it universal and make it connectable with a beer.
 typedef struct _ispindel_list {
     struct _ispindel_list	*next;
-    char			*uuid;			///< Fixed uuid string
-    char			*name;			///< Name or description (Red iSpindle).
-    char			*beercode;		///< Beer code if in use.
-    float			temperature;		///< Temperature of the beer.
-    float			gravity;		///< Measured gravity
-    							// What nore, battery?
-} ispindel_list;
-
-
-// Hergisting meters.
+    char			*uuid;			///< Fixed uuid string.
+    char			*alias;			///< Alias name.
+    char			*node;			///< Node name received.
+    bool			online;			///< Is considered online.
+    char			*mode;			///< Working mode OFF or ON.
+    uint32_t			alarm;			///< Alarm flags.
+    char			*beercode;              ///< Beer unique code
+    char                        *beername;              ///< Beer name being measured
+    char                        *beeruuid;              ///< Beer uuid being measured
+    float			angle;			///< Tilt angle in degrees
+    float			temperature;		///< Temperature in C
+    float			battery;		///< Battery voltage
+    float			gravity;		///< Gravity in plato?
+    int				interval;		///< Measure interval
+} sys_ispindel_list;
 
-/**
- * @brief Standalone temperature loggers. (Freezers, refrigerators, chambers).
- */
-typedef struct _thb_list {
-    struct _thb_list		*next;
-    char			*uuit;			///< Fixed uuid string
-    char			*name;			///< Name or description
-    char			*beercode;		///< Beer code if needed.
-    float			temperature;		///< Temperature in Celcius
-    float			humidity;		///< Humidity in %
-    float			barometer;		///< Air pressure.
-    float			gps_latitude;		///< GPS latitude
-    float			gps_longitude;		///< GPS longitide
-    float			gps_altitude;		///< GPS altitude
-} thb_list;
 
 
 #endif

mercurial