aqhome apps: sending a message via aqhome-nodes to nodes now works.
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
#include "./devicesread.h"
|
||||
#include "./r_setdata.h"
|
||||
#include "./r_connect.h"
|
||||
#include "./r_forward.h"
|
||||
#include "./r_setaccmsggrps.h"
|
||||
|
||||
#include <aqhome/aqhome.h>
|
||||
#include <aqhome/ipc2/ipc_endpoint.h>
|
||||
@@ -29,6 +31,7 @@
|
||||
#include <aqhome/msg/ipc/m_ipc.h>
|
||||
#include <aqhome/msg/ipc/m_ipc_result.h>
|
||||
#include <aqhome/msg/ipc/m_ipc_connect.h>
|
||||
#include <aqhome/msg/ipc/m_ipc_tag16.h>
|
||||
#include <aqhome/msg/ipc/data/m_ipcd.h>
|
||||
#include <aqhome/msg/ipc/data/m_ipcd_multidata.h>
|
||||
#include <aqhome/msg/ipc/nodes/m_ipcn.h>
|
||||
@@ -594,13 +597,13 @@ int _exchangeConnect(AQH_NODE_SERVER *xo, uint32_t flags)
|
||||
uint32_t msgId;
|
||||
|
||||
msgId=AQH_Endpoint_GetNextMessageId(xo->brokerEndpoint);
|
||||
msgOut=AQH_IpcMessageConnect_new(xo->protoId, xo->protoVer,
|
||||
msgOut=AQH_IpcMessageConnect_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION,
|
||||
AQH_MSGTYPE_IPC_CONNECT_REQ,
|
||||
msgId, 0,
|
||||
xo->brokerClientId, NULL, NULL, flags);
|
||||
AQH_Endpoint_AddMsgOut(xo->brokerEndpoint, msgOut);
|
||||
return AQH_IpcEndpoint_WaitForResultMsg(xo->brokerEndpoint,
|
||||
xo->protoId, xo->protoVer, AQH_MSGTYPE_IPC_RESULT,
|
||||
AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, AQH_MSGTYPE_IPC_RESULT,
|
||||
msgId, xo->timeoutInSeconds);
|
||||
}
|
||||
|
||||
@@ -751,11 +754,19 @@ void _handleMsgFromClient(GWEN_UNUSED AQH_OBJECT *o, GWEN_UNUSED AQH_NODE_SERVER
|
||||
/* exec IPC message */
|
||||
code=AQH_IpcMessage_GetCode(msg);
|
||||
protoId=AQH_IpcMessage_GetProtoId(msg);
|
||||
if (protoId==AQH_IPC_PROTOCOL_DATA_ID) {
|
||||
DBG_ERROR(NULL, "Received IPC packet %d (%x)", (int) code, code);
|
||||
switch(code) {
|
||||
case AQH_MSGTYPE_IPC_DATA_CONNECT_REQ: AQH_NodeServer_HandleConnect(o, ep, msg); break;
|
||||
default: break;
|
||||
if (protoId==AQH_IPC_PROTOCOL_NODES_ID) {
|
||||
GWEN_TAG16_LIST *tagList;
|
||||
|
||||
tagList=AQH_IpcMessageTag16_ParsePayload(msg, 0);
|
||||
if (tagList) {
|
||||
DBG_ERROR(NULL, "Received IPC packet %d (%x)", (int) code, code);
|
||||
switch(code) {
|
||||
case AQH_MSGTYPE_IPC_NODES_CONNECT_REQ: AQH_NodeServer_HandleConnect(o, ep, msg, tagList); break;
|
||||
case AQH_MSGTYPE_IPC_NODES_FORWARD: AQH_NodeServer_HandleForward(o, ep, msg, tagList); break;
|
||||
case AQH_MSGTYPE_IPC_NODES_SETACCMSGGRPS: AQH_NodeServer_HandleSetAccMsgGrps(o, ep, msg, tagList); break;
|
||||
default: break;
|
||||
}
|
||||
GWEN_Tag16_List_free(tagList);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -835,6 +846,7 @@ void _forwardTtyMsgToClients(AQH_NODE_SERVER *xo, const AQH_MESSAGE *msg)
|
||||
if (AQH_Endpoint_GetAcceptedMsgGroups(ep) & msgGroup) {
|
||||
AQH_MESSAGE *outMsg;
|
||||
|
||||
DBG_ERROR(NULL, "Forwarding node message %d to client", AQH_NodeMessage_GetMsgType(msg));
|
||||
outMsg=AQH_IpcnMessageForward_new(AQH_MSGTYPE_IPC_NODES_FORWARD,
|
||||
AQH_Endpoint_GetNextMessageId(ep), 0,
|
||||
AQH_Message_GetMsgPointer(msg), AQH_Message_GetUsedSize(msg));
|
||||
|
||||
Reference in New Issue
Block a user