0
if(socket->peerAddress().toString()!=addressToConnect)

i did it that way, where

socket - object of QBluetoothSocket

addressToConnect - QString object with contains address that socket been connected to

but that works only if connected device shuts off, and then turns on again, is there a way to check connection without getting device turning on again, in case it's just lost power, or something of that kind?

Giulio Caccin
  • 2,962
  • 6
  • 36
  • 57

1 Answers1

0

If I understand correctly you want to know if the device is still connected?

As per Documentation the socekt class provides the QBluetoothSocket::state() and QBlutoothSocket::error() functions. They provide the QBluetoothSocket::ConnectedState and QBluetoothSocket::RemoteHostClosedError (since Qt 5.10) types that might be what you are searching for.

You can then combine this with the check of the address you want to connect to.

paradx
  • 74
  • 12