Long time no commit
This commit is contained in:
@@ -52,6 +52,39 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DocumentationFile>bin\x86\Debug\Xylem.Common.Hardware.Interfaces.Ports.PortCore.xml</DocumentationFile>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == '_MANUAL_CONTROL|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\_MANUAL_CONTROL\</OutputPath>
|
||||
<DefineConstants>CODE_ANALYSIS;CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DocumentationFile>bin\x86\Debug\Xylem.Common.Hardware.Interfaces.Ports.PortCore.xml</DocumentationFile>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\..\..\.shared\SharedAssemblyInfo.cs">
|
||||
<Link>Properties\SharedAssemblyInfo.cs</Link>
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
|
||||
{
|
||||
|
||||
private ILogger _byteDataLogger;
|
||||
private ILogger _asciiDataLogger;
|
||||
internal ILogger _asciiDataLogger;
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual event EventHandler<BasePortDataEventArgs> OnRawRecordReceived;
|
||||
@@ -75,7 +75,7 @@ namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
|
||||
/// e.g. "Slot:1, Port:COM4, Protocol:Request, Type:IrDA -"
|
||||
/// </summary>
|
||||
public String Ident;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ctor for SerialComPort with and full constructed <see cref="T:System.IO.Ports.SerialPort" /> properties
|
||||
/// </summary>
|
||||
@@ -94,7 +94,7 @@ namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
|
||||
|
||||
//assign thread to loop
|
||||
_receiveThread = new Thread(ReadingThreadLoop) { Name = $"{Ident} Reading thread" };
|
||||
|
||||
|
||||
_asciiDataLogger = NLogHelper.CreateOrGetMultiLogger(Ident, "", "LedRawData", "TargetLedRawDataBase", "LedRawDataBase");
|
||||
_byteDataLogger = NLogHelper.CreateOrGetMultiLogger(Ident, "", "UartSerialPort", "COMBase", "BaseSerialPort");
|
||||
}
|
||||
@@ -310,40 +310,40 @@ namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
//not in test bench situation only for temp logging
|
||||
if (syncMarkRecord == SyncMarkRecord.FlushBuffer)
|
||||
{
|
||||
FlushBuffer();
|
||||
return;
|
||||
}
|
||||
//DecodeEveryPackage is ongoing and SkipDecoding is requested = do nothing
|
||||
if (_syncMarkRecord == SyncMarkRecord.DecodeEveryPackage &&
|
||||
syncMarkRecord == SyncMarkRecord.SkipDecoding)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//deny intermediate record when a start or end record is requested
|
||||
if (syncMarkRecord == SyncMarkRecord.DecodeIntermediate &&
|
||||
(_syncMarkRecord == SyncMarkRecord.SyncEnd ||
|
||||
_syncMarkRecord == SyncMarkRecord.SyncStart))
|
||||
{
|
||||
return;
|
||||
}
|
||||
//being able to detect the first incoming record after a sync is requested, the buffer is going to be flushed
|
||||
//if the measurement will be started or stopped
|
||||
if (syncMarkRecord == SyncMarkRecord.SyncEnd ||
|
||||
syncMarkRecord == SyncMarkRecord.SyncStart ||
|
||||
syncMarkRecord == SyncMarkRecord.DecodeIntermediate)
|
||||
{
|
||||
FlushBuffer();
|
||||
}
|
||||
|
||||
_byteDataLogger.Info($"{Ident} Mark next incoming record as {syncMarkRecord} (was {_syncMarkRecord})");
|
||||
_syncMarkRecord = syncMarkRecord;
|
||||
|
||||
|
||||
|
||||
//not in test bench situation only for temp logging
|
||||
if (syncMarkRecord == SyncMarkRecord.FlushBuffer)
|
||||
{
|
||||
FlushBuffer();
|
||||
return;
|
||||
}
|
||||
//DecodeEveryPackage is ongoing and SkipDecoding is requested = do nothing
|
||||
if (_syncMarkRecord == SyncMarkRecord.DecodeEveryPackage &&
|
||||
syncMarkRecord == SyncMarkRecord.SkipDecoding)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//deny intermediate record when a start or end record is requested
|
||||
if (syncMarkRecord == SyncMarkRecord.DecodeIntermediate &&
|
||||
(_syncMarkRecord == SyncMarkRecord.SyncEnd ||
|
||||
_syncMarkRecord == SyncMarkRecord.SyncStart))
|
||||
{
|
||||
return;
|
||||
}
|
||||
//being able to detect the first incoming record after a sync is requested, the buffer is going to be flushed
|
||||
//if the measurement will be started or stopped
|
||||
if (syncMarkRecord == SyncMarkRecord.SyncEnd ||
|
||||
syncMarkRecord == SyncMarkRecord.SyncStart ||
|
||||
syncMarkRecord == SyncMarkRecord.DecodeIntermediate)
|
||||
{
|
||||
FlushBuffer();
|
||||
}
|
||||
|
||||
_byteDataLogger.Info($"{Ident} Mark next incoming record as {syncMarkRecord} (was {_syncMarkRecord})");
|
||||
_syncMarkRecord = syncMarkRecord;
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -650,6 +650,9 @@ namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
|
||||
}
|
||||
}
|
||||
_serialPort.Write(txByteList.ToArray(), 0, txByteList.Count);
|
||||
|
||||
_serialPort.BaseStream.Flush();
|
||||
|
||||
OnRawRecordSendOut?.Invoke(this, new ListBytePortDataEventArgs(txByteList, DateTimeOffset.UtcNow));
|
||||
|
||||
}
|
||||
|
||||
@@ -26,14 +26,17 @@ namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
|
||||
{
|
||||
//send wake up burst with two 0xF0 byte
|
||||
//var wakeUpBurst = new Byte[] { 0xF0, 0xF0 };
|
||||
var wakeUpBurst = new Byte[] { 0x01, 0x01, 0x01, 0x01 };
|
||||
var wakeUpBurst = new Byte[] { 0x01, 0x01, 0x01, 0x01, };
|
||||
var delayPattern = new Byte[] { 0x0F, 0x0F, 0x0F, 0x0F , 0x0F, 0x0F, 0x0F, 0x0F };
|
||||
PhysicalWrite(wakeUpBurst);
|
||||
|
||||
//delay at least 1ms
|
||||
Thread.Sleep(1);
|
||||
//delay at least 500 µs with 0f *8
|
||||
//PhysicalWrite(delayPattern);
|
||||
//Thread.Sleep(1);
|
||||
|
||||
|
||||
//send the IrDA record
|
||||
PhysicalWrite(tx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO.Ports;
|
||||
using NLog;
|
||||
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
|
||||
|
||||
namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
|
||||
@@ -17,5 +18,11 @@ namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
|
||||
{
|
||||
throw new NotSupportedException("Led port does not support writing");
|
||||
}
|
||||
|
||||
public ILogger GetRawLogger()
|
||||
{
|
||||
return _asciiDataLogger;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user