Skip to content

Commit

Permalink
RDK-55945: sync code base to Stable2 Fix Coverity Issues
Browse files Browse the repository at this point in the history
Reason for change: Fix Build Issue
Test Procedure: L1/L2 test and no change in functionality
Risks: Low
Signed-off-by: c.shivabhaskar97@gmail.com
  • Loading branch information
shivabhaskar committed Feb 24, 2025
1 parent 5cc82ef commit b40afa3
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 19 deletions.
3 changes: 3 additions & 0 deletions include/telemetry2_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ extern "C" {
#define PRIVACYMODES_RFC "Device.X_RDKCENTRAL-COM_Privacy.PrivacyMode"
#define T2_ON_DEMAND_REPORT "Device.X_RDKCENTRAL-COM_T2.UploadDCMReport"
#define T2_ABORT_ON_DEMAND_REPORT "Device.X_RDKCENTRAL-COM_T2.AbortDCMReport"

#ifdef DCMAGENT
/* DCM Rbus Events */
#define T2_EVENT_DCM_SETCONF "Device.DCM.Setconfig"
#define T2_EVENT_DCM_PROCCONF "Device.DCM.Processconfig"
#define T2_DCM_RELOAD_EVENT "Device.X_RDKCENTREL-COM.Reloadconfig"
#define T2_DCM_SET_CONFIG "dcmSetConfig"
#define T2_DCM_START_CONFIG "dcmStartConfig"
#endif

#define INFINITE_TIMEOUT (unsigned int)~0

Expand Down
2 changes: 2 additions & 0 deletions source/bulkdata/reportprofiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ T2ERROR initReportProfiles()
cfgReadyFlag = fopen(T2_CONFIG_READY, "w+");
if(cfgReadyFlag)
fclose(cfgReadyFlag);
setT2EventReceiveState(T2_STATE_CONFIG_READY);
T2Info("T2 is now Ready to be configured for report profiles\n");
getMarkerCompRbusSub(true);
}
T2ER_StartDispatchThread();
Expand Down
5 changes: 4 additions & 1 deletion source/ccspinterface/busInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ T2ERROR registerForTelemetryEvents(TelemetryEventCallback eventCB)
if (isRbus)
{
ret = registerRbusT2EventListener(eventCB);
/* Register DCM Events */

#ifdef DCMAGENT
/* Register DCM Events */
ret = registerRbusDCMEventListener();
#endif

}
#if defined(CCSP_SUPPORT_ENABLED)
Expand Down
2 changes: 2 additions & 0 deletions source/ccspinterface/busInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ T2ERROR regDEforProfileDataModel(callBackHandlers* cbHandlers);

T2ERROR publishEventsProfileUpdates() ;

#ifdef DCMAGENT
/* DCM RBus event Publish functions */
T2ERROR publishEventsDCMSetConf(char *confPath);

T2ERROR publishEventsDCMProcConf();

int getRbusDCMEventStatus();
#endif

T2ERROR busUninit() ;

Expand Down
12 changes: 9 additions & 3 deletions source/ccspinterface/rbusInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ static uint32_t t2ReadyStatus = T2_STATE_NOT_READY;;
static char* reportProfileVal = NULL ;
static char* tmpReportProfileVal = NULL ;
static char* reportProfilemsgPckVal = NULL ;
#ifdef DCMAGENT
static bool dcmEventStatus = false;
#endif
uint32_t t2MemUsage = 0;

static pthread_mutex_t asyncMutex = PTHREAD_MUTEX_INITIALIZER;
Expand Down Expand Up @@ -625,8 +627,10 @@ rbusError_t t2PropertyDataGetHandler(rbusHandle_t handle, rbusProperty_t propert
#endif
else {
// START : Extract component name requesting for event marker list
pthread_mutex_lock(&compParamMap);
if(compTr181ParamMap != NULL)
componentName = (char*) hash_map_get(compTr181ParamMap, propertyName);
pthread_mutex_unlock(&compParamMap); // This needs rework

if(componentName) {
T2Debug("Component name = %s \n", componentName);
Expand Down Expand Up @@ -836,6 +840,7 @@ static rbusError_t dcmOnDemandMethodHandler(rbusHandle_t handle, char const* met
return RBUS_ERROR_ASYNC_RESPONSE ;
}

#ifdef DCMAGENT
static void rbusReloadConf(rbusHandle_t handle,
rbusEvent_t const* event,
rbusEventSubscription_t* subscription)
Expand Down Expand Up @@ -998,7 +1003,7 @@ T2ERROR publishEventsDCMProcConf()
T2Debug("%s --out\n", __FUNCTION__);
return status;
}

#endif


T2ERROR registerRbusT2EventListener(TelemetryEventCallback eventCB)
Expand Down Expand Up @@ -1137,14 +1142,15 @@ void unregisterDEforCompEventList(){
return ;
}

pthread_mutex_lock(&compParamMap);

if(!compTr181ParamMap) {
T2Info("No data elements present to unregister");
T2Debug("%s --out\n", __FUNCTION__);
pthread_mutex_unlock(&compParamMap);
return;
}

pthread_mutex_lock(&compParamMap);

count = hash_map_count(compTr181ParamMap);
T2Debug("compTr181ParamMap has %d components registered \n", count);
if(count > 0) {
Expand Down
2 changes: 2 additions & 0 deletions source/ccspinterface/rbusInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ Vector* getRbusProfileParamValues(Vector *paramList);

T2ERROR registerRbusT2EventListener(TelemetryEventCallback eventCB);

#ifdef DCMAGENT
T2ERROR registerRbusDCMEventListener();
#endif

T2ERROR unregisterRbusT2EventListener();

Expand Down
42 changes: 27 additions & 15 deletions source/xconf-client/xconfclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,14 @@ static const int MAX_URL_ARG_LEN = 128;
static int xConfRetryCount = 0;
static bool stopFetchRemoteConfiguration = false;
static bool isXconfInit = false ;

#ifdef DCMAGENT
static bool bNotifyDCM = false;
static bool bexitDCMThread = true;
static pthread_t dcmThread;
#endif

static pthread_t xcrThread;
static pthread_t dcmThread;
static pthread_mutex_t xcMutex;
static pthread_mutex_t xcThreadMutex;
static pthread_cond_t xcCond;
Expand Down Expand Up @@ -969,8 +972,10 @@ static void* getUpdatedConfigurationThread(void *data)
if(fp)
fclose(fp);

#ifdef DCMAGENT
T2Info("Set DCM flag for sending events\n");
bNotifyDCM = true;
bNotifyDCM = true;
#endif

}
if(configData != NULL) {
Expand Down Expand Up @@ -1062,25 +1067,29 @@ void uninitXConfClient()
{
T2Debug("XConfClientThread is stopped already\n");
}
pthread_mutex_lock(&xcThreadMutex);
isXconfInit = false;
pthread_cond_signal(&xcThreadCond);
pthread_mutex_unlock(&xcThreadMutex);
pthread_join(xcrThread, NULL);
pthread_mutex_destroy(&xcMutex);
pthread_mutex_destroy(&xcThreadMutex);
pthread_cond_destroy(&xcCond);
pthread_cond_destroy(&xcThreadCond);
bexitDCMThread = false;
pthread_join(dcmThread, NULL);
if(isXconfInit){
pthread_mutex_lock(&xcThreadMutex);
isXconfInit = false;
pthread_cond_signal(&xcThreadCond);
pthread_mutex_unlock(&xcThreadMutex);
pthread_join(xcrThread, NULL);
pthread_mutex_destroy(&xcMutex);
pthread_mutex_destroy(&xcThreadMutex);
pthread_cond_destroy(&xcCond);
pthread_cond_destroy(&xcThreadCond);
#ifdef DCMAGENT
bexitDCMThread = false;
pthread_join(dcmThread, NULL);
#endif
#ifdef LIBRDKCERTSEL_BUILD
xcCertSelectorFree();
xcCertSelectorFree();
#endif
}
T2Debug("%s --out\n", __FUNCTION__);
T2Info("Uninit XConf Client Successful\n");
}


#ifdef DCMAGENT
static void* nofifyDCMThread(void *data)
{
(void) data; //To avoid compiler warning and use the pthread signature
Expand Down Expand Up @@ -1121,11 +1130,14 @@ T2ERROR startDCMClient()
T2Debug("%s --out\n", __FUNCTION__);
return T2ERROR_SUCCESS;
}
#endif

T2ERROR initXConfClient()
{
T2Debug("%s ++in\n", __FUNCTION__);
#ifdef DCMAGENT
startDCMClient();
#endif
pthread_mutex_init(&xcMutex, NULL);
pthread_mutex_init(&xcThreadMutex, NULL);
pthread_cond_init(&xcCond, NULL);
Expand Down
28 changes: 28 additions & 0 deletions telemetry2_0.path
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
##########################################################################
# If not stated otherwise in this file or this component's LICENSE
# file the following copyright and licenses apply:
#
# Copyright 2016 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##########################################################################
[Unit]
Description=Start Telemetry2_0
OnFailure=path-fail-notifier@%n.service

[Path]
PathExists=/tmp/enable_t2_service
Unit=telemetry2_0.service

[Install]
WantedBy=multi-user.target

0 comments on commit b40afa3

Please sign in to comment.