Created
August 30, 2018 16:13
-
-
Save corytodd/a8228dd3a7a05f0725b39848150b66b8 to your computer and use it in GitHub Desktop.
PTIRelianceLib Reconnection Test Loop
This file contains 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
// Call out from some place else... | |
private static void RunReconnectionTest() | |
{ | |
while (true) | |
{ | |
using (var printer = new ReliancePrinter()) | |
{ | |
var start = DateTime.Now; | |
while (!printer.IsDeviceReady && (DateTime.Now - start).TotalSeconds < 7) | |
{ | |
/* Try a number of times or for period of time */ | |
} | |
if (printer.Ping() == ReturnCodes.Okay) | |
{ | |
var status = printer.GetStatus(); | |
Console.WriteLine(status); | |
} | |
else | |
{ | |
Console.WriteLine("Printer is busy"); | |
} | |
} | |
Thread.Sleep(250); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment