Browse Source

2021-04-29 / ct_chen

Actions:
1. Webservice add "StopChargingByButton" setting in "charging" tab

Files:
1. EVSE/Modularization/WebService.c
   EVSE/Projects/define.h
   EVSE/rootfs/var/www/head.php
   EVSE/rootfs/var/www/set_charging.php
   EVSE/rootfs/var/www/set_charging_action.php
ct_chen 3 years ago
parent
commit
82826c6d33

+ 8 - 0
EVSE/Modularization/WebService.c

@@ -668,6 +668,7 @@ int main(int argc, char *argv[]) {
 			int MaxChargingCurrent = 0;
 			int AcMaxChargingCurrent = 0;
 			int MaxChargingDuration = 0;
+			int StopChargingByButton = 0;
 			char *LocalWhiteCard0 = NULL;
 			char *LocalWhiteCard1 = NULL;
 			char *LocalWhiteCard2 = NULL;
@@ -725,6 +726,10 @@ int main(int argc, char *argv[]) {
 				MaxChargingDuration = json_object_get_int(val_obj);
 				ShmSysConfigAndInfo->SysConfig.MaxChargingDuration = MaxChargingDuration;
 			}
+			if( json_object_object_get_ex(jobj, "StopChargingByButton", &val_obj) ) {
+				StopChargingByButton = json_object_get_int(val_obj);
+				ShmSysConfigAndInfo->SysConfig.StopChargingByButton = StopChargingByButton;
+			}
 			if( json_object_object_get_ex(jobj, "LocalWhiteCard0", &val_obj) ) {
 				LocalWhiteCard0 = (char*)json_object_get_string(val_obj);
 				strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0],LocalWhiteCard0);
@@ -1459,6 +1464,7 @@ int main(int argc, char *argv[]) {
 		struct json_object *MaxChargingCurrent;
 		struct json_object *AcMaxChargingCurrent;
 		struct json_object *MaxChargingDuration;
+		struct json_object *StopChargingByButton;
 		struct json_object *LocalWhiteCard[10];
 		struct json_object *LocalWhiteCardArr= json_object_new_array();
 		struct json_object *isBilling;
@@ -1699,6 +1705,7 @@ int main(int argc, char *argv[]) {
 		MaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
 		AcMaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent);
 		MaxChargingDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingDuration);
+		StopChargingByButton = json_object_new_int(ShmSysConfigAndInfo->SysConfig.StopChargingByButton);
 		LocalWhiteCard[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0]);
 		LocalWhiteCard[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1]);
 		LocalWhiteCard[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2]);
@@ -2215,6 +2222,7 @@ int main(int argc, char *argv[]) {
 		json_object_object_add(jobj2,"MaxChargingCurrent",MaxChargingCurrent);
 		json_object_object_add(jobj2,"AcMaxChargingCurrent",AcMaxChargingCurrent);
 		json_object_object_add(jobj2,"MaxChargingDuration",MaxChargingDuration);
+		json_object_object_add(jobj2,"StopChargingByButton",StopChargingByButton);
 		json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[0]);
 		json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[1]);
 		json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[2]);

+ 1 - 0
EVSE/Projects/define.h

@@ -474,6 +474,7 @@ struct SysConfigData
 	unsigned char			ShowInformation;
 	unsigned char           isReqFirstUpgrade;          //EVSE is request first upgrade from PH server
 	unsigned char           isEnableLocalPowerSharging; //0: Disable power sharing  1: Enable power sharing
+	unsigned char			StopChargingByButton;		//0: Disable  1: Enable
 };
 
 struct ChargingInfoData

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

@@ -119,7 +119,7 @@
 		break;
 	}
 	if(substr($model,4,3)=="122"){
-		$am120='block';
+		$am120='none';
 	}
 	else{
 		$am120='none';

+ 8 - 0
EVSE/rootfs/var/www/set_charging.php

@@ -574,6 +574,13 @@ img {
 											<input type="text" name="MaxChargingDuration" id="MaxChargingDuration" class="form-control" value="<?php echo $obj['MaxChargingDuration'];?>" placeholder="<?php echo ($obj['MaxChargingDuration']==0||$obj['MaxChargingDuration']=="")?"'0' means unlimit":"";?>" title="'0' means unlimit">
 											<small class="form-text text-muted-red"><label id="MaxChargingDurationText" style="display:none;">'0' means unlimit</label></small>
 										</div>
+										<div class="form-group" style="display:<?php echo $am001;?>">
+											<label>Stop Charging By Button</label>
+											<select class="form-control" id="StopChargingByButton" name="StopChargingByButton">
+												<option value="0" <?php echo $obj['StopChargingByButton']=="0"?"selected":""?>>Disable</option>
+												<option value="1" <?php echo $obj['StopChargingByButton']=="1"?"selected":""?>>Enable</option>
+											</select>
+										</div>
 										<div class="form-group" id="AcMaxChargingCurrentDiv">
 											<label>AC Max Charging Current</label>
 											<small class="form-text text-muted-red">amp</small>
@@ -1451,6 +1458,7 @@ img {
 						"&MaxChargingCurrent=" + document.getElementById("MaxChargingCurrent").value+
 						"&AcMaxChargingCurrent=" + document.getElementById("AcMaxChargingCurrent").value+
 						"&MaxChargingDuration=" + document.getElementById("MaxChargingDuration").value+
+						"&StopChargingByButton=" + document.getElementById("StopChargingByButton").value+
 						"&LocalWhiteCard0=" + document.getElementById("LocalWhiteCard0").value+
 						"&LocalWhiteCard1=" + document.getElementById("LocalWhiteCard1").value+
 						"&LocalWhiteCard2=" + document.getElementById("LocalWhiteCard2").value+

+ 4 - 0
EVSE/rootfs/var/www/set_charging_action.php

@@ -27,6 +27,7 @@
 		checkMaxValue("MaxChargingCurrent");
 		checkMaxValue("AcMaxChargingCurrent");
 		checkMaxValue("MaxChargingDuration");
+		checkValue("StopChargingByButton");
 		if(isset($_POST['MaxChargingEnergy'])){
 			$json['MaxChargingEnergy']			= (int)$_POST['MaxChargingEnergy'];
 		}
@@ -42,6 +43,9 @@
 		if(isset($_POST['MaxChargingDuration'])){
 			$json['MaxChargingDuration'] 		= (int)$_POST['MaxChargingDuration'];
 		}
+		if(isset($_POST['StopChargingByButton'])){
+			$json['StopChargingByButton'] 		= (int)$_POST['StopChargingByButton'];
+		}
 		if(isset($_POST['LocalWhiteCard0'])){
 			$json['LocalWhiteCard0']			= isset($_POST['LocalWhiteCard0'])?$_POST['LocalWhiteCard0']:"";
 		}