[Feature][S300][task-view-1920][app] add S300V2 BJMTN plmn dial lock
Change-Id: Ic04c7adac1a049b4a8b4df068717358796392ae0
diff --git a/lynq/S300/BJMTN/ap/app/zte_comm/at_ctl/src/atconfig/ps_pdp.c b/lynq/S300/BJMTN/ap/app/zte_comm/at_ctl/src/atconfig/ps_pdp.c
index 28d7339..5ac2c7e 100755
--- a/lynq/S300/BJMTN/ap/app/zte_comm/at_ctl/src/atconfig/ps_pdp.c
+++ b/lynq/S300/BJMTN/ap/app/zte_comm/at_ctl/src/atconfig/ps_pdp.c
@@ -34,13 +34,13 @@
#include <asm/unistd.h>
#include <limits.h>
-
-
#define PDP_CMD_LEN 256 //PDP¼¤»îÏà¹ØµÄATÃüÁ¶È
#define MAX_AT_IPV6_SIZE 64 // ´ÓATÏìÓ¦ÃüÁî»ñÈ¡µÄIPV6µØÖ·³¤¶È
#define MAX_AT_IPV4V6_SIZE 80 // ´ÓATÏìÓ¦ÃüÁî»ñÈ¡µÄIPV4V6µØÖ·³¤¶È£¬16(IPV4) + 64(IPV6)
+extern int is_valid_plmn(char *mcc, char *mnc);
+
enum
{
CID_IDLE = 0,
@@ -1586,6 +1586,19 @@
char creg_stat[20] = {0};
char cereg_stat[20] = {0};
char ppp_status[20] = {0};
+ int ret = 0;
+ char mcc[4] = {0};
+ char mnc[4] = {0};
+
+ cfg_get_item("mcc", mcc, sizeof(mcc));
+ cfg_get_item("mnc", mnc, sizeof(mnc));
+ printf("pdp_act_func mcc=%s,mnc=%s\n", mcc, mnc);
+
+ ret = is_valid_plmn(mcc, mnc);
+ if(0 == ret)
+ {
+ return NULL;
+ }
cfg_get_item("cgreg_stat", creg_stat, sizeof(creg_stat));
cfg_get_item("cereg_stat", cereg_stat, sizeof(cereg_stat));
@@ -3289,9 +3302,23 @@
void start_pdp_auto_dial(void)
{
+ int ret = 0;
char auto_reconnect [20] = {0};
char reconnect_type[20] = {0};
+ char mcc[4] = {0};
+ char mnc[4] = {0};
+
+ cfg_get_item("mcc", mcc, sizeof(mcc));
+ cfg_get_item("mnc", mnc, sizeof(mnc));
+ printf("start_pdp_auto_dial mcc=%s,mnc=%s\n", mcc, mnc);
+
+ ret = is_valid_plmn(mcc, mnc);
+ if(0 == ret)
+ {
+ return;
+ }
+
cfg_get_item("reconnect_type", reconnect_type, sizeof(reconnect_type));
cfg_get_item("auto_reconnect", auto_reconnect, sizeof(auto_reconnect));
//µ±Ç°Ä¬ÈÏapnµÄpdp¼¤»îÇëÇóÒÑ´æÔÚ£¬Ôò˵Ã÷ĬÈÏapn¿Ï¶¨ÒѾ·¢Æð¹ýpdp¼¤»î
diff --git a/lynq/S300/BJMTN/ap/app/zte_comm/zte_locknet/src/zctrm_locknet_main.c b/lynq/S300/BJMTN/ap/app/zte_comm/zte_locknet/src/zctrm_locknet_main.c
index ed4968f..0476fb9 100755
--- a/lynq/S300/BJMTN/ap/app/zte_comm/zte_locknet/src/zctrm_locknet_main.c
+++ b/lynq/S300/BJMTN/ap/app/zte_comm/zte_locknet/src/zctrm_locknet_main.c
@@ -3,6 +3,8 @@
#include "zctrm_locknet.h"
int sendflag = 0;
+extern void plmnList_init(void);
+
void locknet_msg_proc(MSG_BUF *msg_buf)
{
switch (msg_buf->usMsgCmd) {
@@ -70,6 +72,7 @@
prctl(PR_SET_NAME, "locknet", 0, 0, 0);
/* ´´½¨ÏûÏ¢¶ÓÁÐ*/
msg_handle = msgget(MODULE_ID_LOCKNET, IPC_CREAT|0600);
+ plmnList_init();
while(1)
{
memset(&msg, 0x00, sizeof(MSG_BUF));
diff --git a/lynq/S300/BJMTN/ap/app/zte_comm/zte_locknet/src/zctrm_locknet_proc.c b/lynq/S300/BJMTN/ap/app/zte_comm/zte_locknet/src/zctrm_locknet_proc.c
index 8407539..7696f18 100755
--- a/lynq/S300/BJMTN/ap/app/zte_comm/zte_locknet/src/zctrm_locknet_proc.c
+++ b/lynq/S300/BJMTN/ap/app/zte_comm/zte_locknet/src/zctrm_locknet_proc.c
@@ -27,6 +27,10 @@
SINT32 g_Sec_Status = ENCRYPT_INITING;
extern int sendflag;
+#define NUM_BASE 52
+static T_zCtrm_LockListPara s_plmnList[20] = {0};
+static UINT8 s_plmnList_num = 0;
+
SINT32 zCtrm_Atohex(CHAR c)
{
SINT32 result = 0;
@@ -2220,3 +2224,57 @@
return 0;
}
+void plmnList_init(void)
+{
+ const char * temp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ memset(s_plmnList, 0, sizeof(s_plmnList));
+ //add china plmn 46000-46011
+ UINT8 i = 0;
+ for(i = 0; i < 12; i++)
+ {
+ s_plmnList[i].mcc[0] = temp[NUM_BASE+4];
+ s_plmnList[i].mcc[1] = temp[NUM_BASE+6];
+ s_plmnList[i].mcc[2] = temp[NUM_BASE+0];
+ if (i < 10)
+ {
+ s_plmnList[i].mnc[0] = temp[NUM_BASE+0];
+ s_plmnList[i].mnc[1] = temp[NUM_BASE+i];
+ }
+ else
+ {
+ s_plmnList[i].mnc[0] = temp[NUM_BASE+1];
+ s_plmnList[i].mnc[1] = temp[NUM_BASE+i-10];
+ }
+ }
+ //add plmn 61603
+ s_plmnList[12].mcc[0] = temp[NUM_BASE+6];
+ s_plmnList[12].mcc[1] = temp[NUM_BASE+1];
+ s_plmnList[12].mcc[2] = temp[NUM_BASE+6];
+ s_plmnList[12].mnc[0] = temp[NUM_BASE+0];
+ s_plmnList[12].mnc[1] = temp[NUM_BASE+3];
+
+ s_plmnList_num = 13;
+}
+
+int is_valid_plmn(char *mcc, char *mnc)
+{
+ if(mcc == NULL || mnc == NULL)
+ {
+ return 0;
+ }
+
+ if(0 == s_plmnList_num)
+ {
+ return 1;
+ }
+
+ UINT8 i = 0;
+ for(i = 0; i < s_plmnList_num; i++)
+ {
+ if(strcmp(mcc, s_plmnList[i].mcc) == 0 && strcmp(mnc, s_plmnList[i].mnc) == 0)
+ {
+ return 1;
+ }
+ }
+ return 0;
+}