Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Solved What is the correct way to create a bluetooth server?

    C++ Gurus
    2
    3
    791
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DominusDRR
      DominusDRR last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • ?
        A Former User last edited by A Former User

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

        QBluetoothServer *rfcommServer = new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol, this);
        
        1 Reply Last reply Reply Quote 1
        • DominusDRR
          DominusDRR last edited by

          Ok. Thanks.

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

          QBluetoothServer *rfcommServer; 
           rfcommServer = new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol, this);
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post