Warning, /sdk/cutehmi/extensions/CuteHMI/Examples/Modbus/Requests.3/ReadWriteMultipleHoldingRegistersControl.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.0
0002 import QtQuick.Controls 2.0
0003 import QtQuick.Layouts 1.0
0004
0005 import CuteHMI.Modbus 4.0
0006
0007 RowLayout {
0008 property AbstractDevice device
0009
0010 Button {
0011 text: "Read/write multiple holding registers"
0012 onClicked: {
0013 var values = []
0014 for (var i = 0; i < repeater.count; i++)
0015 values.push(repeater.itemAt(i).value)
0016 device.requestReadWriteMultipleHoldingRegisters(readAddressBox.value, readAmountBox.value, writeAddressBox.value, values)
0017 }
0018 }
0019
0020 Label {
0021 text: qsTr("Read address:")
0022 }
0023
0024 SpinBox {
0025 id: readAddressBox
0026
0027 editable: true
0028 from: 0
0029 to: 65535
0030 }
0031
0032 Label {
0033 text: qsTr("Read amount:")
0034 }
0035
0036 SpinBox {
0037 id: readAmountBox
0038
0039 editable: true
0040 from: 0
0041 to: device.maxReadHoldingRegisters
0042 value: 1
0043 }
0044
0045 Label {
0046 text: qsTr("Write address:")
0047 }
0048
0049 SpinBox {
0050 id: writeAddressBox
0051
0052 editable: true
0053 from: 0
0054 to: 65535
0055 }
0056
0057 Label {
0058 text: qsTr("Write amount:")
0059 }
0060
0061 SpinBox {
0062 id: writeAmountBox
0063
0064 editable: true
0065 from: 0
0066 to: device.maxWriteHoldingRegisters
0067 value: 1
0068 }
0069
0070 Label {
0071 text: qsTr("Values:")
0072 }
0073
0074 Repeater {
0075 id: repeater
0076
0077 model: writeAmountBox.value
0078
0079 SpinBox {
0080 editable: true
0081 from: 0
0082 to: 65535
0083 }
0084 }
0085 }
0086
0087 //(c)C: Copyright © 2022, Michał Policht <michal@policht.pl>. All rights reserved.
0088 //(c)C: SPDX-License-Identifier: LGPL-3.0-or-later OR MIT
0089 //(c)C: This file is a part of CuteHMI.
0090 //(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.
0091 //(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.
0092 //(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/>.
0093 //(c)C: Additionally, this file is licensed under terms of MIT license as expressed below.
0094 //(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:
0095 //(c)C: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
0096 //(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.