Skip to content

Commit

Permalink
Spools up a thread to parse data on LineReceived
Browse files Browse the repository at this point in the history
  • Loading branch information
ndorin committed Jan 5, 2021
1 parent acf0fd3 commit c35675b
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions epi-display-lg/LgDisplayDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,35 +349,39 @@ private void CommunicationMonitor_StatusChange(object sender, MonitorStatusChang

private void PortGather_LineReceived(object sender, GenericCommMethodReceiveTextArgs args)
{
var data = args.Text.Trim().Replace("OK", "").Split(' ');
CrestronInvoke.BeginInvoke((o) =>
{
var data = args.Text.Trim().Replace("OK", "").Split(' ');
var command = data[0];
var id = data[1];
var responseValue = data[2];
if (!id.Equals(Id))
{
Debug.Console(2, this, "Device ID Mismatch - Discarding Response");
return;
}
var command = data[0];
var id = data[1];
var responseValue = data[2];
//command = 'ka'
switch (command)
{
case ("a"):
UpdatePowerFb(responseValue);
break;
case ("b"):
UpdateInputFb(responseValue);
break;
case ("f"):
UpdateVolumeFb(responseValue);
break;
case ("e"):
UpdateMuteFb(responseValue);
break;
}
if (!id.Equals(Id))
{
Debug.Console(2, this, "Device ID Mismatch - Discarding Response");
return;
}
//command = 'ka'
switch (command)
{
case ("a"):
UpdatePowerFb(responseValue);
break;
case ("b"):
UpdateInputFb(responseValue);
break;
case ("f"):
UpdateVolumeFb(responseValue);
break;
case ("e"):
UpdateMuteFb(responseValue);
break;
}
});

}

Expand Down

0 comments on commit c35675b

Please sign in to comment.