Prepared introduction of multiple ipc protocols.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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 <gwenhywfar/args.h>
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 <gwenhywfar/endpoint_tcpc.h>
|
||||
#include <gwenhywfar/debug.h>
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user