I'm not sure what did you vaguley understood and what not but i'll try to explain the purpose of these classes in general..
ConnectThread
- receives a bluetooth device that was discovered in the discovery stage (which is prior to connection obviously) gets the BT socket from the device and when run() is called it tries to connect to it.
if the connection succeeded - in the code it just says manageConnectedSocket(mmSocket);
but that means that u should open a ConnectedThread
for receiving and sending data through the socket.
ConnectedThread -
as mentioned, is the thread for managing sending and receiving data. as you can see in the run()
it constantly listens using a while(true)
it calls read which is blocking - meaning "the thread is stuck there" until it receives incoming data.
When data is received it handles it with the mHandler which is also not implemented here, again you should just implement whatever you want to do with the data received.
The write method simply receives an array of bytes and writes it to the socket, note that this is also a blocking call therefore u should use it from another thread.
Hope this helps u understand