public class ControllActivity extends Activity 
{

	BluetoothDevice device;
	private static final UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
	BluetoothSocket socket;
	OutputStream output;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_controll);
		
		Intent intent = getIntent();
		device = intent.getParcelableExtra("device");
	}	
	
	public void doConnect(View view)
	{
		Thread t = new Thread()
		{
			public void run()
			{
				try {
					socket = device.createRfcommSocketToServiceRecord(uuid);
					socket.connect();
					output = socket.getOutputStream();
					Log.e("MainActivity", "成功");
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					Log.e("MainActivity", "失敗"+e.getMessage());
				}
			}
		};
		t.start();
	}
}