Blocking Read / Write Access?

Tim
2005-11-21
2013-04-15
  • Tim
    Tim
    2005-11-21

    Hello Developers!

    I've got a question for you and I hope you can help me:
    We're writing a bluetooth application that (among other things) can read and write data to a autonomous transponder. We try hard to keep that application not blocking during. To reach that goal we for example implemented the DeviceDiscovery-Service, which implements some kind of EventHandler.

    Anayway, we are using an L2CAP-Connection and the problem for now is the reading service:
    As it's pointed out in the API, the receive()-Service of the L2CAPConnection-Class requires the method "ready()" to return true for not blocking the whole thing. Does that mean we have to put a Threading in our application to doublecheck whether data is available (using the ready()-method) at the RemoteDevice and after that receive it? Isn't there an easier way?

    I've tried to get some information about the bluetooth driver itself...but I wasn't very lucky.

    I hope theres someone out there to help us out of this...

    Greets
    Tim

     
    • Serge Hauser
      Serge Hauser
      2005-12-07

      Hi Tim,

      Its best to implement I/O Operation in sepparate thread, so you start a thread, open connection, read/write data and when all is complete you notify the main application that the I/O has finished.

      hope that helps
      Serge

       
      • Tim
        Tim
        2005-12-08

        Thank you very much for your answer. We had implemented that application with Threads and at least the Threading works fine.

        Greets
        Tim