Merge "Revert "[BugFix][T106BUG-3] Resolve ril issue service exceptions""
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
index 57ff7e0..2a2af37 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
@@ -151,7 +151,8 @@
liblynq-call \
liblynq-sim \
liblynq-network \
- liblynq-sms \
+ liblynq-sms \
+ liblynq-data \
"
zxic_lib += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'libbinder libril', 'libtelsvr', d)}"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-data/liblynq-data.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-data/liblynq-data.bb
new file mode 100755
index 0000000..7041261
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-data/liblynq-data.bb
@@ -0,0 +1,51 @@
+inherit externalsrc package
+
+DESCRIPTION = "lynq call"
+LICENSE = "MobileTekProprietary"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
+DEPENDS += "libpal liblynq-log libvendor-ril liblynq-shm"
+inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-data"
+
+TARGET_CC_ARCH += "${LDFLAGS}"
+BB_INCLUDE_ADD = "--sysroot=${STAGING_DIR_HOST}"
+BB_LDFLAGS_ADD = "--sysroot=${STAGING_DIR_HOST} -Wl,--hash-style=gnu"
+#Parameters passed to do_compile()
+EXTRA_OEMAKE = "'RAT_CONFIG_C2K_SUPPORT = ${RAT_CONFIG_C2K_SUPPORT}'\
+ 'MTK_MULTI_SIM_SUPPORT = ${MTK_MULTI_SIM_SUPPORT}'\
+ 'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
+
+EXTRA_OEMAKE += "'MOBILETEK_RIL_CFG = ${MOBILETEK_RIL_CFG}'"
+
+FILES_${PN} = "${base_libdir}/*.so \
+ ${base_bindir}\
+ ${base_sbindir} \
+ /etc/dbus-1/system.d/"
+FILES_${PN}-dev = "/test \
+ ${includedir}"
+FILES_${PN}-doc = "/doc"
+FILES_${PN}-dbg ="${base_bindir}/.debug \
+ ${base_libdir}/.debug \
+ ${base_sbindir}/.debug"
+INSANE_SKIP_${PN} += "already-stripped"
+INSANE_SKIP_${PN} += "installed-vs-shipped"
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+ if [ "${PACKAGE_ARCH}" = "cortexa7hf-vfp-vfpv4-neon" ]; then
+ oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mfpu=neon-vfpv4 -mhard-float -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ elif [ "${PACKAGE_ARCH}" = "cortexa7hf-neon-vfpv4" ]; then
+ oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mfpu=neon-vfpv4 -mhard-float -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ elif [ "${PACKAGE_ARCH}" = "cortexa53hf-neon-fp-armv8" ]; then
+ oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mfpu=neon-vfpv4 -mhard-float -Wl,--hash-style=gnu -DTELEPHONYWARE -mhard-float -mfpu=neon-fp-armv8 -mfloat-abi=hard -mcpu=cortex-a53 -mtune=cortex-a53"
+ else
+ oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ fi
+}
+
+do_install() {
+ oe_runmake install ROOT=${D}
+ if [ -d "${WORKONSRC}" ] ; then
+ install -d ${D}${includedir}
+ cp -af ${S}/include/libdata/ ${D}${includedir}/libdata
+ fi
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-ril-service/lynq-ril-service.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-ril-service/lynq-ril-service.bb
index 2a4fa94..b46c235 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-ril-service/lynq-ril-service.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-ril-service/lynq-ril-service.bb
@@ -16,7 +16,8 @@
EXTRA_OEMAKE = "'RAT_CONFIG_C2K_SUPPORT = ${RAT_CONFIG_C2K_SUPPORT}'\
'MTK_MULTI_SIM_SUPPORT = ${MTK_MULTI_SIM_SUPPORT}'\
'TARGET_PLATFORM = ${TARGET_PLATFORM}'\
- 'MTK_LED_SUPPORT = ${MTK_LED_SUPPORT}'"
+ 'MTK_LED_SUPPORT = ${MTK_LED_SUPPORT}'\
+ 'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
EXTRA_OEMAKE += "'MOBILETEK_RIL_CFG = ${MOBILETEK_RIL_CFG}'"
EXTRA_OEMAKE += "'MOBILETEK_FOTA_CFG = ${MOBILETEK_FOTA_CFG}'"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/mobiletek-tester-rdit/mobiletek-tester-rdit.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/mobiletek-tester-rdit/mobiletek-tester-rdit.bb
index 21ae078..3db44aa 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/mobiletek-tester-rdit/mobiletek-tester-rdit.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/mobiletek-tester-rdit/mobiletek-tester-rdit.bb
@@ -4,7 +4,7 @@
LICENSE = "MobileTekProprietary"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
-DEPENDS += "liblynq-call liblynq-sms liblynq-network liblynq-sim"
+DEPENDS += "liblynq-call liblynq-sms liblynq-network liblynq-sim liblynq-data"
inherit workonsrc
WORKONSRC = "${TOPDIR}/../src/lynq/packages/apps/Mobiletek_Tester_RDIT"
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.cpp
index 8d81825..b8990d2 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.cpp
@@ -764,6 +764,71 @@
int setupDataCall(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
{
Parcel p;
+//xf.li@20230610 add for T106 data start
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ char* apn = argv[1];
+ char* apntype = argv[2];
+ int result = 0;
+
+ if(argv[1] != NULL)
+ {
+ RLOGD("argv[1] != NULL\n");
+ for(int i = 0;i< LYNQ_APN_CHANNEL_MAX;i++)
+ {
+ RLOGD("lynq_apn_cid_table[i].apn:%s,argv[1]:%s\n",lynq_apn_cid_table[i].apn,argv[1]);
+ if(strcmp(lynq_apn_cid_table[i].apn, apn)==0)//代表已经有argv[1]的APN 已经被建立
+ {
+ /*此处直接返回response,给client成功的结果码,并返回iface*/
+ p.writeInt32(0);
+ p.writeInt32(0);
+ p.writeInt32(pRI->pCI->requestNumber);
+ p.writeInt32(socket_id);
+ p.writeInt32(0);//error
+ p.writeInt32(0);//version
+ p.writeInt32(0);//num
+ p.writeInt32(0);//status
+ p.writeInt32(-1);//suggestedRetryTime
+ p.writeInt32(lynq_apn_cid_table[i].cid);//cid
+ android::LYNQ_RIL_respSocket(p, (void *)pRI);
+ RLOGD("cid:%d,apn:%s,apntype:%s", lynq_apn_cid_table[i].cid, lynq_apn_cid_table[i].apn, lynq_apn_cid_table[i].apntype);
+ return -1;
+ }
+ }
+ }
+ else
+ {
+ RLOGD("argv[1] = NULL\n");
+ memcpy(apn, "", 1);
+ }
+
+ //xf.li need add updata lynq_apn_cid_table add a apn
+ for(int i = 0; i < LYNQ_APN_CHANNEL_MAX; i++)
+ {
+ if(lynq_apn_cid_table[i].used != 1)
+ {
+ lynq_apn_cid_table[i].used = 1;
+ memcpy(lynq_apn_cid_table[i].apn, apn, strlen(apn) + 1);
+ memcpy(lynq_apn_cid_table[i].apntype, apntype, strlen(apntype) + 1);
+ lynq_apn_cid_table[i].dialing = 1;
+ RLOGD("DATA: apn_table[%d].apn = %s, apntype = %s, dialing = %d\n", i, lynq_apn_cid_table[i].apn, lynq_apn_cid_table[i].apntype, lynq_apn_cid_table[i].dialing);
+ break;
+ }
+ }
+ RLOGD("setupDataCall end, lynq_apn_cid_table content:\n");
+ for(int i = 0; i < LYNQ_APN_CHANNEL_MAX; i++)
+ {
+ RLOGD("lynq_apn_cid_table[%d],apntype:%s,apnstatus:%d,ifaceName:%s,used=%d,address=%s,dialing=%d\n",
+ i,lynq_apn_cid_table[i].apntype,
+ lynq_apn_cid_table[i].status,
+ lynq_apn_cid_table[i].ifaceName,
+ lynq_apn_cid_table[i].used,
+ lynq_apn_cid_table[i].address,
+ lynq_apn_cid_table[i].dialing);
+ }
+ result = setupDataCallargc(argc,argv,socket_id,pRI);
+ return result;
+#else
+//xf.li@20230610 add for T106 data end
/*jb.qi change for switch card after dial on 20221025 start*/
if((argc == 0) && (pRI == NULL))
{
@@ -866,6 +931,7 @@
free(pRI);
}
return ret;
+#endif
}
int getIntefaceId(char * apnType) {
@@ -909,6 +975,38 @@
int setupDataCallargc(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
{
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ const char *radioTechnoloy = "";
+ const char *profile = "";
+ const char *apn = argv[1];
+ const char *apntype = argv[2];
+ const char *user = argv[3];
+ const char *password = argv[4];
+ const char *authtype = argv[5];
+ const char *pdp_type = argv[6];
+ const char *optional_property = "";
+
+ android::Parcel p;
+ size_t pos = p.dataPosition();
+
+ p.writeInt32(8);
+ writeStringToParcel(p,radioTechnoloy);
+ writeStringToParcel(p,profile);
+ writeStringToParcel(p,apn);
+ writeStringToParcel(p,user);
+ writeStringToParcel(p,password);
+ writeStringToParcel(p,authtype);
+ writeStringToParcel(p,pdp_type);//protocol == (ZXW)pdp_type
+ writeStringToParcel(p, optional_property);
+ p.setDataPosition(pos);
+
+ RLOGD("setupDataCallargc: \nradioTechnoloy: %s\nprofileId: %s\napn: %s\n \
+ username: %s\npassword: %s\nauthType: %s\nprotocol %s\noptional_property: %s",radioTechnoloy,profile,apn,
+ user,password,authtype,pdp_type,optional_property);
+
+ pRI->pCI->dispatchFunction(p, pRI);
+ return 0;
+#else
if(argc != 8)
{
//free(pRI);//Warren chenge for t800 ril service 2021/12/28 start
@@ -1011,6 +1109,7 @@
user,password,authtype,protocol,apnType, interface_id);
pRI->pCI->dispatchFunction(p, pRI);
return 0;
+#endif
}
int deactivateDataCallarc(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
@@ -1055,6 +1154,32 @@
int deactivateDataCall(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
{
+//xf.li@20230607 modify for T106 data start
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ char reason[8];
+ const char *cid = argv[1];
+
+ if(argc != 2)
+ {
+ free(pRI);
+ RLOGD("the paremeters numbers isn't right , so return");
+ return -1;
+ }
+ RLOGD("cid = %S",cid);
+ RLOGD("deactivateDataCall %d: " , pRI->pCI->requestNumber);
+ sprintf(reason,"%d",DEACTIVATE_REASON_NONE);
+ android::Parcel p;
+ size_t pos = p.dataPosition();
+ p.writeInt32(2);
+ writeStringToParcel(p,cid);
+ writeStringToParcel(p,reason);
+ p.setDataPosition(pos);
+
+ pRI->pCI->dispatchFunction(p, pRI);
+ RLOGD("deactivateDataCall() done");
+ return 0;
+//xf.li@20230607 modify for T106 data end
+#else
bool hasDeactivate = TRUE;
Parcel p;
/*jb.qi change for swtich card after dial on 20221025 start*/
@@ -1182,6 +1307,7 @@
free(pRI);
}
return ret;
+#endif
}
#if 0
@@ -1373,7 +1499,70 @@
pRI->pCI->dispatchFunction(p, pRI);
return 0;
}
-
+//xf.li@20230610 add for T106 start
+void updateRILDataCallResponsev11(int num ,RIL_Data_Call_Response_v11* p_cur)
+{
+ int i = 0;
+ RLOGD("in updateRILDataCallResponsev11");
+ if(num != 1)
+ {
+ RLOGD("the response of RIL_REQUEST_SETUP_DATA_CALL is %d", num);
+ }
+ if(p_cur[i].ifname == NULL)
+ {
+ RLOGD("ERROR:p_cur[i].ifname is NULL!");
+ return;
+ }
+ if(p_cur[i].addresses == NULL)
+ {
+ RLOGD("ERROR:p_cur[i].addresses is NULL!");
+ return;
+ }
+ //update lynq_apn_cid_table at there whitch dialing = 1
+ for(int j = 0; j < LYNQ_APN_CHANNEL_MAX; j++)
+ {
+ if(lynq_apn_cid_table[j].used == 1 && lynq_apn_cid_table[j].dialing == 1)
+ {
+ if((int)p_cur[i].status == 0)
+ {
+ //update
+ lynq_apn_cid_table[j].cid = p_cur[i].cid;
+ memcpy(lynq_apn_cid_table[j].ifaceName, p_cur[i].ifname, strlen(p_cur[i].ifname) + 1);
+ lynq_apn_cid_table[j].status = (int)p_cur[i].status;
+ memcpy(lynq_apn_cid_table[j].address, p_cur[i].addresses, strlen(p_cur[i].addresses) + 1);
+ lynq_apn_cid_table[j].dialing = 0;
+ //break;
+ }
+ else
+ {
+ //delete
+ bzero(lynq_apn_cid_table[j].apn,LYNQ_APN_LEN_MAX);
+ bzero(lynq_apn_cid_table[j].apntype,LYNQ_APNTPYE_LEN_MAX);
+ bzero(lynq_apn_cid_table[j].ifaceName,LYNQ_IFNAME_LEN_MAX);
+ bzero(lynq_apn_cid_table[j].address,LYNQ_ADDRESS_LEN_MAX);
+ lynq_apn_cid_table[j].cid = -1;
+ lynq_apn_cid_table[j].used = -1;
+ lynq_apn_cid_table[j].status = -1;
+ lynq_apn_cid_table[j].dialing = -1;
+ //break;
+ }
+ }
+ }
+ RLOGD("updateRILDataCallResponsev11 end, lynq_apn_cid_table content:\n");
+ for(int i = 0; i < LYNQ_APN_CHANNEL_MAX; i++)
+ {
+ RLOGD("lynq_apn_cid_table[%d],cid:%d,apntype:%s,apnstatus:%d,ifaceName:%s,used=%d,address=%s,dialing=%d\n",
+ i,
+ lynq_apn_cid_table[i].cid,
+ lynq_apn_cid_table[i].apntype,
+ lynq_apn_cid_table[i].status,
+ lynq_apn_cid_table[i].ifaceName,
+ lynq_apn_cid_table[i].used,
+ lynq_apn_cid_table[i].address,
+ lynq_apn_cid_table[i].dialing);
+ }
+}
+//xf.li@20230610 add for T106 end
void updateRILDataCallResponsev6(int num ,RIL_Data_Call_Response_v6* p_cur)
{
if(!isEnableLocalconf()) return;
@@ -1439,7 +1628,86 @@
RLOGD("updateRILDataCallResponsev6 fail");
}
}
+//xf.li@20230531 add for T106 data start
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+void handleUnsolDataCalllistChange(int num ,RIL_Data_Call_Response_v11* p_cur){
+ int i;
+ RLOGD("num = %d, apn_count = %d", num, apn_count);
+ for(int j = 0; j < LYNQ_APN_CHANNEL_MAX; j++)
+ {
+ RLOGD("lynq_apn_cid_table[%d],cid:%d,apn:%s,apntype:%s,apnstatus:%d,ifaceName:%s,used=%d,address=%s,dialing=%d\n",
+ j,
+ lynq_apn_cid_table[j].cid,
+ lynq_apn_cid_table[j].apn,
+ lynq_apn_cid_table[j].apntype,
+ lynq_apn_cid_table[j].status,
+ lynq_apn_cid_table[j].ifaceName,
+ lynq_apn_cid_table[j].used,
+ lynq_apn_cid_table[j].address,
+ lynq_apn_cid_table[j].dialing);
+
+ //add update lynq_apn_cid_list at there for every used = 1, if cid = p_cur.cid, update, else delete lynq_apn_cid_table[i]
+ if(lynq_apn_cid_table[j].used == 1)
+ {
+ for(i = 0; i < num; i++)
+ {
+ if(p_cur[i].ifname == NULL)
+ {
+ RLOGD("ERROR:p_cur[i].ifname is NULL!");
+ return;
+ }
+ if(p_cur[i].addresses == NULL)
+ {
+ RLOGD("ERROR:p_cur[i].addresses is NULL!");
+ return;
+ }
+ RLOGD("lynq_apn_cid_table[j].cid %d and p_cur[i].cid %d", lynq_apn_cid_table[j].cid, p_cur[i].cid);
+ if(lynq_apn_cid_table[j].cid == p_cur[i].cid)
+ {
+ RLOGD("need update");
+ lynq_apn_cid_table[j].dialing = 0;
+ lynq_apn_cid_table[j].status = p_cur[i].status;
+ memcpy(lynq_apn_cid_table[j].ifaceName, p_cur[i].ifname, strlen(p_cur[i].ifname) + 1);
+ lynq_apn_cid_table[j].status = (int)p_cur[i].status;
+ memcpy(lynq_apn_cid_table[j].address, p_cur[i].addresses, strlen(p_cur[i].addresses) + 1);
+ RLOGD("end update");
+ break;
+ }
+ }
+ if(i == num)
+ {
+ RLOGD("clean start\n");
+ bzero(lynq_apn_cid_table[j].apn,LYNQ_APN_LEN_MAX);
+ bzero(lynq_apn_cid_table[j].apntype,LYNQ_APNTPYE_LEN_MAX);
+ bzero(lynq_apn_cid_table[j].ifaceName,LYNQ_IFNAME_LEN_MAX);
+ bzero(lynq_apn_cid_table[j].address,LYNQ_ADDRESS_LEN_MAX);
+ lynq_apn_cid_table[j].cid = -1;
+ lynq_apn_cid_table[j].used = -1;
+ lynq_apn_cid_table[j].status = -1;
+ lynq_apn_cid_table[j].dialing = -1;
+ RLOGD("clean end\n");
+ }
+ }
+ }
+ RLOGD("handleUnsolDataCalllistChange end, lynq_apn_cid_table content:\n");
+ for(int i = 0; i < LYNQ_APN_CHANNEL_MAX; i++)
+ {
+ RLOGD("lynq_apn_cid_table[%d],cid:%d,apntype:%s,apnstatus:%d,ifaceName:%s,used=%d,address=%s,dialing=%d\n",
+ i,
+ lynq_apn_cid_table[i].cid,
+ lynq_apn_cid_table[i].apntype,
+ lynq_apn_cid_table[i].status,
+ lynq_apn_cid_table[i].ifaceName,
+ lynq_apn_cid_table[i].used,
+ lynq_apn_cid_table[i].address,
+ lynq_apn_cid_table[i].dialing);
+ }
+
+
+}
+//xf.li@20230531 add for T106 data end
+#else
void handleUnsolDataCalllistChange(int num ,RIL_Data_Call_Response_v6* p_cur){
for(int i =0; i < 8; i++)
{
@@ -1461,7 +1729,7 @@
}
}
}
-
+#endif
static int getApntypeBitmask(const char *type)
{
struct apntype_2_bitmask apntypebitmask[] = {
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.h b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.h
index 657f8be..25c8e89 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.h
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/data/data.h
@@ -48,9 +48,16 @@
int apnSetting(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
int getApnDbIms();
void updateRILDataCallResponsev6(int num ,RIL_Data_Call_Response_v6* p_cur);
+//xf.il@20230610 modify for T106 data start
+void updateRILDataCallResponsev11(int num ,RIL_Data_Call_Response_v11* p_cur);
+//xf.il@20230610 modify for T106 data end
int getDataCallList(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
int getLastDataCallFailCause(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+void handleUnsolDataCalllistChange(int num ,RIL_Data_Call_Response_v11* p_cur);
+#else
void handleUnsolDataCalllistChange(int num ,RIL_Data_Call_Response_v6* p_cur);
+#endif
int setDataProfile(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
int syncDataSettingsToMd(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
int syncDataSettings(RIL_SOCKET_ID socket_id);
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.cpp
index a5338bc..8989350 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.cpp
@@ -31,6 +31,19 @@
#define LOG_TAG "LYNQ_COMMON"
extern apn_table_t apn_table[LYNQ_APN_CHANNEL_MAX] = {};
+//xf.il@20230610 modify for T106 data start
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+extern lynq_apn_cid_table_t lynq_apn_cid_table[LYNQ_APN_CHANNEL_MAX] = {
+ {-1, "", "", "", -1, -1, -1, ""}, \
+ {-1, "", "", "", -1, -1, -1, ""}, \
+ {-1, "", "", "", -1, -1, -1, ""}, \
+ {-1, "", "", "", -1, -1, -1, ""}, \
+ {-1, "", "", "", -1, -1, -1, ""}, \
+ {-1, "", "", "", -1, -1, -1, ""}, \
+ {-1, "", "", "", -1, -1, -1, ""},
+};
+#endif
+//xf.il@20230610 modify for T106 data end
extern int apn_count = 0;
extern char lynq_at[LYNQ_AT_LEN_MAX]= {};
char mccmnc[8] = {0};
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.h b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.h
index 16b6403..ff3dd2b 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.h
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/lynq_common.h
@@ -38,6 +38,8 @@
#define LYNQ_APN_LEN_MAX 100
#define LYNQ_APNTPYE_LEN_MAX 50
+#define LYNQ_IFNAME_LEN_MAX 10
+#define LYNQ_ADDRESS_LEN_MAX 100
#define LYNQ_APN_CHANNEL_MAX 7//max is 7
#define LYNQ_AT_LEN_MAX 20
#define LYNQ_EVENT_WAIT_TIME_MAX 25 //m
@@ -95,7 +97,27 @@
int pdpstate;//lei add for at+elapnact? refer to T800 AT COMMANDS:+lapnact
char address[LYNQ_APNTPYE_LEN_MAX];
}apn_table_t;
+//xf.il@20230610 modify for T106 data start
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+typedef struct
+{
+ int cid;
+ char apn[LYNQ_APN_LEN_MAX];
+ char apntype[LYNQ_APNTPYE_LEN_MAX];
+ char ifaceName[LYNQ_IFNAME_LEN_MAX];
+ //int netId;
+ int used;//0:not use,1:used.
+ int dialing;
+ int status;
+ //int apnstatus;//1:has enable;0:need disable.
+ //int pdpstate;//lei add for at+elapnact? refer to T800 AT COMMANDS:+lapnact
+ char address[LYNQ_ADDRESS_LEN_MAX];
+}lynq_apn_cid_table_t;
+extern lynq_apn_cid_table_t lynq_apn_cid_table[LYNQ_APN_CHANNEL_MAX];
+#endif
+//xf.il@20230610 modify for T106 data end
extern apn_table_t apn_table[LYNQ_APN_CHANNEL_MAX];
+
extern int apn_count;
extern char lynq_at[LYNQ_AT_LEN_MAX];
extern char mccmnc[8];
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/makefile b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/makefile
index 3da0640..b0c76d3 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/makefile
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/makefile
@@ -10,6 +10,10 @@
-DKEEP_ALIVE \
-DECALL_SUPPORT
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+ LOCAL_CFLAGS += -DMOBILETEK_TARGET_PLATFORM_T106
+endif
+
ifeq ($(strip $(MOBILETEK_FOTA_CFG)), PLATFORM)
LOCAL_CFLAGS += -DMOBILETEK_FOTA_CFG
endif
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
index 1233bf6..8394830 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
@@ -2325,6 +2325,8 @@
static int responseDataCallListV6(Parcel &p, void *response, size_t responselen)
{
+//xf.il@20230610 modify for T106 data start
+ RLOGD("RIL.CPP: in responseDataCallListV6\n");
if (response == NULL && responselen != 0) {
RLOGE("invalid response: NULL");
return RIL_ERRNO_INVALID_RESPONSE;
@@ -2345,7 +2347,20 @@
RIL_Data_Call_Response_v6 *p_cur = (RIL_Data_Call_Response_v6 *) response;
startResponse;
int i;
+
for (i = 0; i < num; i++) {
+
+ RLOGD("LYNQ_READ_PCUR: [status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s],",
+ p_cur[i].status,
+ p_cur[i].suggestedRetryTime,
+ p_cur[i].cid,
+ (p_cur[i].active==0)?"down":"up",
+ (char*)p_cur[i].type,
+ (char*)p_cur[i].ifname,
+ (char*)p_cur[i].addresses,
+ (char*)p_cur[i].dnses,
+ (char*)p_cur[i].gateways);
+//xf.il@20230610 modify for T106 data end
p.writeInt32((int)p_cur[i].status);
p.writeInt32(p_cur[i].suggestedRetryTime);
p.writeInt32(p_cur[i].cid);
@@ -2355,6 +2370,7 @@
writeStringToParcel(p, p_cur[i].addresses);
writeStringToParcel(p, p_cur[i].dnses);
writeStringToParcel(p, p_cur[i].gateways);
+
appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s],", printBuf,
p_cur[i].status,
p_cur[i].suggestedRetryTime,
@@ -2425,6 +2441,9 @@
static int responseDataCallList(Parcel &p, void *response, size_t responselen)
{
+//xf.il@20230610 modify for T106 data start
+ RLOGD("responseDataCallList: s_callbacks.version = %d, responselen = %d, sizeof(RIL_Data_Call_Response_v6) = %d\n",
+ s_callbacks.version, responselen, sizeof(RIL_Data_Call_Response_v6));
if (s_callbacks.version < 5) {
RLOGD("responseDataCallList: v4");
return responseDataCallListV4(p, response, responselen);
@@ -2451,9 +2470,25 @@
p.writeInt32(num);
RIL_Data_Call_Response_v11 *p_cur = (RIL_Data_Call_Response_v11 *) response;
+
startResponse;
int i;
for (i = 0; i < num; i++) {
+
+ RLOGD("LYNQ:[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s,mtu=%d],",
+ p_cur[i].status,
+ p_cur[i].suggestedRetryTime,
+ p_cur[i].cid,
+ (p_cur[i].active==0)?"down":"up",
+ (char*)p_cur[i].type,
+ (char*)p_cur[i].ifname,
+ (char*)p_cur[i].addresses,
+ (char*)p_cur[i].dnses,
+ (char*)p_cur[i].gateways,
+ (char*)p_cur[i].pcscf,
+ p_cur[i].mtu);
+//xf.li@20230531 modify for T106 data start end
+
p.writeInt32((int)p_cur[i].status);
p.writeInt32(p_cur[i].suggestedRetryTime);
p.writeInt32(p_cur[i].cid);
@@ -2481,7 +2516,6 @@
removeLastChar;
closeResponse;
}
-
return 0;
}
@@ -4203,9 +4237,18 @@
}
case RIL_REQUEST_SETUP_DATA_CALL:
{
+ //xf.il@20230610 modify for T106 data start
+ #ifdef MOBILETEK_TARGET_PLATFORM_T106
+ int num = responselen / sizeof(RIL_Data_Call_Response_v11);
+ RLOGD("the num of RIL_REQUEST_SETUP_DATA_CALL is %d", num);
+ RIL_Data_Call_Response_v11 *p_cur = (RIL_Data_Call_Response_v11 *) response;
+ updateRILDataCallResponsev11(num,p_cur);
+ #else
int num = responselen / sizeof(RIL_Data_Call_Response_v6);
RIL_Data_Call_Response_v6 *p_cur = (RIL_Data_Call_Response_v6 *) response;
updateRILDataCallResponsev6(num,p_cur);
+ #endif
+ //xf.il@20230610 modify for T106 data end
break;
}
case RIL_REQUEST_ANSWER:
@@ -4746,9 +4789,17 @@
}
case RIL_UNSOL_DATA_CALL_LIST_CHANGED:
{
+//xf.il@20230610 modify for T106 data start
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ RLOGD("URC is RIL_UNSOL_DATA_CALL_LIST_CHANGED, datalen = %d\n", datalen);
+ int num = datalen / sizeof(RIL_Data_Call_Response_v11);
+ RIL_Data_Call_Response_v11 *p_cur = (RIL_Data_Call_Response_v11 *) data;
+#else
int num = datalen / sizeof(RIL_Data_Call_Response_v6);
RIL_Data_Call_Response_v6 *p_cur = (RIL_Data_Call_Response_v6 *) data;
+#endif
handleUnsolDataCalllistChange(num,p_cur);
+//xf.il@20230610 modify for T106 data end
break;
}
case RIL_UNSOL_VOICE_RADIO_TECH_CHANGED:
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_module_socket.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_module_socket.cpp
index ff45c02..68a8e9b 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_module_socket.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_module_socket.cpp
@@ -129,11 +129,11 @@
* other:failure
*/
const int waitResponse(Parcel*& p, int token,int time_out)
-{
+{
int waitToken = token;
int wakeup_token=-1;
int resp_type;
- struct timeval now;
+ struct timeval now;
struct timespec timeout;
int ret;
std::list<Parcel*>::iterator iter;
@@ -141,8 +141,8 @@
gettimeofday(&now,NULL);
timeout.tv_sec = now.tv_sec+time_out; //timeout is 1min
- timeout.tv_nsec = now.tv_usec*1000;
-
+ timeout.tv_nsec = now.tv_usec*1000;
+
LYINFLOG("%s wait token is %d, wait time is %d",__func__,waitToken,time_out);
BLOCK_RECV_MSG_LOCK();
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-data/LICENSE b/cap/zx297520v3/src/lynq/lib/liblynq-data/LICENSE
new file mode 100755
index 0000000..605b7ea
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-data/LICENSE
@@ -0,0 +1,31 @@
+Copyright Statement:
+
+This software/firmware and related documentation ("MobileTek Software") are
+protected under relevant copyright laws. The information contained herein is
+confidential and proprietary to MobileTek Inc. and/or its licensors. Without
+the prior written permission of MobileTek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of MobileTek Software, and
+information contained herein, in whole or in part, shall be strictly
+prohibited.
+
+MobileTek Inc. (C) 2015. All rights reserved.
+
+BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MobileTek SOFTWARE")
+RECEIVED FROM MobileTek AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. MobileTek EXPRESSLY DISCLAIMS ANY AND ALL
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+NONINFRINGEMENT. NEITHER DOES MobileTek PROVIDE ANY WARRANTY WHATSOEVER WITH
+RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+INCORPORATED IN, OR SUPPLIED WITH THE MobileTek SOFTWARE, AND RECEIVER AGREES
+TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MobileTek
+SOFTWARE. MobileTek SHALL ALSO NOT BE RESPONSIBLE FOR ANY MobileTek SOFTWARE
+RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MobileTek'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MobileTek SOFTWARE
+RELEASED HEREUNDER WILL BE, AT MobileTek'S OPTION, TO REVISE OR REPLACE THE
+MobileTek SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO MobileTek FOR SUCH MobileTek SOFTWARE AT ISSUE.
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-data/include/libdata/lynq_data.h b/cap/zx297520v3/src/lynq/lib/liblynq-data/include/libdata/lynq_data.h
new file mode 100755
index 0000000..99da6ec
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-data/include/libdata/lynq_data.h
@@ -0,0 +1,81 @@
+#ifndef LYNQ_DATA_H
+#define LYNQ_DATA_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define LYNQ_APN_CHANNEL_MAX 10
+#define LYNQ_PDP_TYPE_MAX_LEN 16
+#define LYNQ_IFACE_NAME_MAX_LEN 50
+#define LYNQ_APN_MAX_LEN 50
+#define LYNQ_TYPE_MAX_LEN 50
+#define LYNQ_ADDRESSES_MAX_LEN 100
+#define LYNQ_DNSES_MAX_LEN 50
+#define LYNQ_GATEWAYS_MAX_LEN 50
+#define LYNQ_PCSCF_MAX_LEN 50
+#define LYNQ_APN_TYPE_MAX_LEN 50
+#define LYNQ_PDP_ADDR_MAX_LEN 64
+#define LYNQ_DNS_ADDR_MAX_LEN 256
+#define LYNQ_GETWAYS_ADDR_MAX_LEN 64
+#define LYNQ_POXY_ADDR_MAX_LEN 64
+
+
+typedef struct {
+ int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */
+ int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry
+ back-off timer value RIL wants to override the one
+ pre-configured in FW.
+ The unit is miliseconds.
+ The value < 0 means no value is suggested.
+ The value 0 means retry should be done ASAP.
+ The value of INT_MAX(0x7fffffff) means no retry. */
+ int cid; /* Context ID, uniquely identifies this call */
+ int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
+ char type[LYNQ_PDP_TYPE_MAX_LEN]; /* One of the PDP_type values in TS 27.007 section 10.1.1.
+ For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is
+ PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported
+ such as "IP" or "IPV6" */
+ char ifname[LYNQ_IFACE_NAME_MAX_LEN]; /* The network interface name */
+ char addresses[LYNQ_PDP_ADDR_MAX_LEN]; /* A space-delimited list of addresses with optional "/" prefix length,
+ e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64".
+ May not be empty, typically 1 IPv4 or 1 IPv6 or
+ one of each. If the prefix length is absent the addresses
+ are assumed to be point to point with IPv4 having a prefix
+ length of 32 and IPv6 128. */
+ char dnses[LYNQ_DNS_ADDR_MAX_LEN]; /* A space-delimited list of DNS server addresses,
+ e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
+ May be empty. */
+ char gateways[LYNQ_GETWAYS_ADDR_MAX_LEN]; /* A space-delimited list of default gateway addresses,
+ e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
+ May be empty in which case the addresses represent point
+ to point connections. */
+ char pcscf[LYNQ_POXY_ADDR_MAX_LEN]; /* the Proxy Call State Control Function address
+ via PCO(Protocol Configuration Option) for IMS client. */
+ int mtu; /* MTU received from network
+ Value <= 0 means network has either not sent a value or
+ sent an invalid value */
+} lynq_data_call_response_v11_t;
+
+typedef struct
+{
+ int index;
+ char apn[LYNQ_APN_MAX_LEN];
+ char apnType[LYNQ_APN_TYPE_MAX_LEN];
+}lynq_apn_info;
+
+int lynq_init_data(int uToken);
+int lynq_deinit_data();
+int lynq_setup_data_call(int *handle);
+int lynq_deactive_data_call(int *handle);
+int lynq_setup_data_call_sp(int *handle,char *apn,char *apnType,char *user,char *password,char *authType,char *normalProtocol,char *roamingProtocol);
+int lynq_setup_data_call_sp_t106(int *handle,char *apn,char *apnType,char *user,char *password,char *authType,char *normalProtocol,char *roamingProtocol);
+//int lynq_deactive_data_call_sp(int *handle,char *apnType);
+int lynq_get_data_call_list(int *handle,lynq_data_call_response_v11_t *dataCallList);
+int lynq_wait_data_call_state_change(int *handle);
+int lynq_modify_apn_db(const int cmd,char *id,char *mcc,char *mnc,char *apn,char *apntype,char *user,char *password,char *normalprotocol,char *roamingprotocol,char *carrier,char *out);
+int lynq_reset_apn(char *result);
+int lynq_get_apn_table(int *size,lynq_apn_info **list);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
new file mode 100755
index 0000000..eb566f4
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
@@ -0,0 +1,1980 @@
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <binder/Parcel.h>
+#include <log/log.h>
+#include "lynq_data.h"
+#include <cutils/jstring.h>
+#include <pthread.h>
+#include "liblog/lynq_deflog.h"
+#include <sys/time.h>
+#include <include/lynq_uci.h>
+#include <errno.h>
+#include <vector>
+#include "lynq_data_urc.h"
+
+#define LYNQ_SERVICE_PORT 8088
+#define LYNQ_REC_BUF 8192
+#define LYNQ_REQUEST_PARAM_BUF 8192
+#define LYQN_SEDN_BUF 1024*8+sizeof(int)*3
+#define USER_LOG_TAG "LYNQ_DATA"
+
+#define LYNQ_DATA_UCI_BUF 258
+
+#define LYNQ_ADDRESS "127.0.0.1"
+
+using ::android::Parcel;
+typedef struct{
+ int uToken;
+ int request;
+ int paramLen;
+ char param[LYNQ_REQUEST_PARAM_BUF];
+}lynq_client_t;
+typedef enum{
+ LYNQ_E_CARDSTATE_ERROR=8000,
+ /* The voice service state is out of service*/
+ LYNQ_E_STATE_OUT_OF_SERVICE=8001,
+ /* The voice service state is EMERGENCY_ONLY*/
+ LYNQ_E_STATE_EMERGENCY_ONLY=8002,
+ /* The radio power is power off*/
+ LYNQ_E_STATE_POWER_OFF=8003,
+ LYNQ_E_TIME_OUT=8004,
+ /*create or open sms DB fail */
+ LYNQ_E_SMS_DB_FAIL=8005,
+ /*Failed to execute sql statement*/
+ LYNQ_E_SMS_SQL_FAIL = 8006,
+ LYNQ_E_SMS_NOT_FIND = 8007,
+ /* The logic conflict*/
+ LYNQ_E_CONFLICT=9000,
+ /*Null anomaly*/
+ LYNQ_E_NULL_ANONALY=9001
+}LYNQ_E;
+
+int lynq_client_sockfd = 0;
+int Global_uToken = 0;
+struct sockaddr_in lynq_data_socket_server_addr;
+int lynq_data_socket_server_addr_len;
+
+int lynq_data_call_change_id = -1;
+pthread_t lynq_data_tid =-1;
+static pthread_mutex_t s_data_call_state_change_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t s_data_call_state_change_cond = PTHREAD_COND_INITIALIZER;
+
+static pthread_mutex_t s_lynq_apn_change_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t s_lynq_apn_change_cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t s_lynq_urc_vector_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t s_lynq_urc_vector_cond = PTHREAD_COND_INITIALIZER;
+/**g_lynq_data_sendto_mutex
+* @brief mark data send request mutex
+*/
+static pthread_mutex_t g_lynq_data_sendto_mutex;
+/*This value data the state of the wait*/
+static int data_waiting_status = 0;
+/*The value indicates that 8085 error occurs in data*/
+static int data_invaild_error = 0;
+/*This value ensure the data call timing is correct*/
+static int data_timelimit = 0;
+
+/**g_lynq_data_init_flag
+* @brief mark data initialization state
+* 0:deinit status
+* 1:init state
+*/
+static int g_lynq_data_init_flag = 0;
+/**g_lynq_apn_result
+* @brief temp of apn result info
+*/
+char g_lynq_apn_result[1024] = {};
+
+static std::vector<int> s_data_urc_wait_list;
+
+typedef struct
+{
+ char apn[LYNQ_APN_MAX_LEN];
+ char apnType[LYNQ_APN_TYPE_MAX_LEN];
+ char ifaceName[LYNQ_IFACE_NAME_MAX_LEN];
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ int cid;
+#endif
+ int status;
+ char statusApnType[LYNQ_APN_TYPE_MAX_LEN];
+ int hasUsed;
+ int hasTimeout;
+}lynq_apn_t;
+lynq_apn_t lynq_apn_table[LYNQ_APN_CHANNEL_MAX] = {};
+lynq_data_call_response_v11_t lynq_data_call_lists[LYNQ_APN_CHANNEL_MAX] = {};
+int lynq_data_call = 0;
+
+int getLynqApnID(char apnType[])
+{
+ int ret = 0;
+ int len = 0;
+ for(ret;ret<LYNQ_APN_CHANNEL_MAX;ret++)
+ {
+ len = strlen(apnType);
+ LYINFLOG("apn_table[%d].apnType:%s,input apntype:%s,len:%d",ret,lynq_apn_table[ret].apnType,apnType,len);
+ if(strncmp(lynq_apn_table[ret].apnType,apnType,len)==0)
+ {
+ return ret;
+ }
+ }
+ return -1;
+}
+
+int getDeactApnID(char apnType[])
+{
+ int ret = 0;
+ int len = 0;
+ for(ret;ret<LYNQ_APN_CHANNEL_MAX;ret++)
+ {
+ len = strlen(apnType);
+ LYINFLOG("apn_table[%d].apnType:%s,input apntype:%s,len:%d",ret,lynq_apn_table[ret].apnType,apnType,len);
+ if(strncmp(lynq_apn_table[ret].statusApnType,apnType,len)==0)
+ {
+ return ret;
+ }
+ }
+ return -1;
+}
+
+void updateApnTable(lynq_apn_t *apn_table,char apn[],char apntype[],char ifaceName[])
+{
+ LYDBGLOG("[updateApnTable] apn:%s,apntype:%s,ifaceName:%s",apn,apntype,ifaceName);
+ if(apn_table==NULL)
+ {
+ LYERRLOG("apn_table is null");
+ return;
+ }
+ memcpy(apn_table->apn,apn,strlen(apn)+1);
+ memcpy(apn_table->apnType,apntype,strlen(apntype)+1);
+ memcpy(apn_table->ifaceName,ifaceName,strlen(ifaceName)+1);
+ apn_table->hasTimeout = 0;
+ apn_table->hasUsed = 1;
+ return;
+}
+
+void cleanOnceApnTable(int apnId)
+{
+ LYDBGLOG("%s:apn id:%d",__FUNCTION__,apnId);
+ if((apnId < 0) || (apnId > LYNQ_APN_CHANNEL_MAX-1))
+ {
+ LYERRLOG("apn id is invalid!!!");
+ return;
+ }
+ lynq_apn_table[apnId].hasTimeout = 0;
+ lynq_apn_table[apnId].hasUsed = 0;
+ memcpy(lynq_apn_table[apnId].statusApnType,lynq_apn_table[apnId].apnType,strlen(lynq_apn_table[apnId].apnType));
+ bzero(lynq_apn_table[apnId].apn,LYNQ_APN_MAX_LEN);
+ bzero(lynq_apn_table[apnId].apnType,LYNQ_APN_TYPE_MAX_LEN);
+ bzero(lynq_apn_table[apnId].ifaceName,LYNQ_IFACE_NAME_MAX_LEN);
+ lynq_apn_table[apnId].status = 32;
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ lynq_apn_table[apnId].cid = 0;
+#endif
+ return;
+}
+void cleanDeactApn(int apnId)
+{
+ LYDBGLOG("%s:apn id:%d",__FUNCTION__,apnId);
+ if((apnId < 0) || (apnId > LYNQ_APN_CHANNEL_MAX-1))
+ {
+ LYERRLOG("apn id is invalid!!!");
+ return;
+ }
+ lynq_apn_table[apnId].status = 0;
+ bzero(lynq_apn_table[apnId].statusApnType,LYNQ_APN_TYPE_MAX_LEN);
+}
+
+void updateDeactApn(int apnId,int pdnState)
+{
+ LYDBGLOG("%s:apn id:%d",__FUNCTION__,apnId);
+ if((apnId < 0) || (apnId > LYNQ_APN_CHANNEL_MAX-1))
+ {
+ LYERRLOG("apn id is invalid!!!");
+ return;
+ }
+ lynq_apn_table[apnId].status = pdnState;
+}
+
+
+int getUnusedElement()
+{
+ if (lynq_apn_table == NULL)
+ {
+ LYERRLOG("get UnusedElemnt apn_table is null");
+ return -1;
+ }
+ for(int i=0;i < LYNQ_APN_CHANNEL_MAX; i++)
+ {
+ if(lynq_apn_table[i].hasUsed!=1)
+ {
+ return i;
+ }
+ }
+ LYERRLOG("None of get unused Element");
+ return -1;
+}
+int updateApn(char apnType[])
+{
+ int ret = 0;
+ ret = getUnusedElement();
+ if(ret >= 0)
+ {
+ memcpy(lynq_apn_table[ret].apnType,apnType,strlen(apnType)+1);
+ lynq_apn_table[ret].hasUsed = 1;
+ }
+ return ret;
+}
+//xf.li@20230610 add for T106 data start
+int findCidInTable(int cid)
+{
+ int i = 0;
+ for(i = 0;i < LYNQ_APN_CHANNEL_MAX; i++)
+ {
+ if(lynq_apn_table[i].cid == cid)
+ {
+ LYERRLOG("has exit this cid %d in slot %d\n", cid, i);
+ return i;
+ }
+ }
+ return -1;
+}
+//xf.li@20230610 add for T106 data end
+int handleCheck(int handle)
+{
+ if (lynq_apn_table[handle].hasUsed == 1)
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+int waitApnResult()
+{
+ int ret = 0;
+ LYINFLOG("start wait apn result!!!");
+ int sec = 0;
+ int usec = 0;
+ struct timeval now;
+ struct timespec timeout;
+ gettimeofday(&now, NULL);
+ sec = 20000 / 1000;
+ usec = 20000 % 1000;
+ timeout.tv_sec = now.tv_sec + sec;
+ timeout.tv_nsec = now.tv_usec * 1000 + usec * 1000000;
+ pthread_mutex_lock(&s_lynq_apn_change_mutex);
+ ret = pthread_cond_timedwait(&s_lynq_apn_change_cond, &s_lynq_apn_change_mutex, &timeout);
+ pthread_mutex_unlock(&s_lynq_apn_change_mutex);
+ return ret;
+}
+
+void sendSignalApnChange()
+{
+ LYINFLOG("start send Signal Apn Change");
+ pthread_mutex_lock(&s_lynq_apn_change_mutex);
+ pthread_cond_signal(&s_lynq_apn_change_cond);
+ pthread_mutex_unlock(&s_lynq_apn_change_mutex);
+ return;
+}
+
+int waitPdnChange()
+{
+ int ret = 0;
+ pthread_mutex_lock(&s_lynq_urc_vector_mutex);
+ ret = pthread_cond_wait(&s_lynq_urc_vector_cond,&s_lynq_urc_vector_mutex);
+ pthread_mutex_unlock(&s_lynq_urc_vector_mutex);
+ return ret;
+}
+int waitDataCallstateChange(int mtime)
+{
+ int ret = 0;
+ int sec = 0;
+ int usec = 0;
+ struct timeval now;
+ struct timespec timeout;
+ gettimeofday(&now,NULL);
+ sec = mtime/1000;
+ usec = mtime%1000;
+ timeout.tv_sec = now.tv_sec+sec;
+ timeout.tv_nsec = now.tv_usec*1000+usec*1000000;
+ pthread_mutex_lock(&s_data_call_state_change_mutex);
+ ret = pthread_cond_timedwait(&s_data_call_state_change_cond,&s_data_call_state_change_mutex,&timeout);
+ pthread_mutex_unlock(&s_data_call_state_change_mutex);
+ return ret;
+}
+void sendSignalDataCallStateChange()
+{
+ pthread_mutex_lock(&s_data_call_state_change_mutex);
+ pthread_cond_signal(&s_data_call_state_change_cond);
+ pthread_mutex_unlock(&s_data_call_state_change_mutex);
+ return;
+}
+void sendSignalPdnChange()
+{
+ pthread_mutex_lock(&s_lynq_urc_vector_mutex);
+ pthread_cond_signal(&s_lynq_urc_vector_cond);
+ pthread_mutex_unlock(&s_lynq_urc_vector_mutex);
+ return;
+}
+
+int get_response(int sockfd,Parcel &p)
+{
+ int len = 0;
+ char recvline[LYNQ_REC_BUF];
+ bzero(recvline,LYNQ_REC_BUF);
+ /* receive data from server */
+ len = recvfrom(sockfd,recvline,LYNQ_REC_BUF,0,(struct sockaddr *)&lynq_data_socket_server_addr,(socklen_t *)&lynq_data_socket_server_addr_len);
+ //len = read(sockfd, recvline, LYNQ_REC_BUF);
+ if(len == -1)
+ {
+ LYERRLOG("get_response fail,errno:%d",errno);
+ return -1;
+ }
+ if (recvline != NULL) {
+ p.setData((uint8_t *)recvline,len); // p.setData((uint8_t *) buffer, buflen);
+ p.setDataPosition(0);
+ }
+ return 0;
+}
+int JumpHeader(Parcel &p,int *resp_type,int *request,int *slot_id,int *error)
+{
+ if(p.dataAvail() > 0)
+ {
+ p.readInt32(resp_type);
+ p.readInt32(request);
+ p.readInt32(slot_id);
+ p.readInt32(error);
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+int send_request(int sockfd,lynq_client_t *client_tmp)
+{
+ int ret=0;
+ ret = write(sockfd, client_tmp, LYQN_SEDN_BUF);
+ if(ret==-1)
+ {
+ perror("write error");
+ return -1;
+ }
+ return 0;
+}
+static char *strdupReadString(Parcel &p) {
+ size_t stringlen;
+ const char16_t *s16;
+ s16 = p.readString16Inplace(&stringlen);
+ return strndup16to8(s16, stringlen);
+}
+static char *strdupReadString_p(Parcel *p) {
+ size_t stringlen;
+ const char16_t *s16;
+ s16 = p->readString16Inplace(&stringlen);
+ return strndup16to8(s16, stringlen);
+}
+
+/*Warren add for T800 platform 2021/11/19 start*/
+int lynq_socket_client_start()
+{
+ /* init lynq_socket_server_addr */
+ bzero(&lynq_data_socket_server_addr, sizeof(lynq_data_socket_server_addr));
+ lynq_data_socket_server_addr.sin_family = AF_INET;
+ lynq_data_socket_server_addr.sin_port = htons(LYNQ_SERVICE_PORT);
+ lynq_data_socket_server_addr.sin_addr.s_addr = inet_addr(LYNQ_ADDRESS);
+ lynq_data_socket_server_addr_len = sizeof(lynq_data_socket_server_addr);
+ /*
+ if(inet_pton(AF_INET,"127.0.0.1", &lynq_socket_server_addr.sin_addr) <= 0)
+ {
+ LYINFLOG("[%s] is not a valid IPaddress\n", argv[1]);
+ exit(1);
+ }
+*/
+ lynq_client_sockfd = socket(AF_INET, SOCK_DGRAM, 0);
+ struct timeval timeOut;
+
+ timeOut.tv_sec = 30;
+ timeOut.tv_usec = 0;
+
+ if (setsockopt(lynq_client_sockfd, SOL_SOCKET, SO_RCVTIMEO, &timeOut, sizeof(timeOut)) < 0)
+ {
+ LYERRLOG("time out setting failed");
+ }
+ if(connect(lynq_client_sockfd, (struct sockaddr *)&lynq_data_socket_server_addr, sizeof(lynq_data_socket_server_addr)) == -1)
+ {
+ perror("connect error");
+ return -1;
+ }
+ return 0;
+}
+
+bool is_support_urc(int urc_id)
+{
+ switch(urc_id)
+ {
+ case LYNQ_URC_DATA_CALL_STATUS_IND:
+
+ case LYNQ_URC_MODIFY_APNDB:
+ case LYNQ_URC_RESET_APNDB:
+ return true;
+ default:
+ return false;
+ }
+}
+//xf.li@20230610 add for T106 data start
+bool is_support_urc_t106(int urc_id)
+{
+ switch(urc_id)
+ {
+ case RIL_UNSOL_DATA_CALL_LIST_CHANGED:
+ case LYNQ_URC_MODIFY_APNDB:
+ case LYNQ_URC_RESET_APNDB:
+ return true;
+ default:
+ return false;
+ }
+}
+//xf.li@20230610 add for T106 data end
+int printf_apn_table()
+{
+ int ret = 0;
+ if (lynq_apn_table == NULL)
+ {
+ LYERRLOG("apn table is null");
+ return -1;
+ }
+ for(ret;ret<LYNQ_APN_CHANNEL_MAX;ret++)
+ {
+ //xf.li@20230610 add for T106 data start
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ LYINFLOG("[Typethree test info]apn=%s ;apntype=%s ;cid=%d ;ifname=%s ;hasTimeout = %d ; hasUsed = %d", \
+ lynq_apn_table[ret].apn,lynq_apn_table[ret].apnType,lynq_apn_table[ret].cid,lynq_apn_table[ret].ifaceName, \
+ lynq_apn_table[ret].hasTimeout,lynq_apn_table[ret].hasUsed);
+#else
+ LYINFLOG("[%s][%d] apn=%s ;apntype=%s ;ifname=%s ;hasTimeout = %d ; hasUsed = %d,status = %d,statusDeactApn = %s",__FUNCTION__,ret, \
+ lynq_apn_table[ret].apn,lynq_apn_table[ret].apnType,lynq_apn_table[ret].ifaceName, \
+ lynq_apn_table[ret].hasTimeout,lynq_apn_table[ret].hasUsed,lynq_apn_table[ret].status,lynq_apn_table[ret].statusApnType);
+#endif
+ //xf.li@20230610 add for T106 data end
+ }
+ return 0;
+}
+//xf.li@20230607 add for T106 data start
+void urc_msg_process_add_for_t106(Parcel *p)
+{
+ int len;
+ int resp_type;
+ int urcid;
+ int slot_id;
+ int check_count = 0;
+
+ int version = -1;
+ int num = -1;
+ int status = -1;
+ int suggestedRetryTime = -1;
+ int cid = -1;
+ int active = -1;
+ int mtu = -1;
+
+ int pdnState = 0;
+ char apn[LYNQ_APN_MAX_LEN];
+ char apnType[LYNQ_APN_TYPE_MAX_LEN];
+ char ifaceName[LYNQ_IFACE_NAME_MAX_LEN];
+ char type[LYNQ_TYPE_MAX_LEN];
+ char addresses[LYNQ_ADDRESSES_MAX_LEN];
+ char dnses[LYNQ_DNSES_MAX_LEN];
+ char gateways[LYNQ_GATEWAYS_MAX_LEN];
+ char pcscf[LYNQ_PCSCF_MAX_LEN];
+
+ int cid_list[LYNQ_APN_CHANNEL_MAX] = {-1};
+ int cid_index = 0;
+ int j = 0;
+ char *urc_msg = NULL;
+
+ LYINFLOG("DATA in urc_msg_process_add_for_t106\n");
+ int size = p->dataSize();
+ p->readInt32(&resp_type);
+ p->readInt32(&urcid);
+ p->readInt32(&slot_id);
+ LYINFLOG("data lib recv urc:resp_type=%d,urcid=%d,slot_id=%d,size=%d\n",resp_type,urcid,slot_id,size);
+ switch(urcid)
+ {
+ case RIL_UNSOL_DATA_CALL_LIST_CHANGED:
+ LYINFLOG("LIBLYNQ_DATA receive RIL_UNSOL_DATA_CALL_LIST_CHANGED\n");
+ p->readInt32(&version);
+ p->readInt32(&num);
+ /* update apn start*/
+ for(int i = 0; i < num; i++)
+ {
+ bzero(type,LYNQ_TYPE_MAX_LEN);
+ bzero(ifaceName,LYNQ_IFACE_NAME_MAX_LEN);
+ bzero(addresses,LYNQ_ADDRESSES_MAX_LEN);
+ bzero(dnses,LYNQ_DNSES_MAX_LEN);
+ bzero(gateways,LYNQ_GATEWAYS_MAX_LEN);
+ bzero(pcscf,LYNQ_PCSCF_MAX_LEN);
+
+ p->readInt32(&status);
+ p->readInt32(&suggestedRetryTime);
+ p->readInt32(&cid);
+ p->readInt32(&active);
+
+ cid_list[cid_index] = cid;
+ cid_index++;
+
+ urc_msg = strdupReadString_p(p);
+ int len = strlen(urc_msg);
+ if(len < LYNQ_TYPE_MAX_LEN-1)
+ {
+ memcpy(type,urc_msg,len+1);
+ }
+ free(urc_msg);
+ urc_msg = strdupReadString_p(p);
+ len = strlen(urc_msg);
+ if(len < LYNQ_IFACE_NAME_MAX_LEN-1)
+ {
+ memcpy(ifaceName,urc_msg,len+1);
+ }
+ free(urc_msg);
+ urc_msg = strdupReadString_p(p);
+ len = strlen(urc_msg);
+ if(len < LYNQ_ADDRESSES_MAX_LEN-1)
+ {
+ memcpy(addresses,urc_msg,strlen(urc_msg)+1);
+ }
+ free(urc_msg);
+ urc_msg = strdupReadString_p(p);
+ len = strlen(urc_msg);
+ if(len < LYNQ_DNSES_MAX_LEN-1)
+ {
+ memcpy(dnses,urc_msg,strlen(urc_msg)+1);
+ }
+ free(urc_msg);
+ urc_msg = strdupReadString_p(p);
+ len = strlen(urc_msg);
+ if(len < LYNQ_GATEWAYS_MAX_LEN-1)
+ {
+ memcpy(gateways,urc_msg,strlen(urc_msg)+1);
+ }
+ free(urc_msg);
+ urc_msg = strdupReadString_p(p);
+ len = strlen(urc_msg);
+ if(len < LYNQ_PCSCF_MAX_LEN-1)
+ {
+ memcpy(pcscf,urc_msg,strlen(urc_msg)+1);
+ }
+ free(urc_msg);
+ p->readInt32(&mtu);
+ /*
+ //update the lynq_apn_table start
+ int apnId = getLynqApnID(apnType);
+ LYINFLOG("URC apnType:%s,ifaceName:%s,apn:%s pdnState:%d",apnType,ifaceName,apn,pdnState);
+ if(apnId >= 0)
+ {
+ updateApnTable(&lynq_apn_table[apnId],apn,apnType,ifaceName);
+ }
+
+ pthread_mutex_lock(&s_lynq_urc_vector_mutex);
+ s_data_urc_wait_list.push_back(apnId);
+ pthread_mutex_unlock(&s_lynq_urc_vector_mutex);
+ lynq_data_call_change_id = apnId;
+ sendSignalPdnChange();
+ LYDBGLOG("data call state:%d",lynq_data_call);
+ //update the lynq_apn_table completed
+ */
+ }
+ /* update apn end*/
+
+ /*delete apn start*/
+ for(int i = 0; i < LYNQ_APN_CHANNEL_MAX; i++)
+ {
+ if( lynq_apn_table[i].hasUsed != 1)
+ {
+ continue;
+ }
+ for(j = 0; j < num ; j++)
+ {
+ if(cid_list[j] == lynq_apn_table[i].cid)
+ {
+ LYINFLOG("lynq_apn_table[%d], cid = &d, needn't delete\n",i, lynq_apn_table[i].cid);
+ break;
+ }
+ }
+ if(j == num)
+ {
+ LYINFLOG("need delete lynq_apn_table[%d]\n", i);
+ bzero(lynq_apn_table[i].apnType,LYNQ_APN_TYPE_MAX_LEN);//async clean
+ lynq_apn_table[i].hasUsed = 0;
+ lynq_apn_table[i].cid = 0;
+ pthread_mutex_lock(&s_lynq_urc_vector_mutex);
+ s_data_urc_wait_list.push_back(i);
+ pthread_mutex_unlock(&s_lynq_urc_vector_mutex);
+ sendSignalPdnChange();
+ }
+ }
+ /*delete apn end*/
+ LYINFLOG("update lynq_apn_table end\n");
+ printf_apn_table();
+ break;
+
+ case LYNQ_URC_MODIFY_APNDB:
+ urc_msg = strdupReadString_p(p);
+ if (NULL == urc_msg)
+ {
+ LYERRLOG("error apn msg");
+ }
+ else
+ {
+ bzero(g_lynq_apn_result, 1024);
+ strcpy(g_lynq_apn_result, urc_msg);
+ sendSignalApnChange();
+ }
+ break;
+ case LYNQ_URC_RESET_APNDB:
+ {
+ urc_msg = strdupReadString_p(p);
+ if (NULL == urc_msg)
+ {
+ LYERRLOG("error apn msg");
+ }
+ else
+ {
+ bzero(g_lynq_apn_result, 1024);
+ strcpy(g_lynq_apn_result, urc_msg);
+ sendSignalApnChange();
+ }
+ }
+ default:
+ break;
+ }
+
+}
+//xf.li@20230607 add for T106 data end
+void printf_apn_table_debug(const char *fun,int line)
+{
+ LYINFLOG("[%s][%d]apn_table msg",fun,line);
+ printf_apn_table();
+}
+void urc_msg_process(Parcel *p)
+{
+ int len;
+ int resp_type;
+ int urcid;
+ int slot_id;
+ int check_count = 0;
+ static int apnId=-1;
+
+ int pdnState = 0;
+ char apn[LYNQ_APN_MAX_LEN];
+ char apnType[LYNQ_APN_TYPE_MAX_LEN];
+ char ifaceName[LYNQ_IFACE_NAME_MAX_LEN];
+ char *urc_msg = NULL;
+
+ int size = p->dataSize();
+ p->readInt32(&resp_type);
+ p->readInt32(&urcid);
+ p->readInt32(&slot_id);
+ LYINFLOG("data lib recv urc:resp_type=%d,urcid=%d,slot_id=%d,size=%d\n",resp_type,urcid,slot_id,size);
+ switch(urcid)
+ {
+ case LYNQ_URC_DATA_CALL_STATUS_IND:
+ p->readInt32(&pdnState);
+ bzero(apn,LYNQ_APN_MAX_LEN);
+ bzero(apnType,LYNQ_APN_TYPE_MAX_LEN);
+ bzero(ifaceName,LYNQ_IFACE_NAME_MAX_LEN);
+ if(pdnState!=4)//PDN_DISCONNECTED
+ {
+ urc_msg = strdupReadString_p(p);
+ int len = strlen(urc_msg);
+ if((len < LYNQ_APN_MAX_LEN-1) && (len > 0))
+ {
+ memcpy(apn,urc_msg,len+1);
+ }
+ free(urc_msg);
+ urc_msg = strdupReadString_p(p);
+ len = strlen(urc_msg);
+ if((len < LYNQ_APN_TYPE_MAX_LEN-1) && (len > 0))
+ {
+ memcpy(apnType,urc_msg,len+1);
+ }
+ free(urc_msg);
+ urc_msg = strdupReadString_p(p);
+ len = strlen(urc_msg);
+ if((len < LYNQ_IFACE_NAME_MAX_LEN-1) && (len > 0))
+ {
+ memcpy(ifaceName,urc_msg,strlen(urc_msg)+1);
+ }
+ free(urc_msg);
+ //sendSignalDataCallStateChange();
+ apnId = getLynqApnID(apnType);
+ if(apnId >= 0)
+ {
+ LYINFLOG("URC apnType:%s,ifaceName:%s,apn:%s pdnState:%d,handle:%d",apnType,ifaceName,apn,pdnState,apnId);
+ if(lynq_apn_table[apnId].hasTimeout==1)
+ {
+ /*whether timeout?,real or not,*/
+ printf_apn_table();
+ LYERRLOG("apn:%s has time out,deacive this apn",lynq_apn_table[apnId].apn);
+ if (NULL != lynq_apn_table[apnId].apn && NULL != lynq_apn_table[apnId].apnType && strlen(lynq_apn_table[apnId].apn)>0)
+ {
+ LYERRLOG("deactive this time out APN");
+ lynq_deactive_data_call(&apnId);
+ }
+ else
+ {
+ /*if apn lose,update apn and deactive all apn*/
+ LYERRLOG("this table is invalid update APN table");
+ }
+ break;
+ }
+ updateApnTable(&lynq_apn_table[apnId],apn,apnType,ifaceName);
+ printf_apn_table_debug(__FUNCTION__,__LINE__);
+ }
+ /*To be completed*/
+ else
+ {
+ data_invaild_error = 1;
+ printf_apn_table_debug(__FUNCTION__,__LINE__);
+ apnId = getDeactApnID(apnType);
+ if(apnId < 0)
+ {
+ LYERRLOG("[%d]invalid apnId:%d",__LINE__,apnId);
+ break;
+ }
+ LYINFLOG("URC apnType:%s,ifaceName:%s,apn:%s pdnState:%d,handle:%d",apnType,ifaceName,apn,pdnState,apnId);
+ updateDeactApn(apnId,pdnState);
+ printf_apn_table_debug(__FUNCTION__,__LINE__);
+ }
+ pthread_mutex_lock(&s_lynq_urc_vector_mutex);
+ s_data_urc_wait_list.push_back(apnId);
+ pthread_mutex_unlock(&s_lynq_urc_vector_mutex);
+ lynq_data_call_change_id = apnId;
+ sendSignalPdnChange();
+ LYDBGLOG("data call state:%d",lynq_data_call);
+ if(lynq_data_call==1)
+ {
+ while (data_timelimit == 0)
+ {
+ LYINFLOG("client not ready to wait");
+ for (check_count = 0;check_count < 500;check_count++)
+ {
+ /*wait 10ms*/
+ usleep(10*1000);
+ }
+ LYERRLOG("client still without res");
+ break;
+ }
+ sendSignalDataCallStateChange();
+ lynq_data_call = 0;
+ data_timelimit = 0;
+ }
+ printf_apn_table_debug(__FUNCTION__,__LINE__);
+ }
+ else
+ {
+ urc_msg = strdupReadString_p(p);
+ free(urc_msg);
+ urc_msg = strdupReadString_p(p);
+ len = strlen(urc_msg);
+ if(len < LYNQ_APN_TYPE_MAX_LEN-1)
+ {
+ memcpy(apnType,urc_msg,len+1);
+ }
+ free(urc_msg);
+ LYDBGLOG("[data thread_urc_recv] apntype:%s",apnType);
+ apnId = getLynqApnID(apnType);
+ if(apnId >= 0)
+ {
+ LYINFLOG("URC apnType:%s,ifaceName:%s,apn:%s pdnState:%d,handle:%d",apnType,ifaceName,apn,pdnState,apnId);
+ lynq_data_call_change_id = apnId;
+ //bzero(lynq_apn_table[apnId].apnType,LYNQ_APN_TYPE_MAX_LEN);//async clean
+ pthread_mutex_lock(&s_lynq_urc_vector_mutex);
+ s_data_urc_wait_list.push_back(apnId);
+ pthread_mutex_unlock(&s_lynq_urc_vector_mutex);
+ sendSignalPdnChange();
+ }
+ else
+ {
+ apnId = getDeactApnID(apnType);
+ if(apnId < 0)
+ {
+ LYERRLOG("[%d]invalid apnId:%d",__LINE__,apnId);
+ break;
+ }
+ LYINFLOG("URC apnType:%s,ifaceName:%s,apn:%s pdnState:%d,handle:%d",apnType,ifaceName,apn,pdnState,apnId);
+ cleanDeactApn(apnId);
+ lynq_data_call_change_id = apnId;
+ bzero(lynq_apn_table[apnId].apnType,LYNQ_APN_TYPE_MAX_LEN);//async clean
+ pthread_mutex_lock(&s_lynq_urc_vector_mutex);
+ s_data_urc_wait_list.push_back(apnId);
+ pthread_mutex_unlock(&s_lynq_urc_vector_mutex);
+ sendSignalPdnChange();
+ printf_apn_table_debug(__FUNCTION__,__LINE__);
+ }
+ LYDBGLOG("data call state:%d",lynq_data_call);
+ if(lynq_data_call==1)
+ {
+ while (data_timelimit == 0)
+ {
+ LYINFLOG("client not ready to wait");
+ for (check_count = 0;check_count < 500;check_count++)
+ {
+ /*wait 10ms*/
+ usleep(10*1000);
+ }
+ LYERRLOG("client still without res");
+ break;
+ }
+ sendSignalDataCallStateChange();
+ lynq_data_call = 0;
+ data_timelimit = 0;
+ }
+ printf_apn_table_debug(__FUNCTION__,__LINE__);
+ }
+ break;
+ case LYNQ_URC_MODIFY_APNDB:
+ urc_msg = strdupReadString_p(p);
+ if (NULL == urc_msg)
+ {
+ LYERRLOG("error apn msg");
+ }
+ else
+ {
+ bzero(g_lynq_apn_result, 1024);
+ strcpy(g_lynq_apn_result, urc_msg);
+ sendSignalApnChange();
+ }
+ free(urc_msg);
+ break;
+ case LYNQ_URC_RESET_APNDB:
+ {
+ urc_msg = strdupReadString_p(p);
+ if (NULL == urc_msg)
+ {
+ LYERRLOG("error apn msg");
+ }
+ else
+ {
+ bzero(g_lynq_apn_result, 1024);
+ strcpy(g_lynq_apn_result, urc_msg);
+ sendSignalApnChange();
+ }
+ free(urc_msg);
+ }
+ default:
+ break;
+ }
+
+}
+
+int create_urc_vector_signal_thread()
+{
+ int ret;
+ pthread_mutex_init(&s_lynq_urc_vector_mutex,NULL);
+ pthread_mutex_lock(&s_lynq_urc_vector_mutex);
+ s_data_urc_wait_list.clear();
+ pthread_mutex_unlock(&s_lynq_urc_vector_mutex);
+ return 0;
+}
+
+int lynq_init_data(int uToken)
+{
+ if (g_lynq_data_init_flag == 1)
+ {
+ LYERRLOG("init twice is not allowed");
+ return -1;
+ }
+ g_lynq_data_init_flag = 1;
+ int result = 0;
+ Global_uToken = uToken;
+ LYLOGSET(LOG_INFO);
+ LYLOGEINIT(USER_LOG_TAG);
+ result = lynq_socket_client_start();
+ pthread_mutex_init(&g_lynq_data_sendto_mutex, NULL);
+ if(result!=0)
+ {
+ LYERRLOG("init socket client fail!!!");
+ return -1;
+ }
+ result = lynq_init_data_urc_thread();
+ if(result!=0)
+ {
+ LYERRLOG("init socket urc fail!!!");
+ return -1;
+ }
+
+ result = create_urc_vector_signal_thread();
+ if(result!=0)
+ {
+ LYERRLOG("init socket urc fail!!!");
+ return -1;
+ }
+ memset(lynq_apn_table,0,sizeof(lynq_apn_table));
+ LYDBGLOG("lynq init call success!!!");
+ return 0;
+
+}
+int lynq_deinit_data()
+{
+ int ret = -1;
+ if (g_lynq_data_init_flag == 0)
+ {
+ LYERRLOG("deinit twice is not allowed");
+ return ret;
+ }
+ g_lynq_data_init_flag = 0;
+ for(int i =0;i<LYNQ_APN_CHANNEL_MAX;i++)
+ {
+ if(strlen(lynq_apn_table[i].apnType)!=0)
+ {
+ lynq_deactive_data_call(&i);
+ }
+ }
+ if(lynq_client_sockfd>0)
+ {
+ close(lynq_client_sockfd);
+ }
+ ret = lynq_deinit_data_urc_thread();
+ if (ret != 0)
+ {
+ LYERRLOG("lynq_deinit_data_urc_thread fail");
+ return ret;
+ }
+ pthread_mutex_lock(&s_lynq_urc_vector_mutex);
+ s_data_urc_wait_list.clear();
+ pthread_mutex_unlock(&s_lynq_urc_vector_mutex);
+ return 0;
+}
+int lynq_setup_data_call(int *handle)
+{
+ int error = -1;
+ //xf.li@20230610 add for T106 data start
+ #ifdef MOBILETEK_TARGET_PLATFORM_T106
+ LYINFLOG("[%s][%d] call lynq_setup_data_call_sp",__FUNCTION__,__LINE__);
+ error = lynq_setup_data_call_sp_t106(handle,NULL,"iot_default",NULL,NULL,NULL,NULL,NULL);
+ return error;
+ #else
+ //xf.li@20230610 add for T106 data end
+ #ifdef GSW_RIL_CFG //becuase gsw not have connman,data can not be triggered by connman.
+ LYINFLOG("[%s][%d]",__FUNCTION__,__LINE__);
+ error = lynq_setup_data_call_sp(handle,NULL,"iot_default",NULL,NULL,NULL,NULL,NULL);
+ #else
+ Parcel p;
+ lynq_client_t client;
+ int resp_type = -1;
+ int request = -1;
+ int slot_id = -1;
+ int lynq_data_call_id = 0;
+ if(handle==NULL)
+ {
+ LYERRLOG("handle is null!!!");
+ return LYNQ_E_NULL_ANONALY;
+ }
+ client.uToken = Global_uToken;
+ client.request = 27;//RIL_REQUEST_SETUP_DATA_CALL
+ client.paramLen = 0;
+ bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
+ LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
+ lynq_data_call_id = updateApn("default");
+ if (lynq_data_call_id < 0)
+ {
+ LYERRLOG("update apn table fail error id = %d",lynq_data_call_id);
+ return LYNQ_E_NULL_ANONALY+1;
+ }
+ *handle = lynq_data_call_id;//T8TSK-211 (2023/5/16) why? If it times out, the client application will also try to reconnect.
+ //Reconnection needs to be deactivated first, and deactivation needs to know which apn to activate.
+ lynq_data_call = 1;
+ pthread_mutex_lock(&g_lynq_data_sendto_mutex);
+ if(send_request(lynq_client_sockfd,&client)==-1)
+ {
+ LYERRLOG("send request fail");
+ perror("[LYNQ_DATA] send request fail:");
+ return LYNQ_E_NULL_ANONALY+2;
+ }
+ get_response(lynq_client_sockfd,p);
+ pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+ JumpHeader(p,&resp_type,&request,&slot_id,&error);
+ LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
+ if(error==0)
+ {
+ data_timelimit = 1;
+ if (waitDataCallstateChange(60000) == ETIMEDOUT) // 60s
+ {
+ error = LYNQ_E_TIME_OUT;
+ LYERRLOG("timeout:wait data Call state fail!!!");
+ lynq_apn_table[lynq_data_call_id].hasTimeout = 1;
+ if (data_invaild_error == 1)
+ {
+ data_invaild_error = 0;
+ LYERRLOG("urc apn info error!!!");
+ return 8085;
+ }
+ printf_apn_table_debug(__FUNCTION__,__LINE__);
+ return error;
+ }
+ }
+ printf_apn_table_debug(__FUNCTION__,__LINE__);
+ #endif //GSW_RIL_CFG
+ #endif
+ return error;
+}
+
+int lynq_deactive_data_call(int *handle)
+{
+ Parcel p;
+ lynq_client_t client;
+ int resp_type = -1;
+ int request = -1;
+ int slot_id = -1;
+ int error = -1;
+ int lynq_data_call_id = -1;
+ int ret = 0;
+ if(handle==NULL)
+ {
+ LYERRLOG("handle is null!!!");
+ return -1;
+ }
+ ret = handleCheck(*handle);
+ if (ret != 0)
+ {
+ LYERRLOG("incomming handle is invalid");
+ return -1;
+ }
+ lynq_data_call_id = *handle;
+ client.uToken = Global_uToken;
+ client.request = 41;//RIL_REQUEST_DEACTIVATE_DATA_CALL
+ //xf.li@20230610 add for T106 data start
+#ifndef MOBILETEK_TARGET_PLATFORM_T106
+ client.paramLen = 0;
+ bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
+ #ifdef GSW_RIL_CFG
+ client.paramLen = 1;
+ sprintf(client.param,"%s",lynq_apn_table[lynq_data_call_id].apnType);
+ #else
+ if(strcmp(lynq_apn_table[lynq_data_call_id].apnType,"default")!=0)
+ {
+ client.paramLen = 1;
+ sprintf(client.param,"%s",lynq_apn_table[lynq_data_call_id].apnType);
+ }
+ #endif //GSW_RIL_CFG
+
+#endif
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ client.paramLen = 1;
+ bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
+ sprintf(client.param,"%d",lynq_apn_table[lynq_data_call_id].cid);
+#endif
+//xf.li@20230610 add for T106 data start
+ LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
+ pthread_mutex_lock(&g_lynq_data_sendto_mutex);
+ if(send_request(lynq_client_sockfd,&client)==-1)
+ {
+ LYERRLOG("send request fail");
+ perror("[LYNQ_DATA] send request fail:");
+ return -1;
+ }
+ get_response(lynq_client_sockfd,p);
+ pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+ JumpHeader(p,&resp_type,&request,&slot_id,&error);
+ LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
+ cleanOnceApnTable(lynq_data_call_id);
+ printf_apn_table_debug(__FUNCTION__,__LINE__);
+ return error;
+}
+//xf.li@20230610 add for T106 data start
+int lynq_setup_data_call_sp_t106(int *handle,char *apn,char *apnType,char *user,char *password,char *authType,char *normalProtocol,char *roamingProtocol)
+{
+ Parcel p;
+ lynq_client_t client;
+ int resp_type = -1;
+ int request = -1;
+ int slot_id = -1;
+ int error = -1;
+ int lynq_data_call_id = -1;
+ char *argv[10] = {};
+ //T106 arg
+ int slot_tmp = -1;
+ int version = -1;
+ int num = -1;
+ int status = -1;
+ int suggestedRetryTime = -1;
+ int cid = -1;
+ int active = -1;
+ int utoken = -1;
+ char ifaceName[LYNQ_IFACE_NAME_MAX_LEN];
+ char type[LYNQ_TYPE_MAX_LEN];
+ char addresses[LYNQ_ADDRESSES_MAX_LEN];
+ char dnses[LYNQ_DNSES_MAX_LEN];
+ char gateways[LYNQ_GATEWAYS_MAX_LEN];
+ char pcscf[LYNQ_PCSCF_MAX_LEN];
+
+ char *tmp_msg = NULL;
+ int len = 0;
+
+ LYINFLOG("[%s][%d]",__FUNCTION__,__LINE__);
+ if(handle==NULL)
+ {
+ LYERRLOG("handle is null!!!");
+ return -1;
+ }
+ if(normalProtocol==NULL)
+ {
+ argv[4] = "IPV4V6";
+ }
+ else
+ {
+ argv[4] = normalProtocol;
+ }
+
+ client.uToken = Global_uToken;
+ client.request = 27;//RIL_REQUEST_SETUP_DATA_CALL
+ client.paramLen = 7;
+ bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
+
+ sprintf(client.param,"%s %s %s %s %s %s %s",apn,apnType,argv[1],argv[2],argv[3],argv[4],argv[5]);
+
+ LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
+
+ pthread_mutex_lock(&g_lynq_data_sendto_mutex);
+
+ if(send_request(lynq_client_sockfd,&client)==-1)
+ {
+ LYERRLOG("send request fail");
+ perror("[LYNQ_DATA] send request fail:");
+ return -1;
+ }
+
+ get_response(lynq_client_sockfd,p);
+ pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+
+ bzero(type,LYNQ_TYPE_MAX_LEN);
+ bzero(ifaceName,LYNQ_IFACE_NAME_MAX_LEN);
+
+ if(p.dataAvail() > 0)
+ {
+ p.readInt32(&resp_type);
+ p.readInt32(&utoken);
+ p.readInt32(&request);
+ p.readInt32(&slot_id);
+ p.readInt32(&error);
+ p.readInt32(&version);
+ p.readInt32(&num);
+ p.readInt32(&status);
+ p.readInt32(&suggestedRetryTime);
+ p.readInt32(&cid);
+
+ LYINFLOG("resp_type=%d,utoken=%d,request=%d,socket_id=%d,error_code=%d,version=%d,num=%d,status=%d,suggestedRetryTime=%d,cid=%d\n",resp_type,utoken,request,slot_id,error,version,num,status,suggestedRetryTime,cid);
+ }
+ else
+ {
+ LYINFLOG("avail <= 0\n");
+ return -1;
+ }
+
+ if(error==0)
+ {
+ if(version == 0)
+ {
+ slot_tmp = findCidInTable(cid);
+ if(slot_tmp >= 0)
+ {
+ *handle = slot_tmp;
+ return error;
+ }
+ }
+//version != 0 || slot < 0, the cid out of lynq_apn_table, need add a new item
+ p.readInt32(&active);
+
+ tmp_msg = strdupReadString(p);
+ len = strlen(tmp_msg);
+ if(len < LYNQ_TYPE_MAX_LEN-1)
+ {
+ memcpy(type,tmp_msg,len+1);
+ }
+ free(tmp_msg);
+ tmp_msg = strdupReadString(p);
+ len = strlen(tmp_msg);
+ if(len < LYNQ_IFACE_NAME_MAX_LEN-1)
+ {
+ memcpy(ifaceName,tmp_msg,len+1);
+ }
+ free(tmp_msg);
+ LYINFLOG("resp_type=%d,utoken=%d,request=%d,socket_id=%d,error_code=%d,version=%d,num=%d,status=%d,suggestedRetryTime=%d,cid=%d,active=%d,type=%s,ifname=%s\n",
+ resp_type,utoken,request,slot_id,error,version,num,status,suggestedRetryTime,cid,active,type,ifaceName);
+ for(lynq_data_call_id = 0; lynq_data_call_id < LYNQ_APN_CHANNEL_MAX; lynq_data_call_id++)
+ {
+ if(lynq_apn_table[lynq_data_call_id].hasUsed == 0)
+ {
+ break;
+ }
+ }
+ if (lynq_data_call_id == LYNQ_APN_CHANNEL_MAX)
+ {
+ LYERRLOG("update apn table fail error id = %d",lynq_data_call_id);
+ return -1;
+ }
+ LYINFLOG("lynq_data_call_id = %d\n", lynq_data_call_id);
+ *handle = lynq_data_call_id;
+ lynq_apn_table[lynq_data_call_id].cid = cid;
+ memcpy(lynq_apn_table[lynq_data_call_id].ifaceName, ifaceName, strlen(ifaceName) + 1);
+ memcpy(lynq_apn_table[lynq_data_call_id].apnType, apnType, strlen(apnType) + 1);
+ lynq_apn_table[lynq_data_call_id].hasUsed = 1;
+ printf_apn_table();
+ return status;
+ }
+ else
+ {
+ return error;
+ }
+}
+//xf.li@20230610 add for T106 data end
+int lynq_setup_data_call_sp(int *handle,char *apn,char *apnType,char *user,char *password,char *authType,char *normalProtocol,char *roamingProtocol)
+{
+ int t106_error = -1;
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ t106_error = lynq_setup_data_call_sp_t106(handle, apn, apnType, user, password, authType, normalProtocol, roamingProtocol);
+ return t106_error;
+#endif
+ Parcel p;
+ lynq_client_t client;
+ int resp_type = -1;
+ int request = -1;
+ int slot_id = -1;
+ int error = -1;
+ int lynq_data_call_id = -1;
+ char *argv[10] = {};
+ #ifdef GSW_RIL_CFG
+ LYINFLOG("[%s][%d]",__FUNCTION__,__LINE__);
+ if(handle==NULL||apnType==NULL)
+ {
+ LYERRLOG("handle or apntype is null!!!");
+ return -1;
+ }
+ #else
+ if(handle==NULL||apn==NULL||apnType==NULL)
+ {
+ LYERRLOG("handle ,apn or apntype is null!!!");
+ return LYNQ_E_NULL_ANONALY;
+ }
+ #endif //GSW_RIL_CFG
+ if(user==NULL)
+ {
+ argv[1] = "null";
+ }
+ else
+ {
+ argv[1] = user;
+ }
+ if(password==NULL)
+ {
+ argv[2] = "null";
+ }
+ else
+ {
+ argv[2] = password;
+ }
+ if(authType==NULL)
+ {
+ argv[3] = "null";
+ }
+ else
+ {
+ argv[3] = authType;
+ }
+ if(normalProtocol==NULL)
+ {
+ argv[4] = "null";
+ }
+ else
+ {
+ argv[4] = normalProtocol;
+ }
+ if(roamingProtocol==NULL)
+ {
+ argv[5] = "null";
+ }
+ else
+ {
+ argv[5] = roamingProtocol;
+ }
+ client.uToken = Global_uToken;
+ client.request = 27;//RIL_REQUEST_SETUP_DATA_CALL
+ client.paramLen = 7;
+ bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
+ #ifdef GSW_RIL_CFG
+ if(NULL == apn)
+ {
+ sprintf(client.param,"null %s %s %s %s %s %s",apnType,argv[1],argv[2],argv[3],argv[4],argv[5]);
+ }
+ else
+ {
+ sprintf(client.param,"%s %s %s %s %s %s %s",apn,apnType,argv[1],argv[2],argv[3],argv[4],argv[5]);
+ }
+ #else
+ sprintf(client.param,"%s %s %s %s %s %s %s",apn,apnType,argv[1],argv[2],argv[3],argv[4],argv[5]);
+ #endif //GSW_RIL_CFG
+ LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
+ lynq_data_call_id = updateApn(apnType);
+ if (lynq_data_call_id < 0)
+ {
+ LYERRLOG("update apn table fail error id = %d",lynq_data_call_id);
+ return LYNQ_E_NULL_ANONALY+1;
+ }
+ *handle = lynq_data_call_id;//T8TSK-211 (2023/5/16)
+ lynq_data_call = 1;
+ pthread_mutex_lock(&g_lynq_data_sendto_mutex);
+ if(send_request(lynq_client_sockfd,&client)==-1)
+ {
+ LYERRLOG("send request fail");
+ perror("[LYNQ_DATA] send request fail:");
+ return LYNQ_E_NULL_ANONALY+2;
+ }
+ get_response(lynq_client_sockfd,p);
+ pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+ JumpHeader(p,&resp_type,&request,&slot_id,&error);
+ LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
+ if(error==0)
+ {
+ data_timelimit = 1;
+ if(waitDataCallstateChange(60000)==ETIMEDOUT)//60s
+ {
+ error = LYNQ_E_TIME_OUT;
+ LYERRLOG("timeout:wait data Call state fail!!!");
+ lynq_apn_table[lynq_data_call_id].hasTimeout = 1;
+ if (data_invaild_error == 1)
+ {
+ data_invaild_error = 0;
+ LYERRLOG("urc apn info error!!!");
+ return 8085;
+ }
+ printf_apn_table_debug(__FUNCTION__,__LINE__);
+ return error;
+ }
+ }
+ printf_apn_table_debug(__FUNCTION__,__LINE__);
+ return error;
+}
+/*
+int lynq_deactive_data_call_sp(int *handle,char *apnType)
+{
+ Parcel p;
+ lynq_client_t client;
+ int resp_type = -1;
+ int request = -1;
+ int slot_id = -1;
+ int error = -1;
+ if(handle==NULL||apnType==NULL)
+ {
+ LYERRLOG("handle is null!!!");
+ return -1;
+ }
+ client.uToken = Global_uToken;
+ client.request = 41;//RIL_REQUEST_DEACTIVATE_DATA_CALL
+ client.paramLen = 1;
+ bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
+ sprintf(client.param,"%s",apnType);
+ LYERRLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
+ if(send_request(lynq_client_sockfd,&client)==-1)
+ {
+ LYERRLOG("send request fail");
+ perror("[LYNQ_DATA] send request fail:");
+ return -1;
+ }
+ get_response(lynq_client_sockfd,p);
+ JumpHeader(p,&resp_type,&request,&slot_id,&error);
+ LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
+ return error;
+}
+*/
+int getDataCallLists(lynq_data_call_response_v11_t dataCallList[LYNQ_APN_CHANNEL_MAX],int *realNum)
+{
+ Parcel p;
+ lynq_client_t client;
+ int resp_type = -1;
+ int token;
+ int request = -1;
+ int slot_id = -1;
+ int error = -1;
+ int version =0;
+ int num = 0;
+ char *temp_char = NULL;
+ if(dataCallList==NULL)
+ {
+ LYERRLOG("dataCallList is null!!!");
+ return -1;
+ }
+ Global_uToken++;
+ client.uToken = Global_uToken;
+ client.request = 57;//RIL_REQUEST_DATA_CALL_LIST
+ client.paramLen = 0;
+ bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
+ LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
+ pthread_mutex_lock(&g_lynq_data_sendto_mutex);
+ if(send_request(lynq_client_sockfd,&client)==-1)
+ {
+ LYERRLOG("send request fail");
+ perror("[LYNQ_DATA] send request fail:");
+ return -1;
+ }
+ get_response(lynq_client_sockfd,p);
+ pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+ if(p.dataAvail() > 0)
+ {
+ p.readInt32(&resp_type);
+ p.readInt32(&token);
+ p.readInt32(&request);
+ p.readInt32(&slot_id);
+ p.readInt32(&error);
+ }
+ else
+ {
+ return -1;
+ }
+ LYINFLOG("resp_type=%d,uToken=%d,request=%d,slot_id=%d,error_code=%d",resp_type,token,request,slot_id,error);
+ p.readInt32(&version);
+ if(version==11)
+ {
+ p.readInt32(&num);
+ *realNum = num;
+ for (int i = 0; i < num; i++)
+ {
+ p.readInt32(&dataCallList[i].status);
+ p.readInt32(&dataCallList[i].suggestedRetryTime);
+ p.readInt32(&dataCallList[i].cid);
+ p.readInt32(&dataCallList[i].active);
+ temp_char = strdupReadString(p);
+ LYINFLOG("[%s][%d]%s",__FUNCTION__,__LINE__,temp_char);
+ if(temp_char)
+ {
+ memcpy(dataCallList[i].type,temp_char,strlen(temp_char)+1);
+ free(temp_char);
+ }
+ temp_char = strdupReadString(p);
+ LYINFLOG("[%s][%d]%s",__FUNCTION__,__LINE__,temp_char);
+ if(temp_char)
+ {
+ memcpy(dataCallList[i].ifname,temp_char,strlen(temp_char)+1);
+ free(temp_char);
+ }
+ temp_char = strdupReadString(p);
+ LYINFLOG("[%s][%d]%s",__FUNCTION__,__LINE__,temp_char);
+ if(temp_char)
+ {
+ memcpy(dataCallList[i].addresses,temp_char,strlen(temp_char)+1);
+ free(temp_char);
+ }
+ temp_char = strdupReadString(p);
+ LYINFLOG("[%s][%d]%s",__FUNCTION__,__LINE__,temp_char);
+ if(temp_char)
+ {
+ memcpy(dataCallList[i].dnses,temp_char,strlen(temp_char)+1);
+ free(temp_char);
+ }
+ temp_char = strdupReadString(p);
+ LYINFLOG("[%s][%d]%s",__FUNCTION__,__LINE__,temp_char);
+ if(temp_char)
+ {
+ memcpy(dataCallList[i].gateways,temp_char,strlen(temp_char)+1);
+ free(temp_char);
+ }
+ temp_char = strdupReadString(p);
+ LYINFLOG("[%s][%d]%s",__FUNCTION__,__LINE__,temp_char);
+ if(temp_char)
+ {
+ memcpy(dataCallList[i].pcscf,temp_char,strlen(temp_char)+1);
+ free(temp_char);
+ }
+ p.readInt32(&dataCallList[i].mtu);
+ }
+ }
+ return error;
+}
+int lynq_get_data_call_list(int *handle,lynq_data_call_response_v11_t *dataCallList)
+{
+ lynq_data_call_response_v11_t interDataCallList[LYNQ_APN_CHANNEL_MAX]={};
+ int number = 0;
+ int lynq_data_call_id = 0;
+ int error = 0;
+ lynq_data_call_id = *handle;
+ if(handle==NULL)
+ {
+ LYERRLOG("handle is NULL");
+ return LYNQ_E_NULL_ANONALY;
+ }
+ if (*handle<0 && handle>8)
+ {
+ LYERRLOG("handle value error");
+ }
+ LYINFLOG("incoming handle value: %d",*handle);
+ memset(interDataCallList,0,sizeof(interDataCallList));
+ error = getDataCallLists(interDataCallList,&number);
+ if(error == 0)
+ {
+ for(int i = 0;i < number;i++)
+ {
+ if(strcmp(interDataCallList[i].ifname,lynq_apn_table[lynq_data_call_id].ifaceName)==0)
+ {
+ dataCallList->active = interDataCallList[i].active;
+ dataCallList->suggestedRetryTime = interDataCallList[i].suggestedRetryTime;
+ dataCallList->cid = interDataCallList[i].cid;
+ dataCallList->status = interDataCallList[i].status;
+ dataCallList->mtu = interDataCallList[i].mtu;
+ memcpy(dataCallList->addresses,interDataCallList[i].addresses,sizeof(interDataCallList[i].addresses));
+ memcpy(dataCallList->ifname,interDataCallList[i].ifname,sizeof(interDataCallList[i].ifname));
+ memcpy(dataCallList->dnses,interDataCallList[i].dnses,sizeof(interDataCallList[i].dnses));
+ memcpy(dataCallList->type,interDataCallList[i].type,sizeof(interDataCallList[i].type));
+ memcpy(dataCallList->gateways,interDataCallList[i].gateways,sizeof(interDataCallList[i].gateways));
+ memcpy(dataCallList->pcscf,interDataCallList[i].pcscf,sizeof(interDataCallList[i].pcscf));
+ LYDBGLOG("ifname:%s,addr:%s",dataCallList->ifname,dataCallList->addresses);
+ }
+ }
+ }
+ return error;
+}
+int lynq_wait_data_call_state_change(int *handle)
+{
+ if (data_waiting_status == 1)
+ {
+ LYDBGLOG("some thread is waiting");
+ return -3;
+ }
+ LYDBGLOG("is empty :%d",s_data_urc_wait_list.empty());
+ if (s_data_urc_wait_list.empty())
+ {
+ LYDBGLOG("start wait");
+ data_waiting_status = 1;
+ waitPdnChange();
+ }
+ data_waiting_status = 0;
+ for(std::vector<int>::iterator i = s_data_urc_wait_list.begin(); i != s_data_urc_wait_list.end(); i++)
+ {
+ LYINFLOG("s_data_urc_wait_list iterm:%d\n", *i);
+ }
+ std::vector<int>::iterator iter;
+
+ pthread_mutex_lock(&s_lynq_urc_vector_mutex);
+ iter = s_data_urc_wait_list.begin();
+ if (iter != s_data_urc_wait_list.end())
+ {
+ *handle = *iter;
+ }
+ s_data_urc_wait_list.erase(iter);
+
+ for(std::vector<int>::iterator i = s_data_urc_wait_list.begin(); i != s_data_urc_wait_list.end(); i++)
+ {
+ LYINFLOG("s_data_urc_wait_list iterm:%d\n", *i);
+ }
+
+ pthread_mutex_unlock(&s_lynq_urc_vector_mutex);
+
+ LYINFLOG("lynq_wait_data_call_state_change handle:%d",*handle);
+ return 0;
+}
+/*Warren add for T800 platform 2021/11/19 end*/
+
+/*Typethree add for T800 platform 2022/04/21 start*/
+
+int insert_apn_char(char *agc, char *id,char *mcc, char *mnc, char *apn, char *apntype, char *user, char *password, char *normalprotocol, char *roamingprotocol, char *carrier)
+{
+ char strtmp[10][32];
+ if (id == NULL)
+ {
+ sprintf(strtmp[0], "id=;");
+ }
+ else
+ {
+ sprintf(strtmp[0], "id=%s;", id);
+ }
+ if (mcc == NULL)
+ {
+ sprintf(strtmp[1], "mcc=;");
+ }
+ else
+ {
+ sprintf(strtmp[1], "mcc=%s;", mcc);
+ }
+ if (mnc == NULL)
+ {
+ sprintf(strtmp[2], "mnc=;");
+ }
+ else
+ {
+ sprintf(strtmp[2], "mnc=%s;", mnc);
+ }
+ if (apn == NULL)
+ {
+ sprintf(strtmp[3], "apn=;");
+ }
+ else
+ {
+ sprintf(strtmp[3], "apn=%s;", apn);
+ }
+ if (apntype == NULL)
+ {
+ sprintf(strtmp[4], "apntype=;");
+ }
+ else
+ {
+ sprintf(strtmp[4], "apntype=%s;", apntype);
+ }
+ if (user == NULL)
+ {
+ sprintf(strtmp[5], "user=;");
+ }
+ else
+ {
+ sprintf(strtmp[5], "user=%s;", user);
+ }
+ if (password == NULL)
+ {
+ sprintf(strtmp[6], "password=;");
+ }
+ else
+ {
+ sprintf(strtmp[6], "password=%s;", password);
+ }
+ if (normalprotocol == NULL)
+ {
+ sprintf(strtmp[7], "normalprotocol=;");
+ }
+ else
+ {
+ sprintf(strtmp[7], "normalprotocol=%s;", normalprotocol);
+ }
+ if (roamingprotocol == NULL)
+ {
+ sprintf(strtmp[8], "roamingprotocol=;");
+ }
+ else
+ {
+ sprintf(strtmp[8], "roamingprotocol=%s;", roamingprotocol);
+ }
+ if (carrier == NULL)
+ {
+ sprintf(strtmp[9], "carrier=;");
+ }
+ else
+ {
+ sprintf(strtmp[9], "carrier=%s;", carrier);
+ }
+ sprintf(agc, "%s%s%s%s%s%s%s%s%s%s",strtmp[0], strtmp[1], strtmp[2], strtmp[3], strtmp[4], strtmp[5], strtmp[6], strtmp[7], strtmp[8], strtmp[9]);
+
+ return 0;
+}
+
+int modify_apn_char(char *agc, char *id, char *mcc, char *mnc, char *apn, char *apntype, char *user, char *password, char *normalprotocol, char *roamingprotocol, char *carrier)
+{
+ char strtmp[10][32];
+ if (id == NULL)
+ {
+ sprintf(strtmp[0], "id=;");
+ }
+ else
+ {
+ sprintf(strtmp[0], "id=%s;", id);
+ }
+ if (mcc == NULL)
+ {
+ sprintf(strtmp[1], "mcc=;");
+ }
+ else
+ {
+ sprintf(strtmp[1], "mcc=%s;", mcc);
+ }
+ if (mnc == NULL)
+ {
+ sprintf(strtmp[2], "mnc=;");
+ }
+ else
+ {
+ sprintf(strtmp[2], "mnc=%s;", mnc);
+ }
+ if (apn == NULL)
+ {
+ sprintf(strtmp[3], "apn=;");
+ }
+ else
+ {
+ sprintf(strtmp[3], "apn=%s;", apn);
+ }
+ if (apntype == NULL)
+ {
+ sprintf(strtmp[4], "apntype=;");
+ }
+ else
+ {
+ sprintf(strtmp[4], "apntype=%s;", apntype);
+ }
+ if (user == NULL)
+ {
+ sprintf(strtmp[5], "user=;");
+ }
+ else
+ {
+ sprintf(strtmp[5], "user=%s;", user);
+ }
+ if (password == NULL)
+ {
+ sprintf(strtmp[6], "password=;");
+ }
+ else
+ {
+ sprintf(strtmp[6], "password=%s;", password);
+ }
+ if (normalprotocol == NULL)
+ {
+ sprintf(strtmp[7], "normalprotocol=;");
+ }
+ else
+ {
+ sprintf(strtmp[7], "normalprotocol=%s;", normalprotocol);
+ }
+ if (roamingprotocol == NULL)
+ {
+ sprintf(strtmp[8], "roamingprotocol=;");
+ }
+ else
+ {
+ sprintf(strtmp[8], "roamingprotocol=%s;", roamingprotocol);
+ }
+ if (carrier == NULL)
+ {
+ sprintf(strtmp[9], "carrier=;");
+ }
+ else
+ {
+ sprintf(strtmp[9], "carrier=%s;", carrier);
+ }
+ sprintf(agc, "%s%s%s%s%s%s%s%s%s%s", strtmp[0], strtmp[1], strtmp[2], strtmp[3], strtmp[4], strtmp[5], strtmp[6], strtmp[7], strtmp[8], strtmp[9]);
+ return 0;
+}
+
+
+int query_apn_char(char *agc, char *id, char *mcc, char *mnc, char *apn, char *apntype, char *user, char *password, char *normalprotocol, char *roamingprotocol, char *carrier)
+{
+ char strtmp[10][32];
+ if (id == NULL)
+ {
+ sprintf(strtmp[0], "");
+ }
+ else
+ {
+ sprintf(strtmp[0], "id=%s;", id);
+ }
+ if (mcc == NULL)
+ {
+ sprintf(strtmp[1], "");
+ }
+ else
+ {
+ sprintf(strtmp[1], "mcc=%s;", mcc);
+ }
+ if (mnc == NULL)
+ {
+ sprintf(strtmp[2], "");
+ }
+ else
+ {
+ sprintf(strtmp[2], "mnc=%s;", mnc);
+ }
+ if (apn == NULL)
+ {
+ sprintf(strtmp[3], "");
+ }
+ else
+ {
+ sprintf(strtmp[3], "apn=%s;", apn);
+ }
+ if (apntype == NULL)
+ {
+ sprintf(strtmp[4], "");
+ }
+ else
+ {
+ sprintf(strtmp[4], "apntype=%s;", apntype);
+ }
+ if (user == NULL)
+ {
+ sprintf(strtmp[5], "");
+ }
+ else
+ {
+ sprintf(strtmp[5], "user=%s;", user);
+ }
+ if (password == NULL)
+ {
+ sprintf(strtmp[6], "");
+ }
+ else
+ {
+ sprintf(strtmp[6], "password=%s;", password);
+ }
+ if (normalprotocol == NULL)
+ {
+ sprintf(strtmp[7], "");
+ }
+ else
+ {
+ sprintf(strtmp[7], "normalprotocol=%s;", normalprotocol);
+ }
+ if (roamingprotocol == NULL)
+ {
+ sprintf(strtmp[8], "");
+ }
+ else
+ {
+ sprintf(strtmp[8], "roamingprotocol=%s;", roamingprotocol);
+ }
+ if (carrier == NULL)
+ {
+ sprintf(strtmp[9], "");
+ }
+ else
+ {
+ sprintf(strtmp[9], "carrier=%s;", carrier);
+ }
+ sprintf(agc, "%s%s%s%s%s%s%s%s%s%s", strtmp[0], strtmp[1], strtmp[2], strtmp[3], strtmp[4], strtmp[5], strtmp[6], strtmp[7], strtmp[8], strtmp[9]);
+ return 0;
+}
+
+static char *lynqStrdupReadString(Parcel &p)
+{
+ size_t stringlen;
+ const char16_t *s16;
+
+ s16 = p.readString16Inplace(&stringlen);
+ return strndup16to8(s16, stringlen);
+}
+
+int lynq_modify_apn_db(const int cmd, char *id, char *mcc, char *mnc, char *apn, char *apntype, char *user, char *password, char *normalprotocol, char *roamingprotocol, char *carrier, char *out)
+{
+ if (NULL == id && NULL == mcc && NULL == mnc && NULL == apn && NULL == apntype && NULL == user && NULL == password && NULL == normalprotocol && NULL == roamingprotocol && NULL == carrier)
+ {
+ LYERRLOG("There are no valid parameters");
+ return -1;
+ }
+ lynq_client_t client;
+ char argc[512];
+ int res = 0;
+ Parcel p;
+ if (cmd == 0) // insert apn db
+ {
+ res = insert_apn_char(argc, id, mcc, mnc, apn, apntype, user, password, normalprotocol, roamingprotocol, carrier);
+
+ client.uToken = Global_uToken;
+ client.request = 2000 + 193; // RIL_REQUEST_MODIFY_APN
+ client.paramLen = 2;
+ bzero(client.param, LYNQ_REQUEST_PARAM_BUF);
+ sprintf(client.param, "%d %s", cmd, argc);
+ }
+ else if (cmd == 1) //delete apn db
+ {
+ if (NULL == id)
+ {
+ LYERRLOG("id is NULL!!!please input id: ");
+ }
+ sprintf(argc, "id=%s", id);
+ client.uToken = Global_uToken;
+ client.request = 2000 + 193; // RIL_REQUEST_MODIFY_APN
+ client.paramLen = 2;
+ bzero(client.param, LYNQ_REQUEST_PARAM_BUF);
+ sprintf(client.param, "%d %s", cmd, argc);
+ }
+ else if (cmd == 2) //query apn db
+ {
+ query_apn_char(argc, id, mcc, mnc, apn, apntype, user, password, normalprotocol, roamingprotocol, carrier);
+ client.uToken = Global_uToken;
+ client.request = 2000 + 193; // RIL_REQUEST_MODIFY_APN
+ client.paramLen = 2;
+ bzero(client.param, LYNQ_REQUEST_PARAM_BUF);
+ sprintf(client.param, "%d %s", cmd, argc);
+ }
+ else if (cmd == 3) //modify apn db
+ {
+ modify_apn_char(argc, id, mcc, mnc, apn, apntype, user, password, normalprotocol, roamingprotocol, carrier);
+ client.uToken = Global_uToken;
+ client.request = 2000 + 193; // RIL_REQUEST_MODIFY_APN
+ client.paramLen = 2;
+ bzero(client.param, LYNQ_REQUEST_PARAM_BUF);
+ sprintf(client.param, "%d %s", cmd, argc);
+ }
+ else
+ {
+ LYERRLOG("incoming command is invalid");
+ return -1;
+ }
+ LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
+ pthread_mutex_lock(&g_lynq_data_sendto_mutex);
+ if(send_request(lynq_client_sockfd,&client)==-1)
+ {
+ LYERRLOG("send request fail");
+ return -1;
+ }
+ pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+ waitApnResult();
+ strcpy(out, g_lynq_apn_result);
+ LYINFLOG(">>>>>output info:%s",out);
+ return 0;
+}
+
+int lynq_reset_apn(char *result)
+{
+ Parcel p;
+ lynq_client_t client;
+ if (NULL == result)
+ {
+ LYERRLOG("incoming paramters error");
+ }
+ client.uToken = Global_uToken;
+ client.request = 2000 + 194;
+ client.paramLen = 0;
+ bzero(client.param, LYNQ_REQUEST_PARAM_BUF);
+ LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s", client.uToken, client.request, client.paramLen, client.param);
+ pthread_mutex_lock(&g_lynq_data_sendto_mutex);
+ if (send_request(lynq_client_sockfd, &client) == -1)
+ {
+ LYERRLOG("send request fail");
+ return -1;
+ }
+ pthread_mutex_unlock(&g_lynq_data_sendto_mutex);
+ waitApnResult();
+ strcpy(result, g_lynq_apn_result);
+ LYINFLOG(">>>>>result:%s",result);
+ return 0;
+}
+
+int lynq_get_apn_table(int *size,lynq_apn_info **list)
+{
+ if (NULL == size || NULL == list)
+ {
+ LYERRLOG("size or list is NULL");
+ return LYNQ_E_NULL_ANONALY;
+ }
+ int count = 0;
+ int i = 0;
+ for (i = 0;i < LYNQ_APN_CHANNEL_MAX;i++)
+ {
+ if (lynq_apn_table[i].hasUsed == 1)
+ {
+ if (NULL == list[count])
+ {
+ LYERRLOG("list[%d] is NULL",count);
+ return LYNQ_E_NULL_ANONALY;
+ }
+ list[count]->index = i;
+ memcpy(list[count]->apn,lynq_apn_table[i].apn,strlen(lynq_apn_table[i].apn)+1);
+ memcpy(list[count]->apnType,lynq_apn_table[i].apnType,strlen(lynq_apn_table[i].apnType)+1);
+ count++;
+ }
+ }
+ *size = count;
+ return 0;
+}
+/*Typethree add for T800 platform 2022/04/21 end*/
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data_urc.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data_urc.cpp
new file mode 100755
index 0000000..3935fbd
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data_urc.cpp
@@ -0,0 +1,347 @@
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <string.h>
+#include <unistd.h>
+#include <binder/Parcel.h>
+#include <log/log.h>
+#include <cutils/jstring.h>
+#include <pthread.h>
+#include <list>
+#include "lynq_data.h"
+#include "lynq_data_urc.h"
+#include "liblog/lynq_deflog.h"
+#include "lynq_shm.h"
+
+#define LYNQ_REC_BUF 8192
+
+static std::list<Parcel*> s_urc_recv_parcel_list;
+
+int lynq_len_urc_addr_serv;
+struct sockaddr_in urc_local_addr;
+static int lynq_urc_sockfd = -1;
+bool data_urc_recive_status = 1;
+static pthread_mutex_t s_lynq_urc_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t s_lynq_urc_cond = PTHREAD_COND_INITIALIZER;
+
+/*recv*/
+pthread_t data_urc_recv_tid = -1;
+static pthread_mutex_t s_lynq_urc_recv_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t s_lynq_urc_recv_cond = PTHREAD_COND_INITIALIZER;
+
+/*process*/
+pthread_t data_urc_process_tid = -1;
+bool data_urc_process_status = 1;
+static pthread_mutex_t s_lynq_urc_process_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t s_lynq_urc_process_cond = PTHREAD_COND_INITIALIZER;
+
+#define SHM_BUFFER_INDEX_OFFSET 1
+#define SHM_BUFFER_SIZE_OFFSET 16
+#define SHM_BUFFER_INDEX_MASK 0x0000007F
+#define SHM_BUFFER_SIZE_MASK 0x0000FFFF
+
+bool urc_data_is_in_shm_data(int responseType,int& level, int& index, int& size)
+{
+ int shm_index=((responseType>>SHM_BUFFER_INDEX_OFFSET)&SHM_BUFFER_INDEX_MASK);
+ if (shm_index>0)
+ {
+ index=shm_index-1;
+ size=((responseType>>SHM_BUFFER_SIZE_OFFSET)&SHM_BUFFER_SIZE_MASK);
+ if(size>=sizeof(int32_t)*3 && get_shem_buffer_level(size,&level))
+ {
+ LYINFLOG("urc_data_is_in_shm_data level is %d, index is %d size is %d",level,index,size);
+ return true;
+ }
+ }
+ LYINFLOG("urc_data_is_in_shm_data return false, responseType is %d",responseType);
+ return false;
+}
+
+void cleanup_urc_process_mutex(void *arg)
+{
+ pthread_mutex_unlock(&s_lynq_urc_process_mutex);
+}
+
+void *thread_urc_recv()
+{
+ Parcel *urc_p =NULL;
+ char urc_data[LYNQ_REC_BUF];
+ int res = 0;
+ lynq_head_t* phead;
+ int level,index,size;
+ uint8_t * shm_buffer;
+
+ LYINFLOG("urc recv thread is running");
+ while(data_urc_recive_status)
+ {
+ bzero(urc_data,LYNQ_REC_BUF);
+ res = recvfrom(lynq_urc_sockfd,urc_data,sizeof(urc_data),0,(struct sockaddr *)&urc_local_addr,(socklen_t*)&lynq_len_urc_addr_serv);
+ LYINFLOG("[%s][%d] res:%d",__FUNCTION__,__LINE__,res);
+ if(res<sizeof(int32_t)*2)
+ {
+ LYERRLOG("thread_urc_recv step2 fail: res is %d",res);
+ continue;
+ }
+
+ phead=(lynq_head_t*) urc_data;
+ //xf.li@20230610 add for T106 data start
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ if(is_support_urc_t106(phead->urcid)==false)
+#else
+ if(is_support_urc(phead->urcid)==false)
+#endif
+//xf.li@20230610 add for T106 data end
+ {
+ continue;
+ }
+ urc_p = new Parcel();
+ if(urc_p == NULL)
+ {
+ LYERRLOG("new parcel failure!!!");
+ continue;
+ }
+ if(urc_data_is_in_shm_data(phead->resp_type,level,index,size))
+ {
+ shm_buffer = (uint8_t *)get_shem_buffer(level,index); // p.setData((uint8_t *) buffer, buflen);
+ LYINFLOG("shm pointer is %p", shm_buffer);
+ urc_p->setData(shm_buffer,size);
+ }
+ else if(res>=sizeof(int32_t)*3)
+ {
+ urc_p->setData((uint8_t *)urc_data,res); // p.setData((uint8_t *) buffer, buflen);
+ }
+ else
+ {
+ LYERRLOG("res %d error!!!", res);
+ delete urc_p;
+ urc_p = NULL;
+ continue;
+ }
+ urc_p->setDataPosition(0);
+ if(urc_p->dataAvail()>0)
+ {
+ pthread_mutex_lock(&s_lynq_urc_process_mutex);
+ s_urc_recv_parcel_list.push_back(urc_p);
+ pthread_cond_broadcast(&s_lynq_urc_process_cond);
+ pthread_mutex_unlock(&s_lynq_urc_process_mutex);
+ }
+ else
+ {
+ delete urc_p;
+ urc_p = NULL;
+ }
+ }
+ LYINFLOG("urc recv thread ended");
+ return NULL;
+}
+
+void *thread_urc_process()
+{
+ Parcel *urc_p =NULL;
+ std::list<Parcel*>::iterator iter;
+
+ LYINFLOG("urc process thread is running");
+ pthread_cleanup_push(cleanup_urc_process_mutex, NULL); // thread cleanup handler
+ while (data_urc_process_status)
+ {
+ pthread_mutex_lock(&s_lynq_urc_process_mutex);
+ while(s_urc_recv_parcel_list.empty())
+ {
+ pthread_cond_wait(&s_lynq_urc_process_cond,&s_lynq_urc_process_mutex);
+ }
+ iter=s_urc_recv_parcel_list.begin();
+ urc_p = (*iter);
+ s_urc_recv_parcel_list.erase(iter);
+ pthread_mutex_unlock(&s_lynq_urc_process_mutex);
+ urc_p->setDataPosition(0);
+ if(urc_p->dataAvail()>0)
+ {
+ pthread_mutex_lock(&s_lynq_urc_mutex);
+ //xf.li@20230610 add for T106 data start
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ LYINFLOG("DATA urc_msg_process_add_in_urccpp end\n");
+ urc_msg_process_add_for_t106(urc_p);
+ LYINFLOG("DATA urc_msg_process_add_in_datacpp end\n");
+#else
+ urc_msg_process(urc_p);
+#endif
+ //xf.li@20230610 add for T106 data end
+ urc_msg_process(urc_p);
+ pthread_mutex_unlock(&s_lynq_urc_mutex);
+ }
+ delete urc_p;
+ urc_p = NULL;
+ }
+ pthread_cleanup_pop(0);
+ LYINFLOG("urc process thread ended");
+ return NULL;
+}
+
+int lynq_socket_recv_start()
+{
+ int rt=0;
+ int on=1;
+ struct sockaddr_in urc_local_addr;
+ pthread_attr_t attr;
+ lynq_urc_sockfd = socket(AF_INET,SOCK_DGRAM,0);
+ lynq_len_urc_addr_serv = sizeof(urc_local_addr);
+ if(lynq_urc_sockfd < 0)
+ {
+ LYERRLOG("create socket for udp fail");
+ return -1;
+ }
+ urc_local_addr.sin_family = AF_INET;
+ urc_local_addr.sin_port = htons(LYNQ_URC_SERVICE_PORT);
+ urc_local_addr.sin_addr.s_addr = htons(INADDR_ANY);
+ /* Set socket to allow reuse of address and port, SO_REUSEADDR value is 2*/
+ rt = setsockopt(lynq_urc_sockfd,SOL_SOCKET,SO_REUSEADDR,&on,sizeof on);
+ if(rt<0)
+ {
+ LYERRLOG("SO_REUSEADDR fail");
+ close(lynq_urc_sockfd);
+ lynq_urc_sockfd = -1;
+ return -1;
+ }
+ rt = bind(lynq_urc_sockfd ,(struct sockaddr*)&urc_local_addr, sizeof(urc_local_addr));
+ if (rt == -1)
+ {
+ LYERRLOG("bind failed");
+ close(lynq_urc_sockfd);
+ lynq_urc_sockfd = -1;
+ return -1;
+ }
+ return 0;
+}
+
+int lynq_socket_recv_stop()
+{
+ if (lynq_urc_sockfd >=0)
+ {
+ close(lynq_urc_sockfd);
+ lynq_urc_sockfd = -1;
+ }
+ return 0;
+}
+
+void lynq_urc_recv_thread_stop()
+{
+ int ret;
+
+ pthread_mutex_lock(&s_lynq_urc_process_mutex);
+ data_urc_recive_status = 0;
+ if (data_urc_recv_tid != -1)
+ {
+ ret = pthread_cancel(data_urc_recv_tid);
+ LYDBGLOG("pthread cancel ret = %d",ret);
+ }
+ pthread_mutex_unlock(&s_lynq_urc_process_mutex);
+
+ if (data_urc_recv_tid != -1)
+ {
+ ret = pthread_join(data_urc_recv_tid,NULL);
+ LYDBGLOG("pthread join ret = %d",ret);
+ data_urc_recv_tid = -1;
+ }
+}
+
+void lynq_urc_process_thread_stop()
+{
+ int ret;
+
+ pthread_mutex_lock(&s_lynq_urc_process_mutex);
+ pthread_mutex_lock(&s_lynq_urc_mutex);
+
+ data_urc_process_status = 0;
+ if (data_urc_process_tid != -1)
+ {
+ ret = pthread_cancel(data_urc_process_tid);
+ LYDBGLOG("pthread cancel ret = %d",ret);
+ }
+ pthread_mutex_unlock(&s_lynq_urc_mutex);
+ pthread_mutex_unlock(&s_lynq_urc_process_mutex);
+
+ if (data_urc_process_tid != -1)
+ {
+ ret = pthread_join(data_urc_process_tid,NULL);
+ LYDBGLOG("pthread join ret = %d",ret);
+ data_urc_process_tid = -1;
+ }
+}
+
+
+int lynq_init_data_urc_thread()
+{
+ int ret = 0;
+ if(ril_init_mem()!=0)
+ {
+ LYERRLOG("ril_init_mem fail");
+ return -1;
+ }
+
+ ret = lynq_socket_recv_start();
+ if (ret != 0)
+ {
+ LYERRLOG("lynq_socket_recv_start fail");
+ ril_deinit_mem();
+ return -1;
+ }
+
+ pthread_mutex_init(&s_lynq_urc_process_mutex,NULL);
+ pthread_mutex_init(&s_lynq_urc_recv_mutex,NULL);
+
+ pthread_mutex_lock(&s_lynq_urc_process_mutex);
+ std::list<Parcel*>::iterator iter;
+ for (iter=s_urc_recv_parcel_list.begin();iter!=s_urc_recv_parcel_list.end();++iter)
+ {
+ delete(*iter);
+ }
+ s_urc_recv_parcel_list.clear();
+ pthread_mutex_unlock(&s_lynq_urc_process_mutex);
+
+ pthread_mutex_init(&s_lynq_urc_mutex,NULL);
+ data_urc_recive_status = 1;
+
+ ret = pthread_create(&data_urc_recv_tid,NULL,thread_urc_recv,NULL);
+ if (ret < 0)
+ {
+ LYERRLOG("urc recv pthread create error");
+ data_urc_recive_status = 0;
+ lynq_socket_recv_stop();
+ ril_deinit_mem();
+ return -1;
+ }
+
+ data_urc_process_status = 1;
+ ret = pthread_create(&data_urc_process_tid,NULL,thread_urc_process,NULL);
+ if (ret < 0)
+ {
+ LYERRLOG("urc recv pthread create error");
+
+ data_urc_process_status = 0;
+ lynq_socket_recv_stop();
+ lynq_urc_recv_thread_stop();
+
+ return -1;
+ }
+ return 0;
+}
+
+int lynq_deinit_data_urc_thread()
+{
+ lynq_socket_recv_stop();
+ lynq_urc_recv_thread_stop();
+ lynq_urc_process_thread_stop();
+
+ pthread_mutex_lock(&s_lynq_urc_process_mutex);
+ std::list<Parcel*>::iterator iter;
+ for (iter=s_urc_recv_parcel_list.begin();iter!=s_urc_recv_parcel_list.end();++iter)
+ {
+ delete(*iter);
+ }
+ s_urc_recv_parcel_list.clear();
+ pthread_mutex_unlock(&s_lynq_urc_process_mutex);
+
+ ril_deinit_mem();
+ return 0;
+}
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data_urc.h b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data_urc.h
new file mode 100755
index 0000000..6e1ae58
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data_urc.h
@@ -0,0 +1,37 @@
+#ifndef LYNQ_DATA_URC_H
+#define LYNQ_DATA_URC_H
+
+using ::android::Parcel;
+
+#define LYNQ_URC_SERVICE_PORT 8086
+
+/*the same with lynq_interface.h begin*/
+#define LYNQ_REQUEST_VENDOR_BASE 8000
+#define LYNQ_URC_VENDOR_BASE 9000
+//xf.li@20230610 add for T106 data start
+#define RIL_UNSOL_DATA_CALL_LIST_CHANGED 1010
+//xf.li@20230610 add for T106 data end
+#define LYNQ_AT_SNED (LYNQ_REQUEST_VENDOR_BASE +1)
+#define LYNQ_URC_CALL_STATUS_IND (LYNQ_URC_VENDOR_BASE+1)
+#define LYNQ_URC_DATA_STATUS_IND (LYNQ_URC_VENDOR_BASE+2)
+#define LYNQ_URC_DATA_CALL_STATUS_IND (LYNQ_URC_VENDOR_BASE+3)
+#define LYNQ_AUTO_ANSWER_CALL (LYNQ_REQUEST_VENDOR_BASE +2)
+#define LYNQ_REQUEST_SET_DTMF_VOLUME (LYNQ_REQUEST_VENDOR_BASE +3)
+#define LYNQ_URC_MODIFY_APNDB (LYNQ_URC_VENDOR_BASE+4)
+#define LYNQ_URC_RESET_APNDB (LYNQ_URC_VENDOR_BASE+5)
+
+typedef struct{
+ int resp_type;
+ int urcid;
+}lynq_head_t;
+
+int lynq_init_data_urc_thread();
+int lynq_deinit_data_urc_thread();
+bool is_support_urc(int urc_id);
+//xf.li@20230610 add for T106 data start
+bool is_support_urc_t106(int urc_id);
+void urc_msg_process_add_for_t106(Parcel *p);
+//xf.li@20230610 add for T106 data end
+void urc_msg_process(Parcel *p);
+
+#endif
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-data/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-data/makefile
new file mode 100755
index 0000000..1dbdf99
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-data/makefile
@@ -0,0 +1,79 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+ -std=c++11 \
+ -g -Os \
+ -flto \
+ -fPIC \
+ -fpermissive \
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
+endif
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+ LOCAL_CFLAGS += -DMOBILETEK_TARGET_PLATFORM_T106
+endif
+
+$(warning ################# lynq data demo ROOT: $(ROOT),includedir:$(includedir))
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+ -I$(LOCAL_PATH)/include/libdata \
+ -I$(ROOT)$(includedir)/lynq_shm \
+ -I$(ROOT)$(includedir)/logger \
+ -I$(ROOT)$(includedir)/liblog \
+
+
+LOCAL_LIBS := \
+ -L. \
+ -ldl \
+ -lstdc++ \
+ -llog \
+ -lcutils \
+ -lutils \
+ -lbinder \
+ -lpthread \
+ -llynq-log \
+ -llynq-uci \
+ -llynq-shm \
+
+ifeq ($(strip $(MOBILETEK_RIL_CFG)), GSW)
+ LOCAL_CFLAGS += -DGSW_RIL_CFG
+
+endif
+
+SOURCES = $(wildcard *.cpp)
+
+EXECUTABLE = liblynq-data.so
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+
+.PHONY: build clean install pack_rootfs
+all: build
+$(EXECUTABLE): $(OBJECTS)
+ $(CXX) -shared -Wl,--no-undefined $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+ $(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+build: $(EXECUTABLE)
+ $(warning ########## build $(EXECUTABLE) ##########)
+install:
+ mkdir -p $(ROOT)$(base_libdir)/
+ install $(EXECUTABLE) $(ROOT)$(base_libdir)/
+ mkdir -p $(ROOT)$(includedir)/$(NAME)/sdk
+pack_rootfs:
+ mkdir -p $(PACK_INITRAMFS_TO)$(base_libdir)/
+ cp -af $(EXECUTABLE) $(PACK_INITRAMFS_TO)$(base_libdir)/
+ $(CROSS)strip $(PACK_INITRAMFS_TO)$(base_libdir)/$(EXECUTABLE)
+ mkdir -p $(PACK_TO)$(base_libdir)/
+ cp -af $(EXECUTABLE) $(PACK_TO)$(base_libdir)/
+ $(CROSS)strip $(PACK_TO)$(base_libdir)/$(EXECUTABLE)
+.PHONY: clean
+clean:
+ $(RM) $(OBJECTS) $(EXECUTABLE)
+ -find . -name "*.o" -delete
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.cpp b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.cpp
new file mode 100755
index 0000000..c7b49e5
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.cpp
@@ -0,0 +1,87 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libdata/lynq_data.h>
+#include "data.h"
+#define TEST_RESULT "lynq_result="
+
+int init_data(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int uToken = atoi(argv[1]);
+ ret = lynq_init_data(uToken);
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
+int deinit_data(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ ret = lynq_deinit_data();
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
+int setup_data_call(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int handle = atoi(argv[1]);
+
+ ret = lynq_setup_data_call(&handle);
+
+ printf("%s%d\n",TEST_RESULT,ret);
+ printf("handle = %d\n", handle);
+ return ret;
+}
+int deactivte_data_call(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int handle = atoi(argv[1]);
+
+ ret = lynq_deactive_data_call(&handle);
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
+int wait_data_call(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int handle = atoi(argv[1]);
+
+ ret = lynq_wait_data_call_state_change(&handle);
+ printf("LYNQ_WAIT_DATA_CALL: handle = %d\n", handle);
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
+int setup_data_call_sp(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int flag = atoi(argv[5]);
+ int handle = atoi(argv[1]);
+
+ ret = lynq_setup_data_call_sp(&handle, argv[2], argv[3], NULL, NULL, NULL, argv[4], NULL);
+
+ printf("%s%d\n",TEST_RESULT,ret);
+ printf("handle = %d\n", handle);
+ return ret;
+}
+int get_data_call_list(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int handle = atoi(argv[1]);
+ lynq_data_call_response_v11_t dataCallList = {-1, -1, -1, -1,"", "", "", "", "", "", -1};
+
+ ret = lynq_get_data_call_list(&handle, &dataCallList);
+
+ printf("LYNQ_GET_DATA_CALL_LIST: handle = %d\n", handle);
+ printf("LYNQ_GET_DATA_CALL_LIST: status=%d, suggestedRetryTime=%d, cid=%d, active=%d, type=%s, ifname=%s, addresses=%s, dnses=%s, gateways=%s, pcscf=%s, mtu=%d\n",
+ dataCallList.status, dataCallList.suggestedRetryTime, dataCallList.cid, dataCallList.active,
+ dataCallList.type, dataCallList.ifname, dataCallList.addresses, dataCallList.dnses, dataCallList.gateways, dataCallList.pcscf,
+ dataCallList.mtu);
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.h
new file mode 100755
index 0000000..8ca841e
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/data.h
@@ -0,0 +1,8 @@
+//DATA
+int init_data(int argc, char *argv[], int sp_test);
+int deinit_data(int argc, char *argv[], int sp_test);
+int setup_data_call(int argc, char *argv[], int sp_test);
+int deactivte_data_call(int argc, char *argv[], int sp_test);
+int wait_data_call(int argc, char *argv[], int sp_test);
+int setup_data_call_sp(int argc, char *argv[], int sp_test);
+int get_data_call_list(int argc, char *argv[], int sp_test);
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/dispatch.cpp b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/dispatch.cpp
index 3a07304..f3f74e6 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/dispatch.cpp
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/dispatch.cpp
@@ -9,6 +9,9 @@
#include "dispatch.h"
#include "lynq.h"
#include "cc.h"
+#include "sms.h"
+#include "network.h"
+#include "data.h"
#define SOCKET_BUF_SIZE 512
typedef struct {
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h
index 40cc25b..6472942 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h
@@ -14,4 +14,36 @@
#define LYNQ_ANSWER LYNQ_BASE + 2
#define LYNQ_HUNGUP LYNQ_BASE + 3
#define LYNQ_CALL_INIT LYNQ_BASE + 4
+
+#define LYNQ_SMS LYNQ_BASE + 20
+#define LYNQ_SMS_INIT LYNQ_SMS + 1
+#define LYNQ_SMS_DEINIT LYNQ_SMS + 2
+#define LYNQ_SEND_SMS LYNQ_SMS + 3
+#define LYNQ_READ_SMS LYNQ_SMS + 4
+#define LYNQ_LIST_SMS LYNQ_SMS + 5
+#define LYNQ_DELETE_SMS LYNQ_SMS + 6
+#define LYNQ_WAIT_SMS LYNQ_SMS + 7
+
+#define LYNQ_NETWORK LYNQ_BASE + 30
+#define LYNQ_NETWORK_INIT LYNQ_NETWORK + 1
+#define LYNQ_NETWORK_DEINIT LYNQ_NETWORK + 2
+#define LYNQ_QUERY_OPERATER LYNQ_NETWORK + 3
+#define LYNQ_QUERY_NETWORK_SELECTION_MODE LYNQ_NETWORK + 4
+#define LYNQ_SET_NETWORK_SELECTION_MODE LYNQ_NETWORK + 5
+#define LYNQ_QUERY_AVAILABLE_NETWORK LYNQ_NETWORK + 6
+#define LYNQ_QUERY_REGISTRATION_STATE LYNQ_NETWORK + 7
+#define LYNQ_QUERY_PREFFERRED_NETWORKTYPE LYNQ_NETWORK + 8
+#define LYNQ_SET_PREFFERRED_NETWORKTYPE LYNQ_NETWORK + 9
+#define LYNQ_SOLICITED_SIGNAL_STRENGTH LYNQ_NETWORK + 10
+#define LYNQ_SET_IMS LYNQ_NETWORK + 11
+
+#define LYNQ_DATA LYNQ_BASE + 60
+#define LYNQ_DATA_INIT LYNQ_DATA + 1
+#define LYNQ_DATA_DEINIT LYNQ_DATA + 2
+#define LYNQ_DEACTIVATE_DATA_CALL LYNQ_DATA + 3
+#define LYNQ_WAIT_DATA_CALL LYNQ_DATA + 4
+#define LYNQ_SETUP_DATA_CALL LYNQ_DATA + 5
+#define LYNQ_SETUP_DATA_CALL_SP LYNQ_DATA + 6
+#define LYNQ_GET_DATA_CALL_LIST LYNQ_DATA + 7
+
int create_socket(const int domain, const int type, const int protocol,const int port,const char *IP,const char *socket_name,void * addr,int backlog,int cs);
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile
index 11720f6..293cc82 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile
@@ -23,11 +23,14 @@
-ldl \
-lstdc++ \
-lpthread \
- -llynq-call
+ -llynq-call \
+ -llynq-sms \
+ -llynq-network \
+ -llynq-data \
-SOURCES = main.cpp cc.cpp dispatch.cpp
+SOURCES = main.cpp cc.cpp dispatch.cpp sms.cpp network.cpp data.cpp
SOURCES_TOOL = dispatch.cpp socket-tool.cpp
EXECUTABLE = Mobiletek-Tester-RDIT
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/network.cpp b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/network.cpp
new file mode 100755
index 0000000..834b94d
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/network.cpp
@@ -0,0 +1,113 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <lynq_network/lynq_network/lynq_network.h>
+#include "network.h"
+#define TEST_RESULT "lynq_result="
+
+int init_network(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int uToken = atoi(argv[1]);
+ ret = lynq_network_init(uToken);
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
+int deinit_network(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ ret = lynq_network_deinit();
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
+int query_operater(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ ret = lynq_query_operater(argv[1], argv[2], argv[3]);
+ printf("%s%d\n",TEST_RESULT,ret);
+ printf("LYNQ_QUERY_OPERATER: OperatorFN=%s, OperatorSH=%s, MccMnc=%s\n", argv[1], argv[2], argv[3]);
+ return ret;
+}
+int query_network_selection_mode(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int netselMode = atoi(argv[1]);
+ ret = lynq_query_network_selection_mode(&netselMode);
+ printf("%s%d\n",TEST_RESULT,ret);
+ printf("LYNQ_QUERY_NETWORK_SELECTION_MODE: netselMode=%d\n", netselMode);
+ return ret;
+}
+int set_network_selection_mode(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ ret = lynq_set_network_selection_mode(argv[1], argv[2]);
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
+int query_available_network(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ ret = lynq_query_available_network(argv[1], argv[2], argv[3], argv[4]);
+ printf("%s%d\n",TEST_RESULT,ret);
+ printf("LYNQ_QUERY_AVAILABLE_NETWORK: OperatorFN=%s, OperatorSH=%s, MccMnc=%s, NetStatus=%s\n", argv[1], argv[2], argv[3], argv[4]);
+ return ret;
+}
+int query_registration_state(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int regState = atoi(argv[2]);
+ int imsRegState = atoi(argv[3]);
+ int netType = atoi(argv[6]);
+ int radioTechFam = atoi(argv[7]);
+ int netRejected = atoi(argv[8]);
+ ret = lynq_query_registration_state(argv[1], ®State, &imsRegState, argv[4], argv[5], &netType, &radioTechFam, &netRejected);
+ printf("%s%d\n",TEST_RESULT,ret);
+ printf("LYNQ_QUERY_REGISTRATION_STATE: regState=%d, imsRegState=%d, LAC=%s, CID=%s, netType=%d, radioTechFam=%d, netRejected=%d\n", regState, imsRegState, argv[4], argv[5], netType, radioTechFam, netRejected);
+ return ret;
+}
+int query_prefferred_networktype(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int preNetType = atoi(argv[1]);
+ ret = lynq_query_prefferred_networktype(&preNetType);
+ printf("%s%d\n",TEST_RESULT,ret);
+ printf("LYNQ_QUERY_PREFFERRED_NETWORKTYPE: preNetType=%d\n", preNetType);
+ return ret;
+}
+int set_prefferred_networktype(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int preNetType = atoi(argv[1]);
+ ret = lynq_set_prefferred_networktype(preNetType);
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
+int solicited_signal_strength(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ signalStrength_t solSigStren = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
+
+ ret = lynq_solicited_signal_strength(&solSigStren);
+ printf("%s%d\n",TEST_RESULT,ret);
+ printf("LYNQ_SOLICITED_SIGNAL_STRENGTH: gw_sig_valid=%d, wcdma_valid=%d, rssi=%d, rscp=%d\n", solSigStren.gw_sig_valid, solSigStren.wcdma_sig_valid, solSigStren.rssi, solSigStren.rscp);
+ return ret;
+}
+int set_ims(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int ims_mode = atoi(argv[1]);
+ ret = lynq_set_ims(ims_mode);
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/network.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/network.h
new file mode 100755
index 0000000..4d4a582
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/network.h
@@ -0,0 +1,12 @@
+//network
+int init_network(int argc, char *argv[], int sp_test);
+int deinit_network(int argc, char *argv[], int sp_test);
+int query_operater(int argc, char *argv[], int sp_test);
+int query_network_selection_mode(int argc, char *argv[], int sp_test);
+int set_network_selection_mode(int argc, char *argv[], int sp_test);
+int query_available_network(int argc, char *argv[], int sp_test);
+int query_registration_state(int argc, char *argv[], int sp_test);
+int query_prefferred_networktype(int argc, char *argv[], int sp_test);
+int set_prefferred_networktype(int argc, char *argv[], int sp_test);
+int solicited_signal_strength(int argc, char *argv[], int sp_test);
+int set_ims(int argc, char *argv[], int sp_test);
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h
index e20d230..d8e275c 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h
@@ -3,4 +3,34 @@
{"LYNQ_CALL_INIT",init_call, "init the call lib", LYNQ_CALL_INIT},
{"LYNQ_ANSWER",answer_test, "answer a call", LYNQ_ANSWER},
{"LYNQ_HUNGUP",hungup_test, "hungup a call", LYNQ_HUNGUP},
+//SMS
+ {"LYNQ_SMS_INIT",init_sms, "init the sms lib", LYNQ_SMS_INIT},
+ {"LYNQ_SMS_DEINIT",deinit_sms, "deinit the sms lib", LYNQ_SMS_DEINIT},
+ {"LYNQ_SEND_SMS",send_sms, "send short message", LYNQ_SEND_SMS},
+ {"LYNQ_READ_SMS",read_sms, "read short message", LYNQ_READ_SMS},
+ {"LYNQ_LIST_SMS",list_sms, "list short message", LYNQ_LIST_SMS},
+ {"LYNQ_DELETE_SMS",delete_sms, "delete short messsage", LYNQ_DELETE_SMS},
+ {"LYNQ_WAIT_SMS",wait_sms, "wait short messsage", LYNQ_WAIT_SMS},
+//NETWORK
+ {"LYNQ_NETWORK_INIT",init_network, "init the network lib", LYNQ_NETWORK_INIT},
+ {"LYNQ_NETWORK_DEINIT",deinit_network, "deinit the network lib", LYNQ_NETWORK_DEINIT},
+ {"LYNQ_QUERY_OPERATER",query_operater, "query operater infomation ", LYNQ_QUERY_OPERATER},
+ {"LYNQ_QUERY_NETWORK_SELECTION_MODE",query_network_selection_mode, "query network selection mode", LYNQ_QUERY_NETWORK_SELECTION_MODE},
+ {"LYNQ_SET_NETWORK_SELECTION_MODE",set_network_selection_mode, "set network selection mode", LYNQ_SET_NETWORK_SELECTION_MODE},
+ {"LYNQ_QUERY_AVAILABLE_NETWORK",query_available_network, "query available network", LYNQ_QUERY_AVAILABLE_NETWORK},
+ {"LYNQ_QUERY_REGISTRATION_STATE",query_registration_state, "query registration state", LYNQ_QUERY_REGISTRATION_STATE},
+ {"LYNQ_QUERY_PREFFERRED_NETWORKTYPE",query_prefferred_networktype, "query prefferred networktype", LYNQ_QUERY_PREFFERRED_NETWORKTYPE},
+ {"LYNQ_SET_PREFFERRED_NETWORKTYPE",set_prefferred_networktype, "set prefferred networktype", LYNQ_SET_PREFFERRED_NETWORKTYPE},
+ {"LYNQ_SOLICITED_SIGNAL_STRENGTH",solicited_signal_strength, "solicited signal strength", LYNQ_SOLICITED_SIGNAL_STRENGTH},
+ {"LYNQ_SET_IMS",set_ims, "set ims open or close", LYNQ_SET_IMS},
+//DATA
+ {"LYNQ_DATA_INIT",init_data, "init the data lib", LYNQ_DATA_INIT},
+ {"LYNQ_DATA_DEINIT",deinit_data, "deinit the data lib", LYNQ_DATA_DEINIT},
+ {"LYNQ_SETUP_DATA_CALL",setup_data_call, "set up data call", LYNQ_SETUP_DATA_CALL},
+ {"LYNQ_SETUP_DATA_CALL_SP",setup_data_call_sp, "set up data call sp", LYNQ_SETUP_DATA_CALL_SP},
+ {"LYNQ_DEACTIVATE_DATA_CALL",deactivte_data_call, "wait data call", LYNQ_DEACTIVATE_DATA_CALL},
+ {"LYNQ_WAIT_DATA_CALL",wait_data_call, "wait data call", LYNQ_WAIT_DATA_CALL},
+ {"LYNQ_GET_DATA_CALL_LIST",get_data_call_list, "wait data call", LYNQ_GET_DATA_CALL_LIST},
{(char *)NULL, NULL, (char *)NULL , -1},
+
+
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.cpp b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.cpp
new file mode 100755
index 0000000..3f2b865
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.cpp
@@ -0,0 +1,82 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <libsms/lynq_sms.h>
+#include "sms.h"
+#define TEST_RESULT "lynq_result="
+
+int init_sms(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int uToken = atoi(argv[1]);
+ ret = lynq_sms_init(uToken);
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
+int deinit_sms(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ ret = lynq_sms_deinit();
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
+int send_sms(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int charset = atoi(argv[2]);
+ int msglen = atoi(argv[4]);
+ ret = lynq_send_sms(argv[1], charset, argv[3], msglen);
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
+int read_sms(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int index = atoi(argv[1]);
+ int status = atoi(argv[2]);
+ int charset = atoi(argv[3]);
+ int smscLen = atoi(argv[5]);
+ int smslen = atoi(argv[7]);
+ int numLen = atoi(argv[9]);
+ int current = atoi(argv[10]);
+ int total = atoi(argv[11]);
+ ret = lynq_read_sms(index, &status, &charset, argv[4], &smscLen, &smslen, argv[6], argv[8], &numLen, ¤t, &total);
+ printf("%s%d\n",TEST_RESULT,ret);
+ printf("LYNQ_SMS_READ: status=%d, charset=%d, smsc=%s, smscLen=%d, message=%s, smslen=%d, teleNum=%s, numLen=%d, current=%d, total=%d\n", status, charset, argv[4], smscLen, argv[6], smslen, argv[8], numLen, current, total);
+ return ret;
+}
+int list_sms(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+
+ ret = lynq_list_sms(argv[1]);
+ printf("%s%d\n",TEST_RESULT,ret);
+ printf("LYNQ_LIST_SMS: index_list=%s\n", argv[1]);
+ return ret;
+}
+int delete_sms(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int index = atoi(argv[1]);
+
+ ret = lynq_delete_sms(index);
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
+int wait_sms(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ int handle = atoi(argv[1]);
+
+ ret = lynq_wait_receive_new_sms(&handle);
+ printf("%s%d\n",TEST_RESULT,ret);
+ printf("LYNQ_WAIT_SMS: handle=%d\n", handle);
+ return ret;
+}
+
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.h
new file mode 100755
index 0000000..3185e4a
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.h
@@ -0,0 +1,8 @@
+//SMS
+int init_sms(int argc, char *argv[], int sp_test);
+int deinit_sms(int argc, char *argv[], int sp_test);
+int send_sms(int argc, char *argv[], int sp_test);
+int read_sms(int argc, char *argv[], int sp_test);
+int list_sms(int argc, char *argv[], int sp_test);
+int delete_sms(int argc, char *argv[], int sp_test);
+int wait_sms(int argc, char *argv[], int sp_test);
diff --git a/update_version.sh b/update_version.sh
index cad8e12..a64b49f 100644
--- a/update_version.sh
+++ b/update_version.sh
@@ -1,8 +1,8 @@
#!/bin/bash
#export LYNQ_VERSION="T106_lynq_version_ap_build_sh"
-LYNQ_AP_VERSION="T106.EA.02.00"
-LYNQ_CAP_INSIDE_VERSION="EA.CAP.02.01"
-LYNQ_CAP_VERSION="EA.CAP.02"
+LYNQ_AP_VERSION="T106CN-ZS03.V2.01.01.02P48U02.AP.03.00"
+LYNQ_CAP_INSIDE_VERSION="CAP.03.00"
+LYNQ_CAP_VERSION="CAP.03"
COMMIT_ID="$(git rev-parse HEAD)"
LYNQ_SW_INSIDE_VERSION="LYNQ_CONFIG_VERSION = \"${LYNQ_AP_VERSION}_${LYNQ_CAP_INSIDE_VERSION}\""
@@ -17,4 +17,3 @@
eval sed -i 's/^.*LYNQ_CONFIG_VERSION[[:space:]]=.*$/"${LYNQ_SW_INSIDE_VERSION}"/' $(pwd)/boot/common/src/uboot/arch/arm/lib/Makefile
eval sed -i 's/^.*LYNQ_CONFIG_COMMITID[[:space:]]=.*$/"${LYNQ_COMMITID}"/' $(pwd)/boot/common/src/uboot/arch/arm/lib/Makefile
-