def _on_disconnected(self, device):
        """Callback function called when a disconnected event has been received.
        This resets any open interfaces on the virtual device and clears any
        in progress traces and streams.
        It is executed in the baBLE working thread: should not be blocking.

        Args:
            device (dict): Information about the newly connected device
        """

        self._logger.debug("Device disconnected event: {}".format(device))

        if self.streaming:
            self.device.close_streaming_interface()
            self.streaming = False

        if self.tracing:
            self.device.close_tracing_interface()
            self.tracing = False

        self.device.connected = False
        self.connected = False
        self._connection_handle = 0
        self.header_notif = False
        self.payload = False

        self._clear_reports()
        self._clear_traces()

        self._defer(self.set_advertising, [True])
        self._audit('ClientDisconnected')