void notifyDeviceDisconnected(@NonNull final BluetoothDevice device, final int status) {
		if (connectionState == BluetoothProfile.STATE_DISCONNECTED)
			return;

		final boolean wasConnected = connected;
		final boolean hadDiscoveredServices = servicesDiscovered;
		connected = false;
		ready = false;
		servicesDiscovered = false;
		serviceDiscoveryRequested = false;
		deviceNotSupported = false;
		mtu = 23;
		interval = latency = timeout = 0;
		connectionState = BluetoothGatt.STATE_DISCONNECTED;
		checkCondition();
		if (!wasConnected) {
			log(Log.WARN, () -> "Connection attempt timed out");
			close();
			// Close will not notify the observer as the device was not connected.
			postCallback(c -> c.onDeviceDisconnected(device));
			postConnectionStateChange(o -> o.onDeviceFailedToConnect(device, status));
			// ConnectRequest was already notified
		} else if (userDisconnected) {
			log(Log.INFO, () -> "Disconnected");
			// If Remove Bond was called, the broadcast may be called AFTER the device has disconnected.
			// In that case, we can't call close() here, as that would unregister the broadcast
			// receiver. Instead, close() will be called from the receiver.
			final Request request = this.request;
			if (request == null || request.type != Request.Type.REMOVE_BOND)
				close();
			postCallback(c -> c.onDeviceDisconnected(device));
			postConnectionStateChange(o -> o.onDeviceDisconnected(device, status));
			if (request != null && request.type == Request.Type.DISCONNECT) {
				request.notifySuccess(device);
				this.request = null;
			}
		} else {
			log(Log.WARN, () -> "Connection lost");
			postCallback(c -> c.onLinkLossOccurred(device));
			// When the device indicated disconnection, return the REASON_TERMINATE_PEER_USER.
			// Otherwise, return REASON_LINK_LOSS.
			// See: https://github.com/NordicSemiconductor/Android-BLE-Library/issues/284
			final int reason = status == ConnectionObserver.REASON_TERMINATE_PEER_USER ?
					ConnectionObserver.REASON_TERMINATE_PEER_USER : ConnectionObserver.REASON_LINK_LOSS;
			postConnectionStateChange(o -> o.onDeviceDisconnected(device, reason));
			// We are not closing the connection here as the device should try to reconnect
			// automatically.
			// This may be only called when the shouldAutoConnect() method returned true.
		}
		synchronized (valueChangedCallbacks) {
			for (final ValueChangedCallback callback : valueChangedCallbacks.values()) {
				callback.notifyClosed();
			}
			valueChangedCallbacks.clear();
		}
		dataProviders.clear();
		batteryLevelNotificationCallback = null;
		batteryValue = -1;
		if (hadDiscoveredServices) {
			manager.onServicesInvalidated();
		}
		onDeviceDisconnected();
	}
This method should nullify all services and characteristics of the device.
<p>
It's called when the services were invalidated and can no longer be used. Most probably the
device has disconnected, Service Changed indication was received, or
{@link BleManager#refreshDeviceCache()} request was executed, which has invalidated cached
services.
@deprecated Use {@link BleManager#onServicesInvalidated()} instead.
ble/src/main/java/no/nordicsemi/android/ble/BleManagerHandler.java