Files
aqhomecontrol/apps/aqhome-nodes/server.h

66 lines
2.3 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 SERVER_H
#define SERVER_H
#include "aqhome-nodes/types/device.h"
#include "aqhome/events2/object.h"
#include <aqhome/ipc2/msgrequest.h>
AQH_OBJECT *AQH_NodeServer_new(AQH_EVENT_LOOP *eventLoop);
int AQH_NodeServer_Init(AQH_OBJECT *o, int argc, char **argv);
/* loop functions */
void AQH_NodeServer_CleanupClients(AQH_OBJECT *o);
void AQH_NodeServer_HandleTtyMsgs(AQH_OBJECT *o);
void AQH_NodeServer_HandleClientMsgs(AQH_OBJECT *o);
void AQH_NodeServer_HandleBrokerMsgs(AQH_OBJECT *o);
void AQH_NodeServer_CheckBrokerConnection(AQH_OBJECT *o);
void AQH_NodeServer_CheckTtyConnection(AQH_OBJECT *o);
/* getters and setters */
int AQH_NodeServer_GetTimeout(const AQH_OBJECT *o);
void AQH_NodeServer_SetLogFile(AQH_OBJECT *o, const char *s);
void AQH_NodeServer_SetDbFile(AQH_OBJECT *o, const char *s);
void AQH_NodeServer_SetPidFile(AQH_OBJECT *o, const char *s);
void AQH_NodeServer_SetDevicePath(AQH_OBJECT *o, const char *s);
void AQH_NodeServer_SetTpcAddress(AQH_OBJECT *o, const char *s);
void AQH_NodeServer_SetTcpPort(AQH_OBJECT *o, int i);
void AQH_NodeServer_SetBrokerAddress(AQH_OBJECT *o, const char *s);
void AQH_NodeServer_SetBrokerPort(AQH_OBJECT *o, int i);
void AQH_NodeServer_SetBrokerClientId(AQH_OBJECT *o, const char *s);
/* device management */
const AQHNODE_DEVICE_LIST *AQH_NodeServer_GetDeviceDefList(const AQH_OBJECT *o);
const AQHNODE_DEVICE *AQH_NodeServer_FindDeviceDef(const AQH_OBJECT *o,
uint32_t manufacturer,
uint16_t deviceType, uint16_t deviceVersion);
const AQHNODE_DEVICE *AQH_NodeServer_GetDeviceDefByName(const AQH_OBJECT *o, const char *name);
/* request management */
AQH_MSG_REQUEST *AQH_NodeServer_GetRequestTree(const AQH_OBJECT *o);
void AQH_NodeServer_AddRequestToTree(AQH_OBJECT *o, AQH_MSG_REQUEST *rq);
void AQH_NodeServer_CleanupRequests(AQH_OBJECT *o);
#endif