Code example for BluetoothSocket

Methods: connect, getInputStream

0
		} 
	} 
	 
	protected int setupConnection(ImprovedBluetoothDevice device, byte[] readBuffer) throws Exception {
        m_socket = m_useInsecureChannel ? device.createInsecureRfcommSocket(1) : device.createRfcommSocket(1);
        m_socket.connect();
 
        if (D) Log.d(LOG_NAME, "Connected to " + m_address);
    	 
    	m_input = m_socket.getInputStream();
    	return m_input.read(readBuffer);		
	} 
	 
	protected abstract void validateWelcomeMessage(byte[] data, int read);
 
	@Override 
	public String getDeviceAddress() {
		return m_address;
	} 
 
	@Override