aqhome: More work on endpoint system. Basically works.

This commit is contained in:
Martin Preuss
2023-02-22 17:54:17 +01:00
parent da1ea9c268
commit 7a1968e962
12 changed files with 242 additions and 61 deletions

61
aqhome/aqhome.c Normal file
View File

@@ -0,0 +1,61 @@
/****************************************************************************
* 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 "aqhome/aqhome.h"
#include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/logger.h>
#include <gwenhywfar/debug.h>
#include <stdlib.h>
int AQH_Init()
{
int rv;
const char *s;
rv=GWEN_Init();
if (rv) {
DBG_ERROR_ERR(AQH_LOGDOMAIN, rv);
return rv;
}
if (!GWEN_Logger_IsOpen(AQH_LOGDOMAIN))
GWEN_Logger_Open(AQH_LOGDOMAIN, "aqhome", 0, GWEN_LoggerType_Console, GWEN_LoggerFacility_User);
s=getenv("AQHOME_LOGLEVEL");
if (s && *s) {
GWEN_LOGGER_LEVEL ll;
ll=GWEN_Logger_Name2Level(s);
GWEN_Logger_SetLevel(AQH_LOGDOMAIN, ll);
}
else
GWEN_Logger_SetLevel(AQH_LOGDOMAIN, GWEN_LoggerLevel_Notice);
return 0;
}
int AQH_Fini()
{
GWEN_Logger_Close(AQH_LOGDOMAIN);
GWEN_Fini();
return 0;
}