Android BluetoothAdapter

来源:互联网 发布:linux返回上一步 编辑:程序博客网 时间:2024/06/05 20:07

本文基于android 7.0代码

BluetoothAdapter

frameworks/base/core/java/android/bluetooth/BluetoothAdapter.java

提供了7个状态值

    /**     * Indicates the local Bluetooth adapter is off.     */    public static final int STATE_OFF = 10;    /**     * Indicates the local Bluetooth adapter is turning on. However local     * clients should wait for {@link #STATE_ON} before attempting to     * use the adapter.     */    public static final int STATE_TURNING_ON = 11;    /**     * Indicates the local Bluetooth adapter is on, and ready for use.     */    public static final int STATE_ON = 12;    /**     * Indicates the local Bluetooth adapter is turning off. Local clients     * should immediately attempt graceful disconnection of any remote links.     */    public static final int STATE_TURNING_OFF = 13;    /**     * Indicates the local Bluetooth adapter is turning Bluetooth LE mode on.     * @hide     */    public static final int STATE_BLE_TURNING_ON = 14;    /**     * Indicates the local Bluetooth adapter is in LE only mode.     * @hide     */    public static final int STATE_BLE_ON = 15;    /**     * Indicates the local Bluetooth adapter is turning off LE only mode.     * @hide     */    public static final int STATE_BLE_TURNING_OFF = 16;

BLE就是Bluetooth Low Energy,具体参考下面的文档
https://developer.android.com/guide/topics/connectivity/bluetooth-le.html

BluetoothAdapter提供了很多功能接口,蓝牙开启关闭都是通过这个类搞定的

enable
disable

0 0
原创粉丝点击