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

@@ -46,14 +46,6 @@
<headers dist="true" install="$(pkgincludedir)/ipc" >
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>
@@ -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
</sources>
@@ -82,9 +66,11 @@
<useTargets>
aqhipcnodes
</useTargets>
<subdirs>
nodes
</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
#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>
#endif
#include <aqhome/ipc/msg_ipc_error.h>
#include <aqhome/ipc/nodes/msg_ipc_error.h>
#include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h>
@@ -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;

View File

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

View File

@@ -10,7 +10,7 @@
# include <config.h>
#endif
#include <aqhome/ipc/msg_ipc_forward.h>
#include <aqhome/ipc/nodes/msg_ipc_forward.h>
#include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h>
@@ -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);
}

View File

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

View File

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

View File

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

View File

@@ -10,7 +10,7 @@
# include <config.h>
#endif
#include <aqhome/ipc/msg_ipc_getdevices_rsp.h>
#include <aqhome/ipc/nodes/msg_ipc_getdevices_rsp.h>
#include <gwenhywfar/msg.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;
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;

View File

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

View File

@@ -10,7 +10,7 @@
# include <config.h>
#endif
#include <aqhome/ipc/msg_ipc_ping.h>
#include <aqhome/ipc/nodes/msg_ipc_ping.h>
#include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h>
@@ -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;

View File

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

View File

@@ -10,7 +10,7 @@
# include <config.h>
#endif
#include <aqhome/ipc/msg_ipc_setaccmsggrps.h>
#include <aqhome/ipc/nodes/msg_ipc_setaccmsggrps.h>
#include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h>
@@ -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;

View File

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

View File

@@ -10,7 +10,7 @@
# include <config.h>
#endif
#include <aqhome/ipc/msg_ipc_value.h>
#include <aqhome/ipc/nodes/msg_ipc_value.h>
#include <gwenhywfar/msg.h>
#include <gwenhywfar/buffer.h>
@@ -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;

View File

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

View File

@@ -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"