From 64938b9cb06069ada3772c4719212fd79e26c2fc Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sun, 13 Aug 2023 14:09:15 +0200 Subject: [PATCH] Prepared introduction of multiple ipc protocols. --- apps/aqhome-tool/flash.c | 12 +-- apps/aqhome-tool/getdevices.c | 14 +-- apps/aqhome-tool/ping.c | 8 +- apps/aqhome-tool/utils.c | 10 +- apps/aqhomed/loop.c | 4 +- apps/aqhomed/loop_ipc.c | 28 +++--- apps/aqhomed/loop_tty.c | 4 +- apps/aqhomed/loop_tty_ipc.c | 8 +- apps/aqhomed/loop_tty_mqtt.c | 4 +- aqhome/ipc/0BUILD | 18 +--- aqhome/ipc/msg_ipc.h | 37 -------- aqhome/ipc/nodes/0BUILD | 93 +++++++++++++++++++ aqhome/ipc/{msg_ipc.c => nodes/ipc_nodes.c} | 2 +- aqhome/ipc/nodes/ipc_nodes.h | 37 ++++++++ aqhome/ipc/{ => nodes}/msg_ipc_error.c | 4 +- aqhome/ipc/{ => nodes}/msg_ipc_error.h | 2 +- aqhome/ipc/{ => nodes}/msg_ipc_forward.c | 4 +- aqhome/ipc/{ => nodes}/msg_ipc_forward.h | 2 +- .../ipc/{ => nodes}/msg_ipc_getdevices_req.c | 4 +- .../ipc/{ => nodes}/msg_ipc_getdevices_req.h | 2 +- .../ipc/{ => nodes}/msg_ipc_getdevices_rsp.c | 4 +- .../ipc/{ => nodes}/msg_ipc_getdevices_rsp.h | 2 +- aqhome/ipc/{ => nodes}/msg_ipc_ping.c | 4 +- aqhome/ipc/{ => nodes}/msg_ipc_ping.h | 2 +- .../ipc/{ => nodes}/msg_ipc_setaccmsggrps.c | 4 +- .../ipc/{ => nodes}/msg_ipc_setaccmsggrps.h | 2 +- aqhome/ipc/{ => nodes}/msg_ipc_value.c | 4 +- aqhome/ipc/{ => nodes}/msg_ipc_value.h | 2 +- aqhome/libtest.c | 6 +- 29 files changed, 203 insertions(+), 124 deletions(-) delete mode 100644 aqhome/ipc/msg_ipc.h create mode 100644 aqhome/ipc/nodes/0BUILD rename aqhome/ipc/{msg_ipc.c => nodes/ipc_nodes.c} (91%) create mode 100644 aqhome/ipc/nodes/ipc_nodes.h rename aqhome/ipc/{ => nodes}/msg_ipc_error.c (91%) rename aqhome/ipc/{ => nodes}/msg_ipc_error.h (95%) rename aqhome/ipc/{ => nodes}/msg_ipc_forward.c (93%) rename aqhome/ipc/{ => nodes}/msg_ipc_forward.h (96%) rename aqhome/ipc/{ => nodes}/msg_ipc_getdevices_req.c (87%) rename aqhome/ipc/{ => nodes}/msg_ipc_getdevices_req.h (94%) rename aqhome/ipc/{ => nodes}/msg_ipc_getdevices_rsp.c (97%) rename aqhome/ipc/{ => nodes}/msg_ipc_getdevices_rsp.h (97%) rename aqhome/ipc/{ => nodes}/msg_ipc_ping.c (91%) rename aqhome/ipc/{ => nodes}/msg_ipc_ping.h (95%) rename aqhome/ipc/{ => nodes}/msg_ipc_setaccmsggrps.c (92%) rename aqhome/ipc/{ => nodes}/msg_ipc_setaccmsggrps.h (95%) rename aqhome/ipc/{ => nodes}/msg_ipc_value.c (96%) rename aqhome/ipc/{ => nodes}/msg_ipc_value.h (97%) diff --git a/apps/aqhome-tool/flash.c b/apps/aqhome-tool/flash.c index bf6f9b2..f578ecc 100644 --- a/apps/aqhome-tool/flash.c +++ b/apps/aqhome-tool/flash.c @@ -14,8 +14,8 @@ #include "./utils.h" #include "aqhome/ipc/endpoint_ipc.h" -#include "aqhome/ipc/msg_ipc_setaccmsggrps.h" -#include "aqhome/ipc/msg_ipc_forward.h" +#include "aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h" +#include "aqhome/ipc/nodes/msg_ipc_forward.h" #include "aqhome/msg/msg_node.h" #include "aqhome/msg/msg_flashready.h" #include "aqhome/msg/msg_flashstart.h" @@ -471,7 +471,7 @@ int _sendRebootRequest(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid) return GWEN_ERROR_GENERIC; } - msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_FORWARD, GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode)); + msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_NODES_FORWARD, GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode)); GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut); GWEN_Msg_free(msgNode); return 0; @@ -490,7 +490,7 @@ int _sendFlashStart(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid) return GWEN_ERROR_GENERIC; } - msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_FORWARD, GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode)); + msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_NODES_FORWARD, GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode)); GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut); GWEN_Msg_free(msgNode); return 0; @@ -509,7 +509,7 @@ int _sendFlashEnd(GWEN_MSG_ENDPOINT *epTcp, int reason) return GWEN_ERROR_GENERIC; } - msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_FORWARD, GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode)); + msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_NODES_FORWARD, GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode)); GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut); GWEN_Msg_free(msgNode); return 0; @@ -555,7 +555,7 @@ int _sendFlashRecord(GWEN_MSG_ENDPOINT *epTcp, return GWEN_ERROR_GENERIC; } - msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_FORWARD, GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode)); + msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_NODES_FORWARD, GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode)); GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut); GWEN_Msg_free(msgNode); diff --git a/apps/aqhome-tool/getdevices.c b/apps/aqhome-tool/getdevices.c index a141308..12b27d4 100644 --- a/apps/aqhome-tool/getdevices.c +++ b/apps/aqhome-tool/getdevices.c @@ -14,9 +14,9 @@ #include "./utils.h" #include "aqhome/ipc/endpoint_ipc.h" -#include "aqhome/ipc/msg_ipc_getdevices_req.h" -#include "aqhome/ipc/msg_ipc_getdevices_rsp.h" -#include "aqhome/ipc/msg_ipc_error.h" +#include "aqhome/ipc/nodes/msg_ipc_getdevices_req.h" +#include "aqhome/ipc/nodes/msg_ipc_getdevices_rsp.h" +#include "aqhome/ipc/nodes/msg_ipc_error.h" #include "aqhome/msg/msg_node.h" #include @@ -146,19 +146,19 @@ int _doGetDevices(GWEN_DB_NODE *dbArgs) GWEN_MSG *msg; uint16_t code; - msg=Utils_WaitForSpecificIpcMessage(epTcp, AQH_MSGTYPE_IPC_GETDEVICES_RSP, timeoutInSeconds); + msg=Utils_WaitForSpecificIpcMessage(epTcp, AQH_MSGTYPE_IPC_NODES_GETDEVICES_RSP, timeoutInSeconds); if (msg==NULL) { DBG_INFO(NULL, "No GET_DEVICE response received."); GWEN_MsgEndpoint_free(epTcp); return 2; } code=GWEN_IpcMsg_GetCode(msg); - if (code==AQH_MSGTYPE_IPC_ERROR) { + if (code==AQH_MSGTYPE_IPC_NODES_ERROR) { fprintf(stdout, "No device list (%d)\n", AQH_ErrorIpcMsg_GetErrorCode(msg)); GWEN_Msg_free(msg); break; } - else if (code==AQH_MSGTYPE_IPC_GETDEVICES_RSP) { + else if (code==AQH_MSGTYPE_IPC_NODES_GETDEVICES_RSP) { uint16_t fwVersion; int64_t ts64; GWEN_TIMESTAMP *ts; @@ -206,7 +206,7 @@ int _sendGetDevices(GWEN_MSG_ENDPOINT *epTcp) { GWEN_MSG *msgOut; - msgOut=AQH_GetDevicesRequestIpcMsg_new(AQH_MSGTYPE_IPC_GETDEVICES_REQ); + msgOut=AQH_GetDevicesRequestIpcMsg_new(AQH_MSGTYPE_IPC_NODES_GETDEVICES_REQ); if (msgOut==NULL) { DBG_ERROR(NULL, "Error creating message"); return GWEN_ERROR_GENERIC; diff --git a/apps/aqhome-tool/ping.c b/apps/aqhome-tool/ping.c index f12e472..ae139b5 100644 --- a/apps/aqhome-tool/ping.c +++ b/apps/aqhome-tool/ping.c @@ -13,9 +13,9 @@ #include "./ping.h" #include "./utils.h" -#include "aqhome/ipc/msg_ipc_setaccmsggrps.h" -#include "aqhome/ipc/msg_ipc_ping.h" -#include "aqhome/ipc/msg_ipc_forward.h" +#include "aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h" +#include "aqhome/ipc/nodes/msg_ipc_ping.h" +#include "aqhome/ipc/nodes/msg_ipc_forward.h" #include "aqhome/ipc/endpoint_ipc.h" #include "aqhome/msg/msg_node.h" @@ -175,7 +175,7 @@ int _sendPing(GWEN_MSG_ENDPOINT *epTcp, int nodeAddr) { GWEN_MSG *msgOut; - msgOut=AQH_PingIpcMsg_new(AQH_MSGTYPE_IPC_PING, nodeAddr); + msgOut=AQH_PingIpcMsg_new(AQH_MSGTYPE_IPC_NODES_PING, nodeAddr); if (msgOut==NULL) { DBG_ERROR(NULL, "Error creating message"); return GWEN_ERROR_GENERIC; diff --git a/apps/aqhome-tool/utils.c b/apps/aqhome-tool/utils.c index d505a06..dae69dc 100644 --- a/apps/aqhome-tool/utils.c +++ b/apps/aqhome-tool/utils.c @@ -14,8 +14,8 @@ #include "./utils.h" #include "aqhome/ipc/endpoint_ipc.h" -#include "aqhome/ipc/msg_ipc_setaccmsggrps.h" -#include "aqhome/ipc/msg_ipc_forward.h" +#include "aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h" +#include "aqhome/ipc/nodes/msg_ipc_forward.h" #include #include @@ -70,7 +70,7 @@ GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT *epTcp, GWEN_MsgEndpoint_IoLoop(epTcp, 2000); /* 2000 ms */ msg=GWEN_MsgEndpoint_TakeFirstReceivedMessage(epTcp); if (msg) { - if (GWEN_IpcMsg_GetCode(msg)==AQH_MSGTYPE_IPC_FORWARD) { + if (GWEN_IpcMsg_GetCode(msg)==AQH_MSGTYPE_IPC_NODES_FORWARD) { GWEN_MSG *nodeMsg; DBG_INFO(NULL, "Received IPC FORWARD message"); @@ -125,7 +125,7 @@ GWEN_MSG *Utils_WaitForSpecificIpcMessage(GWEN_MSG_ENDPOINT *epTcp, DBG_INFO(NULL, "Received expected IPC message"); return msg; } - else if (code==AQH_MSGTYPE_IPC_ERROR) { + else if (code==AQH_MSGTYPE_IPC_NODES_ERROR) { DBG_INFO(NULL, "Received IPC error message"); return msg; } @@ -169,7 +169,7 @@ int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT *epTcp, uint32_t groups) { GWEN_MSG *msgOut; - msgOut=AQH_SetAcceptedMsgGroupsIpcMsg_new(AQH_MSGTYPE_IPC_SETACCMSGGRPS, groups); + msgOut=AQH_SetAcceptedMsgGroupsIpcMsg_new(AQH_MSGTYPE_IPC_NODES_SETACCMSGGRPS, groups); if (msgOut==NULL) { DBG_ERROR(NULL, "Error creating message"); return GWEN_ERROR_GENERIC; diff --git a/apps/aqhomed/loop.c b/apps/aqhomed/loop.c index e7e1343..fbe9e00 100644 --- a/apps/aqhomed/loop.c +++ b/apps/aqhomed/loop.c @@ -23,8 +23,8 @@ #include "aqhome/msg/msg_node.h" #include "aqhome/msg/msg_value2.h" #include "aqhome/ipc/endpoint_ipc.h" -#include "aqhome/ipc/msg_ipc_forward.h" -#include "aqhome/ipc/msg_ipc_value.h" +#include "aqhome/ipc/nodes/msg_ipc_forward.h" +#include "aqhome/ipc/nodes/msg_ipc_value.h" #include "aqhome/mqtt/endpoint_mqttc.h" #include diff --git a/apps/aqhomed/loop_ipc.c b/apps/aqhomed/loop_ipc.c index 845aadd..3f4887b 100644 --- a/apps/aqhomed/loop_ipc.c +++ b/apps/aqhomed/loop_ipc.c @@ -22,13 +22,13 @@ #include "aqhome/msg/msg_value2.h" #include "aqhome/msg/msg_ping.h" #include "aqhome/ipc/endpoint_ipc.h" -#include "aqhome/ipc/msg_ipc.h" -#include "aqhome/ipc/msg_ipc_forward.h" -#include "aqhome/ipc/msg_ipc_value.h" -#include "aqhome/ipc/msg_ipc_ping.h" -#include "aqhome/ipc/msg_ipc_setaccmsggrps.h" -#include "aqhome/ipc/msg_ipc_getdevices_rsp.h" -#include "aqhome/ipc/msg_ipc_error.h" +#include "aqhome/ipc/nodes/ipc_nodes.h" +#include "aqhome/ipc/nodes/msg_ipc_forward.h" +#include "aqhome/ipc/nodes/msg_ipc_value.h" +#include "aqhome/ipc/nodes/msg_ipc_ping.h" +#include "aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h" +#include "aqhome/ipc/nodes/msg_ipc_getdevices_rsp.h" +#include "aqhome/ipc/nodes/msg_ipc_error.h" #include #include @@ -102,11 +102,11 @@ void _handleIpcMsg(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg) code=GWEN_IpcMsg_GetCode(msg); DBG_ERROR(AQH_LOGDOMAIN, "Received IPC packet"); switch(code) { - case AQH_MSGTYPE_IPC_PING: _handleIpcMsgPing(aqh, ep, msg); break; - case AQH_MSGTYPE_IPC_SETACCMSGGRPS: _handleIpcMsgSetAccMsgGrps(aqh, ep, msg); break; - case AQH_MSGTYPE_IPC_FORWARD: _handleIpcMsgForward(aqh, ep, msg); break; - case AQH_MSGTYPE_IPC_GETDEVICES_REQ: _handleIpcMsgGetDevicesReq(aqh, ep, msg); break; - default: break; + case AQH_MSGTYPE_IPC_NODES_PING: _handleIpcMsgPing(aqh, ep, msg); break; + case AQH_MSGTYPE_IPC_NODES_SETACCMSGGRPS: _handleIpcMsgSetAccMsgGrps(aqh, ep, msg); break; + case AQH_MSGTYPE_IPC_NODES_FORWARD: _handleIpcMsgForward(aqh, ep, msg); break; + case AQH_MSGTYPE_IPC_NODES_GETDEVICES_REQ: _handleIpcMsgGetDevicesReq(aqh, ep, msg); break; + default: break; } } @@ -167,7 +167,7 @@ void _handleIpcMsgGetDevicesReq(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_ niNext=AQH_NodeInfo_List_Next(ni); DBG_INFO(AQH_LOGDOMAIN, "Sending response for node %02x (%08x)", AQH_NodeInfo_GetBusAddress(ni), AQH_NodeInfo_GetUid(ni)); - msgOut=AQH_GetDevicesResponseIpcMsg_new(AQH_MSGTYPE_IPC_GETDEVICES_RSP, niNext?0:AQH_MSGIPC_GETDEVICES_RSP_FLAGS_LAST, ni); + msgOut=AQH_GetDevicesResponseIpcMsg_new(AQH_MSGTYPE_IPC_NODES_GETDEVICES_RSP, niNext?0:AQH_MSGIPC_GETDEVICES_RSP_FLAGS_LAST, ni); GWEN_MsgEndpoint_AddSendMessage(ep, msgOut); ni=niNext; } @@ -176,7 +176,7 @@ void _handleIpcMsgGetDevicesReq(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_ GWEN_MSG *msgOut; DBG_INFO(AQH_LOGDOMAIN, "No nodes"); - msgOut=AQH_ErrorIpcMsg_new(AQH_MSGTYPE_IPC_ERROR, AQH_MSG_IPC_ERROR_NODATA); + msgOut=AQH_ErrorIpcMsg_new(AQH_MSGTYPE_IPC_NODES_ERROR, AQH_MSG_IPC_ERROR_NODATA); GWEN_MsgEndpoint_AddSendMessage(ep, msgOut); } } diff --git a/apps/aqhomed/loop_tty.c b/apps/aqhomed/loop_tty.c index d124345..e5bebcb 100644 --- a/apps/aqhomed/loop_tty.c +++ b/apps/aqhomed/loop_tty.c @@ -23,8 +23,8 @@ #include "aqhome/msg/msg_node.h" #include "aqhome/msg/msg_value2.h" #include "aqhome/ipc/endpoint_ipc.h" -#include "aqhome/ipc/msg_ipc_forward.h" -#include "aqhome/ipc/msg_ipc_value.h" +#include "aqhome/ipc/nodes/msg_ipc_forward.h" +#include "aqhome/ipc/nodes/msg_ipc_value.h" #include "aqhome/mqtt/endpoint_mqttc.h" #include diff --git a/apps/aqhomed/loop_tty_ipc.c b/apps/aqhomed/loop_tty_ipc.c index ba24bfc..070590b 100644 --- a/apps/aqhomed/loop_tty_ipc.c +++ b/apps/aqhomed/loop_tty_ipc.c @@ -21,8 +21,8 @@ #include "aqhome/msg/msg_node.h" #include "aqhome/msg/msg_value2.h" #include "aqhome/ipc/endpoint_ipc.h" -#include "aqhome/ipc/msg_ipc_forward.h" -#include "aqhome/ipc/msg_ipc_value.h" +#include "aqhome/ipc/nodes/msg_ipc_forward.h" +#include "aqhome/ipc/nodes/msg_ipc_value.h" #include "aqhome/mqtt/endpoint_mqttc.h" #include @@ -93,7 +93,7 @@ void _forwardValue2MsgToIpc(GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *nodeMsg) { GWEN_MSG *ipcMsg; - ipcMsg=AQH_ValueIpcMsg_new(AQH_MSGTYPE_IPC_VALUE, + ipcMsg=AQH_ValueIpcMsg_new(AQH_MSGTYPE_IPC_NODES_VALUE, AQH_Value2Msg_GetUid(nodeMsg), AQH_Value2Msg_GetValueId(nodeMsg), AQH_Value2Msg_GetValueType(nodeMsg), @@ -108,7 +108,7 @@ void _forwardAnyMsgToIpc(GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *nodeMsg) { GWEN_MSG *ipcMsg; - ipcMsg=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_FORWARD, GWEN_Msg_GetConstBuffer(nodeMsg), GWEN_Msg_GetBytesInBuffer(nodeMsg)); + ipcMsg=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_NODES_FORWARD, GWEN_Msg_GetConstBuffer(nodeMsg), GWEN_Msg_GetBytesInBuffer(nodeMsg)); GWEN_MsgEndpoint_AddSendMessage(ep, ipcMsg); } diff --git a/apps/aqhomed/loop_tty_mqtt.c b/apps/aqhomed/loop_tty_mqtt.c index 2f6b7af..a3bf995 100644 --- a/apps/aqhomed/loop_tty_mqtt.c +++ b/apps/aqhomed/loop_tty_mqtt.c @@ -23,8 +23,8 @@ #include "aqhome/msg/msg_sendstats.h" #include "aqhome/msg/msg_recvstats.h" #include "aqhome/ipc/endpoint_ipc.h" -#include "aqhome/ipc/msg_ipc_forward.h" -#include "aqhome/ipc/msg_ipc_value.h" +#include "aqhome/ipc/nodes/msg_ipc_forward.h" +#include "aqhome/ipc/nodes/msg_ipc_value.h" #include "aqhome/mqtt/endpoint_mqttc.h" #include "aqhome/mqtt/msg_mqtt_publish.h" diff --git a/aqhome/ipc/0BUILD b/aqhome/ipc/0BUILD index d4aa854..39c1e70 100644 --- a/aqhome/ipc/0BUILD +++ b/aqhome/ipc/0BUILD @@ -46,14 +46,6 @@ endpoint_ipc.h - msg_ipc.h - msg_ipc_forward.h - msg_ipc_value.h - msg_ipc_ping.h - msg_ipc_error.h - msg_ipc_setaccmsggrps.h - msg_ipc_getdevices_req.h - msg_ipc_getdevices_rsp.h @@ -66,14 +58,6 @@ $(local/typefiles) endpoint_ipc.c - msg_ipc.c - msg_ipc_forward.c - msg_ipc_value.c - msg_ipc_ping.c - msg_ipc_error.c - msg_ipc_setaccmsggrps.c - msg_ipc_getdevices_req.c - msg_ipc_getdevices_rsp.c @@ -82,9 +66,11 @@ + aqhipcnodes + nodes diff --git a/aqhome/ipc/msg_ipc.h b/aqhome/ipc/msg_ipc.h deleted file mode 100644 index 50f7086..0000000 --- a/aqhome/ipc/msg_ipc.h +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************** - * 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 AQH_MSG_IPC_H -#define AQH_MSG_IPC_H - - -#include - -#include -#include - - -#define AQH_IPC_PROTOCOL_ID 1 -#define AQH_IPC_PROTOCOL_VERSION 1 - - -#define AQH_MSGTYPE_IPC_FORWARD 0x100 -#define AQH_MSGTYPE_IPC_VALUE 0x200 -#define AQH_MSGTYPE_IPC_PING 0x300 -#define AQH_MSGTYPE_IPC_SETACCMSGGRPS 0x400 -#define AQH_MSGTYPE_IPC_GETDEVICES_REQ 0x500 -#define AQH_MSGTYPE_IPC_GETDEVICES_RSP 0x600 -#define AQH_MSGTYPE_IPC_ERROR 0x700 - - - - -#endif - - - diff --git a/aqhome/ipc/nodes/0BUILD b/aqhome/ipc/nodes/0BUILD new file mode 100644 index 0000000..7b08d63 --- /dev/null +++ b/aqhome/ipc/nodes/0BUILD @@ -0,0 +1,93 @@ + + + + + + + + $(gwenhywfar_cflags) + -I$(topsrcdir) + -I$(topbuilddir) + + + + --include=$(builddir) + --include=$(srcdir) + + + + + + $(visibility_cflags) + + + + --api=AQHOME_API + + + + + + + + + + + + + + + + + + $(local/built_headers_pub) + + + + + ipc_nodes.h + msg_ipc_forward.h + msg_ipc_value.h + msg_ipc_ping.h + msg_ipc_error.h + msg_ipc_setaccmsggrps.h + msg_ipc_getdevices_req.h + msg_ipc_getdevices_rsp.h + + + + + endpoint_ipc_p.h + + + + + $(local/typefiles) + + ipc_nodes.c + msg_ipc_forward.c + msg_ipc_value.c + msg_ipc_ping.c + msg_ipc_error.c + msg_ipc_setaccmsggrps.c + msg_ipc_getdevices_req.c + msg_ipc_getdevices_rsp.c + + + + + + + + + + + + + + + + + + + diff --git a/aqhome/ipc/msg_ipc.c b/aqhome/ipc/nodes/ipc_nodes.c similarity index 91% rename from aqhome/ipc/msg_ipc.c rename to aqhome/ipc/nodes/ipc_nodes.c index 41f3a6d..dffab65 100644 --- a/aqhome/ipc/msg_ipc.c +++ b/aqhome/ipc/nodes/ipc_nodes.c @@ -11,6 +11,6 @@ #endif -#include +#include diff --git a/aqhome/ipc/nodes/ipc_nodes.h b/aqhome/ipc/nodes/ipc_nodes.h new file mode 100644 index 0000000..4d8d27b --- /dev/null +++ b/aqhome/ipc/nodes/ipc_nodes.h @@ -0,0 +1,37 @@ +/**************************************************************************** + * 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 AQH_MSG_IPC_NODES_H +#define AQH_MSG_IPC_NODES_H + + +#include + +#include +#include + + +#define AQH_IPC_PROTOCOL_NODES_ID 1 +#define AQH_IPC_PROTOCOL_NODES_VERSION 1 + + +#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 + + + + +#endif + + + diff --git a/aqhome/ipc/msg_ipc_error.c b/aqhome/ipc/nodes/msg_ipc_error.c similarity index 91% rename from aqhome/ipc/msg_ipc_error.c rename to aqhome/ipc/nodes/msg_ipc_error.c index 65d40ec..31baf0e 100644 --- a/aqhome/ipc/msg_ipc_error.c +++ b/aqhome/ipc/nodes/msg_ipc_error.c @@ -10,7 +10,7 @@ # include #endif -#include +#include #include #include @@ -35,7 +35,7 @@ GWEN_MSG *AQH_ErrorIpcMsg_new(uint16_t code, uint16_t errorCode) GWEN_MSG *msg; uint8_t *ptr; - msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_ID, AQH_IPC_PROTOCOL_VERSION, code, AQH_MSGIPC_ERROR_MINSIZE, NULL); + msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, AQH_MSGIPC_ERROR_MINSIZE, NULL); ptr=GWEN_Msg_GetBuffer(msg); ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_ERROR_OFFS_ERRORCODE+0]=errorCode & 0xff; ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_ERROR_OFFS_ERRORCODE+1]=errorCode & 0xff; diff --git a/aqhome/ipc/msg_ipc_error.h b/aqhome/ipc/nodes/msg_ipc_error.h similarity index 95% rename from aqhome/ipc/msg_ipc_error.h rename to aqhome/ipc/nodes/msg_ipc_error.h index fdc2c5f..29d2123 100644 --- a/aqhome/ipc/msg_ipc_error.h +++ b/aqhome/ipc/nodes/msg_ipc_error.h @@ -11,7 +11,7 @@ #include -#include +#include #include #include diff --git a/aqhome/ipc/msg_ipc_forward.c b/aqhome/ipc/nodes/msg_ipc_forward.c similarity index 93% rename from aqhome/ipc/msg_ipc_forward.c rename to aqhome/ipc/nodes/msg_ipc_forward.c index e8d9328..fc6bb10 100644 --- a/aqhome/ipc/msg_ipc_forward.c +++ b/aqhome/ipc/nodes/msg_ipc_forward.c @@ -10,7 +10,7 @@ # include #endif -#include +#include #include #include @@ -32,7 +32,7 @@ GWEN_MSG *AQH_ForwardIpcMsg_new(uint16_t code, const uint8_t *ptr, uint32_t len) { - return GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_ID, AQH_IPC_PROTOCOL_VERSION, code, len, ptr); + return GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, len, ptr); } diff --git a/aqhome/ipc/msg_ipc_forward.h b/aqhome/ipc/nodes/msg_ipc_forward.h similarity index 96% rename from aqhome/ipc/msg_ipc_forward.h rename to aqhome/ipc/nodes/msg_ipc_forward.h index 64500a5..db54a35 100644 --- a/aqhome/ipc/msg_ipc_forward.h +++ b/aqhome/ipc/nodes/msg_ipc_forward.h @@ -11,7 +11,7 @@ #include -#include +#include #include #include diff --git a/aqhome/ipc/msg_ipc_getdevices_req.c b/aqhome/ipc/nodes/msg_ipc_getdevices_req.c similarity index 87% rename from aqhome/ipc/msg_ipc_getdevices_req.c rename to aqhome/ipc/nodes/msg_ipc_getdevices_req.c index 7fd508c..9d78016 100644 --- a/aqhome/ipc/msg_ipc_getdevices_req.c +++ b/aqhome/ipc/nodes/msg_ipc_getdevices_req.c @@ -10,7 +10,7 @@ # include #endif -#include +#include #include #include @@ -30,7 +30,7 @@ GWEN_MSG *AQH_GetDevicesRequestIpcMsg_new(uint16_t code) { - return GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_ID, AQH_IPC_PROTOCOL_VERSION, code, AQH_MSGIPC_GETDEVICES_REQ_MINSIZE, NULL); + return GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, AQH_MSGIPC_GETDEVICES_REQ_MINSIZE, NULL); } diff --git a/aqhome/ipc/msg_ipc_getdevices_req.h b/aqhome/ipc/nodes/msg_ipc_getdevices_req.h similarity index 94% rename from aqhome/ipc/msg_ipc_getdevices_req.h rename to aqhome/ipc/nodes/msg_ipc_getdevices_req.h index 7de7a97..ad9336e 100644 --- a/aqhome/ipc/msg_ipc_getdevices_req.h +++ b/aqhome/ipc/nodes/msg_ipc_getdevices_req.h @@ -11,7 +11,7 @@ #include -#include +#include #include #include diff --git a/aqhome/ipc/msg_ipc_getdevices_rsp.c b/aqhome/ipc/nodes/msg_ipc_getdevices_rsp.c similarity index 97% rename from aqhome/ipc/msg_ipc_getdevices_rsp.c rename to aqhome/ipc/nodes/msg_ipc_getdevices_rsp.c index bd96be1..8ae2f18 100644 --- a/aqhome/ipc/msg_ipc_getdevices_rsp.c +++ b/aqhome/ipc/nodes/msg_ipc_getdevices_rsp.c @@ -10,7 +10,7 @@ # include #endif -#include +#include #include #include @@ -51,7 +51,7 @@ GWEN_MSG *AQH_GetDevicesResponseIpcMsg_new(uint16_t code, uint8_t flags, const A uint64_t u64=0; const GWEN_TIMESTAMP *t; - msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_ID, AQH_IPC_PROTOCOL_VERSION, code, AQH_MSGIPC_GETDEVICES_RSP_MINSIZE, NULL); + msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, AQH_MSGIPC_GETDEVICES_RSP_MINSIZE, NULL); ptr=GWEN_Msg_GetBuffer(msg)+GWEN_MSGIPC_OFFS_PAYLOAD; *(ptr++)=flags & 0xff; diff --git a/aqhome/ipc/msg_ipc_getdevices_rsp.h b/aqhome/ipc/nodes/msg_ipc_getdevices_rsp.h similarity index 97% rename from aqhome/ipc/msg_ipc_getdevices_rsp.h rename to aqhome/ipc/nodes/msg_ipc_getdevices_rsp.h index 77c70c8..b694d2e 100644 --- a/aqhome/ipc/msg_ipc_getdevices_rsp.h +++ b/aqhome/ipc/nodes/msg_ipc_getdevices_rsp.h @@ -11,7 +11,7 @@ #include -#include +#include #include #include diff --git a/aqhome/ipc/msg_ipc_ping.c b/aqhome/ipc/nodes/msg_ipc_ping.c similarity index 91% rename from aqhome/ipc/msg_ipc_ping.c rename to aqhome/ipc/nodes/msg_ipc_ping.c index 50bb250..f231d90 100644 --- a/aqhome/ipc/msg_ipc_ping.c +++ b/aqhome/ipc/nodes/msg_ipc_ping.c @@ -10,7 +10,7 @@ # include #endif -#include +#include #include #include @@ -35,7 +35,7 @@ GWEN_MSG *AQH_PingIpcMsg_new(uint16_t code, uint8_t destAddr) GWEN_MSG *msg; uint8_t *ptr; - msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_ID, AQH_IPC_PROTOCOL_VERSION, code, AQH_MSGIPC_PING_MINSIZE, NULL); + msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, AQH_MSGIPC_PING_MINSIZE, NULL); ptr=GWEN_Msg_GetBuffer(msg); ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_PING_OFFS_DESTADDR]=destAddr & 0xff; diff --git a/aqhome/ipc/msg_ipc_ping.h b/aqhome/ipc/nodes/msg_ipc_ping.h similarity index 95% rename from aqhome/ipc/msg_ipc_ping.h rename to aqhome/ipc/nodes/msg_ipc_ping.h index a7178c4..568ae40 100644 --- a/aqhome/ipc/msg_ipc_ping.h +++ b/aqhome/ipc/nodes/msg_ipc_ping.h @@ -11,7 +11,7 @@ #include -#include +#include #include #include diff --git a/aqhome/ipc/msg_ipc_setaccmsggrps.c b/aqhome/ipc/nodes/msg_ipc_setaccmsggrps.c similarity index 92% rename from aqhome/ipc/msg_ipc_setaccmsggrps.c rename to aqhome/ipc/nodes/msg_ipc_setaccmsggrps.c index 59fd207..f547751 100644 --- a/aqhome/ipc/msg_ipc_setaccmsggrps.c +++ b/aqhome/ipc/nodes/msg_ipc_setaccmsggrps.c @@ -10,7 +10,7 @@ # include #endif -#include +#include #include #include @@ -35,7 +35,7 @@ GWEN_MSG *AQH_SetAcceptedMsgGroupsIpcMsg_new(uint16_t code, uint32_t groups) GWEN_MSG *msg; uint8_t *ptr; - msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_ID, AQH_IPC_PROTOCOL_VERSION, code, AQH_MSGIPC_SETACCEPTEDMSGGRPS_MINSIZE, NULL); + msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, AQH_MSGIPC_SETACCEPTEDMSGGRPS_MINSIZE, NULL); ptr=GWEN_Msg_GetBuffer(msg); ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_SETACCEPTEDMSGGRPS_OFFS_GROUPS+0]=groups & 0xff; ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_SETACCEPTEDMSGGRPS_OFFS_GROUPS+1]=(groups>>8) & 0xff; diff --git a/aqhome/ipc/msg_ipc_setaccmsggrps.h b/aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h similarity index 95% rename from aqhome/ipc/msg_ipc_setaccmsggrps.h rename to aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h index f1e4867..f61fdf7 100644 --- a/aqhome/ipc/msg_ipc_setaccmsggrps.h +++ b/aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h @@ -11,7 +11,7 @@ #include -#include +#include #include #include diff --git a/aqhome/ipc/msg_ipc_value.c b/aqhome/ipc/nodes/msg_ipc_value.c similarity index 96% rename from aqhome/ipc/msg_ipc_value.c rename to aqhome/ipc/nodes/msg_ipc_value.c index f4241d9..4fd3047 100644 --- a/aqhome/ipc/msg_ipc_value.c +++ b/aqhome/ipc/nodes/msg_ipc_value.c @@ -10,7 +10,7 @@ # include #endif -#include +#include #include #include @@ -44,7 +44,7 @@ GWEN_MSG *AQH_ValueIpcMsg_new(uint16_t code, GWEN_MSG *msg; uint8_t *ptr; - msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_ID, AQH_IPC_PROTOCOL_VERSION, code, AQH_MSGIPC_VALUE_MINSIZE, NULL); + msg=GWEN_IpcMsg_new(AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, code, AQH_MSGIPC_VALUE_MINSIZE, NULL); ptr=GWEN_Msg_GetBuffer(msg); ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_UID+0]=uid & 0xff; ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_UID+1]=(uid>>8) & 0xff; diff --git a/aqhome/ipc/msg_ipc_value.h b/aqhome/ipc/nodes/msg_ipc_value.h similarity index 97% rename from aqhome/ipc/msg_ipc_value.h rename to aqhome/ipc/nodes/msg_ipc_value.h index 1bd85e4..96112dc 100644 --- a/aqhome/ipc/msg_ipc_value.h +++ b/aqhome/ipc/nodes/msg_ipc_value.h @@ -11,7 +11,7 @@ #include -#include +#include #include #include diff --git a/aqhome/libtest.c b/aqhome/libtest.c index 7f9c520..2a15307 100644 --- a/aqhome/libtest.c +++ b/aqhome/libtest.c @@ -4,9 +4,9 @@ #endif #include "aqhome/msg/msg_ping.h" -#include "aqhome/ipc/msg_ipc_ping.h" -#include "aqhome/ipc/msg_ipc_forward.h" -#include "aqhome/ipc/msg_ipc_setaccmsggrps.h" +#include "aqhome/ipc/nodes/msg_ipc_ping.h" +#include "aqhome/ipc/nodes/msg_ipc_forward.h" +#include "aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h" #include "aqhome/mqtt/endpoint_mqttc.h" #include "aqhome/mqtt/msg_mqtt_connect.h" #include "aqhome/mqtt/msg_mqtt_connack.h"