public ConnectedThread(BluetoothService service, BluetoothSocket socket) { this.service = service; this.socket = socket; Stream tempIn = null; Stream tempOut = null; this.handler = this.service.MessageHandler; try { tempIn = this.socket.InputStream; } catch (IOException e) { Logger.Log("Error occurred when creating input stream " + e.Message); } try { tempOut = this.socket.OutputStream; } catch (IOException e) { Logger.Log("Error occurred when creating output stream " + e.Message); } InStream = tempIn; InStream.Flush(); OutStream = tempOut; OutStream.Flush(); }
public BluetoothService(Context context, BluetoothHandler handler) { this.context = context; MessageHandler = handler; BtAdapter = BluetoothAdapter.DefaultAdapter; }