From 32125efcf57a8ccf7f7a3e439b5b1d63e4bf368b Mon Sep 17 00:00:00 2001 From: kpl Date: Sat, 4 May 2013 23:52:56 -0700 Subject: [PATCH] cmRtSys.h/c,cmUiRTSysMstr.c:Allow access to cmRtNetH_t via cmRtSys. --- cmRtSys.c | 21 +++++++++++++++++++-- cmRtSys.h | 2 +- cmUiRtSysMstr.c | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/cmRtSys.c b/cmRtSys.c index 27b03e2..425168d 100644 --- a/cmRtSys.c +++ b/cmRtSys.c @@ -29,7 +29,7 @@ typedef enum kDisableCbCmdId } kRtCmdId_t; -cmRtSysH_t cmRtSysNullHandle = { NULL }; +cmRtSysH_t cmRtSysNullHandle = cmSTATIC_NULL_HANDLE; struct cmRt_str; @@ -961,7 +961,7 @@ cmRtRC_t cmRtSysCfg( cmRtSysH_t h, const cmRtSysSubSys_t* ss, unsigned rtSubIdx for(j=0; jendptCnt; ++j) { cmRtSysNetEndpt_t* ep = ss->endptArray + j; - if( cmRtNetRegisterEndPoint( cp->netH, ep->label, ep->id ) != kOkNetRC ) + if( cmRtNetRegisterEndPoint( cp->netH, cp->ctx.rtSubIdx, ep->label, ep->id ) != kOkNetRC ) { rc = _cmRtError(p,kNetErrRtRC,"Network end point allocation failed on label:%s id:%i.",cmStringNullGuard(ep->label),ep->id); goto errLabel; @@ -1280,6 +1280,23 @@ cmRtRC_t cmRtSysNetReport( cmRtSysH_t h ) } +cmRtRC_t cmRtSysNetGetHandle( cmRtSysH_t h, unsigned rtSubIdx, cmRtNetH_t* hp ) +{ + cmRtRC_t rc = kOkRtRC; + cmRt_t* p = _cmRtHandleToPtr(h); + + assert( rtSubIdx < p->ssCnt ); + + if( rtSubIdx < p->ssCnt ) + { + *hp = p->ssArray[rtSubIdx].netH; + return rc; + } + + return cmErrMsg(&p->err,kInvalidArgRtRC,"The rtSubIdx %i is out of range %i.",rtSubIdx,p->ssCnt); +} + + //=========================================================================================================================== // diff --git a/cmRtSys.h b/cmRtSys.h index de1231c..048e25f 100644 --- a/cmRtSys.h +++ b/cmRtSys.h @@ -322,7 +322,7 @@ extern "C" { bool cmRtSysNetIsInitialized( cmRtSysH_t h ); cmRtRC_t cmRtSysNetDoSync( cmRtSysH_t h ); cmRtRC_t cmRtSysNetReport( cmRtSysH_t h ); - + cmRtRC_t cmRtSysNetGetHandle( cmRtSysH_t h, unsigned rtSubIdx, cmRtNetH_t* hp ); #ifdef __cplusplus diff --git a/cmUiRtSysMstr.c b/cmUiRtSysMstr.c index 8a214bc..c3071fc 100644 --- a/cmUiRtSysMstr.c +++ b/cmUiRtSysMstr.c @@ -9,6 +9,7 @@ #include "cmThread.h" #include "cmUdpPort.h" #include "cmRtSysMsg.h" +#include "cmRtNet.h" #include "cmRtSys.h" #include "cmUiDrvr.h" #include "cmUi.h"