V4.7
This commit is contained in:
@@ -174,13 +174,13 @@ namespace AiQ_GUI
|
||||
// Treat "operation was canceled" as a successful apply
|
||||
if (response.Contains("The operation was canceled", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Logging.LogMessage($"SetVaxtorMinMaxPlate: Camera applied config but closed connection early (safe to ignore).{Level.WARNING}");
|
||||
Logging.LogMessage($"SetVaxtorMinMaxPlate: Camera applied config but closed connection early (safe to ignore).");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (response.Contains("error", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
MainForm.Instance.DisplayQuestion($"SetVaxtorMinMaxPlate: failed - Please set manually{Level.WARNING}");
|
||||
MainForm.Instance.DisplayQuestion($"SetVaxtorMinMaxPlate: failed - Please set manually");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -188,23 +188,11 @@ namespace AiQ_GUI
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MainForm.Instance.AddToActionsList($"Could not set Vaxtor Plate height and min confidence: {ex.Message}{Level.ERROR}");
|
||||
MainForm.Instance.AddToActionsList($"Could not set Vaxtor Plate height and min confidence: {ex.Message}", Level.ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task GPSFix(string IPAddress)
|
||||
{
|
||||
string sysstatus = await APIHTTPRequest("/sysstatus", IPAddress, 5);
|
||||
SysStatus status = JsonConvert.DeserializeObject<SysStatus>(sysstatus);
|
||||
|
||||
if (status.gpsState == 0 || status.gpsPresent == "Not Fitted")
|
||||
{
|
||||
MainForm.Instance.AddToActionsList($"GPS not present in camera. State: {status.gpsState} & Status: {status.gpsPresent}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task SetTrim(string IPAddress, string LblTxt, int RetryCount = 0) // Sets trim by getting plate postion as metric
|
||||
{
|
||||
Trim trim;
|
||||
@@ -254,7 +242,7 @@ namespace AiQ_GUI
|
||||
}
|
||||
else // Ask user to centre the plate in the field of view
|
||||
{
|
||||
await MainForm.Instance.DisplayOK($"Please centralise plate in view THEN press OK {Level.WARNING}"); // Awaited till OK has been clicked
|
||||
await MainForm.Instance.DisplayOK($"Please centralise plate in view THEN press OK"); // Awaited till OK has been clicked
|
||||
|
||||
if (RetryCount >= 3)
|
||||
{
|
||||
|
||||
@@ -11,20 +11,22 @@ namespace AiQ_GUI
|
||||
const string SAFsalt = "F7W?wbD#'[+:v44]tA<:_iK4hQ}+$R{U";
|
||||
const string Streamsalt = "*;5WPsR5i/$8s1I(M)K5=z3fms{_8x4U";
|
||||
const string Auditsalt = "4t5e[E06:dXWf:C09Z[h)}V*n>}t0POP";
|
||||
const string XMLsalt = "ap(r]oN?t V@WvI=IX=[+$n(<5J,&Ygd";
|
||||
const string PasswordSalt = "eP@4^4T2@e@^h12oqf!590";
|
||||
|
||||
// Generates the license response based on the challenge and type of license
|
||||
public static string GenerateLicCode(string challenge, string Type)
|
||||
{
|
||||
string salt; // Different salts for differnet licenses
|
||||
string? salt = Type switch
|
||||
{
|
||||
"Store & Forward" => SAFsalt,
|
||||
"Streaming" => Streamsalt,
|
||||
"Audit" => Auditsalt,
|
||||
"XML Server" => XMLsalt,
|
||||
_ => null
|
||||
};
|
||||
|
||||
if (Type == "Store & Forward")
|
||||
salt = SAFsalt;
|
||||
else if (Type == "Streaming")
|
||||
salt = Streamsalt;
|
||||
else if (Type == "Audit")
|
||||
salt = Auditsalt;
|
||||
else
|
||||
if (salt == null)
|
||||
return $"Unrecognised challenge type:{Level.ERROR}" + Type;
|
||||
|
||||
if (string.IsNullOrEmpty(challenge) || challenge.Length != 6) // Check challenge format
|
||||
|
||||
@@ -323,7 +323,7 @@ namespace AiQ_GUI
|
||||
|
||||
if (checkDevice.Result.Trim() != "OK") // Device not found
|
||||
{
|
||||
MainForm.Instance.AddToActionsList($"Block device {device} not found. {Level.WARNING}");
|
||||
MainForm.Instance.AddToActionsList($"Block device {device} not found.", Level.WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ namespace AiQ_GUI
|
||||
|
||||
if (checkDevice.Result.Trim().Length > 1) // Device not found
|
||||
{
|
||||
MainForm.Instance.AddToActionsList($"Cannot sync files to disk. Replied: {checkDevice.Result}. DO NOT TURN OFF, GET SUPERVISOR {Level.ERROR}");
|
||||
MainForm.Instance.AddToActionsList($"Cannot sync files to disk. Replied: {checkDevice.Result}. DO NOT TURN OFF, GET SUPERVISOR", Level.ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -387,7 +387,33 @@ namespace AiQ_GUI
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MainForm.Instance.AddToActionsList($"Cannot sync becuase: {ex.Message}. DO NOT TURN OFF, GET SUPERVISOR {Level.ERROR}");
|
||||
MainForm.Instance.AddToActionsList($"Cannot sync becuase: {ex.Message}. DO NOT TURN OFF, GET SUPERVISOR", Level.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetTo115200(string IPAddress)
|
||||
{
|
||||
try
|
||||
{
|
||||
string Cmd = "sudo sh -c \"stty -F /dev/ttyInfrared 9600 cs8 -cstopb -parenb -ixon -ixoff -crtscts -icanon -echo -opost; echo '81 01 04 01 03 FF' | xxd -r -p > /dev/ttyInfrared\"";
|
||||
SshClient client = SshConnect(IPAddress);
|
||||
|
||||
SshCommand checkDevice = client.RunCommand(Cmd);
|
||||
if (!string.IsNullOrWhiteSpace(checkDevice.Error))
|
||||
throw new Exception(checkDevice.Error);
|
||||
|
||||
Cmd = Cmd.Replace("Infrared", "Colour");
|
||||
|
||||
checkDevice = client.RunCommand(Cmd);
|
||||
if (!string.IsNullOrWhiteSpace(checkDevice.Error))
|
||||
throw new Exception(checkDevice.Error);
|
||||
|
||||
client.Disconnect();
|
||||
client.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MainForm.Instance.AddToActionsList($"Cannot set cameras to 115200 becuase: {ex.Message}", Level.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -399,4 +425,4 @@ namespace AiQ_GUI
|
||||
public string FilesystemSize { get; set; } = string.Empty;
|
||||
public bool tailscale { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user