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