private final BluetoothGattServerCallback mGattServerCallback = new BluetoothGattServerCallback() {
@Override
public void onConnectionStateChange(BluetoothDevice device, final int status, int newState) {
  super.onConnectionStateChange(device, status, newState);
  if (status == BluetoothGatt.GATT_SUCCESS) {
    if (newState == BluetoothGatt.STATE_CONNECTED) {
      mBluetoothDevices.add(device);
      updateConnectedDevicesStatus();
      String macAddress = android.provider.Settings.Secure.getString(getApplication().getContentResolver(), "bluetooth_address");
      Log.v(TAG, "Connected to device: " + device.getAddress());
      Log.d("/bleUUID","uuid is " +macAddress);
      Log.d("/bleUUID","uuid is " +CHARACTERISTIC_USER_DESCRIPTION_UUID);
    } else if (newState == BluetoothGatt.STATE_DISCONNECTED) {
      mBluetoothDevices.remove(device);
      updateConnectedDevicesStatus();
      Log.v(TAG, "Disconnected from device");
    }
  } else {
    mBluetoothDevices.remove(device);
    updateConnectedDevicesStatus();
    // There are too many gatt errors (some of them not even in the documentation) so we just
    // show the error to the user.
    final String errorMessage = getString(com.efftronics.android.bleperipheral.R.string.status_errorWhenConnecting) + ": " + status;
    runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(Peripheral.this, errorMessage, Toast.LENGTH_LONG).show();
      }
    });
    Log.e(TAG, "Error when connecting: " + status);
  }
}
}

在断开与nrf连接的连接时,此 onConnectionStateChange 未调用 . 为什么?

我正在实施BLE外围应用程序 . 我的应用是广告(外围模式) . 和NRF连接(中央模式)正在扫描广告设备 .

当另一个应用程序连接到我的外围应用程序时,我的常用应用程序的地址显示在NRF连接中 . 这个地址来自这条线 .

private static final UUID CHARACTERISTIC_USER_DESCRIPTION_UUID = UUID .fromString(“00002901-0000-1000-8000-00805f9b34fb”);

但每次连接到NRF连接时,此地址都在变化 . 为什么?

如果我每次都需要相同的地址 . 我怎样才能做到这一点?

一段时间后,我的外围应用程序自动断开连接超时错误 . 为什么?

请帮我 . 任何帮助,将不胜感激 .
this is my ble peripheral app which is advertising.

This is other app which is  scanning for the devices and connected to my peripheral app(installed in lenovo tab). And here showing some address like 58:31:8F:FF:56:AB. If I disconnect my peripheral app and again reconnected then this address is changing every time

This error is coming in the nrFConect app(central). Why it is coming?