Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Add new RBUS event for cloud_conn_online to retry webpa sync notifications" #462

Merged
merged 1 commit into from
Dec 20, 2024
Merged
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
5 changes: 0 additions & 5 deletions src/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,11 +840,6 @@ int createNopollConnection(noPollCtx *ctx, server_list_t *server_list)
ParodusInfo("cloud_status set as %s after successful connection\n", get_cloud_status());
if(!connection_init)
{
#ifdef ENABLE_WEBCFGBIN
//Sending cloud connection online event only during reconnect
ParodusInfo("Sending cloud connection online event after reconnection\n");
SendConnOnlineEvent();
#endif
int chk_ret = creat("/tmp/webpanotifyready",S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (chk_ret == -1)
{
Expand Down
1 change: 0 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ int main( int argc, char **argv)
registerRbusLogger();
subscribeRBUSevent();
regXmidtSendDataMethod();
regConnOnlineEvent();
#endif
setDefaultValuesToCfg(cfg);
if (0 != parseCommandLine(argc,argv,cfg)) {
Expand Down
9 changes: 1 addition & 8 deletions src/upstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@

#include <pthread.h>
#include <wrp-c.h>
#ifdef ENABLE_WEBCFGBIN
#include <rbus.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -46,11 +43,7 @@ typedef struct UpStreamMsg__
/*----------------------------------------------------------------------------*/
/* Function Prototypes */
/*----------------------------------------------------------------------------*/
#ifdef ENABLE_WEBCFGBIN
int regConnOnlineEvent();
rbusError_t SendConnOnlineEvent();
rbusError_t CloudConnSubscribeHandler(rbusHandle_t handle, rbusEventSubAction_t action, const char* eventName, rbusFilter_t filter, int32_t interval, bool* autoPublish);
#endif

void packMetaData();
void *handle_upstream();
void *processUpstreamMessage();
Expand Down
88 changes: 0 additions & 88 deletions src/upstream_rbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@
#include "heartBeat.h"

#define WEBCFG_UPSTREAM_EVENT "Webconfig.Upstream"
#define CLOUD_CONN_ONLINE "cloud_conn_online_event"
#ifdef WAN_FAILOVER_SUPPORTED
#define WEBPA_INTERFACE "Device.X_RDK_WanManager.CurrentActiveInterface"
#endif

int cloud_online_subscribe = 0;

rbusHandle_t rbus_Handle;
rbusError_t err;

Expand Down Expand Up @@ -244,88 +241,3 @@ void eventReceiveHandler( rbusHandle_t rbus_Handle, rbusEvent_t const* event, rb
}
}
#endif

rbusError_t SendConnOnlineEvent()
{
rbusError_t rc = RBUS_ERROR_BUS_ERROR;
if(cloud_online_subscribe)
{
rbusEvent_t event = {0};
rbusObject_t data;
rbusValue_t value;

ParodusInfo("publishing cloud connection online Event\n");

rbusValue_Init(&value);
rbusValue_SetInt32(value, 1);

rbusObject_Init(&data, NULL);
rbusObject_SetValue(data, "value", value);

event.name = CLOUD_CONN_ONLINE;
event.data = data;
event.type = RBUS_EVENT_GENERAL;

rc = rbusEvent_Publish(rbus_Handle, &event);

rbusValue_Release(value);
rbusObject_Release(data);

if(rc != RBUS_ERROR_SUCCESS)
ParodusError("provider: rbusEvent_Publish cloud connection online event failed: %d\n", rc);
}
return rc;
}


rbusError_t CloudConnSubscribeHandler(rbusHandle_t handle, rbusEventSubAction_t action, const char* eventName, rbusFilter_t filter, int32_t interval, bool* autoPublish)
{
(void)handle;
(void)filter;
(void)autoPublish;
(void)interval;

if(eventName == NULL)
{
ParodusError("CloudConnSubscribeHandler: event name is NULL\n");
return RBUS_ERROR_INVALID_INPUT;
}

ParodusInfo("CloudConnSubscribeHandler: action=%s eventName=%s\n", action == RBUS_EVENT_ACTION_SUBSCRIBE ? "subscribe" : "unsubscribe", eventName);

if(!strcmp(CLOUD_CONN_ONLINE, eventName))
{
cloud_online_subscribe = action == RBUS_EVENT_ACTION_SUBSCRIBE ? 1 : 0;
}
else
{
ParodusError("provider: CloudConnSubscribeHandler unexpected eventName %s\n", eventName);
}

return RBUS_ERROR_SUCCESS;
}


int regConnOnlineEvent()
{
rbusError_t ret = RBUS_ERROR_SUCCESS;
rbusDataElement_t SyncRetryElements[1] = {{CLOUD_CONN_ONLINE, RBUS_ELEMENT_TYPE_EVENT, {NULL, NULL, NULL, NULL, CloudConnSubscribeHandler, NULL}}};

ParodusInfo("Registering rbus event %s\n", CLOUD_CONN_ONLINE);
if(!rbus_Handle)
{
ParodusError("regConnOnlineEvent failed as rbus_handle is empty\n");
return -1;
}
ret = rbus_regDataElements(rbus_Handle, 1, SyncRetryElements);
if(ret == RBUS_ERROR_SUCCESS)
{
ParodusInfo("Registered cloud connection online event\n");
}
else
{
ParodusError("Failed to register cloud connection online event %d\n", ret);
}
return ret;
}

13 changes: 0 additions & 13 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -275,19 +275,6 @@ target_link_libraries (test_upstream_sock -lcmocka gcov -lcunit -lcimplog
-lwrp-c -luuid -lpthread -lmsgpackc -lnopoll -lnanomsg
-Wl,--no-as-needed -lcjson -lcjwt -ltrower-base64
-lssl -lcrypto -lrt -lm)

#-------------------------------------------------------------------------------
# test_upstream_rbus
#-------------------------------------------------------------------------------
if(ENABLE_WEBCFGBIN)
add_test(NAME test_upstream_rbus COMMAND ${MEMORY_CHECK} ./test_upstream_rbus)
add_executable(test_upstream_rbus test_upstream_rbus.c ../src/upstream_rbus.c)
target_link_libraries (test_upstream_rbus -lcmocka gcov -lcunit -lcimplog
-lwrp-c -luuid -lpthread -lmsgpackc -lnopoll
-Wl,--no-as-needed -lcjson -lcjwt -ltrower-base64
-lssl -lcrypto -lrt -lm -lnanomsg -lrbus)
endif(ENABLE_WEBCFGBIN)


#-------------------------------------------------------------------------------
# test_downstream
Expand Down
9 changes: 0 additions & 9 deletions tests/test_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
#include <assert.h>
#include <nopoll.h>
#include <pthread.h>
#ifdef ENABLE_WEBCFGBIN
#include <rbus.h>
#endif

#include "../src/ParodusInternal.h"
#include "../src/connection.h"
Expand Down Expand Up @@ -220,12 +217,6 @@ void setMessageHandlers()
{
}

#ifdef ENABLE_WEBCFGBIN
rbusError_t SendConnOnlineEvent()
{
return;
}
#endif
int allow_insecure_conn (char **server_addr, unsigned int *port)
{
int rtn;
Expand Down
165 changes: 0 additions & 165 deletions tests/test_upstream_rbus.c

This file was deleted.

Loading