QML Bluetooth Example



  • Hi,

    Apologies if this is a bit vague.

    I've run the QML Bluetooth Example. It runs on both Mac os and iOS but the BluetoothDiscoveryModel doesn't seem to work. It finds the devices in range but returns 00:00:00:00:00:00 as the address for all devices. It doesn't find any services in either minimal or full discovery modes.

    I'm using macOS 10.12, iOS 10.3.1, Qt 5.8

    0_1491620992529_IMG_0133.PNG

    Does anyone have any ideas on what I can do or more info I can give?

    Cheers,

    Al


  • Moderators

    @albanj Just a guess, does it require some sort of permissions to access the bluetooth on iOS that you aren't giving it?

    Also side note, Qt has had bluetooth problems for a long time. You may want to try another bluetooth library to see if it is a Qt issue or not.

    The vplay guys usually come through these threads but just in case they miss it, you could try their bluetooth to test with.. v-play.net. ;)



  • Hi, thanks for your suggestions.

    Other apps (from the app store) can correctly discover the devices and their services. There doesn't appear to be any permissions needed. I have tried adding the bluetooth sharing string to my project-info.plist. I'll do a bit more reading on this though in case I've missed something.

    I do use v-play but as far as I can tell they don't do anything special with bluetooth.

    Perhaps I'll take this as an opportunity to learn swift.

    Thanks again,

    Al


  • Moderators

    @albanj Sorry wish I had more advice to give, but I haven't written any apps for iOS yet, and Qt's bluetooth has failed me every time I've tried to use it on anything other than some simple device like a headset.


  • Qt Champions 2016

    are you sure you're not trying to get the address unde iOS or MAcOS ? this would fail !
    here's from my BT LE Example app

    QString MyBluetoothDeviceInfo::getAddress() const
    {
    #if defined (Q_OS_IOS) || defined (Q_OS_MAC)
        // On MacOS and iOS we get no access to device address,
        // only unique UUIDs generated by Core Bluetooth.
        qDebug() << "getting address from deviceUuid()";
        return mDevice.deviceUuid().toString();
    #else
        return mDevice.address().toString();
    #endif
    }
    

    I'll publish my BT LE Example apps soon - probably one week to work on ...



  • Hi,

    I've been trying to use the BluetoothDiscoveryModel QML Type

    When a device is discovered, one of the properties returned is called remoteAddress. There doesn't seem to be a distinction between address and UUID in the QML type. That could well be the problem.

    Thanks for your input. This might turn out to be a bigger small project than I was hoping for.

    Regards,

    Al


  • Qt Champions 2016

    @albanj said in QML Bluetooth Example:

    ...This might turn out to be a bigger small project than I was hoping for.

    there's always a mistake: marketing and product managers are thinking because BT LE devices are small and cheap - same happens for the software solutions ;-)

    It's not trivial to develop a stable running BT LE APP - so many states, errors, signals, can happen

    I'm just in the process of doing this using custom BT LE devices and also a WaiterLock BT LE device (for Login/Logout)
    To separate this from the APPs where I have to integrate the BT LE device - logic I'm developing my own BT LE Example app with Scanner (Device Discovery) and exploring all the Services, Characteristics, Descriptors and also demo HowTo manage some standard devcies (HeartRate, WeightControl)

    stay tuned - my BT LE Example APP will be available at Github soon. Covering all the new stuff from Qt 5.8 and also using QtQuickControls2. Tested on mobile (Android, iOS)

    BTW: I'm doing all the BT LE stuff from Qt/C++ not QML - QML only for UI



  • IT's just a hobby project for me. It's been a few years since I even looked at any C++. It does seem like that may be the way to go though. From the docs and the scanner example it seems like the QML side should be capable on iOS but perhaps I've missed something.

    Thanks for your time and I look forward to your example project.

    Al


Log in to reply
 

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