Skip to content

Instantly share code, notes, and snippets.

@corytodd
Created August 30, 2018 16:13
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 corytodd/a8228dd3a7a05f0725b39848150b66b8 to your computer and use it in GitHub Desktop.
Save corytodd/a8228dd3a7a05f0725b39848150b66b8 to your computer and use it in GitHub Desktop.
PTIRelianceLib Reconnection Test Loop
// 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