Skip to content

Commit fdf384b

Browse files
ZacharyWalsh57Zack Walsh
authored andcommitted
Changed logic for building responses
Removed calls to write empty content if no values are found for responses.
1 parent 4f3a4e6 commit fdf384b

6 files changed

Lines changed: 31 additions & 15 deletions

File tree

SharpAutoId/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
[assembly: Guid("73552094-035A-4DFB-BEC4-5116EC7993EF")]
2020

2121
// Version information
22-
[assembly: AssemblyVersion("0.4.4.153")]
23-
[assembly: AssemblyFileVersion("0.4.4.153")]
22+
[assembly: AssemblyVersion("0.4.4.156")]
23+
[assembly: AssemblyFileVersion("0.4.4.156")]
2424
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
2525

SharpExpressions/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
[assembly: Guid("73552094-035A-4DFB-BEC4-5116EC7993EF")]
2020

2121
// Version information
22-
[assembly: AssemblyVersion("0.5.15.392")]
23-
[assembly: AssemblyFileVersion("0.5.15.392")]
22+
[assembly: AssemblyVersion("0.5.15.395")]
23+
[assembly: AssemblyFileVersion("0.5.15.395")]
2424
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
2525

SharpPipes/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
[assembly: Guid("73552094-035A-4DFB-BEC4-5116EC7993EF")]
2020

2121
// Version information
22-
[assembly: AssemblyVersion("0.2.4.48")]
23-
[assembly: AssemblyFileVersion("0.2.4.48")]
22+
[assembly: AssemblyVersion("0.2.4.50")]
23+
[assembly: AssemblyFileVersion("0.2.4.50")]
2424
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
2525

SharpSimulator/PassThruSimulationPlayer.cs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,11 @@ private void _processSimulationMessages()
683683
}
684684

685685
// If no message was found for the given input, move onto the next one
686-
if (IndexOfMessageFound == -1) continue;
686+
if (IndexOfMessageFound == -1 || IndexOfMessageSet == -1) continue;
687+
688+
// If no responses exist for the given input, move onto the next message
689+
var MessagesToSend = this.PairedSimulationMessages[IndexOfMessageSet][IndexOfMessageFound];
690+
if (MessagesToSend.MessageResponses.Length == 0) continue;
687691

688692
// Mark a new channel is needed and build new one for configuration of messages
689693
try
@@ -749,8 +753,8 @@ private bool _generateResponseChannel(int IndexOfMessageSet, int IndexOfMessageF
749753
var ProtocolValue = this.ChannelProtocols[IndexOfMessageSet];
750754
var FiltersToApply = this.ChannelFilters[IndexOfMessageSet];
751755

752-
// Find our message contents and pick what filters we're looking to apply
753-
var PulledMessages = this.PairedSimulationMessages[IndexOfMessageSet][IndexOfMessageFound];
756+
// Once we know there's messages for us to send back, we do so now
757+
var PulledMessages = this.PairedSimulationMessages[IndexOfMessageSet][IndexOfMessageFound];
754758
var FilterFlowCtl = PulledMessages.MessageResponses.FirstOrDefault(MsgObj => MsgObj.RxStatus == 0).DataToHexString();
755759
bool CanMatchFilter = FiltersToApply.Any(FilterObj => string.IsNullOrWhiteSpace(FilterFlowCtl) || FilterFlowCtl.Contains(FilterObj.FilterFlowCtl));
756760

@@ -762,7 +766,11 @@ private bool _generateResponseChannel(int IndexOfMessageSet, int IndexOfMessageF
762766
if (CanMatchFilter && !FilterFlowCtl.Contains(ChannelFilter.FilterFlowCtl)) continue;
763767

764768
// Try and set each filter for the channel. Skip duplicate filters
765-
try { this.PhysicalChannel.StartMessageFilter(ChannelFilter); }
769+
try
770+
{
771+
this.PhysicalChannel.StartMessageFilter(ChannelFilter);
772+
this._simPlayingLogger.WriteLog($"Started Filter: {ChannelFilter.FilterMask} | {ChannelFilter.FilterPattern} | {ChannelFilter.FilterFlowCtl}", LogType.ErrorLog);
773+
}
766774
catch
767775
{
768776
// Log out what our duplicate/invalid filter was
@@ -783,8 +791,12 @@ private bool _generateResponseChannel(int IndexOfMessageSet, int IndexOfMessageF
783791
private bool _generateSimulationResponses(int IndexOfMessageSet, int IndexOfMessageFound)
784792
{
785793
// Pull out the message set, then find the response messages and send them out
794+
this._simPlayingLogger.WriteLog(string.Join("", Enumerable.Repeat("=", 100)));
786795
var PulledMessages = this.PairedSimulationMessages[IndexOfMessageSet][IndexOfMessageFound];
787-
if (!this.ResponsesEnabled)
796+
797+
// Log message contents out and then log the responses out if we are going to be sending them
798+
this._simPlayingLogger.WriteLog($"--> READ MESSAGE [0]: {BitConverter.ToString(PulledMessages.MessageRead.Data)}", LogType.InfoLog);
799+
if (!ResponsesEnabled)
788800
{
789801
// Fake a reply output event and disconnect our channel
790802
this.SimulationSession.PTDisconnect(0);
@@ -800,6 +812,10 @@ private bool _generateSimulationResponses(int IndexOfMessageSet, int IndexOfMess
800812

801813
// Attempt to send output events in a task to stop hanging our response operations
802814
this.SimMessageReceived(new SimMessageEventArgs(this.SimulationSession, true, PulledMessages.MessageRead, PulledMessages.MessageResponses));
815+
for (int RespIndex = 0; RespIndex < PulledMessages.MessageResponses.Length; RespIndex += 1)
816+
this._simPlayingLogger.WriteLog($" --> SENT MESSAGE [{RespIndex}]: {BitConverter.ToString(PulledMessages.MessageResponses[RespIndex].Data)}");
817+
818+
// Return passed sending output
803819
return true;
804820
}
805821
catch (Exception SendResponseException)

SharpSimulator/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
[assembly: Guid("183F7A6A-E107-4209-8A11-044A08DEAEE4")]
2020

2121
// Version information
22-
[assembly: AssemblyVersion("0.12.12.320")]
23-
[assembly: AssemblyFileVersion("0.12.12.320")]
22+
[assembly: AssemblyVersion("0.12.12.323")]
23+
[assembly: AssemblyFileVersion("0.12.12.323")]
2424
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
2525

SharpWrapper/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
[assembly: InternalsVisibleTo("SharpWrap2534Tests")]
2121

2222
// Version information
23-
[assembly: AssemblyVersion("6.2.1.500")]
24-
[assembly: AssemblyFileVersion("6.2.1.500")]
23+
[assembly: AssemblyVersion("6.2.1.502")]
24+
[assembly: AssemblyFileVersion("6.2.1.502")]
2525
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
2626

0 commit comments

Comments
 (0)