2 * Copyright 2012 Ruediger Gad
4 * This file is part of QZeeControl.
6 * QZeeControl is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * QZeeControl is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with QZeeControl. If not, see <http://www.gnu.org/licenses/>.
21 import com.nokia.meego 1.0
22 import QtMobility.connectivity 1.2
23 import qzeecontrol 1.0
30 anchors.centerIn: parent
31 text: "Press to connect."
38 horizontalCenter: parent.horizontalCenter
46 btDiscovery.discovery = true
54 horizontalCenter: parent.horizontalCenter
55 top: connectButton.bottom
66 BluetoothDiscoveryModel{
70 minimalDiscovery: true
74 label.text = "Scanning for devices..."
75 connectButton.enabled = false
76 disconnectButton.enabled = false
78 connectButton.enabled = true
79 disconnectButton.enabled = false
83 onNewServiceDiscovered: {
84 console.log("Service " + service.serviceName + " found on " + service.deviceName + " at address " + service.deviceAddress + " on port " + service.servicePort + ".")
85 //btSocket.service = service
86 btConn.connect(service.deviceAddress, service.servicePort)
95 console.log("Data available: " + stringData.charCodeAt(0) + data)
99 console.log("Service changed. Connecting...")
103 onConnectedChanged: {
104 console.log("Connected.")
112 connectButton.enabled = false
113 disconnectButton.enabled = true
114 label.text = "Connected."
118 connectButton.enabled = true
119 disconnectButton.enabled = false
120 label.text = "Press to connect."
124 console.log("Stick moved. x: " + x + " y: " + y)
128 console.log("Buttons changed. A: " + a + " B: " + b + " C: " + c + " D: " + d)