Skip to content

Instantly share code, notes, and snippets.

@theterg
Created December 21, 2014 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theterg/24f4d9722db271359ecc to your computer and use it in GitHub Desktop.
Save theterg/24f4d9722db271359ecc to your computer and use it in GitHub Desktop.
public void CommunicationsTask(bool blnOnlyCheckXmitQueue)
{
try
{
if (serialPort1.IsOpen)
{
if (blnCommEnabled)
{
if (!blnWaitingForResponse)
{
if (!blnOnlyCheckXmitQueue)
{
if (0 == MsgQueue.Count)
{
if (!blnOnline)
{
// Send a thing
}
else
{
if (!blnDataUploadInProgress)
{
switch (Program.frmMain.GetCurrentTab())
{
case 0:
// Do some work
break;
case 1:
// Do some work
break;
case 2:
// Do some work
break;
case 3:
// Do some work
break;
default:
break;
}
}
}
}
}
if (0 != MsgQueue.Count)
{
if (SendMsg(MsgQueue.Peek()))
{
blnWaitingForResponse = true;
timer2.Enabled = true;
}
}
}
}
}
}
catch (Exception)
{
MsgQueue.Clear();
blnWaitingForResponse = true;
timer2.Enabled = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment