diff --git a/cov_build.sh b/cov_build.sh index 0cee692d..29e0e423 100644 --- a/cov_build.sh +++ b/cov_build.sh @@ -40,10 +40,6 @@ 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 @@ -51,7 +47,7 @@ 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 @@ -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 diff --git a/src/rrdInterface.c b/src/rrdInterface.c index 43446d3c..27be9cc9 100644 --- a/src/rrdInterface.c +++ b/src/rrdInterface.c @@ -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 @@ -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; diff --git a/src/rrdMain.c b/src/rrdMain.c index 61fce922..d13ac97d 100644 --- a/src/rrdMain.c +++ b/src/rrdMain.c @@ -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 @@ -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, ¶m); - 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; } @@ -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) @@ -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); } diff --git a/src/rrdMain.h b/src/rrdMain.h index 8a6c7f4c..d4f9a4dd 100644 --- a/src/rrdMain.h +++ b/src/rrdMain.h @@ -32,7 +32,6 @@ extern "C" #ifdef IARMBUS_SUPPORT #include "rfcapi.h" #else -#include "syscfg/syscfg.h" #endif #endif