Explorar el Código

Merge branch 'master' into AW-Regular

FolusWen hace 5 años
padre
commit
b5ed2bfae3

+ 52 - 38
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -91,7 +91,7 @@ struct OCPP16Data 				*ShmOCPP16Data;
 #define MESSAGE_TYPE_CALLERROR		4
 
 //
-#define server_cycle_Status			120
+//#define server_cycle_Status			120
 #define MACROSTR(k) #k
 
 //ConfigurationMaxKeys
@@ -102,6 +102,11 @@ struct OCPP16Data 				*ShmOCPP16Data;
 pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 char queuedata[2600]={0};
 
+//=================================
+//  StatusNotification cycle
+//=================================
+static int server_cycle_Status = 120;
+
 //===============================
 // Configuration: unknownkey
 //===============================
@@ -692,7 +697,6 @@ static char * ValueFormatStr[] = {
 	MACROSTR(SignedData)
 };
 
-
 /*Measurand*/
 typedef enum {
 	Current_Export ,
@@ -1447,7 +1451,6 @@ void CheckSystemValue(void)
 					if((access(filenmae,F_OK))!=-1)
 					{
 						DEBUG_INFO("TxProfile exist. OCPP will delete TX Charging Profile\n");
-
 						sprintf(str,"rm -f %s",filenmae);
 						system(str);
 					}
@@ -1472,7 +1475,6 @@ void CheckSystemValue(void)
 						sprintf(str,"rm -f %s",filenmae);
 						system(str);
 					}
-
 				}
 			}// End for GB
 		}
@@ -1495,21 +1497,16 @@ void CheckSystemValue(void)
 
 						sprintf(str,"rm -f %s",filenmae);
 						system(str);
-
 					}
-
 				}
 			}//End for AC
 
-
 		}//END OF ELSE
 
+		clientTime.MeterValues[gun_index] = time((time_t*)NULL);
 
-		//	sleep(1);
-			clientTime.MeterValues[gun_index] = time((time_t*)NULL);
-
-			if(meterValueSend[gun_index] == 1)
-				sendMeterValuesRequest(gun_index);
+		if(meterValueSend[gun_index] == 1)
+			sendMeterValuesRequest(gun_index);
 	}
 
 	//==============================================
@@ -1990,6 +1987,13 @@ int sendStartTransactionRequest(int gun_index)
 	strcpy((char *)ShmOCPP16Data->StartTransaction[gun_index].Timestamp, buf);
 	//strcpy((char *)ShmOCPP16Data->StartTransaction[gun_index].IdTag, (const char *)ShmSysConfigAndInfo->SysConfig.UserId);
 
+	// clear StartTransaction Response
+	strcpy((char *)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.ExpiryDate, "");
+	strcpy((char *)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.ParentIdTag, "");
+	strcpy((char *)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.Status, "");
+	ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId = 0;
+
+
 	if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
 	{
 		for (int index = 0; index < CHAdeMO_QUANTITY; index++)
@@ -2049,7 +2053,7 @@ int sendStartTransactionRequest(int gun_index)
 	sprintf(tempdata, "StartTransaction,%d", (gun_index));
 	if(hashmap_operation(0, guid, tempdata) == 1)//if(hashmap_operation(0,NULL/*hashMap*/, mapItem[0].key_string, mapItem[0].key_value/*mapItem*/, (void**)(&mapItem)/*(void**)(&mapItem)*/) ==  MAP_OK/*hashmap_put(hashMap, mapItem->key_string, mapItem) == MAP_OK*/)
 	{
-			result = PASS;
+		result = PASS;
 	}
 	strcpy(queuedata, message);
 	queue_operation(4, guid, queuedata );//addq(guid, queuedata); ---> remove temporally
@@ -2847,7 +2851,7 @@ int sendMeterValuesRequest(int gun_index)
 	//int length = 0;
 	char tempdata[65]={0};
 
-	DEBUG_ERROR("sendMeterValuesRequest ...\n");
+	DEBUG_INFO("sendMeterValuesRequest ...\n");
 	//DEBUG_ERROR("gun_index =%d\n",gun_index);
 
 	if((ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId == 0)&&(ShmOCPP16Data->CsMsg.bits[gun_index].TriggerMessageReq == 0)) // no TransactionId
@@ -11155,12 +11159,11 @@ DEBUG_INFO("idTagInfo-status: %s\n", ShmOCPP16Data->StartTransaction[gun_index].
 DEBUG_INFO("transactionId: %d\n", ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId);
 #endif
 
-	if(strcmp((const char *)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.Status, "Accepted") == 0)
-	{
-		//add Charging Record
-		SettingChargingRecord(gun_index, transactionIdInt);
-
-	}
+	//if(strcmp((const char *)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.Status, "Accepted") == 0)
+	//{
+	//	//add Charging Record
+	//	SettingChargingRecord(gun_index, transactionIdInt);
+	//}
 
 	//DEBUG_INFO("Start Charging ErrorCode=%s\n", ShmOCPP16Data->StatusNotification[gun_index].ErrorCode);
 }
@@ -11290,12 +11293,12 @@ int initialConfigurationTable(void)
 
 		/*Core Profile*/
 		//AllowOfflineTxForUnknownId
-		ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemAccessibility = 1;
+		ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemAccessibility = 0;
 		printf("AllowoddlineTXForUnknownId type: %d  \n", ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemAccessibility);
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemName, "AllowOfflineTxForUnknownId");
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemData, "FALSE" );
 
-		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AllowOfflineTxForUnknownId", "false", "FALSE");
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AllowOfflineTxForUnknownId", "true", "FALSE");
 
 		//AuthorizationCacheEnabled
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationCacheEnabled].ItemAccessibility = 1;
@@ -11417,8 +11420,8 @@ int initialConfigurationTable(void)
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[MinimumStatusDuration].ItemAccessibility = 1;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MinimumStatusDuration].ItemName, "MinimumStatusDuration");
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MinimumStatusDuration].ItemData, "0" );
-
-		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MinimumStatusDuration", "false", "0");
+		server_cycle_Status = 120; //StatusNotification cycle
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MinimumStatusDuration", "false", "120");
 
 		// NumberOfConnectors
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[NumberOfConnectors].ItemAccessibility = 0;
@@ -11465,9 +11468,9 @@ int initialConfigurationTable(void)
 		// StopTransactionOnInvalidId
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnInvalidId].ItemAccessibility = 0; //1;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnInvalidId].ItemName, "StopTransactionOnInvalidId");
-		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnInvalidId].ItemData, "TRUE" );
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnInvalidId].ItemData, "FALSE" );
 
-		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","StopTransactionOnInvalidId", "true", "TRUE");
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","StopTransactionOnInvalidId", "true", "FALSE");
 
 		// StopTxnAlignedData
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnAlignedData].ItemAccessibility = 1;
@@ -11815,7 +11818,7 @@ int initialConfigurationTable(void)
 			{
 			    ShmOCPP16Data->ConfigurationTable.CoreProfile[MinimumStatusDuration].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
 				sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MinimumStatusDuration].ItemData, "%d", atoi(valuestr) );
-
+				server_cycle_Status = atoi(valuestr); //StatusNotification cycle
 			}
 
 			if(strcmp(keystr, "NumberOfConnectors") == 0)
@@ -12026,7 +12029,7 @@ void StoreConfigurationTable(void)
     */
 
 	//DEBUG_INFO("data=%s\n",data);
-	fprintf(outfile,"{\"key\":\"%s\",\"readonly\": %s,\"value\":\"%s\"}\n","AllowOfflineTxForUnknownId", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemData);
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\": %s,\"value\":\"%s\"}\n","AllowOfflineTxForUnknownId", "true", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemData);
 
 	//AuthorizationCacheEnabled
 	/*
@@ -12238,12 +12241,12 @@ void StoreConfigurationTable(void)
 
 	// StopTransactionOnInvalidId
 	/*
-	ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnInvalidId].ItemAccessibility = 1;
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnInvalidId].ItemAccessibility = 0;
 	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnInvalidId].ItemName, "StopTransactionOnInvalidId");
 	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnInvalidId].ItemData, "FALSE" );
 	*/
 
-	fprintf(outfile,"{\"key\":\"%s\",\"readonly\": %s,\"value\":\"%s\"}\n","StopTransactionOnInvalidId", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnInvalidId].ItemData);
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\": %s,\"value\":\"%s\"}\n","StopTransactionOnInvalidId", "true", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnInvalidId].ItemData);
 
 	// StopTxnAlignedData
 	/*
@@ -13650,6 +13653,7 @@ void processUnkownKey(void)
     		{
     			//Charger.MinimumStatusDuration = Integer.parseInt(value);
     			 sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MinimumStatusDuration].ItemData, "%d", atoi(value) );
+    			 server_cycle_Status = atoi(value); //StatusNotification Cycle
     			 isSuccess = ConfigurationStatus_Accepted;
     		}
     	}
@@ -15100,6 +15104,12 @@ int GetTransactionId(int gunindex, unsigned char idTag[])
 	temptransactionId = 0;
 	/*------ Read the file ----------------*/
 	fptr1=fopen("/Storage/OCPP/QueueTransactionId","r");
+	if (!fptr1)
+	{
+		printf(" File not found or unable to open the input file!!\n");
+		return temptransactionId;
+	}
+
 	ch=fgetc(fptr1);
 	//printf(" Now the content of the file %s is : \n","/Storage/OCPP/QueueTransactionId");
 	rewind(fptr1);
@@ -15117,11 +15127,15 @@ int GetTransactionId(int gunindex, unsigned char idTag[])
 			char *revbuf[8] = {0}; //存放分割後的子字串
 			int num = 0;//分割後子字串的個數
 			splitstring(str,",",revbuf,&num); //呼叫函式進行分割
-			if((atoi(revbuf[0])==gunindex) || (strcmp(revbuf[1],(const char *)idTag)==0))
+			if((revbuf[1][0] != '\0')&&(revbuf[2][0] != '\0'))
 			{
-				temptransactionId = atoi(revbuf[2]);
-				break;
+				if((atoi(revbuf[0])==gunindex) || (strcmp(revbuf[1],(const char *)idTag)==0))
+				{
+					temptransactionId = atoi(revbuf[2]);
+					break;
+				}
 			}
+
 		}
 	}
 
@@ -15143,15 +15157,15 @@ void SetTransactionIdZero(int transactionId)
     fptr1 = fopen("/Storage/OCPP/QueueTransactionId", "r");
     if (!fptr1)
 	{
-            printf(" File not found or unable to open the input file!!\n");
-            return ;
+    	printf(" File not found or unable to open the input file!!\n");
+        return ;
     }
     fptr2 = fopen(temp, "w"); // open the temporary file in write mode
     if (!fptr2)
 	{
-            printf("Unable to open a temporary file to write!!\n");
-            fclose(fptr1);
-            return ;
+        printf("Unable to open a temporary file to write!!\n");
+        fclose(fptr1);
+        return ;
     }
 
     ch=fgetc(fptr1);

+ 76 - 27
EVSE/Modularization/ocppfiles/Module_OcppBackend.c

@@ -38,7 +38,6 @@
 #define SPEC_LATEST_SUPPORTED 13
 #endif
 
-
 #define Debug
 //#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
 #define PASS				1
@@ -100,6 +99,7 @@ static int ConnectionEstablished=0;
 static int TransactionMessageResend = 1;
 static int TransactionQueueInterval = 10;//3; // TransactionMessageAttempts
 static int TransactionQueueNum = 0;
+static int OfflineTransactionQueueNum = 0;
 static int  OfflineTransaction = 0;
 int defaultWaitingTime = 10; //10 second
 char OcppPath[160]={0};
@@ -465,6 +465,8 @@ static int OCPP16Callback(struct lws *wsi, enum lws_callback_reasons reason, voi
 			#endif
 			pthread_detach(pid);
 			server_sign = FALSE;
+			ConnectionEstablished=0;
+			context = NULL;
 			break;
 		case LWS_CALLBACK_LOCK_POLL:
 			break;
@@ -510,12 +512,34 @@ static int OCPP16Callback(struct lws *wsi, enum lws_callback_reasons reason, voi
 		}
 
 			break;
-		case LWS_CALLBACK_CLIENT_ESTABLISHED://3
-			#ifdef SystemLogMessage
-			DEBUG_INFO("LWS_CALLBACK_CLIENT_ESTABLISHED\n");
-			#endif
-			//connected
-			ConnectionEstablished=1;
+		case LWS_CALLBACK_CLIENT_ESTABLISHED: //3
+			{
+#ifdef SystemLogMessage
+DEBUG_INFO("LWS_CALLBACK_CLIENT_ESTABLISHED\n");
+#endif
+				char frontUUID[100] ={0};
+				char frontData[1200] ={0};
+				int queueNotEmpty = 0;
+
+				//connected
+				ConnectionEstablished=1;
+
+				queueNotEmpty = queue_operation(1,frontUUID, frontData);
+
+				if(queueNotEmpty == TRUE)
+				{
+					OfflineTransaction = 1;
+				}
+
+				TransactionQueueInterval = 0;
+				TransactionMessageResend = 1;
+
+				//get offline number
+				queue_operation(0,"","");
+				OfflineTransactionQueueNum =TransactionQueueNum ;
+
+			}
+
 			break;
 		case LWS_CALLBACK_CLIENT_CONNECTION_ERROR://1
 			#ifdef SystemLogMessage
@@ -576,10 +600,9 @@ static int OCPP16Callback(struct lws *wsi, enum lws_callback_reasons reason, voi
 		case LWS_CALLBACK_CLOSED://4
 			#ifdef SystemLogMessage
 			DEBUG_INFO("LWS_CALLBACK_CLOSED\n");
-			ConnectionEstablished=0;
 			#endif
 			//disconnected
-
+			ConnectionEstablished=0;
 			break;
 		case LWS_CALLBACK_CLIENT_WRITEABLE://10
 			//if(need to send message and its relevant data already store into SendBuffer)
@@ -695,7 +718,13 @@ void* ConnectWsServer(void* data)  //int ConnectWsServer()
 	//lws_set_log_level(LLL_PARSER | LLL_HEADER | LLL_ERR | LLL_WARN | LLL_NOTICE | LLL_INFO | LLL_DEBUG | LLL_EXT | LLL_CLIENT | LLL_LATENCY  , NULL);
 
 	if(context!=NULL)
+	{
+		pthread_detach(pthread_self());
 		lws_context_destroy(context);
+		ConnectionEstablished=0;
+		context = NULL;
+	}
+
 
 	memset(&ContextInfo, 0, sizeof(struct lws_context_creation_info));
 
@@ -885,7 +914,7 @@ if( fgets (str, 1200, fp)!=NULL ) {
 	else
 	{
 		 //puts(str);
-		 /*********************uuid***************/
+		 //----------------uuid--------------//
 		 loc = strstr(str, "\"");
 		 memset(sstr ,0, sizeof(sstr) );
 		 c = 0;
@@ -920,11 +949,11 @@ FILE *outfile;
 char rmFileCmd[100]={0};
 struct stat stats;
 stat("/Storage/OCPP", &stats);
-DEBUG_INFO("addq\n");
+DEBUG_INFO("addq ");
 // Check for directory existence
 if (S_ISDIR(stats.st_mode) == 1)
 {
-	DEBUG_INFO("\n OCPP directory exist \n");
+	//DEBUG_INFO("\n OCPP directory exist \n");
 }
 else
 {
@@ -946,7 +975,7 @@ else
 
 	if(log == NULL)
 	{
-		DEBUG_INFO("Can't Create File TransactionRelatedQueue \n");
+		//DEBUG_INFO("Can't Create File TransactionRelatedQueue \n");
 		return 0;
 	}
 	else
@@ -957,11 +986,12 @@ else
 
 // open file for writing
 outfile = fopen ("/Storage/OCPP/TransactionRelatedQueue", "a");
-//DEBUG_INFO("data=%s\n",data);
+DEBUG_INFO("data=%s\n",data);
 fputs(data, outfile);
 fputs("\n", outfile);
 fclose (outfile);
 TransactionQueueNum = TransactionQueueNum + 1;
+DEBUG_INFO("add queue end\n");
 return 0;
 
 }
@@ -1131,12 +1161,15 @@ if (fp == NULL) {
   return 0;
 }
 
+TransactionQueueNum = 0;
+
 while(fgets(line, sizeof line, fp) != NULL) {
-	DEBUG_INFO("%s\n", line);
+	//DEBUG_INFO("%s\n", line);
+	TransactionQueueNum = TransactionQueueNum + 1;
 }
 
 fclose(fp);
-return 0;
+return 1;
 
 }
 
@@ -1190,7 +1223,7 @@ if(fp == NULL) {
 
 if( fgets (str, 1200, fp)!=NULL ) {
 
-	/* writing content to stdout */
+	//---- writing content to stdout ---//
 
 	//*********************StopTransaction***************************/
 	loc = strstr(str, "StopTransaction");
@@ -1407,15 +1440,25 @@ void* processTransactionQueue(void* data) {
 
 			if((queueNotEmpty == 1) && (GetOcppConnStatus() == 1))
 			{
-				if((OfflineTransaction == 1) && (TransactionQueueNum != 0))
+
+				if((OfflineTransaction == 1) && (OfflineTransactionQueueNum != 0))
 				{
-					TransactionQueueInterval = 10;//2;
-					sleep(TransactionQueueInterval);
+					TransactionQueueInterval = 10;//10;//2;
 					sendbuffer = 1;
+					OfflineTransactionQueueNum = OfflineTransactionQueueNum - 1;
+
+					if(OfflineTransactionQueueNum == 0)
+					{
+						OfflineTransaction = 0;
+
+					}
+					DEBUG_INFO(" Offline Transaction , online sent queue .... \n");
+					sleep(TransactionQueueInterval);
 				}
 				else
 				{
-					OfflineTransaction = 0;
+					DEBUG_INFO(" online sent queue .... \n");
+					//OfflineTransaction = 0;
 					if(TransactionMessageResend < TransactionMessageAttemptsGet()) //
 					{
 						//DEBUG_INFO("processTransactionQueue queue is not empty!\n");
@@ -1436,12 +1479,6 @@ void* processTransactionQueue(void* data) {
 						sleep(TransactionQueueInterval);
 					}
 				}
-
-
-			}
-			else if((queueNotEmpty == 1) && (GetOcppConnStatus() == 0))
-			{
-				OfflineTransaction = 1;
 			}
 			else
 			{
@@ -1449,6 +1486,18 @@ void* processTransactionQueue(void* data) {
 				sleep(TransactionQueueInterval);
 			}
 		}
+
+		if(GetOcppConnStatus() == 0)
+		{
+			//DEBUG_INFO(" Offline .... \n");
+			if(queueNotEmpty == 1)
+			{
+				OfflineTransaction = 1;
+				DEBUG_INFO(" Offline Transaction .... \n");
+			}
+
+		}
+
 		usleep(5000);
 	}
   pthread_exit(NULL); //

+ 2 - 6
EVSE/rootfs/var/www/set_system.php

@@ -118,11 +118,10 @@ img {
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Authentication</label>
-											<select type="text" class="form-control" id="AuthorisationMode" name="AuthorisationMode" <?php //onchange="AuthorisationMode_changed();"?>>
+											<select class="form-control" id="AuthorisationMode" name="AuthorisationMode">
 												<option value="0" <?php echo $obj->{'AuthorisationMode'}=="0"?"selected":""?>>enable</option>
 												<option value="1" <?php echo $obj->{'AuthorisationMode'}=="1"?"selected":""?>>disable</option>
 											</select>
-<?php /*											<small class="form-text text-muted-red"><label id="AuthorisationModeText" style="display:none;">You should set parameter about OCPP after this setting</label></small> */?>
 										</div>
 										<div class="form-group" style="display:<?php echo $am111;?>">
 											<label>Input Voltage R</label>
@@ -278,9 +277,6 @@ img {
 			format:"YYYY-MM-DD HH:mm:ss"
 		});
 		setInterval(function(){var t = new Date(document.getElementById("SystemDateTime0").placeholder);var t_s = t.getTime();t.setTime(t_s + 1000 );document.getElementById("SystemDateTime0").placeholder= t.Format("yyyy-MM-dd hh:mm:ss");}, 1000);
-		// if(document.getElementById("AuthorisationMode").value=="0"){
-			// document.getElementById("AuthorisationModeText").style.display="block";
-		// }
 		if(document.getElementById("ModelName").value.substr(8,1) != "0"){
 			document.getElementById("AcRatingCurrentDiv").style.display="block";
 		}
@@ -315,7 +311,7 @@ img {
 			var data =  "SystemId=" + document.getElementById("SystemId").value+
 						"&SystemDateTime=" + document.getElementById("SystemDateTime").value+
 						"&FactoryConfiguration=" + (document.getElementById("FactoryConfiguration").checked?1:0)+
-						"&AuthorisationMode=" + (document.getElementById("AuthorisationMode").checked?0:1)+
+						"&AuthorisationMode=" + document.getElementById("AuthorisationMode").value+
 						"&isAPP=" + (document.getElementById("isAPP").checked?1:0)+
 						"&isQRCode=" + (document.getElementById("isQRCode").checked?1:0)+
 						"&isRFID=" + (document.getElementById("isRFID").checked?1:0)+