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

@@ -15,7 +15,7 @@
#include <gwenhywfar/msg_ipc.h>
#define AQH_IPC_PROTOCOL_DATA_ID 1
#define AQH_IPC_PROTOCOL_DATA_ID 2
#define AQH_IPC_PROTOCOL_DATA_VERSION 1

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;

View File

@@ -33,6 +33,7 @@ AQHOME_API uint32_t AQH_ValuesDataIpcMsg_GetNumValues(const GWEN_MSG *msg);
AQHOME_API uint64_t AQH_ValuesDataIpcMsg_GetValueId(const GWEN_MSG *msg, int idx);
AQHOME_API const char *AQH_ValuesDataIpcMsg_GetValueName(const GWEN_MSG *msg, int idx);
AQHOME_API const char *AQH_ValuesDataIpcMsg_GetValueUnits(const GWEN_MSG *msg, int idx);
AQHOME_API int AQH_ValuesDataIpcMsg_IsValid(const GWEN_MSG *msg);
AQHOME_API void AQH_ValuesDataIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);

View File

@@ -22,8 +22,11 @@
#define AQH_IPC_PROTOCOL_RESULT_VERSION 1
#define AQH_MSG_IPC_SUCCESS 0
#define AQH_MSG_IPC_ERROR_NODATA 1
#define AQH_MSG_IPC_SUCCESS 0
#define AQH_MSG_IPC_ERROR_INVALID 1
#define AQH_MSG_IPC_ERROR_EXISTS 2
#define AQH_MSG_IPC_ERROR_NODATA 3
#define AQH_MSG_IPC_ERROR_BADDATA 4
AQHOME_API GWEN_MSG *AQH_ResultIpcMsg_new(uint16_t code, uint32_t resultCode);

View File

@@ -20,13 +20,14 @@
#define AQH_IPC_PROTOCOL_NODES_VERSION 1
#define AQH_MSGTYPE_IPC_NODES_RESULT 0x001
#define AQH_MSGTYPE_IPC_NODES_FORWARD 0x100
#define AQH_MSGTYPE_IPC_NODES_VALUE 0x200
#define AQH_MSGTYPE_IPC_NODES_PING 0x300
#define AQH_MSGTYPE_IPC_NODES_SETACCMSGGRPS 0x400
#define AQH_MSGTYPE_IPC_NODES_GETDEVICES_REQ 0x500
#define AQH_MSGTYPE_IPC_NODES_GETDEVICES_RSP 0x600
#define AQH_MSGTYPE_IPC_NODES_ERROR 0x700