Warning, /sdk/cutehmi/extensions/CuteHMI/Examples/Modbus/Requests.3/View.qml is written in an unsupported language. File is not indexed.
0001 import QtQml 2.2
0002 import QtQuick 2.11
0003 import QtQuick.Layouts 1.3
0004 import QtQuick.Controls 2.1
0005
0006 import CuteHMI.Modbus 4.0
0007 import CuteHMI.Services 3.0
0008
0009 Item {
0010 anchors.fill: parent
0011
0012 TCPServer {
0013 id: server
0014 }
0015
0016 TCPClient {
0017 id: client
0018 }
0019
0020 RowLayout {
0021 anchors.fill: parent
0022 anchors.margins: 40
0023 spacing: 40
0024
0025 ColumnLayout {
0026 spacing: 40
0027
0028 DeviceControl {
0029 text: qsTr("Server state:")
0030 device: server
0031 configurationItem: TCPServerConfiguration {
0032 server: server
0033 }
0034 }
0035
0036 DeviceControl {
0037 text: qsTr("Client state:")
0038 device: client
0039 configurationItem: TCPClientConfiguration {
0040 client: client
0041 }
0042 }
0043 }
0044
0045 ColumnLayout {
0046 Layout.fillHeight: true
0047 Layout.fillWidth: true
0048
0049 ComboBox {
0050 id: deviceBox
0051
0052 model: ["Server", "Client"]
0053 currentIndex: 1
0054
0055 property AbstractDevice device: client
0056
0057 onActivated: {
0058 if (currentText === "Server")
0059 device = server
0060 else if (currentText === "Client")
0061 device = client
0062 }
0063
0064 onDeviceChanged: {
0065 device.requestCompleted.disconnect(deviceRquestReplyArea.onRequestCompleted)
0066 device.requestCompleted.connect(deviceRquestReplyArea.onRequestCompleted)
0067 }
0068 }
0069
0070 Flickable {
0071 Layout.fillHeight: true
0072 Layout.fillWidth: true
0073
0074 ScrollBar.vertical: ScrollBar {}
0075 ScrollBar.horizontal: ScrollBar {}
0076
0077 clip: true
0078 contentWidth: requestsLayout.implicitWidth
0079 contentHeight: requestsLayout.implicitHeight
0080
0081 ColumnLayout {
0082 id: requestsLayout
0083
0084 ReadCoilsControl {
0085 device: deviceBox.device
0086 }
0087
0088 WriteCoilControl {
0089 device: deviceBox.device
0090 }
0091
0092 WriteMultipleCoilsControl {
0093 device: deviceBox.device
0094 }
0095
0096 ReadDiscreteInputsControl {
0097 device: deviceBox.device
0098 }
0099
0100 WriteDiscreteInputControl {
0101 device: deviceBox.device
0102 }
0103
0104 WriteMultipleDiscreteInputsControl {
0105 device: deviceBox.device
0106 }
0107
0108 ReadHoldingRegistersControl {
0109 device: deviceBox.device
0110 }
0111
0112 WriteHoldingRegisterControl {
0113 device: deviceBox.device
0114 }
0115
0116 WriteMultipleHoldingRegistersControl {
0117 device: deviceBox.device
0118 }
0119
0120 ReadInputRegistersControl {
0121 device: deviceBox.device
0122 }
0123
0124 WriteInputRegisterControl {
0125 device: deviceBox.device
0126 }
0127
0128 WriteMultipleInputRegistersControl {
0129 device: deviceBox.device
0130 }
0131
0132 ReadExceptionStatusControl {
0133 device: deviceBox.device
0134 }
0135
0136 DiagnosticsControl {
0137 device: deviceBox.device
0138 }
0139
0140 ReportSlaveIdControl {
0141 device: deviceBox.device
0142 }
0143
0144 FetchCommEventCounterControl {
0145 device: deviceBox.device
0146 }
0147
0148 FetchCommEventLogControl {
0149 device: deviceBox.device
0150 }
0151
0152 ReadFIFOQueueControl {
0153 device: deviceBox.device
0154 }
0155
0156 MaskWrite4xRegisterControl {
0157 device: deviceBox.device
0158 }
0159
0160 ReadWriteMultipleHoldingRegistersControl {
0161 device: deviceBox.device
0162 }
0163
0164 ReadFileRecordControl {
0165 device: deviceBox.device
0166 }
0167
0168 WriteFileRecordControl {
0169 device: deviceBox.device
0170 }
0171 }
0172 }
0173
0174 TextArea {
0175 id: deviceRquestReplyArea
0176
0177 readOnly: true
0178
0179 function onRequestCompleted(request, reply) {
0180 text = "Request: " + JSON.stringify(request) + "\nReply: " + JSON.stringify(reply)
0181 }
0182 }
0183
0184 }
0185 }
0186 }
0187
0188 //(c)C: Copyright © 2022-2024, Michał Policht <michal@policht.pl>. All rights reserved.
0189 //(c)C: SPDX-License-Identifier: LGPL-3.0-or-later OR MIT
0190 //(c)C: This file is a part of CuteHMI.
0191 //(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
0192 //(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
0193 //(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>.
0194 //(c)C: Additionally, this file is licensed under terms of MIT license as expressed below.
0195 //(c)C: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
0196 //(c)C: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
0197 //(c)C: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.