android蓝牙开发

   在进行android蓝牙开发之前必选要对其相关的基础知识有详细的了解,这里主要介绍一些基础知识点和开发流程.


一、整体基础知识框架介绍:

      android 提供管理蓝牙功能的类,例如扫描设备、连接设备和管理设备之间的数据传输。

蓝牙接口支持两个“经典的蓝牙”和蓝牙低能量

     蓝牙应用程序的应用程序:

  1. 扫描其他蓝牙设备(包括BLE设备)。
  2. 查询本地蓝牙适配器,用于配对蓝牙设备。
  3. 建立RFCOMM串口/插座。
  4. 在其他设备上连接指定的插座。
  5. 向其他设备传送数据。
  6. 与BLE设备通信,如接近传感器、心率监视器,健身设备,等等。
  7. 作为关贸总协定GATT客户端或服务器(BLE)。

        重要的是要使用这些接口来进行蓝牙通信,应用程序必须声明蓝牙权限。一些额外的功能,如请求设备发现,还需要bluetooth_admin许可。

       注:并非所有的安卓系统设备提供蓝牙功能。

二、android为蓝牙提供三个接口Interfaces、

  1.  BluetoothAdapter.LeScanCallback :用于提供扫描结果的回调接口
  2. BluetoothProfile : 蓝牙配置文件的公共接口。
  3. BluetoothProfile.ServiceListener:一个接口通知bluetoothprofile IPC客户当他们已连接或断开服务

三、11个功能类:Classes

  1.  bluetootha2dp这类提供公共的API来控制蓝牙A2DP。
  2.  BluetoothAdapter表示本地设备蓝牙适配器。
  3. bluetoothassignednumbers蓝牙分配号码。
  4. BluetoothClass表示蓝牙类,它描述了设备的一般特性和功能。
  5. BluetoothClass.Device   定义所有的设备类的常量。
  6. bluetoothclass.device.major定义所有主要设备类常数。
  7. BluetoothClass.Service定义所有的服务类的常量。
  8. BluetoothDevice表示远程蓝牙设备。
  9. bluetoothgatt公共API蓝牙GATT简介。
  10. bluetoothgattcallback这个抽象类来实现bluetoothgatt回调。
  11. bluetoothgattcharacteristic表示蓝牙关贸总协定的特点
  12. BluetoothGattDescriptor关贸总协定的描述符表示蓝牙描述符包含了额外的信息属性的关贸总协定GATT bluetoothgattcharacteristic的特性
  13. bluetoothgattserver 公共API蓝牙GATT配置服务器角色。
  14. bluetoothgattservercallback这个抽象类来实现bluetoothgattserver回调。
  15. bluetoothgattservice表示一个蓝牙GATT服务关贸总协定的服务包含一组bluetoothgattcharacteristic,以及参考服务。
  16. bluetoothheadset公共API控制蓝牙耳机服务。
  17. bluetoothhealth公共API蓝牙健康档案。
  18. bluetoothhealthappconfiguration蓝牙健康应用程序配置,采用的是与bluetoothhealth类连词。
  19. bluetoothhealthcallback这个抽象类来实现bluetoothhealth回调。
  20. bluetoothmanager高级经理用来获得一个蓝牙适配器的实例并进行全面的蓝牙管理。
  21. bluetoothserversocket收听蓝牙插座。
  22. BluetoothSocket连接或连接蓝牙插座。

你可能感兴趣的:(android开发)