/**************************************************************************** * 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 #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_AddRoom(AQH_STORAGE *sto, AQH_ROOM *r); AQHOME_API AQH_ROOM_LIST *AQH_Storage_GetRoomList(const AQH_STORAGE *sto); AQHOME_API AQH_ROOM *AQH_Storage_GetRoomById(const AQH_STORAGE *sto, uint64_t id); AQHOME_API AQH_ROOM *AQH_Storage_GetRoomByName(const AQH_STORAGE *sto, const char *s); AQHOME_API void AQH_Storage_AddDevice(AQH_STORAGE *sto, AQH_DEVICE *dev); AQHOME_API AQH_DEVICE_LIST *AQH_Storage_GetDeviceList(const AQH_STORAGE *sto); AQHOME_API AQH_DEVICE *AQH_Storage_GetDeviceById(const AQH_STORAGE *sto, uint64_t id); AQHOME_API AQH_DEVICE *AQH_Storage_GetDeviceByName(const AQH_STORAGE *sto, const char *s); AQHOME_API void AQH_Storage_AddMqttTopic(AQH_STORAGE *sto, AQH_MQTT_TOPIC *t); AQHOME_API AQH_MQTT_TOPIC_LIST *AQH_Storage_GetMqttTopicList(const AQH_STORAGE *sto); AQHOME_API AQH_MQTT_TOPIC *AQH_Storage_GetMqttTopicById(const AQH_STORAGE *sto, uint64_t id); AQHOME_API AQH_MQTT_TOPIC *AQH_Storage_GetMqttTopicByTopic(const AQH_STORAGE *sto, const char *topic); 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_GetValueByName(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 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_WriteState(AQH_STORAGE *sto); AQHOME_API void AQH_Storage_HandleMqttPublish(AQH_STORAGE *sto, const char *topic, const char *value); #ifdef __cplusplus } #endif #endif