现在的位置: 首页 > 综合 > 正文

BluetoothChat 基本

2013年12月08日 ⁄ 综合 ⁄ 共 838字 ⁄ 字号 评论关闭

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

  1. Bluetooth Permissions
  2. Setting Up Bluetooth
  3. Finding Devices
    1. Querying paired devices
    2. Discovering devices
  4. Connecting Devices
    1. Connecting as a server
    2. Connecting as a client
  5. Managing a Connection


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 thread
for connecting with a device, and a thread for performing data transmissions when connected.
 

【上篇】
【下篇】

抱歉!评论已关闭.