类 IBluetoothManager
java.lang.Object
com.hyperlcd.Bluetooth.IBluetoothManager
public class IBluetoothManager
extends java.lang.Object
HyperlcdLib 蓝牙控制类
使用该类中的接口方法必须先调用 getInstance(Context, BluetoothManagerListener) 获取实例。
结束使用调用 destroyInstance() 销毁单例。
isSupportBluetooth()是否支持蓝牙enableBluetooth()打开蓝牙disableBluetooth()关闭蓝牙startDiscoveryBluetooth()开始扫描蓝牙CreateBond(BluetoothDevice)创建配对RemoveBond(BluetoothDevice)移除配对
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static interfaceIBluetoothManager.BluetoothManagerListener -
字段概要
字段 修饰符和类型 字段 说明 static intBluetooth_BOND_BONDEDstatic intBluetooth_BOND_BONDINGstatic intBluetooth_BOND_NONEstatic intBluetooth_DISCOVERY_FINISHEDstatic intBluetooth_DISCOVERY_STARTEDstatic intBluetooth_FOUND -
构造器概要
构造器 构造器 说明 IBluetoothManager(android.content.Context context, IBluetoothManager.BluetoothManagerListener bluetoothManagerListener)蓝牙控制构造方法,不需要回调监听 -
方法概要
修饰符和类型 方法 说明 voidCreateBond(android.bluetooth.BluetoothDevice device)配对设备static voiddestroyInstance()销毁蓝牙单例booleandisableBluetooth()蓝牙关闭 true为关闭成功 false 为关闭失败或不支持booleanenableBluetooth()蓝牙打开 true为打开 false 为打开失败或不支持java.lang.StringgetBluetoothLocalAddress()获取本地蓝牙地址java.lang.StringgetBluetoothLocalName()获取本地蓝牙名称static IBluetoothManagergetInstance(android.content.Context context, IBluetoothManager.BluetoothManagerListener bluetoothManagerListener)booleanisBluetoothEnable()蓝牙是否打开 true为打开 false 为关闭或不支持booleanisSupportBluetooth()设备是否支持蓝牙 true为支持 false为不支持voidRemoveBond(android.bluetooth.BluetoothDevice device)取消设备配对booleansetBluetoothLocalName(java.lang.String name)设置本地蓝牙名称booleanstartDiscoveryBluetooth()蓝牙扫描 true为开始扫描 false 为扫描失败或不支持static voidunregisterReceiver()反注册广播取消蓝牙的配对
-
字段详细资料
-
Bluetooth_DISCOVERY_STARTED
public static final int Bluetooth_DISCOVERY_STARTED- 另请参阅:
- 常量字段值
-
Bluetooth_DISCOVERY_FINISHED
public static final int Bluetooth_DISCOVERY_FINISHED- 另请参阅:
- 常量字段值
-
Bluetooth_FOUND
public static final int Bluetooth_FOUND- 另请参阅:
- 常量字段值
-
Bluetooth_BOND_BONDING
public static final int Bluetooth_BOND_BONDING- 另请参阅:
- 常量字段值
-
Bluetooth_BOND_BONDED
public static final int Bluetooth_BOND_BONDED- 另请参阅:
- 常量字段值
-
Bluetooth_BOND_NONE
public static final int Bluetooth_BOND_NONE- 另请参阅:
- 常量字段值
-
-
构造器详细资料
-
IBluetoothManager
public IBluetoothManager(android.content.Context context, IBluetoothManager.BluetoothManagerListener bluetoothManagerListener)蓝牙控制构造方法,不需要回调监听
-
-
方法详细资料
-
getInstance
public static IBluetoothManager getInstance(android.content.Context context, IBluetoothManager.BluetoothManagerListener bluetoothManagerListener)- 参数:
context- 上下文对象- 返回:
-
destroyInstance
public static void destroyInstance()销毁蓝牙单例 -
unregisterReceiver
public static void unregisterReceiver()反注册广播取消蓝牙的配对 -
isSupportBluetooth
public boolean isSupportBluetooth()设备是否支持蓝牙 true为支持 false为不支持- 返回:
-
getBluetoothLocalName
public java.lang.String getBluetoothLocalName()获取本地蓝牙名称- 返回:
-
setBluetoothLocalName
public boolean setBluetoothLocalName(java.lang.String name)设置本地蓝牙名称- 参数:
name- 设置的蓝牙名称- 返回:
- true 成功 false 失败
-
getBluetoothLocalAddress
public java.lang.String getBluetoothLocalAddress()获取本地蓝牙地址- 返回:
-
isBluetoothEnable
public boolean isBluetoothEnable()蓝牙是否打开 true为打开 false 为关闭或不支持- 返回:
-
enableBluetooth
public boolean enableBluetooth()蓝牙打开 true为打开 false 为打开失败或不支持- 返回:
-
disableBluetooth
public boolean disableBluetooth()蓝牙关闭 true为关闭成功 false 为关闭失败或不支持- 返回:
-
startDiscoveryBluetooth
public boolean startDiscoveryBluetooth()蓝牙扫描 true为开始扫描 false 为扫描失败或不支持- 返回:
-
CreateBond
public void CreateBond(android.bluetooth.BluetoothDevice device) throws java.lang.Exception配对设备- 参数:
device- 蓝牙设备- 抛出:
java.lang.Exception
-
RemoveBond
public void RemoveBond(android.bluetooth.BluetoothDevice device) throws java.lang.Exception取消设备配对- 参数:
device- 蓝牙设备- 抛出:
java.lang.Exception
-