通常手机端与蓝牙外设进行BLE连接时,调用如下的API:
private BluetoothDevice mDevice;
private BluetoothGatt mBluetoothGatt;
mBluetoothGatt = mDevice.connectGatt(mContext, false, mGattCallback);
private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
@Override
public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
}
@Override
public void onConnectionStateChange(final BluetoothGatt gatt, int status, int newState)