import QtQuick 1.1 import com.nokia.meego 1.0 import QtMobility.connectivity 1.2 import qzeecontrol 1.0 Page { tools: commonTools Label { id: label anchors.centerIn: parent text: "Click to Scan" } Button{ id: scanButton anchors { horizontalCenter: parent.horizontalCenter top: label.bottom topMargin: 10 } text: "Connect" onClicked: { btDiscovery.discovery = true } } BluetoothDiscoveryModel{ id: btDiscovery discovery: false minimalDiscovery: true onDiscoveryChanged: { if(discovery){ label.text = "Scanning for devices..." scanButton.enabled = false }else{ label.text = "Scan finished." scanButton.enabled = true } } onNewServiceDiscovered: { console.log("Service " + service.serviceName + " found on " + service.deviceName + " at address " + service.deviceAddress + " on port " + service.servicePort + ".") //btSocket.service = service btConn.connect(service.deviceAddress, service.servicePort) } } /* BluetoothSocket{ id: btSocket onDataAvailable: { console.log("Data available: " + stringData.charCodeAt(0) + data) } onServiceChanged: { console.log("Service changed. Connecting...") connected = true } onConnectedChanged: { console.log("Connected.") } }*/ BtConnector{ id: btConn } }