|
|
@@ -476,6 +476,8 @@ static void reset_var( cell_handle_t *h)
|
|
|
sprintf(h->all.stat.longitude, "-");
|
|
|
h->all.stat.utctime = 0;
|
|
|
h->all.stat.linked = 0;
|
|
|
+ sprintf(h->all.stat.ipv4, "-");
|
|
|
+ sprintf(h->all.stat.ipv4, "-");
|
|
|
|
|
|
sprintf(h->all.info.apn, "-");
|
|
|
sprintf(h->all.info.cnum, "-");
|
|
|
@@ -734,6 +736,30 @@ static int cell_deinit(cell_handle_t *h)
|
|
|
|
|
|
return r;
|
|
|
}
|
|
|
+static int cell_get_ip(cell_handle_t *h, cell_stat_t *stat)
|
|
|
+{
|
|
|
+ char buf[200];
|
|
|
+ int r=-1;
|
|
|
+ memset(stat->ipv4, 0, sizeof(stat->ipv4));
|
|
|
+ memset(stat->ipv6, 0, sizeof(stat->ipv6));
|
|
|
+
|
|
|
+ if(h->stat==AT_STAT_UNINIT) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ r = send_cmd(h, AT_CMD_QIACT, "?", buf, sizeof(buf));
|
|
|
+ if (r != AT_OK)
|
|
|
+ {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ r = sscanf(str_get(buf, '+'), "+QIACT: %*d,%*d,%*d,\"%15[^\"]\",\"%63[^\"]\"", stat->ipv4, stat->ipv6);
|
|
|
+
|
|
|
+ LOGD("Cellular IPV4: %s\n",stat->ipv4);
|
|
|
+ LOGD("Cellular IPV6:%s\n", stat->ipv6);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
static int cell_get_info(cell_handle_t *h, cell_info_t *info)
|
|
|
{
|
|
|
int r;
|
|
|
@@ -769,6 +795,8 @@ static int cell_get_info(cell_handle_t *h, cell_info_t *info)
|
|
|
r = sscanf(str_get(buf,'+'), "+COPS: %*d,%*d,\"%[^\"]", info->isp);
|
|
|
}
|
|
|
|
|
|
+ //cell_get_ip(h, &h->all.stat);
|
|
|
+
|
|
|
LOGD("___info->apn: %s\n", info->apn);
|
|
|
LOGD("___info->isp: %s\n", info->isp);
|
|
|
LOGD("___info->imei: %s\n", info->imei);
|
|
|
@@ -912,6 +940,8 @@ static int cell_get_stat(cell_handle_t *h, cell_stat_t *stat)
|
|
|
cell_get_gnss(h, stat);
|
|
|
cell_get_ping(h, stat);
|
|
|
cell_get_time(h, stat);
|
|
|
+
|
|
|
+ cell_get_ip(h, stat);
|
|
|
|
|
|
return 0;
|
|
|
}
|