Quellcode durchsuchen

1. 拉出OCPP20 url 重新導向的連線設定值

Jessica Tseng vor 2 Jahren
Ursprung
Commit
f59930ce8f

+ 2 - 0
EVCB_OCPP.WSServer/App.config

@@ -16,6 +16,8 @@
     <add key="LocalAuthAPI" value="" />
     <add key="WSPort" value="2012" />
     <add key="WSSPort" value="2016" />
+    <add key="OCPP20_WSUrl" value="ws://ocpp.phihong.com.tw:5004" />
+    <add key="OCPP20_WSSUrl" value="ws://ocpp.phihong.com.tw:5004" />
     <add key="MaintainMode" value="0" />
   </appSettings>
   <startup>

+ 22 - 1
EVCB_OCPP.WSServer/GlobalConfig.cs

@@ -11,13 +11,20 @@ namespace EVCB_OCPP.WSServer
         {
             "WSPort",
             "WSSPort",
-            ""
+            "OCPP20_WSUrl",
+            "OCPP20_WSSUrl"
         };
 
         public static string TCC_API_URL = string.Empty;
 
         public static string TCC_SALTKEY = string.Empty;
 
+        public static string OCPP20_WSUrl = string.Empty;
+
+        public static string OCPP20_WSSUrl = string.Empty;  
+
+      
+
 
         /// <summary>
         /// 預設心跳間隔時間 單位:秒
@@ -66,6 +73,20 @@ namespace EVCB_OCPP.WSServer
                                 WSS_Port = Convert.ToInt32(value);
                             }
                             break;
+                        case "OCPP20_WSUrl":// convert to int type                       
+                            {
+                                var value = ConfigurationManager.AppSettings[key];
+
+                                OCPP20_WSUrl = value;
+                            }
+                            break;
+                        case "OCPP20_WSSUrl":// convert to int type                       
+                            {
+                                var value = ConfigurationManager.AppSettings[key];
+
+                                OCPP20_WSSUrl = value;
+                            }
+                            break;
                         default://convert to string type                             
                             break;
 

+ 1 - 1
EVCB_OCPP.WSServer/Properties/AssemblyInfo.cs

@@ -35,4 +35,4 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyVersion("1.0.5.0")]
 [assembly: AssemblyFileVersion("1.0.5.0")]
 
-[assembly: AssemblyInformationalVersion("1e8d3a2")]
+[assembly: AssemblyInformationalVersion("6516adf")]

+ 3 - 19
EVCB_OCPP.WSServer/ProtalServer.cs

@@ -139,23 +139,7 @@ namespace EVCB_OCPP.WSServer
 
             Task serverHealthTask = new Task(HealthCheckTrigger, _ct);
             serverHealthTask.Start();
-
-            var ocpp20NetworkSetting = new EVCB_OCPP20.Packet.Messages.SetNetworkProfileRequest()
-            {
-                ConfigurationSlot = 0,
-                ConnectionData = new EVCB_OCPP20.Packet.DataTypes.NetworkConnectionProfileType()
-                {
-                    OcppVersion = EVCB_OCPP20.Packet.DataTypes.EnumTypes.OCPPVersionEnumType.OCPP20,
-                    OcppTransport = EVCB_OCPP20.Packet.DataTypes.EnumTypes.OCPPTransportEnumType.JSON,
-                    MessageTimeout = 30,
-                    OcppCsmsUrl = "ws://ocpp.phihong.com.tw:5004",
-                    OcppInterface = EVCB_OCPP20.Packet.DataTypes.EnumTypes.OCPPInterfaceEnumType.Wired0
-                }
-
-            };
-
-            _ocpp20NetworkSetting = JsonConvert.SerializeObject(ocpp20NetworkSetting, Formatting.None);
-
+           
             while (true)
             {
                 var input = Console.ReadLine();
@@ -564,7 +548,7 @@ namespace EVCB_OCPP.WSServer
                                                         OcppVersion = EVCB_OCPP20.Packet.DataTypes.EnumTypes.OCPPVersionEnumType.OCPP20,
                                                         OcppTransport = EVCB_OCPP20.Packet.DataTypes.EnumTypes.OCPPTransportEnumType.JSON,
                                                         MessageTimeout = 30,
-                                                        OcppCsmsUrl = "ws://ocpp.phihong.com.tw:5004",
+                                                        OcppCsmsUrl = session.UriScheme == "ws" ? GlobalConfig.OCPP20_WSUrl : GlobalConfig.OCPP20_WSSUrl,
                                                         OcppInterface = EVCB_OCPP20.Packet.DataTypes.EnumTypes.OCPPInterfaceEnumType.Wired0
                                                     }
 
@@ -735,7 +719,7 @@ namespace EVCB_OCPP.WSServer
                                     session.IsCheckIn = true;
                                     if (((BootNotificationConfirmation)replyResult.Message).status == Packet.Messages.SubTypes.RegistrationStatus.Accepted)
                                     {
-                                        
+
 
 
                                         CheckVersion(session.ChargeBoxId);

BIN
SuperWebSocket/bin/Debug/SuperWebSocket.dll


BIN
SuperWebSocket/bin/Debug/SuperWebSocket.pdb