I like to build a qml-based app with bluetooth support. My code works well for the Desktop Kit in the Ubuntu SDK but fails on the BQ Aquaris 4.5 with the error message 'module "QtBluetooth" is not installed'.

My questions:

  • Is it planned to support QtBluetooth on Ubuntu Phone in the near future?
  • If not: Is it possible to install QtBluetooth manually?
  • If not: Are there alternatives for QtBluetooth?

If anybody like to try out just create a qml-project in the ubuntu sdk and copy/paste the following code:

import QtQuick 2.4
import Ubuntu.Components 1.2
import Ubuntu.Components 1.2 as Toolkit
import Ubuntu.Components.ListItems 1.0 as ListItem
import QtBluetooth 5.2


MainView {
    width: units.gu(40)
    height: units.gu(60)

    Page {
        title: i18n.tr("Bluetooth")
        property BluetoothService currentService

        BluetoothDiscoveryModel {
            id: btModel
            running: false
            discoveryMode: BluetoothDiscoveryModel.DeviceDiscovery
            onDiscoveryModeChanged: console.log("Discovery mode: " + discoveryMode)
            onServiceDiscovered: console.log("Found new service " + service.deviceAddress + " " + service.deviceName + " " + service.serviceName);
            onDeviceDiscovered: console.log("New device: " + device)
            onErrorChanged: {
                switch (btModel.error) {
                case BluetoothDiscoveryModel.PoweredOffError:
                    console.log("Error: Bluetooth device not turned on"); break;
                case BluetoothDiscoveryModel.InputOutputError:
                    console.log("Error: Bluetooth I/O Error"); break;
                case BluetoothDiscoveryModel.InvalidBluetoothAdapterError:
                    console.log("Error: Invalid Bluetooth Adapter Error"); break;
                case BluetoothDiscoveryModel.NoError:
                    break;
                default:
                    console.log("Error: Unknown Error"); break;
                }
            }
       }

        Button{
            id: scanner
            anchors.top: parent.top
            anchors.left: parent.left
            anchors.margins: units.gu(2)
            width: parent.width / 2
            text: "Scan"
            onClicked: btModel.running=true
        }

        ActivityIndicator {
            id: busy
            anchors.right: parent.right
            anchors.top: parent.top
            anchors.margins: units.gu(2)
            running: btModel.running
        }

        ListItem.ItemSelector {
            anchors.top: busy.bottom //+ units.gu(15)
            anchors.margins: units.gu(2)
            text: i18n.tr("Bluetooth Devices:")
            expanded: true

            model: btModel
            delegate: Toolkit.OptionSelectorDelegate { text: deviceName; subText: remoteAddress }
        }
    }
}
share|improve this question
    
"QML Bluetooth Scanner Example" fine compile for ubuntu-sdk Qt Creator 3.5.0 Based on Qt 5.4.2 (GCC 4.8.4, 64 bit) – ADR Feb 20 '16 at 3:43
    
It is now possible to run the code on the Ubuntu phone thanks to the last OTA update. However, there are still problems since it always gets Bluetooth I/O errors. – Birger Apr 14 '16 at 13:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.