From 088377e10497bcc8b024d27a95ec4226d56549a1 Mon Sep 17 00:00:00 2001 From: G S Senthil Kumar Date: Wed, 27 May 2015 15:35:33 +0530 Subject: [PATCH] Constructing the libraries path in PPM at runtime loading using tizen app framework package. Removing libcoap.so and loading libuuid.so in tizen applications and removed unwanted files to be packaged into rpm. Change-Id: Ic207a0609044b39a6a3809745dea62b964bf89e1 Signed-off-by: G S Senthil Kumar Reviewed-on: https://gerrit.iotivity.org/gerrit/1096 Reviewed-by: RadhaBhavani Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- .../SampleApp/tizen/NMSampleApp/.cproject | 4 +- service/protocol-plugin/plugin-manager/SConscript | 3 + .../protocol-plugin/plugin-manager/src/Config.cpp | 32 +- .../protocol-plugin/plugin-manager/src/Config.h | 2 + .../plugin-manager/src/PluginManager.cpp | 19 +- .../sample-app/tizen/PPMSampleApp/.cproject | 2 +- .../SampleApp/tizen/SSMTesterApp/.cproject | 2 +- .../tizen/SSMTesterApp/src/ssmtesterapp.cpp | 970 +++++++++++---------- .../sampleapp/tizen/ConServerApp/.cproject | 2 +- .../sampleapp/tizen/TMSampleApp/.cproject | 2 +- .../tizen/TMSampleApp/src/configuration.cpp | 1 + tools/tizen/iotivity.spec | 7 +- 12 files changed, 545 insertions(+), 501 deletions(-) diff --git a/service/notification-manager/SampleApp/tizen/NMSampleApp/.cproject b/service/notification-manager/SampleApp/tizen/NMSampleApp/.cproject index cd1b3e5..ad584dd 100644 --- a/service/notification-manager/SampleApp/tizen/NMSampleApp/.cproject +++ b/service/notification-manager/SampleApp/tizen/NMSampleApp/.cproject @@ -221,10 +221,10 @@ diff --git a/service/protocol-plugin/plugin-manager/SConscript b/service/protocol-plugin/plugin-manager/SConscript index 681ab10..5457b7b 100644 --- a/service/protocol-plugin/plugin-manager/SConscript +++ b/service/protocol-plugin/plugin-manager/SConscript @@ -19,6 +19,9 @@ plugin_manager_env.AppendUnique(CPPPATH = [ env.get('SRC_DIR')+'/extlibs/rapidxml' ]) +if target_os == 'tizen': + plugin_manager_env.ParseConfig("pkg-config --cflags --libs capi-appfw-app-common") + if target_os not in ['windows', 'winrt']: plugin_manager_env.AppendUnique(CXXFLAGS = ['-Wall','-std=c++0x', '-fpermissive', '-Wsign-compare']) diff --git a/service/protocol-plugin/plugin-manager/src/Config.cpp b/service/protocol-plugin/plugin-manager/src/Config.cpp index 963c89e..65062c0 100644 --- a/service/protocol-plugin/plugin-manager/src/Config.cpp +++ b/service/protocol-plugin/plugin-manager/src/Config.cpp @@ -25,6 +25,9 @@ #include "Config.h" +#ifdef __TIZEN__ +#include +#endif using namespace OIC; using namespace rapidxml; @@ -35,14 +38,6 @@ Config *Config::s_configinstance = NULL; Config::Config(void *args) { std::string path = "."; -/** - * For Tizen Platform, specifiy the absolute location of config file. It is required for - * Tizen 2.3 EFL App to work. - */ -#ifdef __TIZEN__ - if (loadConfigFile("/opt/usr/apps/org.iotivity.service.ppm.ppmsampleapp/lib/pluginmanager.xml") - != PM_S_OK) -#else #ifdef ANDROID JavaVM *jvm = (JavaVM *)args; JNIEnv *env; @@ -52,13 +47,22 @@ Config::Config(void *args) jmethodID mid = env->GetStaticMethodID(cls, "getPackageName", "()Ljava/lang/String;"); jstring jpath = (jstring)env->CallStaticObjectMethod(cls, mid); path = env->GetStringUTFChars(jpath, 0); - - if(path != ".") + if (path != ".") path = "/data/data/" + path + "/files"; +#elif __TIZEN__ + char *app_id = (char *)malloc(PATH_MAX_SIZE * sizeof(char)); + char completePath[PATH_MAX_SIZE]; + int res = app_get_id(&app_id); + if (APP_ERROR_NONE == res) + { + strcpy(completePath, "/opt/usr/apps/"); + strcat(completePath, app_id); + strcat(completePath, "/lib"); + } + path = completePath; #endif if (loadConfigFile(path + "/pluginmanager.xml") != PM_S_OK) -#endif //#ifdef __TIZEN__ { fprintf(stderr, "PM Configuration file is not exist current Folder.\n" ); exit(EXIT_FAILURE); @@ -67,7 +71,7 @@ Config::Config(void *args) Config::~Config(void) { - if (s_configinstance) + if (s_configinstance) { s_configinstance->deleteinstance(); s_configinstance = NULL; @@ -77,7 +81,7 @@ Config::~Config(void) PMRESULT Config::loadConfigFile(const std::string configfilepath) { // Read the xml file - xml_document< char > doc; + xml_document< char > doc; std::basic_ifstream< char > xmlFile(configfilepath.c_str()); if (!xmlFile.good()) { @@ -99,7 +103,7 @@ PMRESULT Config::loadConfigFile(const std::string configfilepath) // Find our root node xml_node< char > *root_node = doc.first_node("pluginManager"); - if(!root_node) + if (!root_node) { throw parse_error("No Root Element", 0); } diff --git a/service/protocol-plugin/plugin-manager/src/Config.h b/service/protocol-plugin/plugin-manager/src/Config.h index 553f0d1..9db7827 100644 --- a/service/protocol-plugin/plugin-manager/src/Config.h +++ b/service/protocol-plugin/plugin-manager/src/Config.h @@ -36,6 +36,8 @@ #include #endif +#define PATH_MAX_SIZE 100 + using namespace rapidxml; namespace OIC diff --git a/service/protocol-plugin/plugin-manager/src/PluginManager.cpp b/service/protocol-plugin/plugin-manager/src/PluginManager.cpp index 43b41a8..18c6101 100644 --- a/service/protocol-plugin/plugin-manager/src/PluginManager.cpp +++ b/service/protocol-plugin/plugin-manager/src/PluginManager.cpp @@ -24,18 +24,25 @@ #include "PluginManager.h" +#ifdef __TIZEN__ +#include +#endif using namespace OIC; PluginManager::PluginManager() { -/** - * For Tizen Platform, specifiy the absolute location of dynamic library. It is required for - * Tizen 2.3 EFL App to work. - */ #ifdef __TIZEN__ - handle = dlopen("/opt/usr/apps/org.iotivity.service.ppm.ppmsampleapp/lib/libpmimpl.so", - RTLD_LAZY); + char *app_id = (char *)malloc(PATH_MAX_SIZE * sizeof(char)); + char completePath[PATH_MAX_SIZE]; + int res = app_get_id(&app_id); + if (APP_ERROR_NONE == res) + { + strcpy(completePath, "/opt/usr/apps/"); + strcat(completePath, app_id); + strcat(completePath, "/lib/libpmimpl.so"); + } + handle = dlopen(completePath, RTLD_LAZY); #else handle = dlopen("./libpmimpl.so", RTLD_LAZY); #endif //#ifdef __TIZEN__ diff --git a/service/protocol-plugin/sample-app/tizen/PPMSampleApp/.cproject b/service/protocol-plugin/sample-app/tizen/PPMSampleApp/.cproject index 9f8ba20..3d37aad 100644 --- a/service/protocol-plugin/sample-app/tizen/PPMSampleApp/.cproject +++ b/service/protocol-plugin/sample-app/tizen/PPMSampleApp/.cproject @@ -222,11 +222,11 @@ diff --git a/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/.cproject b/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/.cproject index c9ca9aa..4da2a05 100644 --- a/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/.cproject +++ b/service/soft-sensor-manager/SampleApp/tizen/SSMTesterApp/.cproject @@ -218,9 +218,9 @@ - + diff --git a/service/things-manager/sampleapp/tizen/TMSampleApp/src/configuration.cpp b/service/things-manager/sampleapp/tizen/TMSampleApp/src/configuration.cpp index 509a086..edc82f8 100644 --- a/service/things-manager/sampleapp/tizen/TMSampleApp/src/configuration.cpp +++ b/service/things-manager/sampleapp/tizen/TMSampleApp/src/configuration.cpp @@ -812,6 +812,7 @@ static Eina_Bool naviframe_pop_cb(void *data, Elm_Object_Item *it) { onDestroyConfigure(); + resourceTable.clear(); if (NULL != log_entry) { evas_object_del(log_entry); diff --git a/tools/tizen/iotivity.spec b/tools/tizen/iotivity.spec index e908d7b..e23930f 100644 --- a/tools/tizen/iotivity.spec +++ b/tools/tizen/iotivity.spec @@ -1,5 +1,5 @@ Name: iotivity -Version: 0.9.0 +Version: 0.9.1 Release: 0 Summary: IoTivity Base Stack & IoTivity Services Group: System Environment/Libraries @@ -19,6 +19,7 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(uuid) BuildRequires: pkgconfig(capi-network-wifi) BuildRequires: pkgconfig(capi-network-bluetooth) +BuildRequires: pkgconfig(capi-appfw-app-common) Requires(postun): /sbin/ldconfig Requires(post): /sbin/ldconfig @@ -68,9 +69,11 @@ mkdir -p %{buildroot}%{_libdir} mkdir -p %{buildroot}%{_sbindir} cp out/tizen/*/release/lib*.so %{buildroot}%{_libdir} -cp out/tizen/*/release/lib*.a %{buildroot}%{_libdir} +cp out/tizen/*/release/libSSMSDK.a %{buildroot}%{_libdir} +cp out/tizen/*/release/libppm.a %{buildroot}%{_libdir} cp out/tizen/*/release/service/protocol-plugin/plugins/mqtt-fan/*.so %{buildroot}%{_libdir} cp out/tizen/*/release/service/protocol-plugin/plugins/mqtt-light/*.so %{buildroot}%{_libdir} +cp /usr/lib/libuuid.so %{buildroot}%{_libdir} cp resource/csdk/stack/include/ocstack.h %{buildroot}%{_includedir} cp resource/csdk/stack/include/ocstackconfig.h %{buildroot}%{_includedir} -- 2.7.4