瀏覽代碼

2020-06-22 / ct_chen

Actions:
1. Webservice add LED Intensity

Files:
1. as list
ct_chen 4 年之前
父節點
當前提交
04cd4f3ae9
共有 3 個文件被更改,包括 20 次插入1 次删除
  1. 9 1
      EVSE/Modularization/WebService.c
  2. 9 0
      EVSE/rootfs/var/www/set_system.php
  3. 2 0
      EVSE/rootfs/var/www/set_system_action.php

+ 9 - 1
EVSE/Modularization/WebService.c

@@ -369,6 +369,7 @@ int main(int argc, char *argv[]) {
 			char isRFID = NULL;
 			char QRCodeMadeMode = NULL;
 			char *QRCodeContent = NULL;
+			char Intensity = NULL;
 
 			if( json_object_object_get_ex(jobj, "SystemId", &val_obj) ) {
 				SystemId = (char*)json_object_get_string(val_obj);
@@ -406,6 +407,9 @@ int main(int argc, char *argv[]) {
 			if( json_object_object_get_ex(jobj, "QRCodeContent", &val_obj) ) {
 				QRCodeContent = json_object_get_string(val_obj);
 			}
+			if( json_object_object_get_ex(jobj, "Intensity", &val_obj) ) {
+				Intensity = json_object_get_int(val_obj);
+			}
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId,SystemId);
 			ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy = PhaseLossPolicy;
 			ShmSysConfigAndInfo->SysInfo.FactoryConfiguration = FactoryConfiguration;
@@ -417,6 +421,7 @@ int main(int argc, char *argv[]) {
 			ShmSysConfigAndInfo->SysConfig.isRFID = isRFID;
 			ShmSysConfigAndInfo->SysConfig.QRCodeMadeMode = QRCodeMadeMode;
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.QRCodeContent,QRCodeContent);
+			ShmSysConfigAndInfo->SysConfig.LedInfo.Intensity = Intensity;
 
 			if(strlen(SystemDateTime)>0){
 				char cmd[100];
@@ -1074,6 +1079,7 @@ int main(int argc, char *argv[]) {
 		struct json_object *isRFID;
 		struct json_object *QRCodeMadeMode;
 		struct json_object *QRCodeContent;
+		struct json_object *Intensity;
 		struct json_object *AuxPower5V;
 		struct json_object *AuxPower12V;
 		struct json_object *AuxPower24V;
@@ -1219,6 +1225,7 @@ int main(int argc, char *argv[]) {
 		isRFID = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isRFID);
 		QRCodeMadeMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.QRCodeMadeMode);
 		QRCodeContent = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.QRCodeContent);
+		Intensity = json_object_new_int(ShmSysConfigAndInfo->SysConfig.LedInfo.Intensity);
 		AuxPower5V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower5V);
 		AuxPower12V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower12V);
 		AuxPower24V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower24V);
@@ -1633,7 +1640,7 @@ int main(int argc, char *argv[]) {
 		json_object_object_add(jobj1,"SerialNumber",SerialNumber);
 		json_object_object_add(jobj1,"SystemId",SystemId);
 		json_object_object_add(jobj1,"AcPhaseCount",AcPhaseCount);
-		json_object_object_add(jobj2,"PhaseLossPolicy",PhaseLossPolicy);
+		json_object_object_add(jobj1,"PhaseLossPolicy",PhaseLossPolicy);
 		json_object_object_add(jobj1,"FactoryConfiguration",FactoryConfiguration);
 		json_object_object_add(jobj1,"AuthorisationMode",AuthorisationMode);
 		json_object_object_add(jobj1,"DefaultLanguage",DefaultLanguage);
@@ -1651,6 +1658,7 @@ int main(int argc, char *argv[]) {
 		json_object_object_add(jobj1,"isRFID",isRFID);
 		json_object_object_add(jobj1,"QRCodeMadeMode",QRCodeMadeMode);
 		json_object_object_add(jobj1,"QRCodeContent",QRCodeContent);
+		json_object_object_add(jobj1,"Intensity",Intensity);
 		json_object_object_add(jobj1,"AuxPower5V",AuxPower5V);
 		json_object_object_add(jobj1,"AuxPower12V",AuxPower12V);
 		json_object_object_add(jobj1,"AuxPower24V",AuxPower24V);

+ 9 - 0
EVSE/rootfs/var/www/set_system.php

@@ -208,6 +208,14 @@ img {
 											<label>QR Code Content</label>
 											<input type="text" name="QRCodeContent" id="QRCodeContent" class="form-control" placeholder="<?php echo $obj->{'QRCodeContent'};?>" value="<?php echo $obj->{'QRCodeContent'};?>">
 										</div>
+										<div class="form-group" style="display:<?php echo $am111;?>">
+											<label>LED Intensity</label>
+											<select class="form-control" id="Intensity" name="Intensity">
+												<option value="0" <?php echo $obj->{'Intensity'}=="0"?"selected":""?>>Darkest</option>
+												<option value="1" <?php echo $obj->{'Intensity'}=="1"?"selected":""?>>Medium</option>
+												<option value="2" <?php echo $obj->{'Intensity'}=="2"?"selected":""?>>Brightest</option>
+											</select>
+										</div>
 									</section>
 								</article>
 								<article class="envor-sorting-item css">
@@ -346,6 +354,7 @@ img {
 						"&isRFID=" + (document.getElementById("isRFID").checked?1:0)+
 						"&QRCodeMadeMode=" + document.getElementById("QRCodeMadeMode").value+
 						"&QRCodeContent=" + document.getElementById("QRCodeContent").value+
+						"&Intensity=" + document.getElementById("Intensity").value+
 						"&RfidCardNumEndian=" + document.getElementById("RfidCardNumEndian").value+
 						"&PsuAcInputType=" + document.getElementById("PsuAcInputType").value;
 

+ 2 - 0
EVSE/rootfs/var/www/set_system_action.php

@@ -28,6 +28,7 @@
 		checkValue("isQRCode",2);
 		checkValue("isRFID",2);
 		checkValue("QRCodeMadeMode",2);
+		checkValue("Intensity",1);
 		checkValue("RfidCardNumEndian",1);
 		checkValue("PsuAcInputType",1);
 //		$json = json_decode(file_get_contents("system.txt"), true);
@@ -41,6 +42,7 @@
 		$json['isRFID']					= (int)$_POST['isRFID'];
 		$json['QRCodeMadeMode']			= (int)$_POST['QRCodeMadeMode'];
 		$json['QRCodeContent']			= $_POST['QRCodeContent'];
+		$json['Intensity']				= (int)$_POST['Intensity'];
 		$json['RfidCardNumEndian']		= $_POST['RfidCardNumEndian'];
 		$json['PsuAcInputType']			= $_POST['PsuAcInputType'];