quarchpy 2.1.21__py2.py3-none-any.whl → 2.1.23__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. quarchpy/.idea/modules.xml +1 -0
  2. quarchpy/.idea/quarchpy.iml +1 -0
  3. quarchpy/.idea/workspace.xml +49 -29
  4. quarchpy/__init__.py +6 -6
  5. quarchpy/__pycache__/__init__.cpython-311.pyc +0 -0
  6. quarchpy/__pycache__/_version.cpython-311.pyc +0 -0
  7. quarchpy/_version.py +1 -1
  8. quarchpy/connection_specific/QPS/qis/qis.jar +0 -0
  9. quarchpy/connection_specific/QPS/qis/qis_lib/CInterface-1.8.0.jar +0 -0
  10. quarchpy/connection_specific/QPS/qps.jar +0 -0
  11. quarchpy/connection_specific/QPS/scriptCommands.txt +2 -2
  12. quarchpy/connection_specific/__pycache__/connection_QIS.cpython-311.pyc +0 -0
  13. quarchpy/connection_specific/__pycache__/connection_QPS.cpython-311.pyc +0 -0
  14. quarchpy/connection_specific/__pycache__/connection_ReST.cpython-311.pyc +0 -0
  15. quarchpy/connection_specific/connection_QIS.py +19 -8
  16. quarchpy/connection_specific/connection_QPS.py +25 -1
  17. quarchpy/connection_specific/connection_ReST.py +3 -2
  18. quarchpy/debug/upgrade_quarchpy.py +3 -3
  19. quarchpy/device/__pycache__/device.cpython-311.pyc +0 -0
  20. quarchpy/device/__pycache__/quarchQPS.cpython-311.pyc +0 -0
  21. quarchpy/device/__pycache__/scanDevices.cpython-311.pyc +0 -0
  22. quarchpy/device/device.py +10 -6
  23. quarchpy/device/quarchQPS.py +0 -3
  24. quarchpy/device/scanDevices.py +0 -2
  25. quarchpy/docs/CHANGES.rst +15 -5
  26. quarchpy/docs/_build/doctrees/CHANGES.doctree +0 -0
  27. quarchpy/docs/_build/doctrees/environment.pickle +0 -0
  28. quarchpy/docs/_build/doctrees/source/changelog.doctree +0 -0
  29. quarchpy/docs/_build/doctrees/source/quarchpy.connection_specific.doctree +0 -0
  30. quarchpy/docs/_build/doctrees/source/quarchpy.qis.doctree +0 -0
  31. quarchpy/docs/_build/html/CHANGES.html +133 -120
  32. quarchpy/docs/_build/html/_sources/CHANGES.rst.txt +15 -5
  33. quarchpy/docs/_build/html/genindex.html +9 -3
  34. quarchpy/docs/_build/html/index.html +60 -58
  35. quarchpy/docs/_build/html/objects.inv +0 -0
  36. quarchpy/docs/_build/html/searchindex.js +1 -1
  37. quarchpy/docs/_build/html/source/changelog.html +193 -178
  38. quarchpy/docs/_build/html/source/quarchpy.connection_specific.html +12 -1
  39. quarchpy/docs/_build/html/source/quarchpy.html +3 -0
  40. quarchpy/docs/_build/html/source/quarchpy.qis.html +6 -0
  41. quarchpy/fio/fioDiskFinder.py +1 -1
  42. quarchpy/qis/__pycache__/qisFuncs.cpython-311.pyc +0 -0
  43. quarchpy/qis/qisFuncs.py +0 -4
  44. quarchpy/run.py +4 -4
  45. quarchpy/user_interface/__pycache__/user_interface.cpython-311.pyc +0 -0
  46. quarchpy/user_interface/user_interface.py +1 -0
  47. {quarchpy-2.1.21.dist-info → quarchpy-2.1.23.dist-info}/METADATA +16 -6
  48. {quarchpy-2.1.21.dist-info → quarchpy-2.1.23.dist-info}/RECORD +50 -56
  49. quarchpy/__pycache__/run.cpython-311.pyc +0 -0
  50. quarchpy/connection_specific/__pycache__/connection_TCP.cpython-311.pyc +0 -0
  51. quarchpy/connection_specific/__pycache__/connection_Telnet.cpython-311.pyc +0 -0
  52. quarchpy/debug/__pycache__/module_debug.cpython-311.pyc +0 -0
  53. quarchpy/debug/__pycache__/simple_terminal.cpython-311.pyc +0 -0
  54. quarchpy/debug/__pycache__/upgrade_quarchpy.cpython-311.pyc +0 -0
  55. quarchpy/fio/__pycache__/fioDiskFinder.cpython-311.pyc +0 -0
  56. {quarchpy-2.1.21.dist-info → quarchpy-2.1.23.dist-info}/WHEEL +0 -0
  57. {quarchpy-2.1.21.dist-info → quarchpy-2.1.23.dist-info}/top_level.txt +0 -0
@@ -3,6 +3,7 @@
3
3
  <component name="ProjectModuleManager">
4
4
  <modules>
5
5
  <module fileurl="file://$PROJECT_DIR$/../../../../Application Notes/.idea/Application Notes.iml" filepath="$PROJECT_DIR$/../../../../Application Notes/.idea/Application Notes.iml" />
6
+ <module fileurl="file://$PROJECT_DIR$/../../../QuarchCalibration/.idea/QuarchCalibration.iml" filepath="$PROJECT_DIR$/../../../QuarchCalibration/.idea/QuarchCalibration.iml" />
6
7
  <module fileurl="file://$PROJECT_DIR$/.idea/quarchpy.iml" filepath="$PROJECT_DIR$/.idea/quarchpy.iml" />
7
8
  </modules>
8
9
  </component>
@@ -7,6 +7,7 @@
7
7
  <orderEntry type="jdk" jdkName="Python 3.11" jdkType="Python SDK" />
8
8
  <orderEntry type="sourceFolder" forTests="false" />
9
9
  <orderEntry type="module" module-name="Application Notes" />
10
+ <orderEntry type="module" module-name="QuarchCalibration" />
10
11
  </component>
11
12
  <component name="PyDocumentationSettings">
12
13
  <option name="format" value="PLAIN" />
@@ -17,23 +17,26 @@
17
17
  </list>
18
18
  </option>
19
19
  </component>
20
+ <component name="MarkdownSettingsMigration">
21
+ <option name="stateVersion" value="1" />
22
+ </component>
20
23
  <component name="ProjectId" id="2T0rSFX3wSYiHYg1HMDN2Ug8LET" />
21
24
  <component name="ProjectViewState">
22
25
  <option name="hideEmptyMiddlePackages" value="true" />
23
26
  <option name="showLibraryContents" value="true" />
24
27
  </component>
25
- <component name="PropertiesComponent">{
26
- &quot;keyToString&quot;: {
27
- &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
28
- &quot;last_opened_file_path&quot;: &quot;P:/Software/Application Notes/AN-015 - Automating with QPS/Trunk&quot;,
29
- &quot;settings.editor.selected.configurable&quot;: &quot;diff.base&quot;
28
+ <component name="PropertiesComponent"><![CDATA[{
29
+ "keyToString": {
30
+ "RunOnceActivity.ShowReadmeOnStart": "true",
31
+ "last_opened_file_path": "P:/Software/Python/QuarchCalibration",
32
+ "settings.editor.selected.configurable": "diff.base"
30
33
  },
31
- &quot;keyToStringList&quot;: {
32
- &quot;com.intellij.ide.scratch.ScratchImplUtil$2/New Scratch File&quot;: [
33
- &quot;Python&quot;
34
+ "keyToStringList": {
35
+ "com.intellij.ide.scratch.ScratchImplUtil$2/New Scratch File": [
36
+ "Python"
34
37
  ]
35
38
  }
36
- }</component>
39
+ }]]></component>
37
40
  <component name="PyConsoleOptionsProvider">
38
41
  <option name="myPythonConsoleState">
39
42
  <console-settings module-name="quarchpy" is-module-sdk="true">
@@ -44,6 +47,8 @@
44
47
  </component>
45
48
  <component name="RecentsManager">
46
49
  <key name="CopyFile.RECENT_KEYS">
50
+ <recent name="P:\Software\Python\QuarchPy\Trunk\quarchpy\debug" />
51
+ <recent name="P:\Software\Application Notes\AN-006 - Python Control of Quarch Modules\Trunk" />
47
52
  <recent name="P:\Software\Application Notes\AN-015 - Automating with QPS\Trunk" />
48
53
  <recent name="P:\Software\Application Notes\AN-017 - QPS performance test with FIO\Trunk" />
49
54
  <recent name="C:\Users\sboon\AppData\Roaming\JetBrains\PyCharmCE2023.1\scratches" />
@@ -52,20 +57,20 @@
52
57
  <recent name="P:\Software\Python\QuarchPy\Trunk\quarchpy" />
53
58
  </key>
54
59
  </component>
55
- <component name="RunManager" selected="Python.QisStreamExample">
56
- <configuration name="QPSHelpReader" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
57
- <module name="Application Notes" />
60
+ <component name="RunManager" selected="Python.HammerRegRead">
61
+ <configuration name="HammerRegRead" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
62
+ <module name="quarchpy" />
58
63
  <option name="INTERPRETER_OPTIONS" value="" />
59
64
  <option name="PARENT_ENVS" value="true" />
60
65
  <envs>
61
66
  <env name="PYTHONUNBUFFERED" value="1" />
62
67
  </envs>
63
68
  <option name="SDK_HOME" value="" />
64
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../../../../Application Notes/AN-015 - Automating with QPS/Trunk" />
65
- <option name="IS_MODULE_SDK" value="true" />
69
+ <option name="WORKING_DIRECTORY" value="$USER_HOME$/Desktop" />
70
+ <option name="IS_MODULE_SDK" value="false" />
66
71
  <option name="ADD_CONTENT_ROOTS" value="true" />
67
72
  <option name="ADD_SOURCE_ROOTS" value="true" />
68
- <option name="SCRIPT_NAME" value="$PROJECT_DIR$/../../../../Application Notes/AN-015 - Automating with QPS/Trunk/QPSHelpReader.py" />
73
+ <option name="SCRIPT_NAME" value="$USER_HOME$/Desktop/HammerRegRead.py" />
69
74
  <option name="PARAMETERS" value="" />
70
75
  <option name="SHOW_COMMAND_LINE" value="false" />
71
76
  <option name="EMULATE_TERMINAL" value="false" />
@@ -74,7 +79,7 @@
74
79
  <option name="INPUT_FILE" value="" />
75
80
  <method v="2" />
76
81
  </configuration>
77
- <configuration name="QisStreamExample" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
82
+ <configuration name="PowerExamples" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
78
83
  <module name="Application Notes" />
79
84
  <option name="INTERPRETER_OPTIONS" value="" />
80
85
  <option name="PARENT_ENVS" value="true" />
@@ -82,11 +87,11 @@
82
87
  <env name="PYTHONUNBUFFERED" value="1" />
83
88
  </envs>
84
89
  <option name="SDK_HOME" value="" />
85
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../../../../Application Notes/AN-012 - Python Control of Power Modules via QIS/Trunk" />
90
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../../../../Application Notes/AN-022 - QIS Automation and post processing example/Trunk" />
86
91
  <option name="IS_MODULE_SDK" value="true" />
87
92
  <option name="ADD_CONTENT_ROOTS" value="true" />
88
93
  <option name="ADD_SOURCE_ROOTS" value="true" />
89
- <option name="SCRIPT_NAME" value="$PROJECT_DIR$/../../../../Application Notes/AN-012 - Python Control of Power Modules via QIS/Trunk/QisStreamExample.py" />
94
+ <option name="SCRIPT_NAME" value="$PROJECT_DIR$/../../../../Application Notes/AN-022 - QIS Automation and post processing example/Trunk/PowerExamples.py" />
90
95
  <option name="PARAMETERS" value="" />
91
96
  <option name="SHOW_COMMAND_LINE" value="false" />
92
97
  <option name="EMULATE_TERMINAL" value="false" />
@@ -95,7 +100,7 @@
95
100
  <option name="INPUT_FILE" value="" />
96
101
  <method v="2" />
97
102
  </configuration>
98
- <configuration name="performanceTestFIO" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
103
+ <configuration name="QisStreamExample" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
99
104
  <module name="Application Notes" />
100
105
  <option name="INTERPRETER_OPTIONS" value="" />
101
106
  <option name="PARENT_ENVS" value="true" />
@@ -103,11 +108,11 @@
103
108
  <env name="PYTHONUNBUFFERED" value="1" />
104
109
  </envs>
105
110
  <option name="SDK_HOME" value="" />
106
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../../../../Application Notes/AN-017 - QPS performance test with FIO/Trunk" />
111
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../../../../Application Notes/AN-012 - Python Control of Power Modules via QIS/Trunk" />
107
112
  <option name="IS_MODULE_SDK" value="true" />
108
113
  <option name="ADD_CONTENT_ROOTS" value="true" />
109
114
  <option name="ADD_SOURCE_ROOTS" value="true" />
110
- <option name="SCRIPT_NAME" value="$PROJECT_DIR$/../../../../Application Notes/AN-017 - QPS performance test with FIO/Trunk/performanceTestFIO.py" />
115
+ <option name="SCRIPT_NAME" value="$PROJECT_DIR$/../../../../Application Notes/AN-012 - Python Control of Power Modules via QIS/Trunk/QisStreamExample.py" />
111
116
  <option name="PARAMETERS" value="" />
112
117
  <option name="SHOW_COMMAND_LINE" value="false" />
113
118
  <option name="EMULATE_TERMINAL" value="false" />
@@ -116,19 +121,19 @@
116
121
  <option name="INPUT_FILE" value="" />
117
122
  <method v="2" />
118
123
  </configuration>
119
- <configuration name="run (2)" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
120
- <module name="quarchpy" />
124
+ <configuration name="TestPYQPSQISConnectionsSameModule" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
125
+ <module name="Application Notes" />
121
126
  <option name="INTERPRETER_OPTIONS" value="" />
122
127
  <option name="PARENT_ENVS" value="true" />
123
128
  <envs>
124
129
  <env name="PYTHONUNBUFFERED" value="1" />
125
130
  </envs>
126
131
  <option name="SDK_HOME" value="" />
127
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
132
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../../../../Application Notes/AN-006 - Python Control of Quarch Modules/Trunk" />
128
133
  <option name="IS_MODULE_SDK" value="true" />
129
134
  <option name="ADD_CONTENT_ROOTS" value="true" />
130
135
  <option name="ADD_SOURCE_ROOTS" value="true" />
131
- <option name="SCRIPT_NAME" value="$PROJECT_DIR$/run.py" />
136
+ <option name="SCRIPT_NAME" value="$PROJECT_DIR$/../../../../Application Notes/AN-006 - Python Control of Quarch Modules/Trunk/TestPYQPSQISConnectionsSameModule.py" />
132
137
  <option name="PARAMETERS" value="" />
133
138
  <option name="SHOW_COMMAND_LINE" value="false" />
134
139
  <option name="EMULATE_TERMINAL" value="false" />
@@ -160,11 +165,11 @@
160
165
  </configuration>
161
166
  <recent_temporary>
162
167
  <list>
168
+ <item itemvalue="Python.HammerRegRead" />
169
+ <item itemvalue="Python.TestPYQPSQISConnectionsSameModule" />
170
+ <item itemvalue="Python.PowerExamples" />
163
171
  <item itemvalue="Python.QisStreamExample" />
164
172
  <item itemvalue="Python.simple_terminal" />
165
- <item itemvalue="Python.QPSHelpReader" />
166
- <item itemvalue="Python.run (2)" />
167
- <item itemvalue="Python.performanceTestFIO" />
168
173
  </list>
169
174
  </recent_temporary>
170
175
  </component>
@@ -219,7 +224,7 @@
219
224
  </line-breakpoint>
220
225
  <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
221
226
  <url>file://$PROJECT_DIR$/connection_specific/connection_QPS.py</url>
222
- <line>57</line>
227
+ <line>82</line>
223
228
  <option name="timeStamp" value="25" />
224
229
  </line-breakpoint>
225
230
  <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
@@ -287,6 +292,21 @@
287
292
  <line>21</line>
288
293
  <option name="timeStamp" value="84" />
289
294
  </line-breakpoint>
295
+ <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
296
+ <url>file://$PROJECT_DIR$/../../../../Application Notes/AN-022 - QIS Automation and post processing example/Trunk/PowerExamples.py</url>
297
+ <line>74</line>
298
+ <option name="timeStamp" value="88" />
299
+ </line-breakpoint>
300
+ <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
301
+ <url>file://$PROJECT_DIR$/connection_specific/connection_QIS.py</url>
302
+ <line>1049</line>
303
+ <option name="timeStamp" value="89" />
304
+ </line-breakpoint>
305
+ <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
306
+ <url>file://$PROJECT_DIR$/../../../../Application Notes/AN-006 - Python Control of Quarch Modules/Trunk/TestPYQPSQISConnectionsSameModule.py</url>
307
+ <line>36</line>
308
+ <option name="timeStamp" value="97" />
309
+ </line-breakpoint>
290
310
  </breakpoints>
291
311
  <default-breakpoints>
292
312
  <breakpoint type="python-exception">
quarchpy/__init__.py CHANGED
@@ -46,17 +46,17 @@ from debug.versionCompare import requiredQuarchpyVersion
46
46
  #breacking back-compatibility with old scripts. Avoid using these direct imports
47
47
  #and use the managed sub module format instead (from quarchpy.device import *)
48
48
  from device import quarchDevice, getQuarchDevice
49
- from connection_specific.connection_QIS import QisInterface as qisInterface
50
- from connection_specific.connection_QPS import QpsInterface as qpsInterface
49
+ from connection_specific.connection_QIS import QisInterface, QisInterface as qisInterface
50
+ from connection_specific.connection_QPS import QpsInterface, QpsInterface as qpsInterface
51
51
  from qis.qisFuncs import isQisRunning, startLocalQis, GetQisModuleSelection
52
- from qis.qisFuncs import closeQis as closeQIS
52
+ from qis.qisFuncs import closeQis, closeQis as closeQIS
53
53
  from device.quarchPPM import quarchPPM
54
54
  from iometer.iometerFuncs import generateIcfFromCsvLineData, readIcfCsvLineData, generateIcfFromConf, runIOMeter, processIometerInstResults
55
55
  from device.quarchQPS import quarchQPS
56
56
  from qps.qpsFuncs import isQpsRunning, startLocalQps, GetQpsModuleSelection
57
- from qps.qpsFuncs import closeQps as closeQPS
58
- from disk_test.DiskTargetSelection import getDiskTargetSelection as GetDiskTargetSelection
59
- from qps.qpsFuncs import toQpsTimeStamp as adjustTime
57
+ from qps.qpsFuncs import closeQps, closeQps as closeQPS
58
+ from disk_test.DiskTargetSelection import getDiskTargetSelection, getDiskTargetSelection as GetDiskTargetSelection
59
+ from qps.qpsFuncs import toQpsTimeStamp, toQpsTimeStamp as adjustTime
60
60
  from fio.FIO_interface import runFIO
61
61
  from device.scanDevices import scanDevices
62
62
 
quarchpy/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.1.21"
1
+ __version__ = "2.1.23"
Binary file
@@ -1,7 +1,7 @@
1
1
  QPS Command Summary
2
2
  Copyright (c) Quarch Ltd
3
- QPS v1.37.19
4
- Generated: 08-Mar-2024
3
+ QPS v1.39
4
+ Generated: 18-Mar-2024
5
5
 
6
6
 
7
7
  *** Commands ***
@@ -171,10 +171,6 @@ class QisInterface:
171
171
  moduleStreaming= module.sendCommand("rec stream?").lower() #checking if module thinks its streaming.
172
172
  moduleStreaming2= module.sendCommand("stream?").lower() #checking if the module has told qis it has stopped streaming.
173
173
 
174
- #print("thread list = " + str(threadNameList))
175
- #print("moduleStreaming rec stream? = " + str(moduleStreaming))
176
- #print("moduleStreaming stream? = " + str(moduleStreaming2))
177
-
178
174
  if (moduleName in threadNameList or "running" in moduleStreaming or "running" in moduleStreaming2):
179
175
  time.sleep(0.1)
180
176
 
@@ -276,7 +272,6 @@ class QisInterface:
276
272
  #now = time.time()
277
273
  streamOverrun, removeChar, newStripes = self.streamGetStripesText(self.streamSock, module, numStripesPerRead)
278
274
  newStripes = newStripes.replace(' ', separator)
279
- #print (time.time() - now)
280
275
  if streamOverrun:
281
276
  self.deviceDict[module][0:3] = [True, 'Stopped', 'Device buffer overrun']
282
277
  # TODO: MD Why don't we return isEmpty in the tuple, instead of having this confusing test?
@@ -498,10 +493,7 @@ class QisInterface:
498
493
  streamOverrun, removeChar, newStripes = self.streamGetStripesText(self.streamSock, module,
499
494
  numStripesPerRead)
500
495
  newStripes = newStripes.replace(' ',separator)
501
- # print(newStripes)
502
- # print(len(newStripes))
503
496
 
504
- # print (time.time() - now)
505
497
  if streamOverrun:
506
498
  self.deviceDict[module][0:3] = [True, 'Stopped', 'Device buffer overrun']
507
499
  if (removeChar == -6 and len(newStripes) == 6):
@@ -1565,6 +1557,25 @@ class QisInterface:
1565
1557
  f.write("Saved: "+x+ "\n")
1566
1558
 
1567
1559
 
1560
+ def sendCommand(self, cmd, device="", timeout=20,sock=None,readUntilCursor=True, betweenCommandDelay=0.0, expectedResponse=True):
1561
+ '''Send command is used to send a command to QIS and as far as I can see it has no difference than sendAndReceiveCmd'''
1562
+ if expectedResponse is True:
1563
+ if sock == None:
1564
+ sock = self.sock
1565
+ if not (device == ''):
1566
+ self.deviceDictSetup(device)
1567
+ res = self.sendAndReceiveText(sock, cmd, device, readUntilCursor)
1568
+ if (betweenCommandDelay > 0):
1569
+ time.sleep(betweenCommandDelay)
1570
+ # If ends with cursor get rid of it
1571
+ if res[-1:] == '>':
1572
+ res = res[:-3] # remove last three chars - hopefully '\r\n>'
1573
+ return res
1574
+
1575
+ else :
1576
+ self.sendText(sock, cmd, device)
1577
+ return
1578
+
1568
1579
  # when sending commands to module (as opposed to back end)
1569
1580
  # If read until cursor is set to True (which is default) then keep reading response until a cursor is returned as the last character of result string
1570
1581
  # After command is sent wait for betweenCommandDelay which defaults to 0 but can be specified to add a delay between commands
@@ -52,6 +52,31 @@ class QpsInterface:
52
52
  else:
53
53
  self.client.send( data )
54
54
 
55
+ def sendCommand(self, cmd, timeout=20, expectedResponse=True ):
56
+ cmd = cmd + "\r\n"
57
+ logging.debug("Sending cmd to QPS: " + str(cmd))
58
+ self.send(cmd)
59
+
60
+ start = time.time()
61
+ response = self.recv().strip()
62
+ while response.rfind('\r\n>') == -1: # If true then the resposnse is large and multi packeted
63
+ time.sleep(0.1)
64
+ t_response = self.recv().strip()
65
+ # Add current response to new response
66
+ response += t_response
67
+ # Keep reading from the socket if there's stuff that was retreived
68
+ if len(str(t_response)) == 0:
69
+ if time.time() - start > timeout:
70
+ logging.warning("Command : " + str(cmd) + " Hit timeout during QPS read. timeout = " + str(timeout))
71
+ break
72
+
73
+ pos = response.rfind('\r\n>')
74
+ if pos == -1:
75
+ logging.warning("Did not retrieve trailing '\\r\\n>' from QPS read, returned full response so far")
76
+ logging.warning("command : " + cmd.replace('\r\n', '\\r\\n'))
77
+ logging.warning("returned : " + response.replace('\r\n', '\\r\\n'))
78
+ pos = len(str(response))
79
+ return response[:pos]
55
80
 
56
81
  def sendCmdVerbose(self, cmd, timeout=20):
57
82
  cmd = cmd + "\r\n"
@@ -83,7 +108,6 @@ class QpsInterface:
83
108
  def connect(self, targetDevice):
84
109
  cmd="$connect " + targetDevice
85
110
  retVal = self.sendCmdVerbose(cmd)
86
- #print(cmd+" : "+retVal)
87
111
  time.sleep(0.3)
88
112
  return retVal
89
113
 
@@ -15,9 +15,9 @@ class ReSTConn:
15
15
  def close(self):
16
16
  return True
17
17
 
18
- def sendCommand(self, Command, expectedResponse = True, max_retries=1):
18
+ def sendCommand(self, Command, expectedResponse = True, max_retries=2):
19
19
  Command = "/" + Command.replace(" ", "%20")
20
- for attempt in range(1, max_retries + 1):
20
+ for attempt in range(0, max_retries ):
21
21
  try:
22
22
  self.Connection.request("GET", Command)
23
23
  if expectedResponse == True:
@@ -37,6 +37,7 @@ class ReSTConn:
37
37
  except socket.timeout as e:
38
38
  if attempt < max_retries:
39
39
  logging.warning("Socket timed out, retrying command...")
40
+ time.sleep(0.1)
40
41
  else:
41
42
  logging.error("Maximum number of retries reached on module at: "+self.ConnTarget+". Exiting.")
42
43
  raise e
@@ -1,7 +1,7 @@
1
1
  """
2
2
  Functions to allow automatic update and checking of the quarchpy package.
3
3
  """
4
- from quarchpy import isQisRunning, closeQIS, isQpsRunning, closeQPS
4
+ from quarchpy import isQisRunning, isQpsRunning, closeQps, closeQis
5
5
  import subprocess, sys
6
6
  from quarchpy.user_interface import *
7
7
 
@@ -89,11 +89,11 @@ def check_if_update(auto_update):
89
89
  if update_desired:
90
90
  if isQpsRunning() == True:
91
91
  usr_input = requestDialog(title="", message="QPS must be closed to update. Close QPS Y/N?")
92
- if auto_update or usr_input == "Y" or usr_input == "y": closeQPS()
92
+ if auto_update or usr_input == "Y" or usr_input == "y": closeQps()
93
93
  else: return False
94
94
  if isQisRunning() == True:
95
95
  usr_input = requestDialog(title="", message="QIS must be closed to update. Close QIS Y/N?")
96
- if auto_update or usr_input == "Y" or usr_input == "y": closeQIS()
96
+ if auto_update or usr_input == "Y" or usr_input == "y": closeQis()
97
97
  else: return False
98
98
  else:
99
99
  return False
quarchpy/device/device.py CHANGED
@@ -214,7 +214,6 @@ class quarchDevice:
214
214
 
215
215
  # def setCanStream(self):
216
216
  # ask module name if = name in list
217
- # TODO: expectedResponse does nothing can it be removed
218
217
  # TODO: The connectionObj should be an instance of a common base class such that the IF block here is not needed
219
218
  def sendCommand(self, CommandString, expectedResponse = True):
220
219
  """
@@ -245,33 +244,35 @@ class quarchDevice:
245
244
  if numb_colons == 1:
246
245
  self.ConString = self.ConString.replace(':', '::')
247
246
 
248
- response = self.connectionObj.qis.sendCmd(self.ConString, CommandString)
247
+ response = self.connectionObj.qis.sendCommand(CommandString, device=self.ConString, expectedResponse=expectedResponse)
249
248
  # send response to log
250
249
  logging.debug(os.path.basename(__file__) + ": "+self.ConType[:3]+" received: " + response)
251
250
  return response
252
251
 
253
252
  elif self.ConType == "PY":
254
- response = self.connectionObj.connection.sendCommand(CommandString)
253
+ response = self.connectionObj.connection.sendCommand(CommandString, expectedResponse=expectedResponse)
255
254
  # send response to log
256
255
  logging.debug(os.path.basename(__file__) + ": "+self.ConType[:3]+" received: " + response)
257
256
  return response
258
257
 
259
258
  elif self.ConType[:3] == "QPS":
260
- # checking if the command string passed has a $ as first char
259
+ # If "$" CMD is for QPS, else its for the specific module. Since QPS can talk to many modules we must added the conString.
261
260
  if CommandString[0] != '$':
262
261
  CommandString = self.ConString + " " + CommandString
263
262
 
264
- response = self.connectionObj.qps.sendCmdVerbose(CommandString)
263
+ response = self.connectionObj.qps.sendCommand(CommandString, expectedResponse)
265
264
  # send response to log
266
265
  logging.debug(os.path.basename(__file__) + ": "+self.ConType[:3]+" received: " + response)
267
266
  return response
268
267
 
268
+
269
269
  # Only works for usb
270
270
  # TODO: Can this be marked '_' for private use only
271
271
  def sendBinaryCommand(self, cmd):
272
272
  self.connectionObj.connection.Connection.SendCommand(cmd)
273
273
  return self.connectionObj.connection.Connection.BulkRead()
274
274
 
275
+
275
276
  # TODO: Not using class hierarchy based connectionObj, recreation of PYConnection may not release the previous handle in time.
276
277
  # QPS and QIS actions are different despite the underlying connection being the same!
277
278
  def openConnection(self):
@@ -297,6 +298,7 @@ class quarchDevice:
297
298
  else:
298
299
  raise Exception("Connection type not recognised")
299
300
 
301
+
300
302
  # TODO: Not using class hierarchy based connectionObj. QPS and QIS actions are different despite the underlying connection being the same!
301
303
  def closeConnection(self):
302
304
  """
@@ -317,7 +319,7 @@ class quarchDevice:
317
319
 
318
320
  return "OK"
319
321
 
320
-
322
+
321
323
  # TODO: Not using class hierarchy based connectionObj.
322
324
  def resetDevice(self, timeout=10):
323
325
  """
@@ -427,6 +429,7 @@ class quarchDevice:
427
429
  else:
428
430
  return True
429
431
 
432
+
430
433
  def getRuntime(self, command="conf:runtimes?"):
431
434
  '''
432
435
 
@@ -468,6 +471,7 @@ def _check_ip_in_qis_list(ip_address, detailed_device_list):
468
471
  # If the ip address wasn't found, then return none
469
472
  return None
470
473
 
474
+
471
475
  # TODO: Can we make this an '_' internal function?
472
476
  def checkModuleFormat(ConString):
473
477
  ConnectionTypes = ["USB", "SERIAL", "TELNET", "REST", "TCP"] # acceptable conTypes
@@ -393,9 +393,6 @@ class quarchStream:
393
393
  else:
394
394
  dataPointTime = toQpsTimeStamp(dataPointTime)
395
395
 
396
- # print ("printing command: $log " + channelName + " " + groupName + " " + str(dataPointTime) + " " + str(dataValue))
397
- # self.connectionObj.qps.sendCmdVerbose("$log " + channelName + " " + groupName + " " + str(dataPointTime) + " " + str(dataValue))
398
-
399
396
  self.connectionObj.qps.sendCmdVerbose(
400
397
  "$stream data add " + channelName + " " + groupName + " " + str(dataPointTime) + " " + str(
401
398
  dataValue) + " " + timeFormat)
@@ -220,7 +220,6 @@ def list_network(target_conn="all", debugPring=False, lanTimeout=1, ipAddressLoo
220
220
  break
221
221
  cont = 0
222
222
 
223
- # print(msg_received)
224
223
  # Used split \r\n since values of 13 or 10 were looked at as /r and /n when using splitlines
225
224
  # This fixes for all cases except if 13 is followed by 10.
226
225
  splits = msg_received[0].split(b"\r\n")
@@ -480,7 +479,6 @@ def scanDevices(target_conn="all", lanTimeout=1, scanInArray=True, favouriteOnly
480
479
  except Exception as e:
481
480
  logging.error(e)
482
481
  logging.warning("Network scan failed, check network connection")
483
- # print(foundDevices)
484
482
 
485
483
  if target_conn.lower() == "serial":
486
484
  foundDevices = list_serial()
quarchpy/docs/CHANGES.rst CHANGED
@@ -13,6 +13,16 @@ Quarchpy
13
13
  Change Log
14
14
  ----------
15
15
 
16
+ 2.1.23
17
+ ------
18
+ - QIS and QPS devices and interfaces can use sendCommand to send comannds to the modules and to the applications uniformly
19
+ - Tidy up of print statments and comments.
20
+
21
+ 2.1.22
22
+ ------
23
+ - QIS and QPS patch containing mDNS removal
24
+
25
+
16
26
  2.1.21
17
27
  ------
18
28
  - New QPS v1.38 and QIS 1.41
@@ -20,7 +30,7 @@ Change Log
20
30
 
21
31
  2.1.20
22
32
  ------
23
- - Improved direct IP scanning for quarch modules.
33
+ - Improved direct IP scanning for quarch modules
24
34
  - New QPS v1.37 and QIS v1.40
25
35
 
26
36
  2.1.19
@@ -49,19 +59,19 @@ Change Log
49
59
 
50
60
  2.1.14
51
61
  ------
52
- - minor bug fixes and logging improvements.
62
+ - minor bug fixes and logging improvements
53
63
 
54
64
  2.1.13
55
65
  ------
56
66
  - New QPS v1.36
57
67
  - New QIS v1.39
58
- - minor bug fixes and logging improvements.
68
+ - minor bug fixes and logging improvements
59
69
 
60
70
  2.1.12
61
71
  ------
62
72
  - New QPS v1.35
63
73
  - New QIS v1.38
64
- - minor bug fixes and removal of depracated code.
74
+ - minor bug fixes and removal of depracated code
65
75
 
66
76
  2.1.11
67
77
  ------
@@ -100,7 +110,7 @@ Change Log
100
110
  2.1.3
101
111
  -----
102
112
  - New QPS v1.22
103
- - modules on the network can now be connected to using conType:QTLNumber eg. TCP:QTL1999-02-001.
113
+ - modules on the network can now be connected to using conType:QTLNumber eg. TCP:QTL1999-02-001
104
114
  - fixed QIS not closing with QPS when launch with by QPS
105
115
  - closeConnection added to QIS api
106
116
  - display table formats multiline items and handles empty cells