#一.BLEDeviceInfo/CharacteristicInfo
1.BLEDeviceInfo : Bluetooth basic information(蓝牙基本信息)
DeviceName | Whether the system bluetooth is enabled(系统蓝牙是否开启) |
---|---|
MacAddress | Whether onnected to bluetooth(是否连接蓝牙) |
Rssi | Maximum turning speed in (deg/s) while following a path. |
2.CharacteristicInfo :Characteristic basic information(特征值基本信息)
bLEDeviceInfo | Bluetooth basic information(蓝牙基本信息) |
---|---|
CanRead | Is Readable(是否可读) |
CanWrite | Is Writeable(是否可写) |
CanNotify | Is Notifiable(是否可通知) |
ServiceUUID | Service UUID(Service的UUID) |
UUID | Characteristic UUID(特征值的UUID) |
二.BLEManager : Main interface(主要接口类)
Static Properties
Instance | BLEManager Singleton(BLEManager的单例) |
---|---|
Properties
SysBluetoothState | Whether the system bluetooth is enabled(系统蓝牙是否开启) |
---|---|
isSupportBLE | 设备是否支持低功耗蓝牙 |
isHasBluePermission | 是否有蓝牙权限 |
isConnectedBlue | Whether onnected to bluetooth(是否连接蓝牙) |
ConnectedBlueInfo | Basic information of bluetooth connection(连接上的蓝牙基本信息) |
isConnectA2DPBlue | Connect to audio bluetooth(是否连接上音频蓝牙) |
ConnectedA2DPBlueInfo | Connect to the audio bluetooth for basic information(连接上的音频蓝牙的基本信息) |
Method
BlueInit | (蓝牙初始化) |
---|---|
StartA2DPListen | (开始音频蓝牙的监听) |
JudgeConAudioBlueA2DP | (判断当前是否连接音频蓝牙,如果连接,返回其基本信息) |
StartScan | (开始扫描蓝牙设备) |
StopScan | (停止扫描蓝牙设备) |
ConnectBLE | (连接蓝牙) |
ReadCharacteristic | (读取特征值,返回读取到的信息) |
NotifyCharacteristic | (订阅特征值,接收连接蓝牙的通知) |
UnNotifyCharacteristic | (取消订阅) |
WriteCharacteristic | (写入特征即发送数据) |
DisConnect | (断开连接) |
BlueDeInit | (释放蓝牙模块) |
onApplicationPause | (程序暂停调用会停止扫描,Resume启动扫描,并获取此时蓝牙的各种状态) |
GetNewBlueState | (获取当前蓝牙最新状态,因为后台Unity无法接收到原生传上来的信息) |