#include <storage.h>
#include <util.h>
#include <at.h>
+#include <tzplatform_config.h>
#include "s_common.h"
#include "s_network.h"
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;
const TcoreATResponse *resp = data;
UserRequest *ur;
struct tresp_network_get_serving_network Tresp = {0};
- char plmn[7] = {0};
char *long_plmn_name = NULL;
char *short_plmn_name = NULL;
char *plmn_id = NULL;
tcore_at_tok_free(tokens);
}
- memcpy(Tresp.plmn, plmn, 7);
+ if(plmn_id)
+ memcpy(Tresp.plmn, plmn_id, strlen(plmn_id));
tcore_network_get_access_technology(o, &(Tresp.act));
tcore_network_get_lac(o, &(Tresp.gsm.lac));
struct tnoti_network_change network_change;
memset(&network_change, 0, sizeof(struct tnoti_network_change));
- memcpy(network_change.plmn, plmn, 7);
+ if(plmn_id)
+ memcpy(network_change.plmn, plmn_id, strlen(plmn_id));
tcore_network_get_access_technology(o, &(network_change.act));
tcore_network_get_lac(o, &(network_change.gsm.lac));
if ((AT_COPS_MODE_DEREGISTER != network_mode) &&
(AT_COPS_MODE_SET_ONLY != network_mode)) {
/*Network identity noti*/
- memset(¬i, 0x0, sizeof(struct tnoti_network_change));
+ memset(¬i, 0x0, sizeof(struct tnoti_network_identity));
if (long_plmn_name)
memcpy(noti.full_name, long_plmn_name, MIN(32, strlen(long_plmn_name)));
if (short_plmn_name)
goto OUT;
} else {
stat = atoi(pResp);
- if ((pResp = g_slist_nth_data(tokens, 1)))
- lac = atoi(pResp);
+ if ((pResp = g_slist_nth_data(tokens, 1))) {
+ pResp = util_removeQuotes(pResp);
+ lac = strtol(pResp, NULL, 16);
+ g_free(pResp);
+ }
- if ((pResp = g_slist_nth_data(tokens, 2)))
- ci = atoi(pResp);
- else
+ if ((pResp = g_slist_nth_data(tokens, 2))) {
+ pResp = util_removeQuotes(pResp);
+ ci = strtol(pResp, NULL, 16);
+ g_free(pResp);
+ } else {
dbg("No ci in +CGREG");
+ }
if ((pResp = g_slist_nth_data(tokens, 3)))
AcT = atoi(pResp);
else
dbg("No AcT in +CGREG");
- if ((pResp = g_slist_nth_data(tokens, 4)))
- rac = atoi(pResp);
- else
+ if ((pResp = g_slist_nth_data(tokens, 4))) {
+ pResp = util_removeQuotes(pResp);
+ rac = strtol(pResp, NULL, 16);
+ g_free(pResp);
+ } else {
dbg("No rac in +CGREG");
+ }
}
goto OUT;
} else {
stat = atoi(pResp);
- if ((pResp = g_slist_nth_data(tokens, 1)))
- lac = atoi(pResp);
+ if ((pResp = g_slist_nth_data(tokens, 1))) {
+ pResp = util_removeQuotes(pResp);
+ lac = strtol(pResp, NULL, 16);
+ g_free(pResp);
+ }
- if ((pResp = g_slist_nth_data(tokens, 2)))
- ci = atoi(pResp);
- else
+ if ((pResp = g_slist_nth_data(tokens, 2))) {
+ pResp = util_removeQuotes(pResp);
+ ci = strtol(pResp, NULL, 16);
+ g_free(pResp);
+ } else {
dbg("No ci in +CREG");
+ }
if ((pResp = g_slist_nth_data(tokens, 3)))
AcT = atoi(pResp);