Files
aqhomecontrol/aqhome/data/storage.h
2023-09-20 17:51:02 +02:00

91 lines
2.5 KiB
C

/****************************************************************************
* This file is part of the project Gwenhywfar.
* Gwenhywfar (c) by 2023 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
****************************************************************************/
#ifndef AQH_STORAGE_H
#define AQH_STORAGE_H
#include <aqhome/api.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct AQH_STORAGE AQH_STORAGE;
#ifdef __cplusplus
}
#endif
#include "aqhome/data/room.h"
#include "aqhome/data/device.h"
#include "aqhome/data/mqtttopic.h"
#include "aqhome/data/value.h"
#include "aqhome/data/datapoint.h"
#define AQH_STORAGE_RTFLAGS_MODIFIED 0x0001
#ifdef __cplusplus
extern "C" {
#endif
/**
*/
AQHOME_API AQH_STORAGE *AQH_Storage_new(void);
AQHOME_API void AQH_Storage_free(AQH_STORAGE *sto);
AQHOME_API void AQH_Storage_AddValue(AQH_STORAGE *sto, AQH_VALUE *value);
AQHOME_API AQH_VALUE_LIST *AQH_Storage_GetValueList(const AQH_STORAGE *sto);
AQHOME_API AQH_VALUE *AQH_Storage_GetValueById(const AQH_STORAGE *sto, uint64_t id);
AQHOME_API AQH_VALUE *AQH_Storage_GetValueByNameForSystem(const AQH_STORAGE *sto, const char *s);
AQHOME_API const char *AQH_Storage_GetStateFile(const AQH_STORAGE *sto);
AQHOME_API void AQH_Storage_SetStateFile(AQH_STORAGE *sto, const char *s);
AQHOME_API const char *AQH_Storage_GetDataFileFolder(const AQH_STORAGE *sto);
AQHOME_API void AQH_Storage_SetDataFileFolder(AQH_STORAGE *sto, const char *s);
AQHOME_API uint32_t AQH_Storage_GetRuntimeFlags(const AQH_STORAGE *sto);
AQHOME_API void AQH_Storage_SetRuntimeFlags(AQH_STORAGE *sto, uint32_t flags);
AQHOME_API void AQH_Storage_AddRuntimeFlags(AQH_STORAGE *sto, uint32_t flags);
AQHOME_API void AQH_Storage_SubRuntimeFlags(AQH_STORAGE *sto, uint32_t flags);
AQHOME_API int AQH_Storage_Init(AQH_STORAGE *sto);
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 uint64_t *AQH_Storage_GetDataPoints(AQH_STORAGE *sto, uint64_t valueId,
uint64_t fromTime, uint64_t toTime,
uint64_t maxArrayLen);
AQHOME_API int AQH_Storage_GetLastDataPoint(AQH_STORAGE *sto, uint64_t valueId, uint64_t *pTimestamp, double *pValue);
#ifdef __cplusplus
}
#endif
#endif