public class CentralManager
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BACKGROUND_SCAN_DURATION
The default duration in milliseconds of the Bluetooth scan duration when clients are in the background
|
static int |
DEFAULT_BACKGROUND_SCAN_INTERVAL
The default duration in milliseconds of the Bluetooth scan interval when clients are in the background
|
static int |
DEFAULT_FOREGROUND_SCAN_DURATION
The default duration in milliseconds of the Bluetooth scan duration when clients are in the foreground
|
static int |
DEFAULT_FOREGROUND_SCAN_INTERVAL
The default duration in milliseconds of the Bluetooth scan interval when clients are in the foreground
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
void |
disableBluetooth()
Disable bluetooth
|
void |
disconnectAllDevice() |
void |
enableBluetooth()
Open bluetooth
|
CentralManager |
enableLog(boolean enable)
print log?
|
java.util.List<Peripheral> |
getAllConnectedDevice() |
android.bluetooth.BluetoothAdapter |
getBluetoothAdapter()
Get the BluetoothAdapter
|
BLEConnectionCompat |
getConnectionCompat() |
android.content.Context |
getContext() |
static CentralManager |
getInstance() |
int |
getMaxConnectCount()
Get the maximum number of connections
|
MultiplePeripheralController |
getMultiplePeripheralController()
Get the multiple peripheral Controller
|
int |
getOperateTimeout()
Get operate timeout
|
Peripheral |
getPeripheral(java.lang.String address) |
void |
handleException(BLEException exception)
Handle Exception Information
|
void |
init(android.content.Context context) |
boolean |
isBLEConnected(java.lang.String address) |
boolean |
isBluetoothEnable()
judge Bluetooth is enable
|
boolean |
isConnected(java.lang.String address) |
boolean |
isConnecting(java.lang.String address) |
boolean |
isScanning() |
boolean |
isSupportBle()
is support ble?
|
Peripheral |
retrievePeripheral(byte[] address) |
Peripheral |
retrievePeripheral(java.lang.String address) |
CentralManager |
setMaxConnectCount(int maxCount)
Set the maximum number of connections
|
CentralManager |
setOperateTimeout(int operateTimeout)
Set operate timeout
|
void |
startScan(boolean isCycled,
ScanRuleConfig config,
ScanCallback callback) |
void |
stopScan() |
public static final int DEFAULT_FOREGROUND_SCAN_DURATION
public static final int DEFAULT_FOREGROUND_SCAN_INTERVAL
public static final int DEFAULT_BACKGROUND_SCAN_DURATION
public static final int DEFAULT_BACKGROUND_SCAN_INTERVAL
public static CentralManager getInstance()
public void init(android.content.Context context)
public boolean isScanning()
public void startScan(boolean isCycled,
ScanRuleConfig config,
ScanCallback callback)
public void stopScan()
public android.content.Context getContext()
public android.bluetooth.BluetoothAdapter getBluetoothAdapter()
public void handleException(BLEException exception)
public MultiplePeripheralController getMultiplePeripheralController()
public BLEConnectionCompat getConnectionCompat()
public int getMaxConnectCount()
public CentralManager setMaxConnectCount(int maxCount)
public int getOperateTimeout()
public CentralManager setOperateTimeout(int operateTimeout)
public CentralManager enableLog(boolean enable)
public boolean isSupportBle()
public void enableBluetooth()
public void disableBluetooth()
public boolean isBluetoothEnable()
public Peripheral retrievePeripheral(java.lang.String address)
public Peripheral retrievePeripheral(byte[] address)
public java.util.List<Peripheral> getAllConnectedDevice()
public boolean isBLEConnected(java.lang.String address)
public boolean isConnecting(java.lang.String address)
public boolean isConnected(java.lang.String address)
public Peripheral getPeripheral(java.lang.String address)
public void disconnectAllDevice()
public void destroy()