Files
aqhomecontrol/apps/aqhome-data/server.h
2025-02-27 23:50:18 +01:00

60 lines
2.1 KiB
C

/****************************************************************************
* This file is part of the project AqHome.
* AqHome (c) by 2025 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 AQHOME_DATA_SERVER_H
#define AQHOME_DATA_SERVER_H
#include <aqhome/data/storage.h>
#include <aqhome/events2/object.h>
#include <aqhome/ipc2/msgrequest.h>
#define AQH_ENDPOINT_PERMS_LISTVALUES 0x0001
#define AQH_ENDPOINT_PERMS_READVALUE 0x0002
#define AQH_ENDPOINT_PERMS_ADDVALUE 0x0004
#define AQH_ENDPOINT_PERMS_LISTDATA 0x0010
#define AQH_ENDPOINT_PERMS_READDATA 0x0020
#define AQH_ENDPOINT_PERMS_ADDDATA 0x0040
#define AQH_ENDPOINT_PERMS_SETDATA 0x0080
#define AQH_ENDPOINT_PERMS_LISTDEVICES 0x0100
#define AQH_ENDPOINT_PERMS_READDEVICE 0x0200
#define AQH_ENDPOINT_PERMS_ADDDEVICE 0x0400
#define AQH_ENDPOINT_PERMS_MODDEVICE 0x0800
AQH_OBJECT *AqHomeDataServer_new(AQH_EVENT_LOOP *eventLoop);
int AqHomeDataServer_Init(AQH_OBJECT *o, int argc, char **argv);
int AqHomeDataServer_GetTimeout(const AQH_OBJECT *o);
int AqHomeDataServer_GetClientNum(const AQH_OBJECT *o);
void AqHomeDataServer_CleanupClients(AQH_OBJECT *o);
void AqHomeDataServer_HandleClientMsgs(AQH_OBJECT *o);
AQH_OBJECT *AqHomeDataServer_GetIpcEndpointByServiceName(const AQH_OBJECT *o, const char *serviceName);
void AqHomeDataServer_SendResponseResultToEndpoint(AQH_OBJECT *ep, uint32_t refMsgId, int result);
AQH_MSG_REQUEST *AqHomeDataServer_GetRequestTree(const AQH_OBJECT *o);
void AqHomeDataServer_AddRequestToTree(AQH_OBJECT *o, AQH_MSG_REQUEST *rq);
void AqHomeDataServer_CleanupRequests(AQH_OBJECT *o);
int AqHomeDataServer_LockStorage(AQH_OBJECT *o);
int AqHomeDataServer_UnlockStorage(AQH_OBJECT *o);
int AqHomeDataServer_WriteStorageIfChanged(AQH_OBJECT *o);
AQH_VALUE *AqHomeDataServer_GetOrCreateValueForDriverWithTemplate(AQH_OBJECT *o, AQH_OBJECT *epDriver, const AQH_VALUE *valueTemplate);
#endif