2017년 6월 2일 금요일

bluetooth status not updating from connected to not connected


I am trying to make a bluetooth based app in which I have used a label to show the status of connection....whether connected or not connected.
Initially no device is connected...so the label shows NOT CONNECTED, when a connection is established it changes to CONNECTED but when the connection is lost again it doesn't change to NOT CONNECTED. I have used a clock timer to check whether the bt device is connected or not, as done in most of the videos available online for this purpose.
Please help.

--
Can you post your blocks? I am wondering about this...

-- 
but when the connection is lost again it doesn't change to NOT CONNECTED.

yes, that's correct, that's how bluetooth works
you will have to send something to find out, if the connection is lost: you will get an error then
  Error 516: Unable to write: Connection reset by peer
see also https://puravidaapps.com/btchat.php
btchat.aia

Known Issues
  • While trying to connect, both client and server display an "Error 509 Accept Connection: Unable to accept a connection from a bluetooth device". This message can be ignored.
  • As far as I can see, after client or server disconnected, there is no possibility for the chat partner to see, that the connection is gone. Therefore currently an "Error 516: Unable to write: Connection reset by peer" will be diplayed after trying to send a text without connection.
  • Sometimes "Error 507: Unable to connect. Is the device turned on?" shows up while trying to connect.
--
I am new to this forum can u tell me how to add code blocks here
or i just have to write the logic?

-- 

-- 

댓글 없음:

댓글 쓰기