|
@@ -10,7 +10,6 @@ using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Net;
|
|
|
using System.Text;
|
|
|
-using System.Text.RegularExpressions;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Web;
|
|
|
using System.Windows.Ink;
|
|
@@ -66,7 +65,7 @@ namespace AwInitilizer.Procedure
|
|
|
for (pollinfCnt = 0; pollinfCnt < 14; pollinfCnt++)
|
|
|
{
|
|
|
await Task.Delay(TimeSpan.FromSeconds(30));
|
|
|
- response = await CheckAllIdel();
|
|
|
+ response = await ChekCsuBootCompelete();
|
|
|
if (response)
|
|
|
break;
|
|
|
}
|
|
@@ -180,58 +179,6 @@ namespace AwInitilizer.Procedure
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private async Task<bool> CheckAllIdel()
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- using (WebClient webClient = new WebClient())
|
|
|
- {
|
|
|
- NameValueCollection parameters = new NameValueCollection();
|
|
|
- parameters.Add("opt", "2");
|
|
|
- webClient.QueryString = parameters;
|
|
|
-
|
|
|
- using (Stream stream = await webClient.OpenReadTaskAsync($"https://{ServerIpAddress}/get_query_action.php"))
|
|
|
- // 使用 StreamReader 讀取 stream 內的字元
|
|
|
- using (StreamReader reader = new StreamReader(stream))
|
|
|
- {
|
|
|
- // 將 StreamReader 所讀到的字元轉為 string
|
|
|
- string request = reader.ReadToEnd();
|
|
|
- InfoLog += $"get status respons:\n{request}\n";
|
|
|
- LogPair.Add($"EvseStatus", request);
|
|
|
- Regex rx = new Regex("(SystemStatus)\\\": (\\d)");
|
|
|
- var matches = rx.Matches(request);
|
|
|
- bool isAllPassed = true;
|
|
|
- for (int matchIndex = 0; matchIndex < matches.Count; matchIndex++)
|
|
|
- {
|
|
|
- var match = matches[matchIndex];
|
|
|
- if (match.Groups.Count != 3)
|
|
|
- {
|
|
|
- InfoLog += $"Connector {matchIndex} status string mismatched\n";
|
|
|
- Logger.Print($"Connector {matchIndex} status string mismatched", isError: true);
|
|
|
- isAllPassed = false;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (match.Groups[2].Value != "1")
|
|
|
- {
|
|
|
- InfoLog += $"Connector {matchIndex} status not Idel\n";
|
|
|
- Logger.Print($"Connector {matchIndex} status not Idel", isError: true);
|
|
|
- isAllPassed = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return isAllPassed;
|
|
|
- }
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
internal async Task<bool> Uploadfiremware(string fileName)
|
|
|
{
|
|
|
try
|