Skip to content

Commit

Permalink
Feat:WebPA Sync Notification handling during Factory reset cloud sync
Browse files Browse the repository at this point in the history
  • Loading branch information
nlrcomcast committed Nov 12, 2024
1 parent 039fa62 commit 2561c27
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ jobs:
- name: Make Build Directory
run: mkdir build

- name: Get Sonarcloud Binaries
uses: xmidt-org/sonarcloud-installer-action@v1
with:
working-directory: build
#- name: Get Sonarcloud Binaries
#uses: xmidt-org/sonarcloud-installer-action@v1
# with:
# working-directory: build

- name: Get rtrouted Binary
working-directory: build
Expand All @@ -64,7 +64,7 @@ jobs:
mkdir _install
mkdir _install/lib
cp ${RBUS_INSTALL_DIR}/usr/lib/librbus* _install/lib
build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make all test
build-wrapper-linux-x86-64 --out-dir bw-output make all test
# ARGS=-VV make test # use this version for debugging

Expand Down
2 changes: 2 additions & 0 deletions source/broadband/include/webpa_notification.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,5 @@ WDMP_STATUS validate_webpa_notification_data(char *notify_param_name, char *writ

pthread_cond_t *get_global_sync_condition(void);
pthread_mutex_t *get_global_sync_mutex(void);

void FR_CloudSyncCheck();
8 changes: 7 additions & 1 deletion source/broadband/webpa_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void processRequest(char *reqPayload,char *transactionId, char **resPayload, hea
char *dbCID = NULL;
char *dbCMC = NULL;
char newCMC[32]={'\0'};

static int testing = 1;
WalPrint("************** processRequest *****************\n");

wdmp_parse_request(reqPayload,&reqObj);
Expand Down Expand Up @@ -324,6 +324,12 @@ void processRequest(char *reqPayload,char *transactionId, char **resPayload, hea

case TEST_AND_SET:
{
if(testing == 1)
{
testing =0;
WalInfo("Sleeping 30sec before processing TEST_AND_SET\n");
sleep(30);
}
WalPrint("Request:> ParamCount = %zu\n",reqObj->u.testSetReq->paramCnt);
resObj->paramCnt = reqObj->u.testSetReq->paramCnt;
WalPrint("Response:> paramCnt = %zu\n", resObj->paramCnt);
Expand Down
39 changes: 39 additions & 0 deletions source/broadband/webpa_notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,12 +1041,50 @@ static void addNotifyMsgToQueue(NotifyData *notifyData)
WalPrint("*****Returned from addNotifyMsgToQueue*****\n");
}

/*
* @brief To handle sync notifications during factory reset
*/
void FR_CloudSyncCheck()
{
char *dbCID = NULL;
int factory_reset_flag = flase;
for(int i=1;i<=12;i++)
{
dbCID = getParameterValue(PARAM_CID);
if(dbCID == NULL)
{
WalError("Unable to get dbCID value in handleNotificationEvents\n");
sleep(5);
}
else if (dbCID != NULL && strcmp(dbCID, "0") == 0) //To check wheter the devie is up after factory reset
{
WalInfo("factory reset cloud sync is in progress, wait 5sec for process nitification\n");
factory_reset_flag = true;
sleep(5);
}
else
{
break;
}
WAL_FREE(dbCID);
}
if(factory_reset_flag == true)
{
WalInfo("factory reset cloud sync is done, processing NotificationEvents\n");
}
if(dbCID != NULL && (strcmp(dbCID, "0") == 0) && factory_reset_flag == true)
{
WalError("factory reset sync is failed after 60sec, proceding NotificationEvents without cloud sysnc\n");
}
WAL_FREE(dbCID);
}

/*
* @brief To monitor notification events in Notification queue
*/
static void handleNotificationEvents()
{
FR_CloudSyncCheck();
while(1)
{
pthread_mutex_lock (&mut);
Expand Down Expand Up @@ -1281,6 +1319,7 @@ void processNotification(NotifyData *notifyData)
free(dest);
return;
}
WalInfo("Parameter name: %s\n",notifyData->u.notify->paramName);
cJSON_AddNumberToObject(notifyPayload, "cmc", cmc);
cJSON_AddStringToObject(notifyPayload, "cid", cid);
OnboardLog("%s/%d/%s\n",dest,cmc,cid);
Expand Down

0 comments on commit 2561c27

Please sign in to comment.