Increment assembly version to 3.9.3097.1, add SlotGroupedLogin support in iPerlCommunicationForm, implement GroupedLoginSlot method in OptoHeadTest, and update slot operation logic with enhanced error messaging.

This commit is contained in:
2026-05-13 12:57:23 +02:00
parent d346dcfa03
commit 2526e997e3
25 changed files with 115 additions and 16 deletions
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("3.9.3095.1")] [assembly: AssemblyVersion("3.9.3097.1")]
[assembly: AssemblyFileVersion("3.9.3095.1")] [assembly: AssemblyFileVersion("3.9.3097.1")]
@@ -1260,6 +1260,80 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
return ex.Message; return ex.Message;
} }
} }
public BridgeComponents.GciBridge.Interfaces.PublicModels.GciFullLoginResult GroupedLoginSlot()
{
if (genesisHead != null && genesisHead.DebugLevel == DebugMode.Simulate)
{
log.Debug("Connect() - Simulated response");
return new BridgeComponents.GciBridge.Interfaces.PublicModels.GciFullLoginResult
{
SlotId = genesisHead.GetSlotNr,
Success = true,
Message = "Simulated Connect",
ConnectResult = null,
PcbResult = null,
PasswordResult = null,
SetPasswordResult = null,
LoginResult = null,
};
}
var gciFullLoginResult = Task.Run(() => GroupedLoginSlot_Async(genesisHead))
.GetAwaiter()
.GetResult();
return gciFullLoginResult;
}
public string GroupedLoginSlotStr()
{
if (genesisHead != null && genesisHead.DebugLevel == DebugMode.Simulate)
{
log.Debug("Connect() - Simulated response");
return "Simulated Connect";
}
var gciFullLoginResult = Task.Run(() => GroupedLoginSlot_Async(genesisHead))
.GetAwaiter()
.GetResult();
return gciFullLoginResult.Success ? ResultOk : ResultNok;
}
private async Task<BridgeComponents.GciBridge.Interfaces.PublicModels.GciFullLoginResult> GroupedLoginSlot_Async(GenesisSmartReader genesisSmartReader)
{
try
{
log.Debug("GroupedLoginSlot_Async called for iHead: " + genesisHead);
var gciFullLoginResult = new BridgeComponents.GciBridge.Interfaces.PublicModels.GciFullLoginResult()
{
Success = false,
};
if (genesisHead == null) return gciFullLoginResult;
if (string.IsNullOrEmpty(genesisHead.CommInterface)) return gciFullLoginResult;
if (genesisHead.CommInterfaceBridge == null) return gciFullLoginResult;
CancellationToken token = default;
log.Debug($"GroupedLoginSlot_Async( Slot: {genesisSmartReader.GetSlotNr}) - Start");
BridgeComponents.GciBridge.Interfaces.PublicModels.GciFullLoginResult connectFullPassLoginWithRetryAsync = await genesisSmartReader.CommInterfaceBridge.ConnectFullPassLoginWithRetryAsync(genesisSmartReader.GetSlotNr, token);
log.Debug($"GroupedLoginSlot_Async( Slot: {genesisSmartReader.GetSlotNr}) - Result: " + connectFullPassLoginWithRetryAsync);
return connectFullPassLoginWithRetryAsync;
}
catch (Exception ex)
{
log.Error($"GroupedLoginSlot_Async({genesisHead.GetSlotNr}) - Exception:", ex);
return new BridgeComponents.GciBridge.Interfaces.PublicModels.GciFullLoginResult()
{
Success = false,
Message = ex.Message
};
}
}
public string SetTestModeSlot() public string SetTestModeSlot()
{ {
@@ -1291,7 +1365,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
byte valueLed = (ledMode == LedState.active) ? (byte)6 : (byte)0; byte valueLed = (ledMode == LedState.active) ? (byte)6 : (byte)0;
log.Debug($"SetTestModeSlot_Async( Slot: {genesisSmartReader.GetSlotNr}) - Start - Set Led Mode: {valueLed}"); log.Debug($"SetTestModeSlot_Async( Slot: {genesisSmartReader.GetSlotNr}) - Start - Set Led Mode: {valueLed}");
var registerWriteResult = await gciBridge.WriteRegisterAsync(genesisSmartReader.GetSlotNr, RadioService.LedMode, valueLed, false, false, token); var registerWriteResult = await gciBridge.WriteRegisterWithRetryAsync(genesisSmartReader.GetSlotNr, RadioService.LedMode, valueLed, false, false, token);
if (registerWriteResult == null || !registerWriteResult.Success) if (registerWriteResult == null || !registerWriteResult.Success)
{ {
@@ -1342,7 +1416,7 @@ namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication
log.Debug( log.Debug(
$"SetActiveModeSlot_Async( Slot: {genesisSmartReader.GetSlotNr}) - Start - Set Led Mode: {valueLed}"); $"SetActiveModeSlot_Async( Slot: {genesisSmartReader.GetSlotNr}) - Start - Set Led Mode: {valueLed}");
var registerWriteResult = await gciBridge.WriteRegisterAsync(genesisSmartReader.GetSlotNr, var registerWriteResult = await gciBridge.WriteRegisterWithRetryAsync(genesisSmartReader.GetSlotNr,
RadioService.LedMode, valueLed, false, false, token); RadioService.LedMode, valueLed, false, false, token);
if (registerWriteResult == null || !registerWriteResult.Success) if (registerWriteResult == null || !registerWriteResult.Success)
@@ -57,6 +57,7 @@ namespace TBF.Rig.TestMethods.GenesisCommunication
retVal.Add(iPerlCommunicationForm.SlotPCBSlotStr); retVal.Add(iPerlCommunicationForm.SlotPCBSlotStr);
retVal.Add(iPerlCommunicationForm.SlotSetPasswordStr); retVal.Add(iPerlCommunicationForm.SlotSetPasswordStr);
retVal.Add(iPerlCommunicationForm.SlotLoginStr); retVal.Add(iPerlCommunicationForm.SlotLoginStr);
retVal.Add(iPerlCommunicationForm.SlotGroupedLoginStr);
retVal.Add(iPerlCommunicationForm.SlotSetTestModeStr); retVal.Add(iPerlCommunicationForm.SlotSetTestModeStr);
retVal.Add(iPerlCommunicationForm.SlotSetActiveModeStr); retVal.Add(iPerlCommunicationForm.SlotSetActiveModeStr);
retVal.Add(iPerlCommunicationForm.SlotDisconnectStr); retVal.Add(iPerlCommunicationForm.SlotDisconnectStr);
@@ -83,6 +83,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
public const string SlotPCBSlotStr = "PCB Slot"; public const string SlotPCBSlotStr = "PCB Slot";
public const string SlotSetPasswordStr = "Set Password"; public const string SlotSetPasswordStr = "Set Password";
public const string SlotLoginStr = "Login"; public const string SlotLoginStr = "Login";
public const string SlotGroupedLoginStr = "Login (Combined workflow)";
public const string SlotSetTestModeStr = "Switch to Test Mode"; public const string SlotSetTestModeStr = "Switch to Test Mode";
public const string SlotSetActiveModeStr ="Switch to Active Mode"; public const string SlotSetActiveModeStr ="Switch to Active Mode";
public const string SlotDisconnectStr = "Disconnect Slot"; public const string SlotDisconnectStr = "Disconnect Slot";
@@ -752,6 +753,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
else if (currentActivity.ToLower().Equals(SlotPCBSlotStr.ToLower())) error = SlotPCBSlot(threadID, ihead, ref resultStr); else if (currentActivity.ToLower().Equals(SlotPCBSlotStr.ToLower())) error = SlotPCBSlot(threadID, ihead, ref resultStr);
else if (currentActivity.ToLower().Equals(SlotSetPasswordStr.ToLower())) error = SlotSetPassword(threadID, ihead, ref resultStr); else if (currentActivity.ToLower().Equals(SlotSetPasswordStr.ToLower())) error = SlotSetPassword(threadID, ihead, ref resultStr);
else if (currentActivity.ToLower().Equals(SlotLoginStr.ToLower())) error = SlotLogin(threadID, ihead, ref resultStr); else if (currentActivity.ToLower().Equals(SlotLoginStr.ToLower())) error = SlotLogin(threadID, ihead, ref resultStr);
else if (currentActivity.ToLower().Equals(SlotGroupedLoginStr.ToLower())) error = SlotGroupedLogin(threadID, ihead, ref resultStr);
else if (currentActivity.ToLower().Equals(SlotSetTestModeStr.ToLower())) error = SlotSetTestMode(threadID, ihead, ref resultStr); else if (currentActivity.ToLower().Equals(SlotSetTestModeStr.ToLower())) error = SlotSetTestMode(threadID, ihead, ref resultStr);
else if (currentActivity.ToLower().Equals(SlotSetActiveModeStr.ToLower())) error = SlotSetActiveMode(threadID, ihead, ref resultStr); else if (currentActivity.ToLower().Equals(SlotSetActiveModeStr.ToLower())) error = SlotSetActiveMode(threadID, ihead, ref resultStr);
else if (currentActivity.ToLower().Equals(SlotDisconnectStr.ToLower())) error = SlotDisconnect(threadID, ihead, ref resultStr); else if (currentActivity.ToLower().Equals(SlotDisconnectStr.ToLower())) error = SlotDisconnect(threadID, ihead, ref resultStr);
@@ -853,6 +855,28 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
} }
} }
private CommErr SlotGroupedLogin(int threadId, GenesisSmartReader iHead, ref string resultStr)
{
CommErr error = CommErr.FailedLogin;
var gciFullLoginResult = iHead.OptoHeadTest.GroupedLoginSlot();
if (gciFullLoginResult.Success)
{
log.Debug("SlotLogin successful");
resultStr = string.Format($"Login OK - Serial No: {gciFullLoginResult?.PcbResult?.Result?.PcbId}");
iHead.SerialNr = gciFullLoginResult?.PcbResult?.Result?.PcbId;
if (iHead.ConfigStruct != null)
{
iHead.ConfigStruct.PCBNumberString = gciFullLoginResult?.PcbResult?.Result?.PcbId;
}
error = CommErr.None;
}
else
{
resultStr = "Failed Combined Login";
}
return error;
}
private CommErr SlotDisconnect(int threadId, GenesisSmartReader iHead, ref string resultStr) private CommErr SlotDisconnect(int threadId, GenesisSmartReader iHead, ref string resultStr)
{ {
CommErr error = CommErr.FailedSetActiveMode; CommErr error = CommErr.FailedSetActiveMode;
@@ -894,12 +918,12 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
if (!string.IsNullOrEmpty(resultStr) && resultStr.Equals(TBF.Rig.RegisterReaders.GenesisRegReader.communication.OptoHeadTest.ResultOk)) if (!string.IsNullOrEmpty(resultStr) && resultStr.Equals(TBF.Rig.RegisterReaders.GenesisRegReader.communication.OptoHeadTest.ResultOk))
{ {
log.Debug("SlotSetTestMode successful"); log.Debug("SlotSetTestMode successful");
resultStr = string.Format($"Serial No: {resultStr}"); resultStr = string.Format($"SlotSetTestMode: {resultStr}");
error = CommErr.None; error = CommErr.None;
} }
else else
{ {
resultStr = "Failed Read Serial No"; resultStr = "Failed Set Test Mode";
} }
return error; return error;
} }
@@ -911,12 +935,12 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
if (!string.IsNullOrEmpty(resultStr) && resultStr.Equals(TBF.Rig.RegisterReaders.GenesisRegReader.communication.OptoHeadTest.ResultOk)) if (!string.IsNullOrEmpty(resultStr) && resultStr.Equals(TBF.Rig.RegisterReaders.GenesisRegReader.communication.OptoHeadTest.ResultOk))
{ {
log.Debug("SlotLogin successful"); log.Debug("SlotLogin successful");
resultStr = string.Format($"Serial No: {resultStr}"); resultStr = string.Format($"SlotLogin: {resultStr}");
error = CommErr.None; error = CommErr.None;
} }
else else
{ {
resultStr = "Failed Read Serial No"; resultStr = "Failed SlotLogin";
} }
return error; return error;
} }
@@ -928,7 +952,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
if (!string.IsNullOrEmpty(resultStr) && resultStr.Equals(TBF.Rig.RegisterReaders.GenesisRegReader.communication.OptoHeadTest.ResultOk)) if (!string.IsNullOrEmpty(resultStr) && resultStr.Equals(TBF.Rig.RegisterReaders.GenesisRegReader.communication.OptoHeadTest.ResultOk))
{ {
log.Debug("SlotSetPassword successful"); log.Debug("SlotSetPassword successful");
resultStr = string.Format($"Serial No: {resultStr}"); resultStr = string.Format($"SlotSetPassword: {resultStr}");
error = CommErr.None; error = CommErr.None;
} }
else else
@@ -944,13 +968,13 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
PcbReadResult pcbReadSlot = iHead.OptoHeadTest.PCB_ReadSlot(); PcbReadResult pcbReadSlot = iHead.OptoHeadTest.PCB_ReadSlot();
if (pcbReadSlot.Success) if (pcbReadSlot.Success)
{ {
log.Debug("SlotSetPassword successful"); log.Debug("SlotPCBSlot successful");
resultStr = string.Format($"Serial No: {pcbReadSlot.PcbId}"); resultStr = string.Format($"SlotPCBSlot: {pcbReadSlot.PcbId}");
error = CommErr.None; error = CommErr.None;
} }
else else
{ {
resultStr = "Failed Read Serial No"; resultStr = "Failed SlotPCBSlot";
} }
return error; return error;
} }
@@ -961,8 +985,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
resultStr = iHead.OptoHeadTest.ConnectSlot(); resultStr = iHead.OptoHeadTest.ConnectSlot();
if (!string.IsNullOrEmpty(resultStr)) if (!string.IsNullOrEmpty(resultStr))
{ {
log.Debug("SlotSetPassword successful"); log.Debug("SlotConnect successful");
resultStr = string.Format($"Serial No: {resultStr}"); resultStr = string.Format($"SlotConnect: {resultStr}");
error = CommErr.None; error = CommErr.None;
} }
else else
@@ -984,8 +1008,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
resultStr = iHead.OptoHeadTest.InitialiseSlot(); resultStr = iHead.OptoHeadTest.InitialiseSlot();
if (!string.IsNullOrEmpty(resultStr)) if (!string.IsNullOrEmpty(resultStr))
{ {
log.Debug("SlotSetPassword successful"); log.Debug("SlotInitialize successful");
resultStr = string.Format($"Serial No: {resultStr}"); resultStr = string.Format($"SlotInitialize: {resultStr}");
error = CommErr.None; error = CommErr.None;
} }
else else
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.