Warning, /sdk/cutehmi/extensions/CuteHMI/Examples/Modbus/Requests.3/ReadFileRecordControl.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                 Layout.alignment: Qt.AlignTop
0012 
0013                 text: "Read file record"
0014                 onClicked:  {
0015                         var subrequests = []
0016                         for (var i = 0; i < repeater.count; i++) {
0017                                 var item = repeater.itemAt(i)
0018                                 subrequests.push(device.readFileRecordSubrequest(item.file, item.address, item.amount))
0019                         }
0020                         device.requestReadFileRecord(subrequests)
0021                 }
0022         }
0023 
0024         RowLayout {
0025                 Layout.alignment: Qt.AlignTop
0026 
0027                 Label {
0028                         text: qsTr("Subrequests:")
0029                 }
0030 
0031                 SpinBox {
0032                         id: subrequestsBox
0033 
0034                         editable: true
0035                         from: 1
0036                         to: 10
0037                 }
0038         }
0039 
0040         ColumnLayout {
0041                 Repeater {
0042                         id: repeater
0043 
0044                         model: subrequestsBox.value
0045 
0046                         RowLayout {
0047                                 property int file: fileBox.value
0048                                 property int address: addressBox.value
0049                                 property int amount: amountBox.value
0050 
0051                                 Label {
0052                                         text: qsTr("File:")
0053                                 }
0054 
0055                                 SpinBox {
0056                                         id: fileBox
0057 
0058                                         editable: true
0059                                         from: 1
0060                                         to: 65535
0061                                 }
0062 
0063                                 Label {
0064                                         text: qsTr("Address:")
0065                                 }
0066 
0067                                 SpinBox {
0068                                         id: addressBox
0069 
0070                                         editable: true
0071                                         from: 0
0072                                         to: 0x270F
0073                                 }
0074 
0075                                 Label {
0076                                         text: qsTr("Amount:")
0077                                 }
0078 
0079                                 SpinBox {
0080                                         id: amountBox
0081 
0082                                         editable: true
0083                                         from: 1
0084                                         to: 65535
0085                                 }
0086                         }
0087                 }
0088         }
0089 }
0090 
0091 //(c)C: Copyright © 2022, Michał Policht <michal@policht.pl>. All rights reserved.
0092 //(c)C: SPDX-License-Identifier: LGPL-3.0-or-later OR MIT
0093 //(c)C: This file is a part of CuteHMI.
0094 //(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.
0095 //(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.
0096 //(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/>.
0097 //(c)C: Additionally, this file is licensed under terms of MIT license as expressed below.
0098 //(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:
0099 //(c)C: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
0100 //(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.