20 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
21 # |
21 # |
22 # This code is made available on the understanding that it will not be |
22 # This code is made available on the understanding that it will not be |
23 # used in safety-critical situations without a full and competent review. |
23 # used in safety-critical situations without a full and competent review. |
24 |
24 |
|
25 from __future__ import absolute_import |
|
26 from __future__ import division |
|
27 from six.moves import xrange |
25 |
28 |
26 # dictionary implementing: |
29 # dictionary implementing: |
27 # key - string with the description we want in the request plugin GUI |
30 # key - string with the description we want in the request plugin GUI |
28 # tuple - (modbus function number, request type, max count value, |
31 # tuple - (modbus function number, request type, max count value, |
29 # data_type, bit_size) |
32 # data_type, bit_size) |
183 {"%(locreqstr)s", %(nodeid)s, %(slaveid)s, %(iotype)s, %(func_nr)s, %(address)s , %(count)s, |
186 {"%(locreqstr)s", %(nodeid)s, %(slaveid)s, %(iotype)s, %(func_nr)s, %(address)s , %(count)s, |
184 DEF_REQ_SEND_RETRIES, 0 /* error_code */, 0 /* prev_code */, {%(timeout_s)d, %(timeout_ns)d} /* timeout */, |
187 DEF_REQ_SEND_RETRIES, 0 /* error_code */, 0 /* prev_code */, {%(timeout_s)d, %(timeout_ns)d} /* timeout */, |
185 {%(buffer)s}, {%(buffer)s}}''' |
188 {%(buffer)s}, {%(buffer)s}}''' |
186 |
189 |
187 timeout = int(GetCTVal(child, 4)) |
190 timeout = int(GetCTVal(child, 4)) |
188 timeout_s = int(timeout / 1000) |
191 timeout_s = timeout // 1000 |
189 timeout_ms = timeout - (timeout_s * 1000) |
192 timeout_ms = timeout - (timeout_s * 1000) |
190 timeout_ns = timeout_ms * 1000000 |
193 timeout_ns = timeout_ms * 1000000 |
191 |
194 |
192 request_dict = { |
195 request_dict = { |
193 "locreqstr": "_".join(map(str, child.GetCurrentLocation())), |
196 "locreqstr": "_".join(map(str, child.GetCurrentLocation())), |