BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(tcore)
BuildRequires: pkgconfig(iniparser)
+BuildRequires: pkgconfig(libtzplatform-config)
%description
Telephony Packet Service library
/sbin/ldconfig
#create db
-mkdir -p /opt/dbspace
+mkdir -p %{TZ_SYS_DB}
-if [ ! -f /opt/dbspace/.dnet.db ]
+if [ ! -f %{TZ_SYS_DB}/.dnet.db ]
then
- sqlite3 /opt/dbspace/.dnet.db < /usr/share/ps-plugin/dnet_db.sql
- sqlite3 /opt/dbspace/.dnet.db < /usr/share/ps-plugin/dnet_db_data.sql
+ sqlite3 %{TZ_SYS_DB}/.dnet.db < /usr/share/ps-plugin/dnet_db.sql
+ sqlite3 %{TZ_SYS_DB}/.dnet.db < /usr/share/ps-plugin/dnet_db_data.sql
fi
rm -f /usr/share/ps-plugin/dnet_db.sql
rm -f /usr/share/ps-plugin/dnet_db_data.sql
#change file permission
-if [ -f /opt/dbspace/.dnet.db ]
+if [ -f %{TZ_SYS_DB}/.dnet.db ]
then
- chmod 660 /opt/dbspace/.dnet.db
+ chmod 660 %{TZ_SYS_DB}/.dnet.db
fi
-if [ -f /opt/dbspace/.dnet.db-journal ]
+if [ -f %{TZ_SYS_DB}/.dnet.db-journal ]
then
- chmod 664 /opt/dbspace/.dnet.db-journal
+ chmod 664 %{TZ_SYS_DB}/.dnet.db-journal
fi
%postun -p /sbin/ldconfig
#include <arpa/inet.h>
#include <iniparser.h>
+#include <tzplatform_config.h>
#define PROP_DEFAULT FALSE
#define PROP_DEFAULT_STR NULL
#define BOOL2STRING(a) ((a==TRUE) ? ("TRUE"):("FALSE"))
-#define DATABASE_PATH "/opt/dbspace/.dnet.db"
/*Properties*/
enum {
{
TcorePlugin *p = plugin;
Server *s = tcore_plugin_ref_server(p);
+ const char *path = NULL;
strg_db = tcore_server_find_storage(s, "database");
+ path = tzplatform_mkpath(TZ_SYS_DB,".dnet.db");
- handle = tcore_storage_create_handle(strg_db, DATABASE_PATH);
+ handle = tcore_storage_create_handle(strg_db, path);
if (!handle)
err("fail to create database handle");
{//insert data into table
char szQuery[5000];
- memset(szQuery, 0, 5000);
+ memset(szQuery, 0, sizeof(szQuery));
strcpy(szQuery," insert into pdp_profile( ");
strcat(szQuery," profile_id, profile_name, apn, auth_type, auth_id, auth_pwd, ");
strcat(szQuery," pdp_protocol, proxy_ip_addr, home_url, linger_time,");
conn = _ps_modem_ref_dbusconn(modem);
p = _ps_modem_ref_plugin(modem);
- memset(szQuery, '\0', 5000);
+ memset(szQuery, '\0', sizeof(szQuery));
strcpy(szQuery, "select");
strcat(szQuery, " a.network_info_id, a.network_name, a.mccmnc,"); //0 , 1, 2
strcat(szQuery, " b.profile_id, b.profile_name, b.apn, "); //3, 4, 5
GHashTable *in_param;
char szQuery[5000];
- memset(szQuery, '\0', 5000);
+ memset(szQuery, '\0', sizeof(szQuery));
strcat(szQuery, " delete from pdp_profile");
in_param = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
dbg("Create profile by mccmnc: [%s]", mccmnc);
- memset(szQuery, '\0', 5000);
+ memset(szQuery, '\0', sizeof(szQuery));
strcpy(szQuery, "select");
strcat(szQuery, " a.network_info_id, a.network_name, a.mccmnc,"); //0 , 1, 2
strcat(szQuery, " b.profile_id, b.profile_name, b.apn, "); //3, 4, 5