Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt and Bluetooth

Qt and Bluetooth

Scheduled Pinned Locked Moved General and Desktop
qt 5.4.0bluetooth
3 Posts 3 Posters 1.6k Views
  • 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.
  • A Offline
    A Offline
    avrik
    wrote on 18 May 2015, 11:43 last edited by avrik
    #1

    So, I created server by this tutorial - http://doc.qt.io/qt-5/qtbluetooth-btchat-example.html.

    When, I'm trying to connect to my mac with BLE iPhone application I only see unknown service with system information about mac.

    System: Ubuntu 15.04
    Console output:

    Starting bluetooth server!
    "28:CF:E9:1F:2C:D8"
    Bluetooth server started!
    

    I also tried to launch this application on Mac OS X with Qt 5.5. Same result.

    Code:

    QBluetoothLocalDevice localDevice;
    QBluetoothAddress adapterAddress = localDevice.address();
    
    qWarning() << "Starting bluetooth server!";
    qWarning() << adapterAddress;
    
    rfcommServer = new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol, this);
    connect(rfcommServer, SIGNAL(newConnection()), this, SLOT(clientConnected()));
    bool result = rfcommServer->listen(adapterAddress);
    if (!result) {
        qWarning() << "Cannot bind chat server to " << adapterAddress.toString();
        return;
    }
    
    qWarning() << "Bluetooth server started!";
    
    serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceName, tr("Bt Chat Server"));
    serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceDescription,
                             tr("Example bluetooth chat server"));
    serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceProvider, tr("qt-project.org"));
    
    static const QLatin1String serviceUuid("e8e10f95-1a70-4b27-9ccf-02010264e9c8");
    serviceInfo.setServiceUuid(QBluetoothUuid(serviceUuid));
    
    QBluetoothServiceInfo::Sequence publicBrowse;
    publicBrowse << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::PublicBrowseGroup));
    serviceInfo.setAttribute(QBluetoothServiceInfo::BrowseGroupList, publicBrowse);
    
    QBluetoothServiceInfo::Sequence protocolDescriptorList;
    QBluetoothServiceInfo::Sequence protocol;
    protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap));
    protocolDescriptorList.append(QVariant::fromValue(protocol));
    protocol.clear();
    protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::Rfcomm))
             << QVariant::fromValue(quint8(rfcommServer->serverPort()));
    protocolDescriptorList.append(QVariant::fromValue(protocol));
    serviceInfo.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList,
                             protocolDescriptorList);
    
    serviceInfo.registerService(adapterAddress);
    
    1 Reply Last reply
    0
    • N Offline
      N Offline
      nedo99
      wrote on 18 May 2015, 16:24 last edited by
      #2

      I think that there is no bluetooth support for the Mac OS (as far as I understood, you are running Qt on Mac OS).

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 18 May 2015, 19:54 last edited by
        #3

        @nedo99 There is starting with Qt 5.5, see the new feature list

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1

        3/3

        18 May 2015, 19:54

        • Login

        • Login or register to search.
        3 out of 3
        • First post
          3/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved