import QtQuick 2.0
Item {
id: startpadConn
height: 0
width: 0
opacity: 0
visible: false
signal pushed()
property bool connected: false
property var status: {'status': startpadConn.state, 'progress': get_progress()}
Timer {
//timer that refreshes the connection state to the buzzer
id: connectionRefreshTimer
running: root.state !== "RUNNING" && root.state !== "STARTING" && startpadConn.status !== "connecting"
repeat: false
interval: 1000
onTriggered: {
_cppStartpadConn.refresh()
if(!_cppStartpadConn.get("connected") && startpadConn.state !== "connecting"){
startpadConn.state = "disconnected"
}
connectionRefreshTimer.start()
//timer that checks, if the button has been pushed
id: running_refresh_timer
running: root.state === "RUNNING"
interval: 1
if(_cppStartpadConn.buzzer_triggered()){
startpadConn.pushed()
if(root.state === "RUNNING" || root.state === "STARTING"){
running_refresh_timer.start()
id: prog_refresh
running: startpadConn.state === "connecting"
repeat: true
startpadConn.status.progress = get_progress()
states: [
State {
name: "disconnected"
PropertyChanges {
target: startpadConn
},
name: "connecting"
name: "connected"
]
function connect(){
startpadConn.state = "connecting"
if(_cppStartpadConn.connect()){
startpadConn.state = "connected"
return(true)
else {
return(false)
function get_progress(){
return(_cppStartpadConn.get("connection_progress"))