Procházet zdrojové kódy

1. change firmware upload to api
2. add support of sub telcom test

Robert před 9 měsíci
rodič
revize
3be3a19e1e
39 změnil soubory, kde provedl 3422 přidání a 1057 odebrání
  1. 117 0
      ApiTest/ApiTest.csproj
  2. 6 0
      ApiTest/App.config
  3. 9 0
      ApiTest/App.xaml
  4. 17 0
      ApiTest/App.xaml.cs
  5. 15 0
      ApiTest/ButtonStatus.cs
  6. 606 0
      ApiTest/EvApi.cs
  7. 352 0
      ApiTest/EvHttpClient.cs
  8. 60 0
      ApiTest/EvHttpClientLogger.cs
  9. 80 0
      ApiTest/MainWindow.xaml
  10. 142 0
      ApiTest/MainWindow.xaml.cs
  11. 56 0
      ApiTest/Properties/AssemblyInfo.cs
  12. 71 0
      ApiTest/Properties/Resources.Designer.cs
  13. 117 0
      ApiTest/Properties/Resources.resx
  14. 30 0
      ApiTest/Properties/Settings.Designer.cs
  15. 7 0
      ApiTest/Properties/Settings.settings
  16. 54 0
      ApiTest/SetConfigDlg.xaml
  17. 40 0
      ApiTest/SetConfigDlg.xaml.cs
  18. 15 0
      ApiTest/SimStatusString.cs
  19. 19 0
      ApiTest/WebClientTimeout.cs
  20. 4 0
      ApiTest/packages.config
  21. 49 43
      AwInitilizer.sln
  22. 152 2
      AwInitilizer/Assist/EvApi.cs
  23. 62 16
      AwInitilizer/Assist/EvHttpClient.cs
  24. 226 224
      AwInitilizer/Initializer.csproj
  25. 336 329
      AwInitilizer/MainWindow.xaml
  26. 24 15
      AwInitilizer/MainWindow.xaml.cs
  27. 17 16
      AwInitilizer/Model/AppSettingConfig.cs
  28. 29 23
      AwInitilizer/Model/SettingConfig.cs
  29. 15 0
      AwInitilizer/Model/SimStatusString.cs
  30. 247 184
      AwInitilizer/Model/UpdateData.cs
  31. 51 0
      AwInitilizer/Procedure/DsiableChargeAuthProcedure.cs
  32. 12 1
      AwInitilizer/Procedure/FirmwareBundleUploadProcedure.cs
  33. 248 81
      AwInitilizer/Procedure/FourGenModuleCheckProcedure.cs
  34. 4 4
      AwInitilizer/Properties/AssemblyInfo.cs
  35. 119 105
      AwInitilizer/SettingConfig.cs
  36. 6 6
      AwInitilizer/packages.config
  37. 1 1
      GitVersion.yml
  38. 3 3
      Initilizer/AssemblyInfo.cs
  39. 4 4
      MesAdaptor/Properties/AssemblyInfo.cs

+ 117 - 0
ApiTest/ApiTest.csproj

@@ -0,0 +1,117 @@
+<?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>{C52DE85F-C266-4DE4-A6F3-1E9C8DD43318}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <RootNamespace>ApiTest</RootNamespace>
+    <AssemblyName>ApiTest</AssemblyName>
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <WarningLevel>4</WarningLevel>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <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' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <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.Data" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xaml">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="WindowsBase" />
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml">
+      <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>
+    </Page>
+    <Compile Include="App.xaml.cs">
+      <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>
+    </Compile>
+    <Page Include="SetConfigDlg.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+    <None Include="packages.config" />
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 6 - 0
ApiTest/App.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
+    </startup>
+</configuration>

+ 9 - 0
ApiTest/App.xaml

@@ -0,0 +1,9 @@
+<Application x:Class="ApiTest.App"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:local="clr-namespace:ApiTest"
+             StartupUri="MainWindow.xaml">
+    <Application.Resources>
+         
+    </Application.Resources>
+</Application>

+ 17 - 0
ApiTest/App.xaml.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace ApiTest
+{
+    /// <summary>
+    /// App.xaml 的互動邏輯
+    /// </summary>
+    public partial class App : Application
+    {
+    }
+}

+ 15 - 0
ApiTest/ButtonStatus.cs

@@ -0,0 +1,15 @@
+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; }
+    }
+}

+ 606 - 0
ApiTest/EvApi.cs

@@ -0,0 +1,606 @@
+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;
+        }
+    }
+}

+ 352 - 0
ApiTest/EvHttpClient.cs

@@ -0,0 +1,352 @@
+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 }; ;
+            }
+        }
+    }
+}

+ 60 - 0
ApiTest/EvHttpClientLogger.cs

@@ -0,0 +1,60 @@
+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();
+        }
+    }
+}

+ 80 - 0
ApiTest/MainWindow.xaml

@@ -0,0 +1,80 @@
+<Window
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:local="clr-namespace:ApiTest"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    Title="MainWindow"
+    Width="800"
+    Height="450"
+    mc:Ignorable="d"
+    x:Class="ApiTest.MainWindow">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="50" />
+            <RowDefinition Height="*" />
+        </Grid.RowDefinitions>
+        <StackPanel Orientation="Horizontal">
+            <TextBlock VerticalAlignment="Center" Text="IP" />
+            <TextBox
+                x:Name="uxIp"
+                Width="120"
+                VerticalAlignment="Center"
+                Text="192.168.1.10" />
+            <TextBlock VerticalAlignment="Center" Text="account" />
+            <TextBox
+                x:Name="uxAccount"
+                Width="120"
+                VerticalAlignment="Center"
+                Text="" />
+            <TextBlock VerticalAlignment="Center" Text="pass" />
+            <TextBox
+                x:Name="uxPass"
+                Width="120"
+                VerticalAlignment="Center"
+                Text="" />
+        </StackPanel>
+        <Grid Grid.Row="1">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="150" />
+                <ColumnDefinition Width="*" />
+            </Grid.ColumnDefinitions>
+            <StackPanel Grid.Column="0">
+                <Button Margin="5" Click="GetVersion_Click">
+                    <TextBlock Text="GetVersion" />
+                </Button>
+                <Button Margin="5" Click="GetSystem_Click">
+                    <TextBlock Text="GetSystem" />
+                </Button>
+                <Button Margin="5" Click="GetCharging_Click">
+                    <TextBlock Text="GetCharging" />
+                </Button>
+                <Button Margin="5" Click="GetNetwrok_Click">
+                    <TextBlock Text="GetNetwrok" />
+                </Button>
+                <Button Margin="5" Click="GetBackend_Click">
+                    <TextBlock Text="GetBackend" />
+                </Button>
+                <Button Margin="5" Click="EnableAuth_Click">
+                    <TextBlock Text="Enable Auth" />
+                </Button>
+                <Button Margin="5" Click="DisableAuth_Click">
+                    <TextBlock Text="Disable Auth" />
+                </Button>
+                <Button Margin="5" Click="SetSystem_Click">
+                    <TextBlock Text="SetSystem" />
+                </Button>
+                <Button Margin="5" Click="GetTelcom_Click">
+                    <TextBlock Text="GetTelcom" />
+                </Button>
+                <Button Margin="5" Click="UploadFirmware_Click">
+                    <TextBlock Text="UploadFirmware" />
+                </Button>
+            </StackPanel>
+            <TextBox
+                x:Name="uxResult"
+                Grid.Column="1"
+                TextWrapping="Wrap" />
+        </Grid>
+    </Grid>
+</Window>

+ 142 - 0
ApiTest/MainWindow.xaml.cs

@@ -0,0 +1,142 @@
+using AwInitilizer.Assist;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace ApiTest
+{
+    /// <summary>
+    /// MainWindow.xaml 的互動邏輯
+    /// </summary>
+    public partial class MainWindow : Window
+    {
+        public MainWindow()
+        {
+            InitializeComponent();
+
+            uxIp.Text = "192.168.80.129";
+            uxAccount.Text = "zerova";
+            uxPass.Text = "t6sji4j83";
+        }
+
+        private async void GetVersion_Click(object sender, RoutedEventArgs e)
+        {
+            TryUpdateConfig();
+
+            var result = await EvApi.GetVersion();
+            //var result = await EvApi.GetTelcomModemFwRev();
+            uxResult.Text = result.Response;
+        }
+
+        private async void GetSystem_Click(object sender, RoutedEventArgs e)
+        {
+            TryUpdateConfig();
+
+            var result = await EvHttpClient.GetQueryActionOpt1String();
+            uxResult.Text = result.Msg;
+        }
+
+        private async void GetCharging_Click(object sender, RoutedEventArgs e)
+        {
+            TryUpdateConfig();
+
+            var result = await EvHttpClient.GetQueryActionOpt2String();
+            uxResult.Text = result.Msg;
+        }
+
+        private async void GetNetwrok_Click(object sender, RoutedEventArgs e)
+        {
+            TryUpdateConfig();
+
+            var result = await EvHttpClient.GetQueryActionOpt3String();
+            uxResult.Text = result.Msg;
+        }
+
+        private async void GetBackend_Click(object sender, RoutedEventArgs e)
+        {
+            TryUpdateConfig();
+
+            var result = await EvHttpClient.GetQueryActionOpt4String();
+            uxResult.Text = result.Msg;
+        }
+
+        private async void EnableAuth_Click(object sender, RoutedEventArgs e)
+        {
+            TryUpdateConfig();
+
+            var result = await EvApi.SetAuthorisationMode(isAuthRequired: true);
+            uxResult.Text = result.Response;
+        }
+
+        private async void DisableAuth_Click(object sender, RoutedEventArgs e)
+        {
+            TryUpdateConfig();
+
+            var result = await EvApi.SetAuthorisationMode(isAuthRequired: false);
+            uxResult.Text = result.Response;
+        }
+
+        private async void SetSystem_Click(object sender, RoutedEventArgs e)
+        {
+            TryUpdateConfig();
+
+            var dlg = new SetConfigDlg() { Owner = this };
+            dlg.ShowDialog();
+
+            if (dlg.DialogResult != true)
+                return;
+
+            var result = await EvHttpClient.SetSystemAction(dlg.Key, dlg.Val);
+            uxResult.Text = result.Msg;
+        }
+
+        private async void GetTelcom_Click(object sender, RoutedEventArgs e)
+        {
+            TryUpdateConfig();
+
+            var result = await EvApi.GetTelcomSubSimStatus();
+            uxResult.Text = JsonConvert.SerializeObject(result.Result);
+        }
+
+        private async void UploadFirmware_Click(object sender, RoutedEventArgs e)
+        {
+
+            TryUpdateConfig();
+
+            var result = await EvHttpClient.GetUploadfirmwareResultString(new List<string>() {
+                //System.IO.Path.GetFullPath("fake.txt"),
+                //System.IO.Path.GetFullPath("fake.txt")
+                System.IO.Path.GetFullPath("CCS_V0.32.S0_CRC=485E654C.gz"),
+                System.IO.Path.GetFullPath("CSU_V3.06_CRC=54D4A562.gz")
+            });
+            //var result = await EvApi.SignalUpdateFirmware(); ;
+            uxResult.Text = JsonConvert.SerializeObject(result);
+        }
+
+        private void TryUpdateConfig()
+        {
+            if (!string.IsNullOrEmpty(uxAccount.Text))
+            {
+                EvHttpClient.account = uxAccount.Text;
+            }
+            if (!string.IsNullOrEmpty(uxPass.Text))
+            {
+                EvHttpClient.pass = uxPass.Text;
+            }
+
+            EvHttpClient.ResetServerIpAddress(uxIp.Text);
+        }
+    }
+}

+ 56 - 0
ApiTest/Properties/AssemblyInfo.cs

@@ -0,0 +1,56 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// 組件的一般資訊是由下列的屬性集控制。
+// 變更這些屬性的值即可修改組件的相關
+// 資訊。
+[assembly: AssemblyTitle("ApiTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ApiTest")]
+[assembly: AssemblyCopyright("Copyright ©  2024")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 將 ComVisible 設為 false 可對 COM 元件隱藏
+// 組件中的類型。若必須從 COM 存取此組件中的類型,
+// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
+[assembly: ComVisible(false)]
+
+//若要開始建置可當地語系化的應用程式,請在
+//.csproj 檔案中的 <UICulture>CultureYouAreCodingWith</UICulture>
+//在 <PropertyGroup> 中。例如,如果原始程式檔使用美式英文, 
+//請將 <UICulture> 設為 en-US。然後取消註解下列
+//NeutralResourceLanguage 屬性。在下一行中更新 "en-US",
+//以符合專案檔中的 UICulture 設定。
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+    ResourceDictionaryLocation.None, //主題特定資源字典的位置
+                                     //(在頁面中找不到時使用,
+                                     // 或應用程式資源字典中找不到資源時)
+    ResourceDictionaryLocation.SourceAssembly //泛型資源字典的位置
+                                              //(在頁面中找不到時使用,
+                                              // 或是應用程式或任何主題特定資源字典中找不到資源時)
+)]
+
+
+// 組件的版本資訊由下列四個值所組成:
+//
+//      主要版本
+//      次要版本
+//      組建編號
+//      修訂
+//
+// 您可以指定所有的值,也可以使用 '*' 將組建和修訂編號
+// 設為預設,如下所示:
+// [assembly: AssemblyVersion("1.11.5.0")]
+[assembly: AssemblyVersion("1.11.5.0")]
+[assembly: AssemblyFileVersion("1.11.5.0")]
+[assembly: AssemblyInformationalVersion("266a5e2")]

+ 71 - 0
ApiTest/Properties/Resources.Designer.cs

@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     這段程式碼是由工具產生的。
+//     執行階段版本:4.0.30319.42000
+//
+//     變更這個檔案可能會導致不正確的行為,而且如果已重新產生
+//     程式碼,則會遺失變更。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ApiTest.Properties
+{
+
+
+    /// <summary>
+    ///   用於查詢當地語系化字串等的強類型資源類別
+    /// </summary>
+    // 這個類別是自動產生的,是利用 StronglyTypedResourceBuilder
+    // 類別透過 ResGen 或 Visual Studio 這類工具產生。
+    // 若要加入或移除成員,請編輯您的 .ResX 檔,然後重新執行 ResGen
+    // (利用 /str 選項),或重建您的 VS 專案。
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources
+    {
+
+        private static global::System.Resources.ResourceManager resourceMan;
+
+        private static global::System.Globalization.CultureInfo resourceCulture;
+
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources()
+        {
+        }
+
+        /// <summary>
+        ///   傳回這個類別使用的快取的 ResourceManager 執行個體。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager
+        {
+            get
+            {
+                if ((resourceMan == null))
+                {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ApiTest.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+
+        /// <summary>
+        ///   覆寫目前執行緒的 CurrentUICulture 屬性,對象是所有
+        ///   使用這個強類型資源類別的資源查閱。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture
+        {
+            get
+            {
+                return resourceCulture;
+            }
+            set
+            {
+                resourceCulture = value;
+            }
+        }
+    }
+}

+ 117 - 0
ApiTest/Properties/Resources.resx

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 30 - 0
ApiTest/Properties/Settings.Designer.cs

@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ApiTest.Properties
+{
+
+
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+    {
+
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+        public static Settings Default
+        {
+            get
+            {
+                return defaultInstance;
+            }
+        }
+    }
+}

+ 7 - 0
ApiTest/Properties/Settings.settings

@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>

+ 54 - 0
ApiTest/SetConfigDlg.xaml

@@ -0,0 +1,54 @@
+<Window
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:local="clr-namespace:ApiTest"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    Title="SetConfigDlg"
+    Width="400"
+    Height="100"
+    WindowStartupLocation="CenterOwner"
+    WindowStyle="ToolWindow"
+    mc:Ignorable="d"
+    x:Class="ApiTest.SetConfigDlg">
+    <Grid Margin="5">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto" />
+            <RowDefinition Height="Auto" />
+        </Grid.RowDefinitions>
+        <Grid HorizontalAlignment="Center">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="70" />
+                <ColumnDefinition Width="100" />
+                <ColumnDefinition Width="70" />
+                <ColumnDefinition Width="100" />
+            </Grid.ColumnDefinitions>
+            <TextBlock HorizontalAlignment="Center" Text="key" />
+            <TextBlock
+                Grid.Column="2"
+                HorizontalAlignment="Center"
+                Text="val" />
+            <TextBox x:Name="uxKey" Grid.Column="1" />
+            <TextBox x:Name="uxVal" Grid.Column="3" />
+        </Grid>
+        <StackPanel
+            Grid.Row="1"
+            Margin="5"
+            HorizontalAlignment="Center"
+            Orientation="Horizontal">
+            <Button
+                HorizontalAlignment="Center"
+                VerticalAlignment="Center"
+                Click="OK_Click">
+                <TextBlock Text="OK" />
+            </Button>
+            <Border Width="5" />
+            <Button
+                HorizontalAlignment="Center"
+                VerticalAlignment="Center"
+                Click="Cancel_Click">
+                <TextBlock Text="Cancel" />
+            </Button>
+        </StackPanel>
+    </Grid>
+</Window>

+ 40 - 0
ApiTest/SetConfigDlg.xaml.cs

@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ApiTest
+{
+    /// <summary>
+    /// SetConfigDlg.xaml 的互動邏輯
+    /// </summary>
+    public partial class SetConfigDlg : Window
+    {
+        public string Key => uxKey.Text;
+        public string Val => uxVal.Text;
+
+        public SetConfigDlg()
+        {
+            InitializeComponent();
+        }
+
+        private void OK_Click(object sender, RoutedEventArgs e)
+        {
+            DialogResult = true;
+        }
+
+        private void Cancel_Click(object sender, RoutedEventArgs e)
+        {
+            DialogResult = false;
+        }
+    }
+}

+ 15 - 0
ApiTest/SimStatusString.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Model
+{
+    public class SimStatusString
+    {
+        public bool IsInstalled { get; set; }
+        public string ICCID { get; set; }
+        public string IMSI { get; set; }
+    }
+}

+ 19 - 0
ApiTest/WebClientTimeout.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Assist
+{
+    public class WebClientTimeout : WebClient
+    {
+        protected override WebRequest GetWebRequest(Uri uri)
+        {
+            WebRequest w = base.GetWebRequest(uri);
+            w.Timeout = 2 * 1000;
+            return w;
+        }
+    }
+}

+ 4 - 0
ApiTest/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>

+ 49 - 43
AwInitilizer.sln

@@ -1,43 +1,49 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30413.136
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Initializer", "AwInitilizer\Initializer.csproj", "{7A23D514-38E1-423E-9238-464B0E2AFCC0}"
-EndProject
-Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "InitlizerInstaller_Shinewave", "AwInitlizerInstaller__Shinewave\AwInitlizerInstaller.vdproj", "{9A5A71D0-545F-43BB-9411-467C30365306}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MesAdaptor", "MesAdaptor\MesAdaptor.csproj", "{6B69CF23-270B-429B-A21D-AD98C2DFF678}"
-EndProject
-Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "InitlizerInstaller_Sajet", "InitlizerInstaller_Sajet\InitlizerInstaller_Sajet.vdproj", "{B5C036AF-3A25-4892-A1EE-28DEF290A024}"
-EndProject
-Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "InitlizerInstaller_Sajet2", "InitlizerInstaller_Sajet2\InitlizerInstaller_Sajet2.vdproj", "{92DFE875-0D71-4B79-81FD-F7BA9A2303FD}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Release|Any CPU = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{7A23D514-38E1-423E-9238-464B0E2AFCC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{7A23D514-38E1-423E-9238-464B0E2AFCC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{7A23D514-38E1-423E-9238-464B0E2AFCC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{7A23D514-38E1-423E-9238-464B0E2AFCC0}.Release|Any CPU.Build.0 = Release|Any CPU
-		{9A5A71D0-545F-43BB-9411-467C30365306}.Debug|Any CPU.ActiveCfg = Debug
-		{9A5A71D0-545F-43BB-9411-467C30365306}.Release|Any CPU.ActiveCfg = Release
-		{6B69CF23-270B-429B-A21D-AD98C2DFF678}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{6B69CF23-270B-429B-A21D-AD98C2DFF678}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{6B69CF23-270B-429B-A21D-AD98C2DFF678}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{6B69CF23-270B-429B-A21D-AD98C2DFF678}.Release|Any CPU.Build.0 = Release|Any CPU
-		{B5C036AF-3A25-4892-A1EE-28DEF290A024}.Debug|Any CPU.ActiveCfg = Debug
-		{B5C036AF-3A25-4892-A1EE-28DEF290A024}.Release|Any CPU.ActiveCfg = Release
-		{92DFE875-0D71-4B79-81FD-F7BA9A2303FD}.Debug|Any CPU.ActiveCfg = Debug
-		{92DFE875-0D71-4B79-81FD-F7BA9A2303FD}.Release|Any CPU.ActiveCfg = Release
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-		SolutionGuid = {F83AB2ED-7223-44BF-A441-9175A5E1B45F}
-	EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.7.34031.279
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Initializer", "AwInitilizer\Initializer.csproj", "{7A23D514-38E1-423E-9238-464B0E2AFCC0}"
+EndProject
+Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "InitlizerInstaller_Shinewave", "AwInitlizerInstaller__Shinewave\AwInitlizerInstaller.vdproj", "{9A5A71D0-545F-43BB-9411-467C30365306}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MesAdaptor", "MesAdaptor\MesAdaptor.csproj", "{6B69CF23-270B-429B-A21D-AD98C2DFF678}"
+EndProject
+Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "InitlizerInstaller_Sajet", "InitlizerInstaller_Sajet\InitlizerInstaller_Sajet.vdproj", "{B5C036AF-3A25-4892-A1EE-28DEF290A024}"
+EndProject
+Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "InitlizerInstaller_Sajet2", "InitlizerInstaller_Sajet2\InitlizerInstaller_Sajet2.vdproj", "{92DFE875-0D71-4B79-81FD-F7BA9A2303FD}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApiTest", "ApiTest\ApiTest.csproj", "{C52DE85F-C266-4DE4-A6F3-1E9C8DD43318}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{7A23D514-38E1-423E-9238-464B0E2AFCC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{7A23D514-38E1-423E-9238-464B0E2AFCC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{7A23D514-38E1-423E-9238-464B0E2AFCC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{7A23D514-38E1-423E-9238-464B0E2AFCC0}.Release|Any CPU.Build.0 = Release|Any CPU
+		{9A5A71D0-545F-43BB-9411-467C30365306}.Debug|Any CPU.ActiveCfg = Debug
+		{9A5A71D0-545F-43BB-9411-467C30365306}.Release|Any CPU.ActiveCfg = Release
+		{6B69CF23-270B-429B-A21D-AD98C2DFF678}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6B69CF23-270B-429B-A21D-AD98C2DFF678}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6B69CF23-270B-429B-A21D-AD98C2DFF678}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6B69CF23-270B-429B-A21D-AD98C2DFF678}.Release|Any CPU.Build.0 = Release|Any CPU
+		{B5C036AF-3A25-4892-A1EE-28DEF290A024}.Debug|Any CPU.ActiveCfg = Debug
+		{B5C036AF-3A25-4892-A1EE-28DEF290A024}.Release|Any CPU.ActiveCfg = Release
+		{92DFE875-0D71-4B79-81FD-F7BA9A2303FD}.Debug|Any CPU.ActiveCfg = Debug
+		{92DFE875-0D71-4B79-81FD-F7BA9A2303FD}.Release|Any CPU.ActiveCfg = Release
+		{C52DE85F-C266-4DE4-A6F3-1E9C8DD43318}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C52DE85F-C266-4DE4-A6F3-1E9C8DD43318}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C52DE85F-C266-4DE4-A6F3-1E9C8DD43318}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C52DE85F-C266-4DE4-A6F3-1E9C8DD43318}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {F83AB2ED-7223-44BF-A441-9175A5E1B45F}
+	EndGlobalSection
+EndGlobal

+ 152 - 2
AwInitilizer/Assist/EvApi.cs

@@ -3,6 +3,7 @@ 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;
@@ -100,7 +101,7 @@ namespace AwInitilizer.Assist
             }
 
             if (!result.Contains("Button1") ||
-                !result.Contains("Button2") )
+                !result.Contains("Button2"))
             {
                 return new EvApiResult<ButtonStatus>()
                 {
@@ -403,6 +404,107 @@ namespace AwInitilizer.Assist
             };
         }
 
+        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>
@@ -433,7 +535,6 @@ namespace AwInitilizer.Assist
         /// </summary>
         /// <param name="fileNames"></param>
         /// <returns></returns>
-        [Obsolete]
         internal static async Task<EvApiResult<bool>> Uploadfirmware(List<string> fileNames)
         {
             var result = await EvHttpClient.GetUploadfirmwareResultString(fileNames);
@@ -452,5 +553,54 @@ namespace AwInitilizer.Assist
                 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;
+        }
     }
 }

+ 62 - 16
AwInitilizer/Assist/EvHttpClient.cs

@@ -28,8 +28,8 @@ namespace AwInitilizer.Assist
 
     public static class EvHttpClient
     {
-        private static string account = "admin";
-        private static string pass = "1231231238";
+        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";
@@ -84,6 +84,15 @@ namespace AwInitilizer.Assist
             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";
@@ -120,7 +129,28 @@ namespace AwInitilizer.Assist
             Dictionary<string, string> param = new Dictionary<string, string>(){
                 {"fw_tag","iso"}
             };
-            return CallBase(api, param, firmwareNames: fileNames);
+            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()
@@ -144,11 +174,22 @@ namespace AwInitilizer.Assist
             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)
+            List<HttpContent> customContents = null,
+            int timeOutSeconds = 5)
         {
             try
             {
@@ -174,18 +215,23 @@ namespace AwInitilizer.Assist
 
                 if (firmwareNames != null)
                 {
-                    if (firmwareNames.Count == 1)
+                    foreach (var fileName in firmwareNames)
                     {
-                        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[]");
-                        }
+                        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)
@@ -210,7 +256,7 @@ namespace AwInitilizer.Assist
 
                 using (HttpClient evClient = new HttpClient(handler))
                 {
-                    evClient.Timeout = TimeSpan.FromSeconds(5);
+                    evClient.Timeout = TimeSpan.FromSeconds(timeOutSeconds);
 
                     try
                     {
@@ -255,7 +301,7 @@ namespace AwInitilizer.Assist
                             Msg = result,
                         };
                     }
-                    catch(Exception e)
+                    catch (Exception e)
                     {
                         //post fail
                         EvHttpClientLogger.Instance.Log(e.Message);

+ 226 - 224
AwInitilizer/Initializer.csproj

@@ -1,225 +1,227 @@
-<?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>{7A23D514-38E1-423E-9238-464B0E2AFCC0}</ProjectGuid>
-    <OutputType>WinExe</OutputType>
-    <RootNamespace>AwInitilizer</RootNamespace>
-    <AssemblyName>AwInitilizer</AssemblyName>
-    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <WarningLevel>4</WarningLevel>
-    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
-    <Deterministic>true</Deterministic>
-    <TargetFrameworkProfile />
-    <IsWebBootstrapper>false</IsWebBootstrapper>
-    <PublishUrl>publish\</PublishUrl>
-    <Install>true</Install>
-    <InstallFrom>Disk</InstallFrom>
-    <UpdateEnabled>false</UpdateEnabled>
-    <UpdateMode>Foreground</UpdateMode>
-    <UpdateInterval>7</UpdateInterval>
-    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
-    <UpdatePeriodically>false</UpdatePeriodically>
-    <UpdateRequired>false</UpdateRequired>
-    <MapFileExtensions>true</MapFileExtensions>
-    <ApplicationRevision>0</ApplicationRevision>
-    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
-    <UseApplicationTrust>false</UseApplicationTrust>
-    <BootstrapperEnabled>true</BootstrapperEnabled>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <PlatformTarget>AnyCPU</PlatformTarget>
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <PlatformTarget>AnyCPU</PlatformTarget>
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <PropertyGroup>
-    <ApplicationManifest>app.manifest</ApplicationManifest>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="FluentFTP, Version=37.0.2.0, Culture=neutral, PublicKeyToken=f4af092b1d8df44f, processorArchitecture=MSIL">
-      <HintPath>..\packages\FluentFTP.37.0.2\lib\net45\FluentFTP.dll</HintPath>
-    </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
-    </Reference>
-    <Reference Include="PhihongEv.Lib, Version=1.0.14.0, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\PhihongEv.Lib.1.0.14\lib\net40\PhihongEv.Lib.dll</HintPath>
-    </Reference>
-    <Reference Include="RestSharp, Version=106.15.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
-      <HintPath>..\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll</HintPath>
-    </Reference>
-    <Reference Include="System" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Web" />
-    <Reference Include="System.Xml" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="System.Net.Http" />
-    <Reference Include="System.Xaml">
-      <RequiredTargetFramework>4.0</RequiredTargetFramework>
-    </Reference>
-    <Reference Include="WindowsBase" />
-    <Reference Include="PresentationCore" />
-    <Reference Include="PresentationFramework" />
-  </ItemGroup>
-  <ItemGroup>
-    <ApplicationDefinition Include="App.xaml">
-      <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" />
-    <Compile Include="ManualSn.xaml.cs">
-      <DependentUpon>ManualSn.xaml</DependentUpon>
-    </Compile>
-    <Compile Include="Model\AppSettingConfig.cs" />
-    <Compile Include="ProcedureLog\LogWriter.cs" />
-    <Compile Include="Procedure\FirmwareFtpUploadProcedure.cs" />
-    <Compile Include="Procedure\FirmwareBundleUploadProcedure.cs" />
-    <Compile Include="Procedure\FirmwareCheckVersionProcedure.cs" />
-    <Compile Include="Procedure\FirmwareUploadProcedure.cs" />
-    <Compile Include="Procedure\VersionLogProcedure.cs" />
-    <Compile Include="Procedure\TelcomModemImeiRecordProcedure.cs" />
-    <Compile Include="Procedure\WifRssiCheckProcedure.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Resx\AppResources.Designer.cs">
-      <AutoGen>True</AutoGen>
-      <DesignTime>True</DesignTime>
-      <DependentUpon>AppResources.resx</DependentUpon>
-    </Compile>
-    <Compile Include="SettingConfig.cs" />
-    <Compile Include="SigninDialog.xaml.cs">
-      <DependentUpon>SigninDialog.xaml</DependentUpon>
-    </Compile>
-    <Page Include="HintDialog.xaml">
-      <SubType>Designer</SubType>
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
-    <Page Include="MainWindow.xaml">
-      <Generator>MSBuild:Compile</Generator>
-      <SubType>Designer</SubType>
-    </Page>
-    <Compile Include="App.xaml.cs">
-      <DependentUpon>App.xaml</DependentUpon>
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="Assist\SemaphoreQueue.cs" />
-    <Compile Include="Assist\SerialPortocol.cs" />
-    <Compile Include="Assist\TcpSerializer.cs" />
-    <Compile Include="Assist\WebClientTimeout.cs">
-      <SubType>Component</SubType>
-    </Compile>
-    <Compile Include="Converter\BooleanAndConverter.cs" />
-    <Compile Include="HintDialog.xaml.cs">
-      <DependentUpon>HintDialog.xaml</DependentUpon>
-    </Compile>
-    <Compile Include="Interface\IIogger.cs" />
-    <Compile Include="Interface\ISerialPort.cs" />
-    <Compile Include="MainViewModel.cs" />
-    <Compile Include="MainWindow.xaml.cs">
-      <DependentUpon>MainWindow.xaml</DependentUpon>
-      <SubType>Code</SubType>
-    </Compile>
-    <Page Include="ManualSn.xaml">
-      <SubType>Designer</SubType>
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
-    <Page Include="SigninDialog.xaml">
-      <SubType>Designer</SubType>
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Model\ButtonStatus.cs" />
-    <Compile Include="Model\FirmwareUpdateModel.cs" />
-    <Compile Include="Model\SettingConfig.cs" />
-    <Compile Include="Model\UploadFile.cs" />
-    <Compile Include="Procedure\ButtonStatusCheckPorcedure.cs" />
-    <Compile Include="Model\EvseSerialResponseModel.cs" />
-    <Compile Include="Model\SimStatus.cs" />
-    <Compile Include="Procedure\BasicInfoUpdateProcedure.cs" />
-    <Compile Include="Procedure\FirmwareUpdateProcedure.cs" />
-    <Compile Include="Procedure\FourGenModuleCheckProcedure.cs" />
-    <Compile Include="Procedure\ProcedureBase.cs" />
-    <Compile Include="Model\UpdateData.cs" />
-    <Compile Include="Procedure\RestarttoIdelProcedure.cs" />
-    <Compile Include="Properties\Settings.Designer.cs">
-      <AutoGen>True</AutoGen>
-      <DependentUpon>Settings.settings</DependentUpon>
-      <DesignTimeSharedInput>True</DesignTimeSharedInput>
-    </Compile>
-    <EmbeddedResource Include="Resx\AppResources.resx">
-      <Generator>PublicResXFileCodeGenerator</Generator>
-      <LastGenOutput>AppResources.Designer.cs</LastGenOutput>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Resx\AppResources.zh-CHS.resx" />
-    <None Include="app.manifest" />
-    <None Include="packages.config" />
-    <None Include="Properties\Settings.settings">
-      <Generator>SettingsSingleFileGenerator</Generator>
-      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
-    </None>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="App.config" />
-  </ItemGroup>
-  <ItemGroup>
-    <Resource Include="Image\Blue.png" />
-    <Resource Include="Image\Emergency.png" />
-    <Resource Include="Image\Green.png" />
-  </ItemGroup>
-  <ItemGroup>
-    <BootstrapperPackage Include=".NETFramework,Version=v4.8">
-      <Visible>False</Visible>
-      <ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
-      <Install>true</Install>
-    </BootstrapperPackage>
-    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
-      <Visible>False</Visible>
-      <ProductName>.NET Framework 3.5 SP1</ProductName>
-      <Install>false</Install>
-    </BootstrapperPackage>
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\MesAdaptor\MesAdaptor.csproj">
-      <Project>{6b69cf23-270b-429b-a21d-ad98c2dff678}</Project>
-      <Name>MesAdaptor</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <PropertyGroup>
-    <PreBuildEvent>GitVersion.exe $(SolutionDir) /updateassemblyinfo</PreBuildEvent>
-  </PropertyGroup>
-  <PropertyGroup>
-    <ReactorLocation>"C:\Program Files (x86)\Eziriz\.NET Reactor\dotNET_Reactor.exe"</ReactorLocation>
-    <ReactorProject>"D:\RobertProject\.net Reactor\ap.nrproj"</ReactorProject>
-  </PropertyGroup>
-  <Target Name="AfterCompile">
-  </Target>
+<?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>{7A23D514-38E1-423E-9238-464B0E2AFCC0}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <RootNamespace>AwInitilizer</RootNamespace>
+    <AssemblyName>AwInitilizer</AssemblyName>
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <WarningLevel>4</WarningLevel>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+    <TargetFrameworkProfile />
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup>
+    <ApplicationManifest>app.manifest</ApplicationManifest>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="FluentFTP, Version=37.0.2.0, Culture=neutral, PublicKeyToken=f4af092b1d8df44f, processorArchitecture=MSIL">
+      <HintPath>..\packages\FluentFTP.37.0.2\lib\net45\FluentFTP.dll</HintPath>
+    </Reference>
+    <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="PhihongEv.Lib, Version=1.0.16.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\PhihongEv.Lib.1.0.16\lib\net40\PhihongEv.Lib.dll</HintPath>
+    </Reference>
+    <Reference Include="RestSharp, Version=106.15.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
+      <HintPath>..\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Web" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xaml">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="WindowsBase" />
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml">
+      <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" />
+    <Compile Include="ManualSn.xaml.cs">
+      <DependentUpon>ManualSn.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Model\AppSettingConfig.cs" />
+    <Compile Include="Model\SimStatusString.cs" />
+    <Compile Include="ProcedureLog\LogWriter.cs" />
+    <Compile Include="Procedure\FirmwareFtpUploadProcedure.cs" />
+    <Compile Include="Procedure\FirmwareBundleUploadProcedure.cs" />
+    <Compile Include="Procedure\FirmwareCheckVersionProcedure.cs" />
+    <Compile Include="Procedure\FirmwareUploadProcedure.cs" />
+    <Compile Include="Procedure\DsiableChargeAuthProcedure.cs" />
+    <Compile Include="Procedure\VersionLogProcedure.cs" />
+    <Compile Include="Procedure\TelcomModemImeiRecordProcedure.cs" />
+    <Compile Include="Procedure\WifRssiCheckProcedure.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Resx\AppResources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>AppResources.resx</DependentUpon>
+    </Compile>
+    <Compile Include="SettingConfig.cs" />
+    <Compile Include="SigninDialog.xaml.cs">
+      <DependentUpon>SigninDialog.xaml</DependentUpon>
+    </Compile>
+    <Page Include="HintDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="MainWindow.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Compile Include="App.xaml.cs">
+      <DependentUpon>App.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Assist\SemaphoreQueue.cs" />
+    <Compile Include="Assist\SerialPortocol.cs" />
+    <Compile Include="Assist\TcpSerializer.cs" />
+    <Compile Include="Assist\WebClientTimeout.cs">
+      <SubType>Component</SubType>
+    </Compile>
+    <Compile Include="Converter\BooleanAndConverter.cs" />
+    <Compile Include="HintDialog.xaml.cs">
+      <DependentUpon>HintDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Interface\IIogger.cs" />
+    <Compile Include="Interface\ISerialPort.cs" />
+    <Compile Include="MainViewModel.cs" />
+    <Compile Include="MainWindow.xaml.cs">
+      <DependentUpon>MainWindow.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Page Include="ManualSn.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="SigninDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Model\ButtonStatus.cs" />
+    <Compile Include="Model\FirmwareUpdateModel.cs" />
+    <Compile Include="Model\SettingConfig.cs" />
+    <Compile Include="Model\UploadFile.cs" />
+    <Compile Include="Procedure\ButtonStatusCheckPorcedure.cs" />
+    <Compile Include="Model\EvseSerialResponseModel.cs" />
+    <Compile Include="Model\SimStatus.cs" />
+    <Compile Include="Procedure\BasicInfoUpdateProcedure.cs" />
+    <Compile Include="Procedure\FirmwareUpdateProcedure.cs" />
+    <Compile Include="Procedure\FourGenModuleCheckProcedure.cs" />
+    <Compile Include="Procedure\ProcedureBase.cs" />
+    <Compile Include="Model\UpdateData.cs" />
+    <Compile Include="Procedure\RestarttoIdelProcedure.cs" />
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+    <EmbeddedResource Include="Resx\AppResources.resx">
+      <Generator>PublicResXFileCodeGenerator</Generator>
+      <LastGenOutput>AppResources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Resx\AppResources.zh-CHS.resx" />
+    <None Include="app.manifest" />
+    <None Include="packages.config" />
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Image\Blue.png" />
+    <Resource Include="Image\Emergency.png" />
+    <Resource Include="Image\Green.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.8">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\MesAdaptor\MesAdaptor.csproj">
+      <Project>{6b69cf23-270b-429b-a21d-ad98c2dff678}</Project>
+      <Name>MesAdaptor</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PreBuildEvent>GitVersion.exe $(SolutionDir) /updateassemblyinfo</PreBuildEvent>
+  </PropertyGroup>
+  <PropertyGroup>
+    <ReactorLocation>"C:\Program Files (x86)\Eziriz\.NET Reactor\dotNET_Reactor.exe"</ReactorLocation>
+    <ReactorProject>"D:\RobertProject\.net Reactor\ap.nrproj"</ReactorProject>
+  </PropertyGroup>
+  <Target Name="AfterCompile">
+  </Target>
 </Project>

+ 336 - 329
AwInitilizer/MainWindow.xaml

@@ -1,329 +1,336 @@
-<Window
-    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-    xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
-    xmlns:local="clr-namespace:AwInitilizer"
-    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    xmlns:resx="clr-namespace:AwInitilizer.Resx"
-    x:Name="uxManinWindow"
-    Title="Initializer"
-    Width="1920"
-    Height="1080"
-    input:InputMethod.IsInputMethodEnabled="False"
-    Background="#FF363535"
-    PreviewKeyDown="MainWindow_PreviewKeyDown"
-    WindowStartupLocation="CenterScreen"
-    WindowState="Maximized"
-    mc:Ignorable="d"
-    x:Class="AwInitilizer.MainWindow">
-    <Window.Resources />
-    <Viewbox>
-        <StackPanel Orientation="Vertical">
-            <StackPanel Orientation="Horizontal">
-                <StackPanel
-                    Width="400"
-                    Margin="10,0,0,0"
-                    Orientation="Vertical">
-                    <GroupBox>
-                        <GroupBox.Header>
-                            <Label
-                                FontSize="16"
-                                Content="{x:Static resx:AppResources.Account}"
-                                Foreground="White" />
-                        </GroupBox.Header>
-                        <StackPanel Orientation="Vertical">
-                            <Button
-                                Width="100"
-                                Click="Logout_Click"
-                                IsEnabled="{Binding IsInputLock}">
-                                <Label Content="{x:Static resx:AppResources.Logout}" />
-                            </Button>
-                            <StackPanel
-                                Height="30"
-                                Margin="0,10,0,10"
-                                Orientation="Horizontal">
-                                <Grid Width="178">
-                                    <Label
-                                        HorizontalAlignment="Center"
-                                        FontSize="16"
-                                        Content="{x:Static resx:AppResources.UserID}"
-                                        Foreground="White" />
-                                </Grid>
-                                <TextBox
-                                    Width="200"
-                                    VerticalContentAlignment="Center"
-                                    Text="{Binding UserID}"
-                                    FontSize="16"
-                                    IsEnabled="{Binding IsInputLock}"
-                                    IsReadOnly="True"
-                                    TextAlignment="Center" />
-                            </StackPanel>
-                            <StackPanel
-                                Height="30"
-                                Margin="0,0,0,10"
-                                Orientation="Horizontal">
-                                <Grid Width="178">
-                                    <Label
-                                        HorizontalAlignment="Center"
-                                        FontSize="16"
-                                        Content="{x:Static resx:AppResources.WorkOrder}"
-                                        Foreground="White" />
-                                </Grid>
-                                <TextBox
-                                    Width="200"
-                                    VerticalContentAlignment="Center"
-                                    Text="{Binding WorkOrder}"
-                                    FontSize="16"
-                                    IsEnabled="{Binding IsInputLock}"
-                                    IsReadOnly="True"
-                                    KeyDown="WorkOrder_KeyDown"
-                                    TextAlignment="Center"
-                                    TextChanged="WorkOrder_TextChanged" />
-                            </StackPanel>
-
-                        </StackPanel>
-                    </GroupBox>
-                    <GroupBox>
-                        <GroupBox.Header>
-                            <Label
-                                FontSize="16"
-                                Content="{x:Static resx:AppResources.BarcodeSetting}"
-                                Foreground="White" />
-                        </GroupBox.Header>
-                        <StackPanel Orientation="Vertical">
-                            <StackPanel Height="30" Orientation="Horizontal">
-                                <Grid Width="178">
-                                    <Label
-                                        HorizontalAlignment="Center"
-                                        FontSize="16"
-                                        Content="{x:Static resx:AppResources.ModelName}"
-                                        Foreground="White" />
-                                </Grid>
-                                <TextBox
-                                    x:Name="uxModelName"
-                                    Width="200"
-                                    VerticalContentAlignment="Center"
-                                    Text="{Binding ModelName}"
-                                    FontSize="16"
-                                    IsEnabled="{Binding IsInputLock}"
-                                    IsReadOnly="True"
-                                    TextAlignment="Center" />
-                            </StackPanel>
-                            <StackPanel
-                                Height="30"
-                                Margin="0,10,0,10"
-                                Orientation="Horizontal">
-                                <Grid Width="178">
-                                    <Label
-                                        HorizontalAlignment="Center"
-                                        FontSize="16"
-                                        Content="{x:Static resx:AppResources.SerialNumber}"
-                                        Foreground="White" />
-                                </Grid>
-                                <TextBox
-                                    x:Name="uxSerialNumber"
-                                    Width="200"
-                                    VerticalContentAlignment="Center"
-                                    Text="{Binding SerialNumber}"
-                                    FontSize="16"
-                                    IsEnabled="{Binding IsInputLock}"
-                                    IsReadOnly="True"
-                                    TextAlignment="Center" />
-                            </StackPanel>
-                            <StackPanel
-                                Height="30"
-                                Margin="0,0,0,10"
-                                Orientation="Horizontal">
-                                <Grid Width="178">
-                                    <Label
-                                        HorizontalAlignment="Center"
-                                        FontSize="16"
-                                        Content="{x:Static resx:AppResources.SimStatus}"
-                                        Foreground="White" />
-                                </Grid>
-                                <CheckBox
-                                    x:Name="uxIsSimCheckEnabled"
-                                    VerticalAlignment="Center"
-                                    IsChecked="{Binding IsSimInsert}"
-                                    IsEnabled="{Binding IsInputLock}"
-                                    IsHitTestVisible="False" />
-                            </StackPanel>
-                            <StackPanel
-                                Height="30"
-                                Margin="0,0,0,10"
-                                Orientation="Horizontal">
-                                <Grid Width="178">
-                                    <Label
-                                        HorizontalAlignment="Center"
-                                        FontSize="16"
-                                        Content="{x:Static resx:AppResources.ICCID}"
-                                        Foreground="White" />
-                                </Grid>
-                                <TextBox
-                                    x:Name="uxICCID"
-                                    Width="200"
-                                    VerticalContentAlignment="Center"
-                                    Text="{Binding ICCID}"
-                                    FontSize="16"
-                                    IsReadOnly="True"
-                                    TextAlignment="Center">
-                                    <TextBox.IsEnabled>
-                                        <MultiBinding Converter="{StaticResource booleanAndConverter}">
-                                            <Binding Path="IsSimInsert" />
-                                            <Binding Path="IsInputLock" />
-                                        </MultiBinding>
-                                    </TextBox.IsEnabled>
-                                </TextBox>
-                            </StackPanel>
-                            <StackPanel
-                                Height="30"
-                                Margin="0,0,0,10"
-                                Orientation="Horizontal">
-                                <Grid Width="178">
-                                    <Label
-                                        HorizontalAlignment="Center"
-                                        FontSize="16"
-                                        Content="{x:Static resx:AppResources.IMSI}"
-                                        Foreground="White" />
-                                </Grid>
-                                <TextBox
-                                    x:Name="uxIMSI"
-                                    Width="200"
-                                    VerticalContentAlignment="Center"
-                                    Text="{Binding IMSI}"
-                                    FontSize="16"
-                                    IsReadOnly="True"
-                                    TextAlignment="Center">
-                                    <TextBox.IsEnabled>
-                                        <MultiBinding Converter="{StaticResource booleanAndConverter}">
-                                            <Binding Path="IsSimInsert" />
-                                            <Binding Path="IsInputLock" />
-                                        </MultiBinding>
-                                    </TextBox.IsEnabled>
-                                </TextBox>
-                            </StackPanel>
-                        </StackPanel>
-                    </GroupBox>
-                </StackPanel>
-
-                <StackPanel
-                    Width="400"
-                    Margin="10,0,0,0"
-                    Orientation="Vertical">
-                    <GroupBox>
-                        <GroupBox.Header>
-                            <Label
-                                FontSize="16"
-                                Content="{x:Static resx:AppResources.FirmwareVersion}"
-                                Foreground="White" />
-                        </GroupBox.Header>
-
-                        <DataGrid
-                            Height="335"
-                            Margin="10"
-                            AutoGenerateColumns="False"
-                            CanUserSortColumns="False"
-                            IsEnabled="{Binding IsInputLock}"
-                            ItemsSource="{Binding FirmwareUpdateModels}">
-                            <DataGrid.Columns>
-                                <DataGridTextColumn
-                                    Width="150"
-                                    MinWidth="50"
-                                    Binding="{Binding Path=Module}"
-                                    Header="{x:Static resx:AppResources.FirmwareVersionHeaderName}"
-                                    IsReadOnly="True" />
-                                <DataGridTextColumn
-                                    Width="150"
-                                    MinWidth="70"
-                                    Binding="{Binding Path=Version}"
-                                    Header="{x:Static resx:AppResources.FirmwareVersionHeaderVersion}"
-                                    IsReadOnly="True" />
-                                <!--  " DataGridTextColumn Header="File name" Binding="{Binding Path=FirmwareFileName}" IsReadOnly="False"/  -->
-                            </DataGrid.Columns>
-                        </DataGrid>
-                    </GroupBox>
-                </StackPanel>
-
-                <Grid Margin="10,0,0,0">
-                    <Grid.RowDefinitions>
-                        <RowDefinition Height="*" />
-                        <RowDefinition Height="30" />
-                        <RowDefinition Height="*" />
-                    </Grid.RowDefinitions>
-
-                    <Button
-                        x:Name="uxStartBtn"
-                        Grid.Row="0"
-                        Margin="30"
-                        Click="StartInit_Click">
-                        <Button.Template>
-                            <ControlTemplate TargetType="Button">
-                                <Border
-                                    Background="White"
-                                    BorderBrush="Gray"
-                                    BorderThickness="2"
-                                    CornerRadius="10">
-                                    <Border.Effect>
-                                        <DropShadowEffect ShadowDepth="10" />
-                                    </Border.Effect>
-                                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
-                                </Border>
-                            </ControlTemplate>
-                        </Button.Template>
-                        <Button.IsEnabled>
-                            <MultiBinding Converter="{StaticResource booleanAndConverter}">
-                                <Binding Path="IsInputLock" />
-                                <Binding Path="IsInputCheckpassed" />
-                            </MultiBinding>
-                        </Button.IsEnabled>
-
-                        <Label FontSize="36" Content="{x:Static resx:AppResources.StartProcedure}" />
-                    </Button>
-
-                    <StackPanel Grid.Row="1" Orientation="Vertical">
-                        <StackPanel
-                            HorizontalAlignment="Center"
-                            VerticalAlignment="Center"
-                            Orientation="Horizontal">
-                            <ProgressBar
-                                x:Name="uxProgress"
-                                Width="250"
-                                Height="20"
-                                VerticalAlignment="Center"
-                                Maximum="100"
-                                Minimum="0" />
-                            <Label
-                                x:Name="uxProgressRate"
-                                FontSize="16"
-                                Content="0%"
-                                Foreground="White" />
-                        </StackPanel>
-                    </StackPanel>
-
-
-                    <Grid
-                        x:Name="uxStatusContainer"
-                        Grid.Row="2"
-                        Margin="30"
-                        Background="White">
-                        <Label
-                            x:Name="uxStatus"
-                            HorizontalAlignment="Center"
-                            VerticalAlignment="Center"
-                            FontSize="36"
-                            Content="Idle"
-                            Foreground="Black" />
-                    </Grid>
-                </Grid>
-            </StackPanel>
-            <Label
-                x:Name="uxStatusBar"
-                Margin="0,10,0,0"
-                HorizontalAlignment="Center"
-                FontSize="36"
-                Content=""
-                Foreground="White" />
-        </StackPanel>
-    </Viewbox>
-</Window>
+<Window
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
+    xmlns:local="clr-namespace:AwInitilizer"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:resx="clr-namespace:AwInitilizer.Resx"
+    x:Name="uxManinWindow"
+    Title="Initializer"
+    Width="1920"
+    Height="1080"
+    d:DataContext="{d:DesignInstance Type=local:MainViewModel}"
+    input:InputMethod.IsInputMethodEnabled="False"
+    Background="#FF363535"
+    PreviewKeyDown="MainWindow_PreviewKeyDown"
+    WindowStartupLocation="CenterScreen"
+    WindowState="Maximized"
+    mc:Ignorable="d"
+    x:Class="AwInitilizer.MainWindow">
+    <Window.Resources />
+    <Viewbox>
+        <StackPanel Orientation="Vertical">
+            <StackPanel Orientation="Horizontal">
+                <StackPanel
+                    Width="400"
+                    Margin="10,0,0,0"
+                    Orientation="Vertical">
+                    <GroupBox>
+                        <GroupBox.Header>
+                            <Label
+                                FontSize="16"
+                                Content="{x:Static resx:AppResources.Account}"
+                                Foreground="White" />
+                        </GroupBox.Header>
+                        <StackPanel Orientation="Vertical">
+                            <Button
+                                Width="100"
+                                Click="Logout_Click"
+                                IsEnabled="{Binding IsInputLock}">
+                                <Label Content="{x:Static resx:AppResources.Logout}" />
+                            </Button>
+                            <StackPanel
+                                Height="30"
+                                Margin="0,10,0,10"
+                                Orientation="Horizontal">
+                                <Grid Width="178">
+                                    <Label
+                                        HorizontalAlignment="Center"
+                                        FontSize="16"
+                                        Content="{x:Static resx:AppResources.UserID}"
+                                        Foreground="White" />
+                                </Grid>
+                                <TextBox
+                                    Width="200"
+                                    VerticalContentAlignment="Center"
+                                    Text="{Binding UserID}"
+                                    FontSize="16"
+                                    IsEnabled="{Binding IsInputLock}"
+                                    IsReadOnly="True"
+                                    TextAlignment="Center" />
+                            </StackPanel>
+                            <StackPanel
+                                Height="30"
+                                Margin="0,0,0,10"
+                                Orientation="Horizontal">
+                                <Grid Width="178">
+                                    <Label
+                                        HorizontalAlignment="Center"
+                                        FontSize="16"
+                                        Content="{x:Static resx:AppResources.WorkOrder}"
+                                        Foreground="White" />
+                                </Grid>
+                                <TextBox
+                                    Width="200"
+                                    VerticalContentAlignment="Center"
+                                    Text="{Binding WorkOrder}"
+                                    FontSize="16"
+                                    IsEnabled="{Binding IsInputLock}"
+                                    IsReadOnly="True"
+                                    KeyDown="WorkOrder_KeyDown"
+                                    TextAlignment="Center"
+                                    TextChanged="WorkOrder_TextChanged" />
+                            </StackPanel>
+
+                        </StackPanel>
+                    </GroupBox>
+                    <GroupBox>
+                        <GroupBox.Header>
+                            <Label
+                                FontSize="16"
+                                Content="{x:Static resx:AppResources.BarcodeSetting}"
+                                Foreground="White" />
+                        </GroupBox.Header>
+                        <StackPanel Orientation="Vertical">
+                            <StackPanel Height="30" Orientation="Horizontal">
+                                <Grid Width="178">
+                                    <Label
+                                        HorizontalAlignment="Center"
+                                        FontSize="16"
+                                        Content="{x:Static resx:AppResources.ModelName}"
+                                        Foreground="White" />
+                                </Grid>
+                                <TextBox
+                                    x:Name="uxModelName"
+                                    Width="200"
+                                    VerticalContentAlignment="Center"
+                                    Text="{Binding ModelName}"
+                                    FontSize="16"
+                                    IsEnabled="{Binding IsInputLock}"
+                                    IsReadOnly="True"
+                                    TextAlignment="Center" />
+                            </StackPanel>
+                            <StackPanel
+                                Height="30"
+                                Margin="0,10,0,10"
+                                Orientation="Horizontal">
+                                <Grid Width="178">
+                                    <Label
+                                        HorizontalAlignment="Center"
+                                        FontSize="16"
+                                        Content="{x:Static resx:AppResources.SerialNumber}"
+                                        Foreground="White" />
+                                </Grid>
+                                <TextBox
+                                    x:Name="uxSerialNumber"
+                                    Width="200"
+                                    VerticalContentAlignment="Center"
+                                    Text="{Binding SerialNumber}"
+                                    FontSize="16"
+                                    IsEnabled="{Binding IsInputLock}"
+                                    IsReadOnly="True"
+                                    TextAlignment="Center" />
+                            </StackPanel>
+                            <StackPanel
+                                Height="30"
+                                Margin="0,0,0,10"
+                                Orientation="Horizontal">
+                                <Grid Width="178">
+                                    <Label
+                                        HorizontalAlignment="Center"
+                                        FontSize="16"
+                                        Content="{x:Static resx:AppResources.SimStatus}"
+                                        Foreground="White" />
+                                </Grid>
+                                <CheckBox
+                                    x:Name="uxIsSimCheckEnabled"
+                                    VerticalAlignment="Center"
+                                    IsChecked="{Binding IsSimInsert}"
+                                    IsEnabled="{Binding IsInputLock}"
+                                    IsHitTestVisible="False" />
+                                <CheckBox
+                                    x:Name="uxIsSimCheckEnabled2"
+                                    VerticalAlignment="Center"
+                                    IsChecked="{Binding IsSubSimInsert}"
+                                    IsEnabled="{Binding IsInputLock}"
+                                    IsHitTestVisible="False" />
+                            </StackPanel>
+                            <StackPanel
+                                Height="30"
+                                Margin="0,0,0,10"
+                                Orientation="Horizontal">
+                                <Grid Width="178">
+                                    <Label
+                                        HorizontalAlignment="Center"
+                                        FontSize="16"
+                                        Content="{x:Static resx:AppResources.ICCID}"
+                                        Foreground="White" />
+                                </Grid>
+                                <TextBox
+                                    x:Name="uxICCID"
+                                    Width="200"
+                                    VerticalContentAlignment="Center"
+                                    Text="{Binding UiSimICCID, Mode=OneWay}"
+                                    FontSize="16"
+                                    IsReadOnly="True"
+                                    TextAlignment="Center">
+                                    <TextBox.IsEnabled>
+                                        <MultiBinding Converter="{StaticResource booleanAndConverter}">
+                                            <Binding Path="IsSimInsert" />
+                                            <Binding Path="IsInputLock" />
+                                        </MultiBinding>
+                                    </TextBox.IsEnabled>
+                                </TextBox>
+                            </StackPanel>
+                            <StackPanel
+                                Height="30"
+                                Margin="0,0,0,10"
+                                Orientation="Horizontal">
+                                <Grid Width="178">
+                                    <Label
+                                        HorizontalAlignment="Center"
+                                        FontSize="16"
+                                        Content="{x:Static resx:AppResources.IMSI}"
+                                        Foreground="White" />
+                                </Grid>
+                                <TextBox
+                                    x:Name="uxIMSI"
+                                    Width="200"
+                                    VerticalContentAlignment="Center"
+                                    Text="{Binding UiSimIMSI, Mode=OneWay}"
+                                    FontSize="16"
+                                    IsReadOnly="True"
+                                    TextAlignment="Center">
+                                    <TextBox.IsEnabled>
+                                        <MultiBinding Converter="{StaticResource booleanAndConverter}">
+                                            <Binding Path="IsSimInsert" />
+                                            <Binding Path="IsInputLock" />
+                                        </MultiBinding>
+                                    </TextBox.IsEnabled>
+                                </TextBox>
+                            </StackPanel>
+                        </StackPanel>
+                    </GroupBox>
+                </StackPanel>
+
+                <StackPanel
+                    Width="400"
+                    Margin="10,0,0,0"
+                    Orientation="Vertical">
+                    <GroupBox>
+                        <GroupBox.Header>
+                            <Label
+                                FontSize="16"
+                                Content="{x:Static resx:AppResources.FirmwareVersion}"
+                                Foreground="White" />
+                        </GroupBox.Header>
+
+                        <DataGrid
+                            Height="335"
+                            Margin="10"
+                            AutoGenerateColumns="False"
+                            CanUserSortColumns="False"
+                            IsEnabled="{Binding IsInputLock}"
+                            ItemsSource="{Binding FirmwareUpdateModels}">
+                            <DataGrid.Columns>
+                                <DataGridTextColumn
+                                    Width="150"
+                                    MinWidth="50"
+                                    Binding="{Binding Path=Module}"
+                                    Header="{x:Static resx:AppResources.FirmwareVersionHeaderName}"
+                                    IsReadOnly="True" />
+                                <DataGridTextColumn
+                                    Width="150"
+                                    MinWidth="70"
+                                    Binding="{Binding Path=Version}"
+                                    Header="{x:Static resx:AppResources.FirmwareVersionHeaderVersion}"
+                                    IsReadOnly="True" />
+                                <!--  " DataGridTextColumn Header="File name" Binding="{Binding Path=FirmwareFileName}" IsReadOnly="False"/  -->
+                            </DataGrid.Columns>
+                        </DataGrid>
+                    </GroupBox>
+                </StackPanel>
+
+                <Grid Margin="10,0,0,0">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="*" />
+                        <RowDefinition Height="30" />
+                        <RowDefinition Height="*" />
+                    </Grid.RowDefinitions>
+
+                    <Button
+                        x:Name="uxStartBtn"
+                        Grid.Row="0"
+                        Margin="30"
+                        Click="StartInit_Click">
+                        <Button.Template>
+                            <ControlTemplate TargetType="Button">
+                                <Border
+                                    Background="White"
+                                    BorderBrush="Gray"
+                                    BorderThickness="2"
+                                    CornerRadius="10">
+                                    <Border.Effect>
+                                        <DropShadowEffect ShadowDepth="10" />
+                                    </Border.Effect>
+                                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
+                                </Border>
+                            </ControlTemplate>
+                        </Button.Template>
+                        <Button.IsEnabled>
+                            <MultiBinding Converter="{StaticResource booleanAndConverter}">
+                                <Binding Path="IsInputLock" />
+                                <Binding Path="IsInputCheckpassed" />
+                            </MultiBinding>
+                        </Button.IsEnabled>
+
+                        <Label FontSize="36" Content="{x:Static resx:AppResources.StartProcedure}" />
+                    </Button>
+
+                    <StackPanel Grid.Row="1" Orientation="Vertical">
+                        <StackPanel
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            Orientation="Horizontal">
+                            <ProgressBar
+                                x:Name="uxProgress"
+                                Width="250"
+                                Height="20"
+                                VerticalAlignment="Center"
+                                Maximum="100"
+                                Minimum="0" />
+                            <Label
+                                x:Name="uxProgressRate"
+                                FontSize="16"
+                                Content="0%"
+                                Foreground="White" />
+                        </StackPanel>
+                    </StackPanel>
+
+
+                    <Grid
+                        x:Name="uxStatusContainer"
+                        Grid.Row="2"
+                        Margin="30"
+                        Background="White">
+                        <Label
+                            x:Name="uxStatus"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="36"
+                            Content="Idle"
+                            Foreground="Black" />
+                    </Grid>
+                </Grid>
+            </StackPanel>
+            <Label
+                x:Name="uxStatusBar"
+                Margin="0,10,0,0"
+                HorizontalAlignment="Center"
+                FontSize="36"
+                Content=""
+                Foreground="White" />
+        </StackPanel>
+    </Viewbox>
+</Window>

+ 24 - 15
AwInitilizer/MainWindow.xaml.cs

@@ -283,14 +283,14 @@ namespace AwInitilizer
 
                 if (updateData.IsSimInsert)
                 {
-                    if (string.IsNullOrEmpty(updateData.ICCID))
+                    if (string.IsNullOrEmpty(updateData.SimICCID))
                     {
                         //alertMsg += "ICCID is Required when sim installed\n";
                         alertMsg += Resx.AppResources.IccidEmptyAlert + "\n";
                         isAvaliable = false;
                     }
 
-                    if (string.IsNullOrEmpty(updateData.IMSI))
+                    if (string.IsNullOrEmpty(updateData.SimIMSI))
                     {
                         //alertMsg += "IMSI is Required when sim installed\n";
                         alertMsg += Resx.AppResources.ImsiEmptyAlert + "\n";
@@ -481,8 +481,8 @@ namespace AwInitilizer
             fileWriter.WriteLine($"Model name:{ ViewModel.SettingModelName}");
             fileWriter.WriteLine($"4G Module Version:{ ViewModel.FourGenModuleVersion}");
             fileWriter.WriteLine($"Is sim insert:{ ViewModel.IsSimInsert}");
-            fileWriter.WriteLine($"sim ICCID:{ ViewModel.ICCID}");
-            fileWriter.WriteLine($"sim IMSI:{ ViewModel.IMSI}");
+            fileWriter.WriteLine($"sim ICCID:{ ViewModel.SimICCID}");
+            fileWriter.WriteLine($"sim IMSI:{ ViewModel.SimIMSI}");
 
             foreach (var model in ViewModel.FirmwareUpdateModels)
             {
@@ -643,9 +643,13 @@ namespace AwInitilizer
                 ViewModel.SettingModelName = setting.ModelName;
                 ViewModel.SettingFileName = Path.GetFileName(modelSeettingFilePath);
                 ViewModel.FourGenModuleVersion = setting.FourGenModuleVersion;
+                ViewModel.SubFourGenModuleVersion = setting.SubFourGenModuleVersion;
                 ViewModel.IsSimInsert = setting.IsSimInsert;
-                ViewModel.ICCID = setting.ICCID;
-                ViewModel.IMSI = setting.IMSI;
+                ViewModel.SimICCID = string.IsNullOrEmpty(setting.ICCID) ? setting.SimICCID : setting.ICCID;
+                ViewModel.SimIMSI = string.IsNullOrEmpty(setting.IMSI) ? setting.SimIMSI: setting.IMSI;
+                ViewModel.IsSubSimInsert = setting.IsSubSimInsert;
+                ViewModel.SubSimICCID = setting.SubSimICCID;
+                ViewModel.SubSimIMSI = setting.SubSimIMSI;
                 ViewModel.ButtonTestMode = setting.ButtonTestMode;
                 ViewModel.SkipEmergencyButton = setting.SkipEmergencyButton;
                 ViewModel.SkipButtonTest = setting.SkipButtonTest;
@@ -666,15 +670,20 @@ namespace AwInitilizer
 
             //init intilize procedure list
 
-            procedures.Add(new Procedure.BasicInfoUpdate.BasicInfoUpdateProcedure());
-            procedures.Add(new Procedure.FourGenModuleCheck.FourGenModuleCheckProcedure());
-            procedures.Add(new Procedure.WifRssiCheck.WifRssiCheckProcedure());
-            procedures.Add(new Procedure.TelcomModemImeiRecord.TelcomModemImeiRecordProcedure());
-            procedures.Add(new Procedure.FirmwareBundleUpload.FirmwareFtpUploadProcedure());
-            procedures.Add(new Procedure.FirmwareCheckVersion.FirmwareCheckVersionProcedure());
-            procedures.Add(new Procedure.ButtonStatusCheck.ButtonStatusCheckPorcedure());
-            procedures.Add(new Procedure.RestarttoIdle.RestarttoIdleProcedure());
-            procedures.Add(new Procedure.VersionLog.VersionLogProcedure());
+            procedures.Add(new Procedure.BasicInfoUpdate.BasicInfoUpdateProcedure());
+            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());
+            procedures.Add(new Procedure.RestarttoIdle.RestarttoIdleProcedure());
+            procedures.Add(new Procedure.VersionLog.VersionLogProcedure());
+            if (AppSettingConfig.IsDisableAuthRequired)
+            {
+                procedures.Add(new Procedure.FactoryAssist.DsiableChargeAuthProcedure());
+            }
 
             //procedures.Add(new Procedure.BasicInfoUpdate.BasicInfoUpdateProcedure());
             //procedures.Add(new Procedure.FourGenModuleCheck.FourGenModuleCheckProcedure());

+ 17 - 16
AwInitilizer/Model/AppSettingConfig.cs

@@ -1,16 +1,17 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.Model
-{
-    class AppSettingConfig
-    {
-        public string FirmwareRoot { get; set; }
-        public string Language { get; set; }
-        public string MES { get; set; }
-        public string MechineCode { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Model
+{
+    class AppSettingConfig
+    {
+        public string FirmwareRoot { get; set; }
+        public string Language { get; set; }
+        public string MES { get; set; }
+        public string MechineCode { get; set; }
+        public bool IsDisableAuthRequired { get; set; }
+    }
+}

+ 29 - 23
AwInitilizer/Model/SettingConfig.cs

@@ -1,23 +1,29 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Input;
-
-namespace AwInitilizer.Model
-{
-    public class SettingConfig
-    {
-        public string ModelName { get; set; }
-        public string FourGenModuleVersion { get; set; }
-        public bool IsSimInsert { get; set; }
-        public string ICCID { get; set; }
-        public string IMSI { get; set; }
-        public string ButtonTestMode { get; set; }
-        public bool SkipEmergencyButton { get; set; }
-        public bool SkipButtonTest { get; set; }
-        public string IpAddress { get; set; }
-        public List<FirmwareUpdateModel> FirmwareUpdateList { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Input;
+
+namespace AwInitilizer.Model
+{
+    public class SettingConfig
+    {
+        public string ModelName { get; set; }
+        public string FourGenModuleVersion { get; set; }
+        public string SubFourGenModuleVersion { get; set; }
+        public bool IsSimInsert { get; set; }
+        public string ICCID { get; set; }
+        public string IMSI { get; set; }
+        public string SimICCID { get; set; }
+        public string SimIMSI { get; set; }
+        public bool IsSubSimInsert { get; set; }
+        public string SubSimICCID { get; set; }
+        public string SubSimIMSI { get; set; }
+        public string ButtonTestMode { get; set; }
+        public bool SkipEmergencyButton { get; set; }
+        public bool SkipButtonTest { get; set; }
+        public string IpAddress { get; set; }
+        public List<FirmwareUpdateModel> FirmwareUpdateList { get; set; }
+    }
+}

+ 15 - 0
AwInitilizer/Model/SimStatusString.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Model
+{
+    public class SimStatusString
+    {
+        public bool IsInstalled { get; set; }
+        public string ICCID { get; set; }
+        public string IMSI { get; set; }
+    }
+}

+ 247 - 184
AwInitilizer/Model/UpdateData.cs

@@ -1,184 +1,247 @@
-using PhihongEv.Lib;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer.Model
-{
-    public class UpdateData : INotifyPropertyChanged
-    {
-        private SystemID _SystemID;
-        public SystemID SystemID {
-            get => _SystemID;
-            set
-            {
-                if(_SystemID!=value)
-                {
-                    _SystemID = value;
-                    RaisePropertyChanged("SystemID");
-                }
-            }
-        }
-
-        private string _ModelName;
-        public string ModelName {
-            get => _ModelName;
-            set
-            {
-                if(_ModelName!=value)
-                {
-                    _ModelName = value;
-                    RaisePropertyChanged("ModelName");
-                }
-            }
-        }
-
-        private string _SerialNumber;
-        public string SerialNumber
-        {
-            get => _SerialNumber;
-            set
-            {
-                if (_SerialNumber != value)
-                {
-                    _SerialNumber = value;
-                    RaisePropertyChanged("SerialNumber");
-                }
-            }
-        }
-
-        private string _FourGenModuleVersion;
-        public string FourGenModuleVersion
-        {
-            get => _FourGenModuleVersion;
-            set
-            {
-                if (_FourGenModuleVersion != value)
-                {
-                    _FourGenModuleVersion = value;
-                    RaisePropertyChanged("FourGenModuleVersion");
-                }
-            }
-        }
-
-        private bool _IsSimInsert;
-        public bool IsSimInsert
-        {
-            get => _IsSimInsert;
-            set
-            {
-                if(_IsSimInsert != value)
-                {
-                    _IsSimInsert = value;
-                    RaisePropertyChanged("IsSimInsert");
-                }
-            }
-        }
-
-        private string _ICCID;
-        public string ICCID {
-            get => _ICCID;
-            set
-            {
-                if (_ICCID != value)
-                {
-                    _ICCID = value;
-                    RaisePropertyChanged("ICCID");
-                }
-            }
-        }
-
-        private string _IMSI;
-        public string IMSI
-        {
-            get => _IMSI;
-            set
-            {
-                if (_IMSI != value)
-                {
-                    _IMSI = value;
-                    RaisePropertyChanged("IMSI");
-                }
-            }
-        }
-
-        private string _ButtonTestMode;
-        public string ButtonTestMode
-        {
-            get => _ButtonTestMode;
-            set
-            {
-                if (_ButtonTestMode != value)
-                {
-                    _ButtonTestMode = value;
-                    RaisePropertyChanged("ButtonTestMode");
-                }
-            }
-        }
-
-        private bool _SkipEmergencyButton;
-        public bool SkipEmergencyButton
-        {
-            get => _SkipEmergencyButton;
-            set
-            {
-                if (_SkipEmergencyButton != value)
-                {
-                    _SkipEmergencyButton = value;
-                    RaisePropertyChanged("SkipEmergencyButton");
-                }
-            }
-        }
-
-        private bool _SkipButtonTest;
-        public bool SkipButtonTest
-        {
-            get => _SkipButtonTest;
-            set
-            {
-                if (_SkipButtonTest != value)
-                {
-                    _SkipButtonTest = value;
-                    RaisePropertyChanged("SkipButtonTest");
-                }
-            }
-        }
-
-        private string _IpAddress;
-        public string IpAddress
-        {
-            get => _IpAddress;
-            set
-            {
-                if (_IpAddress != value)
-                {
-                    _IpAddress = value;
-                    RaisePropertyChanged("IpAddress");
-                }
-            }
-        }
-
-        private List<FirmwareUpdateModel> _FirmwareUpdateModels;
-        public List<FirmwareUpdateModel> FirmwareUpdateModels
-        {
-            get => _FirmwareUpdateModels;
-            set
-            {
-                if (_FirmwareUpdateModels != value)
-                {
-                    _FirmwareUpdateModels = value;
-                    RaisePropertyChanged("FirmwareUpdateModels");
-                }
-            }
-        }
-
-        public event PropertyChangedEventHandler PropertyChanged;
-        internal void RaisePropertyChanged(string name)
-        {
-            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
-        }
-    }
-}
+using PhihongEv.Lib;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Model
+{
+    public class UpdateData : INotifyPropertyChanged
+    {
+        private SystemID _SystemID;
+        public SystemID SystemID {
+            get => _SystemID;
+            set
+            {
+                if(_SystemID!=value)
+                {
+                    _SystemID = value;
+                    RaisePropertyChanged("SystemID");
+                }
+            }
+        }
+
+        private string _ModelName;
+        public string ModelName {
+            get => _ModelName;
+            set
+            {
+                if(_ModelName!=value)
+                {
+                    _ModelName = value;
+                    RaisePropertyChanged("ModelName");
+                }
+            }
+        }
+
+        private string _SerialNumber;
+        public string SerialNumber
+        {
+            get => _SerialNumber;
+            set
+            {
+                if (_SerialNumber != value)
+                {
+                    _SerialNumber = value;
+                    RaisePropertyChanged("SerialNumber");
+                }
+            }
+        }
+
+        private string _FourGenModuleVersion;
+        public string FourGenModuleVersion
+        {
+            get => _FourGenModuleVersion;
+            set
+            {
+                if (_FourGenModuleVersion != value)
+                {
+                    _FourGenModuleVersion = value;
+                    RaisePropertyChanged("FourGenModuleVersion");
+                }
+            }
+        }
+
+        private string _SubFourGenModuleVersion;
+        public string SubFourGenModuleVersion
+        {
+            get => _SubFourGenModuleVersion;
+            set
+            {
+                if (_SubFourGenModuleVersion != value)
+                {
+                    _SubFourGenModuleVersion = value;
+                    RaisePropertyChanged("SubFourGenModuleVersion");
+                }
+            }
+        }
+
+        private bool _IsSimInsert;
+        public bool IsSimInsert
+        {
+            get => _IsSimInsert;
+            set
+            {
+                if(_IsSimInsert != value)
+                {
+                    _IsSimInsert = value;
+                    RaisePropertyChanged("IsSimInsert");
+                }
+            }
+        }
+
+        private string _SimICCID;
+        public string SimICCID {
+            get => _SimICCID;
+            set
+            {
+                if (_SimICCID != value)
+                {
+                    _SimICCID = value;
+                    RaisePropertyChanged("SimICCID");
+                    RaisePropertyChanged("UiSimICCID");
+                }
+            }
+        }
+
+        private string _SimIMSI;
+        public string SimIMSI
+        {
+            get => _SimIMSI;
+            set
+            {
+                if (_SimIMSI != value)
+                {
+                    _SimIMSI = value;
+                    RaisePropertyChanged("SimIMSI");
+                    RaisePropertyChanged("UiSimIMSI");
+                }
+            }
+        }
+
+        private bool _IsSubSimInsert;
+        public bool IsSubSimInsert
+        {
+            get => _IsSubSimInsert;
+            set
+            {
+                if(_IsSubSimInsert != value)
+                {
+                    _IsSubSimInsert = value;
+                    RaisePropertyChanged("IsSubSimInsert");
+                }
+            }
+        }
+
+        private string _SubSimICCID;
+        public string SubSimICCID
+        {
+            get => _SubSimICCID;
+            set
+            {
+                if (_SubSimICCID != value)
+                {
+                    _SubSimICCID = value;
+                    RaisePropertyChanged("SubSimICCID");
+                    RaisePropertyChanged("UiSimICCID");
+                }
+            }
+        }
+
+        private string _SubSimIMSI;
+        public string SubSimIMSI
+        {
+            get => _SubSimIMSI;
+            set
+            {
+                if (_SubSimIMSI != value)
+                {
+                    _SubSimIMSI = value;
+                    RaisePropertyChanged("SubSimIMSI");
+                    RaisePropertyChanged("UiSimIMSI");
+                }
+            }
+        }
+
+        public string UiSimICCID => string.IsNullOrEmpty(SubSimICCID) ? SimICCID : $"{SimICCID}/{SubSimICCID}";
+        public string UiSimIMSI => string.IsNullOrEmpty(SubSimIMSI) ? SimIMSI : $"{SimIMSI}/{SubSimIMSI}";
+
+        private string _ButtonTestMode;
+        public string ButtonTestMode
+        {
+            get => _ButtonTestMode;
+            set
+            {
+                if (_ButtonTestMode != value)
+                {
+                    _ButtonTestMode = value;
+                    RaisePropertyChanged("ButtonTestMode");
+                }
+            }
+        }
+
+        private bool _SkipEmergencyButton;
+        public bool SkipEmergencyButton
+        {
+            get => _SkipEmergencyButton;
+            set
+            {
+                if (_SkipEmergencyButton != value)
+                {
+                    _SkipEmergencyButton = value;
+                    RaisePropertyChanged("SkipEmergencyButton");
+                }
+            }
+        }
+
+        private bool _SkipButtonTest;
+        public bool SkipButtonTest
+        {
+            get => _SkipButtonTest;
+            set
+            {
+                if (_SkipButtonTest != value)
+                {
+                    _SkipButtonTest = value;
+                    RaisePropertyChanged("SkipButtonTest");
+                }
+            }
+        }
+
+        private string _IpAddress;
+        public string IpAddress
+        {
+            get => _IpAddress;
+            set
+            {
+                if (_IpAddress != value)
+                {
+                    _IpAddress = value;
+                    RaisePropertyChanged("IpAddress");
+                }
+            }
+        }
+
+        private List<FirmwareUpdateModel> _FirmwareUpdateModels;
+        public List<FirmwareUpdateModel> FirmwareUpdateModels
+        {
+            get => _FirmwareUpdateModels;
+            set
+            {
+                if (_FirmwareUpdateModels != value)
+                {
+                    _FirmwareUpdateModels = value;
+                    RaisePropertyChanged("FirmwareUpdateModels");
+                }
+            }
+        }
+
+        public event PropertyChangedEventHandler PropertyChanged;
+        internal void RaisePropertyChanged(string name)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+        }
+    }
+}

+ 51 - 0
AwInitilizer/Procedure/DsiableChargeAuthProcedure.cs

@@ -0,0 +1,51 @@
+using AwInitilizer.Assist;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer.Procedure.FactoryAssist
+{
+    public class DsiableChargeAuthProcedure : ProcedureBase
+    {
+        public enum ErrorType
+        {
+            None,
+        }
+
+        public enum LogEvent
+        {
+        }
+
+        public ErrorType Error { get; set; } = ErrorType.None;
+
+        private ProcedureLog.LogWriter<DsiableChargeAuthProcedure, LogEvent> LogWriter;
+
+        public DsiableChargeAuthProcedure() : base()
+        {
+            Name = "Disable Charging Auth";
+            Content = "Disable Charging auth for factory test";
+
+            LogWriter = new ProcedureLog.LogWriter<DsiableChargeAuthProcedure, LogEvent>(this);
+        }
+
+        internal override async Task<bool> Run()
+        {
+            if (!AppSettingConfig.IsDisableAuthRequired)
+            {
+                return false;
+            }
+
+            var result = await EvApi.SetAuthorisationMode(isAuthRequired: false);
+
+            LogWriter.Log(result.Response);
+
+            return result.Result;
+        }
+    }
+}

+ 12 - 1
AwInitilizer/Procedure/FirmwareBundleUploadProcedure.cs

@@ -10,6 +10,7 @@ using System.Globalization;
 using System.Net;
 using System.Web;
 using System.IO;
+using System.Runtime.InteropServices;
 
 namespace AwInitilizer.Procedure.FirmwareBundleUpload
 {
@@ -87,7 +88,8 @@ namespace AwInitilizer.Procedure.FirmwareBundleUpload
             bool result = false;
             for (int tryCnt = 0; tryCnt < 10; tryCnt++)
             {
-                result = await UploadWithRestSharp();
+                //result = await UploadWithRestSharp();
+                result = await UploadWithApiClass();
                 if (result)
                     break;
                 else
@@ -177,6 +179,15 @@ namespace AwInitilizer.Procedure.FirmwareBundleUpload
             return true;
         }
 
+        private async Task<bool> UploadWithApiClass()
+        {
+            var updateList = UpdateData.FirmwareUpdateModels;
+            var updateNameList = updateList.Select(x => x.FirmwareFileName).ToList();
+            var uploadResult = await EvHttpClient.GetUploadfirmwareResultString(updateNameList);
+            LogWriter.Log(uploadResult.Msg);
+            return uploadResult.IsSuccess;
+        }
+
         private async Task<bool> UploadWithRestSharp()
         {
             var updateList = UpdateData.FirmwareUpdateModels;

+ 248 - 81
AwInitilizer/Procedure/FourGenModuleCheckProcedure.cs

@@ -1,4 +1,5 @@
-using System;
+using AwInitilizer.Assist;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -22,9 +23,13 @@ namespace AwInitilizer.Procedure.FourGenModuleCheck
     {
         FourgenSocketConnect,
         FourgenModuleVersion,
+        SubFourgenModuleVersion,
         SimStatus,
         SimICCID,
-        SimIMSI
+        SimIMSI,
+        SubSimStatus,
+        SubSimICCID,
+        SubSimIMSI
     }
 
     public class FourGenModuleCheckProcedure : ProcedureBase
@@ -37,18 +42,26 @@ namespace AwInitilizer.Procedure.FourGenModuleCheck
         {
             { LogEvent.FourgenSocketConnect, "FourgenSocketConnect" },
             { LogEvent.FourgenModuleVersion, "FourgenModuleVersion" },
+            { LogEvent.SubFourgenModuleVersion, "SubFourgenModuleVersion" },
             { LogEvent.SimStatus, "SimStatus" },
             { LogEvent.SimICCID, "SimICCID" },
             { LogEvent.SimIMSI, "SimIMSI" },
+            { LogEvent.SubSimStatus, "SubSimStatus" },
+            { LogEvent.SubSimICCID, "SubSimICCID" },
+            { LogEvent.SubSimIMSI, "SubSimIMSI" },
         };
 
         private readonly static Dictionary<LogEvent, string> LogDict = new Dictionary<LogEvent, string>()
         {
             { LogEvent.FourgenSocketConnect, "EVSE connect {0}" },
             { LogEvent.FourgenModuleVersion, "Read 4G Module version : {0}" },
+            { LogEvent.SubFourgenModuleVersion, "Read sub 4G Module version : {0}" },
             { LogEvent.SimStatus, "Get sim instert status {0}" },
             { LogEvent.SimICCID, "Get Sim ICCID : {0}" },
             { LogEvent.SimIMSI, "Get Sim IMSI : {0}" },
+            { LogEvent.SubSimStatus, "Get sub sim instert status {0}" },
+            { LogEvent.SubSimICCID, "Get sub Sim ICCID : {0}" },
+            { LogEvent.SubSimIMSI, "Get sub Sim IMSI : {0}" },
         };
 
         public FourGenModuleCheckProcedure() : base()
@@ -65,7 +78,8 @@ namespace AwInitilizer.Procedure.FourGenModuleCheck
 
         internal override async Task<bool> Run()
         {
-            if (!UpdateData.SystemID.ModelName.Network.Description.Contains("4G"))
+            //if (!UpdateData.SystemID.ModelName.Network.Description.Contains("4G"))
+            if (!UpdateData.SystemID.ModelName.Network.SupportTelecom)
             {
                 //if does not support 4G then end init
                 LogWriter.Log("4G not supported, skip procedure");
@@ -74,40 +88,102 @@ namespace AwInitilizer.Procedure.FourGenModuleCheck
             }
 
             //Logger.Print("Connecting to EVSE");
-            if (!await base.CheckAndCreateSocket())
+            int pollingCnt;
+            bool response;
+            for (pollingCnt = 0; pollingCnt < 56; pollingCnt++)
             {
-                LogWriter.Report(LogEvent.FourgenSocketConnect,"fail", isError: true);
+                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));
+
+            //timeout
+            if (pollingCnt >= 56)
+            {
+                LogWriter.Report(LogEvent.FourgenSocketConnect, "fail", isError: true);
                 Error = ErrorType.ConnectFail;
 
                 return false;
             }
+
+            //if (!await base.CheckAndCreateSocket())
+            //{
+            //    LogWriter.Report(LogEvent.FourgenSocketConnect, "fail", isError: true);
+            //    Error = ErrorType.ConnectFail;
+
+            //    return false;
+            //}
             LogWriter.Report(LogEvent.FourgenSocketConnect, "success");
 
-            var fourthGenModuleVersion = await serialPortocol.GetFourGenModuleVersion();
-            //LogWriter.Report(LogEvent.FourgenModuleVersion, fourthGenModuleVersion);
-            
+            //var fourthGenModuleVersion = await serialPortocol.GetFourGenModuleVersion();
+            var getfourthGenModuleVersion = await EvApi.GetTelcomModemFwRev();
+            var fourthGenModuleVersion = getfourthGenModuleVersion.Result;
+            //LogWriter.Report(LogEvent.FourgenModuleVersion, fourthGenModuleVersion);
+
             if (string.IsNullOrEmpty(fourthGenModuleVersion))
             {
                 Error = ErrorType.VersionReadFail;
                 LogWriter.Log("4G module version read error");
-                LogWriter.Report(LogEvent.FourgenModuleVersion, "empty" , isError: true);
+                LogWriter.Report(LogEvent.FourgenModuleVersion, "empty", isError: true);
                 return false;
             }
-            else
-            {
-                LogWriter.Log(string.Format("Read 4G Module version : {0} , Expect:{1}", fourthGenModuleVersion, UpdateData.FourGenModuleVersion));
 
-                if (!fourthGenModuleVersion.ToLower().StartsWith(UpdateData.FourGenModuleVersion.ToLower()))
-                {
-                    Error = ErrorType.VersionMismatch;
-                    LogWriter.Report(LogEvent.FourgenModuleVersion, fourthGenModuleVersion, isError: true);
-                    return false;
-                }
+            LogWriter.Log(string.Format("Read 4G Module version : {0} , Expect:{1}", fourthGenModuleVersion, UpdateData.FourGenModuleVersion));
 
-                LogWriter.Report(LogEvent.FourgenModuleVersion, fourthGenModuleVersion);
+            if (!fourthGenModuleVersion.ToLower().StartsWith(UpdateData.FourGenModuleVersion.ToLower()))
+            {
+                Error = ErrorType.VersionMismatch;
+                LogWriter.Report(LogEvent.FourgenModuleVersion, fourthGenModuleVersion, isError: true);
+                return false;
             }
 
-            var simstatus = await serialPortocol.GetSimStatus();
+            LogWriter.Report(LogEvent.FourgenModuleVersion, fourthGenModuleVersion);
+
+            if (UpdateData.SystemID.ModelName.Network.SupportSubTelecom)
+            {
+                //var fourthGenModuleVersion = await serialPortocol.GetFourGenModuleVersion();
+                getfourthGenModuleVersion = await EvApi.GetTelcomSubModemFwRev();
+                fourthGenModuleVersion = getfourthGenModuleVersion.Result;
+                //LogWriter.Report(LogEvent.FourgenModuleVersion, fourthGenModuleVersion);
+
+                int retryCnt = 0;
+                while (string.IsNullOrEmpty(fourthGenModuleVersion) && retryCnt < 30)
+                {
+                    retryCnt++;
+                    await Task.Delay(TimeSpan.FromSeconds(10));
+                    getfourthGenModuleVersion = await EvApi.GetTelcomSubModemFwRev();
+                    fourthGenModuleVersion = getfourthGenModuleVersion.Result;
+                }
+                LogWriter.Log($"Get sub sim version retry {retryCnt}");
+
+
+                if (string.IsNullOrEmpty(fourthGenModuleVersion))
+                {
+                    Error = ErrorType.VersionReadFail;
+                    LogWriter.Log("sub 4G module version read error");
+                    LogWriter.Report(LogEvent.SubFourgenModuleVersion, "empty", isError: true);
+                    return false;
+                }
+
+                LogWriter.Log(string.Format("Read sub 4G Module version : {0} , Expect:{1}", fourthGenModuleVersion, UpdateData.SubFourGenModuleVersion));
+
+                if (!fourthGenModuleVersion.ToLower().StartsWith(UpdateData.SubFourGenModuleVersion.ToLower()))
+                {
+                    Error = ErrorType.VersionMismatch;
+                    LogWriter.Report(LogEvent.SubFourgenModuleVersion, fourthGenModuleVersion, isError: true);
+                    return false;
+                }
+
+                LogWriter.Report(LogEvent.SubFourgenModuleVersion, fourthGenModuleVersion);
+            }
+
+
+            //var simstatus = await serialPortocol.GetSimStatus();
+            var getResult = await EvApi.GetTelcomSimStatus();
+            var simstatus = getResult.Result;
             string simstatusString;
 
             if (simstatus == null)
@@ -115,7 +191,7 @@ namespace AwInitilizer.Procedure.FourGenModuleCheck
                 simstatusString = "unknown";
                 //LogWriter.Report(LogEvent.SimStatus, "unknown");
             }
-            else if(simstatus.IsInstalled)
+            else if (simstatus.IsInstalled)
             {
                 simstatusString = "inserted";
                 //LogWriter.Report(LogEvent.SimStatus, "inserted");
@@ -129,72 +205,163 @@ namespace AwInitilizer.Procedure.FourGenModuleCheck
             if (simstatus == null)
             {
                 Error = ErrorType.SimStatusReadFail;
-                LogWriter.Report(LogEvent.SimStatus, simstatusString , isError: true);
+                LogWriter.Report(LogEvent.SimStatus, simstatusString, isError: true);
                 return false;
+            }
+            LogWriter.Log(string.Format("Get Sim Status : {0} , Expect:{1}", simstatus.IsInstalled ? "installed" : "uninstalled", UpdateData.IsSimInsert ? "installed" : "uninstalled"));
+
+            if (simstatus.IsInstalled != UpdateData.IsSimInsert)
+            {
+                Error = ErrorType.SimStatusMismatch;
+                LogWriter.Report(LogEvent.SimStatus, simstatusString, isError: true);
+                return false;
+            }
+            LogWriter.Report(LogEvent.SimStatus, simstatusString);
+            if (simstatus.IsInstalled)
+            {
+                //var iccidByteList = simstatus.ICCID.ToList();
+                //iccidByteList.RemoveAll(x => x == 0x00);
+                //var iccidBytes = iccidByteList.ToArray();
+
+                //var imsiByteList = simstatus.IMSI.ToList();
+                //imsiByteList.RemoveAll(x => x == 0x00);
+                //var imsiBytes = imsiByteList.ToArray();
+
+
+                //var ICCIDstring = Encoding.ASCII.GetString(iccidBytes).Trim();
+                //var IMSIstring = Encoding.ASCII.GetString(imsiBytes).Trim();
+                var ICCIDstring = simstatus.ICCID;
+                var IMSIstring = simstatus.IMSI;
+
+                //LogWriter.Report(LogEvent.SimICCID, ICCIDstring);
+                //LogWriter.Report(LogEvent.SimIMSI, IMSIstring);
+
+                LogWriter.Log(string.Format("Get Sim ICCID : {0} , Expect:{1}", ICCIDstring, UpdateData.SimICCID));
+                LogWriter.Log(string.Format("Get Sim IMSI : {0} , Expect:{1}", IMSIstring, UpdateData.SimIMSI));
+
+                if (ICCIDstring != UpdateData.SimICCID)
+                {
+                    LogWriter.Log("Sim card ICCID not match");
+                    Error = ErrorType.IccidMistach;
+                    LogWriter.Report(LogEvent.SimICCID, ICCIDstring, isError: true);
+                    return false;
+                }
+                else
+                {
+                    LogWriter.Report(LogEvent.SimICCID, ICCIDstring);
+                }
+
+                if (IMSIstring != UpdateData.SimIMSI)
+                {
+                    LogWriter.Log("Sim card IMSI not match");
+                    Error = ErrorType.ImsiMistach;
+                    LogWriter.Report(LogEvent.SimIMSI, IMSIstring, isError: true);
+                    return false;
+                }
+                else
+                {
+                    LogWriter.Report(LogEvent.SimIMSI, IMSIstring);
+                }
+            }
+            else
+            {
+            }
+
+
+
+            if (!UpdateData.SystemID.ModelName.Network.SupportSubTelecom)
+            {
+                return true;
+            }
+
+            getResult = await EvApi.GetTelcomSubSimStatus();
+            simstatus = getResult.Result;
+
+            if (simstatus == null)
+            {
+                simstatusString = "unknown";
+                //LogWriter.Report(LogEvent.SimStatus, "unknown");
+            }
+            else if (simstatus.IsInstalled)
+            {
+                simstatusString = "inserted";
+                //LogWriter.Report(LogEvent.SimStatus, "inserted");
             }
             else
             {
-                LogWriter.Log(string.Format("Get Sim Status : {0} , Expect:{1}", simstatus.IsInstalled ? "installed" : "uninstalled", UpdateData.IsSimInsert ? "installed" : "uninstalled"));
-
-                if (simstatus.IsInstalled != UpdateData.IsSimInsert)
-                {
-                    Error = ErrorType.SimStatusMismatch;
-                    LogWriter.Report(LogEvent.SimStatus, simstatusString, isError: true);
-                    return false;
-                }
-                else
-                {
-                    LogWriter.Report(LogEvent.SimStatus, simstatusString);
-                    if (simstatus.IsInstalled)
-                    {
-                        var iccidByteList = simstatus.ICCID.ToList();
-                        iccidByteList.RemoveAll(x => x == 0x00);
-                        var iccidBytes = iccidByteList.ToArray();
-
-                        var imsiByteList = simstatus.IMSI.ToList();
-                        imsiByteList.RemoveAll(x => x == 0x00);
-                        var imsiBytes = imsiByteList.ToArray();
-
-
-                        var ICCIDstring = Encoding.ASCII.GetString(iccidBytes).Trim();
-                        var IMSIstring = Encoding.ASCII.GetString(imsiBytes).Trim();
-
-                        //LogWriter.Report(LogEvent.SimICCID, ICCIDstring);
-                        //LogWriter.Report(LogEvent.SimIMSI, IMSIstring);
-
-                        LogWriter.Log(string.Format("Get Sim ICCID : {0} , Expect:{1}", ICCIDstring, UpdateData.ICCID));
-                        LogWriter.Log(string.Format("Get Sim IMSI : {0} , Expect:{1}", IMSIstring, UpdateData.IMSI));
-
-                        if (ICCIDstring != UpdateData.ICCID)
-                        {
-                            LogWriter.Log("Sim card ICCID not match");
-                            Error = ErrorType.IccidMistach;
-                            LogWriter.Report(LogEvent.SimICCID, ICCIDstring, isError: true);
-                            return false;
-                        }
-                        else
-                        {
-                            LogWriter.Report(LogEvent.SimICCID, ICCIDstring);
-                        }
-
-                        if (IMSIstring != UpdateData.IMSI)
-                        {
-                            LogWriter.Log("Sim card IMSI not match");
-                            Error = ErrorType.ImsiMistach;
-                            LogWriter.Report(LogEvent.SimIMSI, IMSIstring, isError: true);
-                            return false;
-                        }
-                        else
-                        {
-                            LogWriter.Report(LogEvent.SimIMSI, IMSIstring);
-                        }
-                    }
-                    else
-                    {
-                    }
-                }
+                simstatusString = "none";
+                //LogWriter.Report(LogEvent.SimStatus, "none");
             }
 
+            if (simstatus == null)
+            {
+                Error = ErrorType.SimStatusReadFail;
+                LogWriter.Report(LogEvent.SubSimStatus, simstatusString, isError: true);
+                return false;
+            }
+            LogWriter.Log(string.Format("Get Sub Sim Status : {0} , Expect:{1}", simstatus.IsInstalled ? "installed" : "uninstalled", UpdateData.IsSubSimInsert ? "installed" : "uninstalled"));
+
+            if (simstatus.IsInstalled != UpdateData.IsSubSimInsert)
+            {
+                Error = ErrorType.SimStatusMismatch;
+                LogWriter.Report(LogEvent.SubSimStatus, simstatusString, isError: true);
+                return false;
+            }
+            else
+            {
+                LogWriter.Report(LogEvent.SubSimStatus, simstatusString);
+                if (simstatus.IsInstalled)
+                {
+                    //var iccidByteList = simstatus.ICCID.ToList();
+                    //iccidByteList.RemoveAll(x => x == 0x00);
+                    //var iccidBytes = iccidByteList.ToArray();
+
+                    //var imsiByteList = simstatus.IMSI.ToList();
+                    //imsiByteList.RemoveAll(x => x == 0x00);
+                    //var imsiBytes = imsiByteList.ToArray();
+
+
+                    //var ICCIDstring = Encoding.ASCII.GetString(iccidBytes).Trim();
+                    //var IMSIstring = Encoding.ASCII.GetString(imsiBytes).Trim();
+                    var ICCIDstring = simstatus.ICCID;
+                    var IMSIstring = simstatus.IMSI;
+
+                    //LogWriter.Report(LogEvent.SimICCID, ICCIDstring);
+                    //LogWriter.Report(LogEvent.SimIMSI, IMSIstring);
+
+                    LogWriter.Log(string.Format("Get Sim ICCID : {0} , Expect:{1}", ICCIDstring, UpdateData.SubSimICCID));
+                    LogWriter.Log(string.Format("Get Sim IMSI : {0} , Expect:{1}", IMSIstring, UpdateData.SubSimIMSI));
+
+                    if (ICCIDstring != UpdateData.SubSimICCID)
+                    {
+                        LogWriter.Log("Sim card ICCID not match");
+                        Error = ErrorType.IccidMistach;
+                        LogWriter.Report(LogEvent.SubSimICCID, ICCIDstring, isError: true);
+                        return false;
+                    }
+                    else
+                    {
+                        LogWriter.Report(LogEvent.SubSimICCID, ICCIDstring);
+                    }
+
+                    if (IMSIstring != UpdateData.SubSimIMSI)
+                    {
+                        LogWriter.Log("Sim card IMSI not match");
+                        Error = ErrorType.ImsiMistach;
+                        LogWriter.Report(LogEvent.SubSimIMSI, IMSIstring, isError: true);
+                        return false;
+                    }
+                    else
+                    {
+                        LogWriter.Report(LogEvent.SubSimIMSI, IMSIstring);
+                    }
+                }
+                else
+                {
+                }
+            }
+
+
             return true;
         }
     }

+ 4 - 4
AwInitilizer/Properties/AssemblyInfo.cs

@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.11.4.0")]
-[assembly: AssemblyVersion("1.11.4.0")]
-[assembly: AssemblyFileVersion("1.11.4.0")]
-[assembly: AssemblyInformationalVersion("e705d3b")]
+// [assembly: AssemblyVersion("1.11.5.0")]
+[assembly: AssemblyVersion("1.11.5.0")]
+[assembly: AssemblyFileVersion("1.11.5.0")]
+[assembly: AssemblyInformationalVersion("266a5e2")]

+ 119 - 105
AwInitilizer/SettingConfig.cs

@@ -1,105 +1,119 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AwInitilizer
-{
-    public class AppSettingConfig
-    {
-        public static string FirmwareRoot
-        { 
-            get
-            {
-                if(Instance == null)
-                {
-                    Instance = new AppSettingConfig();
-                }
-                return Instance._FirmwareRoot;
-            }
-        }
-
-        public static string Language
-        {
-            get
-            {
-                if (Instance == null)
-                {
-                    Instance = new AppSettingConfig();
-                }
-                return Instance._Language;
-            }
-        }
-
-        public static string MES
-        {
-            get
-            {
-                if (Instance == null)
-                {
-                    Instance = new AppSettingConfig();
-                }
-                return Instance._MES;
-            }
-        }
-
-        public static string MechineCode
-        {
-            get
-            {
-                if (Instance == null)
-                {
-                    Instance = new AppSettingConfig();
-                }
-                return Instance._MechineCode;
-            }
-        }
-
-        private static AppSettingConfig Instance;
-
-        private string _FirmwareRoot, _Language, _MES , _MechineCode;
-
-        private static string settingFileName = "config.ini";
-
-        public AppSettingConfig()
-        {
-            if(!File.Exists(settingFileName))
-            {
-                LoadDefaultSetting();
-            }
-            else
-            {
-                LoadSettingFromDefaultFile();
-            }
-        }
-
-        private void LoadSettingFromDefaultFile()
-        {
-            try
-            {
-                LoadDefaultSetting();
-
-                var configStr = File.ReadAllText(settingFileName);
-                var config = Newtonsoft.Json.JsonConvert.DeserializeObject<Model.AppSettingConfig>(configStr);
-                _FirmwareRoot = config.FirmwareRoot;
-                _Language = config.Language;
-                _MES = config.MES;
-                _MechineCode = config.MechineCode;
-            }
-            catch
-            {
-                
-            }
-        }
-
-        private void LoadDefaultSetting()
-        {
-            _FirmwareRoot = "./Firmware";
-            _Language = "zh-chs";
-            _MES = "sajet2";
-            _MechineCode = "testMechineCode";
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AwInitilizer
+{
+    public class AppSettingConfig
+    {
+        public static string FirmwareRoot
+        { 
+            get
+            {
+                if(Instance == null)
+                {
+                    Instance = new AppSettingConfig();
+                }
+                return Instance._FirmwareRoot;
+            }
+        }
+
+        public static string Language
+        {
+            get
+            {
+                if (Instance == null)
+                {
+                    Instance = new AppSettingConfig();
+                }
+                return Instance._Language;
+            }
+        }
+
+        public static string MES
+        {
+            get
+            {
+                if (Instance == null)
+                {
+                    Instance = new AppSettingConfig();
+                }
+                return Instance._MES;
+            }
+        }
+
+        public static string MechineCode
+        {
+            get
+            {
+                if (Instance == null)
+                {
+                    Instance = new AppSettingConfig();
+                }
+                return Instance._MechineCode;
+            }
+        }
+
+        public static bool IsDisableAuthRequired
+        {
+            get
+            {
+                if (Instance == null)
+                {
+                    Instance = new AppSettingConfig();
+                }
+                return Instance._IsDisableAuthRequired;
+            }
+        }
+
+        private static AppSettingConfig Instance;
+
+        private string _FirmwareRoot, _Language, _MES , _MechineCode;
+        private bool _IsDisableAuthRequired;
+
+        private static string settingFileName = "config.ini";
+
+        public AppSettingConfig()
+        {
+            if(!File.Exists(settingFileName))
+            {
+                LoadDefaultSetting();
+            }
+            else
+            {
+                LoadSettingFromDefaultFile();
+            }
+        }
+
+        private void LoadSettingFromDefaultFile()
+        {
+            try
+            {
+                LoadDefaultSetting();
+
+                var configStr = File.ReadAllText(settingFileName);
+                var config = Newtonsoft.Json.JsonConvert.DeserializeObject<Model.AppSettingConfig>(configStr);
+                _FirmwareRoot = config.FirmwareRoot;
+                _Language = config.Language;
+                _MES = config.MES;
+                _MechineCode = config.MechineCode;
+                _IsDisableAuthRequired = config.IsDisableAuthRequired;
+            }
+            catch
+            {
+                
+            }
+        }
+
+        private void LoadDefaultSetting()
+        {
+            _FirmwareRoot = "./Firmware";
+            _Language = "zh-chs";
+            _MES = "sajet2";
+            _MechineCode = "testMechineCode";
+        }
+    }
+}

+ 6 - 6
AwInitilizer/packages.config

@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="FluentFTP" version="37.0.2" targetFramework="net48" />
-  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
-  <package id="PhihongEv.Lib" version="1.0.14" targetFramework="net48" />
-  <package id="RestSharp" version="106.15.0" targetFramework="net48" />
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="FluentFTP" version="37.0.2" targetFramework="net48" />
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
+  <package id="PhihongEv.Lib" version="1.0.16" targetFramework="net48" />
+  <package id="RestSharp" version="106.15.0" targetFramework="net48" />
 </packages>

+ 1 - 1
GitVersion.yml

@@ -1,6 +1,6 @@
 assembly-versioning-scheme: MajorMinorPatch
 assembly-informational-format: '{ShortSha}'
-next-version: 1.11.4
+next-version: 1.11.5
 branches: {}
 ignore:
   sha: []

+ 3 - 3
Initilizer/AssemblyInfo.cs

@@ -9,7 +9,7 @@
                                               // app, or any theme specific resource dictionaries)
 )]
 
-[assembly: AssemblyVersion("1.11.4.0")]
-[assembly: AssemblyFileVersion("1.11.4.0")]
-[assembly: AssemblyInformationalVersion("e705d3b")]
+[assembly: AssemblyVersion("1.11.5.0")]
+[assembly: AssemblyFileVersion("1.11.5.0")]
+[assembly: AssemblyInformationalVersion("266a5e2")]
 

+ 4 - 4
MesAdaptor/Properties/AssemblyInfo.cs

@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.11.4.0")]
-[assembly: AssemblyVersion("1.11.4.0")]
-[assembly: AssemblyFileVersion("1.11.4.0")]
-[assembly: AssemblyInformationalVersion("e705d3b")]
+// [assembly: AssemblyVersion("1.11.5.0")]
+[assembly: AssemblyVersion("1.11.5.0")]
+[assembly: AssemblyFileVersion("1.11.5.0")]
+[assembly: AssemblyInformationalVersion("266a5e2")]