@@ -1,264 +1,264 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by Qt Creator 2.4.1, 2012-12-1 |
|
|
3 | <!-- Written by Qt Creator 2.4.1, 2012-12-11T14:32:09. --> | |
|
4 | 4 | <qtcreator> |
|
5 | 5 | <data> |
|
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
7 | 7 | <value type="int">0</value> |
|
8 | 8 | </data> |
|
9 | 9 | <data> |
|
10 | 10 | <variable>ProjectExplorer.Project.EditorSettings</variable> |
|
11 | 11 | <valuemap type="QVariantMap"> |
|
12 | 12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|
13 | 13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|
14 | 14 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|
15 | 15 | <value type="QString" key="language">Cpp</value> |
|
16 | 16 | <valuemap type="QVariantMap" key="value"> |
|
17 | 17 | <value type="QString" key="CurrentPreferences">CppGlobal</value> |
|
18 | 18 | </valuemap> |
|
19 | 19 | </valuemap> |
|
20 | 20 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
|
21 | 21 | <value type="QString" key="language">QmlJS</value> |
|
22 | 22 | <valuemap type="QVariantMap" key="value"> |
|
23 | 23 | <value type="QString" key="CurrentPreferences">QmlJSGlobal</value> |
|
24 | 24 | </valuemap> |
|
25 | 25 | </valuemap> |
|
26 | 26 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
|
27 | 27 | <value type="QByteArray" key="EditorConfiguration.Codec">System</value> |
|
28 | 28 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|
29 | 29 | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
|
30 | 30 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|
31 | 31 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|
32 | 32 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|
33 | 33 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|
34 | 34 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|
35 | 35 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|
36 | 36 | <value type="int" key="EditorConfiguration.TabSize">8</value> |
|
37 | 37 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
|
38 | 38 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
|
39 | 39 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
|
40 | 40 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
|
41 | 41 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
|
42 | 42 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
|
43 | 43 | </valuemap> |
|
44 | 44 | </data> |
|
45 | 45 | <data> |
|
46 | 46 | <variable>ProjectExplorer.Project.PluginSettings</variable> |
|
47 | 47 | <valuemap type="QVariantMap"/> |
|
48 | 48 | </data> |
|
49 | 49 | <data> |
|
50 | 50 | <variable>ProjectExplorer.Project.Target.0</variable> |
|
51 | 51 | <valuemap type="QVariantMap"> |
|
52 | 52 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value> |
|
53 | 53 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> |
|
54 | 54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.DesktopTarget</value> |
|
55 | 55 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
56 | 56 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
57 | 57 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
58 | 58 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
59 | 59 | <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value> |
|
60 | 60 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
61 | 61 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
62 | 62 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
63 | 63 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
64 | 64 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
65 | 65 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
66 | 66 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> |
|
67 | 67 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
68 | 68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
69 | 69 | </valuemap> |
|
70 | 70 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
71 | 71 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
72 | 72 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
73 | 73 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
74 | 74 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
75 | 75 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
76 | 76 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
77 | 77 | </valuemap> |
|
78 | 78 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
79 | 79 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
80 | 80 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
81 | 81 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
82 | 82 | </valuemap> |
|
83 | 83 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
84 | 84 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
85 | 85 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
86 | 86 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
87 | 87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
88 | 88 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
89 | 89 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
90 | 90 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
91 | 91 | </valuemap> |
|
92 | 92 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
93 | 93 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
94 | 94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
95 | 95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
96 | 96 | </valuemap> |
|
97 | 97 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
98 | 98 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
99 | 99 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
100 | 100 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value> |
|
101 | 101 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
102 | 102 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
103 | 103 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
104 | 104 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value> |
|
105 | 105 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value> |
|
106 | 106 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> |
|
107 | 107 | </valuemap> |
|
108 | 108 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> |
|
109 | 109 | <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value> |
|
110 | 110 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
111 | 111 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
112 | 112 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
113 | 113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
114 | 114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
115 | 115 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
116 | 116 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> |
|
117 | 117 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
118 | 118 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
119 | 119 | </valuemap> |
|
120 | 120 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
121 | 121 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
122 | 122 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
123 | 123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
124 | 124 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
125 | 125 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
126 | 126 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
127 | 127 | </valuemap> |
|
128 | 128 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
129 | 129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
130 | 130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
131 | 131 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
132 | 132 | </valuemap> |
|
133 | 133 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
134 | 134 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
135 | 135 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
136 | 136 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
137 | 137 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
138 | 138 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
139 | 139 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
140 | 140 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
141 | 141 | </valuemap> |
|
142 | 142 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
143 | 143 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
144 | 144 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
145 | 145 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
146 | 146 | </valuemap> |
|
147 | 147 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
148 | 148 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
149 | 149 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
150 | 150 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value> |
|
151 | 151 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
152 | 152 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
153 | 153 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> |
|
154 | 154 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value> |
|
155 | 155 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value> |
|
156 | 156 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> |
|
157 | 157 | </valuemap> |
|
158 | 158 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value> |
|
159 | 159 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
160 | 160 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
161 | 161 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
162 | 162 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
163 | 163 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
164 | 164 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
165 | 165 | </valuemap> |
|
166 | 166 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
167 | 167 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value> |
|
168 | 168 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
169 | 169 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
170 | 170 | </valuemap> |
|
171 | 171 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
172 | 172 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
173 | 173 | <value type="bool" key="Analyzer.Project.UseGlobal">true</value> |
|
174 | 174 | <value type="bool" key="Analyzer.Project.UseGlobal">true</value> |
|
175 | 175 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
176 | 176 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
177 | 177 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
178 | 178 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
179 | 179 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
180 | 180 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
181 | 181 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
182 | 182 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
183 | 183 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
184 | 184 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
185 | 185 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
186 | 186 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
187 | 187 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
188 | 188 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
189 | 189 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
190 | 190 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
191 | 191 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
192 | 192 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
193 | 193 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
194 | 194 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
195 | 195 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
196 | 196 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
197 | 197 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
198 | 198 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
199 | 199 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
200 | 200 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
201 | 201 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
202 | 202 | <value type="int">0</value> |
|
203 | 203 | <value type="int">1</value> |
|
204 | 204 | <value type="int">2</value> |
|
205 | 205 | <value type="int">3</value> |
|
206 | 206 | <value type="int">4</value> |
|
207 | 207 | <value type="int">5</value> |
|
208 | 208 | <value type="int">6</value> |
|
209 | 209 | <value type="int">7</value> |
|
210 | 210 | <value type="int">8</value> |
|
211 | 211 | <value type="int">9</value> |
|
212 | 212 | <value type="int">10</value> |
|
213 | 213 | <value type="int">11</value> |
|
214 | 214 | <value type="int">12</value> |
|
215 | 215 | <value type="int">13</value> |
|
216 | 216 | <value type="int">14</value> |
|
217 | 217 | </valuelist> |
|
218 | 218 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
219 | 219 | <value type="int">0</value> |
|
220 | 220 | <value type="int">1</value> |
|
221 | 221 | <value type="int">2</value> |
|
222 | 222 | <value type="int">3</value> |
|
223 | 223 | <value type="int">4</value> |
|
224 | 224 | <value type="int">5</value> |
|
225 | 225 | <value type="int">6</value> |
|
226 | 226 | <value type="int">7</value> |
|
227 | 227 | <value type="int">8</value> |
|
228 | 228 | <value type="int">9</value> |
|
229 | 229 | <value type="int">10</value> |
|
230 | 230 | <value type="int">11</value> |
|
231 | 231 | <value type="int">12</value> |
|
232 | 232 | <value type="int">13</value> |
|
233 | 233 | <value type="int">14</value> |
|
234 | 234 | </valuelist> |
|
235 | 235 | <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> |
|
236 | 236 | <value type="int" key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase">2</value> |
|
237 | 237 | <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">lppmon</value> |
|
238 | 238 | <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value> |
|
239 | 239 | <valuelist type="QVariantList" key="ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges"/> |
|
240 | 240 | <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value> |
|
241 | 241 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run lppmon</value> |
|
242 | 242 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
243 | 243 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> |
|
244 | 244 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
245 | 245 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
246 | 246 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
247 | 247 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value> |
|
248 | 248 | </valuemap> |
|
249 | 249 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
250 | 250 | </valuemap> |
|
251 | 251 | </data> |
|
252 | 252 | <data> |
|
253 | 253 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
254 | 254 | <value type="int">1</value> |
|
255 | 255 | </data> |
|
256 | 256 | <data> |
|
257 | 257 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
258 | 258 | <value type="QString">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
259 | 259 | </data> |
|
260 | 260 | <data> |
|
261 | 261 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
262 | 262 | <value type="int">10</value> |
|
263 | 263 | </data> |
|
264 | 264 | </qtcreator> |
@@ -1,452 +1,434 | |||
|
1 | 1 | ############################################################################# |
|
2 | 2 | # Makefile for building: librmapplugin.so.1.0.0 |
|
3 |
# Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 10 |
|
|
3 | # Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 10 16:03:39 2012 | |
|
4 | 4 | # Project: rmapplugin.pro |
|
5 | 5 | # Template: lib |
|
6 | 6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro |
|
7 | 7 | ############################################################################# |
|
8 | 8 | |
|
9 | 9 | ####### Compiler, tools and options |
|
10 | 10 | |
|
11 | 11 | CC = gcc |
|
12 | 12 | CXX = g++ |
|
13 | 13 | DEFINES = -DPLUGIN=rmapplugin -DPLUGINHEADER="\"rmapplugin.h\"" -Ddriver_Name="\"RMAPPlugin\"" -Ddriver_Author="\"Paul Leroy paul.leroy@lpp.polytechnique.fr\"" -Ddriver_Version="\"1.1.2\"" -Ddriver_Description="\"AHB bus controler, works with Gaisler's AHB plugn' play bus.\"" -Ddriver_can_be_root=1 -Ddriver_can_be_child=0 -Ddriver_VID=0 -Ddriver_PID=0 -DUNIXTRANSLATIONPATH -DLPPMON_PLUGINS_INSTALL_PATH="QDir::homePath()+\"/.lppmon/plugins\"" -DLPPMON_TRANSLATION_PATH="\"/etc/lppmon/translations\"" -DLPPMONPLUGIN_LIBRARY -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED |
|
14 | 14 | CFLAGS = -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES) |
|
15 | 15 | CXXFLAGS = -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -O2 -I/usr/include/python2.7 -I/usr/include/python2.7 -Wall -W -D_REENTRANT -fPIC $(DEFINES) |
|
16 | 16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include -I. -I../common_PLE -I../spw_usb_driver_v2.61/inc -I/usr/include/lppmon/pluginsInterface -I/usr/include/PythonQt -Imoc |
|
17 | 17 | LINK = g++ |
|
18 | 18 | LFLAGS = -Wl,-O1 -Wl,-z,relro -shared -Wl,-soname,librmapplugin.so.1 |
|
19 | 19 | LIBS = $(SUBLIBS) -L/usr/lib64 ../spw_usb_driver_v2.61/lib/x86_64/libSpaceWireUSBAPI.so ../spw_usb_driver_v2.61/lib/x86_64/libConfigLibraryUSB.so -ldl -lutil -lm -lpython2.7 -lPythonQt_QtAll -lPythonQt -lQtGui -lQtNetwork -lQtCore -lpthread |
|
20 | 20 | AR = ar cqs |
|
21 | 21 | RANLIB = |
|
22 | 22 | QMAKE = /usr/bin/qmake-qt4 |
|
23 | 23 | TAR = tar -cf |
|
24 | 24 | COMPRESS = gzip -9f |
|
25 | 25 | COPY = cp -f |
|
26 | 26 | SED = sed |
|
27 | 27 | COPY_FILE = $(COPY) |
|
28 | 28 | COPY_DIR = $(COPY) -r |
|
29 | 29 | STRIP = |
|
30 | 30 | INSTALL_FILE = install -m 644 -p |
|
31 | 31 | INSTALL_DIR = $(COPY_DIR) |
|
32 | 32 | INSTALL_PROGRAM = install -m 755 -p |
|
33 | 33 | DEL_FILE = rm -f |
|
34 | 34 | SYMLINK = ln -f -s |
|
35 | 35 | DEL_DIR = rmdir |
|
36 | 36 | MOVE = mv -f |
|
37 | 37 | CHK_DIR_EXISTS= test -d |
|
38 | 38 | MKDIR = mkdir -p |
|
39 | 39 | |
|
40 | 40 | ####### Output directory |
|
41 | 41 | |
|
42 | 42 | OBJECTS_DIR = obj/ |
|
43 | 43 | |
|
44 | 44 | ####### Files |
|
45 | 45 | |
|
46 | 46 | SOURCES = rmapplugin.cpp \ |
|
47 | 47 | rmappluginui.cpp \ |
|
48 | 48 | rmapoperations.cpp \ |
|
49 | 49 | ccsds.cpp \ |
|
50 | spwpacketreceiver.cpp \ | |
|
51 | 50 | ../common_PLE/qipdialogbox.cpp \ |
|
52 | 51 | ../common_PLE/gresbstatusenquiry.cpp \ |
|
53 | 52 | spectralmatricesdmasimulator.cpp \ |
|
54 | 53 | rmappluginpythonwrapper.cpp \ |
|
55 | 54 | stardundee.cpp \ |
|
56 | 55 | gresb.cpp \ |
|
57 | 56 | bridge.cpp \ |
|
58 | 57 | /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp moc/moc_rmappluginui.cpp \ |
|
59 | 58 | moc/moc_rmapplugin.cpp \ |
|
60 | moc/moc_spwpacketreceiver.cpp \ | |
|
61 | 59 | moc/moc_qipdialogbox.cpp \ |
|
62 | 60 | moc/moc_gresbstatusenquiry.cpp \ |
|
63 | 61 | moc/moc_spectralmatricesdmasimulator.cpp \ |
|
64 | 62 | moc/moc_rmappluginpythonwrapper.cpp \ |
|
65 | 63 | moc/moc_stardundee.cpp \ |
|
66 | 64 | moc/moc_gresb.cpp \ |
|
67 | 65 | moc/moc_bridge.cpp \ |
|
68 | 66 | moc/moc_genericPySysdriver.cpp \ |
|
69 | 67 | moc/moc_lppmonplugin.cpp |
|
70 | 68 | OBJECTS = obj/rmapplugin.o \ |
|
71 | 69 | obj/rmappluginui.o \ |
|
72 | 70 | obj/rmapoperations.o \ |
|
73 | 71 | obj/ccsds.o \ |
|
74 | obj/spwpacketreceiver.o \ | |
|
75 | 72 | obj/qipdialogbox.o \ |
|
76 | 73 | obj/gresbstatusenquiry.o \ |
|
77 | 74 | obj/spectralmatricesdmasimulator.o \ |
|
78 | 75 | obj/rmappluginpythonwrapper.o \ |
|
79 | 76 | obj/stardundee.o \ |
|
80 | 77 | obj/gresb.o \ |
|
81 | 78 | obj/bridge.o \ |
|
82 | 79 | obj/lppmonplugininterface.o \ |
|
83 | 80 | obj/moc_rmappluginui.o \ |
|
84 | 81 | obj/moc_rmapplugin.o \ |
|
85 | obj/moc_spwpacketreceiver.o \ | |
|
86 | 82 | obj/moc_qipdialogbox.o \ |
|
87 | 83 | obj/moc_gresbstatusenquiry.o \ |
|
88 | 84 | obj/moc_spectralmatricesdmasimulator.o \ |
|
89 | 85 | obj/moc_rmappluginpythonwrapper.o \ |
|
90 | 86 | obj/moc_stardundee.o \ |
|
91 | 87 | obj/moc_gresb.o \ |
|
92 | 88 | obj/moc_bridge.o \ |
|
93 | 89 | obj/moc_genericPySysdriver.o \ |
|
94 | 90 | obj/moc_lppmonplugin.o |
|
95 | 91 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
96 | 92 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
97 | 93 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
98 | 94 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
99 | 95 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
100 | 96 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
101 | 97 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
102 | 98 | /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri \ |
|
103 | 99 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
104 | 100 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
105 | 101 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
106 | 102 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
107 | 103 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
108 | 104 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
109 | 105 | /usr/lib64/qt4/mkspecs/features/lppmonplugin.prf \ |
|
110 | 106 | /usr/lib64/qt4/mkspecs/features/pythonqt.prf \ |
|
111 | 107 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
112 | 108 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
113 | 109 | /usr/lib64/qt4/mkspecs/features/qt.prf \ |
|
114 | 110 | /usr/lib64/qt4/mkspecs/features/unix/thread.prf \ |
|
115 | 111 | /usr/lib64/qt4/mkspecs/features/moc.prf \ |
|
116 | 112 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
117 | 113 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
118 | 114 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
119 | 115 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
120 | 116 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
121 | 117 | rmapplugin.pro |
|
122 | 118 | QMAKE_TARGET = rmapplugin |
|
123 | 119 | DESTDIR = bin/ |
|
124 | 120 | TARGET = librmapplugin.so.1.0.0 |
|
125 | 121 | TARGETA = bin/librmapplugin.a |
|
126 | 122 | TARGETD = librmapplugin.so.1.0.0 |
|
127 | 123 | TARGET0 = librmapplugin.so |
|
128 | 124 | TARGET1 = librmapplugin.so.1 |
|
129 | 125 | TARGET2 = librmapplugin.so.1.0 |
|
130 | 126 | |
|
131 | 127 | first: all |
|
132 | 128 | ####### Implicit rules |
|
133 | 129 | |
|
134 | 130 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
135 | 131 | |
|
136 | 132 | .cpp.o: |
|
137 | 133 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
138 | 134 | |
|
139 | 135 | .cc.o: |
|
140 | 136 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
141 | 137 | |
|
142 | 138 | .cxx.o: |
|
143 | 139 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
144 | 140 | |
|
145 | 141 | .C.o: |
|
146 | 142 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
147 | 143 | |
|
148 | 144 | .c.o: |
|
149 | 145 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
150 | 146 | |
|
151 | 147 | ####### Build rules |
|
152 | 148 | |
|
153 | 149 | all: Makefile bin/$(TARGET) |
|
154 | 150 | |
|
155 | 151 | bin/$(TARGET): $(OBJECTS) $(SUBLIBS) $(OBJCOMP) |
|
156 | 152 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
157 | 153 | -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) |
|
158 | 154 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP) |
|
159 | 155 | -ln -s $(TARGET) $(TARGET0) |
|
160 | 156 | -ln -s $(TARGET) $(TARGET1) |
|
161 | 157 | -ln -s $(TARGET) $(TARGET2) |
|
162 | 158 | -$(DEL_FILE) bin/$(TARGET) |
|
163 | 159 | -$(DEL_FILE) bin/$(TARGET0) |
|
164 | 160 | -$(DEL_FILE) bin/$(TARGET1) |
|
165 | 161 | -$(DEL_FILE) bin/$(TARGET2) |
|
166 | 162 | -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) bin/ |
|
167 | 163 | |
|
168 | 164 | |
|
169 | 165 | |
|
170 | 166 | staticlib: $(TARGETA) |
|
171 | 167 | |
|
172 | 168 | $(TARGETA): $(OBJECTS) $(OBJCOMP) |
|
173 | 169 | -$(DEL_FILE) $(TARGETA) |
|
174 | 170 | $(AR) $(TARGETA) $(OBJECTS) |
|
175 | 171 | |
|
176 | 172 | Makefile: rmapplugin.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
177 | 173 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
178 | 174 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
179 | 175 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
180 | 176 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
181 | 177 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
182 | 178 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
183 | 179 | /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri \ |
|
184 | 180 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
185 | 181 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
186 | 182 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
187 | 183 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
188 | 184 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
189 | 185 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
190 | 186 | /usr/lib64/qt4/mkspecs/features/lppmonplugin.prf \ |
|
191 | 187 | /usr/lib64/qt4/mkspecs/features/pythonqt.prf \ |
|
192 | 188 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
193 | 189 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
194 | 190 | /usr/lib64/qt4/mkspecs/features/qt.prf \ |
|
195 | 191 | /usr/lib64/qt4/mkspecs/features/unix/thread.prf \ |
|
196 | 192 | /usr/lib64/qt4/mkspecs/features/moc.prf \ |
|
197 | 193 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
198 | 194 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
199 | 195 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
200 | 196 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
201 | 197 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
202 | 198 | /usr/lib64/libQtGui.prl \ |
|
203 | 199 | /usr/lib64/libQtCore.prl \ |
|
204 | 200 | /usr/lib64/libQtNetwork.prl |
|
205 | 201 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro |
|
206 | 202 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
207 | 203 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
208 | 204 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
209 | 205 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
210 | 206 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
211 | 207 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
212 | 208 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
213 | 209 | /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri: |
|
214 | 210 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
215 | 211 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
216 | 212 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
217 | 213 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
218 | 214 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
219 | 215 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
220 | 216 | /usr/lib64/qt4/mkspecs/features/lppmonplugin.prf: |
|
221 | 217 | /usr/lib64/qt4/mkspecs/features/pythonqt.prf: |
|
222 | 218 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
223 | 219 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
224 | 220 | /usr/lib64/qt4/mkspecs/features/qt.prf: |
|
225 | 221 | /usr/lib64/qt4/mkspecs/features/unix/thread.prf: |
|
226 | 222 | /usr/lib64/qt4/mkspecs/features/moc.prf: |
|
227 | 223 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
228 | 224 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
229 | 225 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
230 | 226 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
231 | 227 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
232 | 228 | /usr/lib64/libQtGui.prl: |
|
233 | 229 | /usr/lib64/libQtCore.prl: |
|
234 | 230 | /usr/lib64/libQtNetwork.prl: |
|
235 | 231 | qmake: FORCE |
|
236 | 232 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro |
|
237 | 233 | |
|
238 | 234 | dist: |
|
239 | 235 | @$(CHK_DIR_EXISTS) obj/rmapplugin1.0.0 || $(MKDIR) obj/rmapplugin1.0.0 |
|
240 |
$(COPY_FILE) --parents $(SOURCES) $(DIST) obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmappluginui.h rmapplugin.h rmapoperations.h ccsds.h |
|
|
236 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmappluginui.h rmapplugin.h rmapoperations.h ccsds.h ../common_PLE/qipdialogbox.h ../common_PLE/gresbstatusenquiry.h spectralmatricesdmasimulator.h rmappluginpythonwrapper.h stardundee.h ../spw_usb_driver_v2.61/inc/spw_usb_api.h ../spw_usb_driver_v2.61/inc/spw_config_library.h gresb.h bridge.h /usr/include/genericPySysdriver.h /usr/include/lppmonplugin.h obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmapplugin.cpp rmappluginui.cpp rmapoperations.cpp ccsds.cpp ../common_PLE/qipdialogbox.cpp ../common_PLE/gresbstatusenquiry.cpp spectralmatricesdmasimulator.cpp rmappluginpythonwrapper.cpp stardundee.cpp gresb.cpp bridge.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp obj/rmapplugin1.0.0/ && (cd `dirname obj/rmapplugin1.0.0` && $(TAR) rmapplugin1.0.0.tar rmapplugin1.0.0 && $(COMPRESS) rmapplugin1.0.0.tar) && $(MOVE) `dirname obj/rmapplugin1.0.0`/rmapplugin1.0.0.tar.gz . && $(DEL_FILE) -r obj/rmapplugin1.0.0 | |
|
241 | 237 | |
|
242 | 238 | |
|
243 | 239 | clean:compiler_clean |
|
244 | 240 | -$(DEL_FILE) $(OBJECTS) |
|
245 | 241 | -$(DEL_FILE) *~ core *.core |
|
246 | 242 | |
|
247 | 243 | |
|
248 | 244 | ####### Sub-libraries |
|
249 | 245 | |
|
250 | 246 | distclean: clean |
|
251 | 247 | -$(DEL_FILE) bin/$(TARGET) |
|
252 | 248 | -$(DEL_FILE) bin/$(TARGET0) bin/$(TARGET1) bin/$(TARGET2) $(TARGETA) |
|
253 | 249 | -$(DEL_FILE) Makefile |
|
254 | 250 | |
|
255 | 251 | |
|
256 | 252 | check: first |
|
257 | 253 | |
|
258 | 254 | mocclean: compiler_moc_header_clean compiler_moc_source_clean |
|
259 | 255 | |
|
260 | 256 | mocables: compiler_moc_header_make_all compiler_moc_source_make_all |
|
261 | 257 | |
|
262 |
compiler_moc_header_make_all: moc/moc_rmappluginui.cpp moc/moc_rmapplugin |
|
|
258 | compiler_moc_header_make_all: moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp | |
|
263 | 259 | compiler_moc_header_clean: |
|
264 |
-$(DEL_FILE) moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp |
|
|
260 | -$(DEL_FILE) moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp | |
|
265 | 261 | moc/moc_rmappluginui.cpp: rmapoperations.h \ |
|
266 | 262 | spectralmatricesdmasimulator.h \ |
|
267 | 263 | stardundee.h \ |
|
268 | 264 | gresb.h \ |
|
269 | spwpacketreceiver.h \ | |
|
270 | 265 | rmappluginui.h |
|
271 | 266 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginui.h -o moc/moc_rmappluginui.cpp |
|
272 | 267 | |
|
273 | 268 | moc/moc_rmapplugin.cpp: rmappluginui.h \ |
|
274 | 269 | rmapoperations.h \ |
|
275 | 270 | spectralmatricesdmasimulator.h \ |
|
276 | 271 | stardundee.h \ |
|
277 | 272 | gresb.h \ |
|
278 | spwpacketreceiver.h \ | |
|
279 | 273 | ccsds.h \ |
|
280 | 274 | rmapplugin.h |
|
281 | 275 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmapplugin.h -o moc/moc_rmapplugin.cpp |
|
282 | 276 | |
|
283 | moc/moc_spwpacketreceiver.cpp: spwpacketreceiver.h | |
|
284 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) spwpacketreceiver.h -o moc/moc_spwpacketreceiver.cpp | |
|
285 | ||
|
286 | 277 | moc/moc_qipdialogbox.cpp: ../common_PLE/qipdialogbox.h |
|
287 | 278 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) ../common_PLE/qipdialogbox.h -o moc/moc_qipdialogbox.cpp |
|
288 | 279 | |
|
289 | 280 | moc/moc_gresbstatusenquiry.cpp: ../common_PLE/gresbstatusenquiry.h |
|
290 | 281 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) ../common_PLE/gresbstatusenquiry.h -o moc/moc_gresbstatusenquiry.cpp |
|
291 | 282 | |
|
292 | 283 | moc/moc_spectralmatricesdmasimulator.cpp: spectralmatricesdmasimulator.h |
|
293 | 284 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) spectralmatricesdmasimulator.h -o moc/moc_spectralmatricesdmasimulator.cpp |
|
294 | 285 | |
|
295 | 286 | moc/moc_rmappluginpythonwrapper.cpp: rmappluginpythonwrapper.h |
|
296 | 287 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginpythonwrapper.h -o moc/moc_rmappluginpythonwrapper.cpp |
|
297 | 288 | |
|
298 | 289 | moc/moc_stardundee.cpp: rmapoperations.h \ |
|
299 | 290 | stardundee.h |
|
300 | 291 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) stardundee.h -o moc/moc_stardundee.cpp |
|
301 | 292 | |
|
302 |
moc/moc_gresb.cpp: |
|
|
303 | rmapoperations.h \ | |
|
293 | moc/moc_gresb.cpp: rmapoperations.h \ | |
|
304 | 294 | gresb.h |
|
305 | 295 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) gresb.h -o moc/moc_gresb.cpp |
|
306 | 296 | |
|
307 |
moc/moc_bridge.cpp: |
|
|
297 | moc/moc_bridge.cpp: rmapoperations.h \ | |
|
298 | bridge.h | |
|
308 | 299 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) bridge.h -o moc/moc_bridge.cpp |
|
309 | 300 | |
|
310 | 301 | moc/moc_genericPySysdriver.cpp: /usr/include/genericPySysdriver.h |
|
311 | 302 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/genericPySysdriver.h -o moc/moc_genericPySysdriver.cpp |
|
312 | 303 | |
|
313 | 304 | moc/moc_lppmonplugin.cpp: /usr/include/lppmonplugin.h |
|
314 | 305 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/lppmonplugin.h -o moc/moc_lppmonplugin.cpp |
|
315 | 306 | |
|
316 | 307 | compiler_rcc_make_all: |
|
317 | 308 | compiler_rcc_clean: |
|
318 | 309 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
319 | 310 | compiler_image_collection_clean: |
|
320 | 311 | -$(DEL_FILE) qmake_image_collection.cpp |
|
321 | 312 | compiler_moc_source_make_all: |
|
322 | 313 | compiler_moc_source_clean: |
|
323 | 314 | compiler_uic_make_all: |
|
324 | 315 | compiler_uic_clean: |
|
325 | 316 | compiler_yacc_decl_make_all: |
|
326 | 317 | compiler_yacc_decl_clean: |
|
327 | 318 | compiler_yacc_impl_make_all: |
|
328 | 319 | compiler_yacc_impl_clean: |
|
329 | 320 | compiler_lex_make_all: |
|
330 | 321 | compiler_lex_clean: |
|
331 | 322 | compiler_clean: compiler_moc_header_clean |
|
332 | 323 | |
|
333 | 324 | ####### Compile |
|
334 | 325 | |
|
335 | 326 | obj/rmapplugin.o: rmapplugin.cpp rmapplugin.h \ |
|
336 | 327 | rmappluginui.h \ |
|
337 | 328 | rmapoperations.h \ |
|
338 | 329 | spectralmatricesdmasimulator.h \ |
|
339 | 330 | stardundee.h \ |
|
340 | 331 | gresb.h \ |
|
341 | spwpacketreceiver.h \ | |
|
342 | 332 | ccsds.h \ |
|
343 | 333 | rmappluginpythonwrapper.h |
|
344 | 334 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmapplugin.o rmapplugin.cpp |
|
345 | 335 | |
|
346 | 336 | obj/rmappluginui.o: rmappluginui.cpp rmapplugin.h \ |
|
347 | 337 | rmappluginui.h \ |
|
348 | 338 | rmapoperations.h \ |
|
349 | 339 | spectralmatricesdmasimulator.h \ |
|
350 | 340 | stardundee.h \ |
|
351 | 341 | gresb.h \ |
|
352 | spwpacketreceiver.h \ | |
|
353 | 342 | ccsds.h |
|
354 | 343 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginui.o rmappluginui.cpp |
|
355 | 344 | |
|
356 | 345 | obj/rmapoperations.o: rmapoperations.cpp rmapoperations.h |
|
357 | 346 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmapoperations.o rmapoperations.cpp |
|
358 | 347 | |
|
359 | 348 | obj/ccsds.o: ccsds.cpp ccsds.h |
|
360 | 349 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/ccsds.o ccsds.cpp |
|
361 | 350 | |
|
362 | obj/spwpacketreceiver.o: spwpacketreceiver.cpp spwpacketreceiver.h \ | |
|
363 | rmapoperations.h | |
|
364 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spwpacketreceiver.o spwpacketreceiver.cpp | |
|
365 | ||
|
366 | 351 | obj/qipdialogbox.o: ../common_PLE/qipdialogbox.cpp ../common_PLE/qipdialogbox.h |
|
367 | 352 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/qipdialogbox.o ../common_PLE/qipdialogbox.cpp |
|
368 | 353 | |
|
369 | 354 | obj/gresbstatusenquiry.o: ../common_PLE/gresbstatusenquiry.cpp ../common_PLE/gresbstatusenquiry.h |
|
370 | 355 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresbstatusenquiry.o ../common_PLE/gresbstatusenquiry.cpp |
|
371 | 356 | |
|
372 | 357 | obj/spectralmatricesdmasimulator.o: spectralmatricesdmasimulator.cpp spectralmatricesdmasimulator.h |
|
373 | 358 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spectralmatricesdmasimulator.o spectralmatricesdmasimulator.cpp |
|
374 | 359 | |
|
375 | 360 | obj/rmappluginpythonwrapper.o: rmappluginpythonwrapper.cpp rmappluginpythonwrapper.h |
|
376 | 361 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginpythonwrapper.o rmappluginpythonwrapper.cpp |
|
377 | 362 | |
|
378 | 363 | obj/stardundee.o: stardundee.cpp stardundee.h \ |
|
379 | 364 | rmapoperations.h |
|
380 | 365 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/stardundee.o stardundee.cpp |
|
381 | 366 | |
|
382 | 367 | obj/gresb.o: gresb.cpp gresb.h \ |
|
383 | spwpacketreceiver.h \ | |
|
384 | 368 | rmapoperations.h |
|
385 | 369 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresb.o gresb.cpp |
|
386 | 370 | |
|
387 | obj/bridge.o: bridge.cpp bridge.h | |
|
371 | obj/bridge.o: bridge.cpp bridge.h \ | |
|
372 | rmapoperations.h | |
|
388 | 373 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/bridge.o bridge.cpp |
|
389 | 374 | |
|
390 | 375 | obj/lppmonplugininterface.o: /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.h \ |
|
391 | 376 | /usr/include/lppmon/pluginsInterface/lppmonplugininterface_global.h |
|
392 | 377 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/lppmonplugininterface.o /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp |
|
393 | 378 | |
|
394 | 379 | obj/moc_rmappluginui.o: moc/moc_rmappluginui.cpp |
|
395 | 380 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_rmappluginui.o moc/moc_rmappluginui.cpp |
|
396 | 381 | |
|
397 | 382 | obj/moc_rmapplugin.o: moc/moc_rmapplugin.cpp |
|
398 | 383 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_rmapplugin.o moc/moc_rmapplugin.cpp |
|
399 | 384 | |
|
400 | obj/moc_spwpacketreceiver.o: moc/moc_spwpacketreceiver.cpp | |
|
401 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_spwpacketreceiver.o moc/moc_spwpacketreceiver.cpp | |
|
402 | ||
|
403 | 385 | obj/moc_qipdialogbox.o: moc/moc_qipdialogbox.cpp |
|
404 | 386 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_qipdialogbox.o moc/moc_qipdialogbox.cpp |
|
405 | 387 | |
|
406 | 388 | obj/moc_gresbstatusenquiry.o: moc/moc_gresbstatusenquiry.cpp |
|
407 | 389 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_gresbstatusenquiry.o moc/moc_gresbstatusenquiry.cpp |
|
408 | 390 | |
|
409 | 391 | obj/moc_spectralmatricesdmasimulator.o: moc/moc_spectralmatricesdmasimulator.cpp |
|
410 | 392 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_spectralmatricesdmasimulator.o moc/moc_spectralmatricesdmasimulator.cpp |
|
411 | 393 | |
|
412 | 394 | obj/moc_rmappluginpythonwrapper.o: moc/moc_rmappluginpythonwrapper.cpp |
|
413 | 395 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_rmappluginpythonwrapper.o moc/moc_rmappluginpythonwrapper.cpp |
|
414 | 396 | |
|
415 | 397 | obj/moc_stardundee.o: moc/moc_stardundee.cpp |
|
416 | 398 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_stardundee.o moc/moc_stardundee.cpp |
|
417 | 399 | |
|
418 | 400 | obj/moc_gresb.o: moc/moc_gresb.cpp |
|
419 | 401 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_gresb.o moc/moc_gresb.cpp |
|
420 | 402 | |
|
421 | 403 | obj/moc_bridge.o: moc/moc_bridge.cpp |
|
422 | 404 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_bridge.o moc/moc_bridge.cpp |
|
423 | 405 | |
|
424 | 406 | obj/moc_genericPySysdriver.o: moc/moc_genericPySysdriver.cpp |
|
425 | 407 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_genericPySysdriver.o moc/moc_genericPySysdriver.cpp |
|
426 | 408 | |
|
427 | 409 | obj/moc_lppmonplugin.o: moc/moc_lppmonplugin.cpp |
|
428 | 410 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_lppmonplugin.o moc/moc_lppmonplugin.cpp |
|
429 | 411 | |
|
430 | 412 | ####### Install |
|
431 | 413 | |
|
432 | 414 | install_target: first FORCE |
|
433 | 415 | @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/home/paul/.lppmon/plugins/ || $(MKDIR) $(INSTALL_ROOT)/home/paul/.lppmon/plugins/ |
|
434 | 416 | -$(INSTALL_PROGRAM) "bin/$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET)" |
|
435 | 417 | -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET0)" |
|
436 | 418 | -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET1)" |
|
437 | 419 | -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET2)" |
|
438 | 420 | |
|
439 | 421 | uninstall_target: FORCE |
|
440 | 422 | -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET)" |
|
441 | 423 | -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET0)" |
|
442 | 424 | -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET1)" |
|
443 | 425 | -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET2)" |
|
444 | 426 | -$(DEL_DIR) $(INSTALL_ROOT)/home/paul/.lppmon/plugins/ |
|
445 | 427 | |
|
446 | 428 | |
|
447 | 429 | install: install_target FORCE |
|
448 | 430 | |
|
449 | 431 | uninstall: uninstall_target FORCE |
|
450 | 432 | |
|
451 | 433 | FORCE: |
|
452 | 434 |
@@ -1,799 +1,766 | |||
|
1 | 1 | #include "gresb.h" |
|
2 | 2 | #include <QTime> |
|
3 | 3 | #include <QHostAddress> |
|
4 | 4 | |
|
5 | 5 | gresb::gresb(QWidget *parent) : |
|
6 | 6 | QWidget(parent) |
|
7 | 7 | { |
|
8 | 8 | RMAPSend_SOCKET = new QTcpSocket; |
|
9 | 9 | RMAPReceive_SOCKET = new QTcpSocket; |
|
10 | 10 | GRESBStatusQuery_SOCKET = new QTcpSocket; |
|
11 | 11 | |
|
12 | 12 | rmapPacketSEMAPHORE = new QSemaphore; |
|
13 | 13 | ccsdsPacketSEMAPHORE = new QSemaphore; |
|
14 | 14 | rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH); |
|
15 | 15 | ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH); |
|
16 | 16 | spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) ); |
|
17 | 17 | |
|
18 | 18 | commandCode = invalid0; // initialization of the command code for the RMAP transfers |
|
19 | 19 | |
|
20 | 20 | //*** QLABEL ***// |
|
21 | 21 | gresbBridgeIPLabel = new QLabel(tr("GRESB Bridge IP: ")); |
|
22 | 22 | gresbVirtualLinkLabel = new QLabel(tr("GRESB Virtual Link: ")); |
|
23 | 23 | spwLinkLabel = new QLabel(tr("GRESB SPW Link: ")); |
|
24 | 24 | rmapSourceLogicalAddressLabel = new QLabel(tr("RMAP Source Logical Address: ")); |
|
25 | 25 | rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection")); |
|
26 | 26 | rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection")); |
|
27 | 27 | gresbStatusQueryLabel = new QLabel(tr("GRESB status query socket (port 3010): waiting for connection")); |
|
28 | 28 | gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running")); |
|
29 | 29 | |
|
30 | 30 | //*** SPINBOX ***// |
|
31 | 31 | gresbVirtualLinkSpinBox = new QSpinBox; |
|
32 | 32 | rmapSourceLogicalAddressSpinBox = new QSpinBox; |
|
33 | 33 | spwLinkSpinBox = new QSpinBox;; |
|
34 | 34 | gresbVirtualLinkSpinBox->setRange(0, 4); |
|
35 | 35 | gresbVirtualLinkSpinBox->setValue(1); |
|
36 | 36 | rmapSourceLogicalAddressSpinBox->setRange(0, 255); |
|
37 | 37 | rmapSourceLogicalAddressSpinBox->setValue(33); |
|
38 | 38 | spwLinkSpinBox->setRange(0, 2); |
|
39 | 39 | spwLinkSpinBox->setValue(0); |
|
40 | 40 | |
|
41 | 41 | //*** QPUSHBUTTON ***// |
|
42 | 42 | gresbStatusQueryRetryButton = new QPushButton(tr("Retry")); |
|
43 | 43 | gresbStatusQueryAbortButton = new QPushButton(tr("Abort")); |
|
44 | 44 | |
|
45 | 45 | //*** LAYOUT ***// |
|
46 | 46 | connectionLayout = new QGridLayout; |
|
47 | 47 | |
|
48 | 48 | //*** MISC ***// |
|
49 | 49 | gresbStatusQueryDialog = new QDialog; |
|
50 | 50 | gresbBridgeIPDialogBox = new QIPDialogBox; |
|
51 | 51 | spwLinkStatusEnquiry = new gresbStatusEnquiry; |
|
52 | 52 | |
|
53 | 53 | connectionLayout->addWidget(gresbBridgeIPLabel, 0, 0, 0); |
|
54 | 54 | connectionLayout->addWidget(gresbBridgeIPDialogBox, 0, 1, 0); |
|
55 | 55 | connectionLayout->addWidget(gresbVirtualLinkLabel, 1, 0, 0); |
|
56 | 56 | connectionLayout->addWidget(gresbVirtualLinkSpinBox, 1, 1, 0); |
|
57 | 57 | connectionLayout->addWidget(spwLinkLabel, 2, 0, 0); |
|
58 | 58 | connectionLayout->addWidget(spwLinkSpinBox, 2, 1, 0); |
|
59 | 59 | connectionLayout->addWidget(rmapSourceLogicalAddressLabel, 3, 0, 0); |
|
60 | 60 | connectionLayout->addWidget(rmapSourceLogicalAddressSpinBox, 3, 1, 0); |
|
61 | 61 | connectionLayout->addWidget(rmapSendStateLabel, 4, 0, 1, 2); |
|
62 | 62 | connectionLayout->addWidget(rmapReceiveStateLabel, 5, 0, 1, 2); |
|
63 | 63 | connectionLayout->addWidget(gresbStatusQueryLabel, 6, 0, 1, 2); |
|
64 | 64 | |
|
65 | 65 | connectionLayout->setRowStretch(7, 1); |
|
66 | 66 | connectionLayout->setColumnStretch(2, 1); |
|
67 | 67 | |
|
68 | 68 | // GRESB STATUS QUERY DIALOG |
|
69 | 69 | gresbStatusQueryDialogLayout = new QGridLayout; |
|
70 | 70 | gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryDialogLabel, 0, 0, 1, 2); |
|
71 | 71 | gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryRetryButton, 1, 0, 0); |
|
72 | 72 | gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryAbortButton, 1, 1, 0); |
|
73 | 73 | gresbStatusQueryDialog->setLayout(gresbStatusQueryDialogLayout); |
|
74 | 74 | |
|
75 | 75 | this->setLayout(connectionLayout); |
|
76 | 76 | |
|
77 | 77 | connect(RMAPSend_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPSendConnectionState(QAbstractSocket::SocketState))); |
|
78 | 78 | connect(RMAPReceive_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPReceiveConnectionState(QAbstractSocket::SocketState))); |
|
79 | 79 | connect(GRESBStatusQuery_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(GRESBConnectionState(QAbstractSocket::SocketState))); |
|
80 | 80 | connect(gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink())); |
|
81 | connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject())); | |
|
81 | 82 | connect(spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery())); |
|
82 | 83 | connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacket())); |
|
83 | ||
|
84 | connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject())); | |
|
85 | connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacket())); | |
|
86 | 84 | } |
|
87 | 85 | |
|
88 | 86 | gresb::~gresb() |
|
89 | 87 | { |
|
90 | 88 | free(rmapPacket); |
|
91 | 89 | free(ccsdsPacket); |
|
92 | 90 | free(spwPacket); |
|
93 | 91 | } |
|
94 | 92 | |
|
95 | 93 | unsigned int gresb::Write(unsigned int *Value, unsigned int count, unsigned int address) |
|
96 | 94 | { |
|
97 | 95 | unsigned int remainingCount = count; |
|
98 | 96 | unsigned int iOffset = 0; |
|
99 | 97 | QString console_message; |
|
100 | 98 | char* data; |
|
101 | 99 | |
|
102 | 100 | if(rmapPacketSEMAPHORE->available()!=0) |
|
103 | 101 | { |
|
104 | 102 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped"); |
|
105 | 103 | return 1; |
|
106 | 104 | } |
|
107 | 105 | |
|
108 | 106 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: unavailable"); |
|
109 | 107 | |
|
110 | 108 | data = (char*) malloc(READ_WRITE_MAX_COUNTS*4); |
|
111 | 109 | |
|
112 | 110 | emit appendToLog(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); |
|
113 | 111 | |
|
114 | 112 | while (remainingCount > READ_WRITE_MAX_COUNTS) |
|
115 | 113 | { |
|
116 | 114 | for (int i = 0; i<READ_WRITE_MAX_COUNTS; i++) |
|
117 | 115 | { |
|
118 | 116 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); |
|
119 | 117 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); |
|
120 | 118 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); |
|
121 | 119 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); |
|
122 | 120 | } |
|
123 | 121 | |
|
124 | 122 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
125 | 123 | emit appendToLog(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
126 | 124 | |
|
127 | 125 | if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0) |
|
128 | 126 | { |
|
129 | 127 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); |
|
130 | 128 | return 1; |
|
131 | 129 | } |
|
132 | 130 | |
|
133 | 131 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; |
|
134 | 132 | address = address + READ_WRITE_MAX_COUNTS * 4; |
|
135 | 133 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; |
|
136 | 134 | } |
|
137 | 135 | |
|
138 | 136 | if (remainingCount > 0) |
|
139 | 137 | { |
|
140 | 138 | for (unsigned int i = 0; i<remainingCount; i++) |
|
141 | 139 | { |
|
142 | 140 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); |
|
143 | 141 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); |
|
144 | 142 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); |
|
145 | 143 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); |
|
146 | 144 | } |
|
147 | 145 | |
|
148 | 146 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
149 | 147 | emit appendToLog(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
150 | 148 | |
|
151 | 149 | if (WriteBLOCK(data, remainingCount*4, address)==0) |
|
152 | 150 | { |
|
153 | 151 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); |
|
154 | 152 | return 1; |
|
155 | 153 | } |
|
156 | 154 | } |
|
157 | 155 | |
|
158 | 156 | emit appendToLog(QString("*** STOP *** WRITE")); |
|
159 | 157 | free(data); |
|
160 | 158 | return count; |
|
161 | 159 | } |
|
162 | 160 | |
|
163 | 161 | unsigned int gresb::Read(unsigned int *Value, unsigned int count, unsigned int address) |
|
164 | 162 | { |
|
165 | 163 | unsigned int remainingCount = count; |
|
166 | 164 | unsigned int iOffset = 0; |
|
167 | 165 | QString console_message; |
|
168 | 166 | |
|
169 | 167 | if(rmapPacketSEMAPHORE->available()!=0) |
|
170 | 168 | { |
|
171 | 169 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped"); |
|
172 | 170 | return 1; |
|
173 | 171 | } |
|
174 | 172 | emit appendToLog(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); |
|
175 | 173 | |
|
176 | 174 | while (remainingCount > READ_WRITE_MAX_COUNTS) |
|
177 | 175 | { |
|
178 | 176 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
179 | 177 | emit appendToLog(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
180 | 178 | |
|
181 | 179 | if (ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0) |
|
182 | 180 | { |
|
183 | 181 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received"); |
|
184 | 182 | return 1; |
|
185 | 183 | } |
|
186 | 184 | |
|
187 | 185 | for(int i=0;i<READ_WRITE_MAX_COUNTS;i++) |
|
188 | 186 | { |
|
189 | 187 | Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; |
|
190 | 188 | for(int j=1;j<4;j++) |
|
191 | 189 | { |
|
192 | 190 | Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256; |
|
193 | 191 | } |
|
194 | 192 | } |
|
195 | 193 | |
|
196 | 194 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; |
|
197 | 195 | address = address + READ_WRITE_MAX_COUNTS * 4; |
|
198 | 196 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; |
|
199 | acquireRMAPSemaphore(); | |
|
197 | rmapPacketSEMAPHORE->acquire(); | |
|
200 | 198 | } |
|
201 | 199 | |
|
202 | 200 | if (remainingCount > 0) |
|
203 | 201 | { |
|
204 | 202 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
205 | 203 | emit appendToLog(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
206 | 204 | |
|
207 | 205 | if (ReadBLOCK(4*remainingCount, address)==0) |
|
208 | 206 | { |
|
209 | 207 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received"); |
|
210 | 208 | return 1; |
|
211 | 209 | } |
|
212 | 210 | |
|
213 | 211 | for(unsigned int i=0;i<remainingCount;i++) |
|
214 | 212 | { |
|
215 | 213 | Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; |
|
216 | 214 | for(int j=1;j<4;j++) |
|
217 | 215 | { |
|
218 | 216 | Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256; |
|
219 | 217 | } |
|
220 | 218 | } |
|
221 | acquireRMAPSemaphore(); | |
|
219 | rmapPacketSEMAPHORE->acquire(); | |
|
222 | 220 | } |
|
223 | 221 | |
|
224 | 222 | emit appendToLog(QString("*** STOP *** READ ")); |
|
225 | 223 | return count; |
|
226 | 224 | } |
|
227 | 225 | |
|
228 | 226 | unsigned int gresb::WriteBLOCK(char *data, unsigned int nbBytes, unsigned int address) |
|
229 | 227 | { |
|
230 | 228 | QTime RMAPTimeout; |
|
231 | 229 | RMAP *RMAPCommand; |
|
232 | 230 | int errorCode; |
|
233 | 231 | QString console_message; |
|
234 | 232 | |
|
235 | 233 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 1) |
|
236 | 234 | { |
|
237 | 235 | this->Close(); |
|
238 | 236 | return 1; |
|
239 | 237 | } |
|
240 | 238 | |
|
241 | 239 | RMAPCommand = new RMAP(commandCode, |
|
242 | 240 | rmapTargetLogicalAddress, |
|
243 | 241 | rmapSourceLogicalAddressSpinBox->value(), |
|
244 | 242 | address, |
|
245 | 243 | nbBytes, |
|
246 | 244 | data); |
|
247 | 245 | |
|
248 | 246 | // SEND GRESB HEADER |
|
249 | 247 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4); |
|
250 | 248 | // SEND SPACEWIRE PACKET HEADER |
|
251 | 249 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader)); |
|
252 | 250 | // SEND DATA |
|
253 | 251 | RMAPSend_SOCKET->write( data, nbBytes); |
|
254 | 252 | // SEND DATA CRC |
|
255 | 253 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->dataCRC), 1); |
|
256 | 254 | RMAPTimeout.start(); |
|
257 | 255 | while(RMAPSend_SOCKET->bytesToWrite() > 0) |
|
258 | 256 | { |
|
259 | 257 | RMAPSend_SOCKET->waitForBytesWritten(100); |
|
260 | 258 | if(RMAPTimeout.elapsed()>1000) |
|
261 | 259 | { |
|
262 | 260 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** sending Write RMAP Command timeout"); |
|
263 | 261 | return 0; |
|
264 | 262 | } |
|
265 | 263 | } |
|
266 | 264 | |
|
267 | 265 | if ( (commandCode == writeSingle_noVer_Rep) | (commandCode == writeInc_noVer_Rep) | |
|
268 | 266 | (commandCode == writeSingle_ver_rep) | (commandCode == writeInc_ver_rep) ) |
|
269 | 267 | { |
|
270 | 268 | // WAIT FOR THE RMAP REPLY PACKET |
|
271 | 269 | errorCode = receiveSPWPacket(1); |
|
272 | 270 | if (errorCode<=0) |
|
273 | 271 | { |
|
274 | 272 | emit appendToLog("WARNING === in function WriteBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode)); |
|
275 | 273 | return 0; |
|
276 | 274 | } |
|
277 | 275 | if(rmapPacketSize != 8) |
|
278 | 276 | { |
|
279 | 277 | console_message.sprintf("WARNING === in function WRITE (with reply) of rmapplugin *** write reply format not compliant\n"); |
|
280 | 278 | emit appendToLog(console_message); |
|
281 | 279 | return 0; |
|
282 | 280 | } |
|
283 | 281 | switch (rmapPacket[3]) // byte 4 is the status byte in the reply |
|
284 | 282 | { |
|
285 | 283 | case 0: |
|
286 | 284 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 0 Successfull"); |
|
287 | 285 | break; |
|
288 | 286 | case 1: |
|
289 | 287 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** General error code"); |
|
290 | 288 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 1 General error code"); |
|
291 | 289 | break; |
|
292 | 290 | case 2: |
|
293 | 291 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Unused RMAP packet type or command code"); |
|
294 | 292 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 2 Unused RMAP packet type or command code"); |
|
295 | 293 | break; |
|
296 | 294 | case 3: |
|
297 | 295 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid key"); |
|
298 | 296 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 3 Invalid key"); |
|
299 | 297 | break; |
|
300 | 298 | case 4: |
|
301 | 299 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid data CRC"); |
|
302 | 300 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 4 Invalid data CRC"); |
|
303 | 301 | break; |
|
304 | 302 | case 5: |
|
305 | 303 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Early EOP"); |
|
306 | 304 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 5 Early EOP"); |
|
307 | 305 | break; |
|
308 | 306 | case 6: |
|
309 | 307 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Too much data"); |
|
310 | 308 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 6 Too much data"); |
|
311 | 309 | break; |
|
312 | 310 | case 7: |
|
313 | 311 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** EEP"); |
|
314 | 312 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 7 EEP"); |
|
315 | 313 | break; |
|
316 | 314 | case 8: |
|
317 | 315 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Reserved"); |
|
318 | 316 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 8 Reserved"); |
|
319 | 317 | break; |
|
320 | 318 | case 9: |
|
321 | 319 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Verify buffer overrun"); |
|
322 | 320 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 9 Verify buffer overrun"); |
|
323 | 321 | break; |
|
324 | 322 | case 10: |
|
325 | 323 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMAP command not implemented or not authorised"); |
|
326 | 324 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 10 RMAP command not implemented or not authorised"); |
|
327 | 325 | break; |
|
328 | 326 | case 11: |
|
329 | 327 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMW data length error"); |
|
330 | 328 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 11 RMAP RMW data length error"); |
|
331 | 329 | break; |
|
332 | 330 | case 12: |
|
333 | 331 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid target logical address"); |
|
334 | 332 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 12 Invalid target logical address"); |
|
335 | 333 | break; |
|
336 | 334 | } |
|
337 | 335 | acquireRMAPSemaphore(); |
|
338 | 336 | } |
|
339 | 337 | return nbBytes; |
|
340 | 338 | } |
|
341 | 339 | |
|
342 | 340 | unsigned int gresb::ReadBLOCK(unsigned int nbBytes, unsigned int address) |
|
343 | 341 | { |
|
344 | 342 | int errorCode; |
|
345 | 343 | RMAP *RMAPCommand; |
|
346 | 344 | QTime RMAPTimeout; |
|
347 | 345 | unsigned int dataLength; |
|
348 | 346 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 1) |
|
349 | 347 | { |
|
350 | 348 | this->Close(); |
|
351 | 349 | return 1; |
|
352 | 350 | } |
|
353 | 351 | |
|
354 | 352 | if (nbBytes > 4) |
|
355 | 353 | { |
|
356 | 354 | RMAPCommand = new RMAP(read_Inc, |
|
357 | 355 | rmapTargetLogicalAddress, |
|
358 | 356 | rmapSourceLogicalAddressSpinBox->value(), |
|
359 | 357 | address, |
|
360 | 358 | nbBytes, |
|
361 | 359 | NULL); |
|
362 | 360 | } |
|
363 | 361 | else |
|
364 | 362 | { |
|
365 | 363 | RMAPCommand = new RMAP(read_Single, |
|
366 | 364 | rmapTargetLogicalAddress, |
|
367 | 365 | rmapSourceLogicalAddressSpinBox->value(), |
|
368 | 366 | address, |
|
369 | 367 | nbBytes, |
|
370 | 368 | NULL); |
|
371 | 369 | } |
|
372 | 370 | |
|
373 | 371 | // SEND THE GRESB HEADER FOR THE RMAP READ COMMAND |
|
374 | 372 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4); |
|
375 | 373 | // SEND THE SPACEWIRE PACKET FOR THE RMAP READ COMMAND |
|
376 | 374 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader)); |
|
377 | 375 | RMAPSend_SOCKET->waitForBytesWritten(100); |
|
378 | 376 | RMAPTimeout.start(); |
|
379 | 377 | // write timeout |
|
380 | 378 | while(RMAPSend_SOCKET->bytesToWrite() > 0) |
|
381 | 379 | { |
|
382 | 380 | RMAPSend_SOCKET->waitForBytesWritten(100); |
|
383 | 381 | if(RMAPTimeout.elapsed()>1000) |
|
384 | 382 | { |
|
385 | 383 | emit appendToLog("WARNING === in function READ of rmapplugin *** sending Read RMAP Command timeout\n"); |
|
386 | 384 | return 0; |
|
387 | 385 | } |
|
388 | 386 | } |
|
389 | 387 | |
|
390 | 388 | // RECEIVE THE INCOMING RMAP PACKET |
|
391 | 389 | errorCode = receiveSPWPacket(1); // request ID 1 is for RMAP packet |
|
392 | 390 | if (errorCode<=0) |
|
393 | 391 | { |
|
394 | 392 | emit appendToLog("WARNING === in function ReadBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode)); |
|
395 | 393 | return 0; |
|
396 | 394 | } |
|
397 | 395 | dataLength = rmapPacketSize - RMAP_READ_REPLY_HEADER_LENGTH - RMAP_DATA_CRC_LENGTH; |
|
398 | 396 | if(dataLength != nbBytes) |
|
399 | 397 | { |
|
400 | 398 | emit appendToLog("WARNING === in function READ of rmapplugin *** number of data received (" |
|
401 | 399 | +QString::number(dataLength) |
|
402 | 400 | +") not equal to number of data requested (" |
|
403 |
+QString::number( |
|
|
401 | +QString::number(nbBytes) | |
|
404 | 402 | +")"); |
|
405 | 403 | return 0; |
|
406 | 404 | } |
|
407 | 405 | return dataLength; |
|
408 | 406 | } |
|
409 | 407 | |
|
410 | 408 | unsigned int gresb::WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) |
|
411 | 409 | { |
|
412 | 410 | char protocoleIdentifier = 0x02; |
|
413 | 411 | char reserved = 0x00; |
|
414 | 412 | char gresbProtocole = 0x00; |
|
415 | 413 | unsigned char size[3]; |
|
416 | 414 | unsigned int spwPacketSize = count + 4; |
|
417 | 415 | QTime SPWTimeout; |
|
418 | 416 | |
|
419 | 417 | if (count>248) |
|
420 | 418 | { |
|
421 | 419 | appendToLog("WARNING === in function WRITE of rmapplugin *** CCSDS packet size > 248 bytes\n"); |
|
422 | 420 | return 1; |
|
423 | 421 | } |
|
424 | 422 | |
|
425 | 423 | appendToLog(QString("*** START *** Send CCSDS packet of ")+ QString::number(count) + QString(" byte(s)")); |
|
426 | 424 | |
|
427 | 425 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 1) |
|
428 | 426 | { |
|
429 | 427 | this->Close(); |
|
430 | 428 | appendToLog("WARNING === in function WRITE of rmapplugin *** SPW link not running\n"); |
|
431 | 429 | return 1; |
|
432 | 430 | } |
|
433 | 431 | |
|
434 | 432 | // SEND GRESB HEADER |
|
435 | 433 | size[0] = (unsigned char) ((unsigned int) spwPacketSize>>16); |
|
436 | 434 | size[1] = (unsigned char) ((unsigned int) spwPacketSize>>8); |
|
437 | 435 | size[2] = (unsigned char) ((unsigned int) spwPacketSize); |
|
438 | 436 | RMAPSend_SOCKET->write(&gresbProtocole, 1); |
|
439 | 437 | RMAPSend_SOCKET->write((char*) size, 3); |
|
440 | 438 | // SEND SPW HEADER |
|
441 | 439 | RMAPSend_SOCKET->write(&targetLogicalAddress, 1); |
|
442 | 440 | RMAPSend_SOCKET->write(&protocoleIdentifier, 1); |
|
443 | 441 | RMAPSend_SOCKET->write(&reserved, 1); |
|
444 | 442 | RMAPSend_SOCKET->write(&userApplication, 1); |
|
445 | 443 | // SEND CCSDS PACKET |
|
446 | 444 | RMAPSend_SOCKET->write(Value, count); |
|
447 | 445 | SPWTimeout.start(); |
|
448 | 446 | while(RMAPSend_SOCKET->bytesToWrite() > 0) |
|
449 | 447 | { |
|
450 | 448 | RMAPSend_SOCKET->waitForBytesWritten(100); |
|
451 | 449 | if(SPWTimeout.elapsed()>1000) |
|
452 | 450 | { |
|
453 | 451 | appendToLog("WARNING === in function WRITE of rmapplugin *** sending CCSDS packet timeout\n"); |
|
454 | 452 | return 1; |
|
455 | 453 | } |
|
456 | 454 | } |
|
457 | 455 | |
|
458 | 456 | appendToLog(QString("*** CCSDS packet sent")); |
|
459 | 457 | |
|
460 | 458 | return count; |
|
461 | 459 | } |
|
462 | 460 | |
|
463 | 461 | int gresb::receiveSPWPacket(unsigned char requestID) // SLOT |
|
464 | 462 | { |
|
465 | 463 | QTime spwPacketReceiverTimeout; |
|
466 | 464 | // GRESB HEADER |
|
467 | 465 | char RES_TR_EP; // 6 bits REserved + 1 bit TRuncated + 1 bit EP error end of packet |
|
468 | 466 | unsigned char packetLength2; |
|
469 | 467 | unsigned char packetLength1; |
|
470 | 468 | unsigned char packetLength0; |
|
471 | 469 | unsigned int packetLength; |
|
472 | 470 | |
|
473 | 471 | if (requestID==1) |
|
474 | 472 | { |
|
475 | 473 | if (rmapPacketSEMAPHORE->available()) return rmapPacketSize; |
|
476 | 474 | } |
|
477 | 475 | |
|
478 | 476 | RMAPReceive_SOCKET->blockSignals(1); // block the signals of the socket during packet reception |
|
479 | 477 | // READ THE GRESB HEADER OF THE INCOMING PACKET |
|
480 | 478 | spwPacketReceiverTimeout.start(); |
|
481 | 479 | while(RMAPReceive_SOCKET->bytesAvailable() < 4) |
|
482 | 480 | { |
|
483 | 481 | RMAPReceive_SOCKET->waitForReadyRead(100); |
|
484 | 482 | if(spwPacketReceiverTimeout.elapsed()>1000) return -1; // ERROR === read GRSEB header TIMEOUT |
|
485 | 483 | } |
|
486 | 484 | RMAPReceive_SOCKET->read(&RES_TR_EP, 1); |
|
487 | 485 | RMAPReceive_SOCKET->read( (char*) &packetLength2, 1); |
|
488 | 486 | RMAPReceive_SOCKET->read( (char*) &packetLength1, 1); |
|
489 | 487 | RMAPReceive_SOCKET->read( (char*) &packetLength0, 1); |
|
490 | 488 | packetLength = (packetLength2<<16) + (packetLength1<<8) + (packetLength0); |
|
491 | spwPacket = (char*) malloc(packetLength); | |
|
492 | 489 | |
|
493 | 490 | // READ THE SPW PACKET |
|
494 | 491 | while(RMAPReceive_SOCKET->bytesAvailable() < packetLength) |
|
495 | 492 | { |
|
496 | 493 | RMAPReceive_SOCKET->waitForReadyRead(100); |
|
497 | 494 | if(spwPacketReceiverTimeout.elapsed()>1000) return -2; // ERROR === read SPW packet TIMEOUT |
|
498 | 495 | } |
|
499 | 496 | RMAPReceive_SOCKET->read( spwPacket, packetLength ); |
|
500 | 497 | RMAPReceive_SOCKET->blockSignals(0); |
|
498 | //emit sendMessage("Packet of size " + QString::number(packetLength) + " received"); | |
|
501 | 499 | |
|
502 | 500 | switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet |
|
503 | 501 | { |
|
504 | 502 | case 1: // 0x01 is the protocole identifier for RMAP packets |
|
505 | 503 | if (rmapPacketSEMAPHORE->available()!=0) return -3; // ERROR === previous RMAP packet not processed yet |
|
506 | 504 | for(unsigned int i=0; i<packetLength; i++) rmapPacket[i] = spwPacket[i]; |
|
507 | 505 | rmapPacketSize = packetLength; |
|
508 | 506 | rmapPacketSEMAPHORE->release(); |
|
509 |
|
|
|
507 | emit sendMessage("RMAP packet of size " + QString::number(packetLength) + " received"); | |
|
510 | 508 | return packetLength; |
|
511 | 509 | |
|
512 | 510 | case 2: // 0x02 is the protocole identifier for CCSDS packets |
|
513 | 511 | if (ccsdsPacketSEMAPHORE->available()!=0) return -4; // ERROR === previous CCSDS packet not processed yet |
|
514 | 512 | for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i]; |
|
515 | 513 | ccsdsPacketSize = packetLength; |
|
516 | 514 | ccsdsPacketSEMAPHORE->release(); |
|
517 | 515 | emit(ccsdsPacketAvailable(ccsdsPacket, packetLength)); |
|
516 | //emit sendMessage("CCSDS packet of size " + QString::number(packetLength) + " received"); | |
|
518 | 517 | return packetLength; |
|
519 | 518 | } |
|
520 | 519 | return 0; |
|
521 | 520 | } |
|
522 | 521 | |
|
523 | 522 | void gresb::Open() // SLOT |
|
524 | 523 | { |
|
525 | 524 | bool spwRunning = true; |
|
526 | 525 | RMAPSend_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()), |
|
527 | 526 | 3000 + gresbVirtualLinkSpinBox->value()*2, |
|
528 | 527 | QIODevice::WriteOnly); |
|
529 | 528 | RMAPReceive_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()), |
|
530 | 529 | 3000 + gresbVirtualLinkSpinBox->value()*2+1, |
|
531 | 530 | QIODevice::ReadOnly); |
|
532 | 531 | GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()), |
|
533 | 532 | 3010, |
|
534 | 533 | QIODevice::ReadWrite); |
|
535 | 534 | GRESBStatusQuery_SOCKET->waitForConnected(10000); |
|
536 | 535 | RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket |
|
537 | 536 | // initialize SPW packet semaphores |
|
538 | 537 | while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire(); |
|
539 | 538 | while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire(); |
|
540 | 539 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) != 0) |
|
541 | 540 | { |
|
542 | 541 | spwRunning = gresbStatusQueryDialog->exec(); |
|
543 | 542 | } |
|
544 | 543 | if (spwRunning == false) this->Close(); |
|
545 | 544 | else |
|
546 | 545 | { |
|
547 | 546 | emit appendToLog(QString("SpaceWire running on virtual link ")+ QString::number(spwLinkSpinBox->value())); |
|
548 | 547 | emit isOpen(true); |
|
549 | 548 | } |
|
550 | 549 | } |
|
551 | 550 | |
|
552 | 551 | void gresb::Close() // SLOT |
|
553 | 552 | { |
|
554 | 553 | RMAPSend_SOCKET->disconnectFromHost(); |
|
555 | 554 | RMAPReceive_SOCKET->disconnectFromHost(); |
|
556 | 555 | GRESBStatusQuery_SOCKET->disconnectFromHost(); |
|
557 | 556 | emit isOpen(false); |
|
558 | 557 | } |
|
559 | 558 | |
|
560 | 559 | int gresb::GRESBStatusQuery() // SLOT |
|
561 | 560 | { |
|
562 | 561 | GRESBStatusQueryRequest(LinkStatus, 0); |
|
563 | 562 | GRESBStatusQueryRequest(LinkStatus, 1); |
|
564 | 563 | GRESBStatusQueryRequest(LinkStatus, 2); |
|
565 | 564 | GRESBStatusQueryRequest(LinkStatistics, 0); |
|
566 | 565 | GRESBStatusQueryRequest(LinkStatistics, 1); |
|
567 | 566 | GRESBStatusQueryRequest(LinkStatistics, 2); |
|
568 | 567 | return 0; |
|
569 | 568 | } |
|
570 | 569 | |
|
571 | 570 | int gresb::GRESBStatusQueryRequest(GresbStatusQueryOption option, char link) |
|
572 | 571 | { |
|
573 | 572 | gresb_status_query_t statusQueryCommand; |
|
574 | 573 | gresb_link_status_reply_t linkStatusReply; |
|
575 | 574 | gresb_link_statistics_reply_t linkStatisticsReply; |
|
576 | 575 | QTime statusQueryTimeout; |
|
577 | 576 | QString console_message; |
|
578 | 577 | |
|
579 | 578 | statusQueryCommand.protocolIdentifier = (char) 0x02; |
|
580 | 579 | statusQueryCommand.reserved1 = (char) 0x00; |
|
581 | 580 | statusQueryCommand.reserved0 = (char) 0x00; |
|
582 | 581 | statusQueryCommand.option = (char) option; |
|
583 | 582 | statusQueryCommand.value3 = (char) 0x00; |
|
584 | 583 | statusQueryCommand.value2 = (char) 0x00; |
|
585 | 584 | statusQueryCommand.value1 = (char) 0x00; |
|
586 | 585 | statusQueryCommand.value0 = (char) link; |
|
587 | 586 | |
|
588 | 587 | GRESBStatusQuery_SOCKET->write((char*) ((void*) &statusQueryCommand), sizeof(statusQueryCommand)); |
|
589 | 588 | GRESBStatusQuery_SOCKET->flush(); |
|
590 | 589 | GRESBStatusQuery_SOCKET->waitForBytesWritten(1000); |
|
591 | 590 | |
|
592 | 591 | statusQueryTimeout.start(); |
|
593 | 592 | while(GRESBStatusQuery_SOCKET->bytesToWrite() > 0) |
|
594 | 593 | { |
|
595 | 594 | GRESBStatusQuery_SOCKET->waitForBytesWritten(100); |
|
596 | 595 | if(statusQueryTimeout.elapsed()>1000) |
|
597 | 596 | { |
|
598 | 597 | emit appendToLog("WARNING === in function GRESBStatusQueryRequest of rmapplugin *** sending StatusQueryCommand timeout"); |
|
599 | 598 | return 1; |
|
600 | 599 | } |
|
601 | 600 | } |
|
602 | 601 | |
|
603 | 602 | switch (option) |
|
604 | 603 | { |
|
605 | 604 | case LinkStatus: |
|
606 | 605 | { |
|
607 | 606 | statusQueryTimeout.start(); |
|
608 | 607 | while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatusReply)) |
|
609 | 608 | { |
|
610 | 609 | GRESBStatusQuery_SOCKET->waitForReadyRead(100); |
|
611 | 610 | if(statusQueryTimeout.elapsed()>1000) |
|
612 | 611 | { |
|
613 | 612 | console_message.sprintf("GRESBStatusQueryRequest / LinkStatus => error timeout bytesAvailable()\n"); |
|
614 | 613 | emit appendToLog(console_message); |
|
615 | 614 | return 1; |
|
616 | 615 | } |
|
617 | 616 | } |
|
618 | 617 | GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatusReply), (int) sizeof(linkStatusReply)); |
|
619 | 618 | console_message.sprintf("%x", linkStatusReply.byte0); |
|
620 | 619 | spwLinkStatusEnquiry->statusQueryTable->item(0, link)->setText(console_message); |
|
621 | 620 | console_message.sprintf("%d", linkStatusReply.byte1); |
|
622 | 621 | spwLinkStatusEnquiry->statusQueryTable->item(1, link)->setText(console_message); |
|
623 | 622 | if (linkStatusReply.byte0 == 0) return 1; |
|
624 | 623 | break; |
|
625 | 624 | } |
|
626 | 625 | case LinkStatistics: |
|
627 | 626 | { |
|
628 | 627 | statusQueryTimeout.start(); |
|
629 | 628 | while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatisticsReply)) |
|
630 | 629 | { |
|
631 | 630 | GRESBStatusQuery_SOCKET->waitForReadyRead(100); |
|
632 | 631 | if(statusQueryTimeout.elapsed()>1000) |
|
633 | 632 | { |
|
634 | 633 | console_message.sprintf("GRESBStatusQueryRequest / LinkStatistics => error timeout bytesAvailable()\n"); |
|
635 | 634 | emit appendToLog(console_message); |
|
636 | 635 | return 1; |
|
637 | 636 | } |
|
638 | 637 | } |
|
639 | 638 | GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatisticsReply), sizeof(linkStatisticsReply)); |
|
640 | 639 | /*console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataTransmitted)); |
|
641 | 640 | UI->spwLinkStatusEnquiry->statusQueryTable->item(9, link)->setText(console_message); |
|
642 | 641 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsTransmitted)); |
|
643 | 642 | UI->spwLinkStatusEnquiry->statusQueryTable->item(8, link)->setText(console_message); |
|
644 | 643 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfTruncatedPacketsReceived)); |
|
645 | 644 | UI->spwLinkStatusEnquiry->statusQueryTable->item(6, link)->setText(console_message); |
|
646 | 645 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsWithEEPReceived)); |
|
647 | 646 | UI->spwLinkStatusEnquiry->statusQueryTable->item(5, link)->setText(console_message); |
|
648 | 647 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataReceived)); |
|
649 | 648 | UI->spwLinkStatusEnquiry->statusQueryTable->item(4, link)->setText(console_message); |
|
650 | 649 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsReceived)); |
|
651 | 650 | UI->spwLinkStatusEnquiry->statusQueryTable->item(3, link)->setText(console_message);*/ |
|
652 | 651 | break; |
|
653 | 652 | } |
|
654 | 653 | case NodeAddressStatistics: |
|
655 | 654 | { |
|
656 | 655 | break; |
|
657 | 656 | } |
|
658 | 657 | case GetRoute: |
|
659 | 658 | { |
|
660 | 659 | break; |
|
661 | 660 | } |
|
662 | 661 | } |
|
663 | 662 | return 0; |
|
664 | 663 | } |
|
665 | 664 | |
|
666 | void gresb::processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size) // SLOT | |
|
667 | { | |
|
668 | QString message; | |
|
669 | unsigned int fine_time_value = 0; | |
|
670 | fine_time_value = ((unsigned int) ccsdsPacket[7]<<24) | |
|
671 | + ((unsigned int) ccsdsPacket[6]<<16) | |
|
672 | + ((unsigned int) ccsdsPacket[5]<<8) | |
|
673 | + ((unsigned int) ccsdsPacket[4]); | |
|
674 | message.append(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": "); | |
|
675 | message.append("size " | |
|
676 | + QString::number(size) | |
|
677 | +" *** header " | |
|
678 | + QString::number(ccsdsPacket[0], 16) | |
|
679 | + " " | |
|
680 | + QString::number(ccsdsPacket[1], 16) | |
|
681 | + " " | |
|
682 | + QString::number(ccsdsPacket[2], 16) | |
|
683 | + " " | |
|
684 | + QString::number(ccsdsPacket[3], 16) | |
|
685 | + " *** coarse time " | |
|
686 | + QString::number(fine_time_value)); | |
|
687 | //+ QString::number(ccsdsPacket[4], 16) | |
|
688 | //+" " | |
|
689 | //+ QString::number(ccsdsPacket[5], 16) | |
|
690 | //+" " | |
|
691 | //+ QString::number(ccsdsPacket[6], 16) | |
|
692 | //+" " | |
|
693 | //+ QString::number(ccsdsPacket[7], 16)); | |
|
694 | ccsdsPacketSEMAPHORE->acquire(); | |
|
695 | emit sendMessage(message); | |
|
696 | } | |
|
697 | ||
|
698 | 665 | void gresb::reTestSPWLink() // SLOT |
|
699 | 666 | { |
|
700 | 667 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 0) |
|
701 | 668 | { |
|
702 | 669 | gresbStatusQueryDialog->accept(); |
|
703 | 670 | } |
|
704 | 671 | } |
|
705 | 672 | |
|
706 | 673 | void gresb::RMAPSendConnectionState(QAbstractSocket::SocketState socketState) // SLOT |
|
707 | 674 | { |
|
708 | 675 | rmapSendStateLabel->setText(""); |
|
709 | 676 | QString socketMessage = "RMAP Send Socket State: "; |
|
710 | 677 | switch(socketState) |
|
711 | 678 | { |
|
712 | 679 | case QAbstractSocket::UnconnectedState : |
|
713 | 680 | socketMessage.append("0 => Unconnected"); |
|
714 | 681 | break; |
|
715 | 682 | case 1: |
|
716 | 683 | socketMessage.append("1 => HostLookup"); |
|
717 | 684 | break; |
|
718 | 685 | case 2: |
|
719 | 686 | socketMessage.append("2 => Connecting"); |
|
720 | 687 | break; |
|
721 | 688 | case 3: |
|
722 | 689 | socketMessage.append("3 => Connected"); |
|
723 | 690 | break; |
|
724 | 691 | case 4: |
|
725 | 692 | socketMessage.append("4 => Bound"); |
|
726 | 693 | break; |
|
727 | 694 | case 5: |
|
728 | 695 | socketMessage.append("5 => Closing"); |
|
729 | 696 | break; |
|
730 | 697 | case 6: |
|
731 | 698 | socketMessage.append("6 => Listening"); |
|
732 | 699 | break; |
|
733 | 700 | } |
|
734 | 701 | rmapSendStateLabel->setText(socketMessage); |
|
735 | 702 | emit appendToLog(socketMessage); |
|
736 | 703 | } |
|
737 | 704 | |
|
738 | 705 | void gresb::RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState) // SLOT |
|
739 | 706 | { |
|
740 | 707 | rmapReceiveStateLabel->setText(""); |
|
741 | 708 | QString socketMessage = "RMAP Receive Socket State: "; |
|
742 | 709 | switch(socketState) |
|
743 | 710 | { |
|
744 | 711 | case QAbstractSocket::UnconnectedState : |
|
745 | 712 | socketMessage.append("0 => Unconnected"); |
|
746 | 713 | break; |
|
747 | 714 | case 1: |
|
748 | 715 | socketMessage.append("1 => HostLookup"); |
|
749 | 716 | break; |
|
750 | 717 | case 2: |
|
751 | 718 | socketMessage.append("2 => Connecting"); |
|
752 | 719 | break; |
|
753 | 720 | case 3: |
|
754 | 721 | socketMessage.append("3 => Connected"); |
|
755 | 722 | break; |
|
756 | 723 | case 4: |
|
757 | 724 | socketMessage.append("4 => Bound"); |
|
758 | 725 | break; |
|
759 | 726 | case 5: |
|
760 | 727 | socketMessage.append("5 => Closing"); |
|
761 | 728 | break; |
|
762 | 729 | case 6: |
|
763 | 730 | socketMessage.append("6 => Listening"); |
|
764 | 731 | break; |
|
765 | 732 | } |
|
766 | 733 | rmapReceiveStateLabel->setText(socketMessage); |
|
767 | 734 | emit appendToLog(socketMessage); |
|
768 | 735 | } |
|
769 | 736 | |
|
770 | 737 | void gresb::GRESBConnectionState(QAbstractSocket::SocketState socketState) // SLOT |
|
771 | 738 | { |
|
772 | 739 | gresbStatusQueryLabel->setText(""); |
|
773 | 740 | QString socketMessage = "GRESB status query socket (port 3010): "; |
|
774 | 741 | switch(socketState) |
|
775 | 742 | { |
|
776 | 743 | case QAbstractSocket::UnconnectedState : |
|
777 | 744 | socketMessage.append("0 => Unconnected"); |
|
778 | 745 | break; |
|
779 | 746 | case 1: |
|
780 | 747 | socketMessage.append("1 => HostLookup"); |
|
781 | 748 | break; |
|
782 | 749 | case 2: |
|
783 | 750 | socketMessage.append("2 => Connecting"); |
|
784 | 751 | break; |
|
785 | 752 | case 3: |
|
786 | 753 | socketMessage.append("3 => Connected"); |
|
787 | 754 | break; |
|
788 | 755 | case 4: |
|
789 | 756 | socketMessage.append("4 => Bound"); |
|
790 | 757 | break; |
|
791 | 758 | case 5: |
|
792 | 759 | socketMessage.append("5 => Closing"); |
|
793 | 760 | break; |
|
794 | 761 | case 6: |
|
795 | 762 | socketMessage.append("6 => Listening"); |
|
796 | 763 | break; |
|
797 | 764 | } |
|
798 | 765 | gresbStatusQueryLabel->setText(socketMessage); |
|
799 | 766 | } |
@@ -1,101 +1,101 | |||
|
1 | 1 | #ifndef GRESB_H |
|
2 | 2 | #define GRESB_H |
|
3 | 3 | |
|
4 | 4 | #include <QWidget> |
|
5 | 5 | #include <QLabel> |
|
6 | 6 | #include <QPushButton> |
|
7 | 7 | #include <QSpinBox> |
|
8 | 8 | #include <QGridLayout> |
|
9 | 9 | #include <QTcpSocket> |
|
10 | 10 | #include <QDialog> |
|
11 | 11 | #include <QSemaphore> |
|
12 | 12 | |
|
13 | 13 | #include "gresbstatusenquiry.h" |
|
14 | #include "spwpacketreceiver.h" | |
|
15 | 14 | #include "rmapoperations.h" |
|
16 | 15 | #include "qipdialogbox.h" |
|
17 | 16 | |
|
18 | 17 | class gresb : public QWidget |
|
19 | 18 | { |
|
20 | 19 | Q_OBJECT |
|
21 | 20 | public: |
|
22 | 21 | explicit gresb(QWidget *parent = 0); |
|
23 | 22 | ~gresb(); |
|
24 | 23 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
25 | 24 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
26 | 25 | unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); |
|
27 | 26 | |
|
28 | 27 | signals: |
|
29 | 28 | void sendMessage(QString message); |
|
30 | 29 | void isOpen(bool); |
|
31 | 30 | void RMAP_write_reply_setText(QString); |
|
32 | 31 | void appendToLog(QString); |
|
33 | 32 | void ccsdsPacketAvailable(unsigned char*, unsigned int); |
|
34 | 33 | |
|
35 | 34 | public slots: |
|
36 | 35 | void Open(); |
|
37 | 36 | void Close(); |
|
38 | 37 | int receiveSPWPacket(unsigned char requestID=0); |
|
39 | void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size); | |
|
38 | void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} | |
|
39 | void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} | |
|
40 | void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();} | |
|
40 | 41 | void reTestSPWLink(); |
|
42 | // | |
|
41 | 43 | void RMAPSendConnectionState(QAbstractSocket::SocketState socketState); |
|
42 | 44 | void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState); |
|
43 | 45 | void GRESBConnectionState(QAbstractSocket::SocketState socketState); |
|
44 | void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} | |
|
45 | void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} | |
|
46 | 46 | |
|
47 | 47 | private slots: |
|
48 | 48 | int GRESBStatusQuery(); |
|
49 | 49 | |
|
50 | 50 | private: |
|
51 | 51 | unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0); |
|
52 | 52 | unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0); |
|
53 |
void acquireRMAPSemaphore() {rmapPacketSEMAPHORE-> |
|
|
54 |
void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE-> |
|
|
53 | void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->tryAcquire();} | |
|
54 | void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->tryAcquire();} | |
|
55 | 55 | int GRESBStatusQueryRequest(GresbStatusQueryOption option, char link); |
|
56 | 56 | |
|
57 | 57 | unsigned char rmapTargetLogicalAddress ; |
|
58 | 58 | unsigned char rmapSourceLogicalAddress ; |
|
59 | 59 | |
|
60 | 60 | RMAP_command_codes commandCode; |
|
61 | 61 | |
|
62 | 62 | QPushButton *gresbStatusQueryRetryButton; |
|
63 | 63 | QPushButton *gresbStatusQueryAbortButton; |
|
64 | 64 | |
|
65 | 65 | QLabel *gresbBridgeIPLabel; |
|
66 | 66 | QLabel *gresbVirtualLinkLabel; |
|
67 | 67 | QLabel *spwLinkLabel; |
|
68 | 68 | QLabel *rmapSourceLogicalAddressLabel; |
|
69 | 69 | QLabel *rmapSendStateLabel; |
|
70 | 70 | QLabel *rmapReceiveStateLabel; |
|
71 | 71 | QLabel *gresbStatusQueryLabel; |
|
72 | 72 | QLabel *gresbStatusQueryDialogLabel; |
|
73 | 73 | |
|
74 | 74 | QDialog *gresbStatusQueryDialog; |
|
75 | 75 | |
|
76 | 76 | QIPDialogBox* gresbBridgeIPDialogBox; |
|
77 | 77 | |
|
78 | 78 | QSpinBox *gresbVirtualLinkSpinBox; |
|
79 | 79 | QSpinBox *spwLinkSpinBox; |
|
80 | 80 | QSpinBox *rmapSourceLogicalAddressSpinBox; |
|
81 | 81 | |
|
82 | 82 | QGridLayout *connectionLayout; |
|
83 | 83 | QGridLayout *gresbStatusQueryDialogLayout; |
|
84 | 84 | |
|
85 | 85 | QTcpSocket *RMAPSend_SOCKET; |
|
86 | 86 | QTcpSocket *RMAPReceive_SOCKET; |
|
87 | 87 | QTcpSocket *GRESBStatusQuery_SOCKET; |
|
88 | 88 | |
|
89 | 89 | gresbStatusEnquiry* spwLinkStatusEnquiry; |
|
90 | 90 | |
|
91 | 91 | // Packet receiver |
|
92 | 92 | QSemaphore *rmapPacketSEMAPHORE; |
|
93 | 93 | QSemaphore *ccsdsPacketSEMAPHORE; |
|
94 | 94 | char* rmapPacket; // The buffer to receive RMAP READ packets |
|
95 | 95 | unsigned char *ccsdsPacket; |
|
96 | 96 | char *spwPacket; |
|
97 | 97 | unsigned int rmapPacketSize; |
|
98 | 98 | unsigned int ccsdsPacketSize; |
|
99 | 99 | }; |
|
100 | 100 | |
|
101 | 101 | #endif // GRESB_H |
@@ -1,286 +1,316 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the LPPMON Software |
|
3 | 3 | -- Copyright (C) 2012, Laboratory of Plasma Physics - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Paul LEROY |
|
20 | 20 | -- Mail : paul.leroy@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "rmapplugin.h" |
|
23 | 23 | #include <QHostAddress> |
|
24 | 24 | #include <QIODevice> |
|
25 | 25 | #include <QApplication> |
|
26 | 26 | #include <rmappluginpythonwrapper.h> |
|
27 | 27 | |
|
28 | 28 | rmapplugin::rmapplugin(QWidget *parent) |
|
29 | 29 | :lppmonplugin(parent,false) |
|
30 | 30 | { |
|
31 | 31 | this->UI = new rmapPluginUI(); |
|
32 | 32 | this->setWindowTitle(tr("RMAP and SPW Communication")); |
|
33 | 33 | this->setWidget((QWidget*)this->UI); |
|
34 | 34 | |
|
35 | 35 | timeCode = 0; |
|
36 | 36 | time_COARSE = 0; |
|
37 | 37 | time_FINE = 0; |
|
38 | 38 | currentBridge = selectedBridgeIsUnknown; |
|
39 | 39 | |
|
40 | 40 | /*Python wrapper*/ |
|
41 | 41 | this->pyObject = new rmappluginPythonWrapper(); |
|
42 | 42 | connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint))); |
|
43 | 43 | connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint))); |
|
44 | 44 | /*==============*/ |
|
45 | 45 | |
|
46 | 46 | connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(openBridge())); |
|
47 | 47 | connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(closeBridge())); |
|
48 | 48 | |
|
49 | 49 | // CCSDS |
|
50 | 50 | connect(this->UI->sendCCSDSCommandButton, SIGNAL(clicked()), this, SLOT(sendCCSDS())); |
|
51 | 51 | connect(this->UI->send_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(send_TC_LFR_UPDATE_TIME())); |
|
52 | 52 | connect(this->UI->reset_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(reset_TC_LFR_UPDATE_TIME())); |
|
53 | 53 | |
|
54 | 54 | // spectralMAtricesDMASimulator |
|
55 | 55 | connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginRead(uint*,uint,uint)), this, SLOT(Read(uint*,uint,uint))); |
|
56 | 56 | connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginWrite(uint*,uint,uint)), this, SLOT(Write(uint*,uint,uint))); |
|
57 | 57 | connect(this->UI->spectralMatricesDMASimulator, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); |
|
58 | 58 | |
|
59 | 59 | // GRESB |
|
60 | 60 | connect(this->UI->gresbBridge, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); |
|
61 | 61 | connect(this->UI->gresbBridge, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool))); |
|
62 | 62 | connect(this->UI->gresbBridge, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString))); |
|
63 | 63 | connect(this->UI->gresbBridge, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString))); |
|
64 | connect(this->UI->gresbBridge, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)), | |
|
65 | this, SLOT(processCCSDSPacket(unsigned char*,uint))); | |
|
66 | connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->gresbBridge, SLOT(ccsdsPacketIsProcessed())); | |
|
64 | 67 | |
|
65 | 68 | // Star Dundee |
|
66 | 69 | connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); |
|
67 | 70 | connect(this->UI->starDundee, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool))); |
|
68 | 71 | connect(this->UI->starDundee, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString))); |
|
69 | 72 | connect(this->UI->starDundee, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString))); |
|
73 | connect(this->UI->starDundee, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)), | |
|
74 | this, SLOT(processCCSDSPacket(unsigned char*,uint))); | |
|
75 | connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->starDundee, SLOT(ccsdsPacketIsProcessed())); | |
|
70 | 76 | |
|
71 | 77 | connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(bridgeHasChanged(selectedBridge))); |
|
72 | 78 | } |
|
73 | 79 | |
|
74 | 80 | rmapplugin::~rmapplugin() |
|
75 | 81 | { |
|
76 | 82 | if (!RMAPSend_SOCKET->isOpen()) RMAPSend_SOCKET->disconnectFromHost(); |
|
77 | 83 | if (!RMAPReceive_SOCKET->isOpen()) RMAPReceive_SOCKET->disconnectFromHost(); |
|
78 | 84 | if (!GRESBStatusQuery_SOCKET->isOpen()) GRESBStatusQuery_SOCKET->disconnectFromHost(); |
|
79 | 85 | } |
|
80 | 86 | |
|
81 | 87 | unsigned int rmapplugin::Write(unsigned int *Value, unsigned int count, unsigned int address) |
|
82 | 88 | { |
|
83 | 89 | unsigned int result; |
|
84 | 90 | switch(currentBridge) |
|
85 | 91 | { |
|
86 | 92 | case selectedBridgeIsGRESB : |
|
87 | 93 | result = UI->gresbBridge->Write(Value, count, address); |
|
88 | 94 | break; |
|
89 | 95 | case selectedBridgeIsStarDundee : |
|
90 | 96 | result = UI->starDundee->Write(Value, count, address); |
|
91 | 97 | break; |
|
92 | 98 | default: |
|
93 | 99 | result = 1; |
|
94 | 100 | break; |
|
95 | 101 | } |
|
96 | 102 | return result; |
|
97 | 103 | } |
|
98 | 104 | |
|
99 | 105 | unsigned int rmapplugin::Read(unsigned int *Value, unsigned int count, unsigned int address) |
|
100 | 106 | { |
|
101 | 107 | unsigned int result; |
|
102 | 108 | switch(currentBridge) |
|
103 | 109 | { |
|
104 | 110 | case selectedBridgeIsGRESB : |
|
105 | 111 | result = UI->gresbBridge->Read(Value, count, address); |
|
106 | 112 | break; |
|
107 | 113 | case selectedBridgeIsStarDundee : |
|
108 | 114 | result = UI->starDundee->Read(Value, count, address); |
|
109 | 115 | break; |
|
110 | 116 | default: |
|
111 | 117 | result = 1; |
|
112 | 118 | break; |
|
113 | 119 | } |
|
114 | 120 | return result; |
|
115 | 121 | } |
|
116 | 122 | |
|
117 | 123 | //////// |
|
118 | 124 | // SLOTS |
|
119 | 125 | |
|
120 | 126 | unsigned int rmapplugin::WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) // SLOT |
|
121 | 127 | { |
|
122 | 128 | unsigned int result; |
|
123 | 129 | switch(currentBridge) |
|
124 | 130 | { |
|
125 | 131 | case selectedBridgeIsGRESB : |
|
126 | 132 | result = UI->gresbBridge->WriteSPW(Value, count, targetLogicalAddress, userApplication); |
|
127 | 133 | break; |
|
128 | 134 | case selectedBridgeIsStarDundee : |
|
129 | 135 | result = UI->starDundee->WriteSPW(Value, count, targetLogicalAddress, userApplication); |
|
130 | 136 | break; |
|
131 | 137 | default: |
|
132 | 138 | result = 1; |
|
133 | 139 | break; |
|
134 | 140 | } |
|
135 | 141 | return result; |
|
136 | 142 | } |
|
137 | 143 | |
|
138 | 144 | void rmapplugin::sendCCSDS() // SLOT |
|
139 | 145 | { |
|
140 | 146 | unsigned int nbBYTES_application_data = 8; |
|
141 | 147 | unsigned int count; |
|
142 | 148 | char *tab; |
|
143 | 149 | unsigned char packetErrorControl1 = 0xaa; |
|
144 | 150 | unsigned char packetErrorControl0 = 0xbb; |
|
145 | 151 | |
|
146 | 152 | ccsds_command = new ccsds(1, 0, 0, nbBYTES_application_data+12, 0, 0, 0, 0, 0); // +12 => packet header 6 bytes + data field header 4 bytes + packet error control 2 bytes |
|
147 | 153 | /* unsigned char data_field_header, |
|
148 | 154 | unsigned char processID, |
|
149 | 155 | unsigned int sequence_count, |
|
150 | 156 | unsigned int packet_length, |
|
151 | 157 | unsigned char acceptance, |
|
152 | 158 | unsigned int completion, |
|
153 | 159 | unsigned char service_type, |
|
154 | 160 | unsigned char service_subtype, |
|
155 | 161 | unsigned char sourceID*/ |
|
156 | 162 | |
|
157 | 163 | count = nbBYTES_application_data+12; // 12 is the size in bytes of the header |
|
158 | 164 | tab = (char*) malloc(count); |
|
159 | 165 | tab[0] = ccsds_command->ccsds_header->packetId1; |
|
160 | 166 | tab[1] = ccsds_command->ccsds_header->packetId0; |
|
161 | 167 | tab[2] = ccsds_command->ccsds_header->packetSequenceControl1; |
|
162 | 168 | tab[3] = ccsds_command->ccsds_header->packetSequenceControl0; |
|
163 | 169 | tab[4] = ccsds_command->ccsds_header->packetLength1; |
|
164 | 170 | tab[5] = ccsds_command->ccsds_header->packetLength0; |
|
165 | 171 | tab[6] = ccsds_command->ccsds_header->dataFieldHeader3; |
|
166 | 172 | tab[7] = ccsds_command->ccsds_header->dataFieldHeader2; |
|
167 | 173 | tab[8] = ccsds_command->ccsds_header->dataFieldHeader1; |
|
168 | 174 | tab[9] = ccsds_command->ccsds_header->dataFieldHeader0; |
|
169 | 175 | tab[10]=0x00; |
|
170 | 176 | tab[11]=0x00; |
|
171 | 177 | tab[12]=0x00; |
|
172 | 178 | tab[13]=0x00; |
|
173 | 179 | tab[14]=0x00; |
|
174 | 180 | tab[15]=0x00; |
|
175 | 181 | tab[nbBYTES_application_data+10] = packetErrorControl1; |
|
176 | 182 | tab[nbBYTES_application_data+11] = packetErrorControl0; |
|
177 | 183 | |
|
178 | 184 | WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00); |
|
179 | 185 | |
|
180 | 186 | free(tab); |
|
181 | 187 | } |
|
182 | 188 | |
|
183 | 189 | void rmapplugin::openBridge() |
|
184 | 190 | { |
|
185 | 191 | switch(currentBridge) |
|
186 | 192 | { |
|
187 | 193 | case selectedBridgeIsGRESB : |
|
188 | 194 | this->UI->gresbBridge->Open(); |
|
189 | 195 | break; |
|
190 | 196 | case selectedBridgeIsStarDundee : |
|
191 | 197 | this->UI->starDundee->Open(); |
|
192 | 198 | break; |
|
193 | 199 | default: |
|
194 | 200 | break; |
|
195 | 201 | } |
|
196 | 202 | } |
|
197 | 203 | |
|
198 | 204 | void rmapplugin::closeBridge() |
|
199 | 205 | { |
|
200 | 206 | switch(currentBridge) |
|
201 | 207 | { |
|
202 | 208 | case selectedBridgeIsGRESB : |
|
203 | 209 | this->UI->gresbBridge->Close(); |
|
204 | 210 | break; |
|
205 | 211 | case selectedBridgeIsStarDundee : |
|
206 | 212 | this->UI->starDundee->Close(); |
|
207 | 213 | break; |
|
208 | 214 | default: |
|
209 | 215 | break; |
|
210 | 216 | } |
|
211 | 217 | } |
|
212 | 218 | |
|
213 | 219 | void rmapplugin::send_TC_LFR_UPDATE_TIME() |
|
214 | 220 | { |
|
215 | 221 | unsigned int nbBYTES_application_data = 6; // Time at CUC format is on 48 bits / 6 bytes |
|
216 | 222 | unsigned int count; |
|
217 | 223 | char *tab; |
|
218 | 224 | unsigned char packetErrorControl1 = 0xaa; |
|
219 | 225 | unsigned char packetErrorControl0 = 0xbb; |
|
220 | 226 | |
|
221 | 227 | ccsds_command = new ccsds(1, 11, 0, nbBYTES_application_data, 1, 1, 9, 129, 0); |
|
222 | 228 | /* unsigned char data_field_header, |
|
223 | 229 | unsigned char processID, |
|
224 | 230 | unsigned int sequence_count, |
|
225 | 231 | unsigned int packet_length, |
|
226 | 232 | unsigned char acceptance, |
|
227 | 233 | unsigned int completion, |
|
228 | 234 | unsigned char service_type, |
|
229 | 235 | unsigned char service_subtype, |
|
230 | 236 | unsigned char sourceID*/ |
|
231 | 237 | |
|
232 | 238 | count = nbBYTES_application_data+12; // +12 => packet header 6 bytes + data field header 4 bytes + packet error control 2 bytes |
|
233 | 239 | tab = (char*) malloc(count); |
|
234 | 240 | tab[0] = ccsds_command->ccsds_header->packetId1; |
|
235 | 241 | tab[1] = ccsds_command->ccsds_header->packetId0; |
|
236 | 242 | tab[2] = ccsds_command->ccsds_header->packetSequenceControl1; |
|
237 | 243 | tab[3] = ccsds_command->ccsds_header->packetSequenceControl0; |
|
238 | 244 | tab[4] = ccsds_command->ccsds_header->packetLength1; |
|
239 | 245 | tab[5] = ccsds_command->ccsds_header->packetLength0; |
|
240 | 246 | tab[6] = ccsds_command->ccsds_header->dataFieldHeader3; |
|
241 | 247 | tab[7] = ccsds_command->ccsds_header->dataFieldHeader2; |
|
242 | 248 | tab[8] = ccsds_command->ccsds_header->dataFieldHeader1; |
|
243 | 249 | tab[9] = ccsds_command->ccsds_header->dataFieldHeader0; |
|
244 | 250 | tab[10] = (unsigned char) (time_COARSE>>24); |
|
245 | 251 | tab[11] = (unsigned char) (time_COARSE>>18); |
|
246 | 252 | tab[12] = (unsigned char) (time_COARSE>>8); |
|
247 | 253 | tab[13] = (unsigned char) (time_COARSE); |
|
248 | 254 | tab[14] = (unsigned char) (time_FINE>>8); |
|
249 | 255 | tab[15] = (unsigned char) (time_FINE); |
|
250 | 256 | tab[nbBYTES_application_data+10] = packetErrorControl1; |
|
251 | 257 | tab[nbBYTES_application_data+11] = packetErrorControl0; |
|
252 | 258 | |
|
253 | 259 | WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00); |
|
254 | 260 | |
|
255 | 261 | time_COARSE = time_COARSE+1; |
|
256 | 262 | |
|
257 | 263 | free(tab); |
|
258 | 264 | } |
|
259 | 265 | |
|
260 | 266 | void rmapplugin::reset_TC_LFR_UPDATE_TIME() |
|
261 | 267 | { |
|
262 | 268 | time_COARSE = 0; |
|
263 | 269 | time_FINE = 0; |
|
264 | 270 | } |
|
265 | 271 | |
|
266 | 272 | void rmapplugin::RMAP_write_reply_setText(QString text) |
|
267 | 273 | { |
|
268 | 274 | this->UI->RMAP_write_reply->setText(text); |
|
269 | 275 | } |
|
270 | 276 | |
|
271 | 277 | void rmapplugin::appendToLog(QString text) |
|
272 | 278 | { |
|
273 | 279 | APPENDTOLOG(text); |
|
274 | 280 | } |
|
275 | 281 | |
|
276 | 282 | ///////////////////// |
|
277 | 283 | // INTERNAL FUNCTIONS |
|
278 | 284 | |
|
279 | void rmapplugin::gresbSelection(bool flag) | |
|
285 | void rmapplugin::processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size) // SLOT | |
|
280 | 286 | { |
|
281 | if (flag == true) UI->selection_GROUPBOX->setEnabled(false); | |
|
282 | if (flag == false) UI->selection_GROUPBOX->setEnabled(true); | |
|
287 | QString message; | |
|
288 | unsigned int fine_time_value = 0; | |
|
289 | fine_time_value = ((unsigned int) ccsdsPacket[7]<<24) | |
|
290 | + ((unsigned int) ccsdsPacket[6]<<16) | |
|
291 | + ((unsigned int) ccsdsPacket[5]<<8) | |
|
292 | + ((unsigned int) ccsdsPacket[4]); | |
|
293 | message.append(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": "); | |
|
294 | message.append("size " | |
|
295 | + QString::number(size) | |
|
296 | +" *** header " | |
|
297 | + QString::number(ccsdsPacket[0], 16) | |
|
298 | + " " | |
|
299 | + QString::number(ccsdsPacket[1], 16) | |
|
300 | + " " | |
|
301 | + QString::number(ccsdsPacket[2], 16) | |
|
302 | + " " | |
|
303 | + QString::number(ccsdsPacket[3], 16) | |
|
304 | + " *** coarse time " | |
|
305 | + QString::number(fine_time_value)); | |
|
306 | //+ QString::number(ccsdsPacket[4], 16) | |
|
307 | //+" " | |
|
308 | //+ QString::number(ccsdsPacket[5], 16) | |
|
309 | //+" " | |
|
310 | //+ QString::number(ccsdsPacket[6], 16) | |
|
311 | //+" " | |
|
312 | //+ QString::number(ccsdsPacket[7], 16)); | |
|
313 | displayOnConsole(message); | |
|
314 | emit ccsdsPacketIsProcessed(); | |
|
283 | 315 | } |
|
284 | 316 | |
|
285 | ||
|
286 |
@@ -1,89 +1,88 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the LPPMON Software |
|
3 | 3 | -- Copyright (C) 2011, Laboratory of Plasmas Physic - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef DRIVER1_H |
|
23 | 23 | #define DRIVER1_H |
|
24 | 24 | #include <rmappluginui.h> |
|
25 | 25 | #include <rmapoperations.h> |
|
26 | 26 | #include <QMenuBar> |
|
27 | 27 | #include <QMenu> |
|
28 | 28 | #include <QAction> |
|
29 | 29 | #include <QMainWindow> |
|
30 | 30 | #include <QTcpSocket> |
|
31 | 31 | #include <QTime> |
|
32 | 32 | #include <ccsds.h> |
|
33 | 33 | #include <QSemaphore> |
|
34 | #include <spwpacketreceiver.h> | |
|
35 | 34 | |
|
36 | 35 | #include <lppmonplugin.h> |
|
37 | 36 | |
|
38 | 37 | #define APPENDTOLOG(message) this->UI->appendToLogFile(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": " + message) |
|
39 | 38 | |
|
40 | 39 | #define READ_WRITE_MAX_COUNTS 4096 // in words |
|
41 | 40 | #define RMAP_MAX_DATA_LENGTH 4*READ_WRITE_MAX_COUNTS // in bytes, shall be lower than the limit size of SPW packet of the GRESB bridge |
|
42 | 41 | #define RMAP_READ_REPLY_HEADER_LENGTH 12 // in bytes => ECSS |
|
43 | 42 | #define RMAP_READ_COMMAND_HEADER_LENGTH 16 // in bytes => ECSS |
|
44 | 43 | #define RMAP_DATA_CRC_LENGTH 1 // in bytes => ECSS |
|
45 | 44 | #define CCSDS_MAX_PACKET_LENGTH 4412 // in bytes, specified in the LFR Software Requirements Specification |
|
46 | 45 | |
|
47 | 46 | class rmapplugin : public lppmonplugin |
|
48 | 47 | { |
|
49 | 48 | Q_OBJECT |
|
50 | 49 | public: |
|
51 | 50 | explicit rmapplugin(QWidget *parent = 0); |
|
52 | 51 | ~rmapplugin(); |
|
53 | 52 | |
|
54 | 53 | public slots: |
|
55 | 54 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
56 | 55 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
57 | 56 | unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); |
|
58 | 57 | void openBridge(); |
|
59 | 58 | void closeBridge(); |
|
59 | void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size); | |
|
60 | 60 | // |
|
61 | 61 | void sendCCSDS(); |
|
62 | 62 | void send_TC_LFR_UPDATE_TIME(); |
|
63 | 63 | void reset_TC_LFR_UPDATE_TIME(); |
|
64 | 64 | void displayOnConsole(QString message) {this->UI->console->append(message);} |
|
65 | 65 | // |
|
66 | void gresbSelection(bool flag); | |
|
67 | 66 | void RMAP_write_reply_setText(QString text); |
|
68 | 67 | void appendToLog(QString text); |
|
69 | 68 | // |
|
70 | 69 | void activatePlugin(bool flag) {emit activateSig(flag);} |
|
71 | 70 | void bridgeHasChanged(selectedBridge bridge) {currentBridge = bridge;} |
|
72 | 71 | |
|
73 | 72 | signals: |
|
73 | void ccsdsPacketIsProcessed(); | |
|
74 | 74 | |
|
75 | 75 | private: |
|
76 | 76 | selectedBridge currentBridge; |
|
77 | 77 | rmapPluginUI* UI; |
|
78 | 78 | QTcpSocket* GRESBStatusQuery_SOCKET; |
|
79 | 79 | QTcpSocket* RMAPSend_SOCKET; |
|
80 | 80 | QTcpSocket* RMAPReceive_SOCKET; |
|
81 | 81 | ccsds* ccsds_command; |
|
82 | 82 | unsigned int rmapPacketSize; |
|
83 | 83 | unsigned int time_COARSE; |
|
84 | 84 | unsigned int time_FINE; |
|
85 | spwpacketreceiver* spwPacketReceiverOBJECT; | |
|
86 | 85 | char timeCode; |
|
87 | 86 | }; |
|
88 | 87 | |
|
89 | 88 | #endif // DRIVER1_H |
@@ -1,72 +1,70 | |||
|
1 | 1 | # |
|
2 | 2 | # Project created by QtCreator 2011-09-20T08:15:30 |
|
3 | 3 | # |
|
4 | 4 | #------------------------------------------------- |
|
5 | 5 | |
|
6 | 6 | #include(/etc/lppmon/lppmonplugin.prf) |
|
7 | 7 | CONFIG += lppmonplugin |
|
8 | 8 | TARGET = rmapplugin |
|
9 | 9 | |
|
10 | 10 | DEFINES += PLUGIN=rmapplugin |
|
11 | 11 | DEFINES += PLUGINHEADER="\"\\\"rmapplugin.h"\\\"\" |
|
12 | 12 | DEFINES += driver_Name="\"\\\"RMAPPlugin"\\\"\" |
|
13 | 13 | DEFINES += driver_Author="\"\\\"Paul Leroy paul.leroy@lpp.polytechnique.fr"\\\"\" |
|
14 | 14 | DEFINES += driver_Version="\"\\\"1.1.2"\\\"\" |
|
15 | 15 | DEFINES += driver_Description="\"\\\"AHB bus controler, works with Gaisler's AHB plugn' play bus."\\\"\" |
|
16 | 16 | DEFINES += driver_can_be_root=1 |
|
17 | 17 | DEFINES += driver_can_be_child=0 |
|
18 | 18 | DEFINES += driver_VID=0 |
|
19 | 19 | DEFINES += driver_PID=0 |
|
20 | 20 | |
|
21 | 21 | QT += network |
|
22 | 22 | |
|
23 | 23 | LIBS += ../spw_usb_driver_v2.61/lib/x86_64/libSpaceWireUSBAPI.so \ |
|
24 | 24 | ../spw_usb_driver_v2.61/lib/x86_64/libConfigLibraryUSB.so |
|
25 | 25 | |
|
26 | 26 | |
|
27 | 27 | INCLUDEPATH += \ |
|
28 | 28 | $${PWD} \ |
|
29 | 29 | ../common_PLE \ |
|
30 | 30 | ../spw_usb_driver_v2.61/inc |
|
31 | 31 | |
|
32 | 32 | |
|
33 | 33 | HEADERS += \ |
|
34 | 34 | rmappluginui.h \ |
|
35 | 35 | rmapplugin.h \ |
|
36 | 36 | rmapoperations.h \ |
|
37 | 37 | ccsds.h \ |
|
38 | spwpacketreceiver.h \ | |
|
39 | 38 | ../common_PLE/qipdialogbox.h \ |
|
40 | 39 | ../common_PLE/gresbstatusenquiry.h \ |
|
41 | 40 | spectralmatricesdmasimulator.h \ |
|
42 | 41 | rmappluginpythonwrapper.h \ |
|
43 | 42 | stardundee.h \ |
|
44 | 43 | ../spw_usb_driver_v2.61/inc/spw_usb_api.h \ |
|
45 | 44 | ../spw_usb_driver_v2.61/inc/spw_config_library.h \ |
|
46 | 45 | gresb.h \ |
|
47 | 46 | bridge.h |
|
48 | 47 | |
|
49 | 48 | |
|
50 | 49 | SOURCES += \ |
|
51 | 50 | rmapplugin.cpp \ |
|
52 | 51 | rmappluginui.cpp \ |
|
53 | 52 | rmapoperations.cpp \ |
|
54 | 53 | ccsds.cpp \ |
|
55 | spwpacketreceiver.cpp \ | |
|
56 | 54 | ../common_PLE/qipdialogbox.cpp \ |
|
57 | 55 | ../common_PLE/gresbstatusenquiry.cpp \ |
|
58 | 56 | spectralmatricesdmasimulator.cpp \ |
|
59 | 57 | rmappluginpythonwrapper.cpp \ |
|
60 | 58 | stardundee.cpp \ |
|
61 | 59 | gresb.cpp \ |
|
62 | 60 | bridge.cpp |
|
63 | 61 | |
|
64 | 62 | |
|
65 | 63 | |
|
66 | 64 | |
|
67 | 65 | |
|
68 | 66 | |
|
69 | 67 | |
|
70 | 68 | |
|
71 | 69 | |
|
72 | 70 |
@@ -1,293 +1,293 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the LPPMON Software |
|
3 | 3 | -- Copyright (C) 2011, Laboratory of Plasmas Physic - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "rmapplugin.h" |
|
23 | 23 | |
|
24 | 24 | rmapPluginUI::rmapPluginUI(QWidget *parent) : |
|
25 | 25 | QWidget(parent) |
|
26 | 26 | { |
|
27 | 27 | spectralMatricesDMASimulator = new SpectralMatricesDMASimulator; |
|
28 | 28 | spwTabWidget = new QTabWidget; |
|
29 | 29 | QWidget* spwTabWidgetPage0 = new QWidget; |
|
30 | 30 | QWidget* spwTabWidgetPage1 = new QWidget; |
|
31 | 31 | QWidget* spwTabWidgetPage2 = new QWidget; |
|
32 | 32 | QWidget* spwTabWidgetPage3 = new QWidget; |
|
33 | 33 | QWidget* spwTabWidgetPage4 = new QWidget; |
|
34 | 34 | bridgeWidget = new QWidget; |
|
35 | 35 | mainLayout = new QVBoxLayout; |
|
36 | 36 | connectionLayout = new QGridLayout; |
|
37 | 37 | ccsdsLayout = new QVBoxLayout; |
|
38 | 38 | consoleLayout = new QVBoxLayout; |
|
39 | 39 | selectionLayout = new QVBoxLayout; |
|
40 | 40 | bridgeSelection_LAYOUT = new QGridLayout; |
|
41 | 41 | generalParameters_LAYOUT = new QGridLayout; |
|
42 | 42 | |
|
43 | 43 | gresb_GROUPBOX = new QGroupBox(tr("GRESB bridge parameters")); |
|
44 | 44 | stardundee_GROUPBOX = new QGroupBox(tr("Star Dundee brick parameters")); |
|
45 | 45 | selection_GROUPBOX = new QGroupBox(tr("Bridge selection")); |
|
46 | 46 | generalParameters_GROUPBOX = new QGroupBox(tr("General parameters")); |
|
47 | 47 | |
|
48 | 48 | //*** QLABEL ***// |
|
49 | 49 | gresbBridgeIPLabel = new QLabel(tr("Bridge IP: ")); |
|
50 | 50 | gresbVirtualLinkLabel = new QLabel(tr("Virtual Link: ")); |
|
51 | 51 | spwLinkLabel = new QLabel(tr("SPW Link: ")); |
|
52 | 52 | rmapSourceLogicalAddressLabel = new QLabel(tr("RMAP Source Logical Address: ")); |
|
53 | 53 | rmapTargetLogicalAddressLabel = new QLabel(tr("RMAP Target Logical Address: ")); |
|
54 | 54 | logFileName = new QLabel; |
|
55 | 55 | gresbStatusQueryLabel = new QLabel(tr("Status query socket (port 3010): waiting for connection")); |
|
56 | 56 | gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running")); |
|
57 | 57 | sendCCSDSCommandLabel = new QLabel(tr("Address of the target")); |
|
58 | 58 | |
|
59 | 59 | //*** QPUSHBUTTON ***// |
|
60 | 60 | rmapOpenCommunicationButton = new QPushButton(tr("Open selected bridge")); |
|
61 | 61 | rmapCloseCommunicationButton = new QPushButton(tr("Close selected bridge")); |
|
62 | 62 | rmapOpenCommunicationButton->setEnabled(false); |
|
63 | 63 | rmapCloseCommunicationButton->setEnabled(false); |
|
64 | 64 | logFileChooseButton = new QPushButton(tr("Choose file")); |
|
65 | 65 | gresbStatusQueryRetryButton = new QPushButton(tr("Retry")); |
|
66 | 66 | gresbStatusQueryAbortButton = new QPushButton(tr("Abort")); |
|
67 | 67 | sendCCSDSCommandButton = new QPushButton(tr("Send CCSDS Command")); |
|
68 | 68 | send_TC_LFR_UPDATE_TIME_Button = new QPushButton(tr("Send TC_LFR_UPDATE_TIME Packet")); |
|
69 | 69 | reset_TC_LFR_UPDATE_TIME_Button = new QPushButton(tr("reset the TC_LFR_UPDATE_TIME Packet coarse and fine times")); |
|
70 | 70 | clearConsoleButton = new QPushButton(tr("Clear")); |
|
71 | 71 | |
|
72 | 72 | selectGRESB_BUTTON = new QRadioButton(tr("GRESB")); |
|
73 | 73 | selectStarDundee_BUTTON = new QRadioButton(tr("Star Dundee")); |
|
74 | 74 | |
|
75 | 75 | //*** SPINBOX ***// |
|
76 | 76 | gresbVirtualLinkSpinBox = new QSpinBox; |
|
77 | 77 | rmapSourceLogicalAddressSpinBox = new QSpinBox; |
|
78 | 78 | rmapTargetLogicalAddressSpinBox = new QSpinBox; |
|
79 | 79 | spwLinkSpinBox = new QSpinBox;; |
|
80 | 80 | CCSDSTargetLogicalAddressSpinBox = new QSpinBox; |
|
81 | 81 | gresbVirtualLinkSpinBox->setRange(0, 4); |
|
82 | 82 | gresbVirtualLinkSpinBox->setValue(1); |
|
83 | 83 | rmapSourceLogicalAddressSpinBox->setRange(0, 255); |
|
84 | 84 | rmapSourceLogicalAddressSpinBox->setValue(33); |
|
85 | 85 | rmapTargetLogicalAddressSpinBox->setRange(0, 255); |
|
86 | 86 | spwLinkSpinBox->setRange(0, 2); |
|
87 | 87 | spwLinkSpinBox->setValue(0); |
|
88 | 88 | CCSDSTargetLogicalAddressSpinBox->setRange(0,255); |
|
89 | 89 | CCSDSTargetLogicalAddressSpinBox->setValue(254); |
|
90 | 90 | |
|
91 | 91 | //*** MISC **// |
|
92 | 92 | starDundee = new StarDundee; |
|
93 | 93 | gresbBridge = new gresb; |
|
94 | 94 | console = new QTextEdit; |
|
95 | 95 | gresbBridgeIPDialogBox = new QIPDialogBox; |
|
96 | 96 | gresbStatusQueryDialog = new QDialog; |
|
97 | 97 | logEnableCheckBox = new QCheckBox(tr("Enable Logs")); |
|
98 | 98 | RMAP_write_verify = new QCheckBox(tr("data checked before write\nlimited to 4 bytes\nNOT IMPLEMENTED")); |
|
99 | 99 | RMAP_write_reply = new QCheckBox(tr("reply to the write command required\nlast reply status: unavailable")); |
|
100 | 100 | spwLinkStatusEnquiry = new gresbStatusEnquiry; |
|
101 | 101 | logFile = new QFile(); |
|
102 | 102 | |
|
103 | 103 | logFileEn = false; |
|
104 | 104 | |
|
105 | 105 | connectionLayout->setRowStretch(7, 1); |
|
106 | 106 | connectionLayout->setColumnStretch(2, 1); |
|
107 | 107 | |
|
108 | 108 | bridgeSelection_LAYOUT->addWidget(selectGRESB_BUTTON, 0, 0, 1, 1); |
|
109 | 109 | bridgeSelection_LAYOUT->addWidget(selectStarDundee_BUTTON, 0, 1, 1, 1); |
|
110 | 110 | bridgeSelection_LAYOUT->setRowStretch(1, 1); |
|
111 | 111 | bridgeSelection_LAYOUT->setColumnStretch(2, 1); |
|
112 | 112 | |
|
113 | 113 | generalParameters_LAYOUT->addWidget(logEnableCheckBox, 0, 0, 1, 1); |
|
114 | 114 | generalParameters_LAYOUT->addWidget(logFileChooseButton, 0, 1, 1, 1); |
|
115 | 115 | generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressLabel, 1, 0, 0); |
|
116 | 116 | generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressSpinBox, 1, 1, 0); |
|
117 | 117 | generalParameters_LAYOUT->addWidget(rmapOpenCommunicationButton, 2, 0, 1, 1); |
|
118 | 118 | generalParameters_LAYOUT->addWidget(rmapCloseCommunicationButton, 2, 1, 1, 1); |
|
119 | 119 | generalParameters_LAYOUT->addWidget(RMAP_write_verify, 3, 0, 1, 2); |
|
120 | 120 | generalParameters_LAYOUT->addWidget(RMAP_write_reply, 4, 0, 1, 2); |
|
121 | 121 | generalParameters_LAYOUT->setRowStretch(5, 1); |
|
122 | 122 | generalParameters_LAYOUT->setColumnStretch(2, 1); |
|
123 | 123 | |
|
124 | 124 | gresb_GROUPBOX->setLayout(gresbBridge->layout()); |
|
125 | 125 | gresb_GROUPBOX->setVisible(false); |
|
126 | 126 | stardundee_GROUPBOX->setLayout(starDundee->layout()); |
|
127 | 127 | stardundee_GROUPBOX->setVisible(false); |
|
128 | 128 | selection_GROUPBOX->setLayout(bridgeSelection_LAYOUT); |
|
129 | 129 | generalParameters_GROUPBOX->setLayout(generalParameters_LAYOUT); |
|
130 | 130 | selectionLayout->addWidget(selection_GROUPBOX); |
|
131 | 131 | selectionLayout->addWidget(generalParameters_GROUPBOX); |
|
132 | 132 | selectionLayout->addWidget(gresb_GROUPBOX); |
|
133 | 133 | selectionLayout->addWidget(stardundee_GROUPBOX); |
|
134 | 134 | |
|
135 | 135 | ccsdsLayout->addWidget(sendCCSDSCommandButton); |
|
136 | 136 | ccsdsLayout->addWidget(send_TC_LFR_UPDATE_TIME_Button); |
|
137 | 137 | ccsdsLayout->addWidget(reset_TC_LFR_UPDATE_TIME_Button); |
|
138 | 138 | ccsdsLayout->addWidget(sendCCSDSCommandLabel); |
|
139 | 139 | ccsdsLayout->addWidget(CCSDSTargetLogicalAddressSpinBox); |
|
140 | 140 | |
|
141 | 141 | consoleLayout->addWidget(console); |
|
142 | 142 | consoleLayout->addWidget(clearConsoleButton); |
|
143 | 143 | |
|
144 | 144 | connect(this->logFileChooseButton, SIGNAL(clicked()), this, SLOT(chooseLogFile())); |
|
145 | 145 | connect(this, SIGNAL(setLogFileName(QString)), this->logFileName, SLOT(setText(QString))); |
|
146 | 146 | connect(this->logEnableCheckBox, SIGNAL(stateChanged(int)), this, SLOT(logFileEnDisable(int))); |
|
147 | 147 | |
|
148 | 148 | spwTabWidget->addTab(spwTabWidgetPage0, tr("connection")); |
|
149 | 149 | spwTabWidget->addTab(spwTabWidgetPage1, tr("ccsds")); |
|
150 | 150 | spwTabWidget->addTab(spwTabWidgetPage2, tr("status")); |
|
151 | 151 | spwTabWidget->addTab(spwTabWidgetPage3, tr("console")); |
|
152 | 152 | spwTabWidget->addTab(spwTabWidgetPage4, tr("DMA")); |
|
153 | 153 | |
|
154 | 154 | spwTabWidgetPage0->setLayout(selectionLayout); |
|
155 | 155 | spwTabWidgetPage1->setLayout(ccsdsLayout); |
|
156 | 156 | spwTabWidgetPage2->setLayout(this->spwLinkStatusEnquiry->mainLayout); |
|
157 | 157 | spwTabWidgetPage3->setLayout(consoleLayout); |
|
158 | 158 | spwTabWidgetPage4->setLayout(spectralMatricesDMASimulator->mainLayout); |
|
159 | 159 | |
|
160 | 160 | mainLayout->addWidget(spwTabWidget); |
|
161 | 161 | setLayout(mainLayout); |
|
162 | 162 | |
|
163 | //connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject())); | |
|
164 | 163 | connect(this->clearConsoleButton, SIGNAL(clicked()), this->console, SLOT(clear())); |
|
164 | ||
|
165 | 165 | // briges |
|
166 | 166 | connect(this->selectGRESB_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee())); |
|
167 | 167 | connect(this->selectStarDundee_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee())); |
|
168 | 168 | connect(this->starDundee, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool))); |
|
169 | 169 | connect(this->gresbBridge, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool))); |
|
170 | 170 | |
|
171 | 171 | connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->starDundee, SLOT(targetHasChanged(int))); |
|
172 | 172 | connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->gresbBridge, SLOT(targetHasChanged(int))); |
|
173 | 173 | |
|
174 | 174 | // command code |
|
175 | 175 | connect(this->RMAP_write_reply, SIGNAL(clicked()), this, SLOT(getCommandCode())); |
|
176 | 176 | connect(this->RMAP_write_verify, SIGNAL(clicked()), this, SLOT(getCommandCode())); |
|
177 | 177 | connect(this, SIGNAL(commandCodeHasChanged(RMAP_command_codes)), |
|
178 | 178 | this->starDundee, SLOT(commandCodeHasChanged(RMAP_command_codes))); |
|
179 | 179 | connect(this, SIGNAL(commandCodeHasChanged(RMAP_command_codes)), |
|
180 | 180 | this->gresbBridge, SLOT(commandCodeHasChanged(RMAP_command_codes))); |
|
181 | 181 | |
|
182 | 182 | getCommandCode(); // init the command code value |
|
183 | 183 | rmapTargetLogicalAddressSpinBox->setValue(254); |
|
184 | 184 | } |
|
185 | 185 | |
|
186 | 186 | rmapPluginUI::~rmapPluginUI() |
|
187 | 187 | { |
|
188 | 188 | //delete ui; |
|
189 | 189 | } |
|
190 | 190 | |
|
191 | 191 | void rmapPluginUI::chooseLogFile() |
|
192 | 192 | { |
|
193 | 193 | if(this->logFile->isOpen()) |
|
194 | 194 | this->logFile->close(); |
|
195 | 195 | this->logFile->setFileName(QFileDialog::getSaveFileName(this,tr("Open Log file"), |
|
196 | 196 | QDir::homePath() |
|
197 | 197 | + "/" |
|
198 | 198 | + QDate::currentDate().toString() |
|
199 | 199 | + "_" |
|
200 | 200 | + QTime::currentTime().toString() |
|
201 | 201 | + "_rmapPluginUI.log", |
|
202 | 202 | tr("Log Files (*.txt *.log)"))); |
|
203 | 203 | if(this->logFile->open(QIODevice::WriteOnly)) |
|
204 | 204 | { |
|
205 | 205 | this->logFileStrm = new QTextStream(this->logFile); |
|
206 | 206 | emit this->setLogFileName(this->logFile->fileName()); |
|
207 | 207 | } |
|
208 | 208 | } |
|
209 | 209 | |
|
210 | 210 | void rmapPluginUI::logFileEnDisable(int state) |
|
211 | 211 | { |
|
212 | 212 | if(state==Qt::Checked) |
|
213 | 213 | { |
|
214 | 214 | this->logFileEn = true; |
|
215 | 215 | } |
|
216 | 216 | else if(state==Qt::Unchecked) |
|
217 | 217 | { |
|
218 | 218 | this->logFileEn = false; |
|
219 | 219 | } |
|
220 | 220 | } |
|
221 | 221 | |
|
222 | 222 | bool rmapPluginUI::islogfileenable() |
|
223 | 223 | { |
|
224 | 224 | return this->logFileEn; |
|
225 | 225 | } |
|
226 | 226 | |
|
227 | 227 | void rmapPluginUI::appendToLogFile(const QString & text) |
|
228 | 228 | { |
|
229 | 229 | if(this->logFileEn && this->logFile->isOpen()) |
|
230 | 230 | { |
|
231 | 231 | *(this->logFileStrm) << text << endl; |
|
232 | 232 | } |
|
233 | 233 | } |
|
234 | 234 | |
|
235 | 235 | void rmapPluginUI::closeEvent(QCloseEvent *event) |
|
236 | 236 | { |
|
237 | 237 | if(this->logFile->isOpen()) |
|
238 | 238 | { |
|
239 | 239 | this->logFileStrm->flush(); |
|
240 | 240 | this->logFile->waitForBytesWritten(3000); |
|
241 | 241 | this->logFile->close(); |
|
242 | 242 | } |
|
243 | 243 | event->accept(); |
|
244 | 244 | } |
|
245 | 245 | |
|
246 | 246 | RMAP_command_codes rmapPluginUI::getCommandCode() |
|
247 | 247 | { |
|
248 | 248 | RMAP_command_codes commandCode = invalid0; |
|
249 | 249 | if (RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) commandCode = writeSingle_ver_rep; |
|
250 | 250 | if (RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) commandCode = writeSingle_ver_noRep; |
|
251 | 251 | if (!RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) commandCode = writeSingle_noVer_Rep; |
|
252 | 252 | if (!RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) commandCode = writeSingle_noVer_noRep; |
|
253 | 253 | emit commandCodeHasChanged(commandCode); |
|
254 | 254 | return commandCode; |
|
255 | 255 | } |
|
256 | 256 | |
|
257 | 257 | // SLOT |
|
258 | 258 | |
|
259 | 259 | void rmapPluginUI::selectionBetweenGresbAndStarDundee() //SLOT |
|
260 | 260 | { |
|
261 | 261 | if (selectGRESB_BUTTON->isChecked()) |
|
262 | 262 | { |
|
263 | 263 | gresb_GROUPBOX->setVisible(true); |
|
264 | 264 | stardundee_GROUPBOX->setVisible(false); |
|
265 | 265 | rmapOpenCommunicationButton->setEnabled(true); |
|
266 | 266 | emit bridgeHasChanged(selectedBridgeIsGRESB); |
|
267 | 267 | } |
|
268 | 268 | if (selectStarDundee_BUTTON->isChecked()) |
|
269 | 269 | { |
|
270 | 270 | stardundee_GROUPBOX->setVisible(true); |
|
271 | 271 | gresb_GROUPBOX->setVisible(false); |
|
272 | 272 | rmapOpenCommunicationButton->setEnabled(true); |
|
273 | 273 | emit bridgeHasChanged(selectedBridgeIsStarDundee); |
|
274 | 274 | } |
|
275 | 275 | } |
|
276 | 276 | |
|
277 | 277 | void rmapPluginUI::isOpen(bool flag) |
|
278 | 278 | { |
|
279 | 279 | if (flag == true) |
|
280 | 280 | { |
|
281 | 281 | selection_GROUPBOX->setEnabled(false); |
|
282 | 282 | this->rmapOpenCommunicationButton->setEnabled(false); |
|
283 | 283 | this->rmapCloseCommunicationButton->setEnabled(true); |
|
284 | 284 | } |
|
285 | 285 | if (flag == false) |
|
286 | 286 | { |
|
287 | 287 | selection_GROUPBOX->setEnabled(true); |
|
288 | 288 | this->rmapOpenCommunicationButton->setEnabled(true); |
|
289 | 289 | this->rmapCloseCommunicationButton->setEnabled(false); |
|
290 | 290 | } |
|
291 | 291 | } |
|
292 | 292 | |
|
293 | 293 |
@@ -1,709 +1,734 | |||
|
1 | 1 | #include "stardundee.h" |
|
2 | 2 | #include <QTime> |
|
3 | 3 | #include <math.h> |
|
4 | 4 | |
|
5 | 5 | StarDundee::StarDundee(QWidget *parent) : |
|
6 | 6 | QWidget(parent) |
|
7 | 7 | { |
|
8 | 8 | // Packet receiver |
|
9 | timer = new QTimer; | |
|
9 | 10 | rmapPacketSEMAPHORE = new QSemaphore; |
|
10 | 11 | ccsdsPacketSEMAPHORE = new QSemaphore; |
|
11 | 12 | rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH); |
|
12 | 13 | ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH); |
|
13 | 14 | spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) ); |
|
14 | 15 | |
|
16 | starDundeeStatusQueryDialog = new QDialog; | |
|
17 | ||
|
15 | 18 | commandCode = invalid0; // initialization of the cmmand code for the RMAP transfers |
|
16 | 19 | |
|
17 | 20 | rmapSourceLogicalAddress = 0x20; |
|
18 | 21 | connection_LAYOUT = new QGridLayout; |
|
19 | 22 | |
|
20 | 23 | usbDeviceNumber_LABEL = new QLabel(tr("USB device number: ")); |
|
21 | 24 | linkNumber_LABEL = new QLabel(tr("SpaceWire link number: ")); |
|
22 | 25 | sourceLogicalAddress_LABEL = new QLabel(tr("Source logical address: ")); |
|
26 | starDundeeStatusQueryDialogLabel = new QLabel(tr("SpaceWire link not running")); | |
|
27 | ||
|
28 | //*** QPUSHBUTTON ***// | |
|
29 | starDundeeStatusQueryRetryButton = new QPushButton(tr("Retry")); | |
|
30 | starDundeeStatusQueryAbortButton = new QPushButton(tr("Abort")); | |
|
23 | 31 | |
|
24 | 32 | usbDeviceNumber_SPINBOX = new QSpinBox; |
|
25 | 33 | usbDeviceNumber_SPINBOX->setRange(0,32); |
|
26 | 34 | usbDeviceNumber_SPINBOX->setValue(0); |
|
27 | 35 | linkNumber_SPINBOX = new QSpinBox; |
|
28 | 36 | linkNumber_SPINBOX->setRange(1,2); |
|
29 | 37 | linkNumber_SPINBOX->setValue(1); |
|
30 | 38 | sourceLogicalAddress_SPINBOX = new QSpinBox; |
|
31 | 39 | sourceLogicalAddress_SPINBOX->setRange(0,254); |
|
32 | 40 | sourceLogicalAddress_SPINBOX->setValue(32); |
|
33 | 41 | |
|
42 | // STAR DUNDEE STATUS QUERY DIALOG | |
|
43 | starDundeeStatusQueryDialogLayout = new QGridLayout; | |
|
44 | starDundeeStatusQueryDialogLayout->addWidget(starDundeeStatusQueryDialogLabel, 0, 0, 1, 2); | |
|
45 | starDundeeStatusQueryDialogLayout->addWidget(starDundeeStatusQueryRetryButton, 1, 0, 0); | |
|
46 | starDundeeStatusQueryDialogLayout->addWidget(starDundeeStatusQueryAbortButton, 1, 1, 0); | |
|
47 | starDundeeStatusQueryDialog->setLayout(starDundeeStatusQueryDialogLayout); | |
|
48 | ||
|
34 | 49 | connection_LAYOUT->addWidget(usbDeviceNumber_LABEL, 0, 0, 1, 1); |
|
35 | 50 | connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 0, 1, 1, 1); |
|
36 | 51 | connection_LAYOUT->addWidget(linkNumber_LABEL, 1, 0, 1, 1); |
|
37 | 52 | connection_LAYOUT->addWidget(linkNumber_SPINBOX, 1, 1, 1, 1); |
|
38 | 53 | connection_LAYOUT->addWidget(sourceLogicalAddress_LABEL, 2, 0, 1, 1); |
|
39 | 54 | connection_LAYOUT->addWidget(sourceLogicalAddress_SPINBOX, 2, 1, 1, 1); |
|
40 | 55 | |
|
41 | 56 | connection_LAYOUT->setRowStretch(3, 1); |
|
42 | 57 | connection_LAYOUT->setColumnStretch(2, 1); |
|
43 | 58 | |
|
44 | 59 | this->setLayout(connection_LAYOUT); |
|
45 | 60 | |
|
46 | 61 | connect(this->sourceLogicalAddress_SPINBOX, SIGNAL(valueChanged(int)), this, SLOT(sourceHasChanged(int))); |
|
62 | ||
|
63 | connect(starDundeeStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink())); | |
|
64 | connect(starDundeeStatusQueryAbortButton, SIGNAL(clicked()), starDundeeStatusQueryDialog, SLOT(reject())); | |
|
65 | ||
|
66 | connect(this->timer, SIGNAL(timeout()), this, SLOT(receivePollingLoop())); | |
|
67 | timer->start(100); // starts the periodical timer, perdio = 100ms | |
|
47 | 68 | } |
|
48 | 69 | |
|
49 | 70 | StarDundee::~StarDundee() |
|
50 | 71 | { |
|
51 | 72 | free(rmapPacket); |
|
52 | 73 | free(ccsdsPacket); |
|
53 | 74 | free(spwPacket); |
|
54 | 75 | USBSpaceWire_Close(hDevice); // Close the device |
|
55 | 76 | } |
|
56 | 77 | |
|
57 | 78 | void StarDundee::Open() |
|
58 | 79 | { |
|
59 | 80 | int status; |
|
60 | 81 | U32 statusControl; |
|
61 | U32 routingTableEntry; | |
|
62 | int tableEntry; | |
|
63 | 82 | |
|
64 | 83 | if (!USBSpaceWire_Open(&hDevice, usbDeviceNumber_SPINBOX->value())) // Open the USB device |
|
65 | 84 | { |
|
66 | 85 | emit sendMessage("stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))"); |
|
67 | 86 | return; |
|
68 | 87 | } |
|
69 | 88 | emit sendMessage("stardundee *** Open *** USBSpaceWire_Open successful, device number: " |
|
70 | 89 | + QString::number(usbDeviceNumber_SPINBOX->value())); |
|
71 | 90 | |
|
72 | 91 | USBSpaceWire_EnableNetworkMode(hDevice, 0); // deactivate the network mode |
|
73 | 92 | CFGSpaceWire_EnableRMAP(1); // Enable the use of RMAP |
|
74 | 93 | CFGSpaceWire_SetRMAPDestinationKey(0x20); // Set the destination key expected by STAR-Dundee devices |
|
75 | 94 | |
|
76 | 95 | // Set the path and return path to the device |
|
77 | 96 | CFGSpaceWire_StackClear(); |
|
78 | 97 | CFGSpaceWire_AddrStackPush(0); |
|
79 | 98 | CFGSpaceWire_AddrStackPush(254); |
|
80 | 99 | CFGSpaceWire_RetAddrStackPush(254); |
|
81 | 100 | |
|
82 | 101 | // set the base transmit rate to 100 MHz |
|
83 | 102 | status = CFGSpaceWire_SetBrickBaseTransmitRate( hDevice, CFG_BRK_CLK_100_MHZ, CFG_BRK_DVDR_1, 0xff); |
|
84 | 103 | if (status != CFG_TRANSFER_SUCCESS) |
|
85 | 104 | { |
|
86 | 105 | emit sendMessage("ERROR CFGSpaceWire_SetBrickBaseTransmitRate"); |
|
87 | 106 | } |
|
88 | 107 | else emit sendMessage("OK CFGSpaceWire_SetBrickBaseTransmitRate, base rate = 100 MHz"); |
|
89 | 108 | // read the link status |
|
90 | 109 | if (CFGSpaceWire_GetLinkStatusControl(hDevice, linkNumber_SPINBOX->value(), &statusControl) != CFG_TRANSFER_SUCCESS) |
|
91 | 110 | { |
|
92 | 111 | emit sendMessage("Could not read link status control for link " + QString::number(linkNumber_SPINBOX->value())); |
|
93 | 112 | } |
|
94 | 113 | else |
|
95 | 114 | { |
|
96 | 115 | emit sendMessage("OK CFGSpaceWire_GetLinkStatusControl of link " + QString::number(linkNumber_SPINBOX->value())); |
|
97 | 116 | |
|
98 | 117 | // Set the link status control register properties |
|
99 | 118 | CFGSpaceWire_LSEnableAutoStart(&statusControl, 1); |
|
100 | 119 | CFGSpaceWire_LSEnableStart(&statusControl, 1); |
|
101 | 120 | CFGSpaceWire_LSEnableDisabled(&statusControl, 0); |
|
102 | 121 | CFGSpaceWire_LSEnableTristate(&statusControl, 0); |
|
103 | 122 | CFGSpaceWire_LSSetOperatingSpeed(&statusControl, 9); // sets the link speed to ( 100 MHz / (9+1) ) = 10 MHz |
|
104 | 123 | |
|
105 | 124 | // Set the link status control register |
|
106 | 125 | if (CFGSpaceWire_SetLinkStatusControl(hDevice, linkNumber_SPINBOX->value(), statusControl) != CFG_TRANSFER_SUCCESS) |
|
107 | 126 | { |
|
108 | 127 | emit sendMessage("Could not set the link status control for link " + QString::number(linkNumber_SPINBOX->value())); |
|
109 | 128 | } |
|
110 | 129 | else emit sendMessage("Set the link status control for link " + QString::number(linkNumber_SPINBOX->value())); |
|
111 | 130 | } |
|
112 | 131 | |
|
113 | // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET 254 <=> 0xfe | |
|
114 | tableEntry = rmapTargetLogicalAddress; | |
|
115 | if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS) | |
|
116 | { | |
|
117 | emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry)); | |
|
118 | } | |
|
119 | else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] cleared"); | |
|
120 | // Build the routing table entry to route out of port 1 with header deletion disabled and priority normal | |
|
121 | CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry, | |
|
122 | (1<<linkNumber_SPINBOX->value()), // 0x02 = 0000 0010 | |
|
123 | 0, | |
|
124 | 0); | |
|
125 | // Set the routing table entry for logical address tableEntry | |
|
126 | if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS) | |
|
127 | { | |
|
128 | emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]"); | |
|
129 | } | |
|
130 | else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" ); | |
|
131 | ||
|
132 | // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET 32 <=> 0x20 | |
|
133 | tableEntry = sourceLogicalAddress_SPINBOX->value(); | |
|
134 | if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS) | |
|
135 | { | |
|
136 | emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry)); | |
|
137 | } | |
|
138 | else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] cleared"); | |
|
139 | ||
|
140 | // Build the routing table entry to route out of port 3 with header deletion disabled and priority normal | |
|
141 | CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry, | |
|
142 | (1<<3), // 0x02 = 0000 0010 | |
|
143 | 0, | |
|
144 | 0); | |
|
145 | // Set the routing table entry for logical address tableEntry | |
|
146 | if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS) | |
|
147 | { | |
|
148 | emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]"); | |
|
149 | } | |
|
150 | else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" ); | |
|
132 | setRoutingTableEntry(rmapTargetLogicalAddress, (1<<linkNumber_SPINBOX->value())); | |
|
133 | setRoutingTableEntry(sourceLogicalAddress_SPINBOX->value(), (1<<3)); | |
|
134 | //setRoutingTableEntry(33, (1<<3)); | |
|
151 | 135 | |
|
152 | 136 | emit sendMessage("The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes"); |
|
153 | 137 | |
|
154 | 138 | USBSpaceWire_RegisterReceiveOnAllPorts(hDevice); // Register to receive on all ports |
|
155 | 139 | USBSpaceWire_ClearEndpoints(hDevice); // clear the USB endpoints |
|
156 | 140 | |
|
157 | 141 | // initialize SPW packet semaphores |
|
158 | 142 | while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire(); |
|
159 | 143 | while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire(); |
|
160 | 144 | |
|
145 | if (getLinkStatus(linkNumber_SPINBOX->value())) | |
|
146 | { | |
|
161 | 147 | emit isOpen(true); |
|
162 | 148 | } |
|
149 | else | |
|
150 | { | |
|
151 | ||
|
152 | } | |
|
153 | } | |
|
163 | 154 | |
|
164 | 155 | void StarDundee::Close() |
|
165 | 156 | { |
|
166 | 157 | USBSpaceWire_Close(hDevice); // Close the device |
|
167 | 158 | emit sendMessage("stardundee *** Close *** USBSpaceWire_Close, device: " + QString::number(usbDeviceNumber_SPINBOX->value())); |
|
168 | 159 | |
|
169 | 160 | USBSpaceWire_UnregisterReceiveOnAllPorts(hDevice); // Stop receiving on all ports |
|
170 | 161 | |
|
171 | 162 | emit isOpen(false); |
|
172 | 163 | } |
|
173 | 164 | |
|
174 | 165 | unsigned int StarDundee::GetRoutingTableEntry() |
|
175 | 166 | { |
|
176 | 167 | U32 routingTableEntry, outputPorts; |
|
177 | 168 | char enabled, delHead, priority; |
|
178 | 169 | int portNum; |
|
179 | 170 | int tableEntry; |
|
180 | 171 | |
|
181 | 172 | tableEntry = rmapTargetLogicalAddress; |
|
182 | 173 | |
|
183 | 174 | // Set the path and return path to the device |
|
184 | 175 | CFGSpaceWire_StackClear(); |
|
185 | 176 | CFGSpaceWire_AddrStackPush(0); |
|
186 | 177 | CFGSpaceWire_AddrStackPush(254); |
|
187 | 178 | CFGSpaceWire_RetAddrStackPush(254); |
|
188 | 179 | |
|
189 | 180 | // Read the routing table entry |
|
190 | 181 | if (CFGSpaceWire_GetRoutingTableEntry(hDevice, tableEntry, &routingTableEntry) != CFG_TRANSFER_SUCCESS) |
|
191 | 182 | { |
|
192 | 183 | emit sendMessage("Could not read routing table entry [" + QString::number(tableEntry) + "]"); |
|
193 | 184 | } |
|
194 | 185 | else |
|
195 | 186 | { |
|
196 | 187 | // Display the routing table entry properties |
|
197 | 188 | CFGSpaceWire_RTIsEnabled(routingTableEntry, &enabled); |
|
198 | 189 | CFGSpaceWire_RTIsDelHead(routingTableEntry, &delHead); |
|
199 | 190 | CFGSpaceWire_RTIsPriority(routingTableEntry, &priority); |
|
200 | 191 | CFGSpaceWire_RTGetOutputPorts(routingTableEntry, &outputPorts); |
|
201 | 192 | emit sendMessage("CFGSpaceWire_RTIsEnabled : " + QString::number(enabled)); |
|
202 | 193 | emit sendMessage("CFGSpaceWire_RTIsDelHead : " + QString::number(delHead)); |
|
203 | 194 | emit sendMessage("CFGSpaceWire_RTIsPriority : " + QString::number(priority)); |
|
204 | 195 | emit sendMessage("CFGSpaceWire_RTGetOutputPorts : "); |
|
205 | 196 | for (portNum = 0; portNum < 32; portNum++) |
|
206 | 197 | { |
|
207 | 198 | if (outputPorts & (1 << portNum)) |
|
208 | 199 | { |
|
209 | 200 | emit sendMessage(QString::number(portNum)); |
|
210 | 201 | } |
|
211 | 202 | } |
|
212 | 203 | } |
|
213 | 204 | |
|
214 | 205 | return 1; |
|
215 | 206 | } |
|
216 | 207 | |
|
217 | 208 | unsigned int StarDundee::Write(unsigned int *Value, unsigned int count, unsigned int address) |
|
218 | 209 | { |
|
219 | 210 | unsigned int remainingCount = count; |
|
220 | 211 | unsigned int iOffset = 0; |
|
221 | 212 | QString console_message; |
|
222 | 213 | char* data; |
|
223 | 214 | |
|
224 | 215 | if(rmapPacketSEMAPHORE->available()!=0) |
|
225 | 216 | { |
|
226 | 217 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped"); |
|
227 | 218 | return 1; |
|
228 | 219 | } |
|
229 | 220 | |
|
230 | 221 | emit this->RMAP_write_reply_setText("reply to the write command required\nlast reply status: unavailable"); |
|
231 | 222 | |
|
232 | 223 | data = (char*) malloc(READ_WRITE_MAX_COUNTS*4); |
|
233 | 224 | |
|
234 | 225 | emit appendToLog(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); |
|
235 | 226 | |
|
236 | 227 | while (remainingCount > READ_WRITE_MAX_COUNTS) |
|
237 | 228 | { |
|
238 | 229 | for (int i = 0; i<READ_WRITE_MAX_COUNTS; i++) |
|
239 | 230 | { |
|
240 | 231 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); |
|
241 | 232 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); |
|
242 | 233 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); |
|
243 | 234 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); |
|
244 | 235 | } |
|
245 | 236 | |
|
246 | 237 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
247 | 238 | emit appendToLog(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
248 | 239 | |
|
249 | 240 | if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0) |
|
250 | 241 | { |
|
251 | 242 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); |
|
252 | 243 | return 1; |
|
253 | 244 | } |
|
254 | 245 | |
|
255 | 246 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; |
|
256 | 247 | address = address + READ_WRITE_MAX_COUNTS * 4; |
|
257 | 248 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; |
|
258 | 249 | } |
|
259 | 250 | |
|
260 | 251 | if (remainingCount > 0) |
|
261 | 252 | { |
|
262 | 253 | for (unsigned int i = 0; i<remainingCount; i++) |
|
263 | 254 | { |
|
264 | 255 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); |
|
265 | 256 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); |
|
266 | 257 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); |
|
267 | 258 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); |
|
268 | 259 | } |
|
269 | 260 | |
|
270 | 261 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
271 | 262 | emit appendToLog(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
272 | 263 | |
|
273 | 264 | if (WriteBLOCK(data, remainingCount*4, address)==0) |
|
274 | 265 | { |
|
275 | 266 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); |
|
276 | 267 | return 1; |
|
277 | 268 | } |
|
278 | 269 | } |
|
279 | 270 | |
|
280 | 271 | emit appendToLog(QString("*** STOP *** WRITE")); |
|
281 | 272 | free(data); |
|
282 | 273 | return count; |
|
283 | 274 | } |
|
284 | 275 | |
|
285 | 276 | unsigned int StarDundee::Read(unsigned int *Value, unsigned int count, unsigned int address) |
|
286 | 277 | { |
|
287 | 278 | unsigned int remainingCount = count; |
|
288 | 279 | unsigned int iOffset = 0; |
|
289 | 280 | QString console_message; |
|
290 | 281 | |
|
291 | 282 | if(rmapPacketSEMAPHORE->available()!=0) |
|
292 | 283 | { |
|
293 | 284 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped"); |
|
294 | 285 | return 1; |
|
295 | 286 | } |
|
296 | 287 | emit appendToLog(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); |
|
297 | 288 | |
|
298 | 289 | while (remainingCount > READ_WRITE_MAX_COUNTS) |
|
299 | 290 | { |
|
300 | 291 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
301 | 292 | emit appendToLog(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
302 | 293 | |
|
303 | 294 | if (this->ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0) |
|
304 | 295 | { |
|
305 | 296 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received"); |
|
306 | 297 | return 1; |
|
307 | 298 | } |
|
308 | 299 | |
|
309 | 300 | for(int i=0;i<READ_WRITE_MAX_COUNTS;i++) |
|
310 | 301 | { |
|
311 | 302 | Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; |
|
312 | 303 | for(int j=1;j<4;j++) |
|
313 | 304 | { |
|
314 | 305 | Value[i+iOffset]= ((unsigned char) (rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) |
|
315 | 306 | + Value[i+iOffset]*256; |
|
316 | 307 | } |
|
317 | 308 | } |
|
318 | 309 | |
|
319 | 310 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; |
|
320 | 311 | address = address + READ_WRITE_MAX_COUNTS * 4; |
|
321 | 312 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; |
|
322 | 313 | this->acquireRMAPSemaphore(); |
|
323 | 314 | } |
|
324 | 315 | |
|
325 | 316 | if (remainingCount > 0) |
|
326 | 317 | { |
|
327 | 318 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
328 | 319 | emit appendToLog(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
329 | 320 | |
|
330 | 321 | if (this->ReadBLOCK(4*remainingCount, address)==0) |
|
331 | 322 | { |
|
332 | 323 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received"); |
|
333 | 324 | return 1; |
|
334 | 325 | } |
|
335 | 326 | |
|
336 | 327 | for(unsigned int i=0;i<remainingCount;i++) |
|
337 | 328 | { |
|
338 | 329 | Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; |
|
339 | 330 | for(int j=1;j<4;j++) |
|
340 | 331 | { |
|
341 | 332 | Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256; |
|
342 | 333 | } |
|
343 | 334 | } |
|
344 | 335 | this->acquireRMAPSemaphore(); |
|
345 | 336 | } |
|
346 | 337 | |
|
347 | 338 | emit appendToLog(QString("*** STOP *** READ ")); |
|
348 | 339 | return count; |
|
349 | 340 | } |
|
350 | 341 | |
|
351 | 342 | unsigned int StarDundee::WriteBLOCK(char *data, unsigned int nbBytes, unsigned int address) |
|
352 | 343 | { |
|
353 | 344 | RMAP *RMAPCommand; |
|
354 | 345 | char * packet; |
|
355 | 346 | unsigned char offset, headerSize, CRCSize; |
|
356 | 347 | char* aux; |
|
357 | 348 | unsigned int totalSize; |
|
358 | 349 | int errorCode; |
|
359 | 350 | QString console_message; |
|
360 | 351 | |
|
361 | 352 | if (getLinkStatus(this->linkNumber_SPINBOX->value()) == 0) |
|
362 | 353 | { |
|
363 | 354 | this->Close(); |
|
364 | 355 | return 1; |
|
365 | 356 | } |
|
366 | 357 | |
|
367 | 358 | RMAPCommand = new RMAP(this->commandCode, |
|
368 | 359 | rmapTargetLogicalAddress, |
|
369 | 360 | rmapSourceLogicalAddress, |
|
370 | 361 | address, |
|
371 | 362 | nbBytes, |
|
372 | 363 | data); |
|
373 | 364 | headerSize = sizeof(RMAPCommand->RMAPHeader); |
|
374 | 365 | CRCSize = 1; |
|
375 | 366 | |
|
376 | 367 | //************************* |
|
377 | 368 | // BUILD THE PACKET TO SEND |
|
378 | 369 | totalSize = headerSize + nbBytes + CRCSize; |
|
379 | 370 | packet = (char*) malloc( totalSize ); |
|
380 | 371 | aux = (char*) ((void*) &RMAPCommand->RMAPHeader); |
|
381 | 372 | for(unsigned int i = 0; i<headerSize; i++) packet[i] = aux[i]; |
|
382 | 373 | offset = headerSize; |
|
383 | 374 | for(unsigned int i = 0; i<nbBytes; i++) |
|
384 | 375 | { |
|
385 | 376 | packet[i+offset] = data[i]; |
|
386 | 377 | } |
|
387 | 378 | packet[nbBytes+offset] = RMAPCommand->dataCRC; |
|
388 | 379 | |
|
389 | 380 | //**************** |
|
390 | 381 | // SEND THE PACKET |
|
391 | 382 | result = USBSpaceWire_SendPacket(hDevice, |
|
392 | 383 | packet, |
|
393 | 384 | totalSize, |
|
394 | 385 | BWAIT_1, &pIdentifier); |
|
395 | 386 | if (result != TRANSFER_SUCCESS) |
|
396 | 387 | { |
|
397 | 388 | emit sendMessage("ERROR *** WriteStarDundee when sending packet of size " |
|
398 | 389 | + QString::number(totalSize) +", with code: " + QString::number(result)); |
|
399 | 390 | USBSpaceWire_FreeSend(hDevice, pIdentifier); |
|
400 | 391 | free(data); |
|
401 | 392 | return 1; |
|
402 | 393 | } |
|
403 | 394 | else emit sendMessage("OK *** WriteStarDundee when sending packet of size " + QString::number(totalSize)); |
|
404 | 395 | |
|
405 | 396 | //************** |
|
406 | 397 | // Free the send |
|
407 | 398 | USBSpaceWire_FreeSend(hDevice, pIdentifier); |
|
408 | 399 | free(packet); |
|
409 | 400 | |
|
410 | 401 | if ( (commandCode == writeSingle_noVer_Rep) | (commandCode == writeInc_noVer_Rep) | |
|
411 | 402 | (commandCode == writeSingle_ver_rep) | (commandCode == writeInc_ver_rep) ) |
|
412 | 403 | { |
|
413 | 404 | // WAIT FOR THE RMAP REPLY PACKET |
|
414 | 405 | errorCode = this->receiveSPWPacket(1); |
|
415 | 406 | if (errorCode<=0) |
|
416 | 407 | { |
|
417 | 408 | emit appendToLog("WARNING === in function WriteBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode)); |
|
418 | 409 | return 0; |
|
419 | 410 | } |
|
420 | 411 | if(rmapPacketSize != 8) |
|
421 | 412 | { |
|
422 | 413 | console_message.sprintf("WARNING === in function WRITE (with reply) of rmapplugin *** write reply format not compliant\n"); |
|
423 | 414 | emit appendToLog(console_message); |
|
424 | 415 | return 0; |
|
425 | 416 | } |
|
426 | 417 | switch (this->rmapPacket[3]) // byte 4 is the status byte in the reply |
|
427 | 418 | { |
|
428 | 419 | case 0: |
|
429 | 420 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 0 Successfull"); |
|
430 | 421 | break; |
|
431 | 422 | case 1: |
|
432 | 423 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** General error code"); |
|
433 | 424 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 1 General error code"); |
|
434 | 425 | break; |
|
435 | 426 | case 2: |
|
436 | 427 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Unused RMAP packet type or command code"); |
|
437 | 428 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 2 Unused RMAP packet type or command code"); |
|
438 | 429 | break; |
|
439 | 430 | case 3: |
|
440 | 431 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid key"); |
|
441 | 432 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 3 Invalid key"); |
|
442 | 433 | break; |
|
443 | 434 | case 4: |
|
444 | 435 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid data CRC"); |
|
445 | 436 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 4 Invalid data CRC"); |
|
446 | 437 | break; |
|
447 | 438 | case 5: |
|
448 | 439 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Early EOP"); |
|
449 | 440 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 5 Early EOP"); |
|
450 | 441 | break; |
|
451 | 442 | case 6: |
|
452 | 443 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Too much data"); |
|
453 | 444 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 6 Too much data"); |
|
454 | 445 | break; |
|
455 | 446 | case 7: |
|
456 | 447 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** EEP"); |
|
457 | 448 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 7 EEP"); |
|
458 | 449 | break; |
|
459 | 450 | case 8: |
|
460 | 451 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Reserved"); |
|
461 | 452 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 8 Reserved"); |
|
462 | 453 | break; |
|
463 | 454 | case 9: |
|
464 | 455 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Verify buffer overrun"); |
|
465 | 456 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 9 Verify buffer overrun"); |
|
466 | 457 | break; |
|
467 | 458 | case 10: |
|
468 | 459 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMAP command not implemented or not authorised"); |
|
469 | 460 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 10 RMAP command not implemented or not authorised"); |
|
470 | 461 | break; |
|
471 | 462 | case 11: |
|
472 | 463 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMW data length error"); |
|
473 | 464 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 11 RMAP RMW data length error"); |
|
474 | 465 | break; |
|
475 | 466 | case 12: |
|
476 | 467 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid target logical address"); |
|
477 | 468 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 12 Invalid target logical address"); |
|
478 | 469 | break; |
|
479 | 470 | } |
|
480 | 471 | this->acquireRMAPSemaphore(); |
|
481 | 472 | } |
|
482 | 473 | else |
|
483 | 474 | emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: unavailable"); |
|
484 | 475 | |
|
485 | 476 | return nbBytes; |
|
486 | 477 | } |
|
487 | 478 | |
|
488 | 479 | unsigned int StarDundee::ReadBLOCK(unsigned int nbBytes, unsigned int address) |
|
489 | 480 | { |
|
490 | 481 | int errorCode; |
|
491 | 482 | RMAP *RMAPCommand; |
|
492 | 483 | unsigned int dataLength; |
|
493 | 484 | |
|
494 | 485 | //********************** |
|
495 | 486 | // Check the link status |
|
496 | 487 | if ( getLinkStatus( this->linkNumber_SPINBOX->value() ) == 0 ) |
|
497 | 488 | { |
|
498 | 489 | this->Close(); |
|
499 | 490 | emit appendToLog("WARNING === in function WriteSPW of StarDundee *** SPW link not running\n"); |
|
500 | 491 | return 0; |
|
501 | 492 | } |
|
502 | 493 | |
|
503 | 494 | //********************** |
|
504 | 495 | // SEND THE READ COMMAND |
|
505 | 496 | if (nbBytes > 4) |
|
506 | 497 | { |
|
507 | 498 | RMAPCommand = new RMAP(read_Inc, |
|
508 | 499 | rmapTargetLogicalAddress, |
|
509 | 500 | rmapSourceLogicalAddress, |
|
510 | 501 | address, |
|
511 | 502 | nbBytes, |
|
512 | 503 | NULL); |
|
513 | 504 | } |
|
514 | 505 | else |
|
515 | 506 | { |
|
516 | 507 | RMAPCommand = new RMAP(read_Single, |
|
517 | 508 | rmapTargetLogicalAddress, |
|
518 | 509 | rmapSourceLogicalAddress, |
|
519 | 510 | address, |
|
520 | 511 | nbBytes, |
|
521 | 512 | NULL); |
|
522 | 513 | } |
|
523 | 514 | result = USBSpaceWire_SendPacket(hDevice, |
|
524 | 515 | (unsigned char*) ((void*) &RMAPCommand->RMAPHeader), |
|
525 | 516 | sizeof(RMAPCommand->RMAPHeader), |
|
526 | 517 | BWAIT_1, &pIdentifier); |
|
527 | 518 | if (result != TRANSFER_SUCCESS) emit sendMessage("ERR *** ReadStarDundee *** ReadBLOCK *** sending the READ command "); |
|
528 | 519 | else emit sendMessage("OK *** ReadStarDundee *** ReadBLOCK *** sending the READ command"); |
|
529 | 520 | |
|
530 | 521 | //********************************* |
|
531 | 522 | // RECEIVE THE INCOMING RMAP PACKET |
|
532 | 523 | errorCode = this->receiveSPWPacket(1); // request ID 1 is for RMAP packet |
|
533 | 524 | if (errorCode<=0) |
|
534 | 525 | { |
|
535 | 526 | emit appendToLog("WARNING === in function ReadBLOCK of StarDundee *** RMAP packet reception failed with code " + QString::number(errorCode)); |
|
536 | 527 | return 0; |
|
537 | 528 | } |
|
538 | 529 | dataLength = rmapPacketSize - RMAP_READ_REPLY_HEADER_LENGTH - RMAP_DATA_CRC_LENGTH; |
|
539 | 530 | if(dataLength != nbBytes) |
|
540 | 531 | { |
|
541 | 532 | emit appendToLog("WARNING === in function READ of StarDundee *** number of data received (" |
|
542 | 533 | +QString::number(dataLength) |
|
543 | 534 | +") not equal to number of data requested (" |
|
544 | 535 | +QString::number(nbBytes) |
|
545 | 536 | +")"); |
|
546 | 537 | return 0; |
|
547 | 538 | } |
|
548 | 539 | return dataLength; |
|
549 | 540 | } |
|
550 | 541 | |
|
551 | 542 | unsigned int StarDundee::WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) |
|
552 | 543 | { |
|
553 | 544 | char protocoleIdentifier = 0x02; |
|
554 | 545 | char reserved = 0x00; |
|
555 | 546 | char *SPWData; |
|
556 | 547 | unsigned int totalSize; |
|
557 | 548 | |
|
558 | 549 | if (count>248) |
|
559 | 550 | { |
|
560 | 551 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** CCSDS packet size > 248 bytes\n"); |
|
561 | 552 | return 1; |
|
562 | 553 | } |
|
563 | 554 | |
|
564 | 555 | emit appendToLog("*** START *** Send CCSDS packet of "+ QString::number(count) + " byte(s)"); |
|
565 | 556 | |
|
566 | 557 | if ( getLinkStatus( this->linkNumber_SPINBOX->value() ) == 0 ) |
|
567 | 558 | { |
|
568 | 559 | this->Close(); |
|
569 | 560 | emit appendToLog("WARNING === in function WriteSPW of StarDundee *** SPW link not running\n"); |
|
570 | 561 | return 1; |
|
571 | 562 | } |
|
572 | 563 | |
|
573 | 564 | totalSize = count + 4; |
|
574 | 565 | SPWData = (char*) malloc(totalSize); |
|
575 | 566 | // SPW HEADER |
|
576 | 567 | SPWData[0] = targetLogicalAddress; |
|
577 | 568 | SPWData[1] = protocoleIdentifier; |
|
578 | 569 | SPWData[2] = reserved; |
|
579 | 570 | SPWData[3] = userApplication; |
|
580 | 571 | // CCSDS PACKET |
|
581 | 572 | for (unsigned int i = 0; i<count; i++) |
|
582 | 573 | { |
|
583 | 574 | SPWData[i+4] = Value[i]; |
|
584 | 575 | } |
|
585 | 576 | |
|
586 | 577 | //************ |
|
587 | 578 | // SEND THE PACKET |
|
588 | 579 | result = USBSpaceWire_SendPacket(hDevice, |
|
589 | 580 | SPWData, |
|
590 | 581 | totalSize, |
|
591 | 582 | BWAIT_1, &pIdentifier); |
|
592 | 583 | if (result != TRANSFER_SUCCESS) |
|
593 | 584 | { |
|
594 | 585 | emit sendMessage("ERROR *** WriteSPW when sending packet of size " |
|
595 | 586 | + QString::number(totalSize) +", with code: " + QString::number(result)); |
|
596 | 587 | USBSpaceWire_FreeSend(hDevice, pIdentifier); |
|
597 | 588 | free(SPWData); |
|
598 | 589 | return 0; |
|
599 | 590 | } |
|
600 | 591 | else emit sendMessage("OK *** WriteSPW when sending packet of size " + QString::number(totalSize)); |
|
601 | 592 | |
|
602 | 593 | //************** |
|
603 | 594 | // Free the send |
|
604 | 595 | USBSpaceWire_FreeSend(hDevice, pIdentifier); |
|
605 | 596 | free(SPWData); |
|
606 | 597 | |
|
607 | 598 | emit appendToLog(QString("*** CCSDS packet sent")); |
|
608 | 599 | |
|
609 | 600 | return 1; |
|
610 | 601 | } |
|
611 | 602 | |
|
612 | 603 | unsigned int StarDundee::getLinkStatus(unsigned char link) |
|
613 | 604 | { |
|
614 | 605 | U32 statusControl, errorStatus, portType; |
|
615 | 606 | U32 linkStatus, operatingSpeed, outputPortConnection; |
|
616 | 607 | char isLinkRunning, isAutoStart, isStart, isDisabled, isTristate; |
|
617 | 608 | |
|
618 | 609 | // Read the link status control register |
|
619 | 610 | if (CFGSpaceWire_GetLinkStatusControl(hDevice, 1, &statusControl) != CFG_TRANSFER_SUCCESS) |
|
620 | 611 | { |
|
621 | 612 | emit appendToLog("Could not read link status control for link" + QString::number(link)); |
|
622 | 613 | } |
|
623 | 614 | else |
|
624 | 615 | { |
|
625 | 616 | // Display the link status control register properties |
|
626 | 617 | CFGSpaceWire_LSPortType(statusControl, &portType); |
|
627 | 618 | if (portType == CFG_CONFIGURATION_PORT) |
|
628 | 619 | { |
|
629 | 620 | CFGSpaceWire_LSConfigErrorStatus(statusControl, &errorStatus); |
|
630 | 621 | //emit appendToLog("Configuration port error status = " + QString::number(errorStatus)); |
|
631 | 622 | } |
|
632 | 623 | else if (portType == CFG_SPACEWIRE_EXTERNAL_PORT) |
|
633 | 624 | { |
|
634 | 625 | CFGSpaceWire_LSExternalErrorStatus(statusControl, &errorStatus); |
|
635 | 626 | //emit appendToLog("External port error status = " + QString::number(errorStatus)); |
|
636 | 627 | } |
|
637 | 628 | else |
|
638 | 629 | { |
|
639 | 630 | CFGSpaceWire_LSErrorStatus(statusControl, &errorStatus); |
|
640 | 631 | //emit appendToLog("SpaceWire link error status = " + QString::number(errorStatus)); |
|
641 | 632 | } |
|
642 | 633 | CFGSpaceWire_LSLinkState(statusControl, &linkStatus); |
|
643 | 634 | CFGSpaceWire_LSIsLinkRunning(statusControl, &isLinkRunning); |
|
644 | 635 | CFGSpaceWire_LSIsAutoStart(statusControl, &isAutoStart); |
|
645 | 636 | CFGSpaceWire_LSIsStart(statusControl, &isStart); |
|
646 | 637 | CFGSpaceWire_LSIsDisabled(statusControl, &isDisabled); |
|
647 | 638 | CFGSpaceWire_LSIsTristate(statusControl, &isTristate); |
|
648 | 639 | CFGSpaceWire_LSOperatingSpeed(statusControl, &operatingSpeed); |
|
649 | 640 | CFGSpaceWire_LSOutputPortConnection(statusControl, &outputPortConnection); |
|
650 | 641 | //emit appendToLog("The link state is = " + QString::number(linkStatus)); |
|
651 | 642 | //emit appendToLog("The link is running = " + QString::number(isLinkRunning)); |
|
652 | 643 | //emit appendToLog("The autostart bit is enabled = " + QString::number(isAutoStart)); |
|
653 | 644 | //emit appendToLog("The start bit is enabled = " + QString::number(isStart)); |
|
654 | 645 | //emit appendToLog("The link is disabled = " + QString::number(isDisabled)); |
|
655 | 646 | //emit appendToLog("The tri-state bit is enabled = " + QString::number(isAutoStart)); |
|
656 | 647 | //emit appendToLog("The operating speed is = " + QString::number(operatingSpeed)); |
|
657 | 648 | //emit appendToLog("This port is currently connected to output port = " + QString::number(outputPortConnection)); |
|
658 | 649 | } |
|
659 | 650 | if (linkStatus == 5) return 1; |
|
660 | 651 | else return 0; |
|
661 | 652 | } |
|
662 | 653 | |
|
663 | 654 | int StarDundee::receiveSPWPacket(unsigned char requestID) // SLOT |
|
664 | 655 | { |
|
665 | 656 | unsigned int packetLength; |
|
666 | 657 | unsigned int nbBytes; |
|
667 | 658 | unsigned nPacketNum; |
|
668 | 659 | USB_SPACEWIRE_PACKET_PROPERTIES properties; // The properties of the read |
|
669 | 660 | |
|
670 | 661 | if (requestID==1) |
|
671 | 662 | { |
|
672 |
if (rmapPacketSEMAPHORE->available()) |
|
|
663 | if (rmapPacketSEMAPHORE->available()) | |
|
664 | { | |
|
665 | return rmapPacketSize; | |
|
666 | } | |
|
673 | 667 | } |
|
674 | 668 | |
|
675 | 669 | //******************** |
|
676 | 670 | // TRY TO RECEIVE DATA |
|
677 | 671 | nbBytes = qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH); // maximum size of the packet to receive |
|
678 | 672 | nPacketNum = 1; |
|
679 | 673 | result = USBSpaceWire_ReadPackets(hDevice, spwPacket, nbBytes, nPacketNum, BWAIT_1, &properties, &pIdentifier); |
|
680 | if (result != TRANSFER_SUCCESS) emit sendMessage("Error: Could not receive the packet"); | |
|
674 | if (result != TRANSFER_SUCCESS) | |
|
675 | { | |
|
676 | emit sendMessage("Error: Could not receive the packet"); | |
|
677 | return 0; | |
|
678 | } | |
|
681 | 679 | else |
|
682 | 680 | { |
|
683 | emit sendMessage("A packet of length " + QString::number(properties.len) + " has been successfully received"); | |
|
681 | packetLength = properties.len; | |
|
684 | 682 | USBSpaceWire_FreeRead(hDevice, pIdentifier); // Free the receive |
|
685 | 683 | } |
|
686 | packetLength = properties.len; | |
|
687 | 684 | |
|
688 | 685 | switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet |
|
689 | 686 | { |
|
690 | 687 | case 1: // 0x01 is the protocole identifier for RMAP packets |
|
691 | 688 | if (rmapPacketSEMAPHORE->available()!=0) return -3; // ERROR === previous RMAP packet not processed yet |
|
692 | 689 | for(unsigned int i=0; i<packetLength; i++) rmapPacket[i] = spwPacket[i]; |
|
693 | 690 | rmapPacketSize = packetLength; |
|
694 | 691 | rmapPacketSEMAPHORE->release(); |
|
695 |
emit |
|
|
692 | emit appendToLog("RMAP packet of size " + QString::number(packetLength) + " received"); | |
|
696 | 693 | return packetLength; |
|
697 | 694 | |
|
698 | 695 | case 2: // 0x02 is the protocole identifier for CCSDS packets |
|
699 | 696 | if (ccsdsPacketSEMAPHORE->available()!=0) return -4; // ERROR === previous CCSDS packet not processed yet |
|
700 | 697 | for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i]; |
|
701 | 698 | ccsdsPacketSize = packetLength; |
|
702 | 699 | ccsdsPacketSEMAPHORE->release(); |
|
700 | emit appendToLog("CCSDS packet of size " + QString::number(packetLength) + " received"); | |
|
703 | 701 | emit(ccsdsPacketAvailable(ccsdsPacket, packetLength)); |
|
704 | 702 | return packetLength; |
|
705 | 703 | } |
|
706 | 704 | return 0; |
|
707 | 705 | } |
|
708 | 706 | |
|
707 | void StarDundee::receivePollingLoop() | |
|
708 | { | |
|
709 | timer->blockSignals(true); | |
|
710 | if (USBSpaceWire_WaitOnReadPacketAvailable(hDevice, 0)) receiveSPWPacket(0); | |
|
711 | timer->blockSignals(false); | |
|
712 | } | |
|
709 | 713 | |
|
714 | unsigned char StarDundee::setRoutingTableEntry(int tableEntry, U32 dwOutputPorts) | |
|
715 | { | |
|
716 | U32 routingTableEntry; | |
|
717 | // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET entryNumber | |
|
718 | if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS) | |
|
719 | { | |
|
720 | emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry)); | |
|
721 | } | |
|
722 | // Build the routing table entry | |
|
723 | CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry, | |
|
724 | dwOutputPorts, // route out of port dwOutputPorts | |
|
725 | 0, // header deletion disabled | |
|
726 | 0); // priority normal | |
|
727 | // Set the routing table entry for logical address tableEntry | |
|
728 | if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS) | |
|
729 | { | |
|
730 | emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]"); | |
|
731 | } | |
|
732 | else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" ); | |
|
733 | ||
|
734 | } |
@@ -1,82 +1,99 | |||
|
1 | 1 | #ifndef STARDUNDEE_H |
|
2 | 2 | #define STARDUNDEE_H |
|
3 | 3 | |
|
4 | 4 | #include <QWidget> |
|
5 | #include "spw_usb_api.h" | |
|
6 | #include "spw_config_library.h" | |
|
7 | 5 | #include <QPushButton> |
|
8 | 6 | #include <QGridLayout> |
|
9 | 7 | #include <QSpinBox> |
|
10 | 8 | #include <QLabel> |
|
11 | 9 | #include <QSemaphore> |
|
10 | #include <QTimer> | |
|
11 | #include <QDialog> | |
|
12 | ||
|
12 | 13 | #include "rmapoperations.h" |
|
14 | #include "spw_usb_api.h" | |
|
15 | #include "spw_config_library.h" | |
|
13 | 16 | |
|
14 | 17 | #define BWAIT_0 0 |
|
15 | 18 | #define BWAIT_1 1 |
|
16 | 19 | |
|
17 | 20 | class StarDundee : public QWidget |
|
18 | 21 | { |
|
19 | 22 | Q_OBJECT |
|
20 | 23 | public: |
|
21 | 24 | explicit StarDundee(QWidget *parent = 0); |
|
22 | 25 | ~StarDundee(); |
|
23 | 26 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
24 | 27 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
25 | 28 | unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); |
|
26 | 29 | |
|
27 | 30 | signals: |
|
28 | 31 | void sendMessage(QString message); |
|
29 | 32 | void isOpen(bool); |
|
30 | 33 | void RMAP_write_reply_setText(QString); |
|
31 | 34 | void appendToLog(QString); |
|
32 | 35 | void ccsdsPacketAvailable(unsigned char*, unsigned int); |
|
33 | 36 | |
|
34 | 37 | public slots: |
|
35 | 38 | void Open(); |
|
36 | 39 | void Close(); |
|
37 | 40 | int receiveSPWPacket(unsigned char requestID); |
|
38 | 41 | void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} |
|
39 | 42 | void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} |
|
43 | void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();} | |
|
44 | void reTestSPWLink() {getLinkStatus(linkNumber_SPINBOX->value());} | |
|
45 | // | |
|
40 | 46 | void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;} |
|
47 | void receivePollingLoop(); | |
|
41 | 48 | |
|
42 | 49 | private: |
|
43 | 50 | unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0); |
|
44 | 51 | unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0); |
|
45 |
void acquireRMAPSemaphore() {rmapPacketSEMAPHORE-> |
|
|
46 |
void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE-> |
|
|
52 | void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->tryAcquire();} | |
|
53 | void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->tryAcquire();} | |
|
54 | unsigned char setRoutingTableEntry(int tableEntry, U32 dwOutputPorts); | |
|
47 | 55 | |
|
48 | 56 | unsigned int getLinkStatus(unsigned char link); |
|
49 | 57 | unsigned int GetRoutingTableEntry(); |
|
50 | 58 | |
|
51 | 59 | unsigned char rmapTargetLogicalAddress ; |
|
52 | 60 | unsigned char rmapSourceLogicalAddress ; |
|
53 | 61 | |
|
54 | 62 | RMAP_command_codes commandCode; |
|
55 | 63 | |
|
56 | 64 | QLabel *usbDeviceNumber_LABEL; |
|
57 | 65 | QLabel *linkNumber_LABEL; |
|
58 | 66 | QLabel *sourceLogicalAddress_LABEL; |
|
67 | QLabel *starDundeeStatusQueryDialogLabel; | |
|
59 | 68 | |
|
60 | 69 | QSpinBox *usbDeviceNumber_SPINBOX; |
|
61 | 70 | QSpinBox *linkNumber_SPINBOX; |
|
62 | 71 | QSpinBox *sourceLogicalAddress_SPINBOX; |
|
63 | 72 | |
|
64 | 73 | QGridLayout *connection_LAYOUT; |
|
74 | QGridLayout *starDundeeStatusQueryDialogLayout; | |
|
75 | ||
|
76 | QDialog *starDundeeStatusQueryDialog; | |
|
77 | ||
|
78 | QPushButton *starDundeeStatusQueryRetryButton; | |
|
79 | QPushButton *starDundeeStatusQueryAbortButton; | |
|
80 | ||
|
81 | QTimer *timer; | |
|
65 | 82 | |
|
66 | 83 | unsigned char pBuffer[10]; // Pointer to the start of the user buffer from which to transmit data |
|
67 | 84 | USB_SPACEWIRE_ID pIdentifier; // A pointer to a variable which will be set to contain a unique identifier for the send |
|
68 | 85 | |
|
69 | 86 | star_device_handle hDevice; // Handle to the SpaceWire device |
|
70 | 87 | USB_SPACEWIRE_STATUS result; // The result of the send operation |
|
71 | 88 | |
|
72 | 89 | // Packet receiver |
|
73 | 90 | QSemaphore *rmapPacketSEMAPHORE; |
|
74 | 91 | QSemaphore *ccsdsPacketSEMAPHORE; |
|
75 | 92 | char* rmapPacket; // The buffer to receive RMAP READ packets |
|
76 | 93 | unsigned char *ccsdsPacket; |
|
77 | 94 | char *spwPacket; |
|
78 | 95 | unsigned int rmapPacketSize; |
|
79 | 96 | unsigned int ccsdsPacketSize; |
|
80 | 97 | }; |
|
81 | 98 | |
|
82 | 99 | #endif // STARDUNDEE_H |
General Comments 0
You need to be logged in to leave comments.
Login now