What is the correct way to create a bluetooth server?



  • Hi.

    I am trying to follow the steps indicated in the following thread:

    link text

    I am trying to create a bluetooth server as follows:

    #include <QBluetoothServer>
    
     rfcommServer = new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol, this);
     connect(rfcommServer, SIGNAL(newConnection()), this, SLOT(clientConnected()));
     QBluetoothSocket *socket = rfcommServer->nextPendingConnection();
    

    But I get the following error:

    alt text

    Thanks for any help.


  • Moderators

    Hi! In C++ you need to declare a variable before you can use it. So, something like:

    QBluetoothServer *rfcommServer = new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol, this);
    


  • Ok. Thanks.

    I must remember my C ++ classes from many years ago.

    QBluetoothServer *rfcommServer; 
     rfcommServer = new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol, this);
    

Log in to reply
 

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