Android QBluetoothSocket::SocketError( 8 )



  • That is the error i get... for the last 2 weeks.

    I am trying to comunicate two devices to try the new characteristic... but i cant make it work.

    basically
    I register one as a server
    @
    rfcommServer = new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol, this);
    connect(rfcommServer, SIGNAL(newConnection()), this, SLOT(clientConnected()));

    connect(rfcommServer,SIGNAL(error(QBluetoothServer::Error)),this,SLOT(serverError(QBluetoothServer::Error)));
    rfcommServer->listen(QBluetoothUuid(SERVICE_UUID),SERVICE_NAME);
    @

    The other lookup for services... and is discovering it... and i try to connect using:
    @
    QBluetoothSocket* socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
    socket->connectToService(serviceInfo);
    @
    but connection fails, throwing the error : QBluetoothSocket::SocketError( 8 )

    Any idea?

    Thx!


  • Lifetime Qt Champion

    Hi,

    Are you using Qt 5.3 ? If not, you will need to, the bluetooth module for android has been ported for this version of Qt



  • yes, i am trying the 5.3.0 beta version.
    But as it is my first time using the bluetooth module, i dont really know if i am doing something wrong or there are limitations in the android version.

    Someone got the examples working?



  • Ok, i am going to self respond, as finally i got it working.

    @
    //socket->connectToService(serviceInfo);
    socket->connectToService(serviceInfo.device().address(),QBluetoothUuid(SERVICE_UUID));
    @

    Seems that call to connecToService with the serviceInfo that you got during discovering is not working. I think it must be a bug (we talk about 5.3.0beta) so i am going to leave it report. :)

    Thx anyway :)


  • Lifetime Qt Champion

    Might be, since you are going to create a report don't forget to post a link here so other user may easily find it :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.