Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6339a50
RDKTV-31426:Post FR, the gdial-server crashes
apatel859 Jul 2, 2024
6058913
RDKTV-32530: Disable power control in gdialserver
apatel859 Jul 3, 2024
6ebd193
RDK-40531: Coverity issues within xDial
hgfell683 Oct 3, 2024
d3ac439
RDK-40531: Coverity issues within xDial
hgfell683 Oct 10, 2024
b5b807b
RDK-40531: Coverity issues within xDial
hgfell683 Oct 10, 2024
c72b098
RDK-40531: Coverity issues within xDial
hgfell683 Oct 14, 2024
33eeb19
Merge pull request #115 from hgfell683/xdial_coverity
apatel859 Oct 14, 2024
0811b24
RDK-52204: Convert GDial as Library
yuvaramachandran-gurusamy Aug 23, 2024
57a3860
RDK-52204: Rename main.c into gdialservice.cpp
yuvaramachandran-gurusamy Aug 27, 2024
365a5ed
RDK-52204: GDialService instance implementation
yuvaramachandran-gurusamy Aug 27, 2024
45a7bce
RDK-52204: GDialService instance implementation with unittest
yuvaramachandran-gurusamy Sep 13, 2024
70b926c
RDK-52204: fixed the crashed issue dueto double free() while stopping
yuvaramachandran-gurusamy Sep 23, 2024
07cda05
Merge remote-tracking branch 'rdkcentral-xdialserver/develop' into to…
yuvaramachandran-gurusamy Nov 26, 2024
61a7749
Merge pull request #118 from yuvaramachandran-gurusamy/topic/RDKE-306
apatel859 Nov 26, 2024
8991323
DELIA-66448 -RDKE Sync Up
hgfell683 Nov 12, 2024
e8b6b66
Merge pull request #119 from yuvaramachandran-gurusamy/topic/RDKE-306
apatel859 Nov 26, 2024
e3f69d2
RDKE-306: Added open source Licence requirement
apatel859 Oct 16, 2024
600a357
RDKE-306: Updated the ssdp default friendly and ModelName as Generic one
yuvaramachandran-gurusamy Dec 4, 2024
dc5a0a6
Merge pull request #120 from yuvaramachandran-gurusamy/topic/RDKE-306
apatel859 Dec 5, 2024
085773b
Merge pull request #1 from rdkcentral/develop
yuvaramachandran-gurusamy Dec 12, 2024
a6c68cd
RDK-52204: WPEFrameworkProtocols Library Change
yuvaramachandran-gurusamy Dec 12, 2024
90fb8af
Revert "RDK-52204: WPEFrameworkProtocols Library Change"
yuvaramachandran-gurusamy Dec 13, 2024
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 Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# If not stated otherwise in this file or this component's LICENSE
# file the following copyright and licenses apply:
#
# Copyright 2019 RDK Management
Expand Down
15 changes: 12 additions & 3 deletions server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# If not stated otherwise in this file or this component's LICENSE
# file the following copyright and licenses apply:
#
# Copyright 2019 RDK Management
Expand Down Expand Up @@ -73,7 +73,7 @@ set (GDIAL_EXEC_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/gdial-rest.c
${CMAKE_CURRENT_SOURCE_DIR}/gdial-ssdp.c
${CMAKE_CURRENT_SOURCE_DIR}/gdial-shield.c
${CMAKE_CURRENT_SOURCE_DIR}/main.c
${CMAKE_CURRENT_SOURCE_DIR}/gdialservice.cpp
)

link_directories (
Expand All @@ -82,7 +82,12 @@ link_directories (
${SOUP_LIBRARY_DIRS}
)

add_executable (gdial-server ${GDIAL_EXEC_SOURCE_FILES})
add_library(gdial-server SHARED ${GDIAL_EXEC_SOURCE_FILES})

set_target_properties(${MODULE_NAME} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED YES)
set_source_files_properties(gdialservice.cpp PROPERTIES COMPILE_FLAGS "-fpermissive")

target_link_libraries (gdial-server
${GLIB_LIBRARIES}
Expand All @@ -93,3 +98,7 @@ target_link_libraries (gdial-server
gdial-plat
uuid
)

add_executable (gdial-server-ut gdialserver_ut.cpp)

target_link_libraries (gdial-server-ut gdial-plat gdial-server)
43 changes: 31 additions & 12 deletions server/gdial-app.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2019 RDK Management
Expand All @@ -26,7 +26,7 @@
#include "gdial-util.h"
#include "gdial-plat-app.h"
#include "gdial-app.h"

#include "gdialservicelogging.h"

typedef struct _GDialAppPrivate {
gpointer state_cb_data;
Expand Down Expand Up @@ -81,7 +81,7 @@ static void gdial_app_dispose(GObject *gobject) {
}

application_instances_ = g_list_remove(application_instances_, gobject);
g_print("After dispose has %d app instances created\r\n", g_list_length(application_instances_));
GDIAL_LOGINFO("After dispose has %d app instances created", g_list_length(application_instances_));

G_OBJECT_CLASS (gdial_app_parent_class)->dispose (gobject);
}
Expand All @@ -91,6 +91,7 @@ static void gdial_plat_app_state_cb(gint instance_id, GDialAppState state, void
GDialApp *app = gdial_app_find_instance_by_instance_id(instance_id);
g_return_if_fail (app != NULL);
GDialAppPrivate *priv = gdial_app_get_instance_private(app);
GDIAL_LOGINFO("instance_id[%d] state[%x] data[%p]", instance_id, state, user_data);
g_signal_emit(app, gdial_app_signals[SIGNAL_STATE_CHANGED], 0, app, priv->state_cb_data);
}

Expand Down Expand Up @@ -171,7 +172,6 @@ static void gdial_app_class_init (GDialAppClass *klass) {
G_TYPE_NONE, 1, /* return type, arg num */
G_TYPE_POINTER); /* arg types */

gdial_plat_init(g_main_context_default());
gdial_plat_application_set_state_cb(gdial_plat_app_state_cb, NULL);
}

Expand Down Expand Up @@ -201,9 +201,11 @@ static int compare_versions(const char *version1, const char *version2) {
}

GDialApp *gdial_app_new(const gchar *app_name) {
GDialApp *app = (GDialApp*)g_object_new(GDIAL_TYPE_APP, GDIAL_APP_NAME, app_name, NULL);
g_print("After create has %d app %s instances created\r\n", g_list_length(application_instances_), app_name);
GDIAL_LOGTRACE("Entering ...");
GDialApp *app = (GDialApp*)g_object_new(GDIAL_TYPE_APP, GDIAL_APP_NAME, app_name, NULL);
GDIAL_LOGINFO("After create has %d app %s instances created", g_list_length(application_instances_), app_name);
gdial_app_refresh_additional_dial_data(app);
GDIAL_LOGTRACE("Exiting ...");
return app;
};

Expand Down Expand Up @@ -295,6 +297,7 @@ const gchar *gdial_app_state_to_string(GDialAppState state) {

void gdial_app_force_shutdown(GDialApp *app) {
g_warn_if_reached();
GDIAL_LOGINFO("App[%p]",app);
}

gchar *gdial_app_get_launch_payload(GDialApp *app) {
Expand Down Expand Up @@ -339,6 +342,7 @@ void gdial_app_set_additional_dial_data(GDialApp *app, GHashTable *additional_di
gdial_app_write_additional_dial_data(app->name, query_str, length);
}
g_free(query_str);
query_str = NULL;
}

GHashTable *gdial_app_get_additional_dial_data(GDialApp *app) {
Expand All @@ -350,6 +354,8 @@ GHashTable *gdial_app_get_additional_dial_data(GDialApp *app) {
void gdial_app_refresh_additional_dial_data(GDialApp *app) {
g_return_if_fail(app && app->name && strlen(app->name));

GDIAL_LOGTRACE("Entering ...");

GDialAppPrivate *priv = gdial_app_get_instance_private(app);
if(priv->additional_dial_data) {
g_hash_table_destroy(priv->additional_dial_data);
Expand All @@ -361,10 +367,16 @@ void gdial_app_refresh_additional_dial_data(GDialApp *app) {
if (data) {
/* we are ready to convert to hashtable*/
gdial_util_str_str_hashtable_from_string(data, length, priv->additional_dial_data);
g_print("gdial_app_refresh_additional_dial_data [%s]\r\n", data);
g_free(data);
GDIAL_LOGINFO("gdial_app_refresh_additional_dial_data [%s]", data);
}
}

if (data) {
g_free(data);
data = NULL;
}

GDIAL_LOGTRACE("Exiting ...");
}

void gdial_app_clear_additional_dial_data(GDialApp *app) {
Expand Down Expand Up @@ -403,7 +415,7 @@ GDIAL_STATIC gboolean gdial_app_write_additional_dial_data(const gchar *app_name
if (!g_file_query_exists(gfile, NULL) || g_file_delete(gfile, NULL, &err) ) {
GFileIOStream *gfile_ios = g_file_create_readwrite(gfile, G_FILE_CREATE_PRIVATE, NULL, &err);
if (gfile_ios) {
if (g_output_stream_write(g_io_stream_get_output_stream(G_IO_STREAM(gfile_ios)), data, length, NULL, &err) == length) {
if (g_output_stream_write(g_io_stream_get_output_stream(G_IO_STREAM(gfile_ios)), data, length, NULL, &err) == (gssize)length) {
result = TRUE;
}
else {
Expand All @@ -421,6 +433,7 @@ GDIAL_STATIC gboolean gdial_app_write_additional_dial_data(const gchar *app_name
}
g_object_unref(gfile);
g_free(filename);
filename = NULL;

return result;
}
Expand All @@ -431,6 +444,8 @@ GDIAL_STATIC gboolean gdial_app_read_additional_dial_data(const gchar *app_name,

*data = NULL; *length = 0;

GDIAL_LOGTRACE("Entering ...");

gchar *filename = g_build_filename(GDIAL_APP_DIAL_DATA_DIR, app_name, NULL);
g_return_val_if_fail(filename && strlen(filename), FALSE);

Expand All @@ -450,7 +465,7 @@ GDIAL_STATIC gboolean gdial_app_read_additional_dial_data(const gchar *app_name,
g_object_unref(gfile_ios);
}
else {
g_printerr("file %s file is not readable\n", filename);
GDIAL_LOGERROR("file %s file is not readable", filename);
}
g_object_unref(gfile_info);
}
Expand All @@ -459,11 +474,14 @@ GDIAL_STATIC gboolean gdial_app_read_additional_dial_data(const gchar *app_name,
}
}
else {
g_printerr("file %s does not exist\n", filename);
GDIAL_LOGERROR("file %s does not exist", filename);
}

g_object_unref(gfile);
g_free(filename);
filename = NULL;

GDIAL_LOGTRACE("Exiting ...");

return result;
}
Expand All @@ -483,6 +501,7 @@ GDIAL_STATIC gboolean gdial_app_remove_additional_dial_data_file(const gchar *ap
}
g_object_unref(gfile);
g_free(filename);
filename = NULL;

return result;
}
Expand All @@ -491,7 +510,7 @@ gchar * gdial_app_state_response_new(GDialApp *app, const gchar *dial_ver, const
{
GDialAppState state = app->state;
if(compare_versions(client_dial_version, "2.1") < 0) {
g_print("gdial_app_state_response_new client: %s less than 2.1\n", (client_dial_version != NULL) ? client_dial_version : "-- none --");
GDIAL_LOGINFO("gdial_app_state_response_new client: %s less than 2.1", (client_dial_version != NULL) ? client_dial_version : "-- none --");
state = (state == GDIAL_APP_STATE_HIDE) ? GDIAL_APP_STATE_STOPPED : state;
}

Expand Down
10 changes: 6 additions & 4 deletions server/gdial-debug.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2019 RDK Management
Expand All @@ -21,6 +21,8 @@
#define GDIAL_DEBUG_H_

#include <glib.h>
#include "gdialservicelogging.h"

G_BEGIN_DECLS

#define GDIAL_PERF_ENABLE 1
Expand All @@ -36,7 +38,7 @@ if ((avg) > 0) {\
time_hist_total+=time_hist[(counter-1)%(avg)];\
time_hist_total-=time_hist[counter%(avg)];\
double average = (time_hist_total) / (counter > (avg) ? (avg) : counter);\
g_printerr("time__ used average %0.3fms for %ld requests (total=%0.3fms)\r\n", average/1000, counter, time_hist_total/1000);\
GDIAL_LOGERROR("time__ used average %0.3fms for %ld requests (total=%0.3fms)\r\n", average/1000, counter, time_hist_total/1000);\
}
#else
#define GDIAL_PERF_TIME_BEGIN()
Expand All @@ -49,7 +51,7 @@ if ((avg) > 0) {\
time_t t;\
t = time(NULL);\
strftime(timestamp_, sizeof(timestamp_), "%FT%T", localtime(&t));\
g_print("[%s] "format, timestamp_, __VA_ARGS__);\
GDIAL_LOGINFO("[%s] "format, timestamp_, __VA_ARGS__);\
}

#define g_warn_msg_if_fail(expr, format, ...)\
Expand All @@ -59,7 +61,7 @@ do {\
GString *msg_buf = g_string_new("");\
g_string_printf(msg_buf, "\r\nFailed Condition: [%s] - Error Message: "format, #expr, __VA_ARGS__);\
gchar *msg = g_string_free(msg_buf, FALSE);\
g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);\
GDIAL_LOGWARNING("%s", msg); /*g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);*/ \
g_free(msg);\
}\
} while (0)
Expand Down
2 changes: 1 addition & 1 deletion server/gdial-impl-config.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2019 RDK Management
Expand Down
2 changes: 1 addition & 1 deletion server/gdial-options.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2019 RDK Management
Expand Down
2 changes: 1 addition & 1 deletion server/gdial-rest-builder.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2019 RDK Management
Expand Down
Loading