Skip to content
This repository has been archived by the owner on Jan 26, 2023. It is now read-only.

Commit

Permalink
RDKC-6801: Camera not reading the even cfg
Browse files Browse the repository at this point in the history
Reason for change: to read event quiet interval from right configuration file
Test Procedure: test cvr and motion detection
Risks:
Signed-off-by:asivan001c <[email protected]>
Signed-off-by: asivan <[email protected]>

(cherry picked from commit af2b4aaa3943e27c2be68fedc6727c833c3ca92c)
Change-Id: I52527e0400c4192447c15a483debbd970072a06e
  • Loading branch information
asivan authored and rdkcmf-scm-jenkins2 committed Apr 7, 2020
1 parent c096fbe commit 2d1888d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions smart_thumbnail_cvr_lite/include/smart_thumbnail.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ class SmartThumbnail
~SmartThumbnail();
STH_STATUS getTnUploadConf();
STH_STATUS getEventConf();
//to update the event quiet interval
int getQuietInterval();
//sets the camera firmware version.
int setCameraImageName(char* out);
//sets the camera firmware version.
Expand Down
58 changes: 58 additions & 0 deletions smart_thumbnail_cvr_lite/smart_thumbnail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,60 @@ STH_STATUS SmartThumbnail::getEventConf()
return STH_SUCCESS;
}

/** @description: retrieve event quiet interval
* @param[in] : void
* @return: event quiet interval
*/
int SmartThumbnail::getQuietInterval()
{
int quiet_interval =smartThInst -> event_quiet_time;
events_provision_info_t *eventsCfg = NULL;

// Allocate memory for event config
eventsCfg = (events_provision_info_t*) malloc(sizeof(events_provision_info_t));

if (NULL == eventsCfg) {
RDK_LOG(RDK_LOG_ERROR,"LOG.RDK.SMARTTHUMBNAIL","%s(%d): Error allocating memory. Use existing quiet interval %d\n", __FILE__, __LINE__, quiet_interval);
return quiet_interval;
}

if (STH_SUCCESS != polling_config_init()) {
RDK_LOG(RDK_LOG_ERROR,"LOG.RDK.SMARTTHUMBNAIL","%s(%d): Error initializing polling config. Use existing quiet interval %d\n", __FILE__, __LINE__, quiet_interval);
if (eventsCfg) {
free(eventsCfg);
}
return quiet_interval;
}

if (STH_SUCCESS != readEventConfig(eventsCfg)) {
RDK_LOG(RDK_LOG_ERROR,"LOG.RDK.SMARTTHUMBNAIL","%s(%d): Error reading EVENTS Config. Use existing quiet interval %d\n", __FILE__, __LINE__, quiet_interval);
return quiet_interval;
}

// get event quiet interval
if (strlen(eventsCfg->quite_interval) > 0) {
quiet_interval = atoi(eventsCfg->quite_interval);
}
else {
RDK_LOG(RDK_LOG_ERROR,"LOG.RDK.SMARTTHUMBNAIL","%s(%d): Invalid Quiet Interval. Use existing quiet interval %d\n", __FILE__, __LINE__, quiet_interval);
return quiet_interval;

}

if (smartThInst -> event_quiet_time != quiet_interval) {
RDK_LOG(RDK_LOG_INFO,"LOG.RDK.SMARTTHUMBNAIL","%s(%d): Retrieved New Quiet Interval: %d %d\n", __FILE__, __LINE__, smartThInst -> event_quiet_time, quiet_interval);
}

if (eventsCfg) {
free(eventsCfg);
eventsCfg = NULL;
}

polling_config_exit();

return quiet_interval;
}

/** @description: create the payload for smart thumbnail
* @param[in] : void
* @return: STH_SUCCESS on success, STH_ERROR otherwise
Expand All @@ -353,6 +407,10 @@ STH_STATUS SmartThumbnail::createPayload()
struct tm* tv = NULL;
struct timespec currTime;
#endif

// update the event quiet interval
smartThInst -> event_quiet_time = getQuietInterval();

{
//Acquire lock
std::unique_lock<std::mutex> lock(smartThInst -> QMutex);
Expand Down

0 comments on commit 2d1888d

Please sign in to comment.