Forráskód Böngészése

[Add][Modularization][Webservice / Web page]

2022.03.23 / Folus Wen

Actions:
1. Webpage enable restart process item.
2. Webservice restart process depend on which OCPP task(1.6/2.0.1/NA) start.

Files:
1. As follow commit history

Image version: D0.00.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 3 éve
szülő
commit
2b0c6779ce
2 módosított fájl, 56 hozzáadás és 3 törlés
  1. 54 1
      EVSE/Modularization/WebService.c
  2. 2 2
      EVSE/rootfs/var/www/head.php

+ 54 - 1
EVSE/Modularization/WebService.c

@@ -52,6 +52,8 @@ struct GBTData				*ShmGBTData;
 struct CcsData				*ShmCcsData;
 struct PsuData 				*ShmPsuData;
 struct PrimaryMcuData		*ShmPrimaryMcuData;
+struct OCPP16Data			*ShmOCPP16Data;
+struct OCPP20Data			*ShmOCPP20Data;
 #ifdef DO360
 ChargerInfoData                 *ShmChargerInfo;
 struct ChargingInfoData 		*_chargingData[4];
@@ -304,6 +306,41 @@ int InitShareMemory() {
 		result = FAIL;
 	} else {
 	}
+
+   	//creat ShmOCPP16Data
+   	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
+    {
+
+   		DEBUG_ERROR("shmget ShmOCPP16Data NG\n");
+
+   		result = FAIL;
+	}
+    else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+
+    	DEBUG_ERROR("shmat ShmOCPP16Data NG\n");
+
+    	result = FAIL;
+   	}
+   	memset(ShmOCPP16Data,0,sizeof(struct OCPP16Data));
+
+   	//creat ShmOCPP20Data
+	if ((MeterSMId = shmget(ShmOcpp20ModuleKey, sizeof(struct OCPP20Data), 0777)) < 0)
+	{
+
+		DEBUG_ERROR("shmget OCPP20Data NG\n");
+
+		result = FAIL;
+	}
+	else if ((ShmOCPP20Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+
+		DEBUG_ERROR("shmat OCPP20Data NG\n");
+
+		result = FAIL;
+	}
+	memset(ShmOCPP20Data,0,sizeof(struct OCPP20Data));
+
 #ifdef DO360
 	//creat ShmChargerInfo
     if ((MeterSMId = shmget(SM_ChargerInfoKey, sizeof(ChargerInfoData), IPC_CREAT | 0777)) < 0)
@@ -1322,7 +1359,23 @@ int main(int argc, char *argv[]) {
 
 		if (strcmp(argv[1], "restart") == 0)
 		{
-			system("exec /usr/bin/run_evse_restart.sh");
+			if((ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16) && (system("pidof -s OcppBackend > /dev/null") == 0))
+			{
+				sprintf((char*)ShmOCPP16Data->Reset.Type, "Soft");
+				ShmOCPP16Data->MsMsg.bits.ResetReq = 1;
+				DEBUG_INFO("Soft reset by OCPP1.6 form web page.\n");
+			}
+			else if((ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20) && (system("pidof -s OcppBackend20 > /dev/null") == 0))
+			{
+				sprintf((char*)ShmOCPP20Data->Reset.type, "OnIdle");
+				ShmOCPP20Data->MsMsg.bits.ResetReq = 1;
+				DEBUG_INFO("Soft reset by OCPP2.0.1 form web page.\n");
+			}
+			else
+			{
+				system("exec /usr/bin/run_evse_restart.sh");
+				DEBUG_INFO("Soft reset directly form web page.\n");
+			}
 		}
 	}
 

+ 2 - 2
EVSE/rootfs/var/www/head.php

@@ -369,9 +369,9 @@
 						<li>
 						  <a href="set_passwd.php"><?php echo $lang->showWord("passwd"); ?></a>
 						</li>
-<?php /*						<li>
+						<li>
 						  <a href="set_restart.php"><?php echo $lang->showWord("restart"); ?></a>
-						</li>*/?>
+						</li>
                       </ul>
                     </li>
 					<li<?php echo ($tag_header=='language'?' class="active"':''); ?>>