For How Long the RFCOMM bluetooth stream could be opened? RRS feed

  • Question

  • Hi guys!
    I have built an app (Kiosk) which allows employees to sign in using their RFID cards. I have a Bluetooth reader and when the app starts, it creates a loop around socket:

                                                sockets.SocketProtectionLevel.plainSocket).done(function () {
                                                    $(elementDiv).find("#RFIDStatusMessage").text("RFID Settings " + "(Connected)");
                                                    that.receiveStringLoop(new streams.DataReader(chatSocket.inputStream));
                                                }, function (error) {
                                                    app.RFID.togleConnected = false;
                                                    app.RFID.ServiceName = "";
                                                    tougle.checked = false;
                                                    $(elementDiv).find("#RFIDStatusMessage").text("RFID Settings " + "(Failed to connect to server, with error!)");

    and inside that.reciveStringLoop I have 

             reader.loadAsync(6).done(function (size) {

    Which waits for employee to touch reader.

    Everything is working perfectly, except once a day it stops working. So, no errors, just employee touch the reader and nothing happens. I have implemented the log around those functions to see may be there are some exceptions which just stops the loop, but there are no errors at all.

    This case is very difficult to test. So I started thinking may be there is some timeout for Bluetooth?

    Guys, I will appriciate any suggestions around that scenario. I was thinking may be to reconnect to the bluetooth every 3 hours let's say?

    Thanks in advance!

    Monday, July 21, 2014 1:08 AM

All replies

  • Really hard to say. It's probably a good idea to restart the connection occasionally in any case.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, July 21, 2014 7:13 PM
  • Thanks Matt for your reply!

    The thing is I don't know how to restart the connection, because the app always come to this function:

     reader.loadAsync(6).done(function (size) {

    Will I be able to run another timer and do something like reader.close?



    Wednesday, July 23, 2014 12:15 AM