Files
aqhomecontrol/apps/aqhome-tool/utils.h
Martin Preuss 62abfd56e9 Added functionality to print a value difference.
Also call GWEN_MsgEndpoint_IoLoop() only after checking all messages in
the endpoint's list.
2023-10-21 02:19:16 +02:00

54 lines
2.2 KiB
C

/****************************************************************************
* 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.
****************************************************************************/
#ifndef AQHOME_TOOL_UTILS_H
#define AQHOME_TOOL_UTILS_H
#include <gwenhywfar/db.h>
#include <gwenhywfar/endpoint.h>
#include <aqhome/data/value.h>
#include <aqhome/data/device.h>
GWEN_MSG_ENDPOINT *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs,
const char *varNameAddr,
const char *varNamePort,
const char *fileVarNameAddr,
const char *fileVarNamePort,
int defaultPort);
GWEN_MSG_ENDPOINT *Utils_SetupBrokerClientEndpoint(GWEN_DB_NODE *dbArgs, uint32_t flags);
GWEN_MSG_ENDPOINT *Utils_SetupNodesClientEndpoint(GWEN_DB_NODE *dbArgs);
GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT *epTcp, int msgCode, int nodeAddr, int timeoutInSeconds);
GWEN_MSG *Utils_WaitForSpecificIpcMessage(GWEN_MSG_ENDPOINT *epTcp, int msgCode, int timeoutInSeconds);
int Utils_FlushOutMessageQueue(GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds);
int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT *epTcp, uint32_t groups);
GWEN_MSG_ENDPOINT *Utils_OpenBrokerConnection(GWEN_DB_NODE *dbArgs, uint32_t flags, int timeoutInSeconds);
void Utils_PrintDataPoints(const uint64_t *dataPoints, uint32_t numValues, const char *valueUnits);
void Utils_PrintSingleDataPoint(uint64_t timestamp, double data, const char *valueUnits);
void Utils_PrintMeanData(const uint64_t *dataPoints, uint32_t numValues, const char *valueUnits);
void Utils_PrintDiffData(const uint64_t *dataPoints, uint32_t numValues, const char *valueUnits);
void Utils_PrintFormattedSingleDataPoint(const AQH_VALUE *v, uint64_t timestamp, double data, const char *tmpl);
void Utils_PrintDevice(const AQH_DEVICE *device, int printHeader);
AQH_DEVICE *Utils_DeviceFromArgs(GWEN_DB_NODE *dbArgs);
#endif