Fix For PTREL-286 : Multi-User Architecture Change updated for review comments 91/15691/3 accepted/tizen/generic accepted/tizen/ivi/stable accepted/tizen/mobile accepted/tizen_ivi_release tizen_ivi_release accepted/tizen/generic/20140130.163213 accepted/tizen/generic/20140312.081931 accepted/tizen/generic/20140326.163045 accepted/tizen/generic/20140326.215935 accepted/tizen/ivi/20140130.173716 accepted/tizen/ivi/20140326.212539 accepted/tizen/ivi/panda/20140312.101247 accepted/tizen/ivi/panda/20140326.234322 accepted/tizen/ivi/release/20140312.124219 accepted/tizen/mobile/20140224.083706 submit/tizen/20140130.101536 submit/tizen/20140312.070710 submit/tizen/20140326.003219 submit/tizen_ivi_release/20140312.071147
authorshivajm <shiva.jm@samsung.com>
Mon, 27 Jan 2014 06:00:24 +0000 (11:30 +0530)
committershivajm <shiva.jm@samsung.com>
Thu, 30 Jan 2014 04:44:50 +0000 (10:14 +0530)
Change-Id: I9fda4abc49fccc92f363f87fa465523fdc69648d
Signed-off-by: shivajm <shiva.jm@samsung.com>
CMakeLists.txt
packaging/tel-plugin-imc.spec
src/s_gps.c
src/s_network.c

index 260778e..a5eb71d 100644 (file)
@@ -10,7 +10,7 @@ SET(INCLUDEDIR "\${prefix}/include")
 
 # Set required packages
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED glib-2.0 tcore dlog db-util libxml-2.0)
+pkg_check_modules(pkgs REQUIRED glib-2.0 tcore dlog db-util libxml-2.0 libtzplatform-config)
 
 FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index 74c0363..60f0886 100644 (file)
@@ -15,6 +15,7 @@ BuildRequires:        pkgconfig(dlog)
 BuildRequires: pkgconfig(tcore)
 BuildRequires: pkgconfig(db-util)
 BuildRequires: pkgconfig(libxml-2.0)
+BuildRequires:  pkgconfig(libtzplatform-config)
 
 %description
 IMC plugin for telephony
@@ -29,22 +30,22 @@ make %{?jobs:-j%jobs}
 
 %post
 /sbin/ldconfig
-mkdir -p /opt/dbspace
+mkdir -p %{TZ_SYS_DB}
 
-if [ ! -f /opt/dbspace/.mcc_mnc_oper_list.db ]
+if [ ! -f %{TZ_SYS_DB}/.mcc_mnc_oper_list.db ]
 then
-       sqlite3 /opt/dbspace/.mcc_mnc_oper_list.db < /tmp/mcc_mnc_oper_list.sql
+       sqlite3 %{TZ_SYS_DB}/.mcc_mnc_oper_list.db < /tmp/mcc_mnc_oper_list.sql
 fi
 
 rm -f /tmp/mcc_mnc_oper_list.sql
 
-if [ -f /opt/dbspace/.mcc_mnc_oper_list.db ]
+if [ -f %{TZ_SYS_DB}/.mcc_mnc_oper_list.db ]
 then
-       chmod 600 /opt/dbspace/.mcc_mnc_oper_list.db
+       chmod 600 %{TZ_SYS_DB}/.mcc_mnc_oper_list.db
 fi
-if [ -f /opt/dbspace/.mcc_mnc_oper_list.db-journal ]
+if [ -f %{TZ_SYS_DB}/.mcc_mnc_oper_list.db-journal ]
 then
-       chmod 644 /opt/dbspace/.mcc_mnc_oper_list.db-journal
+       chmod 644 %{TZ_SYS_DB}/.mcc_mnc_oper_list.db-journal
 fi
 
 %postun -p /sbin/ldconfig
index 6fbdddb..c2517c7 100644 (file)
 #include <libxml/xmlreader.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
+#include <tzplatform_config.h>
 
 #include "s_common.h"
 #include "s_gps.h"
 
 
-#define FILE_NAME   "/opt/home/root/sample.xml"
 #define POSITION_NODE   "pos"
 #define POSITION_NODE_ATTR_XSI  "xsi:noNamespaceSchemaLocation"
 #define POSITION_NODE_ATTR_VAL_XSI  "pos.xsd"
@@ -1676,6 +1676,7 @@ static gboolean on_notification_gps_assist_data(CoreObject *o, const void *event
        xmlTextReaderPtr reader;
        gboolean _gps_assist_data = FALSE, gps_tow_assist = FALSE;
        gboolean ephem_and_clock = FALSE, alm_elem = FALSE;
+       const char *path = NULL;
 
        dbg("enter");
 
@@ -1736,8 +1737,10 @@ static gboolean on_notification_gps_assist_data(CoreObject *o, const void *event
                pos = (char *) xml_line;
        }
        line = g_strdup((char *) pos);
+
+       path = tzplatform_mkpath(TZ_SYS_ROOT, "sample.xml");
        // open file.
-       if ((fd = open(FILE_NAME, O_WRONLY | O_CREAT | O_TRUNC | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, S_IRWXU)) == -1) {
+       if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, S_IRWXU)) == -1) {
                dbg("Cannot open file\n");
                g_free(line);
                return FALSE;
@@ -1753,9 +1756,9 @@ static gboolean on_notification_gps_assist_data(CoreObject *o, const void *event
        g_free(line);
 
        dbg("read xml file");
-       reader = xmlReaderForFile(FILE_NAME, NULL, 0);
+       reader = xmlReaderForFile(path, NULL, 0);
 
-       while (xmlTextReaderRead(reader)) {
+       while (xmlTextReaderRead(reader) == 1) {
                // Get the node type of the current node
                switch (xmlTextReaderNodeType(reader)) {
                case XML_READER_TYPE_ELEMENT:
@@ -1778,11 +1781,11 @@ static gboolean on_notification_gps_assist_data(CoreObject *o, const void *event
                                        xmlCleanupParser();
                                        dbg("gps postion measurement notification ");
                                        // GPS position measurement notification.
-                                       ret = on_notification_gps_measure_position_from_modem(o, FILE_NAME, user_data);
+                                       ret = on_notification_gps_measure_position_from_modem(o, path, user_data);
                                        // remove file.
                                        close(fd);
-                                       if (access(FILE_NAME, F_OK) == 0) {
-                                               if (remove(FILE_NAME))
+                                       if (access(path, F_OK) == 0) {
+                                               if (remove(path))
                                                        dbg("file removed");
                                        }
                                        return ret;
@@ -1897,8 +1900,8 @@ static gboolean on_notification_gps_assist_data(CoreObject *o, const void *event
 
        // remove xml file.
        close(fd);
-       if (access(FILE_NAME, F_OK) == 0) {
-               if (remove(FILE_NAME))
+       if (access(path, F_OK) == 0) {
+               if (remove(path))
                        dbg("file removed");
        }
 
@@ -1919,7 +1922,7 @@ static gboolean on_notification_gps_measure_position_from_modem(CoreObject *o, c
        memset(&gps_measure_position_indi, 0x00, sizeof(gps_measure_position_indi));
        reader = xmlReaderForFile(file_name, NULL, 0);
 
-       while (xmlTextReaderRead(reader)) {
+       while (xmlTextReaderRead(reader) == 1) {
                switch (xmlTextReaderNodeType(reader)) {
                case XML_READER_TYPE_ELEMENT:
                {
index 0bbb5d3..aab77c9 100644 (file)
@@ -36,6 +36,7 @@
 #include <storage.h>
 #include <util.h>
 #include <at.h>
+#include <tzplatform_config.h>
 
 #include "s_common.h"
 #include "s_network.h"
@@ -153,12 +154,15 @@ static void _insert_mcc_mnc_oper_list(TcorePlugin *p, CoreObject *o)
        gpointer key, value;
        GHashTable *result = NULL, *row = NULL;
        struct tcore_network_operator_info *noi = NULL;
+       const char *path = NULL;
        int count = 0;
 
        s = tcore_plugin_ref_server(p);
        strg = tcore_server_find_storage(s, "database");
 
-       handle = tcore_storage_create_handle(strg, "/opt/dbspace/.mcc_mnc_oper_list.db");
+       path = tzplatform_mkpath(TZ_SYS_DB, ".mcc_mnc_oper_list.db");
+
+       handle = tcore_storage_create_handle(strg, path);
        if (!handle) {
                dbg("fail to create database handle");
                return;