Android Question astream.write

Discussion in 'Android Questions' started by gezueb, Jun 8, 2015.

  1. gezueb

    gezueb Member Licensed User

    I have a problem with a bluetooth com using AsyncStreamText. The instream from bluetooth is continous. It works perfectly until i try to write an outstream using astream.write. Then the instream is corrupted. Thanks for your help!
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    There is no relation between the output stream and the input stream. Unless something is broken in the Bluetooth driver.
     
  3. gezueb

    gezueb Member Licensed User

    Thats what I was assuming. But is it possible that they use the same listener (newdata or new-text) or would it be wise to stop input listening while sending a response?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Bluetooth is full duplex. It should support both incoming and outgoing communication. AsyncStreams itself keeps each "stream" separately.

    You should make sure that there is only one AsyncStreams object managing the connection.
     
  5. gezueb

    gezueb Member Licensed User

    Solved the problem! It was my "write" that disturbed the device and changed the way it sent the stream so my parsing went haywire. B4a works like a charm. Thanks for your help!
    Georg
     
    Erel likes this.
Loading...