Suporte a QtBluetooth para o Ubuntu Touch

1

Eu gosto de criar um aplicativo baseado em qml com suporte a bluetooth. Meu código funciona bem para o Desktop Kit no Ubuntu SDK, mas falha no BQ Aquaris 4.5 com a mensagem de erro 'module' QtBluetooth "não está instalada '.

Minhas perguntas:

  • Está previsto apoiar o QtBluetooth no Ubuntu Phone num futuro próximo?
  • Se não: É possível instalar o QtBluetooth manualmente?
  • Se não: Existem alternativas para o QtBluetooth?

Se alguém quiser experimentar, basta criar um projeto qml no sdk do Ubuntu e copiar / colar o seguinte código:

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 }
        }
    }
}
    
por Birger 20.10.2015 / 00:17

0 respostas