Selaa lähdekoodia

test pass by four settings

Robert 10 kuukautta sitten
vanhempi
commit
0f15991956

+ 6 - 6
EVCB_OCPP.WSServer/Message/CoreProfileHandler.cs

@@ -1563,7 +1563,11 @@ internal partial class ProfileHandler
                                     var foundConfig = configure.Find(x => x.ConfigureName == item.key);
 
 
-                                    if (foundConfig != null)
+                                    if (foundConfig == null)
+                                    {
+                                        await mainDbService.AddMachineConfiguration(session.ChargeBoxId, item.key, item.value, item.IsReadOnly);
+                                    }
+                                    else if (item.value != foundConfig.ConfigureSetting)
                                     {
                                         if (foundConfig.ConfigureName == null)
                                         {
@@ -1575,11 +1579,7 @@ internal partial class ProfileHandler
                                             oldValue = foundConfig.ConfigureSetting;
                                         }
 
-										await mainDbService.UpdateMachineConfiguration(session.ChargeBoxId, item.key, item.value, item.IsReadOnly);
-                                    }
-                                    else
-                                    {
-										await mainDbService.AddMachineConfiguration(session.ChargeBoxId, item.key, item.value, item.IsReadOnly);
+                                        await mainDbService.UpdateMachineConfiguration(session.ChargeBoxId, item.key, item.value, item.IsReadOnly);
                                     }
                                 }
                             }

+ 2 - 1
EVCB_OCPP.WSServer/ProtalServer.cs

@@ -1024,11 +1024,12 @@ namespace EVCB_OCPP.WSServer
             catch (Exception e)
             {
                 logger.LogCritical("StartInitializeEVSE:{errormsg}", e.Message);
+                logger.LogCritical("StartInitializeEVSE:{errorStackTrace}", e.StackTrace);
             }
             finally
             {
                 session.BootStatus = BootStatus.Pending;
-                bootSemaphore.Release();
+                //bootSemaphore.Release();
             }
         }
 

+ 12 - 6
EVCB_OCPP.WSServer/Service/ConfirmWaitingMessageSerevice.cs

@@ -210,29 +210,35 @@ namespace EVCB_OCPP.WSServer.Service
             return message;
         }
 
-        internal async Task<object> WaitResultAsync(string msgId, int maxWaitSec = 65000, CancellationToken token = default)
+        internal async Task<object> WaitResultAsync(string serialNo, int maxWaitSec = 65000, CancellationToken token = default)
         {
-            //if (!needConfirmPacketList.Select(x=>x.RequestId).Contains(msgId))
+            //if (!needConfirmPacketList.Select(x => x.RequestId).Contains(serialNo))
             //{
-            //    var checkResult =  await mainDbService.TryGetResponseFromDb(msgId, token);
+            //    logger.LogWarning("msg {msg} not in wait list", serialNo);
+            //    var checkResult = await mainDbService.TryGetResponseFromDb(serialNo, token);
             //    if (checkResult is not null)
             //    {
+            //        logger.LogWarning("{msg} found in db", serialNo);
             //        return checkResult;
             //    }
+            //    logger.LogWarning("{msg} not found in db", serialNo);
             //}
 
             var waiObj = new MessageResultWaitObject();
-            asyncWaitingTasks.Add(msgId, waiObj);
+            asyncWaitingTasks.Add(serialNo, waiObj);
             var task = waiObj.Lock.WaitAsync(token);
             var completedTask = await Task.WhenAny(task, Task.Delay(180_000, token));
             if (completedTask != task)
             {
-                logger.LogWarning("wait {msg} time out", msgId);
-                var checkResult = await mainDbService.TryGetResponseFromDb(msgId, token);
+                logger.LogWarning("wait {msg} time out", serialNo);
+                var checkResult = await mainDbService.TryGetResponseFromDb(serialNo, token);
                 if (checkResult is not null)
                 {
+                    logger.LogWarning("{msg} found in db", serialNo);
                     return checkResult;
                 }
+                logger.LogWarning("{msg} not found in db", serialNo);
+                return null;
             }
             return waiObj.Result.Message;
         }