5 Replies Latest reply on Jan 17, 2019 7:51 AM by Steven Si

    Connection.Close() taking 5 seconds

    Elaine Williams

      I'm using an iOS device to print to a ZQ310 via a Bluetooth connection. The app is written in Xamarin Forms and C# using Zebra.Printer.SDK v.2.15.2634. The Connection.Close() command is taking 5 seconds to complete which seems longer than the previous LinkOS_Xamarin_SDK version?  Is there a way to control how long the Close command will take?  In the debugger I can see a property on the connection called "TimeToWaitBeforeClose", but I'm not able to reference it or override it in my code?  Is that something that I should be able to do?  If so, some sample code would be appreciated.

       

      Thanks,

      Elaine

        • Re: Connection.Close() taking 5 seconds
          Elaine Williams

          My question came in right before the holiday shutdown, but I was still hoping from some feedback on this issue.  I am connecting to the printer, sending slip to printer and then closing connection for each slip that is printed as per sample code. I now have it queuing up the print jobs to get around the delay but it still seems like an issue to have to wait 5000 ms on the Close connection call. Any thoughts from the Zebra team on how to override the "TimeToWaitBeforeClose" so that I can shorten that wait time?  Or is the answer to keep the connection open between print jobs?

           

          Thanks,

          Elaine

            • Re: Connection.Close() taking 5 seconds
              Steven Si

              Since TimeToWaitBeforeClose is a property of the connection, you should be able to modified the property of the connection at runtime. You can change the value of TimeToWaitBeforeClose to the timeout you like at runtime. Please note, the unit of TimeToWaitBeforeClose is in milliseconds.

                • Re: Connection.Close() taking 5 seconds
                  Elaine Williams

                  Thanks Steven. That's exactly what I would like to do, but that property is not available in my connection for some reason? My connection code is using Xamarin.Forms with a Dependency service to connect via Bluetooth.  See screenshot below of code where I would like to set that property. As you can see only TimeToWaitForMoreData is available.  There is no TimeToWaitBeforeClose. However, I do see that property in the debugger if I set a break point after the connection is made.  It is very odd and aggravating because it should be so simple.  Thanks in advance for any more help that you can provide.

                  • Re: Connection.Close() taking 5 seconds
                    Elaine Williams

                    I figured out how to set that property.  I am able to set in the Xamarin.iOS project.  Then when it is used in the Xamarin Forms .NET Standard project, the connection no longer takes 5 seconds to close.