Updated other uses of Internal Config to GLOBAL--FlexiApplication
This commit is contained in:
1
AiQ_GUI.Designer.cs
generated
1
AiQ_GUI.Designer.cs
generated
@@ -587,6 +587,7 @@ namespace AiQ_GUI
|
||||
BtnTest.TabIndex = 189;
|
||||
BtnTest.Text = "Test";
|
||||
BtnTest.UseVisualStyleBackColor = false;
|
||||
BtnTest.Visible = false;
|
||||
BtnTest.Click += BtnTest_Click;
|
||||
//
|
||||
// PicBxIRF2
|
||||
|
||||
34
AiQ_GUI.cs
34
AiQ_GUI.cs
@@ -304,7 +304,7 @@ namespace AiQ_GUI
|
||||
{
|
||||
// Turn off God mode
|
||||
string[,] GOD_JSON = { { "propGodMode", "false" } };
|
||||
string IntConf = await FlexiAPI.HTTP_Update("Internal Config", CamOnTest.IP, GOD_JSON);
|
||||
string IntConf = await FlexiAPI.HTTP_Update("GLOBAL--FlexiApplication", CamOnTest.IP, GOD_JSON);
|
||||
if (!IntConf.Contains("\"propGodMode\": {\"value\": \"false\", \"datatype\": \"boolean\"},"))
|
||||
AddToActionsList("Could not turn off God mode");
|
||||
|
||||
@@ -397,15 +397,14 @@ namespace AiQ_GUI
|
||||
List<object> oblistCD = [CamOnTest.Model, FullFailureValues];
|
||||
GoogleAPI.WriteToSS(oblistCD, "'Approval'!C" + nextRow + ":D" + nextRow, GoogleAPI.spreadsheetId_ModelInfo);
|
||||
|
||||
//await Teams.SendMssg(Convert.ToString(nextRow), CbBxUserName.Text);
|
||||
GoogleAPI.EmailApproval(Convert.ToString(nextRow), CbBxUserName.Text);
|
||||
await Teams.SendMssg(Convert.ToString(nextRow), CbBxUserName.Text);
|
||||
//GoogleAPI.EmailApproval(Convert.ToString(nextRow), CbBxUserName.Text);
|
||||
|
||||
string Approved = "";
|
||||
|
||||
while (Approved != "TRUE")
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
|
||||
values = GoogleAPI.service.Spreadsheets.Values.Get(GoogleAPI.spreadsheetId_ModelInfo, "'Approval'!B" + nextRow).Execute().Values;
|
||||
|
||||
if (values?.Count > 0)
|
||||
@@ -925,7 +924,7 @@ namespace AiQ_GUI
|
||||
|
||||
try
|
||||
{
|
||||
await FlexiAPI.HTTP_Update("Internal Config", CamOnTest.IP, GOD_JSON);
|
||||
await FlexiAPI.HTTP_Update("GLOBAL--FlexiApplication", CamOnTest.IP, GOD_JSON);
|
||||
BtnSetGodMode.Text = newGodModeValue == "true" ? "Set God Mode Off" : "Set God Mode On";
|
||||
BtnSetGodMode.BackColor = Color.Green;
|
||||
}
|
||||
@@ -1171,7 +1170,7 @@ namespace AiQ_GUI
|
||||
try
|
||||
{
|
||||
Network.Initialize("developer", SCL.DevPass); // Ensure network is initialized to the right camera
|
||||
string RESP = await FlexiAPI.HTTP_Update("Internal Config", SCL.IP, GOD_JSON);
|
||||
string RESP = await FlexiAPI.HTTP_Update("GLOBAL--FlexiApplication", SCL.IP, GOD_JSON);
|
||||
Instance.AddToActionsList($"Setting God mode for camera {SCL.IP} to {newGodModeValue}", false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1580,9 +1579,24 @@ namespace AiQ_GUI
|
||||
{
|
||||
if (!SCL.IsChecked)
|
||||
continue;
|
||||
try
|
||||
{
|
||||
Network.Initialize("developer", SCL.DevPass); // Ensure network is initialized to the right camera, cannot be done in soak test finally becuase of this.
|
||||
await CameraModules.FactoryResetModules(SCL.IP); // Reset camera modules
|
||||
|
||||
Network.Initialize("developer", SCL.DevPass); // Ensure network is initialized to the right camera, cannot be done in soak test finally becuase of this.
|
||||
await CameraModules.FactoryResetModules(SCL.IP);
|
||||
string[,] godJson = { { "propGodMode", "false" } }; // Set God mode explicitly off
|
||||
string GOD = await FlexiAPI.HTTP_Update("GLOBAL--FlexiApplication", SCL.IP, godJson);
|
||||
if (GOD.Contains("Error"))
|
||||
throw new Exception("Could not set God mode off");
|
||||
|
||||
bool Pass = await FlexiAPI.ChangeNetwork211(SCL.IP); // set camera to 211
|
||||
if (!Pass)
|
||||
throw new Exception("Could not set camera to 211");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddToActionsList("Failed to set God mode, reset camera modules or 211 for camera " + SCL.IP + ". Reason: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1702,13 +1716,15 @@ namespace AiQ_GUI
|
||||
}
|
||||
|
||||
// ***** Test & Debug *****
|
||||
private async void BtnTest_Click(object sender, EventArgs e)
|
||||
private void BtnTest_Click(object sender, EventArgs e)
|
||||
{
|
||||
Stopwatch stopWatchTest = Stopwatch.StartNew();
|
||||
|
||||
StatsExcel excelExporter = new();
|
||||
excelExporter.ExportDatabaseToExcel();
|
||||
|
||||
// /api/config-ids - For getting all available config IDs
|
||||
|
||||
stopWatchTest.Stop();
|
||||
AddToActionsList("RunTime " + stopWatchTest.Elapsed.ToString(@"hh\:mm\:ss\.ff"));
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<Product>AiQ GUI</Product>
|
||||
<Authors>MAV Systems Ltd</Authors>
|
||||
<PackageId>AiQ GUI</PackageId>
|
||||
<Version>4.0.0</Version>
|
||||
<Version>4.2.0</Version>
|
||||
<Description>A GUI to control and test the AiQ</Description>
|
||||
<Copyright>MAV Systems Ltd 2025</Copyright>
|
||||
<PackageIcon>MAV - Plain - Blue.png</PackageIcon>
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace AiQ_GUI
|
||||
{
|
||||
string JSONdata = BuildJsonUpdate(jsonArrayData, ID);
|
||||
JSONdata = JSONdata.Replace("\"14\"", "14").Replace("\"30\"", "30"); // Fixes & encoding issue
|
||||
MainForm.Instance.AddToActionsList(JSONdata);
|
||||
string url = $"http://{IPAddress}/api/update-config";
|
||||
return await Network.SendHttpRequest(url, HttpMethod.Post, 2, JSONdata);
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ namespace AiQ_GUI
|
||||
{
|
||||
await HTTPReplySetup(context, "Update successful.", 200, "text/plain");
|
||||
}
|
||||
else if (fo.Id == "Internal Config")
|
||||
else if (fo.Id == "GLOBAL--FlexiApplication")
|
||||
{
|
||||
string SerialNumber = "";
|
||||
string ModelNumber = "";
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace AiQ_GUI
|
||||
}
|
||||
|
||||
// Build the MIME message with attachment
|
||||
using MailMessage mail = new MailMessage();
|
||||
using MailMessage mail = new();
|
||||
mail.From = new MailAddress("me");
|
||||
mail.To.Add("richard.porter@mav-systems.com");
|
||||
mail.To.Add("bradley.relyea@mav-systems.com");
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace AiQ_GUI
|
||||
{
|
||||
const string webhookUrl = "https://default71bd136a1c65418fb59e927135629c.ac.environment.api.powerplatform.com:443/powerautomate/automations/direct/workflows/b27c5192e83f4f48b20c1b115985b0b3/triggers/manual/paths/invoke/?api-version=1&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=1-eCbYXms6xInRKHwz3tgAcdQ9x7CSjl3Yzw2V_1MlA";
|
||||
|
||||
public static async Task SendMssg(string ApprovalRow, string User) // Sometimes You will need to reauthenticate the workflow
|
||||
public static async Task SendMssg(string ApprovalRow, string User) // Sometimes You will need to reauthenticate the workflow
|
||||
{
|
||||
using HttpClient client = new HttpClient();
|
||||
using HttpClient client = new();
|
||||
|
||||
string link = $"https://docs.google.com/spreadsheets/d/1bCcCr4OYqfjmydt6UqtmN4FQETezXmZRSStJdCCcqZM/edit#gid=1931079354&range=A{ApprovalRow}"; // Has to be parsed like this as teams doesnt hyperlink otherwise
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace AiQ_GUI
|
||||
};
|
||||
|
||||
string json = JsonConvert.SerializeObject(payload);
|
||||
StringContent content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
StringContent content = new(json, Encoding.UTF8, "application/json");
|
||||
|
||||
HttpResponseMessage response = await client.PostAsync(webhookUrl, content);
|
||||
}
|
||||
|
||||
17
Network.cs
17
Network.cs
@@ -1,7 +1,9 @@
|
||||
using System.Net;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace AiQ_GUI
|
||||
{
|
||||
@@ -10,7 +12,7 @@ namespace AiQ_GUI
|
||||
public static HttpClient? SingleHTTPClient;
|
||||
public static HttpClient Client => SingleHTTPClient ?? throw new InvalidOperationException("Client not initialized.");
|
||||
|
||||
public static void Initialize(string username, string password)
|
||||
public async static void Initialize(string username, string password)
|
||||
{
|
||||
HttpClientHandler handler = new()
|
||||
{
|
||||
@@ -23,6 +25,17 @@ namespace AiQ_GUI
|
||||
{
|
||||
Timeout = TimeSpan.FromSeconds(20)
|
||||
};
|
||||
|
||||
bool UP = false;
|
||||
int i = 0;
|
||||
|
||||
while (!UP)
|
||||
{
|
||||
UP = await PingIP("8.8.8.8");
|
||||
await Task.Delay(500);
|
||||
if (i >= 5) MainForm.Instance.AddToActionsList($"Could not initialise new network with USER: {username} & PSWD: {password}"); // Try 5 times max
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// Handles get and post to the camera API
|
||||
|
||||
Reference in New Issue
Block a user