Browse Source

[Add][Modularization][Module_4g]

2022.09.12 / Folus Wen

Actions:
1. Add network type configure for THALES

Files:
1. As follow commit history

Image version: V0.14.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
Folus Wen 2 years ago
parent
commit
ee9dd16f41
2 changed files with 54 additions and 8 deletions
  1. 50 6
      EVSE/Modularization/Module_4g.c
  2. 4 2
      EVSE/rootfs/root/ppp/ppp-on-dialer-org

+ 50 - 6
EVSE/Modularization/Module_4g.c

@@ -112,7 +112,7 @@ void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
 
 char *portName[3] 				= {"/dev/ttyUSB2", "/dev/ttyACM2", "/dev/ttyACM2"};
 char *valid_Internet[2] 		= {"8.8.8.8", "180.76.76.76"};
-char *Version_And_Date[2]		= {"V0.13","2022-04-21"};
+char *Version_And_Date[2]		= {"V0.14","2022-09-12"};
 pid_t	pid;
 
 struct dongle_info
@@ -644,6 +644,7 @@ int isReadInfo(int connectStep)
 							if(sscanf(rx, "%*[^:]:%*[^,],%d,%*[^,],%*[^,],%*[^,],%*[^,],%[^,]", &Dongle.channel, Dongle.operator) == 2)
 							{
 								Dongle.MODE = NET_MODE_GSM_WCDMA;
+
 								memset(Dongle.band, 0x00, ARRAY_SIZE(Dongle.band));
 								memset(Dongle.act, 0x00, ARRAY_SIZE(Dongle.act));
 							}
@@ -1362,7 +1363,47 @@ void configNetworkMode(uint8_t actReq)
 	}
 	else if(Dongle.Model == DONGLE_THALES)
 	{
-		system("cp /root/ppp/ppp-on-dialer-org /root/ppp/ppp-on-dialer");
+		while (fgets(str, ARRAY_SIZE(str), fpOrg) != NULL)
+		{
+			fprintf(fpDst,"%s", str);
+
+			if(strstr(str, "ATE1") != NULL)
+			{
+				switch(actReq)
+				{
+					case NETWORK_MODE_GSM:
+						fprintf(fpDst, "	OK		\"AT\\^SCFG=\\\"Radio\\/Band\\/2G\\\",\\\"0000000f\\\"\"	\\\n");
+						fprintf(fpDst, "	OK		\\\\d\\\\d\\\\d				\\\n");
+						fprintf(fpDst, "	\"\"	\"AT\\^SCFG=\\\"Radio\\/Band\\/3G\\\",\\\"0\\\"\"	\\\n");
+						fprintf(fpDst, "	OK		\\\\d\\\\d\\\\d				\\\n");
+						fprintf(fpDst, "	\"\"	\"AT\\^SCFG=\\\"Radio\\/Band\\/4G\\\",\\\"0\\\",\\\"0\\\"\"	\\\n");
+						break;
+					case NETWORK_MODE_UMTS:
+						fprintf(fpDst, "	OK		\"AT\\^SCFG=\\\"Radio\\/Band\\/2G\\\",\\\"0\\\"\"	\\\n");
+						fprintf(fpDst, "	OK		\\\\d\\\\d\\\\d				\\\n");
+						fprintf(fpDst, "	\"\"	\"AT\\^SCFG=\\\"Radio\\/Band\\/3G\\\",\\\"000400bf\\\"\"	\\\n");
+						fprintf(fpDst, "	OK		\\\\d\\\\d\\\\d				\\\n");
+						fprintf(fpDst, "	\"\"	\"AT\\^SCFG=\\\"Radio\\/Band\\/4G\\\",\\\"0\\\",\\\"0\\\"\"	\\\n");
+						break;
+					case NETWORK_MODE_LTE:
+						fprintf(fpDst, "	OK		\"AT\\^SCFG=\\\"Radio\\/Band\\/2G\\\",\\\"0\\\"\"	\\\n");
+						fprintf(fpDst, "	OK		\\\\d\\\\d\\\\d				\\\n");
+						fprintf(fpDst, "	\"\"	\"AT\\^SCFG=\\\"Radio\\/Band\\/3G\\\",\\\"0\\\"\"	\\\n");
+						fprintf(fpDst, "	OK		\\\\d\\\\d\\\\d				\\\n");
+						fprintf(fpDst, "	\"\"	\"AT\\^SCFG=\\\"Radio\\/Band\\/4G\\\",\\\"0a0e18df\\\",\\\"00000002000001a0\\\"\"	\\\n");
+						break;
+					case NETWORK_MODE_AUTO:
+						fprintf(fpDst, "	OK		\"AT\\^SCFG=\\\"Radio\\/Band\\/2G\\\",\\\"0000000f\\\"\"	\\\n");
+						fprintf(fpDst, "	OK		\\\\d\\\\d\\\\d				\\\n");
+						fprintf(fpDst, "	\"\"	\"AT\\^SCFG=\\\"Radio\\/Band\\/3G\\\",\\\"000400bf\\\"\"	\\\n");
+						fprintf(fpDst, "	OK		\\\\d\\\\d\\\\d				\\\n");
+						fprintf(fpDst, "	\"\"	\"AT\\^SCFG=\\\"Radio\\/Band\\/4G\\\",\\\"0a0e18df\\\",\\\"00000002000001a0\\\"\"	\\\n");
+					default:
+						break;
+				}
+			}
+			memset(str, 0x00, ARRAY_SIZE(str));
+		}
 	}
 
 	fclose(fpOrg);
@@ -1672,10 +1713,13 @@ int main(void)
 						DEBUG_INFO("Device Channel: %d\n", Dongle.channel);
 					}
 
-					DEBUG_INFO("TX counter: %d bytes\n", Dongle.bytesTx);
-					DEBUG_INFO("RX counter: %d bytes\n", Dongle.bytesRx);
-					DEBUG_INFO("Delta counter: %d bytes\n", (Dongle.bytesTx+Dongle.bytesRx)-Dongle.lastCounter);
-					Dongle.lastCounter = (Dongle.bytesTx+Dongle.bytesRx);
+					if(Dongle.Model == DONGLE_QUECTEL)
+					{
+						DEBUG_INFO("TX counter: %d bytes\n", Dongle.bytesTx);
+						DEBUG_INFO("RX counter: %d bytes\n", Dongle.bytesRx);
+						DEBUG_INFO("Delta counter: %d bytes\n", (Dongle.bytesTx+Dongle.bytesRx)-Dongle.lastCounter);
+						Dongle.lastCounter = (Dongle.bytesTx+Dongle.bytesRx);
+					}
 					DEBUG_INFO("++++++++++++++++++++++++++++++++++++++++\n");
 
 					break;

+ 4 - 2
EVSE/rootfs/root/ppp/ppp-on-dialer-org

@@ -39,7 +39,8 @@ exec /root/ppp/chat -v						\
 	""              "ATZ" 				\
 	OK              "ATE1" 				\
 	OK              "AT+CGDCONT=1,\"IP\",\"$APN\" " \
-        OK              "AT+CFUN=1"                     \
+	OK              \\d\\d\\d                       \
+        ""              "AT+CFUN=1"                     \
         OK              "AT+CGDATA=\"ppp\",1"         	\
 	TIMEOUT         22                              \
 	OK             	\\d\\d\\d			\
@@ -71,7 +72,8 @@ exec /root/ppp/chat -v						\
 	""              "ATZ" 				\
 	OK              "ATE1" 				\
 	OK              "AT+CGDCONT=1,\"IP\",\"$APN\" " \
-	OK              "AT+CFUN=1"                     \
+	OK              \\d\\d\\d                       \
+	""              "AT+CFUN=1"                     \
         OK              "AT+CGDATA=\"ppp\",1"         	\
         TIMEOUT         22                              \
 	OK             	\\d\\d\\d			\