浏览代码

add main db commit
Commit 2624426b: 更新BootNotification 邏輯
電樁剛連上線進pending 此後再上報的BootNotification 的都Accepted

Robert 1 年之前
父节点
当前提交
2d3c08641d

+ 10 - 2
EVCB_OCPP.WSServer/Message/CoreProfileHandler.cs

@@ -220,9 +220,17 @@ internal partial class ProfileHandler
                             int.TryParse(configValue, out heartbeat_interval);
                         }
 
-                        var confirm = new BootNotificationConfirmation() { currentTime = DateTime.UtcNow, interval = session.IsPending ? heartbeat_interval : 5, status = session.IsPending ? Packet.Messages.SubTypes.RegistrationStatus.Accepted : RegistrationStatus.Pending };
+                        if (session.IsPending == true)
+                        {
+                            session.IsPending = false;
+                        }
+                        if (session.IsPending is null)
+                        {
+                            session.IsPending = true;
+                        }
+
+                        var confirm = new BootNotificationConfirmation() { currentTime = DateTime.UtcNow, interval = session.IsPending.Value ? 5 : heartbeat_interval, status = session.IsPending.Value ? RegistrationStatus.Pending : RegistrationStatus.Accepted };
 
-                        session.IsPending = !session.IsPending;
                         result.Message = confirm;
                         result.Success = true;
                     }

+ 1 - 2
EVCB_OCPP.WSServer/SuperSocket.Protocol/ClientData.cs

@@ -18,7 +18,7 @@ namespace OCPPServer.Protocol
 
         public EVCB_OCPP20.Packet.Messages.Basic.Queue queue20 = new EVCB_OCPP20.Packet.Messages.Basic.Queue();
 
-        public bool IsPending { set; get; }
+        public bool? IsPending { set; get; }
         public bool IsCheckIn { set; get; }
 
         public string ChargeBoxId { set; get; }
@@ -89,7 +89,6 @@ namespace OCPPServer.Protocol
         public ClientData()
         {
             IsAC = true;
-            IsPending = false;
             IsCheckIn = false;
             ChargeBoxId = SessionID;
             MachineId = SessionID;