more work on IPC data protocol.

This commit is contained in:
Martin Preuss
2023-08-14 21:38:21 +02:00
parent 5fdb33c192
commit f9ae85b9ad
21 changed files with 505 additions and 32 deletions

View File

@@ -53,7 +53,7 @@ GWEN_MSG *AQH_ValuesDataIpcMsg_new(uint16_t code, uint32_t flags, const AQH_VALU
int count;
int payloadSize;
count=AQH_Value_List_GetCount(valueList);
count=valueList?AQH_Value_List_GetCount(valueList):0;
payloadSize=AQH_MSGDATA_VALUES_OFFS_VALUES+(count*AQH_MSGDATA_VALUES_VALUES_SIZE);
msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, code, payloadSize, NULL);
@@ -192,6 +192,22 @@ const char *AQH_ValuesDataIpcMsg_GetValueName(const GWEN_MSG *msg, int idx)
const char *AQH_ValuesDataIpcMsg_GetValueUnits(const GWEN_MSG *msg, int idx)
{
uint32_t pos;
pos=
AQH_MSGDATA_VALUES_OFFS_VALUES+
(idx*AQH_MSGDATA_VALUES_VALUES_SIZE)+
AQH_MSGDATA_VALUES_VALUES_OFFS_UNITS;
if (GWEN_Msg_GetBytesInBuffer(msg)>=pos+GWEN_MSGIPC_OFFS_PAYLOAD)
return (const char*) (GWEN_Msg_GetConstBuffer(msg)+GWEN_MSGIPC_OFFS_PAYLOAD+pos);
return NULL;
}
int AQH_ValuesDataIpcMsg_IsValid(const GWEN_MSG *msg)
{
int msgLen;