iPERL comm. (Set Active Mode) after saving results and deleting disabled WMs from the Batch fixed, ver. 2.25.1416

This commit is contained in:
Milan Hanajik 2020-02-12 09:15:29 +01:00
parent 09ccc282a5
commit e28b94c367
2 changed files with 31 additions and 13 deletions

View File

@ -792,7 +792,19 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if ((ihead.Group == group) && (threadIx < muxBrdOrGroup14Nrs.Count) && (ihead.MuxBoardNrOrGroup14 == muxBrdOrGroup14Nrs[threadIx]))
{
wmFound = true;
Results.Entities.WaterMeter wm = ProcessData.BatchRslts.Batch.WaterMeters[waterMeterPositions0[wmNr0]];
Results.Entities.WaterMeter wm = null;
if (ProcessData.BatchRslts.Batch.WaterMeters != null)
{
foreach (var w in ProcessData.BatchRslts.Batch.WaterMeters)
{
if (w.WMPosition == wmNr0 + 1)
{
wm = w;
break;
}
}
}
CommErr error;
string resultStr = string.Empty;
@ -801,11 +813,14 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// RFID communication activity call
///
if ((ihead == null) || ihead.Disabled || !ckbState[wmNr0]) error = CommErr.HeadDisabledByUser;
else if (wm == null) error = CommErr.CommFailed;
#if IPERL
else if (currentActivity.ToLower().Contains(SetTestModeStr.ToLower())) error = SetTestMode(threadID, ihead, ref resultStr);
else if (currentActivity.ToLower().Equals(SetActiveModeStr.ToLower())) error = SetActiveMode(threadID, ihead, ref resultStr);
///
/// RFID communication functions below require a reference to water meter entity (wm != null)
///
else if (wm == null) error = CommErr.CommFailed;
else if (currentActivity.ToLower().Contains(ReadConfigurationStr.ToLower())) error = ReadConfiguration(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Contains(SetTestModeStr.ToLower())) error = SetTestMode(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Equals(SetActiveModeStr.ToLower())) error = SetActiveMode(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Equals(ReadCalibrationStr.ToLower())) error = ReadCalibration(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Equals(ReadCalibrationV4Str.ToLower())) error = ReadCalibrationV4(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Contains(WriteCalibrationFactorStr.ToLower())) error = WriteCalibrationFactor(threadID, ihead, wm, ref resultStr);
@ -903,8 +918,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// <summary>
/// Read a complete configuration structure of the watermeter
/// </summary>
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <param name="threadId">Thread ID passed to RFID communication functions</param>
/// <param name="ihead">iPERL head object</param>
/// <param name="wm">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr ReadConfiguration(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
@ -955,10 +972,11 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// whether the testModeConfig is correctly set, if necessary it is changed to the specified value.
/// Read a part of configuration afterwards to verify the mode was set correctly.
/// </summary>
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <param name="threadId">Thread ID passed to RFID communication functions</param>
/// <param name="ihead">iPERL head object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr SetTestMode(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
static CommErr SetTestMode(int threadId, IperlHead ihead, ref string resultStr)
{
if (ihead.CommFailed || ihead.ConfigStruct == null) return CommErr.CommFailed;
@ -1084,10 +1102,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// Set the watermeter to the active mode.
/// Read a part of configuration afterwards to verify the mode was set correctly.
/// </summary>
/// <param name="ihead">Water meter object</param>
/// <param name="ihead">iPERL head object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr SetActiveMode(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
static CommErr SetActiveMode(int threadId, IperlHead ihead, ref string resultStr)
{
if (OpenPort(threadId, ihead) != 0) return CommErr.OpenPort; /// Open RFID port

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.25.1414.0")]
[assembly: AssemblyFileVersion("2.25.1414.0")]
[assembly: AssemblyVersion("2.25.1416.0")]
[assembly: AssemblyFileVersion("2.25.1416.0")]