Back to project page BtDemo.
The source code is released under:
Apache License
If you think the Android project BtDemo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package cn.edu.hust.cm.bt.demo.server; /* w w w.ja va 2 s.co m*/ import java.io.IOException; import java.util.UUID; import android.bluetooth.BluetoothAdapter; import cn.edu.hust.cm.bt.demo.BaseBluetoothSocket; public class BluetoothServer { private String name; private String uuid; private BluetoothServerThread serverThread; public BluetoothServer(String name, String uuid) { super(); this.name = name; this.uuid = uuid; } public String getName() { return name; } public UUID getUuid() { return UUID.fromString(uuid); } public boolean isRunning() { return null != serverThread && serverThread.isRunning(); } public void setup() throws IOException { // TODO bt check try { serverThread = new BluetoothServerThread(this, BluetoothAdapter.getDefaultAdapter()); serverThread.start(); } catch (IOException e) { throw e; } } public void shutdown() throws IOException { if (null != serverThread) { try { serverThread.shutdown(); } catch (IOException e) { throw e; } } } protected void onConnected(BaseBluetoothSocket socket) { } }