aqhome: implemented IPC client, fixed some bugs.
sending a PING request and retrieving the PONG response works now.
This commit is contained in:
@@ -56,46 +56,72 @@ void _freeData(void *bp, void *p)
|
||||
|
||||
|
||||
|
||||
uint8_t AQH_MsgEndpointMgr_GetBusAddr(GWEN_MSG_ENDPOINT_MGR *emgr)
|
||||
{
|
||||
AQH_MSG_ENDPOINT_MGR *xmgr;
|
||||
|
||||
xmgr=GWEN_INHERIT_GETDATA(GWEN_MSG_ENDPOINT_MGR, AQH_MSG_ENDPOINT_MGR, emgr);
|
||||
if (xmgr)
|
||||
return xmgr->busAddr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AQH_MsgEndpointMgr_DistributeMsgFromNodeEndpoint(GWEN_MSG_ENDPOINT_MGR *emgr,
|
||||
GWEN_MSG_ENDPOINT *srcEp,
|
||||
const GWEN_MSG *msg,
|
||||
int groupId)
|
||||
int groupId,
|
||||
const char *wantedTypeName)
|
||||
{
|
||||
GWEN_MSG_ENDPOINT_LIST *endpointList;
|
||||
|
||||
endpointList=GWEN_MsgEndpointMgr_GetEndpointList(emgr);
|
||||
if (endpointList) {
|
||||
GWEN_MSG_ENDPOINT *ep;
|
||||
int acceptedGroupIds;
|
||||
uint32_t msgGroup;
|
||||
|
||||
msgGroup=AQH_NodeMsg_GetMsgGroup(AQH_NodeMsg_GetMsgType(msg));
|
||||
acceptedGroupIds=GWEN_MsgEndpoint_GetAcceptedGroupIds(srcEp);
|
||||
|
||||
ep=GWEN_MsgEndpoint_List_First(endpointList);
|
||||
while(ep) {
|
||||
if (ep!=srcEp) {
|
||||
if (acceptedGroupIds & groupId) {
|
||||
uint32_t acceptedMsgGroups;
|
||||
const char *epTypeName;
|
||||
|
||||
acceptedMsgGroups=AQH_NodeEndpoint_GetAcceptedMsgGroups(ep);
|
||||
DBG_DEBUG(AQH_LOGDOMAIN, "- checking endpoint %s (msgGroup=%08x, accept: %08x, flags: %08x)",
|
||||
GWEN_MsgEndpoint_GetName(ep),
|
||||
msgGroup, acceptedMsgGroups,
|
||||
GWEN_MsgEndpoint_GetFlags(ep));
|
||||
epTypeName=GWEN_MsgEndpoint_GetName(ep);
|
||||
if (wantedTypeName==NULL || (wantedTypeName && epTypeName && strcasecmp(epTypeName, wantedTypeName)==0)) {
|
||||
if (!(GWEN_MsgEndpoint_GetFlags(ep) & AQH_MSGEP_NODE_FLAGS_NOMESSAGES)) {
|
||||
int acceptedGroupIds;
|
||||
uint32_t acceptedMsgGroups;
|
||||
|
||||
if (!(GWEN_MsgEndpoint_GetFlags(ep) & AQH_MSGEP_NODE_FLAGS_NOMESSAGES) &&
|
||||
(msgGroup & acceptedMsgGroups)) {
|
||||
/* endpoint accepts this message */
|
||||
DBG_DEBUG(AQH_LOGDOMAIN, " - endpoint %s accepts message", GWEN_MsgEndpoint_GetName(ep));
|
||||
GWEN_MsgEndpoint_ProcessOutMessage(ep, GWEN_Msg_dup(msg));
|
||||
}
|
||||
acceptedGroupIds=GWEN_MsgEndpoint_GetAcceptedGroupIds(ep);
|
||||
acceptedMsgGroups=AQH_NodeEndpoint_GetAcceptedMsgGroups(ep);
|
||||
|
||||
DBG_DEBUG(AQH_LOGDOMAIN, "- checking endpoint %s (msgGroup=%08x, accept: %08x, flags: %08x)",
|
||||
GWEN_MsgEndpoint_GetName(ep),
|
||||
msgGroup, acceptedMsgGroups,
|
||||
GWEN_MsgEndpoint_GetFlags(ep));
|
||||
if (acceptedGroupIds & groupId) {
|
||||
if ((msgGroup & acceptedMsgGroups)) {
|
||||
/* endpoint accepts this message */
|
||||
DBG_DEBUG(AQH_LOGDOMAIN, " - endpoint %s accepts message", GWEN_MsgEndpoint_GetName(ep));
|
||||
GWEN_MsgEndpoint_ProcessOutMessage(ep, GWEN_Msg_dup(msg));
|
||||
}
|
||||
else {
|
||||
DBG_DEBUG(AQH_LOGDOMAIN, " - endpoint %s does not accept message", GWEN_MsgEndpoint_GetName(ep));
|
||||
}
|
||||
} /* if (acceptedGroupIds & groupId) */
|
||||
else {
|
||||
DBG_DEBUG(AQH_LOGDOMAIN, "Endpoint %s does not contain groupId %d (%d)",
|
||||
GWEN_MsgEndpoint_GetName(ep), groupId, acceptedGroupIds);
|
||||
}
|
||||
} /* !(GWEN_MsgEndpoint_GetFlags(ep) & AQH_MSGEP_NODE_FLAGS_NOMESSAGES) */
|
||||
else {
|
||||
DBG_DEBUG(AQH_LOGDOMAIN, " - endpoint %s does not accept message", GWEN_MsgEndpoint_GetName(ep));
|
||||
DBG_DEBUG(AQH_LOGDOMAIN, "Not checking endpoint %s (NOMSG set)", epTypeName);
|
||||
}
|
||||
} /* if (srcGroupId & groupId) */
|
||||
} /* if wantedTypeName matches */
|
||||
else {
|
||||
DBG_DEBUG(AQH_LOGDOMAIN, "Endpoint does not contain groupId %d (%02x)", groupId, groupId);
|
||||
DBG_DEBUG(AQH_LOGDOMAIN, "Endpoint %s doesn't match", epTypeName);
|
||||
}
|
||||
} /* if (ep!=srcEp) */
|
||||
ep=GWEN_MsgEndpoint_List_Next(ep);
|
||||
|
||||
Reference in New Issue
Block a user