Skip to content
8 changes: 2 additions & 6 deletions cov_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,14 @@ if [ ! -d iarmbus ]; then
git clone https://github.com/rdkcentral/iarmbus.git
fi

if [ ! -d tr69hostif ]; then
git clone https://github.com/rdkcentral/tr69hostif.git
fi

cd rfc
autoreconf -i
./configure --enable-rfctool=yes --enable-tr181set=yes
cd rfcapi
make librfcapi_la_CPPFLAGS="-I/usr/include/cjson -I/usr/rfc/rfcMgr/gtest/mocks"
make install
cd /usr/rfc/tr181api
g++ -fPIC -shared -o libtr181api.so tr181api.cpp -I/usr/local/include/wdmp-c
g++ -fPIC -shared -o libtr181api.so tr181api.cpp -I/usr/local/include/wdmp-c -L/usr/local/lib -lrfcapi
mv ./libtr181api.so /usr/local/lib
cp ./tr181api.h /usr/local/include

Expand All @@ -67,7 +63,7 @@ cp /usr/iarmbus/core/libIARMCore.h /usr/local/include
cp /usr/iarmmgrs/hal/include/pwrMgr.h /usr/local/include/

# Build and install stubs from tr69hostif

git clone https://github.com/rdkcentral/tr69hostif.git
cd tr69hostif
cd ./src/unittest/stubs
g++ -fPIC -shared -o libIARMBus.so iarm_stubs.cpp -I/usr/tr69hostif/src/hostif/parodusClient/pal -I/usr/tr69hostif/src/unittest/stubs -I/usr/tr69hostif/src/hostif/parodusClient/waldb -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/tr69hostif/src/hostif/include -I/usr/tr69hostif/src/hostif/profiles/DeviceInfo -I/usr/tr69hostif/src/hostif/parodusClient/pal -fpermissive
Expand Down
10 changes: 1 addition & 9 deletions src/rrdInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ key_t key = 1234;
#endif
#define RRD_TMP_DIR "/tmp/"
uint32_t gWebCfgBloBVersion = 0;
rbusHandle_t rrdRbusHandle;
extern rbusHandle_t rrdRbusHandle;

/*Function: RRD_subscribe
*Details: This helps to perform Bus init/connect and event handler registration for receiving
Expand All @@ -53,14 +53,6 @@ int RRD_subscribe()
return ret;
}
#endif
//RBUS Event Subscribe for RRD
ret = rbus_open(&rrdRbusHandle, REMOTE_DEBUGGER_RBUS_HANDLE_NAME);
if (ret != 0)
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: RBUS Open Failed!!! \n ", __FUNCTION__, __LINE__);
return ret;
}
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: SUCCESS: RBUS Open! \n", __FUNCTION__, __LINE__);
#if !defined(GTEST_ENABLE)
subscriptions[0].eventName = RRD_SET_ISSUE_EVENT;
subscriptions[0].filter = NULL;
Expand Down
64 changes: 34 additions & 30 deletions src/rrdMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

devicePropertiesData devPropData;

rbusHandle_t rrdRbusHandle;

/*
* @function RRDEventThreadFunc
* @brief Infinite thread created from the main function to read messages received from the TR181 parameter
Expand Down Expand Up @@ -86,37 +88,30 @@ void *RRDEventThreadFunc(void *arg)
*/
bool isRRDEnabled(void)
{
bool ret = true;
bool ret = false;
rbusError_t retCode = RBUS_ERROR_BUS_ERROR;
rbusValue_t value = NULL;
rbusValue_Init(&value);

#if !defined(GTEST_ENABLE)
#ifdef IARMBUS_SUPPORT
RFC_ParamData_t param;
WDMP_STATUS status = getRFCParameter("RDKRemoteDebugger", RRD_RFC, &param);
if(status == WDMP_SUCCESS || status == WDMP_ERR_DEFAULT_VALUE) {
RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]:getRFCParameter() name=%s,type=%d,value=%s\n", __FUNCTION__, __LINE__, param.name, param.type, param.value);
if (strcasecmp("false", param.value) == 0) {
ret = false;
}
}
else {
RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]:ERROR in getRFCParameter()\n", __FUNCTION__, __LINE__);
}
#else
char RRDValue[64]={'\0'};
if(0 == syscfg_init())
{
if( 0 == syscfg_get( NULL, "RemoteDebuggerEnabled", RRDValue, sizeof(RRDValue)))
RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]: syscfg_get RemoteDebuggerEnabled %s\n", __FUNCTION__, __LINE__, RRDValue);
if ((RRDValue[0] != '\0' && strncmp(RRDValue, "true", strlen("true")) == 0))
{
retCode = rbus_get(rrdRbusHandle, RRD_RFC, &value);
if ((retCode == RBUS_ERROR_SUCCESS) && (value != NULL))
{
RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"RemoteDebugger Status: = [%d]\n", rbusValue_GetBoolean(value));
ret = rbusValue_GetBoolean(value);
if(ret)
{
RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]:RFC is enabled, starting remote-debugger\n", __FUNCTION__, __LINE__);
ret = true;
}
else
{
ret = false;
}
}
#endif
}
else
{
RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]:RFC is disabled, stopping remote-debugger\n", __FUNCTION__, __LINE__);
}
}
else
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: rbus_get failed with error [%s]\n\n", __FUNCTION__, __LINE__,rbusError_ToString((rbusError_t)ret));
}
#endif
return ret;
}
Expand All @@ -136,6 +131,7 @@ int main(int argc, char *argv[])
#endif
{
pthread_t RRDTR69ThreadID;
rbusError_t ret = RBUS_ERROR_BUS_ERROR;

rdk_logger_init(DEBUG_INI_FILE);
#if !defined(GTEST_ENABLE)
Expand All @@ -145,10 +141,18 @@ int main(int argc, char *argv[])
/* Initialize Cache */
initCache();

//RBUS Event Subscribe for RRD
ret = rbus_open(&rrdRbusHandle, REMOTE_DEBUGGER_RBUS_HANDLE_NAME);
if (ret != 0)
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: RBUS Open Failed %s !!! \n ", __FUNCTION__, __LINE__, rbusError_ToString((rbusError_t)ret));
}
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: SUCCESS: RBUS Open! \n", __FUNCTION__, __LINE__);

/* Check RRD Enable RFC */
bool isEnabled = isRRDEnabled();
if(!isEnabled) {
RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]:RFC is disabled, stopping remote-debugger\n", __FUNCTION__, __LINE__);
RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]:Stopping RDK Remote Debugger Daemon \n", __FUNCTION__, __LINE__);
exit(0);
}

Expand Down
1 change: 0 additions & 1 deletion src/rrdMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ extern "C"
#ifdef IARMBUS_SUPPORT
#include "rfcapi.h"
#else
#include "syscfg/syscfg.h"
#endif
#endif

Expand Down
Loading