Prepared introduction of multiple ipc protocols.

This commit is contained in:
Martin Preuss
2023-08-13 14:09:15 +02:00
parent 590eccf8d9
commit 64938b9cb0
29 changed files with 203 additions and 124 deletions

View File

@@ -14,8 +14,8 @@
#include "./utils.h" #include "./utils.h"
#include "aqhome/ipc/endpoint_ipc.h" #include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_setaccmsggrps.h" #include "aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h"
#include "aqhome/ipc/msg_ipc_forward.h" #include "aqhome/ipc/nodes/msg_ipc_forward.h"
#include "aqhome/msg/msg_node.h" #include "aqhome/msg/msg_node.h"
#include "aqhome/msg/msg_flashready.h" #include "aqhome/msg/msg_flashready.h"
#include "aqhome/msg/msg_flashstart.h" #include "aqhome/msg/msg_flashstart.h"
@@ -471,7 +471,7 @@ int _sendRebootRequest(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid)
return GWEN_ERROR_GENERIC; 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_MsgEndpoint_AddSendMessage(epTcp, msgOut);
GWEN_Msg_free(msgNode); GWEN_Msg_free(msgNode);
return 0; return 0;
@@ -490,7 +490,7 @@ int _sendFlashStart(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid)
return GWEN_ERROR_GENERIC; 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_MsgEndpoint_AddSendMessage(epTcp, msgOut);
GWEN_Msg_free(msgNode); GWEN_Msg_free(msgNode);
return 0; return 0;
@@ -509,7 +509,7 @@ int _sendFlashEnd(GWEN_MSG_ENDPOINT *epTcp, int reason)
return GWEN_ERROR_GENERIC; 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_MsgEndpoint_AddSendMessage(epTcp, msgOut);
GWEN_Msg_free(msgNode); GWEN_Msg_free(msgNode);
return 0; return 0;
@@ -555,7 +555,7 @@ int _sendFlashRecord(GWEN_MSG_ENDPOINT *epTcp,
return GWEN_ERROR_GENERIC; 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_MsgEndpoint_AddSendMessage(epTcp, msgOut);
GWEN_Msg_free(msgNode); GWEN_Msg_free(msgNode);

View File

@@ -14,9 +14,9 @@
#include "./utils.h" #include "./utils.h"
#include "aqhome/ipc/endpoint_ipc.h" #include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_getdevices_req.h" #include "aqhome/ipc/nodes/msg_ipc_getdevices_req.h"
#include "aqhome/ipc/msg_ipc_getdevices_rsp.h" #include "aqhome/ipc/nodes/msg_ipc_getdevices_rsp.h"
#include "aqhome/ipc/msg_ipc_error.h" #include "aqhome/ipc/nodes/msg_ipc_error.h"
#include "aqhome/msg/msg_node.h" #include "aqhome/msg/msg_node.h"
#include <gwenhywfar/args.h> #include <gwenhywfar/args.h>
@@ -146,19 +146,19 @@ int _doGetDevices(GWEN_DB_NODE *dbArgs)
GWEN_MSG *msg; GWEN_MSG *msg;
uint16_t code; 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) { if (msg==NULL) {
DBG_INFO(NULL, "No GET_DEVICE response received."); DBG_INFO(NULL, "No GET_DEVICE response received.");
GWEN_MsgEndpoint_free(epTcp); GWEN_MsgEndpoint_free(epTcp);
return 2; return 2;
} }
code=GWEN_IpcMsg_GetCode(msg); 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)); fprintf(stdout, "No device list (%d)\n", AQH_ErrorIpcMsg_GetErrorCode(msg));
GWEN_Msg_free(msg); GWEN_Msg_free(msg);
break; break;
} }
else if (code==AQH_MSGTYPE_IPC_GETDEVICES_RSP) { else if (code==AQH_MSGTYPE_IPC_NODES_GETDEVICES_RSP) {
uint16_t fwVersion; uint16_t fwVersion;
int64_t ts64; int64_t ts64;
GWEN_TIMESTAMP *ts; GWEN_TIMESTAMP *ts;
@@ -206,7 +206,7 @@ int _sendGetDevices(GWEN_MSG_ENDPOINT *epTcp)
{ {
GWEN_MSG *msgOut; 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) { if (msgOut==NULL) {
DBG_ERROR(NULL, "Error creating message"); DBG_ERROR(NULL, "Error creating message");
return GWEN_ERROR_GENERIC; return GWEN_ERROR_GENERIC;

View File

@@ -13,9 +13,9 @@
#include "./ping.h" #include "./ping.h"
#include "./utils.h" #include "./utils.h"
#include "aqhome/ipc/msg_ipc_setaccmsggrps.h" #include "aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h"
#include "aqhome/ipc/msg_ipc_ping.h" #include "aqhome/ipc/nodes/msg_ipc_ping.h"
#include "aqhome/ipc/msg_ipc_forward.h" #include "aqhome/ipc/nodes/msg_ipc_forward.h"
#include "aqhome/ipc/endpoint_ipc.h" #include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/msg/msg_node.h" #include "aqhome/msg/msg_node.h"
@@ -175,7 +175,7 @@ int _sendPing(GWEN_MSG_ENDPOINT *epTcp, int nodeAddr)
{ {
GWEN_MSG *msgOut; 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) { if (msgOut==NULL) {
DBG_ERROR(NULL, "Error creating message"); DBG_ERROR(NULL, "Error creating message");
return GWEN_ERROR_GENERIC; return GWEN_ERROR_GENERIC;

View File

@@ -14,8 +14,8 @@
#include "./utils.h" #include "./utils.h"
#include "aqhome/ipc/endpoint_ipc.h" #include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_setaccmsggrps.h" #include "aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h"
#include "aqhome/ipc/msg_ipc_forward.h" #include "aqhome/ipc/nodes/msg_ipc_forward.h"
#include <gwenhywfar/endpoint_tcpc.h> #include <gwenhywfar/endpoint_tcpc.h>
#include <gwenhywfar/debug.h> #include <gwenhywfar/debug.h>
@@ -70,7 +70,7 @@ GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT *epTcp,
GWEN_MsgEndpoint_IoLoop(epTcp, 2000); /* 2000 ms */ GWEN_MsgEndpoint_IoLoop(epTcp, 2000); /* 2000 ms */
msg=GWEN_MsgEndpoint_TakeFirstReceivedMessage(epTcp); msg=GWEN_MsgEndpoint_TakeFirstReceivedMessage(epTcp);
if (msg) { if (msg) {
if (GWEN_IpcMsg_GetCode(msg)==AQH_MSGTYPE_IPC_FORWARD) { if (GWEN_IpcMsg_GetCode(msg)==AQH_MSGTYPE_IPC_NODES_FORWARD) {
GWEN_MSG *nodeMsg; GWEN_MSG *nodeMsg;
DBG_INFO(NULL, "Received IPC FORWARD message"); 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"); DBG_INFO(NULL, "Received expected IPC message");
return msg; return msg;
} }
else if (code==AQH_MSGTYPE_IPC_ERROR) { else if (code==AQH_MSGTYPE_IPC_NODES_ERROR) {
DBG_INFO(NULL, "Received IPC error message"); DBG_INFO(NULL, "Received IPC error message");
return msg; return msg;
} }
@@ -169,7 +169,7 @@ int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT *epTcp, uint32_t groups)
{ {
GWEN_MSG *msgOut; 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) { if (msgOut==NULL) {
DBG_ERROR(NULL, "Error creating message"); DBG_ERROR(NULL, "Error creating message");
return GWEN_ERROR_GENERIC; return GWEN_ERROR_GENERIC;

View File

@@ -23,8 +23,8 @@
#include "aqhome/msg/msg_node.h" #include "aqhome/msg/msg_node.h"
#include "aqhome/msg/msg_value2.h" #include "aqhome/msg/msg_value2.h"
#include "aqhome/ipc/endpoint_ipc.h" #include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_forward.h" #include "aqhome/ipc/nodes/msg_ipc_forward.h"
#include "aqhome/ipc/msg_ipc_value.h" #include "aqhome/ipc/nodes/msg_ipc_value.h"
#include "aqhome/mqtt/endpoint_mqttc.h" #include "aqhome/mqtt/endpoint_mqttc.h"
#include <gwenhywfar/gwenhywfar.h> #include <gwenhywfar/gwenhywfar.h>

View File

@@ -22,13 +22,13 @@
#include "aqhome/msg/msg_value2.h" #include "aqhome/msg/msg_value2.h"
#include "aqhome/msg/msg_ping.h" #include "aqhome/msg/msg_ping.h"
#include "aqhome/ipc/endpoint_ipc.h" #include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc.h" #include "aqhome/ipc/nodes/ipc_nodes.h"
#include "aqhome/ipc/msg_ipc_forward.h" #include "aqhome/ipc/nodes/msg_ipc_forward.h"
#include "aqhome/ipc/msg_ipc_value.h" #include "aqhome/ipc/nodes/msg_ipc_value.h"
#include "aqhome/ipc/msg_ipc_ping.h" #include "aqhome/ipc/nodes/msg_ipc_ping.h"
#include "aqhome/ipc/msg_ipc_setaccmsggrps.h" #include "aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h"
#include "aqhome/ipc/msg_ipc_getdevices_rsp.h" #include "aqhome/ipc/nodes/msg_ipc_getdevices_rsp.h"
#include "aqhome/ipc/msg_ipc_error.h" #include "aqhome/ipc/nodes/msg_ipc_error.h"
#include <gwenhywfar/gwenhywfar.h> #include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/args.h> #include <gwenhywfar/args.h>
@@ -102,10 +102,10 @@ void _handleIpcMsg(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *msg)
code=GWEN_IpcMsg_GetCode(msg); code=GWEN_IpcMsg_GetCode(msg);
DBG_ERROR(AQH_LOGDOMAIN, "Received IPC packet"); DBG_ERROR(AQH_LOGDOMAIN, "Received IPC packet");
switch(code) { switch(code) {
case AQH_MSGTYPE_IPC_PING: _handleIpcMsgPing(aqh, ep, msg); break; case AQH_MSGTYPE_IPC_NODES_PING: _handleIpcMsgPing(aqh, ep, msg); break;
case AQH_MSGTYPE_IPC_SETACCMSGGRPS: _handleIpcMsgSetAccMsgGrps(aqh, ep, msg); break; case AQH_MSGTYPE_IPC_NODES_SETACCMSGGRPS: _handleIpcMsgSetAccMsgGrps(aqh, ep, msg); break;
case AQH_MSGTYPE_IPC_FORWARD: _handleIpcMsgForward(aqh, ep, msg); break; case AQH_MSGTYPE_IPC_NODES_FORWARD: _handleIpcMsgForward(aqh, ep, msg); break;
case AQH_MSGTYPE_IPC_GETDEVICES_REQ: _handleIpcMsgGetDevicesReq(aqh, ep, msg); break; case AQH_MSGTYPE_IPC_NODES_GETDEVICES_REQ: _handleIpcMsgGetDevicesReq(aqh, ep, msg); break;
default: break; default: break;
} }
} }
@@ -167,7 +167,7 @@ void _handleIpcMsgGetDevicesReq(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_
niNext=AQH_NodeInfo_List_Next(ni); niNext=AQH_NodeInfo_List_Next(ni);
DBG_INFO(AQH_LOGDOMAIN, "Sending response for node %02x (%08x)", AQH_NodeInfo_GetBusAddress(ni), AQH_NodeInfo_GetUid(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); GWEN_MsgEndpoint_AddSendMessage(ep, msgOut);
ni=niNext; ni=niNext;
} }
@@ -176,7 +176,7 @@ void _handleIpcMsgGetDevicesReq(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, const GWEN_
GWEN_MSG *msgOut; GWEN_MSG *msgOut;
DBG_INFO(AQH_LOGDOMAIN, "No nodes"); 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); GWEN_MsgEndpoint_AddSendMessage(ep, msgOut);
} }
} }

View File

@@ -23,8 +23,8 @@
#include "aqhome/msg/msg_node.h" #include "aqhome/msg/msg_node.h"
#include "aqhome/msg/msg_value2.h" #include "aqhome/msg/msg_value2.h"
#include "aqhome/ipc/endpoint_ipc.h" #include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_forward.h" #include "aqhome/ipc/nodes/msg_ipc_forward.h"
#include "aqhome/ipc/msg_ipc_value.h" #include "aqhome/ipc/nodes/msg_ipc_value.h"
#include "aqhome/mqtt/endpoint_mqttc.h" #include "aqhome/mqtt/endpoint_mqttc.h"
#include <gwenhywfar/gwenhywfar.h> #include <gwenhywfar/gwenhywfar.h>

View File

@@ -21,8 +21,8 @@
#include "aqhome/msg/msg_node.h" #include "aqhome/msg/msg_node.h"
#include "aqhome/msg/msg_value2.h" #include "aqhome/msg/msg_value2.h"
#include "aqhome/ipc/endpoint_ipc.h" #include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_forward.h" #include "aqhome/ipc/nodes/msg_ipc_forward.h"
#include "aqhome/ipc/msg_ipc_value.h" #include "aqhome/ipc/nodes/msg_ipc_value.h"
#include "aqhome/mqtt/endpoint_mqttc.h" #include "aqhome/mqtt/endpoint_mqttc.h"
#include <gwenhywfar/gwenhywfar.h> #include <gwenhywfar/gwenhywfar.h>
@@ -93,7 +93,7 @@ void _forwardValue2MsgToIpc(GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *nodeMsg)
{ {
GWEN_MSG *ipcMsg; 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_GetUid(nodeMsg),
AQH_Value2Msg_GetValueId(nodeMsg), AQH_Value2Msg_GetValueId(nodeMsg),
AQH_Value2Msg_GetValueType(nodeMsg), AQH_Value2Msg_GetValueType(nodeMsg),
@@ -108,7 +108,7 @@ void _forwardAnyMsgToIpc(GWEN_MSG_ENDPOINT *ep, const GWEN_MSG *nodeMsg)
{ {
GWEN_MSG *ipcMsg; 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); GWEN_MsgEndpoint_AddSendMessage(ep, ipcMsg);
} }

View File

@@ -23,8 +23,8 @@
#include "aqhome/msg/msg_sendstats.h" #include "aqhome/msg/msg_sendstats.h"
#include "aqhome/msg/msg_recvstats.h" #include "aqhome/msg/msg_recvstats.h"
#include "aqhome/ipc/endpoint_ipc.h" #include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_forward.h" #include "aqhome/ipc/nodes/msg_ipc_forward.h"
#include "aqhome/ipc/msg_ipc_value.h" #include "aqhome/ipc/nodes/msg_ipc_value.h"
#include "aqhome/mqtt/endpoint_mqttc.h" #include "aqhome/mqtt/endpoint_mqttc.h"
#include "aqhome/mqtt/msg_mqtt_publish.h" #include "aqhome/mqtt/msg_mqtt_publish.h"

View File

@@ -46,14 +46,6 @@
<headers dist="true" install="$(pkgincludedir)/ipc" > <headers dist="true" install="$(pkgincludedir)/ipc" >
endpoint_ipc.h 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
</headers> </headers>
@@ -66,14 +58,6 @@
$(local/typefiles) $(local/typefiles)
endpoint_ipc.c 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
</sources> </sources>
@@ -82,9 +66,11 @@
<useTargets> <useTargets>
aqhipcnodes
</useTargets> </useTargets>
<subdirs> <subdirs>
nodes
</subdirs> </subdirs>

View File

@@ -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 <aqhome/api.h>
#include <gwenhywfar/msg_ipc.h>
#include <gwenhywfar/buffer.h>
#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

93
aqhome/ipc/nodes/0BUILD Normal file
View File

@@ -0,0 +1,93 @@
<?xml?>
<gwbuild>
<target type="ConvenienceLibrary" name="aqhipcnodes" >
<includes type="c" >
$(gwenhywfar_cflags)
-I$(topsrcdir)
-I$(topbuilddir)
</includes>
<includes type="tm2" >
--include=$(builddir)
--include=$(srcdir)
</includes>
<define name="BUILDING_AQHOME" />
<setVar name="local/cflags">$(visibility_cflags)</setVar>
<setVar name="tm2flags" >
--api=AQHOME_API
</setVar>
<setVar name="local/typefiles" >
</setVar>
<setVar name="local/built_sources" >
</setVar>
<setVar name="local/built_headers_pub">
</setVar>
<setVar name="local/built_headers_priv" >
</setVar>
<headers dist="false" install="$(pkgincludedir)/ipc" >
$(local/built_headers_pub)
</headers>
<headers dist="true" install="$(pkgincludedir)/ipc" >
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
</headers>
<headers dist="true" >
endpoint_ipc_p.h
</headers>
<sources>
$(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
</sources>
<extradist>
</extradist>
<useTargets>
</useTargets>
<subdirs>
</subdirs>
</target>
</gwbuild>

View File

@@ -11,6 +11,6 @@
#endif #endif
#include <aqhome/ipc/msg_ipc.h> #include <aqhome/ipc/nodes/ipc_nodes.h>

View File

@@ -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 <aqhome/api.h>
#include <gwenhywfar/msg_ipc.h>
#include <gwenhywfar/buffer.h>
#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

View File

@@ -10,7 +10,7 @@
# include <config.h> # include <config.h>
#endif #endif
#include <aqhome/ipc/msg_ipc_error.h> #include <aqhome/ipc/nodes/msg_ipc_error.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h> #include <gwenhywfar/buffer.h>
@@ -35,7 +35,7 @@ GWEN_MSG *AQH_ErrorIpcMsg_new(uint16_t code, uint16_t errorCode)
GWEN_MSG *msg; GWEN_MSG *msg;
uint8_t *ptr; 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_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+0]=errorCode & 0xff;
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_ERROR_OFFS_ERRORCODE+1]=errorCode & 0xff; ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_ERROR_OFFS_ERRORCODE+1]=errorCode & 0xff;

View File

@@ -11,7 +11,7 @@
#include <aqhome/api.h> #include <aqhome/api.h>
#include <aqhome/ipc/msg_ipc.h> #include <aqhome/ipc/nodes/ipc_nodes.h>
#include <aqhome/msg/msg_node.h> #include <aqhome/msg/msg_node.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>

View File

@@ -10,7 +10,7 @@
# include <config.h> # include <config.h>
#endif #endif
#include <aqhome/ipc/msg_ipc_forward.h> #include <aqhome/ipc/nodes/msg_ipc_forward.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h> #include <gwenhywfar/buffer.h>
@@ -32,7 +32,7 @@
GWEN_MSG *AQH_ForwardIpcMsg_new(uint16_t code, const uint8_t *ptr, uint32_t len) 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);
} }

View File

@@ -11,7 +11,7 @@
#include <aqhome/api.h> #include <aqhome/api.h>
#include <aqhome/ipc/msg_ipc.h> #include <aqhome/ipc/nodes/ipc_nodes.h>
#include <aqhome/msg/msg_node.h> #include <aqhome/msg/msg_node.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>

View File

@@ -10,7 +10,7 @@
# include <config.h> # include <config.h>
#endif #endif
#include <aqhome/ipc/msg_ipc_getdevices_req.h> #include <aqhome/ipc/nodes/msg_ipc_getdevices_req.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h> #include <gwenhywfar/buffer.h>
@@ -30,7 +30,7 @@
GWEN_MSG *AQH_GetDevicesRequestIpcMsg_new(uint16_t code) 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);
} }

View File

@@ -11,7 +11,7 @@
#include <aqhome/api.h> #include <aqhome/api.h>
#include <aqhome/ipc/msg_ipc.h> #include <aqhome/ipc/nodes/ipc_nodes.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h> #include <gwenhywfar/buffer.h>

View File

@@ -10,7 +10,7 @@
# include <config.h> # include <config.h>
#endif #endif
#include <aqhome/ipc/msg_ipc_getdevices_rsp.h> #include <aqhome/ipc/nodes/msg_ipc_getdevices_rsp.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h> #include <gwenhywfar/buffer.h>
@@ -51,7 +51,7 @@ GWEN_MSG *AQH_GetDevicesResponseIpcMsg_new(uint16_t code, uint8_t flags, const A
uint64_t u64=0; uint64_t u64=0;
const GWEN_TIMESTAMP *t; 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=GWEN_Msg_GetBuffer(msg)+GWEN_MSGIPC_OFFS_PAYLOAD;
*(ptr++)=flags & 0xff; *(ptr++)=flags & 0xff;

View File

@@ -11,7 +11,7 @@
#include <aqhome/api.h> #include <aqhome/api.h>
#include <aqhome/ipc/msg_ipc.h> #include <aqhome/ipc/nodes/ipc_nodes.h>
#include <aqhome/nodes/nodeinfo.h> #include <aqhome/nodes/nodeinfo.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>

View File

@@ -10,7 +10,7 @@
# include <config.h> # include <config.h>
#endif #endif
#include <aqhome/ipc/msg_ipc_ping.h> #include <aqhome/ipc/nodes/msg_ipc_ping.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h> #include <gwenhywfar/buffer.h>
@@ -35,7 +35,7 @@ GWEN_MSG *AQH_PingIpcMsg_new(uint16_t code, uint8_t destAddr)
GWEN_MSG *msg; GWEN_MSG *msg;
uint8_t *ptr; 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_Msg_GetBuffer(msg);
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_PING_OFFS_DESTADDR]=destAddr & 0xff; ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_PING_OFFS_DESTADDR]=destAddr & 0xff;

View File

@@ -11,7 +11,7 @@
#include <aqhome/api.h> #include <aqhome/api.h>
#include <aqhome/ipc/msg_ipc.h> #include <aqhome/ipc/nodes/ipc_nodes.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h> #include <gwenhywfar/buffer.h>

View File

@@ -10,7 +10,7 @@
# include <config.h> # include <config.h>
#endif #endif
#include <aqhome/ipc/msg_ipc_setaccmsggrps.h> #include <aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h> #include <gwenhywfar/buffer.h>
@@ -35,7 +35,7 @@ GWEN_MSG *AQH_SetAcceptedMsgGroupsIpcMsg_new(uint16_t code, uint32_t groups)
GWEN_MSG *msg; GWEN_MSG *msg;
uint8_t *ptr; 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_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+0]=groups & 0xff;
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_SETACCEPTEDMSGGRPS_OFFS_GROUPS+1]=(groups>>8) & 0xff; ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_SETACCEPTEDMSGGRPS_OFFS_GROUPS+1]=(groups>>8) & 0xff;

View File

@@ -11,7 +11,7 @@
#include <aqhome/api.h> #include <aqhome/api.h>
#include <aqhome/ipc/msg_ipc.h> #include <aqhome/ipc/nodes/ipc_nodes.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h> #include <gwenhywfar/buffer.h>

View File

@@ -10,7 +10,7 @@
# include <config.h> # include <config.h>
#endif #endif
#include <aqhome/ipc/msg_ipc_value.h> #include <aqhome/ipc/nodes/msg_ipc_value.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h> #include <gwenhywfar/buffer.h>
@@ -44,7 +44,7 @@ GWEN_MSG *AQH_ValueIpcMsg_new(uint16_t code,
GWEN_MSG *msg; GWEN_MSG *msg;
uint8_t *ptr; 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_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+0]=uid & 0xff;
ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_UID+1]=(uid>>8) & 0xff; ptr[GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_VALUE_OFFS_UID+1]=(uid>>8) & 0xff;

View File

@@ -11,7 +11,7 @@
#include <aqhome/api.h> #include <aqhome/api.h>
#include <aqhome/ipc/msg_ipc.h> #include <aqhome/ipc/nodes/ipc_nodes.h>
#include <aqhome/msg/msg_node.h> #include <aqhome/msg/msg_node.h>
#include <gwenhywfar/msg.h> #include <gwenhywfar/msg.h>

View File

@@ -4,9 +4,9 @@
#endif #endif
#include "aqhome/msg/msg_ping.h" #include "aqhome/msg/msg_ping.h"
#include "aqhome/ipc/msg_ipc_ping.h" #include "aqhome/ipc/nodes/msg_ipc_ping.h"
#include "aqhome/ipc/msg_ipc_forward.h" #include "aqhome/ipc/nodes/msg_ipc_forward.h"
#include "aqhome/ipc/msg_ipc_setaccmsggrps.h" #include "aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h"
#include "aqhome/mqtt/endpoint_mqttc.h" #include "aqhome/mqtt/endpoint_mqttc.h"
#include "aqhome/mqtt/msg_mqtt_connect.h" #include "aqhome/mqtt/msg_mqtt_connect.h"
#include "aqhome/mqtt/msg_mqtt_connack.h" #include "aqhome/mqtt/msg_mqtt_connack.h"