Implemented GETLASTDATA in server and aqhome-tool.

This commit is contained in:
Martin Preuss
2023-09-11 22:55:38 +02:00
parent 518a3a53f9
commit 71f5ce8c7e
14 changed files with 408 additions and 51 deletions

View File

@@ -137,7 +137,7 @@ uint64_t AQH_DataPointsDataIpcMsg_GetValueId(const GWEN_MSG *msg)
const char *AQH_DataPointsDataIpcMsg_GetValueName(const GWEN_MSG *msg)
{
if (GWEN_Msg_GetBytesInBuffer(msg)>=GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGDATA_DATAPOINTS_MINSIZE)
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSGDATA_DATAPOINTS_MINSIZE)
return (const char*) (GWEN_Msg_GetConstBuffer(msg)+GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGDATA_DATAPOINTS_OFFS_VALUENAME);
return NULL;
}
@@ -146,7 +146,7 @@ const char *AQH_DataPointsDataIpcMsg_GetValueName(const GWEN_MSG *msg)
const char *AQH_DataPointsDataIpcMsg_GetUnits(const GWEN_MSG *msg)
{
if (GWEN_Msg_GetBytesInBuffer(msg)>=GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGDATA_DATAPOINTS_MINSIZE)
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSGDATA_DATAPOINTS_MINSIZE)
return (const char*) (GWEN_Msg_GetConstBuffer(msg)+GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGDATA_DATAPOINTS_OFFS_VALUEUNITS);
return NULL;
}
@@ -155,7 +155,7 @@ const char *AQH_DataPointsDataIpcMsg_GetUnits(const GWEN_MSG *msg)
const uint64_t *AQH_DataPointsDataIpcMsg_GetDataPoints(const GWEN_MSG *msg)
{
if (GWEN_Msg_GetBytesInBuffer(msg)>=GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGDATA_DATAPOINTS_MINSIZE)
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSGDATA_DATAPOINTS_MINSIZE)
return (const uint64_t*) (GWEN_Msg_GetConstBuffer(msg)+GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGDATA_DATAPOINTS_OFFS_VALUES);
return NULL;
@@ -200,12 +200,16 @@ int AQH_DataPointsDataIpcMsg_IsValid(const GWEN_MSG *msg)
void AQH_DataPointsDataIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText)
{
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSGDATA_DATAPOINTS_MINSIZE) {
const char *valueName;
valueName=AQH_DataPointsDataIpcMsg_GetValueName(msg);
GWEN_Buffer_AppendArgs(dbuf,
"DATAPOINTS (code=%d, proto=%d, proto version=%d, flags=0x%08x, values=%d)\n",
"DATAPOINTS (code=%d, proto=%d, proto version=%d, flags=0x%08x, valueName=%s, values=%d)\n",
GWEN_IpcMsg_GetCode(msg),
GWEN_IpcMsg_GetProtoId(msg),
GWEN_IpcMsg_GetProtoVersion(msg),
(unsigned int)AQH_DataPointsDataIpcMsg_GetFlags(msg),
valueName?valueName:"<no name>",
AQH_DataPointsDataIpcMsg_GetNumValues(msg));
}
}