Code example for BluetoothSocket

Methods: getInputStream, getOutputStream

0
    } 
 
    private void connectStreams() throws BluetoothException { 
        try { 
            mOutStream = new BufferedWriter(new OutputStreamWriter(
                        mSocket.getOutputStream()));
            mInStream = new BufferedInputStream(mSocket.getInputStream());
            Log.i(TAG, "Socket stream to CAN translator opened successfully");
        } catch(IOException e) {
            Log.e(TAG, "Error opening streams ", e);
            mSocket = null;
            disconnected(); 
            throw new BluetoothException(); 
        } 
    } 
 
    private void setAddress(String address) {
        // TODO verify this is a valid MAC address 
        mAddress = address;
    }