Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/commonlib/telemetry_busmessage_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const char destCompPath[64] = "/com/cisco/spvtg/ccsp/pam";


#define EVENT_ERROR(format, ...) \
fprintf(stderr, "T2ERROR:%s %s:%d: ", __func__ , __FILE__, __LINE__ ); \
fprintf(stderr, "T2INFO:%s %s:%d: ", __func__ , __FILE__, __LINE__ ); \
fprintf(stderr, (format), ##__VA_ARGS__ ); \
fprintf(stderr, "\n" );
Comment on lines 29 to 32
Comment on lines 29 to 32

Expand Down
22 changes: 18 additions & 4 deletions source/commonlib/telemetry_busmessage_sender.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static void rBusInterface_Uninit( )

static T2ERROR initMessageBus( )
{
// EVENT_DEBUG("%s ++in\n", __FUNCTION__);
EVENT_ERROR("%s ++in\n", __FUNCTION__);
T2ERROR status = T2ERROR_SUCCESS;
Comment on lines 205 to 208
Comment on lines 205 to 208
char* component_id = (char*)CCSP_FIXED_COMP_ID;
#if defined(CCSP_SUPPORT_ENABLED)
Expand Down Expand Up @@ -248,7 +248,7 @@ static T2ERROR initMessageBus( )
}
}
#endif // CCSP_SUPPORT_ENABLED
// EVENT_DEBUG("%s --out\n", __FUNCTION__);
EVENT_ERROR("%s --out\n", __FUNCTION__);
return status;
Comment on lines 249 to 252
}
Comment on lines +251 to 253

Expand Down Expand Up @@ -440,6 +440,7 @@ int filtered_event_send(const char* data, const char *markerName)
rbusError_t ret = RBUS_ERROR_SUCCESS;
int status = 0 ;
EVENT_DEBUG("%s ++in\n", __FUNCTION__);
EVENT_ERROR("%s ++in\n", __FUNCTION__);
if(!bus_handle)
Comment on lines 442 to 444
{
Comment on lines 442 to 445
EVENT_ERROR("bus_handle is null .. exiting !!! \n");
Expand Down Expand Up @@ -530,6 +531,7 @@ int filtered_event_send(const char* data, const char *markerName)
}
#endif // CCSP_SUPPORT_ENABLED
EVENT_DEBUG("%s --out with status %d \n", __FUNCTION__, status);
EVENT_ERROR("%s --out with status %d \n", __FUNCTION__, status);
return status;
}
Comment on lines 533 to 536
Comment on lines 533 to 536

Expand Down Expand Up @@ -560,6 +562,7 @@ static T2ERROR doPopulateEventMarkerList( )

snprintf(deNameSpace[0], 124, "%s%s%s", T2_ROOT_PARAMETER, componentName, T2_EVENT_LIST_PARAM_SUFFIX);
EVENT_DEBUG("rbus mode : Query marker list with data element = %s \n", deNameSpace[0]);
EVENT_ERROR("rbus mode : Query marker list with data element = %s \n", deNameSpace[0]);

Comment on lines 563 to 566
pthread_mutex_lock(&markerListMutex);
Comment on lines 563 to 567
EVENT_DEBUG("Lock markerListMutex & Clean up eventMarkerMap \n");
Expand Down Expand Up @@ -596,6 +599,7 @@ static T2ERROR doPopulateEventMarkerList( )
eventMarkerMap = hash_map_create();
rbusProperty_t rbusPropertyList = rbusObject_GetProperties(objectValue);
EVENT_DEBUG("\t rbus mode : Update event map for component %s with below events : \n", componentName);
EVENT_ERROR("\t rbus mode : Update event map for component %s with below events : \n", componentName);
while(NULL != rbusPropertyList)
Comment on lines 600 to 603
{
Comment on lines 599 to 604
const char* eventname = rbusProperty_GetName(rbusPropertyList);
Expand Down Expand Up @@ -668,6 +672,7 @@ static bool isCachingRequired( )
rbusError_t retVal = RBUS_ERROR_SUCCESS;

retVal = rbus_getUint(bus_handle, T2_OPERATIONAL_STATUS, &t2ReadyStatus);
EVENT_ERROR("Retrieved T2 Operational status: %d\n", t2ReadyStatus);

if(retVal != RBUS_ERROR_SUCCESS)
{
Expand Down Expand Up @@ -741,7 +746,7 @@ static int report_or_cache_data(char* telemetry_data, const char* markerName)

if(isT2Ready)
{
// EVENT_DEBUG("T2: Sending event : %s\n", telemetry_data);
EVENT_ERROR("T2: Sending event : %s\n", telemetry_data);
ret = filtered_event_send(telemetry_data, markerName);
Comment on lines 747 to 750
Comment on lines +749 to 750
if(0 != ret)
{
Expand All @@ -757,6 +762,16 @@ static int report_or_cache_data(char* telemetry_data, const char* markerName)
void t2_init(char *component)
{
componentName = strdup(component);
initMutex();

if(initMessageBus() != T2ERROR_SUCCESS)
{
EVENT_ERROR("%s:%d, T2:initMessageBus failed in t2_init, will retry during event send\n", __func__, __LINE__);
}
else
{
isRFCT2Enable = true;
}
}
Comment on lines 762 to 775
Comment on lines 762 to 775
Comment on lines 762 to 775

void t2_uninit(void)
Expand Down Expand Up @@ -787,7 +802,6 @@ T2ERROR t2_event_s(const char* marker, const char* value)
EVENT_DEBUG("%s:%d, T2:component with pid = %d is trying to send event %s with value %s without component name \n", __func__, __LINE__, (int) getpid(), marker, value);
return T2ERROR_COMPONENT_NULL;
}
initMutex();
pthread_mutex_lock(&sMutex);
if ( NULL == marker || NULL == value)
{
Expand Down