'Counter' value added to opto data logging, version 1.6.154.
This commit is contained in:
@@ -10,6 +10,7 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
||||
public OptoTelegramFlags flags;
|
||||
|
||||
public DateTime DateTime;
|
||||
public int Counter;
|
||||
|
||||
public UInt32 EmfRaw;
|
||||
public Int16 MagneticField;
|
||||
@@ -27,12 +28,12 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
||||
{
|
||||
if (flags == OptoTelegramFlags.OK)
|
||||
{
|
||||
return string.Format("{0}:{1}:{2}.{3}\t{4}:\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}",
|
||||
return string.Format("{0}:{1}:{2}.{3}\t{4} :\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}",
|
||||
DateTime.Hour.ToString("D2"),
|
||||
DateTime.Minute.ToString("D2"),
|
||||
DateTime.Second.ToString("D2"),
|
||||
DateTime.Millisecond.ToString("D3"),
|
||||
0,
|
||||
Counter,
|
||||
EmfRaw.ToString("X6"),
|
||||
MagneticField.ToString("X4"),
|
||||
FlowRaw.ToString("X4"),
|
||||
@@ -83,9 +84,10 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
||||
/// </description>
|
||||
/// <param name="data">A complete byte array data</param>
|
||||
/// <returns>ConfigStruct or null when byte array was not complete</returns>
|
||||
public bool UpdateFromString(string telegram)
|
||||
public bool UpdateFromString(string telegram, int counter)
|
||||
{
|
||||
DateTime = DateTime.Now;
|
||||
Counter = counter;
|
||||
|
||||
if ((telegram == null) || (telegram.Length < Length) ||
|
||||
(telegram[6] != '\t') || (telegram[11] != '\t') || (telegram[16] != '\t') ||
|
||||
@@ -107,11 +109,11 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
||||
}
|
||||
|
||||
|
||||
public static OptoTelegramRaw FromString(string telegram)
|
||||
public static OptoTelegramRaw FromString(string telegram, int counter)
|
||||
{
|
||||
OptoTelegramRaw opto = new OptoTelegramRaw();
|
||||
|
||||
if (opto.UpdateFromString(telegram))
|
||||
if (opto.UpdateFromString(telegram, counter))
|
||||
{
|
||||
return opto;
|
||||
}
|
||||
|
||||
@@ -592,12 +592,13 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
if (synchronized)
|
||||
{
|
||||
optoData[optoDataCount].Counter = optoDataCount;
|
||||
optoData[optoDataCount++].SetFlags(OptoTelegramFlags.SyncError);
|
||||
}
|
||||
synchronized = true;
|
||||
}
|
||||
// CR+LF found and (pos >= OptoTelegramRaw.Length - 2)
|
||||
else if (optoData[optoDataCount].UpdateFromString(allRcvd.Substring(pos - OptoTelegramRaw.Length + 2)))
|
||||
else if (optoData[optoDataCount].UpdateFromString(allRcvd.Substring(pos - OptoTelegramRaw.Length + 2), optoDataCount))
|
||||
{
|
||||
OptoTelegramRreceived(optoData[optoDataCount++], synchronized2);
|
||||
synchronized2 = synchronized;
|
||||
@@ -605,6 +606,7 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
||||
}
|
||||
else
|
||||
{
|
||||
optoData[optoDataCount].Counter = optoDataCount;
|
||||
optoData[optoDataCount++].SetFlags(OptoTelegramFlags.InvalidTelegram);
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
}
|
||||
@@ -618,7 +620,7 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
||||
synchronized = true;
|
||||
}
|
||||
// CR+LF found and (pos >= OptoTelegram.Length - 2)
|
||||
else if (toBeFlushed.UpdateFromString(allRcvd.Substring(pos - OptoTelegramRaw.Length + 2)))
|
||||
else if (toBeFlushed.UpdateFromString(allRcvd.Substring(pos - OptoTelegramRaw.Length + 2), 0))
|
||||
{
|
||||
flushedDataCount++;
|
||||
synchronized2 = synchronized;
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.6.153.1")]
|
||||
[assembly: AssemblyFileVersion("1.6.153.1")]
|
||||
[assembly: AssemblyVersion("1.6.154.1")]
|
||||
[assembly: AssemblyFileVersion("1.6.154.1")]
|
||||
|
||||
Reference in New Issue
Block a user