aqhome-data: adding datapoints basically works now.
This commit is contained in:
@@ -359,6 +359,23 @@ void AQH_Storage_SetDataFileFolder(AQH_STORAGE *sto, const char *s)
|
||||
|
||||
|
||||
|
||||
int AQH_Storage_AddDatapoint(AQH_STORAGE *sto, uint64_t valueId, uint64_t timestamp, double dataPoint)
|
||||
{
|
||||
AQH_DATAFILE *df;
|
||||
|
||||
df=_getDataFileByValueId(sto, valueId);
|
||||
if (df) {
|
||||
DBG_INFO(AQH_LOGDOMAIN, "Appending record to datafile");
|
||||
AQH_DataFile_AppendRecord(df, timestamp, dataPoint);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
DBG_ERROR(AQH_LOGDOMAIN, "Error getting data file for value %lu", (unsigned long int) valueId);
|
||||
return GWEN_ERROR_GENERIC;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQH_Storage_HandleMqttPublish(AQH_STORAGE *sto, const char *sTopic, const char *sValue)
|
||||
{
|
||||
|
||||
@@ -86,6 +86,8 @@ AQHOME_API int AQH_Storage_Fini(AQH_STORAGE *sto);
|
||||
|
||||
AQHOME_API int AQH_Storage_WriteState(AQH_STORAGE *sto);
|
||||
|
||||
AQHOME_API int AQH_Storage_AddDatapoint(AQH_STORAGE *sto, uint64_t valueId, uint64_t timestamp, double dataPoint);
|
||||
|
||||
|
||||
AQHOME_API void AQH_Storage_HandleMqttPublish(AQH_STORAGE *sto, const char *topic, const char *value);
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <gwenhywfar/debug.h>
|
||||
#include <gwenhywfar/msg_ipc.h>
|
||||
#include <gwenhywfar/text.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@@ -23,10 +23,11 @@
|
||||
|
||||
|
||||
#define AQH_MSG_IPC_SUCCESS 0
|
||||
#define AQH_MSG_IPC_ERROR_INVALID 1
|
||||
#define AQH_MSG_IPC_ERROR_EXISTS 2
|
||||
#define AQH_MSG_IPC_ERROR_NODATA 3
|
||||
#define AQH_MSG_IPC_ERROR_BADDATA 4
|
||||
#define AQH_MSG_IPC_ERROR_GENERIC 1
|
||||
#define AQH_MSG_IPC_ERROR_INVALID 2
|
||||
#define AQH_MSG_IPC_ERROR_EXISTS 3
|
||||
#define AQH_MSG_IPC_ERROR_NODATA 4
|
||||
#define AQH_MSG_IPC_ERROR_BADDATA 5
|
||||
|
||||
|
||||
AQHOME_API GWEN_MSG *AQH_ResultIpcMsg_new(uint16_t code, uint32_t resultCode);
|
||||
|
||||
Reference in New Issue
Block a user