-
public interface IThingBleAbility
-
-
Method Summary
Modifier and Type Method Description abstract voidconnect(String mac, BleConnectParams bleConnectParams, BleConnectAbilityResponse response)connect ble device abstract voiddiscoveryServices(String mac, BleConnectAbilityResponse response)discovery ble services abstract voidrequestConnectionPriority(int priority, String mac)Set the connection priority of a device with a mac address abstract voiddisconnect(String mac)disconnect a device with mac address abstract voidonlyDisconnect(String mac)abstract voidregisterConnectStatusListener(String mac, BleConnectStatusResponse listener)Monitor Bluetooth connection status abstract voidunregisterConnectStatusListener(String mac, BleConnectStatusResponse listener)Cancel monitoring Bluetooth connection status abstract voidread(String mac, UUID service, UUID character, BleReadAbilityBaseResponse response)Read the characteristic value under a service of Bluetooth abstract voidwrite(String mac, UUID service, UUID character, Array<byte> value, BleBaseResponse response)Write a characteristic value under a service of Bluetooth abstract intwrite(String mac, UUID service, UUID character, Array<Array<byte>> value, long packTimeout)Write a characteristic value under a service of Bluetooth with a timeout abstract intwriteNoRsp(String mac, UUID service, UUID character, Array<Array<byte>> value, int packTimeout)Write a characteristic value under a service of Bluetooth with a timeout,and no response abstract voidreadDescriptor(String mac, UUID service, UUID character, UUID descriptor, BleReadAbilityBaseResponse response)Read a characteristic value abstract voidwriteDescriptor(String mac, UUID service, UUID character, UUID descriptor, Array<byte> value, BleBaseResponse response)Write a descriptor value under a service of Bluetooth with a timeout abstract voidwriteNoRsp(String mac, UUID service, UUID character, Array<byte> value, BleBaseResponse response)Write a character value under a service of Bluetooth abstract voidnotify(String mac, UUID service, UUID character, BleNotifyAbilityResponse response)notify a character value under a service of Bluetooth abstract voidunnotify(String mac, UUID service, UUID character, BleBaseResponse response)abstract voidreadRssi(String mac, BleGetRssiBaseResponse response)read a rssi by mac abstract voidconfigMtu(String mac, int mtu, BleConfigMtuBaseResponse response)abstract voidregisterBluetoothStateListener(BluetoothStateChangedReponse reponse)abstract voidunregisterBluetoothStateListener(BluetoothStateChangedReponse reponse)abstract voidrefreshCache(String mac)-
-
Method Detail
-
connect
abstract void connect(String mac, BleConnectParams bleConnectParams, BleConnectAbilityResponse response)
connect ble device
- Parameters:
mac- ble device's macAddressbleConnectParams- connection strategyBleConnectParamsresponse- connection callbackBleConnectAbilityResponse
-
discoveryServices
abstract void discoveryServices(String mac, BleConnectAbilityResponse response)
discovery ble services
- Parameters:
mac- ble device's macAddressresponse- callback BleConnectAbilityResponse
-
requestConnectionPriority
abstract void requestConnectionPriority(int priority, String mac)
Set the connection priority of a device with a mac address
- Parameters:
priority- prioritymac- ble device's macAddress
-
disconnect
abstract void disconnect(String mac)
disconnect a device with mac address
- Parameters:
mac- ble device's macAddress
-
onlyDisconnect
abstract void onlyDisconnect(String mac)
-
registerConnectStatusListener
abstract void registerConnectStatusListener(String mac, BleConnectStatusResponse listener)
Monitor Bluetooth connection status
- Parameters:
mac- ble device's macAddresslistener- Bluetooth connection status callbackBleConnectStatusResponse
-
unregisterConnectStatusListener
abstract void unregisterConnectStatusListener(String mac, BleConnectStatusResponse listener)
Cancel monitoring Bluetooth connection status
- Parameters:
mac- ble device's macAddresslistener- The previously registered Bluetooth listener callbackregisterConnectStatusListener
-
read
abstract void read(String mac, UUID service, UUID character, BleReadAbilityBaseResponse response)
Read the characteristic value under a service of Bluetooth
- Parameters:
mac- ble device's macAddressservice- Unique sign of bluetooth servicecharacter- A characteristic value under the Bluetooth serviceresponse- The callback result of reading a characteristic value under the Bluetooth serviceBleReadAbilityBaseResponse
-
write
abstract void write(String mac, UUID service, UUID character, Array<byte> value, BleBaseResponse response)
Write a characteristic value under a service of Bluetooth
- Parameters:
mac- ble device's macAddressservice- Unique sign of bluetooth servicecharacter- A characteristic value under the Bluetooth servicevalue- The value of the bluetooth characteristic writtenresponse- The callback result of writing a characteristic value under the Bluetooth serviceBleBaseResponse
-
write
abstract int write(String mac, UUID service, UUID character, Array<Array<byte>> value, long packTimeout)
Write a characteristic value under a service of Bluetooth with a timeout
- Parameters:
mac- ble device's macAddressservice- Unique sign of bluetooth servicecharacter- A characteristic value under the Bluetooth servicevalue- The value of the bluetooth characteristic writtenpackTimeout- timeout of write
-
writeNoRsp
abstract int writeNoRsp(String mac, UUID service, UUID character, Array<Array<byte>> value, int packTimeout)
Write a characteristic value under a service of Bluetooth with a timeout,and no response
- Parameters:
mac- ble device's macAddressservice- Unique sign of bluetooth servicecharacter- A characteristic value under the Bluetooth servicevalue- The value of the bluetooth characteristic writtenpackTimeout- timeout of write
-
readDescriptor
abstract void readDescriptor(String mac, UUID service, UUID character, UUID descriptor, BleReadAbilityBaseResponse response)
Read a characteristic value
- Parameters:
mac- ble device's macAddressservice- Unique sign of bluetooth servicecharacter- A characteristic value under the Bluetooth servicedescriptor- The value of the bluetooth characteristicresponse- The callback result of read a characteristic value under the Bluetooth service,BleReadAbilityBaseResponse
-
writeDescriptor
abstract void writeDescriptor(String mac, UUID service, UUID character, UUID descriptor, Array<byte> value, BleBaseResponse response)
Write a descriptor value under a service of Bluetooth with a timeout
- Parameters:
mac- ble device's macAddressservice- Unique sign of bluetooth servicecharacter- A characteristic value under the Bluetooth servicedescriptor- A descriptor value under the Bluetooth charactervalue- The value of the bluetooth characteristic writtenresponse- The callback result of writing a characteristic value under the Bluetooth serviceBleBaseResponse
-
writeNoRsp
abstract void writeNoRsp(String mac, UUID service, UUID character, Array<byte> value, BleBaseResponse response)
Write a character value under a service of Bluetooth
- Parameters:
mac- ble device's macAddressservice- Unique sign of bluetooth servicecharacter- A characteristic value under the Bluetooth servicevalue- The value of the bluetooth characteristic writtenresponse- The callback result of writing a characteristic value under the Bluetooth serviceBleBaseResponse
-
notify
abstract void notify(String mac, UUID service, UUID character, BleNotifyAbilityResponse response)
notify a character value under a service of Bluetooth
- Parameters:
mac- ble device's macAddressservice- Unique sign of bluetooth servicecharacter- A characteristic value under the Bluetooth serviceresponse- The callback result of writing a characteristic value under the Bluetooth serviceBleBaseResponse
-
unnotify
abstract void unnotify(String mac, UUID service, UUID character, BleBaseResponse response)
-
readRssi
abstract void readRssi(String mac, BleGetRssiBaseResponse response)
read a rssi by mac
- Parameters:
mac- ble device's macAddressresponse- callback
-
configMtu
abstract void configMtu(String mac, int mtu, BleConfigMtuBaseResponse response)
-
registerBluetoothStateListener
abstract void registerBluetoothStateListener(BluetoothStateChangedReponse reponse)
-
unregisterBluetoothStateListener
abstract void unregisterBluetoothStateListener(BluetoothStateChangedReponse reponse)
-
refreshCache
abstract void refreshCache(String mac)
-
-
-
-