Package com.yasee.yasee.ble
Class BleDevice
java.lang.Object
com.yasee.yasee.ble.BleDevice
蓝牙连接设备类
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal AdvertisementData
广播数据int
获取电量信息 (默认为0) battery 电量static BleDevice
当前使用的设备final BluetoothDevice
系统蓝牙对象 -
Constructor Summary
ConstructorsConstructorDescriptionBleDevice
(BluetoothDevice device, AdvertisementData avd) 创建一个新的 蓝牙设备BleDevice
(String mac, AdvertisementData avd) 根据 mac 创建一个设备 -
Method Summary
-
Field Details
-
device
系统蓝牙对象 -
advertisementData
广播数据 -
current
当前使用的设备 -
battery
public int battery获取电量信息 (默认为0) battery 电量
-
-
Constructor Details
-
BleDevice
创建一个新的 蓝牙设备- Parameters:
device
- the deviceavd
- the AdvertisementData
-
BleDevice
根据 mac 创建一个设备
-
-
Method Details
-
getGatt
获取当前的Gatt- Returns:
- the gatt
-
connect
public void connect()连接设备 -
disConnect
public void disConnect()关闭设备 -
send
public void send(byte[] data) 发送指令信息- Parameters:
data
- the data
-
send
-
getBleProcess
设备的连接状态- Returns:
- the ble process
-
getModel
设备注册型号- Returns:
- the model
-
getMac
设备的Mac地址- Returns:
- the mac
-
getPlatform
获取平台信息- Returns:
- the platform
-
refreshDeviceCache
public void refreshDeviceCache()清理Gatt 缓存数据
-