public AcceptThread(BluetoothActivityService service) { _service = service; BluetoothServerSocket tmp = null; // Create a new listening server socket try { tmp = _service._adapter.ListenUsingRfcommWithServiceRecord(NAME, MY_UUID); } catch (Java.IO.IOException e) { Log.Error(TAG, "listen() failed", e); } mmServerSocket = tmp; }
public ConnectThread(BluetoothDevice device, BluetoothActivityService service) { mmDevice = device; _service = service; BluetoothSocket tmp = null; // Get a BluetoothSocket for a connection with the // given BluetoothDevice try { tmp = device.CreateRfcommSocketToServiceRecord(MY_UUID); } catch (Java.IO.IOException e) { Log.Error(TAG, "create() failed", e); } mmSocket = tmp; }
public ConnectedThread(BluetoothSocket socket, BluetoothActivityService service) { Log.Debug(TAG, "create ConnectedThread: "); mmSocket = socket; _service = service; Stream tmpIn = null; Stream tmpOut = null; // Get the BluetoothSocket input and output streams try { tmpIn = socket.InputStream; tmpOut = socket.OutputStream; } catch (Java.IO.IOException e) { Log.Error(TAG, "temp sockets not created", e); } mmInStream = tmpIn; mmOutStream = tmpOut; }