public ConnectedThread(BluetoothSocket socket, BluetoothFeedService service) { this.socket = socket; this.service = service; Stream tmpIn = null; Stream tmpOut = null; // Get the BluetoothSocket input and output streams try { tmpIn = socket.InputStream; } catch (Java.IO.IOException e) { Log.Error(TAG, "temp sockets not created", e); } try { tmpOut = socket.OutputStream; } catch (Java.IO.IOException e) { Log.Error(TAG, "temp sockets not created", e); } inStream = tmpIn; outStream = tmpOut; service.state = STATE_CONNECTED; }
public ConnectThread(BluetoothDevice device, BluetoothFeedService service) { this.device = device; this.service = service; BluetoothSocket tmp = null; ParcelUuid[] supportedUuids = device.GetUuids(); try { if (supportedUuids.Length > 0) { tmp = device.CreateInsecureRfcommSocketToServiceRecord(supportedUuids[0].Uuid); } else { tmp = device.CreateInsecureRfcommSocketToServiceRecord(UUID.FromString("00001101-0000-1000-8000-00805F9B34FB")); } } catch (Java.IO.IOException e) { Log.Error(TAG, "create() failed", e); } socket = tmp; service.state = STATE_CONNECTING; }