Browse Source

change complete

shayne_lo 7 months ago
parent
commit
d874701995
48 changed files with 422 additions and 1224 deletions
  1. 6 8
      ApiTest/ApiTest.csproj
  2. 3 3
      ApiTest/MainWindow.xaml.cs
  3. 1 1
      ApiTest/Properties/AssemblyInfo.cs
  4. 6 0
      AwInitilizer.sln
  5. 0 606
      AwInitilizer/Assist/EvApi.cs
  6. 0 352
      AwInitilizer/Assist/EvHttpClient.cs
  7. 0 59
      AwInitilizer/Assist/EvHttpClientLogger.cs
  8. 4 4
      AwInitilizer/Initializer.csproj
  9. 5 3
      AwInitilizer/MainWindow.xaml.cs
  10. 0 15
      AwInitilizer/Model/ButtonStatus.cs
  11. 27 111
      AwInitilizer/Model/UpdateData.cs
  12. 6 1
      AwInitilizer/Procedure/BasicInfoUpdateProcedure.cs
  13. 2 0
      AwInitilizer/Procedure/ButtonStatusCheckPorcedure.cs
  14. 1 0
      AwInitilizer/Procedure/DsiableChargeAuthProcedure.cs
  15. 1 0
      AwInitilizer/Procedure/FirmwareBundleUploadProcedure.cs
  16. 57 1
      AwInitilizer/Procedure/FirmwareCheckVersionProcedure.cs
  17. 1 0
      AwInitilizer/Procedure/FirmwareFtpUploadProcedure.cs
  18. 1 0
      AwInitilizer/Procedure/FirmwareUpdateProcedure.cs
  19. 1 0
      AwInitilizer/Procedure/FirmwareUploadProcedure.cs
  20. 20 18
      AwInitilizer/Procedure/FourGenModuleCheckProcedure.cs
  21. 1 0
      AwInitilizer/Procedure/ProcedureBase.cs
  22. 1 0
      AwInitilizer/Procedure/RestarttoIdelProcedure.cs
  23. 2 0
      AwInitilizer/Procedure/TelcomModemImeiRecordProcedure.cs
  24. 1 0
      AwInitilizer/Procedure/VersionLogProcedure.cs
  25. 18 0
      AwInitilizer/Procedure/WifRssiCheckProcedure.cs
  26. 1 1
      AwInitilizer/Properties/AssemblyInfo.cs
  27. 1 1
      ConfigEditor/Properties/AssemblyInfo.cs
  28. 10 0
      ConfigEditor/SubPage/AppConfig/AppConfigPanel.xaml
  29. 7 0
      ConfigEditor/SubPage/EvseConfig/EvseConfigPanel.xaml
  30. 63 0
      CsuWebApiLib/CsuWebApiLib.csproj
  31. 50 17
      CsuWebApiLib/EvApi.cs
  32. 22 12
      CsuWebApiLib/EvHttpClient.cs
  33. 2 2
      CsuWebApiLib/EvHttpClientLogger.cs
  34. 1 1
      CsuWebApiLib/Model/ButtonStatus.cs
  35. 1 1
      CsuWebApiLib/Model/SimStatusString.cs
  36. 15 0
      CsuWebApiLib/Model/WifiConfig.cs
  37. 37 0
      CsuWebApiLib/Properties/AssemblyInfo.cs
  38. 1 1
      CsuWebApiLib/WebClientTimeout.cs
  39. 4 0
      CsuWebApiLib/packages.config
  40. 1 1
      Editor/Properties/AssemblyInfo.cs
  41. 2 0
      InitializerModel/AppSettingConfigModel.cs
  42. 1 1
      InitializerModel/EvseSettingConfig.cs
  43. 3 1
      InitializerModel/EvseSettingConfigModel.cs
  44. 1 0
      InitializerModel/InitializerModel.csproj
  45. 31 0
      InitializerModel/ObservableObject.cs
  46. 1 1
      InitializerModel/Properties/AssemblyInfo.cs
  47. 1 1
      Initilizer/AssemblyInfo.cs
  48. 1 1
      MesAdaptor/Properties/AssemblyInfo.cs

+ 6 - 8
ApiTest/ApiTest.csproj

@@ -80,14 +80,9 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
-    <Compile Include="ButtonStatus.cs" />
     <Compile Include="SetConfigDlg.xaml.cs">
       <DependentUpon>SetConfigDlg.xaml</DependentUpon>
     </Compile>
-    <Compile Include="SimStatusString.cs" />
-    <Compile Include="WebClientTimeout.cs">
-      <SubType>Component</SubType>
-    </Compile>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -96,9 +91,6 @@
       <DependentUpon>App.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="EvApi.cs" />
-    <Compile Include="EvHttpClient.cs" />
-    <Compile Include="EvHttpClientLogger.cs" />
     <Compile Include="MainWindow.xaml.cs">
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
@@ -135,5 +127,11 @@
   <ItemGroup>
     <None Include="App.config" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\CsuWebApiLib\CsuWebApiLib.csproj">
+      <Project>{b8c304d4-8ee8-435b-bef8-606993c158a0}</Project>
+      <Name>CsuWebApiLib</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 3 - 3
ApiTest/MainWindow.xaml.cs

@@ -1,4 +1,4 @@
-using AwInitilizer.Assist;
+using CsuWebApiLib;
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
@@ -132,11 +132,11 @@ namespace ApiTest
         {
             if (!string.IsNullOrEmpty(uxAccount.Text))
             {
-                EvHttpClient.account = uxAccount.Text;
+                EvHttpClient.Account = uxAccount.Text;
             }
             if (!string.IsNullOrEmpty(uxPass.Text))
             {
-                EvHttpClient.pass = uxPass.Text;
+                EvHttpClient.Pass = uxPass.Text;
             }
 
             EvHttpClient.ResetServerIpAddress(uxIp.Text);

+ 1 - 1
ApiTest/Properties/AssemblyInfo.cs

@@ -53,4 +53,4 @@ using System.Windows;
 // [assembly: AssemblyVersion("1.13.2.0")]
 [assembly: AssemblyVersion("1.13.2.0")]
 [assembly: AssemblyFileVersion("1.13.2.0")]
-[assembly: AssemblyInformationalVersion("e8c61f8")]
+[assembly: AssemblyInformationalVersion("2a6cbf5")]

+ 6 - 0
AwInitilizer.sln

@@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfigEditor", "ConfigEdito
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InitializerModel", "InitializerModel\InitializerModel.csproj", "{68A79486-7973-42BF-8CAF-43296BEB1107}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsuWebApiLib", "CsuWebApiLib\CsuWebApiLib.csproj", "{B8C304D4-8EE8-435B-BEF8-606993C158A0}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -51,6 +53,10 @@ Global
 		{68A79486-7973-42BF-8CAF-43296BEB1107}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{68A79486-7973-42BF-8CAF-43296BEB1107}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{68A79486-7973-42BF-8CAF-43296BEB1107}.Release|Any CPU.Build.0 = Release|Any CPU
+		{B8C304D4-8EE8-435B-BEF8-606993C158A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{B8C304D4-8EE8-435B-BEF8-606993C158A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{B8C304D4-8EE8-435B-BEF8-606993C158A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{B8C304D4-8EE8-435B-BEF8-606993C158A0}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 0 - 606
AwInitilizer/Assist/EvApi.cs

@@ -1,606 +0,0 @@
-using AwInitilizer.Model;
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net.Http;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace AwInitilizer.Assist
-{
-    public class EvApiResult<T>
-    {
-        public T Result { get; set; }
-        public string Response { get; set; }
-    }
-
-    public class EvApiWifiResult
-    {
-        public int Rssi { get; set; }
-        public int ErrorCode { get; set; }
-    }
-
-    public static class EvApi
-    {
-        internal static async Task<EvApiResult<bool>> ChekCsuBootCompelete()
-        {
-            var getResult = await EvHttpClient.GetQueryActionOpt2String();
-            if (!getResult.IsSuccess ||
-                string.IsNullOrEmpty(getResult.Msg))
-            {
-                return new EvApiResult<bool>() { Response = getResult.Msg, Result = false };
-            }
-
-            Regex rx = new Regex("(SystemStatus)\\\": ([0-9]*)");
-            var matches = rx.Matches(getResult.Msg);
-            if (matches.Count == 0)
-            {
-                return new EvApiResult<bool>()
-                {
-                    Result = false,
-                    Response = getResult.Msg
-                };
-            }
-            bool isAllPassed = true;
-            for (int matchIndex = 0; matchIndex < matches.Count; matchIndex++)
-            {
-                var match = matches[matchIndex];
-                if (match.Groups.Count != 3)
-                {
-                    isAllPassed = false;
-                    break;
-                }
-                else
-                {
-                    if (match.Groups[2].Value != "1")
-                    {
-                        isAllPassed = false;
-                        break;
-                    }
-                }
-            }
-
-            return new EvApiResult<bool>()
-            {
-                Result = isAllPassed,
-                Response = getResult.Msg,
-            };
-        }
-
-        internal static async Task<EvApiResult<bool>> CheckGetQueryAction()
-        {
-            var getResult = await EvHttpClient.GetQueryActionOpt2String();
-            if (!getResult.IsSuccess ||
-                string.IsNullOrEmpty(getResult.Msg))
-            {
-                return new EvApiResult<bool>() { Response = getResult.Msg, Result = false };
-            }
-
-            return new EvApiResult<bool>()
-            {
-                Result = !string.IsNullOrEmpty(getResult.Msg),
-                Response = getResult.Msg
-            };
-        }
-
-        internal static async Task<EvApiResult<ButtonStatus>> GetButtonStatus()
-        {
-            var getResult = await EvHttpClient.GetButtonStatusString();
-            var result = getResult.Msg;
-
-            if (!getResult.IsSuccess)
-            {
-                return new EvApiResult<ButtonStatus>()
-                {
-                    Result = null,
-                    Response = getResult.Msg
-                };
-            }
-
-            if (!result.Contains("Button1") ||
-                !result.Contains("Button2"))
-            {
-                return new EvApiResult<ButtonStatus>()
-                {
-                    Result = null,
-                    Response = result
-                };
-            }
-            var values = JsonConvert.DeserializeObject<ButtonStatus>(result);
-            return new EvApiResult<ButtonStatus>()
-            {
-                Result = values,
-                Response = result,
-            };
-        }
-
-        internal static async Task<EvApiResult<Dictionary<string, string>>> GetVersion()
-        {
-            var getResult = await EvHttpClient.GetQueryActionOpt1String();
-            var toReturn = new Dictionary<string, string>();
-
-            string result = getResult.Msg;
-            if (!getResult.IsSuccess)
-            {
-                return new EvApiResult<Dictionary<string, string>>()
-                {
-                    Result = null,
-                    Response = getResult.Msg,
-                };
-            }
-
-            var values = JsonConvert.DeserializeObject<Dictionary<string, object>>(result);
-
-            foreach (var pair in values)
-            {
-                if (pair.Value is string v)
-                {
-                    toReturn.Add(pair.Key, v);
-                }
-                else if (pair.Value is Newtonsoft.Json.Linq.JArray a)
-                {
-                    try
-                    {
-                        var versionList = JsonConvert.DeserializeObject<List<string>>(a.ToString());
-                        for (int index = 0; index < versionList.Count; index++)
-                        {
-                            toReturn.Add(string.Format("{0}{1}", pair.Key, index), versionList[index]);
-                        }
-                    }
-                    catch
-                    {
-
-                    }
-                }
-            }
-
-            return new EvApiResult<Dictionary<string, string>>()
-            {
-                Result = toReturn,
-                Response = result
-            };
-        }
-
-        internal static async Task<EvApiResult<string>> GetTelcomModemImei()
-        {
-            var getResult = await EvHttpClient.GetQueryActionOpt3String();
-            string result = getResult.Msg;
-            if (!getResult.IsSuccess)
-            {
-                return new EvApiResult<string>()
-                {
-                    Result = null,
-                    Response = getResult.Msg,
-                };
-            }
-
-            Regex rx = new Regex("(TelcomModemImei)\\\": \"([0-9]*)\"");
-            var matches = rx.Matches(result);
-            string imeiString = string.Empty;
-
-            if (matches.Count != 0)
-            {
-                var match = matches[0];
-                if (match.Groups.Count != 3)
-                {
-                    imeiString = string.Empty;
-                }
-                else
-                {
-                    if (match.Groups[2].Value is string imei)
-                    {
-                        imeiString = imei;
-                    }
-                    else
-                    {
-                        imeiString = "";
-                    }
-                }
-            }
-            else
-            {
-                imeiString = "";
-            }
-
-            return new EvApiResult<string>()
-            {
-                Result = imeiString,
-                Response = result
-            };
-        }
-
-        internal static async Task<EvApiResult<EvApiWifiResult>> GetWifiRssi()
-        {
-            var getResult = await EvHttpClient.GetQueryActionOpt3String();
-            string result = getResult.Msg;
-            if (!getResult.IsSuccess)
-            {
-                return new EvApiResult<EvApiWifiResult>()
-                {
-                    Result = new EvApiWifiResult()
-                    {
-                        Rssi = 0,
-                        ErrorCode = 0
-                    },
-                    Response = getResult.Msg,
-                };
-            }
-
-            Regex rx_mode = new Regex("(WifiMode)\\\": ([0-9]*)");
-            var matches_mode = rx_mode.Matches(result);
-            int rssi = 0;
-            int errorCode = -1;
-
-            if (matches_mode.Count != 0)
-            {
-                var match = matches_mode[0];
-                if (match.Groups.Count != 3)
-                {
-                    errorCode = 0;
-                }
-                else
-                {
-                    if (int.TryParse(match.Groups[2].Value, out var wifiMode))
-                    {
-                        if (wifiMode != 1)
-                        {
-                            errorCode = 1;
-                        }
-                    }
-                }
-            }
-            else
-            {
-                errorCode = 2;
-            }
-
-            if (errorCode != -1)
-            {
-                return new EvApiResult<EvApiWifiResult>()
-                {
-                    Result = new EvApiWifiResult()
-                    {
-                        Rssi = rssi,
-                        ErrorCode = errorCode
-                    },
-                    Response = result
-                };
-            }
-
-            Regex rx = new Regex("(WifiRssi)\\\": (-?[0-9]*)");
-            var matches = rx.Matches(result);
-
-            if (matches.Count != 0)
-            {
-                var match = matches[0];
-                if (match.Groups.Count != 3)
-                {
-                    errorCode = 3;
-                }
-                else
-                {
-                    if (int.TryParse(match.Groups[2].Value, out var rssiSignal))
-                    {
-                        rssi = rssiSignal;
-                    }
-                    else
-                    {
-                        errorCode = 4;
-                    }
-                }
-            }
-            else
-            {
-                errorCode = 5;
-            }
-
-            return new EvApiResult<EvApiWifiResult>()
-            {
-                Result = new EvApiWifiResult()
-                {
-                    Rssi = rssi,
-                    ErrorCode = errorCode
-                },
-                Response = result
-            };
-        }
-
-        internal static async Task<EvApiResult<Dictionary<int, string>>> GetConnectorStatus()
-        {
-            var getResult = await EvHttpClient.GetQueryActionOpt2String();
-            Dictionary<int, string> connectorStatusPair = new Dictionary<int, string>();
-
-            string result = getResult.Msg;
-            if (!getResult.IsSuccess)
-            {
-                return new EvApiResult<Dictionary<int, string>>()
-                {
-                    Result = null,
-                    Response = getResult.Msg
-                };
-            }
-
-            Regex rx = new Regex("(SystemStatus)\\\": (\\d)");
-            var matches = rx.Matches(result);
-            for (int matchIndex = 0; matchIndex < matches.Count; matchIndex++)
-            {
-                var match = matches[matchIndex];
-                if (match.Groups.Count != 3)
-                {
-                    //LogWriter.Log($"Connector {matchIndex} status string mismatched");
-                    return new EvApiResult<Dictionary<int, string>>()
-                    {
-                        Result = null,
-                        Response = result
-                    };
-                    //InfoLog += $"Connector {matchIndex} status string mismatched\n";
-                    //Logger.Print($"Connector {matchIndex} status string mismatched", isError:true);
-                }
-                else
-                {
-                    connectorStatusPair.Add(matchIndex, match.Groups[2].Value);
-                }
-            }
-
-            return new EvApiResult<Dictionary<int, string>>()
-            {
-                Result = connectorStatusPair,
-                Response = result,
-            };
-        }
-
-        internal static async Task<EvApiResult<bool>> FactorySet()
-        {
-            var getResult = await EvHttpClient.GetFactorySetResultString();
-            var result = getResult.Msg;
-            if (!getResult.IsSuccess)
-            {
-                return new EvApiResult<bool>()
-                {
-                    Result = false,
-                    Response = getResult.Msg
-                };
-            }
-
-            Regex rx = new Regex("(result)\":\"([a-zA-Z]*)\"");
-            var matches = rx.Matches(result);
-            if (matches.Count > 0 &&
-                matches[0].Success &&
-                matches[0].Groups.Count == 3 &&
-                matches[0].Groups[2].Value.ToLower() == "success")
-            {
-                return new EvApiResult<bool>()
-                {
-                    Result = true,
-                    Response = result
-                };
-            }
-            return new EvApiResult<bool>()
-            {
-                Result = false,
-                Response = result
-            };
-        }
-
-        internal static async Task<EvApiResult<bool>> SignalUpdateFirmware()
-        {
-            var result = await EvHttpClient.GetSignalUpdateFirmwareResultString();
-            if (!result.IsSuccess)
-            {
-                return new EvApiResult<bool>()
-                {
-                    Result = false,
-                    Response = result.Msg
-                };
-            }
-
-            return new EvApiResult<bool>()
-            {
-                Result = !string.IsNullOrEmpty(result.Msg),
-                Response = result.Msg,
-            };
-        }
-
-        internal static async Task<EvApiResult<bool>> SetAuthorisationMode(bool isAuthRequired)
-        {
-            var result = await EvHttpClient.SetSystemAction("AuthorisationMode", isAuthRequired ? "0" : "1");
-            if (!result.IsSuccess)
-            {
-                return new EvApiResult<bool>()
-                {
-                    Result = false,
-                    Response = result.Msg
-                };
-            }
-
-            return new EvApiResult<bool>()
-            {
-                Result = !string.IsNullOrEmpty(result.Msg),
-                Response = result.Msg,
-            };
-        }
-
-        internal static async Task<EvApiResult<string>> GetTelcomModemFwRev()
-        {
-            var key = "TelcomModemFwRev";
-
-            var result = await GetVersion();
-            if (result.Result is null)
-            {
-                return new EvApiResult<string> { Result = null, Response = result.Response };
-            }
-
-            var versionPairs = result.Result;
-            if (versionPairs is null || !versionPairs.ContainsKey(key))
-            {
-                return new EvApiResult<string> { Result = string.Empty, Response = result.Response };
-            }
-
-            return new EvApiResult<string> { Result = versionPairs[key], Response = result.Response };
-        }
-
-        internal static async Task<EvApiResult<string>> GetTelcomSubModemFwRev()
-        {
-            var key = "TelcomSubModemFwRev";
-
-            var result = await GetVersion();
-            if (result.Result is null)
-            {
-                return new EvApiResult<string> { Result = null, Response = result.Response };
-            }
-
-            var versionPairs = result.Result;
-            if (versionPairs is null || !versionPairs.ContainsKey(key))
-            {
-                return new EvApiResult<string> { Result = string.Empty, Response = result.Response };
-            }
-
-            return new EvApiResult<string> { Result = versionPairs[key], Response = result.Response };
-        }
-
-        internal static async Task<EvApiResult<SimStatusString>> GetTelcomSimStatus()
-        {
-            var result = await EvHttpClient.GetQueryActionOpt3String();
-            if (!result.IsSuccess)
-            {
-                return new EvApiResult<SimStatusString>()
-                {
-                    Result = null,
-                    Response = result.Msg
-                };
-            }
-
-            var simStatus = GetIntValue("TelcomSimStatus", result.Msg);
-            var simIccid = GetStringValue("TelcomSimIccid", result.Msg);
-            var simImsi = GetStringValue("TelcomSimImsi", result.Msg);
-            return new EvApiResult<SimStatusString>()
-            {
-                Result = new SimStatusString() { IsInstalled = simStatus == 1, ICCID = simIccid, IMSI = simImsi },
-                Response = result.Msg,
-            };
-        }
-
-        internal static async Task<EvApiResult<SimStatusString>> GetTelcomSubSimStatus()
-        {
-            var result = await EvHttpClient.GetQueryActionOpt3String();
-            if (!result.IsSuccess)
-            {
-                return new EvApiResult<SimStatusString>()
-                {
-                    Result = null,
-                    Response = result.Msg
-                };
-            }
-
-            var simStatus = GetIntValue("TelcomSubSimStatus", result.Msg);
-            var simIccid = GetStringValue("TelcomSubSimIccid", result.Msg);
-            var simImsi = GetStringValue("TelcomSubSimImsi", result.Msg);
-            return new EvApiResult<SimStatusString>()
-            {
-                Result = new SimStatusString() { IsInstalled = simStatus == 1, ICCID = simIccid, IMSI = simImsi },
-                Response = result.Msg,
-            };
-        }
-
-        /// <summary>
-        /// Not Tested
-        /// </summary>
-        /// <param name="fileName"></param>
-        /// <returns></returns>
-        [Obsolete]
-        internal static async Task<EvApiResult<bool>> Uploadfirmware(string fileName)
-        {
-            var result = await EvHttpClient.GetUploadfirmwareResultString(new List<string> { fileName });
-            if (!result.IsSuccess)
-            {
-                return new EvApiResult<bool>()
-                {
-                    Result = false,
-                    Response = result.Msg
-                };
-            }
-
-            return new EvApiResult<bool>()
-            {
-                Result = !string.IsNullOrEmpty(result.Msg),
-                Response = result.Msg,
-            };
-        }
-
-        /// <summary>
-        /// Not tested
-        /// </summary>
-        /// <param name="fileNames"></param>
-        /// <returns></returns>
-        internal static async Task<EvApiResult<bool>> Uploadfirmware(List<string> fileNames)
-        {
-            var result = await EvHttpClient.GetUploadfirmwareResultString(fileNames);
-            if (!result.IsSuccess)
-            {
-                return new EvApiResult<bool>()
-                {
-                    Result = false,
-                    Response = result.Msg
-                };
-            }
-
-            return new EvApiResult<bool>()
-            {
-                Result = !string.IsNullOrEmpty(result.Msg),
-                Response = result.Msg,
-            };
-        }
-
-        private static int? GetIntValue(string key, string source)
-        {
-            Regex rx = new Regex($"({key})\\\": ([0-9]*)");
-            var matches = rx.Matches(source);
-
-            if (matches.Count != 0)
-            {
-                var match = matches[0];
-                if (match.Groups.Count != 3)
-                {
-                    return null;
-                }
-                else
-                {
-                    if (int.TryParse(match.Groups[2].Value, out var val))
-                    {
-                        return val;
-                    }
-                    else
-                    {
-                        return null;
-                    }
-                }
-            }
-            return null;
-        }
-
-
-
-        private static string GetStringValue(string key, string source)
-        {
-            Regex rx = new Regex($"({key})\\\": \"([a-zA-Z0-9]*)\"");
-            var matches = rx.Matches(source);
-
-            if (matches.Count != 0)
-            {
-                var match = matches[0];
-                if (match.Groups.Count != 3)
-                {
-                    return null;
-                }
-                else
-                {
-                    return match.Groups[2].Value;
-                }
-            }
-            return null;
-        }
-    }
-}

+ 0 - 352
AwInitilizer/Assist/EvHttpClient.cs

@@ -1,352 +0,0 @@
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace AwInitilizer.Assist
-{
-    public class EvHttpClientResult
-    {
-        public bool IsSuccess { get; set; }
-        public string Msg { get; set; }
-    }
-
-    public class EvAuthMsg
-    {
-        public string result { get; set; }
-        public object message { get; set; }
-    }
-
-    public static class EvHttpClient
-    {
-        internal static string account = "admin";
-        internal static string pass = "1231231238";
-        //internal static string ServerIpAddress = "192.168.1.10";
-        internal static string ServerUrl = "https://192.168.1.10";
-        //internal static string ServerIpAddress = "172.18.13.84";
-        //internal static string ServerUrl = "https://172.18.13.84";
-        //updated EV
-        //internal static string ServerIpAddress = "192.168.80.197";
-        //internal static string ServerUrl = "https://192.168.80.197";
-        //original EV
-        //internal static string ServerIpAddress = "192.168.80.199";
-        //internal static string ServerUrl = "https://192.168.80.199";
-
-        internal static void ResetServerIpAddress(string ipAddress = null)
-        {
-            if (string.IsNullOrEmpty(ipAddress))
-            {
-                ServerUrl = "https://192.168.1.10";
-                return;
-            }
-
-            if (!ipAddress.StartsWith("http"))
-            {
-                ipAddress = $"https://{ipAddress}";
-            }
-            ServerUrl = ipAddress;
-            return;
-        }
-
-        internal static Task<EvHttpClientResult> GetQueryActionOpt1String()
-        {
-            string api = "get_query_action.php";
-            Dictionary<string, string> param = new Dictionary<string, string>() {
-                {"opt","1"}
-            };
-            return CallBase(api, param);
-        }
-
-        internal static Task<EvHttpClientResult> GetQueryActionOpt2String()
-        {
-            string api = "get_query_action.php";
-            Dictionary<string, string> param = new Dictionary<string, string>() {
-                {"opt","2"}
-            };
-            return CallBase(api, param);
-        }
-
-        internal static Task<EvHttpClientResult> GetQueryActionOpt3String()
-        {
-            string api = "get_query_action.php";
-            Dictionary<string, string> param = new Dictionary<string, string>() {
-                {"opt","3"}
-            };
-            return CallBase(api, param);
-        }
-
-        internal static Task<EvHttpClientResult> GetQueryActionOpt4String()
-        {
-            string api = "get_query_action.php";
-            Dictionary<string, string> param = new Dictionary<string, string>() {
-                {"opt","4"}
-            };
-            return CallBase(api, param);
-        }
-
-        internal static Task<EvHttpClientResult> GetButtonStatusString()
-        {
-            string api = "get_button_action.php";
-            Dictionary<string, string> param = new Dictionary<string, string>()
-            {
-            };
-            return CallBase(api, param);
-        }
-
-        internal static Task<EvHttpClientResult> GetFactorySetResultString()
-        {
-            string api = "set_system_action.php";
-            Dictionary<string, string> param = new Dictionary<string, string>();
-            param.Add("FactoryConfiguration", "1");
-            //param.Add("SystemId", "");
-            //param.Add("SystemDateTime", "");
-            //param.Add("PhaseLossPolicy", "");
-            //param.Add("FactoryConfiguration", "1");
-            //param.Add("AuthorisationMode", "");
-            //param.Add("isAPP", "");
-            //param.Add("isQRCode", "");
-            //param.Add("isRFID", "");
-            //param.Add("QRCodeMadeMode", "");
-            //param.Add("QRCodeContent", "");
-            //param.Add("Intensity", "");
-            //param.Add("RfidCardNumEndian", "");
-            //param.Add("PsuAcInputType", "");
-            return CallBase(api, param);
-        }
-
-        internal static Task<EvHttpClientResult> GetUploadfirmwareResultString(List<string> fileNames)
-        {
-            string api = "upgrade_iso_action.php";
-            Dictionary<string, string> param = new Dictionary<string, string>(){
-                {"fw_tag","iso"}
-            };
-            var httpContentList = new List<HttpContent>();
-            foreach (var fileName in fileNames)
-            {
-                var bytes = File.ReadAllBytes(fileName);
-                var fileContent = new ByteArrayContent(bytes);
-
-                //FileStream file = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-                //var fileContent = new StreamContent(file);
-
-                fileContent.Headers.ContentDisposition
-                  = new ContentDispositionHeaderValue("attachment")
-                  {
-                      FileName = Path.GetFileName(fileName),
-                      CreationDate = DateTime.Now,
-                      ModificationDate = DateTime.Now,
-                      ReadDate = DateTime.Now,
-                      Name = "files[]"
-                  };
-                httpContentList.Add(fileContent);
-            }
-            return CallBase(api, param, customContents: httpContentList, timeOutSeconds: 3600);
-            //return CallBase(api, param, firmwareNames: fileNames);
-        }
-
-        internal static Task<EvHttpClientResult> GetSignalUpdateFirmwareResultString()
-        {
-            string api = "upgrade_iso_action.php";
-            Dictionary<string, string> param = new Dictionary<string, string>(){
-                {"fw_tag","iso"},
-            };
-            var dummyFileCotent = new ByteArrayContent(new byte[0]);
-            dummyFileCotent.Headers.ContentDisposition
-              = new ContentDispositionHeaderValue("attachment")
-              {
-                  FileName = "temp.txt",
-                  Size = 0,
-                  CreationDate = DateTime.Now,
-                  ModificationDate = DateTime.Now,
-                  ReadDate = DateTime.Now,
-                  Name = "files[]"
-              };
-
-            return CallBase(api, param, customContents: new List<HttpContent>() { dummyFileCotent });
-        }
-
-        internal static Task<EvHttpClientResult> SetSystemAction(string key, string value)
-        {
-            string api = "set_system_action.php";
-            Dictionary<string, string> param = new Dictionary<string, string>(){
-                {key,value},
-            };
-
-            return CallBase(api, param, customContents: new List<HttpContent>() { });
-        }
-
-        private static async Task<EvHttpClientResult> CallBase(
-            string api,
-            Dictionary<string, string> param,
-            List<string> firmwareNames = null,
-            List<HttpContent> customContents = null,
-            int timeOutSeconds = 5)
-        {
-            try
-            {
-                var url = string.Format("{0}/{1}", ServerUrl, api);
-                EvHttpClientLogger.Instance.Log(url);
-
-                Dictionary<string, string> pams = new Dictionary<string, string>
-                {
-                    { "account", account },
-                    { "password", pass }
-                };
-                foreach (var pam in param)
-                {
-                    pams.Add(pam.Key, pam.Value);
-                }
-
-
-                var formContent = new MultipartFormDataContent();
-                foreach (var pam in pams)
-                {
-                    formContent.Add(new StringContent(pam.Value), pam.Key);
-                }
-
-                if (firmwareNames != null)
-                {
-                    foreach (var fileName in firmwareNames)
-                    {
-                        formContent.Add(new ByteArrayContent(System.IO.File.ReadAllBytes(fileName)), "file[]");
-                    }
-
-                    //if (firmwareNames.Count == 1)
-                    //{
-                    //    var fileName = firmwareNames[0];
-                    //    formContent.Add(new ByteArrayContent(System.IO.File.ReadAllBytes(fileName)), "file");
-                    //}
-                    //else
-                    //{
-                    //    foreach (var fileName in firmwareNames)
-                    //    {
-                    //        formContent.Add(new ByteArrayContent(System.IO.File.ReadAllBytes(fileName)), "file[]");
-                    //    }
-                    //}
-                }
-
-                if (customContents != null)
-                {
-                    foreach (var content in customContents)
-                    {
-                        formContent.Add(content);
-                    }
-                }
-
-                HttpResponseMessage postResult;
-                string result = null;
-
-
-                var handler = new HttpClientHandler();
-                handler.ClientCertificateOptions = ClientCertificateOption.Manual;
-                handler.ServerCertificateCustomValidationCallback =
-                    (httpRequestMessage, cert, cetChain, policyErrors) =>
-                    {
-                        return true;
-                    };
-
-                using (HttpClient evClient = new HttpClient(handler))
-                {
-                    evClient.Timeout = TimeSpan.FromSeconds(timeOutSeconds);
-
-                    try
-                    {
-                        EvHttpClientLogger.Instance.Log("post with new version");
-                        postResult = await evClient.PostAsync(url, formContent);
-                        EvHttpClientLogger.Instance.Log(postResult.StatusCode.ToString());
-
-                        //MessageBox.Show("Rest Result:" + postResult.StatusCode);
-                        if (postResult == null || !postResult.IsSuccessStatusCode)
-                        {
-                            throw new Exception("Post fail");
-                        }
-                        result = await postResult.Content.ReadAsStringAsync();
-                        EvHttpClientLogger.Instance.Log(result);
-
-                        //MessageBox.Show("Rest Result:" + result);
-
-                        if (result.Contains("File is uploaded, please wait a moment to upgrade"))
-                        {
-                            return new EvHttpClientResult()
-                            {
-                                IsSuccess = true,
-                                Msg = result,
-                            };
-                        }
-
-                        var check = JsonConvert.DeserializeObject<EvAuthMsg>(result);
-                        if (check != null &&
-                            check.result != null &&
-                            check.result.ToLower() == "fail")
-                        {
-                            return new EvHttpClientResult()
-                            {
-                                IsSuccess = false,
-                                Msg = result,
-                            };
-                        }
-
-                        return new EvHttpClientResult()
-                        {
-                            IsSuccess = true,
-                            Msg = result,
-                        };
-                    }
-                    catch (Exception e)
-                    {
-                        //post fail
-                        EvHttpClientLogger.Instance.Log(e.Message);
-                        EvHttpClientLogger.Instance.Log(e.StackTrace);
-                    }
-                }
-
-                using (WebClientTimeout webClient = new WebClientTimeout())
-                {
-                    EvHttpClientLogger.Instance.Log("post with old version");
-                    NameValueCollection parameters = new NameValueCollection();
-                    foreach (var inpam in param)
-                    {
-                        parameters.Add(inpam.Key, inpam.Value);
-                    }
-                    webClient.QueryString = parameters;
-
-                    using (Stream stream = webClient.OpenRead(url))
-                    // 使用 StreamReader 讀取 stream 內的字元
-                    using (StreamReader reader = new StreamReader(stream))
-                    {
-                        // 將 StreamReader 所讀到的字元轉為 string
-                        result = await reader.ReadToEndAsync();
-                    }
-                    EvHttpClientLogger.Instance.Log(result);
-
-                    var check = JsonConvert.DeserializeObject<EvAuthMsg>(result);
-                    if (check != null &&
-                        check.result != null &&
-                        check.result.ToLower() == "fail")
-                    {
-                        return new EvHttpClientResult()
-                        {
-                            IsSuccess = false,
-                            Msg = result,
-                        };
-                    }
-                }
-                return new EvHttpClientResult() { IsSuccess = true, Msg = result };
-
-            }
-            catch (Exception e)
-            {
-                return new EvHttpClientResult() { IsSuccess = false, Msg = e.Message }; ;
-            }
-        }
-    }
-}

+ 0 - 59
AwInitilizer/Assist/EvHttpClientLogger.cs

@@ -1,59 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace AwInitilizer.Assist
-{
-    public class EvHttpClientLogger
-    {
-        public static EvHttpClientLogger Instance => _Instance;
-
-        private static EvHttpClientLogger _Instance = new EvHttpClientLogger();
-
-        private EvHttpClientLogger()
-        {
-            if (!Directory.Exists(FolderName))
-            {
-                Directory.CreateDirectory(FolderName);
-            }
-        }
-        private const string FolderName = "ApiLog";
-        private const int MaxLogCnt = 10;
-        private string LogFileName = null;
-
-        internal void StartNewLog(string name)
-        {
-            TryRemoveOneLog();
-            LogFileName = name + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".txt";
-        }
-
-        internal void Log(string mesasage)
-        {
-            if (string.IsNullOrEmpty(LogFileName))
-            {
-                return;
-            }
-            File.AppendAllText(Path.Combine(FolderName, LogFileName), mesasage + Environment.NewLine);
-        }
-
-        private void TryRemoveOneLog()
-        {
-            var files = Directory.GetFiles(FolderName).ToList();
-            if (files.Count < MaxLogCnt)
-            {
-                return;
-            }
-
-            List<FileInfo> fileInfos = new List<FileInfo>();
-            foreach (var file in files) {
-                fileInfos.Add(new FileInfo(file));
-            }
-            var candidateFile = fileInfos.OrderBy(x => x.LastWriteTimeUtc).First();
-            candidateFile.Delete();
-        }
-    }
-}

+ 4 - 4
AwInitilizer/Initializer.csproj

@@ -111,9 +111,6 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
-    <Compile Include="Assist\EvApi.cs" />
-    <Compile Include="Assist\EvHttpClient.cs" />
-    <Compile Include="Assist\EvHttpClientLogger.cs" />
     <Compile Include="Converter\MesErrorCodeMaper.cs" />
     <Compile Include="Converter\PressStatusConverter.cs" />
     <Compile Include="KeyinListener.cs" />
@@ -179,7 +176,6 @@
     </Page>
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="Model\ButtonStatus.cs" />
     <Compile Include="Model\UploadFile.cs" />
     <Compile Include="Procedure\ButtonStatusCheckPorcedure.cs" />
     <Compile Include="Model\EvseSerialResponseModel.cs" />
@@ -228,6 +224,10 @@
     </BootstrapperPackage>
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\CsuWebApiLib\CsuWebApiLib.csproj">
+      <Project>{b8c304d4-8ee8-435b-bef8-606993c158a0}</Project>
+      <Name>CsuWebApiLib</Name>
+    </ProjectReference>
     <ProjectReference Include="..\InitializerModel\InitializerModel.csproj">
       <Project>{68a79486-7973-42bf-8caf-43296beb1107}</Project>
       <Name>InitializerModel</Name>

+ 5 - 3
AwInitilizer/MainWindow.xaml.cs

@@ -1,6 +1,7 @@
 using AwInitilizer.Assist;
 using AwInitilizer.Model;
 using AwInitilizer.Procedure;
+using CsuWebApiLib;
 using InitializerModel;
 using MesAdaptor;
 using Microsoft.Win32;
@@ -211,8 +212,8 @@ namespace AwInitilizer
 
             DisplayLogin();
 
-            var tester = new ProcedureBase();
-            _ = tester.ChekCsuBootCompelete();
+            //var tester = new ProcedureBase();
+            //_ = tester.ChekCsuBootCompelete();
         }
 
         private void StartInit_Click(object sender, RoutedEventArgs e)
@@ -730,6 +731,7 @@ namespace AwInitilizer
             //ViewModel.SkipButtonTest = setting.SkipButtonTest;
             ViewModel.IpAddress = setting.IpAddress;
             ViewModel.IsDisableAuthRequired = setting.IsDisableAuthRequired;
+            ViewModel.IsIdleCheckPass = setting.IsIdleCheckPass;
             ViewModel.FirmwareUpdateModels = setting.FirmwareUpdateList
                 .Where(x => !string.IsNullOrEmpty(x.Module) && !string.IsNullOrEmpty(x.FirmwareFileName)
                 ).ToList();
@@ -746,10 +748,10 @@ namespace AwInitilizer
             //init intilize procedure list
 
             procedures.Add(new Procedure.BasicInfoUpdate.BasicInfoUpdateProcedure());
+            procedures.Add(new Procedure.FirmwareBundleUpload.FirmwareBundleUploadProcedure());
             procedures.Add(new Procedure.FourGenModuleCheck.FourGenModuleCheckProcedure());
             procedures.Add(new Procedure.WifRssiCheck.WifRssiCheckProcedure());
             procedures.Add(new Procedure.TelcomModemImeiRecord.TelcomModemImeiRecordProcedure());
-            procedures.Add(new Procedure.FirmwareBundleUpload.FirmwareBundleUploadProcedure());
             //procedures.Add(new Procedure.FirmwareBundleUpload.FirmwareFtpUploadProcedure());
             procedures.Add(new Procedure.FirmwareCheckVersion.FirmwareCheckVersionProcedure());
             procedures.Add(new Procedure.ButtonStatusCheck.ButtonStatusCheckPorcedure());

+ 0 - 15
AwInitilizer/Model/ButtonStatus.cs

@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.Model
-{
-    public class ButtonStatus
-    {
-        public int Button1 { get; set; }
-        public int Button2 { get; set; }
-        public int EmergencyButton { get; set; }
-    }
-}

+ 27 - 111
AwInitilizer/Model/UpdateData.cs

@@ -9,88 +9,46 @@ using System.Threading.Tasks;
 
 namespace AwInitilizer.Model
 {
-    public class UpdateData : INotifyPropertyChanged
+    public class UpdateData : ObservableObject
     {
         private SystemID _SystemID;
         public SystemID SystemID {
             get => _SystemID;
-            set
-            {
-                if(_SystemID!=value)
-                {
-                    _SystemID = value;
-                    RaisePropertyChanged("SystemID");
-                }
-            }
+            set => SetProperty(ref _SystemID, value);
         }
 
         private string _ModelName;
         public string ModelName {
             get => _ModelName;
-            set
-            {
-                if(_ModelName!=value)
-                {
-                    _ModelName = value;
-                    RaisePropertyChanged("ModelName");
-                }
-            }
+            set => SetProperty(ref _ModelName, value);
         }
 
         private string _SerialNumber;
         public string SerialNumber
         {
             get => _SerialNumber;
-            set
-            {
-                if (_SerialNumber != value)
-                {
-                    _SerialNumber = value;
-                    RaisePropertyChanged("SerialNumber");
-                }
-            }
+            set => SetProperty(ref _SerialNumber, value);
         }
 
         private string _FourGenModuleVersion;
         public string FourGenModuleVersion
         {
             get => _FourGenModuleVersion;
-            set
-            {
-                if (_FourGenModuleVersion != value)
-                {
-                    _FourGenModuleVersion = value;
-                    RaisePropertyChanged("FourGenModuleVersion");
-                }
-            }
+            set => SetProperty(ref _FourGenModuleVersion, value);
         }
 
         private string _SubFourGenModuleVersion;
         public string SubFourGenModuleVersion
         {
             get => _SubFourGenModuleVersion;
-            set
-            {
-                if (_SubFourGenModuleVersion != value)
-                {
-                    _SubFourGenModuleVersion = value;
-                    RaisePropertyChanged("SubFourGenModuleVersion");
-                }
-            }
+            set => SetProperty(ref _SubFourGenModuleVersion, value);
         }
 
         private bool _IsSimInsert;
         public bool IsSimInsert
         {
             get => _IsSimInsert;
-            set
-            {
-                if(_IsSimInsert != value)
-                {
-                    _IsSimInsert = value;
-                    RaisePropertyChanged("IsSimInsert");
-                }
-            }
+            set => SetProperty(ref _IsSimInsert, value);
         }
 
         private string _SimICCID;
@@ -98,11 +56,9 @@ namespace AwInitilizer.Model
             get => _SimICCID;
             set
             {
-                if (_SimICCID != value)
+                if (SetProperty(ref _SimICCID, value))
                 {
-                    _SimICCID = value;
-                    RaisePropertyChanged("SimICCID");
-                    RaisePropertyChanged("UiSimICCID");
+                    RaisePropertyChanged(nameof(UiSimICCID));
                 }
             }
         }
@@ -113,11 +69,9 @@ namespace AwInitilizer.Model
             get => _SimIMSI;
             set
             {
-                if (_SimIMSI != value)
+                if (SetProperty(ref _SimIMSI, value))
                 {
-                    _SimIMSI = value;
-                    RaisePropertyChanged("SimIMSI");
-                    RaisePropertyChanged("UiSimIMSI");
+                    RaisePropertyChanged(nameof(UiSimIMSI));
                 }
             }
         }
@@ -126,14 +80,7 @@ namespace AwInitilizer.Model
         public bool IsSubSimInsert
         {
             get => _IsSubSimInsert;
-            set
-            {
-                if(_IsSubSimInsert != value)
-                {
-                    _IsSubSimInsert = value;
-                    RaisePropertyChanged("IsSubSimInsert");
-                }
-            }
+            set => SetProperty(ref _IsSubSimInsert, value);
         }
 
         private string _SubSimICCID;
@@ -142,11 +89,9 @@ namespace AwInitilizer.Model
             get => _SubSimICCID;
             set
             {
-                if (_SubSimICCID != value)
+                if (SetProperty(ref _SubSimICCID, value))
                 {
-                    _SubSimICCID = value;
-                    RaisePropertyChanged("SubSimICCID");
-                    RaisePropertyChanged("UiSimICCID");
+                    RaisePropertyChanged(nameof(UiSimICCID));
                 }
             }
         }
@@ -157,11 +102,9 @@ namespace AwInitilizer.Model
             get => _SubSimIMSI;
             set
             {
-                if (_SubSimIMSI != value)
+                if (SetProperty(ref _SubSimIMSI, value))
                 {
-                    _SubSimIMSI = value;
-                    RaisePropertyChanged("SubSimIMSI");
-                    RaisePropertyChanged("UiSimIMSI");
+                    RaisePropertyChanged(nameof(UiSimIMSI));
                 }
             }
         }
@@ -173,14 +116,7 @@ namespace AwInitilizer.Model
         public ButtonTestModeType ButtonTestMode
         {
             get => _ButtonTestMode;
-            set
-            {
-                if (_ButtonTestMode != value)
-                {
-                    _ButtonTestMode = value;
-                    RaisePropertyChanged("ButtonTestMode");
-                }
-            }
+            set => SetProperty(ref _ButtonTestMode, value);
         }
 
         //private bool _SkipEmergencyButton;
@@ -215,48 +151,28 @@ namespace AwInitilizer.Model
         public string IpAddress
         {
             get => _IpAddress;
-            set
-            {
-                if (_IpAddress != value)
-                {
-                    _IpAddress = value;
-                    RaisePropertyChanged("IpAddress");
-                }
-            }
+            set => SetProperty(ref _IpAddress, value);
         }
 
         private bool _IsDisableAuthRequired;
         public bool IsDisableAuthRequired
         {
             get => _IsDisableAuthRequired;
-            set
-            {
-                if (_IsDisableAuthRequired != value)
-                {
-                    _IsDisableAuthRequired = value;
-                    RaisePropertyChanged("IsDisableAuthRequired");
-                }
-            }
+            set => SetProperty(ref _IsDisableAuthRequired, value);
         }
 
-        private List<FirmwareUpdateModel> _FirmwareUpdateModels;
-        public List<FirmwareUpdateModel> FirmwareUpdateModels
+        private bool _IsIdleCheckPass;
+        public bool IsIdleCheckPass
         {
-            get => _FirmwareUpdateModels;
-            set
-            {
-                if (_FirmwareUpdateModels != value)
-                {
-                    _FirmwareUpdateModels = value;
-                    RaisePropertyChanged("FirmwareUpdateModels");
-                }
-            }
+            get => _IsIdleCheckPass;
+            set => SetProperty(ref _IsIdleCheckPass, value);
         }
 
-        public event PropertyChangedEventHandler PropertyChanged;
-        internal void RaisePropertyChanged(string name)
+        private List<FirmwareUpdateModel> _FirmwareUpdateModels;
+        public List<FirmwareUpdateModel> FirmwareUpdateModels
         {
-            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+            get => _FirmwareUpdateModels;
+            set => SetProperty(ref _FirmwareUpdateModels, value);
         }
     }
 }

+ 6 - 1
AwInitilizer/Procedure/BasicInfoUpdateProcedure.cs

@@ -230,13 +230,18 @@ namespace AwInitilizer.Procedure.BasicInfoUpdate
                 LogWriter.Log("UTC Time update Success");
             }
 
-            for (var pollingCnt = 0; pollingCnt < 56; pollingCnt++)
+            int pollingCnt;
+            for (pollingCnt = 0; pollingCnt < 16; pollingCnt++)
             {
                 await Task.Delay(TimeSpan.FromSeconds(15));
                 var response = await ChekCsuBootCompelete();
                 if (response)
                     break;
             }
+            if (pollingCnt == 16)
+            {
+                LogWriter.Log("Wait reboot complete time out");
+            }
 
             return true;
         }

+ 2 - 0
AwInitilizer/Procedure/ButtonStatusCheckPorcedure.cs

@@ -1,5 +1,7 @@
 using AwInitilizer.Assist;
 using AwInitilizer.Model;
+using CsuWebApiLib;
+using CsuWebApiLib.Model;
 using InitializerModel;
 using Newtonsoft.Json;
 using System;

+ 1 - 0
AwInitilizer/Procedure/DsiableChargeAuthProcedure.cs

@@ -1,4 +1,5 @@
 using AwInitilizer.Assist;
+using CsuWebApiLib;
 using InitializerModel;
 using Newtonsoft.Json;
 using System;

+ 1 - 0
AwInitilizer/Procedure/FirmwareBundleUploadProcedure.cs

@@ -11,6 +11,7 @@ using System.Net;
 using System.Web;
 using System.IO;
 using System.Runtime.InteropServices;
+using CsuWebApiLib;
 
 namespace AwInitilizer.Procedure.FirmwareBundleUpload
 {

+ 57 - 1
AwInitilizer/Procedure/FirmwareCheckVersionProcedure.cs

@@ -1,5 +1,6 @@
 
 using AwInitilizer.Assist;
+using CsuWebApiLib;
 using InitializerModel;
 using Newtonsoft.Json;
 using System;
@@ -50,7 +51,37 @@ namespace AwInitilizer.Procedure.FirmwareCheckVersion
             };
         }
 
-        internal override async Task<bool> Run()
+        internal override Task<bool> Run()
+        {
+            if (UpdateData.IsIdleCheckPass)
+            {
+                return RunWithNoBootCheck();
+            }
+            return RunWithBootCheck();
+        }
+
+        internal async Task<bool> RunWithNoBootCheck()
+        {
+            await Task.Delay(TimeSpan.FromMinutes(2));
+            await Task.Delay(5_000);
+
+            int pollingCnt = 0;
+            for (pollingCnt = 0; pollingCnt < 56; pollingCnt++)
+            {
+                await Task.Delay(TimeSpan.FromSeconds(15));
+
+                var checkVersionResult = await CheckVersion();
+                if (checkVersionResult)
+                {
+                    return true;
+                }
+            }
+
+            Error = ErrorType.VersionCheckFail;
+            return false;
+        }
+
+        internal async Task<bool> RunWithBootCheck()
         {
             //wait restart
             bool response = false;
@@ -100,6 +131,31 @@ namespace AwInitilizer.Procedure.FirmwareCheckVersion
             return true;
         }
 
+        private async Task<bool> CheckVersion()
+        {
+            //get version 
+            var versionPair = await GetVersion();
+            var updatedList = UpdateData.FirmwareUpdateModels;
+
+            if (versionPair == null)
+            {
+                //Error = ErrorType.VersionCheckFail;
+                return false;
+            }
+
+            foreach (var model in updatedList)
+            {
+                var checkResult = CheckModelbyList(model, versionPair);
+                if (!checkResult)
+                {
+                    //Error = ErrorType.VersionCheckFail;
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
         private bool CheckModelbyList(FirmwareUpdateModel model, Dictionary<string,string> versionPair)
         {
             if (string.IsNullOrEmpty(model.Module))

+ 1 - 0
AwInitilizer/Procedure/FirmwareFtpUploadProcedure.cs

@@ -1,4 +1,5 @@
 using AwInitilizer.Assist;
+using CsuWebApiLib;
 using FluentFTP;
 using System;
 using System.Collections.Generic;

+ 1 - 0
AwInitilizer/Procedure/FirmwareUpdateProcedure.cs

@@ -1,5 +1,6 @@
 using AwInitilizer.Assist;
 using AwInitilizer.Model;
+using CsuWebApiLib;
 using InitializerModel;
 using Newtonsoft.Json;
 using System;

+ 1 - 0
AwInitilizer/Procedure/FirmwareUploadProcedure.cs

@@ -1,5 +1,6 @@
 using AwInitilizer.Assist;
 using AwInitilizer.Model;
+using CsuWebApiLib;
 using InitializerModel;
 using System;
 using System.Collections.Generic;

+ 20 - 18
AwInitilizer/Procedure/FourGenModuleCheckProcedure.cs

@@ -1,4 +1,6 @@
 using AwInitilizer.Assist;
+using CsuWebApiLib;
+using PhihongEv.Lib;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -89,26 +91,26 @@ namespace AwInitilizer.Procedure.FourGenModuleCheck
             }
 
             //Logger.Print("Connecting to EVSE");
-            int pollingCnt;
-            bool response;
-            for (pollingCnt = 0; pollingCnt < 56; pollingCnt++)
-            {
-                await Task.Delay(TimeSpan.FromSeconds(15));
-                response = await ChekCsuBootCompelete();
-                if (response)
-                    break;
-            }
+            //int pollingCnt;
+            //bool response;
+            //for (pollingCnt = 0; pollingCnt < 56; pollingCnt++)
+            //{
+            //    await Task.Delay(TimeSpan.FromSeconds(15));
+            //    response = await ChekCsuBootCompelete();
+            //    if (response)
+            //        break;
+            //}
 
-            LogWriter.Log(string.Format("EVSE connet elapsed minute(s) : {0}, Expect:<16", (pollingCnt * 0.25) + 2));
+            //LogWriter.Log(string.Format("EVSE connet elapsed minute(s) : {0}, Expect:<16", (pollingCnt * 0.25) + 2));
 
-            //timeout
-            if (pollingCnt >= 56)
-            {
-                LogWriter.Report(LogEvent.FourgenSocketConnect, "fail", isError: true);
-                Error = ErrorType.ConnectFail;
+            ////timeout
+            //if (pollingCnt >= 56)
+            //{
+            //    LogWriter.Report(LogEvent.FourgenSocketConnect, "fail", isError: true);
+            //    Error = ErrorType.ConnectFail;
 
-                return false;
-            }
+            //    return false;
+            //}
 
             //if (!await base.CheckAndCreateSocket())
             //{
@@ -117,7 +119,7 @@ namespace AwInitilizer.Procedure.FourGenModuleCheck
 
             //    return false;
             //}
-            LogWriter.Report(LogEvent.FourgenSocketConnect, "success");
+            //LogWriter.Report(LogEvent.FourgenSocketConnect, "success");
 
             //var fourthGenModuleVersion = await serialPortocol.GetFourGenModuleVersion();
             var getfourthGenModuleVersion = await EvApi.GetTelcomModemFwRev();

+ 1 - 0
AwInitilizer/Procedure/ProcedureBase.cs

@@ -1,6 +1,7 @@
 using AwInitilizer.Assist;
 using AwInitilizer.Interface;
 using AwInitilizer.Model;
+using CsuWebApiLib;
 using MesAdaptor;
 using Newtonsoft.Json;
 using System;

+ 1 - 0
AwInitilizer/Procedure/RestarttoIdelProcedure.cs

@@ -1,4 +1,5 @@
 using AwInitilizer.Assist;
+using CsuWebApiLib;
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;

+ 2 - 0
AwInitilizer/Procedure/TelcomModemImeiRecordProcedure.cs

@@ -1,4 +1,6 @@
 using AwInitilizer.Assist;
+using CsuWebApiLib;
+using PhihongEv.Lib;
 using System;
 using System.Collections.Generic;
 using System.Collections.Specialized;

+ 1 - 0
AwInitilizer/Procedure/VersionLogProcedure.cs

@@ -1,4 +1,5 @@
 using AwInitilizer.Assist;
+using CsuWebApiLib;
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;

+ 18 - 0
AwInitilizer/Procedure/WifRssiCheckProcedure.cs

@@ -1,5 +1,8 @@
 using AwInitilizer.Assist;
+using CsuWebApiLib;
+using InitializerModel;
 using Newtonsoft.Json;
+using PhihongEv.Lib;
 using System;
 using System.Collections.Generic;
 using System.Collections.Specialized;
@@ -63,10 +66,25 @@ namespace AwInitilizer.Procedure.WifRssiCheck
                 return true;
             }
 
+            var updateWifiConfigResult = await SetWifiConfig();
+            if (updateWifiConfigResult)
+            {
+                LogWriter.Log("set wifi to station failed");
+                return false;
+            }
+
             var checkResult = await CheckWifiRssi();
             return checkResult;
         }
 
+        internal async Task<bool> SetWifiConfig()
+        {
+            var ssid = AppSettingConfig.Instance.WifiApSSID;
+            var pwd = AppSettingConfig.Instance.WifiApPassword;
+            var cmdResult = await EvApi.SetWifiStationMode(ssid, pwd);
+            return cmdResult.Result;
+        }
+
         internal async Task<bool> CheckWifiRssi()
         {
             var rssi = await GetWifiRssi();

+ 1 - 1
AwInitilizer/Properties/AssemblyInfo.cs

@@ -34,4 +34,4 @@ using System.Runtime.InteropServices;
 // [assembly: AssemblyVersion("1.13.2.0")]
 [assembly: AssemblyVersion("1.13.2.0")]
 [assembly: AssemblyFileVersion("1.13.2.0")]
-[assembly: AssemblyInformationalVersion("e8c61f8")]
+[assembly: AssemblyInformationalVersion("2a6cbf5")]

+ 1 - 1
ConfigEditor/Properties/AssemblyInfo.cs

@@ -53,4 +53,4 @@ using System.Windows;
 // [assembly: AssemblyVersion("1.13.2.0")]
 [assembly: AssemblyVersion("1.13.2.0")]
 [assembly: AssemblyFileVersion("1.13.2.0")]
-[assembly: AssemblyInformationalVersion("e8c61f8")]
+[assembly: AssemblyInformationalVersion("2a6cbf5")]

+ 10 - 0
ConfigEditor/SubPage/AppConfig/AppConfigPanel.xaml

@@ -54,5 +54,15 @@
             <Label Width="185">JohnSenLedComPort</Label>
             <TextBox Width="150" Text="{Binding JohnSenLedComPort}" />
         </StackPanel>
+        <Rectangle Height="10" />
+        <StackPanel Orientation="Horizontal">
+            <Label Width="185">WifiApSSID</Label>
+            <TextBox Width="150" Text="{Binding WifiApSSID}" />
+        </StackPanel>
+        <Rectangle Height="10" />
+        <StackPanel Orientation="Horizontal">
+            <Label Width="185">WifiApPassword</Label>
+            <TextBox Width="150" Text="{Binding WifiApPassword}" />
+        </StackPanel>
     </StackPanel>
 </UserControl>

+ 7 - 0
ConfigEditor/SubPage/EvseConfig/EvseConfigPanel.xaml

@@ -57,6 +57,13 @@
                     VerticalAlignment="Center"
                     IsChecked="{Binding IsDisableAuthRequired}" />
             </StackPanel>
+            <StackPanel Orientation="Horizontal">
+                <Label Width="185">IsIdleCheckPass</Label>
+                <CheckBox
+                    Width="150"
+                    VerticalAlignment="Center"
+                    IsChecked="{Binding IsIdleCheckPass}" />
+            </StackPanel>
             <Rectangle Height="10" />
             <GroupBox
                 x:Name="uxFirstTelcom"

+ 63 - 0
CsuWebApiLib/CsuWebApiLib.csproj

@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{B8C304D4-8EE8-435B-BEF8-606993C158A0}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>CsuWebApiLib</RootNamespace>
+    <AssemblyName>CsuWebApiLib</AssemblyName>
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <Deterministic>true</Deterministic>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Model\ButtonStatus.cs" />
+    <Compile Include="EvApi.cs" />
+    <Compile Include="EvHttpClient.cs" />
+    <Compile Include="EvHttpClientLogger.cs" />
+    <Compile Include="Model\WifiConfig.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Model\SimStatusString.cs" />
+    <Compile Include="WebClientTimeout.cs">
+      <SubType>Component</SubType>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 50 - 17
ApiTest/EvApi.cs → CsuWebApiLib/EvApi.cs

@@ -1,4 +1,4 @@
-using AwInitilizer.Model;
+using CsuWebApiLib.Model;
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
@@ -9,7 +9,7 @@ using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using System.Windows;
 
-namespace AwInitilizer.Assist
+namespace CsuWebApiLib
 {
     public class EvApiResult<T>
     {
@@ -25,7 +25,7 @@ namespace AwInitilizer.Assist
 
     public static class EvApi
     {
-        internal static async Task<EvApiResult<bool>> ChekCsuBootCompelete()
+        public static async Task<EvApiResult<bool>> ChekCsuBootCompelete()
         {
             var getResult = await EvHttpClient.GetQueryActionOpt2String();
             if (!getResult.IsSuccess ||
@@ -70,7 +70,7 @@ namespace AwInitilizer.Assist
             };
         }
 
-        internal static async Task<EvApiResult<bool>> CheckGetQueryAction()
+        public static async Task<EvApiResult<bool>> CheckGetQueryAction()
         {
             var getResult = await EvHttpClient.GetQueryActionOpt2String();
             if (!getResult.IsSuccess ||
@@ -86,7 +86,7 @@ namespace AwInitilizer.Assist
             };
         }
 
-        internal static async Task<EvApiResult<ButtonStatus>> GetButtonStatus()
+        public static async Task<EvApiResult<ButtonStatus>> GetButtonStatus()
         {
             var getResult = await EvHttpClient.GetButtonStatusString();
             var result = getResult.Msg;
@@ -117,7 +117,7 @@ namespace AwInitilizer.Assist
             };
         }
 
-        internal static async Task<EvApiResult<Dictionary<string, string>>> GetVersion()
+        public static async Task<EvApiResult<Dictionary<string, string>>> GetVersion()
         {
             var getResult = await EvHttpClient.GetQueryActionOpt1String();
             var toReturn = new Dictionary<string, string>();
@@ -164,7 +164,7 @@ namespace AwInitilizer.Assist
             };
         }
 
-        internal static async Task<EvApiResult<string>> GetTelcomModemImei()
+        public static async Task<EvApiResult<string>> GetTelcomModemImei()
         {
             var getResult = await EvHttpClient.GetQueryActionOpt3String();
             string result = getResult.Msg;
@@ -212,7 +212,7 @@ namespace AwInitilizer.Assist
             };
         }
 
-        internal static async Task<EvApiResult<EvApiWifiResult>> GetWifiRssi()
+        public static async Task<EvApiResult<EvApiWifiResult>> GetWifiRssi()
         {
             var getResult = await EvHttpClient.GetQueryActionOpt3String();
             string result = getResult.Msg;
@@ -308,7 +308,7 @@ namespace AwInitilizer.Assist
             };
         }
 
-        internal static async Task<EvApiResult<Dictionary<int, string>>> GetConnectorStatus()
+        public static async Task<EvApiResult<Dictionary<int, string>>> GetConnectorStatus()
         {
             var getResult = await EvHttpClient.GetQueryActionOpt2String();
             Dictionary<int, string> connectorStatusPair = new Dictionary<int, string>();
@@ -352,7 +352,7 @@ namespace AwInitilizer.Assist
             };
         }
 
-        internal static async Task<EvApiResult<bool>> FactorySet()
+        public static async Task<EvApiResult<bool>> FactorySet()
         {
             var getResult = await EvHttpClient.GetFactorySetResultString();
             var result = getResult.Msg;
@@ -385,7 +385,7 @@ namespace AwInitilizer.Assist
             };
         }
 
-        internal static async Task<EvApiResult<bool>> SignalUpdateFirmware()
+        public static async Task<EvApiResult<bool>> SignalUpdateFirmware()
         {
             var result = await EvHttpClient.GetSignalUpdateFirmwareResultString();
             if (!result.IsSuccess)
@@ -404,7 +404,7 @@ namespace AwInitilizer.Assist
             };
         }
 
-        internal static async Task<EvApiResult<bool>> SetAuthorisationMode(bool isAuthRequired)
+        public static async Task<EvApiResult<bool>> SetAuthorisationMode(bool isAuthRequired)
         {
             var result = await EvHttpClient.SetSystemAction("AuthorisationMode", isAuthRequired ? "0" : "1");
             if (!result.IsSuccess)
@@ -423,7 +423,40 @@ namespace AwInitilizer.Assist
             };
         }
 
-        internal static async Task<EvApiResult<string>> GetTelcomModemFwRev()
+        public static Task<EvApiResult<bool>> SetWifiStationMode(string ssid, string password)
+        {
+            return SetWifiConfig(WifiMode.Station, ssid, password);
+        }
+
+        internal static async Task<EvApiResult<bool>> SetWifiConfig(WifiMode mode, string ssid = "", string password = "")
+        {
+            var parm = new Dictionary<string, string>() {
+                { "WifiMode", ((int)mode).ToString() }
+            };
+            if (mode == WifiMode.Station || mode == WifiMode.AccessPoint)
+            {
+                parm.Add("WifiSsid", ssid);
+                parm.Add("WifiPassword", password);
+            }
+
+            var result = await EvHttpClient.SetNetworkAction(parm);
+            if (!result.IsSuccess)
+            {
+                return new EvApiResult<bool>()
+                {
+                    Result = false,
+                    Response = result.Msg
+                };
+            }
+
+            return new EvApiResult<bool>()
+            {
+                Result = !string.IsNullOrEmpty(result.Msg),
+                Response = result.Msg,
+            };
+        }
+
+        public static async Task<EvApiResult<string>> GetTelcomModemFwRev()
         {
             var key = "TelcomModemFwRev";
 
@@ -442,7 +475,7 @@ namespace AwInitilizer.Assist
             return new EvApiResult<string> { Result = versionPairs[key], Response = result.Response };
         }
 
-        internal static async Task<EvApiResult<string>> GetTelcomSubModemFwRev()
+        public static async Task<EvApiResult<string>> GetTelcomSubModemFwRev()
         {
             var key = "TelcomSubModemFwRev";
 
@@ -461,7 +494,7 @@ namespace AwInitilizer.Assist
             return new EvApiResult<string> { Result = versionPairs[key], Response = result.Response };
         }
 
-        internal static async Task<EvApiResult<SimStatusString>> GetTelcomSimStatus()
+        public static async Task<EvApiResult<SimStatusString>> GetTelcomSimStatus()
         {
             var result = await EvHttpClient.GetQueryActionOpt3String();
             if (!result.IsSuccess)
@@ -483,7 +516,7 @@ namespace AwInitilizer.Assist
             };
         }
 
-        internal static async Task<EvApiResult<SimStatusString>> GetTelcomSubSimStatus()
+        public static async Task<EvApiResult<SimStatusString>> GetTelcomSubSimStatus()
         {
             var result = await EvHttpClient.GetQueryActionOpt3String();
             if (!result.IsSuccess)
@@ -511,7 +544,7 @@ namespace AwInitilizer.Assist
         /// <param name="fileName"></param>
         /// <returns></returns>
         [Obsolete]
-        internal static async Task<EvApiResult<bool>> Uploadfirmware(string fileName)
+        public static async Task<EvApiResult<bool>> Uploadfirmware(string fileName)
         {
             var result = await EvHttpClient.GetUploadfirmwareResultString(new List<string> { fileName });
             if (!result.IsSuccess)

+ 22 - 12
ApiTest/EvHttpClient.cs → CsuWebApiLib/EvHttpClient.cs

@@ -12,7 +12,7 @@ using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using System.Windows;
 
-namespace AwInitilizer.Assist
+namespace CsuWebApiLib
 {
     public class EvHttpClientResult
     {
@@ -28,8 +28,8 @@ namespace AwInitilizer.Assist
 
     public static class EvHttpClient
     {
-        internal static string account = "admin";
-        internal static string pass = "1231231238";
+        public static string Account { get; set; } = "admin";
+        public static string Pass { get; set; } = "1231231238";
         //internal static string ServerIpAddress = "192.168.1.10";
         internal static string ServerUrl = "https://192.168.1.10";
         //internal static string ServerIpAddress = "172.18.13.84";
@@ -41,7 +41,7 @@ namespace AwInitilizer.Assist
         //internal static string ServerIpAddress = "192.168.80.199";
         //internal static string ServerUrl = "https://192.168.80.199";
 
-        internal static void ResetServerIpAddress(string ipAddress = null)
+        public static void ResetServerIpAddress(string ipAddress = null)
         {
             if (string.IsNullOrEmpty(ipAddress))
             {
@@ -57,7 +57,7 @@ namespace AwInitilizer.Assist
             return;
         }
 
-        internal static Task<EvHttpClientResult> GetQueryActionOpt1String()
+        public static Task<EvHttpClientResult> GetQueryActionOpt1String()
         {
             string api = "get_query_action.php";
             Dictionary<string, string> param = new Dictionary<string, string>() {
@@ -66,7 +66,7 @@ namespace AwInitilizer.Assist
             return CallBase(api, param);
         }
 
-        internal static Task<EvHttpClientResult> GetQueryActionOpt2String()
+        public static Task<EvHttpClientResult> GetQueryActionOpt2String()
         {
             string api = "get_query_action.php";
             Dictionary<string, string> param = new Dictionary<string, string>() {
@@ -75,7 +75,7 @@ namespace AwInitilizer.Assist
             return CallBase(api, param);
         }
 
-        internal static Task<EvHttpClientResult> GetQueryActionOpt3String()
+        public static Task<EvHttpClientResult> GetQueryActionOpt3String()
         {
             string api = "get_query_action.php";
             Dictionary<string, string> param = new Dictionary<string, string>() {
@@ -84,7 +84,7 @@ namespace AwInitilizer.Assist
             return CallBase(api, param);
         }
 
-        internal static Task<EvHttpClientResult> GetQueryActionOpt4String()
+        public static Task<EvHttpClientResult> GetQueryActionOpt4String()
         {
             string api = "get_query_action.php";
             Dictionary<string, string> param = new Dictionary<string, string>() {
@@ -123,7 +123,7 @@ namespace AwInitilizer.Assist
             return CallBase(api, param);
         }
 
-        internal static Task<EvHttpClientResult> GetUploadfirmwareResultString(List<string> fileNames)
+        public static Task<EvHttpClientResult> GetUploadfirmwareResultString(List<string> fileNames)
         {
             string api = "upgrade_iso_action.php";
             Dictionary<string, string> param = new Dictionary<string, string>(){
@@ -174,7 +174,7 @@ namespace AwInitilizer.Assist
             return CallBase(api, param, customContents: new List<HttpContent>() { dummyFileCotent });
         }
 
-        internal static Task<EvHttpClientResult> SetSystemAction(string key, string value)
+        public static Task<EvHttpClientResult> SetSystemAction(string key, string value)
         {
             string api = "set_system_action.php";
             Dictionary<string, string> param = new Dictionary<string, string>(){
@@ -184,6 +184,16 @@ namespace AwInitilizer.Assist
             return CallBase(api, param, customContents: new List<HttpContent>() { });
         }
 
+        internal static Task<EvHttpClientResult> SetNetworkAction(Dictionary<string, string> param)
+        {
+            string api = "set_network_action.php";
+            //Dictionary<string, string> param = new Dictionary<string, string>(){
+            //    {key,value},
+            //};
+
+            return CallBase(api, param, customContents: new List<HttpContent>() { });
+        }
+
         private static async Task<EvHttpClientResult> CallBase(
             string api,
             Dictionary<string, string> param,
@@ -198,8 +208,8 @@ namespace AwInitilizer.Assist
 
                 Dictionary<string, string> pams = new Dictionary<string, string>
                 {
-                    { "account", account },
-                    { "password", pass }
+                    { "account", Account },
+                    { "password", Pass }
                 };
                 foreach (var pam in param)
                 {

+ 2 - 2
ApiTest/EvHttpClientLogger.cs → CsuWebApiLib/EvHttpClientLogger.cs

@@ -6,7 +6,7 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
 
-namespace AwInitilizer.Assist
+namespace CsuWebApiLib
 {
     public class EvHttpClientLogger
     {
@@ -25,7 +25,7 @@ namespace AwInitilizer.Assist
         private const int MaxLogCnt = 10;
         private string LogFileName = null;
 
-        internal void StartNewLog(string name)
+        public void StartNewLog(string name)
         {
             TryRemoveOneLog();
             LogFileName = name + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".txt";

+ 1 - 1
ApiTest/ButtonStatus.cs → CsuWebApiLib/Model/ButtonStatus.cs

@@ -4,7 +4,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace AwInitilizer.Model
+namespace CsuWebApiLib.Model
 {
     public class ButtonStatus
     {

+ 1 - 1
ApiTest/SimStatusString.cs → CsuWebApiLib/Model/SimStatusString.cs

@@ -4,7 +4,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace AwInitilizer.Model
+namespace CsuWebApiLib.Model
 {
     public class SimStatusString
     {

+ 15 - 0
CsuWebApiLib/Model/WifiConfig.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsuWebApiLib.Model
+{
+    public enum WifiMode
+    {
+        Disable = 0,
+        Station = 1,
+        AccessPoint = 2,
+    }
+}

+ 37 - 0
CsuWebApiLib/Properties/AssemblyInfo.cs

@@ -0,0 +1,37 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 組件的一般資訊是由下列的屬性集控制。
+// 變更這些屬性的值即可修改組件的相關
+// 資訊。
+[assembly: AssemblyTitle("CsuWebApiLib")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("CsuWebApiLib")]
+[assembly: AssemblyCopyright("Copyright ©  2024")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 將 ComVisible 設為 false 可對 COM 元件隱藏
+// 組件中的類型。若必須從 COM 存取此組件中的類型,
+// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
+[assembly: ComVisible(false)]
+
+// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
+[assembly: Guid("b8c304d4-8ee8-435b-bef8-606993c158a0")]
+
+// 組件的版本資訊由下列四個值所組成: 
+//
+//      主要版本
+//      次要版本
+//      組建編號
+//      修訂編號
+//
+// 您可以指定所有的值,也可以使用 '*' 將組建和修訂編號
+// 設為預設,如下所示:
+// [assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyVersion("1.13.2.0")]
+[assembly: AssemblyFileVersion("1.13.2.0")]
+[assembly: AssemblyInformationalVersion("2a6cbf5")]

+ 1 - 1
ApiTest/WebClientTimeout.cs → CsuWebApiLib/WebClientTimeout.cs

@@ -5,7 +5,7 @@ using System.Net;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace AwInitilizer.Assist
+namespace CsuWebApiLib
 {
     public class WebClientTimeout : WebClient
     {

+ 4 - 0
CsuWebApiLib/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
+</packages>

+ 1 - 1
Editor/Properties/AssemblyInfo.cs

@@ -53,4 +53,4 @@ using System.Windows;
 // [assembly: AssemblyVersion("1.13.2.0")]
 [assembly: AssemblyVersion("1.13.2.0")]
 [assembly: AssemblyFileVersion("1.13.2.0")]
-[assembly: AssemblyInformationalVersion("e8c61f8")]
+[assembly: AssemblyInformationalVersion("2a6cbf5")]

+ 2 - 0
InitializerModel/AppSettingConfigModel.cs

@@ -20,5 +20,7 @@ namespace InitializerModel
         public string MechineCode { get; set; }
         //public bool IsDisableAuthRequired { get; set; }
         public string JohnSenLedComPort { get; set; }
+        public string WifiApSSID { get; set; }
+        public string WifiApPassword { get; set; }
     }
 }

+ 1 - 1
InitializerModel/EvseSettingConfig.cs

@@ -140,7 +140,7 @@ namespace InitializerModel
                 return toReturn;
             }
 
-            if (!ModelName.TryLooseParse(setting.ModelName, out _))
+            if (!SystemID.TryLooseParse(setting.ModelName, out _))
             {
                 toReturn.Error = EvseSettingConfigLoadError.InitModelNameError;
                 return toReturn;

+ 3 - 1
InitializerModel/EvseSettingConfigModel.cs

@@ -6,9 +6,10 @@ using System.Threading.Tasks;
 
 namespace InitializerModel
 {
-    public class EvseSettingConfigModel
+    public class EvseSettingConfigModel : ObservableObject
     {
         public string ModelName { get; set; }
+        public bool IsModelNameLength15 => string.IsNullOrEmpty(ModelName) ? false : ModelName.Length == 15;
         public string FourGenModuleVersion { get; set; }
         public string SubFourGenModuleVersion { get; set; }
         public bool IsSimInsert { get; set; }
@@ -28,6 +29,7 @@ namespace InitializerModel
         public bool SkipButtonTest { get; set; }
         public string IpAddress { get; set; }
         public bool IsDisableAuthRequired { get; set; }
+        public bool IsIdleCheckPass { get; set; }
         public List<FirmwareUpdateModel> FirmwareUpdateList { get; set; }
     }
 

+ 1 - 0
InitializerModel/InitializerModel.csproj

@@ -51,6 +51,7 @@
     <Compile Include="AppSettingConfigModel.cs" />
     <Compile Include="EvseSettingConfig.cs" />
     <Compile Include="FirmwareUpdateModel.cs" />
+    <Compile Include="ObservableObject.cs" />
     <Compile Include="PredefinedVersionPair.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="EvseSettingConfigModel.cs" />

+ 31 - 0
InitializerModel/ObservableObject.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InitializerModel
+{
+    public class ObservableObject : INotifyPropertyChanged
+    {
+        public event PropertyChangedEventHandler PropertyChanged;
+        protected void RaisePropertyChanged(string name)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+        }
+
+        protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
+        {
+            if (EqualityComparer<T>.Default.Equals(storage, value))
+            {
+                return false;
+            }
+
+            storage = value;
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+            return true;
+        }
+    }
+}

+ 1 - 1
InitializerModel/Properties/AssemblyInfo.cs

@@ -34,4 +34,4 @@ using System.Runtime.InteropServices;
 // [assembly: AssemblyVersion("1.13.2.0")]
 [assembly: AssemblyVersion("1.13.2.0")]
 [assembly: AssemblyFileVersion("1.13.2.0")]
-[assembly: AssemblyInformationalVersion("e8c61f8")]
+[assembly: AssemblyInformationalVersion("2a6cbf5")]

+ 1 - 1
Initilizer/AssemblyInfo.cs

@@ -11,5 +11,5 @@
 
 [assembly: AssemblyVersion("1.13.2.0")]
 [assembly: AssemblyFileVersion("1.13.2.0")]
-[assembly: AssemblyInformationalVersion("e8c61f8")]
+[assembly: AssemblyInformationalVersion("2a6cbf5")]
 

+ 1 - 1
MesAdaptor/Properties/AssemblyInfo.cs

@@ -34,4 +34,4 @@ using System.Runtime.InteropServices;
 // [assembly: AssemblyVersion("1.13.2.0")]
 [assembly: AssemblyVersion("1.13.2.0")]
 [assembly: AssemblyFileVersion("1.13.2.0")]
-[assembly: AssemblyInformationalVersion("e8c61f8")]
+[assembly: AssemblyInformationalVersion("2a6cbf5")]