aqhome-data: adding datapoints basically works now.

This commit is contained in:
Martin Preuss
2023-08-17 00:24:38 +02:00
parent f9ae85b9ad
commit 3bfb39966f
19 changed files with 727 additions and 45 deletions

View File

@@ -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)
{

View File

@@ -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);