2 * Copyright (C) 2016 The Qt Company Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 import QtWebSockets 1.0
19 import 'MessageId.js' as MessageId
25 property string statusString: "waiting..."
27 property real fanSpeed: 0.0
29 property Connections c : Connections {
32 var json = [MessageId.call, '9999', 'hvac/set', {'FanSpeed': fanSpeed}]
33 console.debug(JSON.stringify(json))
34 sendTextMessage(JSON.stringify(json))
38 onTextMessageReceived: {
39 var json = JSON.parse(message)
40 var request = json[2].request
41 var response = json[2].response
46 root.statusString = request.info
48 case MessageId.reterr:
49 root.statusString = "Bad return value, binding probably not installed"
58 root.statusString = "WebSocket error: " + root.errorString