Bluetooth---初步了解Android 蓝牙4.0
http://developer.android.com/reference/android/bluetooth/package-summary.html
android.bluttooth
提供管理蓝牙功能的类,比如对设备的扫描,连接设备,和管理设备之间的传输数据。蓝牙API支持经典蓝牙和低功耗蓝牙。
Provides classes that manage Bluetooth functionality, such as scanning for devices, connecting with devices, and managing data transfer between devices. The Bluetooth API supports both "Classic Bluetooth" and Bluetooth
Low Energy.
有关很多其它的经典蓝牙信息。能够看Bluetooth指南。有关很多其它的低功耗蓝牙的信息,能够看BLE指南。
For more information about Classic Bluetooth, see the Bluetooth guide.
For more information about Bluetooth Low Energy, see the Bluetooth Low Energy (BLE)
guide.
Bluetooth APIs 能够使得应用具备下面功能:
1.对于其它的蓝牙设备的扫描(包含BLE设备)
2.为配对的蓝牙设备查询本地蓝牙适配器
3.建立RFCOMM channels/sockets.
4.连接在其他设备上指定的sockets
5.与其他设备之间数据传输
6.与BLE设备交流。比如接近传感器,心率监视器,健身设备,等等
7.作为GATTclient或GATT服务端
使用这些APIs来完毕蓝牙之间的交流,一个应用程序必须声明BLUETOOTH
权限。对于一些额外的功能。如请求设备发现,也须要BLUETOOTH_ADMIN
权限。
提示:不是全部的Android设备都提供了Bluetooth功能。
The Bluetooth APIs let applications:
- Scan for other Bluetooth devices (including BLE devices).
- Query the local Bluetooth adapter for paired Bluetooth devices.
- Establish RFCOMM channels/sockets.
- Connect to specified sockets on other devices.
- Transfer data to and from other devices.
- Communicate with BLE devices, such as proximity sensors, heart rate monitors, fitness devices, and so on.
- Act as a GATT client or a GATT server (BLE).
To perform Bluetooth communication using these APIs, an application must declare the BLUETOOTH
permission.
Some additional functionality, such as requesting device discovery, also requires the BLUETOOTH_ADMIN
permission.
Note: Not all Android-powered devices provide Bluetooth functionality.
接口:
BluetoothAdapter.LeScanCallback :用来提供LE扫描结果的回调接口
BluetoothProfile:Bluetooth Profiles的公共APIs
BluetoothProfile.ServiceListener:BluetoothProfile
IPC client与service的连接和断开时的一个通知接口
Interfaces
BluetoothAdapter.LeScanCallback | Callback interface used to deliver LE scan results. |
BluetoothProfile | Public APIs for the Bluetooth Profiles. |
BluetoothProfile.ServiceListener | An interface for notifying BluetoothProfile IPC clients when they have been connected or disconnected to the service. |
类:
BluetoothA2dp:这个类提供控制Bluetooth A2DP profile的公共APIs
BluetoothAdapter:代表本地设备的Bluetooth adapter.
BluetoothAssignedNumbers:蓝牙分配号码
BluetoothClass:代表一个Bluetooth类。它描写叙述了设备的一般特征(characteristics)和能力(capabilities)
BluetoothClass.Device:定义全部设备类的常量
BluetoothClass.Device.Major:定义全部主要设备类的常量
BluetoothClass.Service:定义全部服务类的常量
BluetoothDevice:代表一个远程蓝牙设备
=============================================================================================
BluetoothGatt:蓝牙GATT Profile的公共APIs
BluetoothGattCallback:这个抽象类用于实现BluetoothGatt回调
BluetoothGattCharacteristic:代表一个Bluetooth GATT Characteristic.
一个GATT Characteristic是用来构造一个GATT service,BluetoothGattService
的基本数据元素
BluetoothGattDescriptor:代表一个Bluetooth GATT Descriptor.
GATT Descriptor包括一个GATT characteristic,BluetoothGattCharacteristic
的额外信息和属性.
Classes
BluetoothA2dp | This class provides the public APIs to control the Bluetooth A2DP profile. |
BluetoothAdapter | Represents the local device Bluetooth adapter. |
BluetoothAssignedNumbers | Bluetooth Assigned Numbers. |
BluetoothClass | Represents a Bluetooth class, which describes general characteristics and capabilities of a device. |
BluetoothClass.Device | Defines all device class constants. |
BluetoothClass.Device.Major | Defines all major device class constants. |
BluetoothClass.Service | Defines all service class constants. |
BluetoothDevice | Represents a remote Bluetooth device. |
BluetoothGatt | Public API for the Bluetooth GATT Profile. |
BluetoothGattCallback |
This abstract class is used to implement BluetoothGatt callbacks. |
BluetoothGattCharacteristic |
Represents a Bluetooth GATT Characteristic
A GATT characteristic is a basic data element used to construct a GATT service, |
BluetoothGattDescriptor |
Represents a Bluetooth GATT Descriptor
GATT Descriptors contain additional information and attributes of a GATT characteristic, |
BluetoothGattServer | Public API for the Bluetooth GATT Profile server role. |
BluetoothGattServerCallback |
This abstract class is used to implement BluetoothGattServer callbacks. |
BluetoothGattService |
Represents a Bluetooth GATT Service
Gatt Service contains a collection of |
BluetoothHeadset | Public API for controlling the Bluetooth Headset Service. |
BluetoothHealth | Public API for Bluetooth Health Profile. |
BluetoothHealthAppConfiguration |
The Bluetooth Health Application Configuration that is used in conjunction with the BluetoothHealth class. |
BluetoothHealthCallback |
This abstract class is used to implement BluetoothHealth callbacks. |
BluetoothManager |
High level manager used to obtain an instance of an BluetoothAdapter andto conduct overall Bluetooth Management. |
BluetoothServerSocket | A listening Bluetooth socket. |
BluetoothSocket | A connected or connecting Bluetooth socket. |
BluetoothGattServer:Bluetooth GATT Profileserver角色的公共APIs.
BluetoothGattServerCallback:这个抽象类用于实现BluetoothGattServer
回调.
BluetoothGattService:代表一个Bluetooth GATT Service.
================================================================================
BluetoothHeadset:控制蓝牙耳机(Headset)服务的公共API.
BluetoothHealth:蓝牙Health Profile的公共API.
BluetoothHealthAppConfiguration:The Bluetooth
Health Application Configuration(配置)用来与BluetoothHealth
类结合.
BluetoothHealthCallback:用于实现BluetoothHealth
回调的抽象类
BluetoothManager:用来获取BluetoothAdapter
的实例的管理者,进行全面的蓝牙管理
BluetoothServerSocket:一个监听蓝牙的socket
BluetoothSocket:一个已连接或正在连接的蓝牙socket.
最新文章
- MySQL/MariaDB/PerconaDB-提权条件竞争漏洞
- SCRUM报告(1)
- 数据结构(DataStructure)与算法(Algorithm)、STL应用
- CentOS只允许部分IP登陆ssh |ssh 允许指定IP
- Java碎片知识(笔记)
- 【转】 全世界最短的IE判定
- WPF入口Application
- ios键盘上添加辅助视图
- 0_Linux_虚拟机安装
- 基于visual Studio2013解决面试题之0301累加
- WTL版本ACEdit控件,改写自MFC版,附带源码
- Linux(8)查看服务器系统信息
- [Ccodeforces 736C] Ostap and Tree - 树形DP
- Java运行原理及内存分析
- 距离放弃python又近了一大步,而然只是第四天
- ElasticSearch 启动时加载 Analyzer 源码分析
- 吴恩达机器学习笔记45-使用支持向量机(Using A SVM)
- 44.JS--hover事件防重复效果
- Python中的垃圾回收机制
- error: C++ preprocessor ";/lib/cpp"; fails sanity check错误解决方法
热门文章
- jQuery post 传递 iframe
- web存储方法,现成代码
- jsp中标签id和name的区别(转)
- Windows(x86,64bit)升级MySQL 5.7.17免安装版的详细教程
- 洛谷——V1772 巧妙填数
- Spark源代码分析之中的一个:Job提交执行总流程概述
- [Node.js] Serve Static Files with Express
- 【Python】用Python的“结巴”模块进行分词
- bootstrap课程13 bootstrap的官方文档中有一些控件的使用有bug,如何解决这个问题
- 1.2 Use Cases中 Log Aggregation官网剖析(博主推荐)