started working on storage service.
This commit is contained in:
119
apps/aqhome-storage/aqhomestorage.c
Normal file
119
apps/aqhome-storage/aqhomestorage.c
Normal file
@@ -0,0 +1,119 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqHome.
|
||||
* AqHome (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.
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "./aqhomestorage_p.h"
|
||||
|
||||
#include <gwenhywfar/misc.h>
|
||||
#include <gwenhywfar/debug.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
AQHOME_STORAGE *AqHomeStorage_new()
|
||||
{
|
||||
AQHOME_STORAGE *aqh;
|
||||
|
||||
GWEN_NEW_OBJECT(AQHOME_STORAGE, aqh);
|
||||
aqh->rootEndpoint=GWEN_MsgEndpoint_new("root", 0);
|
||||
|
||||
return aqh;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AqHomeStorage_free(AQHOME_STORAGE *aqh)
|
||||
{
|
||||
if (aqh) {
|
||||
AQH_Storage_free(aqh->storage);
|
||||
GWEN_MsgEndpoint_free(aqh->rootEndpoint);
|
||||
GWEN_MsgEndpoint_free(aqh->rootEndpoint);
|
||||
GWEN_DB_Group_free(aqh->dbArgs);
|
||||
|
||||
aqh->storage=NULL;
|
||||
aqh->rootEndpoint=NULL;
|
||||
aqh->ipcdEndpoint=NULL;
|
||||
aqh->mqttEndpoint=NULL;
|
||||
aqh->httpdEndpoint=NULL;
|
||||
aqh->dbArgs=NULL;
|
||||
free(aqh->pidFile);
|
||||
|
||||
GWEN_FREE_OBJECT(aqh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
GWEN_MSG_ENDPOINT *AqHomeStorage_GetRootEndpoint(const AQHOME_STORAGE *aqh)
|
||||
{
|
||||
return aqh?(aqh->rootEndpoint):NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GWEN_MSG_ENDPOINT *AqHomeStorage_GetIpcdEndpoint(const AQHOME_STORAGE *aqh)
|
||||
{
|
||||
return aqh?(aqh->ipcdEndpoint):NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GWEN_MSG_ENDPOINT *AqHomeStorage_GetMqttEndpoint(const AQHOME_STORAGE *aqh)
|
||||
{
|
||||
return aqh?(aqh->mqttEndpoint):NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GWEN_MSG_ENDPOINT *AqHomeStorage_GetHttpdEndpoint(const AQHOME_STORAGE *aqh)
|
||||
{
|
||||
return aqh?(aqh->httpdEndpoint):NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GWEN_DB_NODE *AqHomeStorage_GetDbArgs(const AQHOME_STORAGE *aqh)
|
||||
{
|
||||
return aqh?(aqh->dbArgs):NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
AQH_STORAGE *AqHomeStorage_GetStorage(const AQHOME_STORAGE *aqh)
|
||||
{
|
||||
return aqh?(aqh->storage):NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *AqHomeStorage_GetPidFile(const AQHOME_STORAGE *aqh)
|
||||
{
|
||||
return aqh?aqh->pidFile:NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AqHomeStorage_SetPidFile(AQHOME_STORAGE *aqh, const char *s)
|
||||
{
|
||||
if (aqh) {
|
||||
free(aqh->pidFile);
|
||||
aqh->pidFile=s?strdup(s):NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user