فهرست منبع

2020-08-18 / Eason Yang
1.Change : Module_Wifi.c
Reason :
a) Rename version V0.08
b) Fixed isReachableInternet() remove ocpp flag
2.Change : Module_4g.c
Reason :
a) Rename version V0.04
b) Fixed isReachableInternet() remove ocpp flag

8009 4 سال پیش
والد
کامیت
4a3a5e9768
2فایلهای تغییر یافته به همراه40 افزوده شده و 52 حذف شده
  1. 20 26
      EVSE/Modularization/Module_4g.c
  2. 20 26
      EVSE/Modularization/Module_Wifi.c

+ 20 - 26
EVSE/Modularization/Module_4g.c

@@ -2,9 +2,9 @@
  *  Module_4g.c
  *
  *  Created on: 2019-11-29
- *  Update on: 2020-07-13
+ *  Update on: 2020-08-18
  *  Author: Eason Yang
- *  Version: D0.03
+ *  Version: V0.04
  */
 
 #include    <sys/types.h>
@@ -811,41 +811,35 @@ int isReachableInternet(void)
 	char buf[512];
 	//char tmp[512];
 
-	if(ShmOCPP16Data->OcppConnStatus == PASS)
+	for(int idx=0;idx<ARRAY_SIZE(valid_Internet);idx++)
 	{
-		result = PASS;
-	}
-	else
-	{
-		for(int idx=0;idx<ARRAY_SIZE(valid_Internet);idx++)
+		sprintf(cmd, "ping -c 1 -w 3 -I ppp0 %s", valid_Internet[idx]);
+		fp = popen(cmd, "r");
+		if(fp != NULL)
 		{
-			sprintf(cmd, "ping -c 1 -w 3 -I ppp0 %s", valid_Internet[idx]);
-			fp = popen(cmd, "r");
-			if(fp != NULL)
+			while(fgets(buf, sizeof(buf), fp) != NULL)
 			{
-				while(fgets(buf, sizeof(buf), fp) != NULL)
+				if(strstr(buf, "transmitted") > 0)
 				{
-					if(strstr(buf, "transmitted") > 0)
-					{
-						//sscanf(buf, "%*s%*s%*s%*s%*s%s", tmp);
+					//sscanf(buf, "%*s%*s%*s%*s%*s%s", tmp);
 
-						if(strstr(buf,"100%") != NULL)
-						{
+					if(strstr(buf,"100%") != NULL)
+					{
 
-						}
-						else
-						{
-							result = PASS;
-						}
-						//DEBUG_INFO("%s",buf);
-						//DEBUG_INFO("%s\n",tmp);
 					}
+					else
+					{
+						result = PASS;
+					}
+					//DEBUG_INFO("%s",buf);
+					//DEBUG_INFO("%s\n",tmp);
 				}
 			}
-			pclose(fp);
 		}
+		
+		pclose(fp);
 	}
-
+	
 	return result;
 }
 

+ 20 - 26
EVSE/Modularization/Module_Wifi.c

@@ -2,9 +2,9 @@
  *  Module_Wifi.c
  *
  *  Created on: 2020-01-14
- *  Update on: 2020-07-23
+ *  Update on: 2020-08-18
  *  Author: Jerry Wang, Eason Yang, Folus Wen
- *  Version: D0.07
+ *  Version: V0.08
  */
 
 #include 	<sys/time.h>
@@ -590,41 +590,35 @@ int isReachableInternet()
 	char buf[512];
 	//char tmp[512];
 
-	if(ShmOCPP16Data->OcppConnStatus == PASS)
+	for(int idx=0;idx<ARRAY_SIZE(valid_Internet);idx++)
 	{
-		result = PASS;
-	}
-	else
-	{
-		for(int idx=0;idx<ARRAY_SIZE(valid_Internet);idx++)
+		sprintf(cmd, "ping -c 1 -w 3 -I %s %s", Wifi.currentInterface, valid_Internet[idx]);
+		fp = popen(cmd, "r");
+		if(fp != NULL)
 		{
-			sprintf(cmd, "ping -c 1 -w 3 -I %s %s", Wifi.currentInterface, valid_Internet[idx]);
-			fp = popen(cmd, "r");
-			if(fp != NULL)
+			while(fgets(buf, sizeof(buf), fp) != NULL)
 			{
-				while(fgets(buf, sizeof(buf), fp) != NULL)
+				if(strstr(buf, "transmitted") > 0)
 				{
-					if(strstr(buf, "transmitted") > 0)
-					{
-						//sscanf(buf, "%*s%*s%*s%*s%*s%*s%s", tmp);
+					//sscanf(buf, "%*s%*s%*s%*s%*s%*s%s", tmp);
 
-						if(strstr(buf,"100%") != NULL)
-						{
+					if(strstr(buf,"100%") != NULL)
+					{
 
-						}
-						else
-						{
-							result = PASS;
-						}
-						//DEBUG_INFO("%s",buf);
-						//DEBUG_INFO("%s\n",tmp);
 					}
+					else
+					{
+						result = PASS;
+					}
+					//DEBUG_INFO("%s",buf);
+					//DEBUG_INFO("%s\n",tmp);
 				}
 			}
-			pclose(fp);
 		}
+		
+		pclose(fp);
 	}
-
+	
 	return result;
 }