Created
December 21, 2014 16:47
-
-
Save theterg/24f4d9722db271359ecc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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