-
public interface IThingBleOperator
BLE operate manager. Provide basic ability of Normal BLE
-
-
Method Summary
Modifier and Type Method Description abstract IThingThirdProtocolSupport
getThingThirdProtocolSupport()
abstract void
startLeScan(int timeout, ScanType type, BleScanResponse response)
Scan surrounding Bluetooth devices abstract void
startLeScan(LeScanSetting setting, BleScanResponse response)
Scan surrounding Bluetooth devices ,support multi scan type abstract void
clearLeCache()
clear scan cache abstract void
startScan(List<ScanFilter> filters, ScanSettings settings, PendingIntent callbackIntent)
pendingIntent scan by Android system api abstract void
stopScan(PendingIntent callbackIntent)
stop pendingIntent scan abstract void
stopLeScan()
stop scan abstract void
connectBleDevice(String address, LeConnectResponse response)
Connect normal bluetooth devices, only physical connection, you can connect all Bluetooth devices. abstract void
registerBleConnectStatus(String address, LeConnectStatusResponse response)
Register normal bluetooth connection status monitoring. abstract void
unregisterBleConnectStatus(String address)
unregister normal bluetooth connection status monitoring. abstract void
disconnectBleDevice(String address)
disconnect normal bluetooth abstract void
readBluetoothRssi(String mac, BleRssiListener listener)
read device rssi abstract boolean
isBluetoothOpened()
is phone bluetooth open abstract boolean
openBluetooth()
open the phone bluetooth abstract boolean
closeBluetooth()
close the phone bluetooth abstract boolean
isBleSupported()
Does the phone support Bluetooth abstract int
getBondState(String mac)
Get Bluetooth binding statusBOND_NONE = 10BOND_BONDING = 11BOND_BONDED = 12code = -1 ,maybe no bluetooth connect permission abstract void
registerBluetoothStateListener(BluetoothStateChangedListener listener)
abstract void
unregisterBluetoothStateListener(BluetoothStateChangedListener listener)
abstract void
createBond(String deviceMac, IResultCallback response)
Start the bonding (pairing) process with the remote device. abstract void
removeBond(String deviceMac, IResultCallback removeBondResponse)
Remove bond (pairing) with the remote device. abstract void
addConnectHidListener(String deviceMac, IResultCallback listener)
abstract void
removeConnectHidListener(String deviceMac)
abstract void
startScanBindDevice(int timeout, ScanType type, IThingResultCallback<String> response)
Scan surrounding Bluetooth devices -
-
Method Detail
-
getThingThirdProtocolSupport
abstract IThingThirdProtocolSupport getThingThirdProtocolSupport()
-
startLeScan
abstract void startLeScan(int timeout, ScanType type, BleScanResponse response)
Scan surrounding Bluetooth devices
- Parameters:
timeout
- scan timeouttype
- scan type see ScanTyperesponse
- response BleScanResponse
-
startLeScan
abstract void startLeScan(LeScanSetting setting, BleScanResponse response)
Scan surrounding Bluetooth devices ,support multi scan type
- Parameters:
setting
- scan setting LeScanSettingresponse
- response BleScanResponse
-
clearLeCache
abstract void clearLeCache()
clear scan cache
-
startScan
abstract void startScan(List<ScanFilter> filters, ScanSettings settings, PendingIntent callbackIntent)
pendingIntent scan by Android system api
- Parameters:
filters
- see ScanFiltersettings
- see ScanSettingscallbackIntent
- see PendingIntent
-
stopScan
abstract void stopScan(PendingIntent callbackIntent)
stop pendingIntent scan
- Parameters:
callbackIntent
- see PendingIntent
-
stopLeScan
abstract void stopLeScan()
stop scan
-
connectBleDevice
abstract void connectBleDevice(String address, LeConnectResponse response)
Connect normal bluetooth devices, only physical connection, you can connect all Bluetooth devices.This type of connect returns only after the connection is successful
- Parameters:
address
- Bluetooth device addressresponse
- connect response LeConnectResponse
-
registerBleConnectStatus
abstract void registerBleConnectStatus(String address, LeConnectStatusResponse response)
Register normal bluetooth connection status monitoring.
- Parameters:
address
- device's addressresponse
- response
-
unregisterBleConnectStatus
abstract void unregisterBleConnectStatus(String address)
unregister normal bluetooth connection status monitoring.
- Parameters:
address
- device's address
-
disconnectBleDevice
abstract void disconnectBleDevice(String address)
disconnect normal bluetooth
- Parameters:
address
- device's address
-
readBluetoothRssi
abstract void readBluetoothRssi(String mac, BleRssiListener listener)
read device rssi
-
isBluetoothOpened
@Deprecated() abstract boolean isBluetoothOpened()
is phone bluetooth open
-
openBluetooth
@Deprecated() abstract boolean openBluetooth()
open the phone bluetooth
-
closeBluetooth
@Deprecated() abstract boolean closeBluetooth()
close the phone bluetooth
-
isBleSupported
abstract boolean isBleSupported()
Does the phone support Bluetooth
-
getBondState
abstract int getBondState(String mac)
Get Bluetooth binding statusBOND_NONE = 10BOND_BONDING = 11BOND_BONDED = 12code = -1 ,maybe no bluetooth connect permission
- Parameters:
mac
- device's address
-
registerBluetoothStateListener
abstract void registerBluetoothStateListener(BluetoothStateChangedListener listener)
-
unregisterBluetoothStateListener
abstract void unregisterBluetoothStateListener(BluetoothStateChangedListener listener)
-
createBond
abstract void createBond(String deviceMac, IResultCallback response)
Start the bonding (pairing) process with the remote device.
This is an asynchronous call, it will return immediately. Registerfor ACTION_BOND_STATE_CHANGED intents to be notified whenthe bonding process completes, and its result.
Android system services will handle the necessary user interactionsto confirm and complete the bonding process.
-
removeBond
abstract void removeBond(String deviceMac, IResultCallback removeBondResponse)
Remove bond (pairing) with the remote device.
Delete the link key associated with the remote device, andimmediately terminate connections to that device that requireauthentication and encryption.
- Parameters:
deviceMac
- device's mac
-
addConnectHidListener
abstract void addConnectHidListener(String deviceMac, IResultCallback listener)
-
removeConnectHidListener
abstract void removeConnectHidListener(String deviceMac)
-
startScanBindDevice
abstract void startScanBindDevice(int timeout, ScanType type, IThingResultCallback<String> response)
Scan surrounding Bluetooth devices
- Parameters:
timeout
- scan timeouttype
- scan type see ScanTyperesponse
- response the devId of bind device
-
-
-
-