Bluetooth 设备通过初始配对过程建立安全连接。在此期间,一个或两个设备需要输入PIN 码,内部算法利用该代码生成安全密钥,安全密钥随后用于验证将来任何时候的设备连接。
- Scanning for other Bluetooth devices
- Querying the local Bluetooth adapter for paired Bluetooth devices
- Establishing RFCOMM channels/sockets
- Connecting to a remote device
- Transfering data over Bluetooth
The basic
The Skill
1.
(1)多线程应用程序
http://docs.oracle.com/javase/tutorial/essential/concurrency/
(2)异步asynchronous
(3)同步synchronized
(4)状态管理
2.广播
在发现蓝牙的过程中,应用程序需要开启广播来接收被发现到的蓝牙设备。
3.蓝牙服务器和客户端
4.封装为一个蓝牙服务器
This class does all the work for setting up and managing Bluetooth connections with other devices. It hasa thread that listens for incoming connections, a threadfor connecting with a device, and a thread for performing data transmissions when connected.