• Camera/LED.cs
• Added null-checks so labels are created dynamically when lblVorI is null (uses MainForm.Instance.AddLabelToPanel). • Camera/CameraModules.cs • Added null-label handling to create dynamic module labels with the correct content (OK or the error message). • AiQ_GUI.cs • Increased dynamic label width in MakeNewLabel from 220 → 700 to avoid truncated messages. • Succesfully ran through a pre-test with dynamic labels
This commit is contained in:
@@ -24,36 +24,39 @@ public static class MobilePreTest
|
||||
string token = await LoginAsync(client, "ADMIN", "1234");
|
||||
|
||||
// Attach JWT to all requests
|
||||
client.DefaultRequestHeaders.Authorization =
|
||||
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
|
||||
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
|
||||
|
||||
// Request firmware information
|
||||
HttpResponseMessage response =
|
||||
await client.GetAsync("/app/v1/system/firmware");
|
||||
HttpResponseMessage response = await client.GetAsync("/app/v1/system/firmware");
|
||||
|
||||
string body = await response.Content.ReadAsStringAsync();
|
||||
|
||||
MainForm.Instance.AddToActionsList(
|
||||
$"Firmware check response: {(int)response.StatusCode} {response.StatusCode} | {body}",
|
||||
Level.LOG);
|
||||
MainForm.Instance.AddToActionsList($"Firmware check response: {(int)response.StatusCode} {response.StatusCode} | {body}",Level.LOG);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
JsonElement json =
|
||||
JsonSerializer.Deserialize<JsonElement>(body);
|
||||
JsonElement json = JsonSerializer.Deserialize<JsonElement>(body);
|
||||
|
||||
string version =
|
||||
json.GetProperty("version").GetString();
|
||||
string version = json.GetProperty("version").GetString()?.Trim();
|
||||
|
||||
MainForm.Instance.AddToActionsList(
|
||||
$"Current firmware version: {version}",
|
||||
Level.Success);
|
||||
|
||||
// Compare against expected SRZFirmware from UniversalData
|
||||
if (string.IsNullOrEmpty(UniversalData.SRZFirmware))
|
||||
{
|
||||
MainForm.Instance.AddToActionsList($"Firmware check failed: Expected SRZFirmware not loaded in UniversalData",Level.ERROR);
|
||||
}
|
||||
else if (version == UniversalData.SRZFirmware)
|
||||
{
|
||||
MainForm.Instance.AddToActionsList($"Firmware match successful: {version}",Level.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainForm.Instance.AddToActionsList($"Firmware mismatch: Camera has {version}, expected {UniversalData.SRZFirmware}",Level.ERROR);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MainForm.Instance.AddToActionsList(
|
||||
$"Firmware check failed: {ex.Message}",
|
||||
Level.ERROR);
|
||||
MainForm.Instance.AddToActionsList($"Firmware check failed: {ex.Message}",Level.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,13 +68,11 @@ public static class MobilePreTest
|
||||
userPassword = Sha256(password)
|
||||
};
|
||||
|
||||
HttpResponseMessage response =
|
||||
await client.PostAsJsonAsync("/app/v1/login", payload);
|
||||
HttpResponseMessage response = await client.PostAsJsonAsync("/app/v1/login", payload);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
JsonElement json =
|
||||
await response.Content.ReadFromJsonAsync<JsonElement>();
|
||||
JsonElement json = await response.Content.ReadFromJsonAsync<JsonElement>();
|
||||
|
||||
return json.GetProperty("token").GetString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user