##// END OF EJS Templates
Minor updates
leroy -
r3:bf349cb3902d default
parent child
Show More
@@ -1,264 +1,264
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by Qt Creator 2.4.1, 2012-12-06T08:47:47. -->
3 <!-- Written by Qt Creator 2.4.1, 2012-12-07T14:08:53. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 <value type="int">0</value>
7 <value type="int">0</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 <valuemap type="QVariantMap">
11 <valuemap type="QVariantMap">
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
14 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 <value type="QString" key="language">Cpp</value>
15 <value type="QString" key="language">Cpp</value>
16 <valuemap type="QVariantMap" key="value">
16 <valuemap type="QVariantMap" key="value">
17 <value type="QString" key="CurrentPreferences">CppGlobal</value>
17 <value type="QString" key="CurrentPreferences">CppGlobal</value>
18 </valuemap>
18 </valuemap>
19 </valuemap>
19 </valuemap>
20 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
20 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 <value type="QString" key="language">QmlJS</value>
21 <value type="QString" key="language">QmlJS</value>
22 <valuemap type="QVariantMap" key="value">
22 <valuemap type="QVariantMap" key="value">
23 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
23 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
24 </valuemap>
24 </valuemap>
25 </valuemap>
25 </valuemap>
26 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
26 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 <value type="QByteArray" key="EditorConfiguration.Codec">System</value>
27 <value type="QByteArray" key="EditorConfiguration.Codec">System</value>
28 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
28 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
29 <value type="int" key="EditorConfiguration.IndentSize">4</value>
29 <value type="int" key="EditorConfiguration.IndentSize">4</value>
30 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
30 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
31 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
31 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
32 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
32 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
33 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
33 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
34 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
34 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
35 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
35 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
36 <value type="int" key="EditorConfiguration.TabSize">8</value>
36 <value type="int" key="EditorConfiguration.TabSize">8</value>
37 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
37 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
38 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
38 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
39 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
39 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
40 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
40 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
41 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
41 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
42 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
42 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
43 </valuemap>
43 </valuemap>
44 </data>
44 </data>
45 <data>
45 <data>
46 <variable>ProjectExplorer.Project.PluginSettings</variable>
46 <variable>ProjectExplorer.Project.PluginSettings</variable>
47 <valuemap type="QVariantMap"/>
47 <valuemap type="QVariantMap"/>
48 </data>
48 </data>
49 <data>
49 <data>
50 <variable>ProjectExplorer.Project.Target.0</variable>
50 <variable>ProjectExplorer.Project.Target.0</variable>
51 <valuemap type="QVariantMap">
51 <valuemap type="QVariantMap">
52 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
52 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
53 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
53 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.DesktopTarget</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.DesktopTarget</value>
55 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
55 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
56 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
56 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
58 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
58 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
59 <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value>
59 <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value>
60 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
60 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
62 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
62 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
63 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
63 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
65 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
65 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
66 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
66 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
67 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
67 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
69 </valuemap>
69 </valuemap>
70 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
70 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
71 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
71 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
72 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
72 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
73 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
73 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
74 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
74 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
75 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
75 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
76 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
76 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
77 </valuemap>
77 </valuemap>
78 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
78 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
79 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
79 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
80 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
80 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
81 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
81 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
82 </valuemap>
82 </valuemap>
83 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
83 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
84 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
84 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
85 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
85 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
88 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
88 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
89 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
89 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
90 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
90 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
91 </valuemap>
91 </valuemap>
92 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
92 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
96 </valuemap>
96 </valuemap>
97 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
97 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
98 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
98 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
99 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
99 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
100 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
100 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
101 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
101 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
102 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
102 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
103 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
103 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
104 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value>
104 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value>
105 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
105 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
106 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
106 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
107 </valuemap>
107 </valuemap>
108 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
108 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
109 <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value>
109 <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value>
110 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
110 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
111 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
111 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
115 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
115 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
116 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
116 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
117 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
117 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
118 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
118 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
119 </valuemap>
119 </valuemap>
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
121 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
121 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
122 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
122 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
124 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
124 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
125 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
125 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
126 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
126 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
127 </valuemap>
127 </valuemap>
128 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
128 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
131 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
131 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
132 </valuemap>
132 </valuemap>
133 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
133 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
134 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
134 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
137 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
137 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
138 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
138 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
139 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
139 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
140 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
140 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
141 </valuemap>
141 </valuemap>
142 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
142 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
143 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
143 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
144 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
144 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
146 </valuemap>
146 </valuemap>
147 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
147 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
148 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
148 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
149 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
149 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
150 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
150 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
151 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
151 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
153 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
153 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
154 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value>
154 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value>
155 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
155 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
156 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
156 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
157 </valuemap>
157 </valuemap>
158 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
158 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
159 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
159 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
160 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
160 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
161 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
161 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
162 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
162 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
163 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
163 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
165 </valuemap>
165 </valuemap>
166 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
166 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
167 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
167 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
168 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
168 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
169 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
169 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
170 </valuemap>
170 </valuemap>
171 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
171 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
172 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
172 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
173 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
173 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
174 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
174 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
175 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
175 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
176 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
176 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
177 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
177 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
178 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
178 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
179 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
179 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
180 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
180 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
181 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
181 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
182 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
182 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
183 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
183 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
184 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
184 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
185 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
185 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
186 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
186 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
187 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
187 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
188 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
188 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
189 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
189 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
190 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
190 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
191 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
191 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
192 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
192 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
193 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
193 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
194 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
194 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
196 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
196 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
197 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
197 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
198 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
198 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
199 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
199 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
200 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
200 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
201 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
201 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
202 <value type="int">0</value>
202 <value type="int">0</value>
203 <value type="int">1</value>
203 <value type="int">1</value>
204 <value type="int">2</value>
204 <value type="int">2</value>
205 <value type="int">3</value>
205 <value type="int">3</value>
206 <value type="int">4</value>
206 <value type="int">4</value>
207 <value type="int">5</value>
207 <value type="int">5</value>
208 <value type="int">6</value>
208 <value type="int">6</value>
209 <value type="int">7</value>
209 <value type="int">7</value>
210 <value type="int">8</value>
210 <value type="int">8</value>
211 <value type="int">9</value>
211 <value type="int">9</value>
212 <value type="int">10</value>
212 <value type="int">10</value>
213 <value type="int">11</value>
213 <value type="int">11</value>
214 <value type="int">12</value>
214 <value type="int">12</value>
215 <value type="int">13</value>
215 <value type="int">13</value>
216 <value type="int">14</value>
216 <value type="int">14</value>
217 </valuelist>
217 </valuelist>
218 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
218 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
219 <value type="int">0</value>
219 <value type="int">0</value>
220 <value type="int">1</value>
220 <value type="int">1</value>
221 <value type="int">2</value>
221 <value type="int">2</value>
222 <value type="int">3</value>
222 <value type="int">3</value>
223 <value type="int">4</value>
223 <value type="int">4</value>
224 <value type="int">5</value>
224 <value type="int">5</value>
225 <value type="int">6</value>
225 <value type="int">6</value>
226 <value type="int">7</value>
226 <value type="int">7</value>
227 <value type="int">8</value>
227 <value type="int">8</value>
228 <value type="int">9</value>
228 <value type="int">9</value>
229 <value type="int">10</value>
229 <value type="int">10</value>
230 <value type="int">11</value>
230 <value type="int">11</value>
231 <value type="int">12</value>
231 <value type="int">12</value>
232 <value type="int">13</value>
232 <value type="int">13</value>
233 <value type="int">14</value>
233 <value type="int">14</value>
234 </valuelist>
234 </valuelist>
235 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
235 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
236 <value type="int" key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase">2</value>
236 <value type="int" key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase">2</value>
237 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">lppmon</value>
237 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">lppmon</value>
238 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
238 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
239 <valuelist type="QVariantList" key="ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges"/>
239 <valuelist type="QVariantList" key="ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges"/>
240 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
240 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
241 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run lppmon</value>
241 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run lppmon</value>
242 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
242 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
243 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
243 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
244 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
244 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
245 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
245 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
246 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
246 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
247 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
247 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
248 </valuemap>
248 </valuemap>
249 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
249 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
250 </valuemap>
250 </valuemap>
251 </data>
251 </data>
252 <data>
252 <data>
253 <variable>ProjectExplorer.Project.TargetCount</variable>
253 <variable>ProjectExplorer.Project.TargetCount</variable>
254 <value type="int">1</value>
254 <value type="int">1</value>
255 </data>
255 </data>
256 <data>
256 <data>
257 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
257 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
258 <value type="QString">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
258 <value type="QString">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
259 </data>
259 </data>
260 <data>
260 <data>
261 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
261 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
262 <value type="int">10</value>
262 <value type="int">10</value>
263 </data>
263 </data>
264 </qtcreator>
264 </qtcreator>
@@ -1,936 +1,923
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the LPPMON Software
3 -- Copyright (C) 2012, Laboratory of Plasma Physics - CNRS
3 -- Copyright (C) 2012, Laboratory of Plasma Physics - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Paul LEROY
19 /*-- Author : Paul LEROY
20 -- Mail : paul.leroy@lpp.polytechnique.fr
20 -- Mail : paul.leroy@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "rmapplugin.h"
22 #include "rmapplugin.h"
23 #include <QHostAddress>
23 #include <QHostAddress>
24 #include <QIODevice>
24 #include <QIODevice>
25 #include <QApplication>
25 #include <QApplication>
26 #include <rmappluginpythonwrapper.h>
26 #include <rmappluginpythonwrapper.h>
27
27
28 rmapplugin::rmapplugin(QWidget *parent)
28 rmapplugin::rmapplugin(QWidget *parent)
29 :lppmonplugin(parent,false)
29 :lppmonplugin(parent,false)
30 {
30 {
31 this->UI = new rmapPluginUI();
31 this->UI = new rmapPluginUI();
32 this->setWindowTitle(tr("RMAP and SPW Communication"));
32 this->setWindowTitle(tr("RMAP and SPW Communication"));
33 this->setWidget((QWidget*)this->UI);
33 this->setWidget((QWidget*)this->UI);
34 RMAPSend_SOCKET = new QTcpSocket;
34 RMAPSend_SOCKET = new QTcpSocket;
35 RMAPReceive_SOCKET = new QTcpSocket;
35 RMAPReceive_SOCKET = new QTcpSocket;
36 GRESBStatusQuery_SOCKET = new QTcpSocket;
36 GRESBStatusQuery_SOCKET = new QTcpSocket;
37 spwPacketReceiverOBJECT = new spwpacketreceiver;
37 spwPacketReceiverOBJECT = new spwpacketreceiver;
38 spwPacketReceiverOBJECT->gresbReceptionSocket = RMAPReceive_SOCKET;
38 spwPacketReceiverOBJECT->gresbReceptionSocket = RMAPReceive_SOCKET;
39 timeCode = 0;
39 timeCode = 0;
40 time_COARSE = 0;
40 time_COARSE = 0;
41 time_FINE = 0;
41 time_FINE = 0;
42 currentBridge = selectedBridgeIsUnknown;
42 currentBridge = selectedBridgeIsUnknown;
43
43
44 /*Python wrapper*/
44 /*Python wrapper*/
45 this->pyObject = new rmappluginPythonWrapper();
45 this->pyObject = new rmappluginPythonWrapper();
46 connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
46 connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
47 connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
47 connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
48 /*==============*/
48 /*==============*/
49
49
50 //connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(RMAP_CONNECT()));
51 //connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(RMAP_DISCONNECT()));
52 connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(openBridge()));
50 connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(openBridge()));
53 connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(closeBridge()));
51 connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(closeBridge()));
54 connect(RMAPSend_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPSendConnectionState(QAbstractSocket::SocketState)));
52 connect(RMAPSend_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPSendConnectionState(QAbstractSocket::SocketState)));
55 connect(RMAPReceive_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPReceiveConnectionState(QAbstractSocket::SocketState)));
53 connect(RMAPReceive_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPReceiveConnectionState(QAbstractSocket::SocketState)));
56 connect(GRESBStatusQuery_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(GRESBConnectionState(QAbstractSocket::SocketState)));
54 connect(GRESBStatusQuery_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(GRESBConnectionState(QAbstractSocket::SocketState)));
57 connect(UI->gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink()));
55 connect(UI->gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink()));
58 connect(this->UI->spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery()));
56 connect(this->UI->spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery()));
59 connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this->spwPacketReceiverOBJECT, SLOT(receiveSPWPacket()));
57 connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this->spwPacketReceiverOBJECT, SLOT(receiveSPWPacket()));
60
58
61 // CCSDS
59 // CCSDS
62 connect(this->UI->sendCCSDSCommandButton, SIGNAL(clicked()), this, SLOT(sendCCSDS()));
60 connect(this->UI->sendCCSDSCommandButton, SIGNAL(clicked()), this, SLOT(sendCCSDS()));
63 connect(this->UI->send_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(send_TC_LFR_UPDATE_TIME()));
61 connect(this->UI->send_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(send_TC_LFR_UPDATE_TIME()));
64 connect(this->UI->reset_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(reset_TC_LFR_UPDATE_TIME()));
62 connect(this->UI->reset_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(reset_TC_LFR_UPDATE_TIME()));
65
63
66 // CONSOLE
64 // CONSOLE
67 connect(this->spwPacketReceiverOBJECT, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
65 connect(this->spwPacketReceiverOBJECT, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
68 connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
66 connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
69
67
70 // spectralMAtricesDMASimulator
68 // spectralMAtricesDMASimulator
71 connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginRead(uint*,uint,uint)), this, SLOT(Read(uint*,uint,uint)));
69 connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginRead(uint*,uint,uint)), this, SLOT(Read(uint*,uint,uint)));
72 connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginWrite(uint*,uint,uint)), this, SLOT(Write(uint*,uint,uint)));
70 connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginWrite(uint*,uint,uint)), this, SLOT(Write(uint*,uint,uint)));
73 connect(this->UI->spectralMatricesDMASimulator, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
71 connect(this->UI->spectralMatricesDMASimulator, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
74
72
75 // GRESB
73 // GRESB
76 connect(this, SIGNAL(gresbIsOpen(bool)), this, SLOT(gresbSelection(bool)));
74 connect(this, SIGNAL(gresbIsOpen(bool)), this, SLOT(gresbSelection(bool)));
77
75
78 // Star Dundee
76 // Star Dundee
79 connect(this->UI->starDundee, SIGNAL(starDundeeIsOpen(bool)), this, SLOT(activatePluginViaStarDundee(bool)));
77 connect(this->UI->starDundee, SIGNAL(isOpen(bool)), this, SLOT(activatePluginViaStarDundee(bool)));
80 connect(this->UI->starDundee, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString)));
78 connect(this->UI->starDundee, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString)));
81 connect(this->UI->starDundee, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString)));
79 connect(this->UI->starDundee, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString)));
82
80
83 connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(bridgeHasChanged(selectedBridge)));
81 connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(bridgeHasChanged(selectedBridge)));
84 }
82 }
85
83
86 rmapplugin::~rmapplugin()
84 rmapplugin::~rmapplugin()
87 {
85 {
88 if (!RMAPSend_SOCKET->isOpen()) RMAPSend_SOCKET->disconnectFromHost();
86 if (!RMAPSend_SOCKET->isOpen()) RMAPSend_SOCKET->disconnectFromHost();
89 if (!RMAPReceive_SOCKET->isOpen()) RMAPReceive_SOCKET->disconnectFromHost();
87 if (!RMAPReceive_SOCKET->isOpen()) RMAPReceive_SOCKET->disconnectFromHost();
90 if (!GRESBStatusQuery_SOCKET->isOpen()) GRESBStatusQuery_SOCKET->disconnectFromHost();
88 if (!GRESBStatusQuery_SOCKET->isOpen()) GRESBStatusQuery_SOCKET->disconnectFromHost();
91 }
89 }
92
90
93 unsigned int rmapplugin::Write(unsigned int *Value, unsigned int count, unsigned int address)
91 unsigned int rmapplugin::Write(unsigned int *Value, unsigned int count, unsigned int address)
94 {
92 {
95 unsigned int result;
93 unsigned int result;
96 switch(currentBridge)
94 switch(currentBridge)
97 {
95 {
98 case selectedBridgeIsGRESB :
96 case selectedBridgeIsGRESB :
99 result = WriteGRESB(Value, count, address);
97 result = WriteGRESB(Value, count, address);
100 break;
98 break;
101 case selectedBridgeIsStarDundee :
99 case selectedBridgeIsStarDundee :
102 result = this->WriteStarDundee(Value, count, address);
100 result = UI->starDundee->Write(Value, count, address);
103 break;
101 break;
104 default:
102 default:
105 result = 1;
103 result = 1;
106 break;
104 break;
107 }
105 }
108 return result;
106 return result;
109 }
107 }
110
108
111 unsigned int rmapplugin::Read(unsigned int *Value, unsigned int count, unsigned int address)
109 unsigned int rmapplugin::Read(unsigned int *Value, unsigned int count, unsigned int address)
112 {
110 {
113 unsigned int result;
111 unsigned int result;
114 switch(currentBridge)
112 switch(currentBridge)
115 {
113 {
116 case selectedBridgeIsGRESB :
114 case selectedBridgeIsGRESB :
117 result = ReadGRESB(Value, count, address);
115 result = ReadGRESB(Value, count, address);
118 break;
116 break;
119 case selectedBridgeIsStarDundee :
117 case selectedBridgeIsStarDundee :
120 result = this->ReadStarDundee(Value, count, address);
118 result = UI->starDundee->Read(Value, count, address);
121 break;
119 break;
122 default:
120 default:
123 result = 1;
121 result = 1;
124 break;
122 break;
125 }
123 }
126 return result;
124 return result;
127 }
125 }
128
126
129 unsigned int rmapplugin::WriteGRESB(unsigned int *Value, unsigned int count, unsigned int address)
127 unsigned int rmapplugin::WriteGRESB(unsigned int *Value, unsigned int count, unsigned int address)
130 {
128 {
131 unsigned int remainingCount = count;
129 unsigned int remainingCount = count;
132 unsigned int iOffset = 0;
130 unsigned int iOffset = 0;
133 QString console_message;
131 QString console_message;
134 char* data;
132 char* data;
135
133
136 if(spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0)
134 if(spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0)
137 {
135 {
138 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped");
136 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped");
139 return 1;
137 return 1;
140 }
138 }
141
139
142 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: unavailable");
140 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: unavailable");
143
141
144 data = (char*) malloc(READ_WRITE_MAX_COUNTS*4);
142 data = (char*) malloc(READ_WRITE_MAX_COUNTS*4);
145
143
146 APPENDTOLOG(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16));
144 APPENDTOLOG(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16));
147
145
148 while (remainingCount > READ_WRITE_MAX_COUNTS)
146 while (remainingCount > READ_WRITE_MAX_COUNTS)
149 {
147 {
150 for (int i = 0; i<READ_WRITE_MAX_COUNTS; i++)
148 for (int i = 0; i<READ_WRITE_MAX_COUNTS; i++)
151 {
149 {
152 data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]);
150 data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]);
153 data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8);
151 data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8);
154 data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16);
152 data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16);
155 data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24);
153 data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24);
156 }
154 }
157
155
158 console_message.sprintf("remainingCount: %d => ", remainingCount);
156 console_message.sprintf("remainingCount: %d => ", remainingCount);
159 APPENDTOLOG(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16));
157 APPENDTOLOG(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16));
160
158
161 if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0)
159 if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0)
162 {
160 {
163 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP write command failed");
161 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP write command failed");
164 return 1;
162 return 1;
165 }
163 }
166
164
167 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
165 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
168 address = address + READ_WRITE_MAX_COUNTS * 4;
166 address = address + READ_WRITE_MAX_COUNTS * 4;
169 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
167 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
170 }
168 }
171
169
172 if (remainingCount > 0)
170 if (remainingCount > 0)
173 {
171 {
174 for (unsigned int i = 0; i<remainingCount; i++)
172 for (unsigned int i = 0; i<remainingCount; i++)
175 {
173 {
176 data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]);
174 data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]);
177 data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8);
175 data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8);
178 data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16);
176 data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16);
179 data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24);
177 data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24);
180 }
178 }
181
179
182 console_message.sprintf("remainingCount: %d => ", remainingCount);
180 console_message.sprintf("remainingCount: %d => ", remainingCount);
183 APPENDTOLOG(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16));
181 APPENDTOLOG(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16));
184
182
185 if (WriteBLOCK(data, remainingCount*4, address)==0)
183 if (WriteBLOCK(data, remainingCount*4, address)==0)
186 {
184 {
187 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP write command failed");
185 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP write command failed");
188 return 1;
186 return 1;
189 }
187 }
190 }
188 }
191
189
192 APPENDTOLOG(QString("*** STOP *** WRITE"));
190 APPENDTOLOG(QString("*** STOP *** WRITE"));
193 free(data);
191 free(data);
194 return count;
192 return count;
195 }
193 }
196
194
197 unsigned int rmapplugin::ReadGRESB(unsigned int *Value, unsigned int count, unsigned int address)
195 unsigned int rmapplugin::ReadGRESB(unsigned int *Value, unsigned int count, unsigned int address)
198 {
196 {
199 unsigned int remainingCount = count;
197 unsigned int remainingCount = count;
200 unsigned int iOffset = 0;
198 unsigned int iOffset = 0;
201 QString console_message;
199 QString console_message;
202
200
203 if(spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0)
201 if(spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0)
204 {
202 {
205 APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped");
203 APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped");
206 return 1;
204 return 1;
207 }
205 }
208 APPENDTOLOG(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16));
206 APPENDTOLOG(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16));
209
207
210 while (remainingCount > READ_WRITE_MAX_COUNTS)
208 while (remainingCount > READ_WRITE_MAX_COUNTS)
211 {
209 {
212 console_message.sprintf("remainingCount: %d => ", remainingCount);
210 console_message.sprintf("remainingCount: %d => ", remainingCount);
213 APPENDTOLOG(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16));
211 APPENDTOLOG(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16));
214
212
215 if (ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0)
213 if (ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0)
216 {
214 {
217 APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP packet not received");
215 APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP packet not received");
218 return 1;
216 return 1;
219 }
217 }
220
218
221 for(int i=0;i<READ_WRITE_MAX_COUNTS;i++)
219 for(int i=0;i<READ_WRITE_MAX_COUNTS;i++)
222 {
220 {
223 Value[i+iOffset] = (unsigned char) spwPacketReceiverOBJECT->rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH];
221 Value[i+iOffset] = (unsigned char) spwPacketReceiverOBJECT->rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH];
224 for(int j=1;j<4;j++)
222 for(int j=1;j<4;j++)
225 {
223 {
226 Value[i+iOffset]= ((unsigned char)(spwPacketReceiverOBJECT->rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256;
224 Value[i+iOffset]= ((unsigned char)(spwPacketReceiverOBJECT->rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256;
227 }
225 }
228 }
226 }
229
227
230 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
228 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
231 address = address + READ_WRITE_MAX_COUNTS * 4;
229 address = address + READ_WRITE_MAX_COUNTS * 4;
232 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
230 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
233 spwPacketReceiverOBJECT->acquireRMAPSemaphore();
231 spwPacketReceiverOBJECT->acquireRMAPSemaphore();
234 }
232 }
235
233
236 if (remainingCount > 0)
234 if (remainingCount > 0)
237 {
235 {
238 console_message.sprintf("remainingCount: %d => ", remainingCount);
236 console_message.sprintf("remainingCount: %d => ", remainingCount);
239 APPENDTOLOG(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16));
237 APPENDTOLOG(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16));
240
238
241 if (ReadBLOCK(4*remainingCount, address)==0)
239 if (ReadBLOCK(4*remainingCount, address)==0)
242 {
240 {
243 APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP packet not received");
241 APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP packet not received");
244 return 1;
242 return 1;
245 }
243 }
246
244
247 for(unsigned int i=0;i<remainingCount;i++)
245 for(unsigned int i=0;i<remainingCount;i++)
248 {
246 {
249 Value[i+iOffset] = (unsigned char) spwPacketReceiverOBJECT->rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH];
247 Value[i+iOffset] = (unsigned char) spwPacketReceiverOBJECT->rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH];
250 for(int j=1;j<4;j++)
248 for(int j=1;j<4;j++)
251 {
249 {
252 Value[i+iOffset]= ((unsigned char)(spwPacketReceiverOBJECT->rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256;
250 Value[i+iOffset]= ((unsigned char)(spwPacketReceiverOBJECT->rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256;
253 }
251 }
254 }
252 }
255 spwPacketReceiverOBJECT->acquireRMAPSemaphore();
253 spwPacketReceiverOBJECT->acquireRMAPSemaphore();
256 }
254 }
257
255
258 APPENDTOLOG(QString("*** STOP *** READ "));
256 APPENDTOLOG(QString("*** STOP *** READ "));
259 return count;
257 return count;
260 }
258 }
261
259
262 unsigned int rmapplugin::WriteBLOCK(char *data, unsigned int nbBytes, unsigned int address)
260 unsigned int rmapplugin::WriteBLOCK(char *data, unsigned int nbBytes, unsigned int address)
263 {
261 {
264 QTime RMAPTimeout;
262 QTime RMAPTimeout;
265 RMAP *RMAPCommand;
263 RMAP *RMAPCommand;
266 int errorCode;
264 int errorCode;
267 QString console_message;
265 QString console_message;
268
266
269 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1)
267 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1)
270 {
268 {
271 RMAP_DISCONNECT();
269 RMAP_DISCONNECT();
272 return 1;
270 return 1;
273 }
271 }
274
272
275 RMAPCommand = new RMAP(UI->getCommandCode(),
273 RMAPCommand = new RMAP(UI->getCommandCode(),
276 UI->rmapTargetLogicalAddressSpinBox->value(),
274 UI->rmapTargetLogicalAddressSpinBox->value(),
277 UI->rmapSourceLogicalAddressSpinBox->value(),
275 UI->rmapSourceLogicalAddressSpinBox->value(),
278 address,
276 address,
279 nbBytes,
277 nbBytes,
280 data);
278 data);
281
279
282 // SEND GRESB HEADER
280 // SEND GRESB HEADER
283 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4);
281 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4);
284 // SEND SPACEWIRE PACKET HEADER
282 // SEND SPACEWIRE PACKET HEADER
285 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader));
283 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader));
286 // SEND DATA
284 // SEND DATA
287 RMAPSend_SOCKET->write( data, nbBytes);
285 RMAPSend_SOCKET->write( data, nbBytes);
288 // SEND DATA CRC
286 // SEND DATA CRC
289 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->dataCRC), 1);
287 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->dataCRC), 1);
290 RMAPTimeout.start();
288 RMAPTimeout.start();
291 while(RMAPSend_SOCKET->bytesToWrite() > 0)
289 while(RMAPSend_SOCKET->bytesToWrite() > 0)
292 {
290 {
293 RMAPSend_SOCKET->waitForBytesWritten(100);
291 RMAPSend_SOCKET->waitForBytesWritten(100);
294 if(RMAPTimeout.elapsed()>1000)
292 if(RMAPTimeout.elapsed()>1000)
295 {
293 {
296 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** sending Write RMAP Command timeout");
294 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** sending Write RMAP Command timeout");
297 return 0;
295 return 0;
298 }
296 }
299 }
297 }
300
298
301 if (UI->RMAP_write_reply->isChecked())
299 if (UI->RMAP_write_reply->isChecked())
302 {
300 {
303 // WAIT FOR THE RMAP REPLY PACKET
301 // WAIT FOR THE RMAP REPLY PACKET
304 errorCode = spwPacketReceiverOBJECT->receiveSPWPacket(1);
302 errorCode = spwPacketReceiverOBJECT->receiveSPWPacket(1);
305 if (errorCode<=0)
303 if (errorCode<=0)
306 {
304 {
307 APPENDTOLOG("WARNING === in function WriteBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode));
305 APPENDTOLOG("WARNING === in function WriteBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode));
308 return 0;
306 return 0;
309 }
307 }
310 if(spwPacketReceiverOBJECT->rmapPacketSize != 8)
308 if(spwPacketReceiverOBJECT->rmapPacketSize != 8)
311 {
309 {
312 console_message.sprintf("WARNING === in function WRITE (with reply) of rmapplugin *** write reply format not compliant\n");
310 console_message.sprintf("WARNING === in function WRITE (with reply) of rmapplugin *** write reply format not compliant\n");
313 APPENDTOLOG(console_message);
311 APPENDTOLOG(console_message);
314 return 0;
312 return 0;
315 }
313 }
316 switch (spwPacketReceiverOBJECT->rmapPacket[3]) // byte 4 is the status byte in the reply
314 switch (spwPacketReceiverOBJECT->rmapPacket[3]) // byte 4 is the status byte in the reply
317 {
315 {
318 case 0:
316 case 0:
319 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 0 Successfull");
317 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 0 Successfull");
320 break;
318 break;
321 case 1:
319 case 1:
322 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** General error code");
320 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** General error code");
323 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 1 General error code");
321 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 1 General error code");
324 break;
322 break;
325 case 2:
323 case 2:
326 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Unused RMAP packet type or command code");
324 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Unused RMAP packet type or command code");
327 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 2 Unused RMAP packet type or command code");
325 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 2 Unused RMAP packet type or command code");
328 break;
326 break;
329 case 3:
327 case 3:
330 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid key");
328 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid key");
331 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 3 Invalid key");
329 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 3 Invalid key");
332 break;
330 break;
333 case 4:
331 case 4:
334 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid data CRC");
332 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid data CRC");
335 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 4 Invalid data CRC");
333 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 4 Invalid data CRC");
336 break;
334 break;
337 case 5:
335 case 5:
338 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Early EOP");
336 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Early EOP");
339 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 5 Early EOP");
337 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 5 Early EOP");
340 break;
338 break;
341 case 6:
339 case 6:
342 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Too much data");
340 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Too much data");
343 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 6 Too much data");
341 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 6 Too much data");
344 break;
342 break;
345 case 7:
343 case 7:
346 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** EEP");
344 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** EEP");
347 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 7 EEP");
345 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 7 EEP");
348 break;
346 break;
349 case 8:
347 case 8:
350 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Reserved");
348 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Reserved");
351 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 8 Reserved");
349 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 8 Reserved");
352 break;
350 break;
353 case 9:
351 case 9:
354 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Verify buffer overrun");
352 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Verify buffer overrun");
355 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 9 Verify buffer overrun");
353 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 9 Verify buffer overrun");
356 break;
354 break;
357 case 10:
355 case 10:
358 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** RMAP command not implemented or not authorised");
356 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** RMAP command not implemented or not authorised");
359 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 10 RMAP command not implemented or not authorised");
357 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 10 RMAP command not implemented or not authorised");
360 break;
358 break;
361 case 11:
359 case 11:
362 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** RMW data length error");
360 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** RMW data length error");
363 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 11 RMAP RMW data length error");
361 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 11 RMAP RMW data length error");
364 break;
362 break;
365 case 12:
363 case 12:
366 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid target logical address");
364 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid target logical address");
367 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 12 Invalid target logical address");
365 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 12 Invalid target logical address");
368 break;
366 break;
369 }
367 }
370 spwPacketReceiverOBJECT->acquireRMAPSemaphore();
368 spwPacketReceiverOBJECT->acquireRMAPSemaphore();
371 }
369 }
372 return nbBytes;
370 return nbBytes;
373 }
371 }
374
372
375 unsigned int rmapplugin::ReadBLOCK(unsigned int nbBytes, unsigned int address)
373 unsigned int rmapplugin::ReadBLOCK(unsigned int nbBytes, unsigned int address)
376 {
374 {
377 int errorCode;
375 int errorCode;
378 RMAP *RMAPCommand;
376 RMAP *RMAPCommand;
379 QTime RMAPTimeout;
377 QTime RMAPTimeout;
380 unsigned int dataLength;
378 unsigned int dataLength;
381 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1)
379 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1)
382 {
380 {
383 RMAP_DISCONNECT();
381 RMAP_DISCONNECT();
384 return 1;
382 return 1;
385 }
383 }
386
384
387 if (nbBytes > 4)
385 if (nbBytes > 4)
388 {
386 {
389 RMAPCommand = new RMAP(read_Inc,
387 RMAPCommand = new RMAP(read_Inc,
390 UI->rmapTargetLogicalAddressSpinBox->value(),
388 UI->rmapTargetLogicalAddressSpinBox->value(),
391 UI->rmapSourceLogicalAddressSpinBox->value(),
389 UI->rmapSourceLogicalAddressSpinBox->value(),
392 address,
390 address,
393 nbBytes,
391 nbBytes,
394 NULL);
392 NULL);
395 }
393 }
396 else
394 else
397 {
395 {
398 RMAPCommand = new RMAP(read_Single,
396 RMAPCommand = new RMAP(read_Single,
399 UI->rmapTargetLogicalAddressSpinBox->value(),
397 UI->rmapTargetLogicalAddressSpinBox->value(),
400 UI->rmapSourceLogicalAddressSpinBox->value(),
398 UI->rmapSourceLogicalAddressSpinBox->value(),
401 address,
399 address,
402 nbBytes,
400 nbBytes,
403 NULL);
401 NULL);
404 }
402 }
405
403
406 // SEND THE GRESB HEADER FOR THE RMAP READ COMMAND
404 // SEND THE GRESB HEADER FOR THE RMAP READ COMMAND
407 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4);
405 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4);
408 // SEND THE SPACEWIRE PACKET FOR THE RMAP READ COMMAND
406 // SEND THE SPACEWIRE PACKET FOR THE RMAP READ COMMAND
409 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader));
407 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader));
410 RMAPSend_SOCKET->waitForBytesWritten(100);
408 RMAPSend_SOCKET->waitForBytesWritten(100);
411 RMAPTimeout.start();
409 RMAPTimeout.start();
412 // write timeout
410 // write timeout
413 while(RMAPSend_SOCKET->bytesToWrite() > 0)
411 while(RMAPSend_SOCKET->bytesToWrite() > 0)
414 {
412 {
415 RMAPSend_SOCKET->waitForBytesWritten(100);
413 RMAPSend_SOCKET->waitForBytesWritten(100);
416 if(RMAPTimeout.elapsed()>1000)
414 if(RMAPTimeout.elapsed()>1000)
417 {
415 {
418 APPENDTOLOG("WARNING === in function READ of rmapplugin *** sending Read RMAP Command timeout\n");
416 APPENDTOLOG("WARNING === in function READ of rmapplugin *** sending Read RMAP Command timeout\n");
419 return 0;
417 return 0;
420 }
418 }
421 }
419 }
422
420
423 // RECEIVE THE INCOMING RMAP PACKET
421 // RECEIVE THE INCOMING RMAP PACKET
424 errorCode = spwPacketReceiverOBJECT->receiveSPWPacket(1); // request ID 1 is for RMAP packet
422 errorCode = spwPacketReceiverOBJECT->receiveSPWPacket(1); // request ID 1 is for RMAP packet
425 if (errorCode<=0)
423 if (errorCode<=0)
426 {
424 {
427 APPENDTOLOG("WARNING === in function ReadBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode));
425 APPENDTOLOG("WARNING === in function ReadBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode));
428 return 0;
426 return 0;
429 }
427 }
430 dataLength = spwPacketReceiverOBJECT->rmapPacketSize - RMAP_READ_REPLY_HEADER_LENGTH - RMAP_DATA_CRC_LENGTH;
428 dataLength = spwPacketReceiverOBJECT->rmapPacketSize - RMAP_READ_REPLY_HEADER_LENGTH - RMAP_DATA_CRC_LENGTH;
431 if(dataLength != nbBytes)
429 if(dataLength != nbBytes)
432 {
430 {
433 APPENDTOLOG("WARNING === in function READ of rmapplugin *** number of data received ("
431 APPENDTOLOG("WARNING === in function READ of rmapplugin *** number of data received ("
434 +QString::number(dataLength)
432 +QString::number(dataLength)
435 +") not equal to number of data requested ("
433 +") not equal to number of data requested ("
436 +QString::number(READ_WRITE_MAX_COUNTS*4)
434 +QString::number(READ_WRITE_MAX_COUNTS*4)
437 +")");
435 +")");
438 return 0;
436 return 0;
439 }
437 }
440 return dataLength;
438 return dataLength;
441 }
439 }
442
440
443 unsigned int rmapplugin::WriteStarDundee(unsigned int *Value, unsigned int count, unsigned int address)
444 {
445 unsigned int result;
446 result = UI->starDundee->WriteStarDundee(Value, count, address);
447 return result;
448 }
449
450 unsigned int rmapplugin::ReadStarDundee(unsigned int *Value, unsigned int count, unsigned int address)
451 {
452 unsigned int result;
453 result = UI->starDundee->ReadStarDundee(Value, count, address);
454 return result;
455 }
456
457 ////////
441 ////////
458 // SLOTS
442 // SLOTS
459
443
460 unsigned int rmapplugin::WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) // SLOT
444 unsigned int rmapplugin::WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) // SLOT
461 {
445 {
446 unsigned int result;
447 switch(currentBridge)
448 {
449 case selectedBridgeIsGRESB :
450 result = WriteSPWGRESB(Value, count, targetLogicalAddress, userApplication);
451 break;
452 case selectedBridgeIsStarDundee :
453 result = UI->starDundee->WriteSPW(Value, count, targetLogicalAddress, userApplication);
454 break;
455 default:
456 result = 1;
457 break;
458 }
459 return result;
460 }
461
462 unsigned int rmapplugin::WriteSPWGRESB(char *Value, unsigned int count, char targetLogicalAddress, char userApplication)
463 {
462 char protocoleIdentifier = 0x02;
464 char protocoleIdentifier = 0x02;
463 char reserved = 0x00;
465 char reserved = 0x00;
464 char gresbProtocole = 0x00;
466 char gresbProtocole = 0x00;
465 unsigned char size[3];
467 unsigned char size[3];
466 unsigned int spwPacketSize = count + 4;
468 unsigned int spwPacketSize = count + 4;
467 QTime SPWTimeout;
469 QTime SPWTimeout;
468
470
469 if (count>248)
471 if (count>248)
470 {
472 {
471 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** CCSDS packet size > 248 bytes\n");
473 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** CCSDS packet size > 248 bytes\n");
472 return 1;
474 return 1;
473 }
475 }
474
476
475 APPENDTOLOG(QString("*** START *** Send CCSDS packet of ")+ QString::number(count) + QString(" byte(s)"));
477 APPENDTOLOG(QString("*** START *** Send CCSDS packet of ")+ QString::number(count) + QString(" byte(s)"));
476
478
477 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1)
479 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1)
478 {
480 {
479 RMAP_DISCONNECT();
481 RMAP_DISCONNECT();
480 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** SPW link not running\n");
482 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** SPW link not running\n");
481 return 1;
483 return 1;
482 }
484 }
483
485
484 // SEND GRESB HEADER
486 // SEND GRESB HEADER
485 size[0] = (unsigned char) ((unsigned int) spwPacketSize>>16);
487 size[0] = (unsigned char) ((unsigned int) spwPacketSize>>16);
486 size[1] = (unsigned char) ((unsigned int) spwPacketSize>>8);
488 size[1] = (unsigned char) ((unsigned int) spwPacketSize>>8);
487 size[2] = (unsigned char) ((unsigned int) spwPacketSize);
489 size[2] = (unsigned char) ((unsigned int) spwPacketSize);
488 RMAPSend_SOCKET->write(&gresbProtocole, 1);
490 RMAPSend_SOCKET->write(&gresbProtocole, 1);
489 RMAPSend_SOCKET->write((char*) size, 3);
491 RMAPSend_SOCKET->write((char*) size, 3);
490 // SEND SPW HEADER
492 // SEND SPW HEADER
491 RMAPSend_SOCKET->write(&targetLogicalAddress, 1);
493 RMAPSend_SOCKET->write(&targetLogicalAddress, 1);
492 RMAPSend_SOCKET->write(&protocoleIdentifier, 1);
494 RMAPSend_SOCKET->write(&protocoleIdentifier, 1);
493 RMAPSend_SOCKET->write(&reserved, 1);
495 RMAPSend_SOCKET->write(&reserved, 1);
494 RMAPSend_SOCKET->write(&userApplication, 1);
496 RMAPSend_SOCKET->write(&userApplication, 1);
495 // SEND CCSDS PACKET
497 // SEND CCSDS PACKET
496 RMAPSend_SOCKET->write(Value, count);
498 RMAPSend_SOCKET->write(Value, count);
497 SPWTimeout.start();
499 SPWTimeout.start();
498 while(RMAPSend_SOCKET->bytesToWrite() > 0)
500 while(RMAPSend_SOCKET->bytesToWrite() > 0)
499 {
501 {
500 RMAPSend_SOCKET->waitForBytesWritten(100);
502 RMAPSend_SOCKET->waitForBytesWritten(100);
501 if(SPWTimeout.elapsed()>1000)
503 if(SPWTimeout.elapsed()>1000)
502 {
504 {
503 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** sending CCSDS packet timeout\n");
505 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** sending CCSDS packet timeout\n");
504 return 1;
506 return 1;
505 }
507 }
506 }
508 }
507
509
508 APPENDTOLOG(QString("*** CCSDS packet sent"));
510 APPENDTOLOG(QString("*** CCSDS packet sent"));
509
511
510 return count;
512 return count;
511 }
513 }
512
514
513 void rmapplugin::sendCCSDS() // SLOT
515 void rmapplugin::sendCCSDS() // SLOT
514 {
516 {
515 unsigned int nbBYTES_application_data = 8;
517 unsigned int nbBYTES_application_data = 8;
516 unsigned int count;
518 unsigned int count;
517 char *tab;
519 char *tab;
518 unsigned char packetErrorControl1 = 0xaa;
520 unsigned char packetErrorControl1 = 0xaa;
519 unsigned char packetErrorControl0 = 0xbb;
521 unsigned char packetErrorControl0 = 0xbb;
520
522
521 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
523 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
522 /* unsigned char data_field_header,
524 /* unsigned char data_field_header,
523 unsigned char processID,
525 unsigned char processID,
524 unsigned int sequence_count,
526 unsigned int sequence_count,
525 unsigned int packet_length,
527 unsigned int packet_length,
526 unsigned char acceptance,
528 unsigned char acceptance,
527 unsigned int completion,
529 unsigned int completion,
528 unsigned char service_type,
530 unsigned char service_type,
529 unsigned char service_subtype,
531 unsigned char service_subtype,
530 unsigned char sourceID*/
532 unsigned char sourceID*/
531
533
532 count = nbBYTES_application_data+12; // 12 is the size in bytes of the header
534 count = nbBYTES_application_data+12; // 12 is the size in bytes of the header
533 tab = (char*) malloc(count);
535 tab = (char*) malloc(count);
534 tab[0] = ccsds_command->ccsds_header->packetId1;
536 tab[0] = ccsds_command->ccsds_header->packetId1;
535 tab[1] = ccsds_command->ccsds_header->packetId0;
537 tab[1] = ccsds_command->ccsds_header->packetId0;
536 tab[2] = ccsds_command->ccsds_header->packetSequenceControl1;
538 tab[2] = ccsds_command->ccsds_header->packetSequenceControl1;
537 tab[3] = ccsds_command->ccsds_header->packetSequenceControl0;
539 tab[3] = ccsds_command->ccsds_header->packetSequenceControl0;
538 tab[4] = ccsds_command->ccsds_header->packetLength1;
540 tab[4] = ccsds_command->ccsds_header->packetLength1;
539 tab[5] = ccsds_command->ccsds_header->packetLength0;
541 tab[5] = ccsds_command->ccsds_header->packetLength0;
540 tab[6] = ccsds_command->ccsds_header->dataFieldHeader3;
542 tab[6] = ccsds_command->ccsds_header->dataFieldHeader3;
541 tab[7] = ccsds_command->ccsds_header->dataFieldHeader2;
543 tab[7] = ccsds_command->ccsds_header->dataFieldHeader2;
542 tab[8] = ccsds_command->ccsds_header->dataFieldHeader1;
544 tab[8] = ccsds_command->ccsds_header->dataFieldHeader1;
543 tab[9] = ccsds_command->ccsds_header->dataFieldHeader0;
545 tab[9] = ccsds_command->ccsds_header->dataFieldHeader0;
544 tab[10]=0x00;
546 tab[10]=0x00;
545 tab[11]=0x00;
547 tab[11]=0x00;
546 tab[12]=0x00;
548 tab[12]=0x00;
547 tab[13]=0x00;
549 tab[13]=0x00;
548 tab[14]=0x00;
550 tab[14]=0x00;
549 tab[15]=0x00;
551 tab[15]=0x00;
550 tab[nbBYTES_application_data+10] = packetErrorControl1;
552 tab[nbBYTES_application_data+10] = packetErrorControl1;
551 tab[nbBYTES_application_data+11] = packetErrorControl0;
553 tab[nbBYTES_application_data+11] = packetErrorControl0;
552
554
553 WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00);
555 WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00);
554
556
555 free(tab);
557 free(tab);
556 }
558 }
557
559
558 void rmapplugin::send_TC_LFR_UPDATE_TIME()
560 void rmapplugin::send_TC_LFR_UPDATE_TIME()
559 {
561 {
560 unsigned int nbBYTES_application_data = 6; // Time at CUC format is on 48 bits / 6 bytes
562 unsigned int nbBYTES_application_data = 6; // Time at CUC format is on 48 bits / 6 bytes
561 unsigned int count;
563 unsigned int count;
562 char *tab;
564 char *tab;
563 unsigned char packetErrorControl1 = 0xaa;
565 unsigned char packetErrorControl1 = 0xaa;
564 unsigned char packetErrorControl0 = 0xbb;
566 unsigned char packetErrorControl0 = 0xbb;
565
567
566 ccsds_command = new ccsds(1, 11, 0, nbBYTES_application_data, 1, 1, 9, 129, 0);
568 ccsds_command = new ccsds(1, 11, 0, nbBYTES_application_data, 1, 1, 9, 129, 0);
567 /* unsigned char data_field_header,
569 /* unsigned char data_field_header,
568 unsigned char processID,
570 unsigned char processID,
569 unsigned int sequence_count,
571 unsigned int sequence_count,
570 unsigned int packet_length,
572 unsigned int packet_length,
571 unsigned char acceptance,
573 unsigned char acceptance,
572 unsigned int completion,
574 unsigned int completion,
573 unsigned char service_type,
575 unsigned char service_type,
574 unsigned char service_subtype,
576 unsigned char service_subtype,
575 unsigned char sourceID*/
577 unsigned char sourceID*/
576
578
577 count = nbBYTES_application_data+12; // +12 => packet header 6 bytes + data field header 4 bytes + packet error control 2 bytes
579 count = nbBYTES_application_data+12; // +12 => packet header 6 bytes + data field header 4 bytes + packet error control 2 bytes
578 tab = (char*) malloc(count);
580 tab = (char*) malloc(count);
579 tab[0] = ccsds_command->ccsds_header->packetId1;
581 tab[0] = ccsds_command->ccsds_header->packetId1;
580 tab[1] = ccsds_command->ccsds_header->packetId0;
582 tab[1] = ccsds_command->ccsds_header->packetId0;
581 tab[2] = ccsds_command->ccsds_header->packetSequenceControl1;
583 tab[2] = ccsds_command->ccsds_header->packetSequenceControl1;
582 tab[3] = ccsds_command->ccsds_header->packetSequenceControl0;
584 tab[3] = ccsds_command->ccsds_header->packetSequenceControl0;
583 tab[4] = ccsds_command->ccsds_header->packetLength1;
585 tab[4] = ccsds_command->ccsds_header->packetLength1;
584 tab[5] = ccsds_command->ccsds_header->packetLength0;
586 tab[5] = ccsds_command->ccsds_header->packetLength0;
585 tab[6] = ccsds_command->ccsds_header->dataFieldHeader3;
587 tab[6] = ccsds_command->ccsds_header->dataFieldHeader3;
586 tab[7] = ccsds_command->ccsds_header->dataFieldHeader2;
588 tab[7] = ccsds_command->ccsds_header->dataFieldHeader2;
587 tab[8] = ccsds_command->ccsds_header->dataFieldHeader1;
589 tab[8] = ccsds_command->ccsds_header->dataFieldHeader1;
588 tab[9] = ccsds_command->ccsds_header->dataFieldHeader0;
590 tab[9] = ccsds_command->ccsds_header->dataFieldHeader0;
589 tab[10] = (unsigned char) (time_COARSE>>24);
591 tab[10] = (unsigned char) (time_COARSE>>24);
590 tab[11] = (unsigned char) (time_COARSE>>18);
592 tab[11] = (unsigned char) (time_COARSE>>18);
591 tab[12] = (unsigned char) (time_COARSE>>8);
593 tab[12] = (unsigned char) (time_COARSE>>8);
592 tab[13] = (unsigned char) (time_COARSE);
594 tab[13] = (unsigned char) (time_COARSE);
593 tab[14] = (unsigned char) (time_FINE>>8);
595 tab[14] = (unsigned char) (time_FINE>>8);
594 tab[15] = (unsigned char) (time_FINE);
596 tab[15] = (unsigned char) (time_FINE);
595 tab[nbBYTES_application_data+10] = packetErrorControl1;
597 tab[nbBYTES_application_data+10] = packetErrorControl1;
596 tab[nbBYTES_application_data+11] = packetErrorControl0;
598 tab[nbBYTES_application_data+11] = packetErrorControl0;
597
599
598 WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00);
600 WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00);
599
601
600 time_COARSE = time_COARSE+1;
602 time_COARSE = time_COARSE+1;
601
603
602 free(tab);
604 free(tab);
603 }
605 }
604
606
605 void rmapplugin::reset_TC_LFR_UPDATE_TIME()
607 void rmapplugin::reset_TC_LFR_UPDATE_TIME()
606 {
608 {
607 time_COARSE = 0;
609 time_COARSE = 0;
608 time_FINE = 0;
610 time_FINE = 0;
609 }
611 }
610
612
611 void rmapplugin::openBridge()
613 void rmapplugin::openBridge()
612 {
614 {
613 switch(currentBridge)
615 switch(currentBridge)
614 {
616 {
615 case selectedBridgeIsGRESB :
617 case selectedBridgeIsGRESB :
616 RMAP_CONNECT();
618 RMAP_CONNECT();
617 break;
619 break;
618 case selectedBridgeIsStarDundee :
620 case selectedBridgeIsStarDundee :
619 this->UI->starDundee->OpenStarDundee();
621 this->UI->starDundee->Open();
620 break;
622 break;
621 default:
623 default:
622 break;
624 break;
623 }
625 }
624 }
626 }
625
627
626 void rmapplugin::closeBridge()
628 void rmapplugin::closeBridge()
627 {
629 {
628 switch(currentBridge)
630 switch(currentBridge)
629 {
631 {
630 case selectedBridgeIsGRESB :
632 case selectedBridgeIsGRESB :
631 RMAP_DISCONNECT();
633 RMAP_DISCONNECT();
632 break;
634 break;
633 case selectedBridgeIsStarDundee :
635 case selectedBridgeIsStarDundee :
634 this->UI->starDundee->CloseStarDundee();
636 this->UI->starDundee->Close();
635 break;
637 break;
636 default:
638 default:
637 break;
639 break;
638 }
640 }
639 }
641 }
640
642
641 void rmapplugin::RMAP_CONNECT() // SLOT
643 void rmapplugin::RMAP_CONNECT() // SLOT
642 {
644 {
643 bool spwRunning = true;
645 bool spwRunning = true;
644 RMAPSend_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()),
646 RMAPSend_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()),
645 3000 + UI->gresbVirtualLinkSpinBox->value()*2,
647 3000 + UI->gresbVirtualLinkSpinBox->value()*2,
646 QIODevice::WriteOnly);
648 QIODevice::WriteOnly);
647 RMAPReceive_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()),
649 RMAPReceive_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()),
648 3000 + UI->gresbVirtualLinkSpinBox->value()*2+1,
650 3000 + UI->gresbVirtualLinkSpinBox->value()*2+1,
649 QIODevice::ReadOnly);
651 QIODevice::ReadOnly);
650 GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()),
652 GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()),
651 3010,
653 3010,
652 QIODevice::ReadWrite);
654 QIODevice::ReadWrite);
653 GRESBStatusQuery_SOCKET->waitForConnected(10000);
655 GRESBStatusQuery_SOCKET->waitForConnected(10000);
654 RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket
656 RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket
655 // initialize SPW packet semaphores
657 // initialize SPW packet semaphores
656 while (spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->acquire();
658 while (spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->acquire();
657 while (spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->acquire();
659 while (spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->acquire();
658 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) != 0)
660 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) != 0)
659 {
661 {
660 spwRunning = UI->gresbStatusQueryDialog->exec();
662 spwRunning = UI->gresbStatusQueryDialog->exec();
661 }
663 }
662 if (spwRunning == false) RMAP_DISCONNECT();
664 if (spwRunning == false) RMAP_DISCONNECT();
663 else
665 else
664 {
666 {
665 APPENDTOLOG(QString("SpaceWire running on virtual link ")+ QString::number(UI->spwLinkSpinBox->value()));
667 APPENDTOLOG(QString("SpaceWire running on virtual link ")+ QString::number(UI->spwLinkSpinBox->value()));
666 emit this->activateSig(true);
668 emit this->activateSig(true);
667 emit gresbIsOpen(true);
669 emit gresbIsOpen(true);
668 }
670 }
669 }
671 }
670
672
671 void rmapplugin::RMAP_DISCONNECT() // SLOT
673 void rmapplugin::RMAP_DISCONNECT() // SLOT
672 {
674 {
673 RMAPSend_SOCKET->disconnectFromHost();
675 RMAPSend_SOCKET->disconnectFromHost();
674 RMAPReceive_SOCKET->disconnectFromHost();
676 RMAPReceive_SOCKET->disconnectFromHost();
675 GRESBStatusQuery_SOCKET->disconnectFromHost();
677 GRESBStatusQuery_SOCKET->disconnectFromHost();
676 emit this->activateSig(false);
678 emit this->activateSig(false);
677 emit gresbIsOpen(false);
679 emit gresbIsOpen(false);
678 }
680 }
679
681
680 void rmapplugin::RMAPSendConnectionState(QAbstractSocket::SocketState socketState) // SLOT
682 void rmapplugin::RMAPSendConnectionState(QAbstractSocket::SocketState socketState) // SLOT
681 {
683 {
682 UI->rmapSendStateLabel->setText("");
684 UI->rmapSendStateLabel->setText("");
683 QString socketMessage = "RMAP Send Socket State: ";
685 QString socketMessage = "RMAP Send Socket State: ";
684 switch(socketState)
686 switch(socketState)
685 {
687 {
686 case QAbstractSocket::UnconnectedState :
688 case QAbstractSocket::UnconnectedState :
687 socketMessage.append("0 => Unconnected");
689 socketMessage.append("0 => Unconnected");
688 UI->rmapOpenCommunicationButton->setEnabled(true);
690 UI->rmapOpenCommunicationButton->setEnabled(true);
689 UI->rmapCloseCommunicationButton->setEnabled(false);
691 UI->rmapCloseCommunicationButton->setEnabled(false);
690 emit this->activateSig(false);
692 emit this->activateSig(false);
691 break;
693 break;
692 case 1:
694 case 1:
693 socketMessage.append("1 => HostLookup");
695 socketMessage.append("1 => HostLookup");
694 break;
696 break;
695 case 2:
697 case 2:
696 socketMessage.append("2 => Connecting");
698 socketMessage.append("2 => Connecting");
697 break;
699 break;
698 case 3:
700 case 3:
699 socketMessage.append("3 => Connected");
701 socketMessage.append("3 => Connected");
700 UI->rmapOpenCommunicationButton->setEnabled(false);
702 UI->rmapOpenCommunicationButton->setEnabled(false);
701 UI->rmapCloseCommunicationButton->setEnabled(true);
703 UI->rmapCloseCommunicationButton->setEnabled(true);
702 break;
704 break;
703 case 4:
705 case 4:
704 socketMessage.append("4 => Bound");
706 socketMessage.append("4 => Bound");
705 break;
707 break;
706 case 5:
708 case 5:
707 socketMessage.append("5 => Closing");
709 socketMessage.append("5 => Closing");
708 break;
710 break;
709 case 6:
711 case 6:
710 socketMessage.append("6 => Listening");
712 socketMessage.append("6 => Listening");
711 break;
713 break;
712 }
714 }
713 UI->rmapSendStateLabel->setText(socketMessage);
715 UI->rmapSendStateLabel->setText(socketMessage);
714 APPENDTOLOG(socketMessage);
716 APPENDTOLOG(socketMessage);
715 }
717 }
716
718
717 void rmapplugin::RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState) // SLOT
719 void rmapplugin::RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState) // SLOT
718 {
720 {
719 UI->rmapReceiveStateLabel->setText("");
721 UI->rmapReceiveStateLabel->setText("");
720 QString socketMessage = "RMAP Receive Socket State: ";
722 QString socketMessage = "RMAP Receive Socket State: ";
721 switch(socketState)
723 switch(socketState)
722 {
724 {
723 case QAbstractSocket::UnconnectedState :
725 case QAbstractSocket::UnconnectedState :
724 socketMessage.append("0 => Unconnected");
726 socketMessage.append("0 => Unconnected");
725 break;
727 break;
726 case 1:
728 case 1:
727 socketMessage.append("1 => HostLookup");
729 socketMessage.append("1 => HostLookup");
728 break;
730 break;
729 case 2:
731 case 2:
730 socketMessage.append("2 => Connecting");
732 socketMessage.append("2 => Connecting");
731 break;
733 break;
732 case 3:
734 case 3:
733 socketMessage.append("3 => Connected");
735 socketMessage.append("3 => Connected");
734 break;
736 break;
735 case 4:
737 case 4:
736 socketMessage.append("4 => Bound");
738 socketMessage.append("4 => Bound");
737 break;
739 break;
738 case 5:
740 case 5:
739 socketMessage.append("5 => Closing");
741 socketMessage.append("5 => Closing");
740 break;
742 break;
741 case 6:
743 case 6:
742 socketMessage.append("6 => Listening");
744 socketMessage.append("6 => Listening");
743 break;
745 break;
744 }
746 }
745 UI->rmapReceiveStateLabel->setText(socketMessage);
747 UI->rmapReceiveStateLabel->setText(socketMessage);
746 APPENDTOLOG(socketMessage);
748 APPENDTOLOG(socketMessage);
747 }
749 }
748
750
749 void rmapplugin::GRESBConnectionState(QAbstractSocket::SocketState socketState) // SLOT
751 void rmapplugin::GRESBConnectionState(QAbstractSocket::SocketState socketState) // SLOT
750 {
752 {
751 UI->gresbStatusQueryLabel->setText("");
753 UI->gresbStatusQueryLabel->setText("");
752 QString socketMessage = "GRESB status query socket (port 3010): ";
754 QString socketMessage = "GRESB status query socket (port 3010): ";
753 switch(socketState)
755 switch(socketState)
754 {
756 {
755 case QAbstractSocket::UnconnectedState :
757 case QAbstractSocket::UnconnectedState :
756 socketMessage.append("0 => Unconnected");
758 socketMessage.append("0 => Unconnected");
757 break;
759 break;
758 case 1:
760 case 1:
759 socketMessage.append("1 => HostLookup");
761 socketMessage.append("1 => HostLookup");
760 break;
762 break;
761 case 2:
763 case 2:
762 socketMessage.append("2 => Connecting");
764 socketMessage.append("2 => Connecting");
763 break;
765 break;
764 case 3:
766 case 3:
765 socketMessage.append("3 => Connected");
767 socketMessage.append("3 => Connected");
766 break;
768 break;
767 case 4:
769 case 4:
768 socketMessage.append("4 => Bound");
770 socketMessage.append("4 => Bound");
769 break;
771 break;
770 case 5:
772 case 5:
771 socketMessage.append("5 => Closing");
773 socketMessage.append("5 => Closing");
772 break;
774 break;
773 case 6:
775 case 6:
774 socketMessage.append("6 => Listening");
776 socketMessage.append("6 => Listening");
775 break;
777 break;
776 }
778 }
777 UI->gresbStatusQueryLabel->setText(socketMessage);
779 UI->gresbStatusQueryLabel->setText(socketMessage);
778 }
780 }
779
781
780 void rmapplugin::reTestSPWLink() // SLOT
782 void rmapplugin::reTestSPWLink() // SLOT
781 {
783 {
782 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 0)
784 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 0)
783 {
785 {
784 UI->gresbStatusQueryDialog->accept();
786 UI->gresbStatusQueryDialog->accept();
785 }
787 }
786 }
788 }
787
789
788 int rmapplugin::GRESBStatusQuery() // SLOT
790 int rmapplugin::GRESBStatusQuery() // SLOT
789 {
791 {
790 GRESBStatusQueryRequest(LinkStatus, 0);
792 GRESBStatusQueryRequest(LinkStatus, 0);
791 GRESBStatusQueryRequest(LinkStatus, 1);
793 GRESBStatusQueryRequest(LinkStatus, 1);
792 GRESBStatusQueryRequest(LinkStatus, 2);
794 GRESBStatusQueryRequest(LinkStatus, 2);
793 GRESBStatusQueryRequest(LinkStatistics, 0);
795 GRESBStatusQueryRequest(LinkStatistics, 0);
794 GRESBStatusQueryRequest(LinkStatistics, 1);
796 GRESBStatusQueryRequest(LinkStatistics, 1);
795 GRESBStatusQueryRequest(LinkStatistics, 2);
797 GRESBStatusQueryRequest(LinkStatistics, 2);
796 return 0;
798 return 0;
797 }
799 }
798
800
799 void rmapplugin::displayOnConsole(QString message)
800 {
801 this->UI->console->append(message);
802 }
803
804 void rmapplugin::activatePluginViaStarDundee(bool flag)
805 {
806 emit activateSig(flag);
807 }
808
809 void rmapplugin::RMAP_write_reply_setText(QString text)
801 void rmapplugin::RMAP_write_reply_setText(QString text)
810 {
802 {
811 this->UI->RMAP_write_reply->setText(text);
803 this->UI->RMAP_write_reply->setText(text);
812 }
804 }
813
805
814 void rmapplugin::appendToLog(QString text)
806 void rmapplugin::appendToLog(QString text)
815 {
807 {
816 APPENDTOLOG(text);
808 APPENDTOLOG(text);
817 }
809 }
818
810
819 /////////////////////
811 /////////////////////
820 // INTERNAL FUNCTIONS
812 // INTERNAL FUNCTIONS
821
813
822 int rmapplugin::GRESBStatusQueryRequest(GresbStatusQueryOption option, char link)
814 int rmapplugin::GRESBStatusQueryRequest(GresbStatusQueryOption option, char link)
823 {
815 {
824 gresb_status_query_t statusQueryCommand;
816 gresb_status_query_t statusQueryCommand;
825 gresb_link_status_reply_t linkStatusReply;
817 gresb_link_status_reply_t linkStatusReply;
826 gresb_link_statistics_reply_t linkStatisticsReply;
818 gresb_link_statistics_reply_t linkStatisticsReply;
827 QTime statusQueryTimeout;
819 QTime statusQueryTimeout;
828 QString console_message;
820 QString console_message;
829
821
830 statusQueryCommand.protocolIdentifier = (char) 0x02;
822 statusQueryCommand.protocolIdentifier = (char) 0x02;
831 statusQueryCommand.reserved1 = (char) 0x00;
823 statusQueryCommand.reserved1 = (char) 0x00;
832 statusQueryCommand.reserved0 = (char) 0x00;
824 statusQueryCommand.reserved0 = (char) 0x00;
833 statusQueryCommand.option = (char) option;
825 statusQueryCommand.option = (char) option;
834 statusQueryCommand.value3 = (char) 0x00;
826 statusQueryCommand.value3 = (char) 0x00;
835 statusQueryCommand.value2 = (char) 0x00;
827 statusQueryCommand.value2 = (char) 0x00;
836 statusQueryCommand.value1 = (char) 0x00;
828 statusQueryCommand.value1 = (char) 0x00;
837 statusQueryCommand.value0 = (char) link;
829 statusQueryCommand.value0 = (char) link;
838
830
839 GRESBStatusQuery_SOCKET->write((char*) ((void*) &statusQueryCommand), sizeof(statusQueryCommand));
831 GRESBStatusQuery_SOCKET->write((char*) ((void*) &statusQueryCommand), sizeof(statusQueryCommand));
840 GRESBStatusQuery_SOCKET->flush();
832 GRESBStatusQuery_SOCKET->flush();
841 GRESBStatusQuery_SOCKET->waitForBytesWritten(1000);
833 GRESBStatusQuery_SOCKET->waitForBytesWritten(1000);
842
834
843 statusQueryTimeout.start();
835 statusQueryTimeout.start();
844 while(GRESBStatusQuery_SOCKET->bytesToWrite() > 0)
836 while(GRESBStatusQuery_SOCKET->bytesToWrite() > 0)
845 {
837 {
846 GRESBStatusQuery_SOCKET->waitForBytesWritten(100);
838 GRESBStatusQuery_SOCKET->waitForBytesWritten(100);
847 if(statusQueryTimeout.elapsed()>1000)
839 if(statusQueryTimeout.elapsed()>1000)
848 {
840 {
849 APPENDTOLOG("WARNING === in function GRESBStatusQueryRequest of rmapplugin *** sending StatusQueryCommand timeout");
841 APPENDTOLOG("WARNING === in function GRESBStatusQueryRequest of rmapplugin *** sending StatusQueryCommand timeout");
850 return 1;
842 return 1;
851 }
843 }
852 }
844 }
853
845
854 switch (option)
846 switch (option)
855 {
847 {
856 case LinkStatus:
848 case LinkStatus:
857 {
849 {
858 statusQueryTimeout.start();
850 statusQueryTimeout.start();
859 while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatusReply))
851 while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatusReply))
860 {
852 {
861 GRESBStatusQuery_SOCKET->waitForReadyRead(100);
853 GRESBStatusQuery_SOCKET->waitForReadyRead(100);
862 if(statusQueryTimeout.elapsed()>1000)
854 if(statusQueryTimeout.elapsed()>1000)
863 {
855 {
864 console_message.sprintf("GRESBStatusQueryRequest / LinkStatus => error timeout bytesAvailable()\n");
856 console_message.sprintf("GRESBStatusQueryRequest / LinkStatus => error timeout bytesAvailable()\n");
865 APPENDTOLOG(console_message);
857 APPENDTOLOG(console_message);
866 return 1;
858 return 1;
867 }
859 }
868 }
860 }
869 GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatusReply), (int) sizeof(linkStatusReply));
861 GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatusReply), (int) sizeof(linkStatusReply));
870 console_message.sprintf("%x", linkStatusReply.byte0);
862 console_message.sprintf("%x", linkStatusReply.byte0);
871 UI->spwLinkStatusEnquiry->statusQueryTable->item(0, link)->setText(console_message);
863 UI->spwLinkStatusEnquiry->statusQueryTable->item(0, link)->setText(console_message);
872 console_message.sprintf("%d", linkStatusReply.byte1);
864 console_message.sprintf("%d", linkStatusReply.byte1);
873 UI->spwLinkStatusEnquiry->statusQueryTable->item(1, link)->setText(console_message);
865 UI->spwLinkStatusEnquiry->statusQueryTable->item(1, link)->setText(console_message);
874 if (linkStatusReply.byte0 == 0) return 1;
866 if (linkStatusReply.byte0 == 0) return 1;
875 break;
867 break;
876 }
868 }
877 case LinkStatistics:
869 case LinkStatistics:
878 {
870 {
879 statusQueryTimeout.start();
871 statusQueryTimeout.start();
880 while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatisticsReply))
872 while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatisticsReply))
881 {
873 {
882 GRESBStatusQuery_SOCKET->waitForReadyRead(100);
874 GRESBStatusQuery_SOCKET->waitForReadyRead(100);
883 if(statusQueryTimeout.elapsed()>1000)
875 if(statusQueryTimeout.elapsed()>1000)
884 {
876 {
885 console_message.sprintf("GRESBStatusQueryRequest / LinkStatistics => error timeout bytesAvailable()\n");
877 console_message.sprintf("GRESBStatusQueryRequest / LinkStatistics => error timeout bytesAvailable()\n");
886 APPENDTOLOG(console_message);
878 APPENDTOLOG(console_message);
887 return 1;
879 return 1;
888 }
880 }
889 }
881 }
890 GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatisticsReply), sizeof(linkStatisticsReply));
882 GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatisticsReply), sizeof(linkStatisticsReply));
891 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataTransmitted));
883 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataTransmitted));
892 UI->spwLinkStatusEnquiry->statusQueryTable->item(9, link)->setText(console_message);
884 UI->spwLinkStatusEnquiry->statusQueryTable->item(9, link)->setText(console_message);
893 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsTransmitted));
885 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsTransmitted));
894 UI->spwLinkStatusEnquiry->statusQueryTable->item(8, link)->setText(console_message);
886 UI->spwLinkStatusEnquiry->statusQueryTable->item(8, link)->setText(console_message);
895 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfTruncatedPacketsReceived));
887 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfTruncatedPacketsReceived));
896 UI->spwLinkStatusEnquiry->statusQueryTable->item(6, link)->setText(console_message);
888 UI->spwLinkStatusEnquiry->statusQueryTable->item(6, link)->setText(console_message);
897 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsWithEEPReceived));
889 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsWithEEPReceived));
898 UI->spwLinkStatusEnquiry->statusQueryTable->item(5, link)->setText(console_message);
890 UI->spwLinkStatusEnquiry->statusQueryTable->item(5, link)->setText(console_message);
899 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataReceived));
891 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataReceived));
900 UI->spwLinkStatusEnquiry->statusQueryTable->item(4, link)->setText(console_message);
892 UI->spwLinkStatusEnquiry->statusQueryTable->item(4, link)->setText(console_message);
901 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsReceived));
893 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsReceived));
902 UI->spwLinkStatusEnquiry->statusQueryTable->item(3, link)->setText(console_message);
894 UI->spwLinkStatusEnquiry->statusQueryTable->item(3, link)->setText(console_message);
903 break;
895 break;
904 }
896 }
905 case NodeAddressStatistics:
897 case NodeAddressStatistics:
906 {
898 {
907 break;
899 break;
908 }
900 }
909 case GetRoute:
901 case GetRoute:
910 {
902 {
911 break;
903 break;
912 }
904 }
913 }
905 }
914 return 0;
906 return 0;
915 }
907 }
916
908
917 int rmapplugin::charTab_TO_int(char *charTab)
909 int rmapplugin::charTab_TO_int(char *charTab)
918 {
910 {
919 int result = 0;
911 int result = 0;
920 result = (charTab[0]<<24) +(charTab[1]<<16) +(charTab[2]<<8) + charTab[3];
912 result = (charTab[0]<<24) +(charTab[1]<<16) +(charTab[2]<<8) + charTab[3];
921 return result;
913 return result;
922 }
914 }
923
915
924 void rmapplugin::gresbSelection(bool flag)
916 void rmapplugin::gresbSelection(bool flag)
925 {
917 {
926 if (flag == true) UI->selection_GROUPBOX->setEnabled(false);
918 if (flag == true) UI->selection_GROUPBOX->setEnabled(false);
927 if (flag == false) UI->selection_GROUPBOX->setEnabled(true);
919 if (flag == false) UI->selection_GROUPBOX->setEnabled(true);
928 }
920 }
929
921
930 // SLOTS
931 void rmapplugin::bridgeHasChanged(selectedBridge bridge)
932 {
933 currentBridge = bridge;
934 }
935
922
936
923
@@ -1,109 +1,108
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the LPPMON Software
3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #ifndef DRIVER1_H
22 #ifndef DRIVER1_H
23 #define DRIVER1_H
23 #define DRIVER1_H
24 #include <rmappluginui.h>
24 #include <rmappluginui.h>
25 #include <rmapoperations.h>
25 #include <rmapoperations.h>
26 #include <QMenuBar>
26 #include <QMenuBar>
27 #include <QMenu>
27 #include <QMenu>
28 #include <QAction>
28 #include <QAction>
29 #include <QMainWindow>
29 #include <QMainWindow>
30 #include <QTcpSocket>
30 #include <QTcpSocket>
31 #include <QTime>
31 #include <QTime>
32 #include <ccsds.h>
32 #include <ccsds.h>
33 #include <QSemaphore>
33 #include <QSemaphore>
34 #include <spwpacketreceiver.h>
34 #include <spwpacketreceiver.h>
35
35
36 #include <lppmonplugin.h>
36 #include <lppmonplugin.h>
37
37
38 #define APPENDTOLOG(message) this->UI->appendToLogFile(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": " + message)
38 #define APPENDTOLOG(message) this->UI->appendToLogFile(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": " + message)
39
39
40 #define READ_WRITE_MAX_COUNTS 4096 // in words
40 #define READ_WRITE_MAX_COUNTS 4096 // in words
41 #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
41 #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 #define RMAP_READ_REPLY_HEADER_LENGTH 12 // in bytes => ECSS
42 #define RMAP_READ_REPLY_HEADER_LENGTH 12 // in bytes => ECSS
43 #define RMAP_READ_COMMAND_HEADER_LENGTH 16 // in bytes => ECSS
43 #define RMAP_READ_COMMAND_HEADER_LENGTH 16 // in bytes => ECSS
44 #define RMAP_DATA_CRC_LENGTH 1 // in bytes => ECSS
44 #define RMAP_DATA_CRC_LENGTH 1 // in bytes => ECSS
45 #define CCSDS_MAX_PACKET_LENGTH 4412 // in bytes, specified in the LFR Software Requirements Specification
45 #define CCSDS_MAX_PACKET_LENGTH 4412 // in bytes, specified in the LFR Software Requirements Specification
46
46
47 class rmapplugin : public lppmonplugin
47 class rmapplugin : public lppmonplugin
48 {
48 {
49 Q_OBJECT
49 Q_OBJECT
50 public:
50 public:
51 explicit rmapplugin(QWidget *parent = 0);
51 explicit rmapplugin(QWidget *parent = 0);
52 ~rmapplugin();
52 ~rmapplugin();
53 int GRESBStatusQueryRequest(GresbStatusQueryOption option, char link);
53 int GRESBStatusQueryRequest(GresbStatusQueryOption option, char link);
54 int charTab_TO_int(char *charTab);
54 int charTab_TO_int(char *charTab);
55 unsigned int ReadGRESB(unsigned int *Value,unsigned int count,unsigned int address=0);
55 unsigned int ReadGRESB(unsigned int *Value,unsigned int count,unsigned int address=0);
56 unsigned int WriteGRESB(unsigned int *Value,unsigned int count,unsigned int address=0);
56 unsigned int WriteGRESB(unsigned int *Value,unsigned int count,unsigned int address=0);
57 unsigned int ReadStarDundee(unsigned int *Value, unsigned int count, unsigned int address=0);
57 unsigned int WriteSPWGRESB(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
58 unsigned int WriteStarDundee(unsigned int *Value, unsigned int count, unsigned int address=0);
59
58
60 public slots:
59 public slots:
61 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
60 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
62 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
61 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
63 //
62 //
64 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
63 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
65 void sendCCSDS();
64 void sendCCSDS();
66 void send_TC_LFR_UPDATE_TIME();
65 void send_TC_LFR_UPDATE_TIME();
67 void reset_TC_LFR_UPDATE_TIME();
66 void reset_TC_LFR_UPDATE_TIME();
68 int GRESBStatusQuery();
67 int GRESBStatusQuery();
69 void displayOnConsole(QString message);
68 void displayOnConsole(QString message) {this->UI->console->append(message);}
70 //
69 //
71 void RMAP_CONNECT();
70 void RMAP_CONNECT();
72 void RMAP_DISCONNECT();
71 void RMAP_DISCONNECT();
73 void openBridge();
72 void openBridge();
74 void closeBridge();
73 void closeBridge();
75 int RMAPSendReadCommand();
74 int RMAPSendReadCommand();
76 int RMAPSendWriteCommand();
75 int RMAPSendWriteCommand();
77 void reTestSPWLink();
76 void reTestSPWLink();
78 //
77 //
79 void RMAPSendConnectionState(QAbstractSocket::SocketState socketState);
78 void RMAPSendConnectionState(QAbstractSocket::SocketState socketState);
80 void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState);
79 void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState);
81 void GRESBConnectionState(QAbstractSocket::SocketState socketState);
80 void GRESBConnectionState(QAbstractSocket::SocketState socketState);
82 //
81 //
83 void gresbSelection(bool flag);
82 void gresbSelection(bool flag);
84 void activatePluginViaStarDundee(bool flag);
83 void activatePluginViaStarDundee(bool flag) {emit activateSig(flag);}
85 void RMAP_write_reply_setText(QString text);
84 void RMAP_write_reply_setText(QString text);
86 void appendToLog(QString text);
85 void appendToLog(QString text);
87 void bridgeHasChanged(selectedBridge bridge);
86 void bridgeHasChanged(selectedBridge bridge) {currentBridge = bridge;}
88
87
89 signals:
88 signals:
90 void ccsdsPacketReadyRead(char *ccsdsPacket, unsigned int size);
89 void ccsdsPacketReadyRead(char *ccsdsPacket, unsigned int size);
91 void gresbIsOpen(bool);
90 void gresbIsOpen(bool);
92
91
93 private:
92 private:
94 selectedBridge currentBridge;
93 selectedBridge currentBridge;
95 rmapPluginUI* UI;
94 rmapPluginUI* UI;
96 QTcpSocket* GRESBStatusQuery_SOCKET;
95 QTcpSocket* GRESBStatusQuery_SOCKET;
97 QTcpSocket* RMAPSend_SOCKET;
96 QTcpSocket* RMAPSend_SOCKET;
98 QTcpSocket* RMAPReceive_SOCKET;
97 QTcpSocket* RMAPReceive_SOCKET;
99 ccsds* ccsds_command;
98 ccsds* ccsds_command;
100 unsigned int rmapPacketSize;
99 unsigned int rmapPacketSize;
101 unsigned int time_COARSE;
100 unsigned int time_COARSE;
102 unsigned int time_FINE;
101 unsigned int time_FINE;
103 spwpacketreceiver* spwPacketReceiverOBJECT;
102 spwpacketreceiver* spwPacketReceiverOBJECT;
104 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
103 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
105 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
104 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
106 char timeCode;
105 char timeCode;
107 };
106 };
108
107
109 #endif // DRIVER1_H
108 #endif // DRIVER1_H
@@ -1,73 +1,75
1 #
1 #
2 # Project created by QtCreator 2011-09-20T08:15:30
2 # Project created by QtCreator 2011-09-20T08:15:30
3 #
3 #
4 #-------------------------------------------------
4 #-------------------------------------------------
5
5
6 #include(/etc/lppmon/lppmonplugin.prf)
6 #include(/etc/lppmon/lppmonplugin.prf)
7 CONFIG += lppmonplugin
7 CONFIG += lppmonplugin
8 TARGET = rmapplugin
8 TARGET = rmapplugin
9
9
10 DEFINES += PLUGIN=rmapplugin
10 DEFINES += PLUGIN=rmapplugin
11 DEFINES += PLUGINHEADER="\"\\\"rmapplugin.h"\\\"\"
11 DEFINES += PLUGINHEADER="\"\\\"rmapplugin.h"\\\"\"
12 DEFINES += driver_Name="\"\\\"RMAPPlugin"\\\"\"
12 DEFINES += driver_Name="\"\\\"RMAPPlugin"\\\"\"
13 DEFINES += driver_Author="\"\\\"Paul Leroy paul.leroy@lpp.polytechnique.fr"\\\"\"
13 DEFINES += driver_Author="\"\\\"Paul Leroy paul.leroy@lpp.polytechnique.fr"\\\"\"
14 DEFINES += driver_Version="\"\\\"1.1.2"\\\"\"
14 DEFINES += driver_Version="\"\\\"1.1.2"\\\"\"
15 DEFINES += driver_Description="\"\\\"AHB bus controler, works with Gaisler's AHB plugn' play bus."\\\"\"
15 DEFINES += driver_Description="\"\\\"AHB bus controler, works with Gaisler's AHB plugn' play bus."\\\"\"
16 DEFINES += driver_can_be_root=1
16 DEFINES += driver_can_be_root=1
17 DEFINES += driver_can_be_child=0
17 DEFINES += driver_can_be_child=0
18 DEFINES += driver_VID=0
18 DEFINES += driver_VID=0
19 DEFINES += driver_PID=0
19 DEFINES += driver_PID=0
20
20
21
21
22 QT += network
22 QT += network
23
23
24
24
25 LIBS += ../spw_usb_driver_v2.61/lib/x86_64/libSpaceWireUSBAPI.so \
25 LIBS += ../spw_usb_driver_v2.61/lib/x86_64/libSpaceWireUSBAPI.so \
26 ../spw_usb_driver_v2.61/lib/x86_64/libConfigLibraryUSB.so
26 ../spw_usb_driver_v2.61/lib/x86_64/libConfigLibraryUSB.so
27
27
28
28
29 INCLUDEPATH += \
29 INCLUDEPATH += \
30 $${PWD} \
30 $${PWD} \
31 ../common_PLE \
31 ../common_PLE \
32 ../spw_usb_driver_v2.61/inc
32 ../spw_usb_driver_v2.61/inc
33
33
34
34
35 HEADERS += \
35 HEADERS += \
36 rmappluginui.h \
36 rmappluginui.h \
37 rmapplugin.h \
37 rmapplugin.h \
38 rmapoperations.h \
38 rmapoperations.h \
39 ccsds.h \
39 ccsds.h \
40 spwpacketreceiver.h \
40 spwpacketreceiver.h \
41 ../common_PLE/qipdialogbox.h \
41 ../common_PLE/qipdialogbox.h \
42 ../common_PLE/gresbstatusenquiry.h \
42 ../common_PLE/gresbstatusenquiry.h \
43 spectralmatricesdmasimulator.h \
43 spectralmatricesdmasimulator.h \
44 rmappluginpythonwrapper.h \
44 rmappluginpythonwrapper.h \
45 stardundee.h \
45 stardundee.h \
46 ../spw_usb_driver_v2.61/inc/spw_usb_api.h \
46 ../spw_usb_driver_v2.61/inc/spw_usb_api.h \
47 ../spw_usb_driver_v2.61/inc/spw_config_library.h \
47 ../spw_usb_driver_v2.61/inc/spw_config_library.h \
48 gresb.h
48 gresb.h \
49 bridge.h
49
50
50
51
51 SOURCES += \
52 SOURCES += \
52 rmapplugin.cpp \
53 rmapplugin.cpp \
53 rmappluginui.cpp \
54 rmappluginui.cpp \
54 rmapoperations.cpp \
55 rmapoperations.cpp \
55 ccsds.cpp \
56 ccsds.cpp \
56 spwpacketreceiver.cpp \
57 spwpacketreceiver.cpp \
57 ../common_PLE/qipdialogbox.cpp \
58 ../common_PLE/qipdialogbox.cpp \
58 ../common_PLE/gresbstatusenquiry.cpp \
59 ../common_PLE/gresbstatusenquiry.cpp \
59 spectralmatricesdmasimulator.cpp \
60 spectralmatricesdmasimulator.cpp \
60 rmappluginpythonwrapper.cpp \
61 rmappluginpythonwrapper.cpp \
61 stardundee.cpp \
62 stardundee.cpp \
62 gresb.cpp
63 gresb.cpp \
64 bridge.cpp
63
65
64
66
65
67
66
68
67
69
68
70
69
71
70
72
71
73
72
74
73
75
@@ -1,323 +1,324
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the LPPMON Software
3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #include "rmapplugin.h"
22 #include "rmapplugin.h"
23
23
24 rmapPluginUI::rmapPluginUI(QWidget *parent) :
24 rmapPluginUI::rmapPluginUI(QWidget *parent) :
25 QWidget(parent)
25 QWidget(parent)
26 {
26 {
27 spectralMatricesDMASimulator = new SpectralMatricesDMASimulator;
27 spectralMatricesDMASimulator = new SpectralMatricesDMASimulator;
28 spwTabWidget = new QTabWidget;
28 spwTabWidget = new QTabWidget;
29 QWidget* spwTabWidgetPage0 = new QWidget;
29 QWidget* spwTabWidgetPage0 = new QWidget;
30 QWidget* spwTabWidgetPage1 = new QWidget;
30 QWidget* spwTabWidgetPage1 = new QWidget;
31 QWidget* spwTabWidgetPage2 = new QWidget;
31 QWidget* spwTabWidgetPage2 = new QWidget;
32 QWidget* spwTabWidgetPage3 = new QWidget;
32 QWidget* spwTabWidgetPage3 = new QWidget;
33 QWidget* spwTabWidgetPage4 = new QWidget;
33 QWidget* spwTabWidgetPage4 = new QWidget;
34 QWidget* spwTabWidgetPage5 = new QWidget;
34 QWidget* spwTabWidgetPage5 = new QWidget;
35 bridgeWidget = new QWidget;
35 bridgeWidget = new QWidget;
36 mainLayout = new QVBoxLayout;
36 mainLayout = new QVBoxLayout;
37 connectionLayout = new QGridLayout;
37 connectionLayout = new QGridLayout;
38 ccsdsLayout = new QVBoxLayout;
38 ccsdsLayout = new QVBoxLayout;
39 consoleLayout = new QVBoxLayout;
39 consoleLayout = new QVBoxLayout;
40 selectionLayout = new QVBoxLayout;
40 selectionLayout = new QVBoxLayout;
41 bridgeSelection_LAYOUT = new QGridLayout;
41 bridgeSelection_LAYOUT = new QGridLayout;
42 generalParameters_LAYOUT = new QGridLayout;
42 generalParameters_LAYOUT = new QGridLayout;
43
43
44 gresb_GROUPBOX = new QGroupBox(tr("GRESB bridge parameters"));
44 gresb_GROUPBOX = new QGroupBox(tr("GRESB bridge parameters"));
45 stardundee_GROUPBOX = new QGroupBox(tr("Star Dundee brick parameters"));
45 stardundee_GROUPBOX = new QGroupBox(tr("Star Dundee brick parameters"));
46 selection_GROUPBOX = new QGroupBox(tr("Bridge selection"));
46 selection_GROUPBOX = new QGroupBox(tr("Bridge selection"));
47 generalParameters_GROUPBOX = new QGroupBox(tr("General parameters"));
47 generalParameters_GROUPBOX = new QGroupBox(tr("General parameters"));
48
48
49 //*** QLABEL ***//
49 //*** QLABEL ***//
50 gresbBridgeIPLabel = new QLabel(tr("GRESB Bridge IP: "));
50 gresbBridgeIPLabel = new QLabel(tr("Bridge IP: "));
51 gresbVirtualLinkLabel = new QLabel(tr("GRESB Virtual Link: "));
51 gresbVirtualLinkLabel = new QLabel(tr("Virtual Link: "));
52 spwLinkLabel = new QLabel(tr("GRESB SPW Link: "));
52 spwLinkLabel = new QLabel(tr("SPW Link: "));
53 rmapSourceLogicalAddressLabel = new QLabel(tr("RMAP Source Logical Address: "));
53 rmapSourceLogicalAddressLabel = new QLabel(tr("RMAP Source Logical Address: "));
54 rmapTargetLogicalAddressLabel = new QLabel(tr("RMAP Target Logical Address: "));
54 rmapTargetLogicalAddressLabel = new QLabel(tr("RMAP Target Logical Address: "));
55 rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection"));
55 rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection"));
56 rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection"));
56 rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection"));
57 logFileName = new QLabel;
57 logFileName = new QLabel;
58 gresbStatusQueryLabel = new QLabel(tr("GRESB status query socket (port 3010): waiting for connection"));
58 gresbStatusQueryLabel = new QLabel(tr("Status query socket (port 3010): waiting for connection"));
59 gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running"));
59 gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running"));
60 sendCCSDSCommandLabel = new QLabel(tr("Address of the target"));
60 sendCCSDSCommandLabel = new QLabel(tr("Address of the target"));
61
61
62 //*** QPUSHBUTTON ***//
62 //*** QPUSHBUTTON ***//
63 rmapOpenCommunicationButton = new QPushButton(tr("Open RMAP Communication"));
63 rmapOpenCommunicationButton = new QPushButton(tr("Open selected bridge"));
64 rmapCloseCommunicationButton = new QPushButton(tr("Close RMAP Communication"));
64 rmapCloseCommunicationButton = new QPushButton(tr("Close selected bridge"));
65 rmapOpenCommunicationButton->setEnabled(false);
65 rmapOpenCommunicationButton->setEnabled(false);
66 rmapCloseCommunicationButton->setEnabled(false);
66 rmapCloseCommunicationButton->setEnabled(false);
67 logFileChooseButton = new QPushButton(tr("Choose file"));
67 logFileChooseButton = new QPushButton(tr("Choose file"));
68 gresbStatusQueryRetryButton = new QPushButton(tr("Retry"));
68 gresbStatusQueryRetryButton = new QPushButton(tr("Retry"));
69 gresbStatusQueryAbortButton = new QPushButton(tr("Abort"));
69 gresbStatusQueryAbortButton = new QPushButton(tr("Abort"));
70 sendCCSDSCommandButton = new QPushButton(tr("Send CCSDS Command"));
70 sendCCSDSCommandButton = new QPushButton(tr("Send CCSDS Command"));
71 send_TC_LFR_UPDATE_TIME_Button = new QPushButton(tr("Send TC_LFR_UPDATE_TIME Packet"));
71 send_TC_LFR_UPDATE_TIME_Button = new QPushButton(tr("Send TC_LFR_UPDATE_TIME Packet"));
72 reset_TC_LFR_UPDATE_TIME_Button = new QPushButton(tr("reset the TC_LFR_UPDATE_TIME Packet coarse and fine times"));
72 reset_TC_LFR_UPDATE_TIME_Button = new QPushButton(tr("reset the TC_LFR_UPDATE_TIME Packet coarse and fine times"));
73 clearConsoleButton = new QPushButton(tr("Clear"));
73 clearConsoleButton = new QPushButton(tr("Clear"));
74
74
75 selectGRESB_BUTTON = new QRadioButton(tr("GRESB"));
75 selectGRESB_BUTTON = new QRadioButton(tr("GRESB"));
76 selectStarDundee_BUTTON = new QRadioButton(tr("Star Dundee"));
76 selectStarDundee_BUTTON = new QRadioButton(tr("Star Dundee"));
77
77
78 //*** SPINBOX ***//
78 //*** SPINBOX ***//
79 gresbVirtualLinkSpinBox = new QSpinBox;
79 gresbVirtualLinkSpinBox = new QSpinBox;
80 rmapSourceLogicalAddressSpinBox = new QSpinBox;
80 rmapSourceLogicalAddressSpinBox = new QSpinBox;
81 rmapTargetLogicalAddressSpinBox = new QSpinBox;
81 rmapTargetLogicalAddressSpinBox = new QSpinBox;
82 spwLinkSpinBox = new QSpinBox;;
82 spwLinkSpinBox = new QSpinBox;;
83 CCSDSTargetLogicalAddressSpinBox = new QSpinBox;
83 CCSDSTargetLogicalAddressSpinBox = new QSpinBox;
84 gresbVirtualLinkSpinBox->setRange(0, 4);
84 gresbVirtualLinkSpinBox->setRange(0, 4);
85 gresbVirtualLinkSpinBox->setValue(1);
85 gresbVirtualLinkSpinBox->setValue(1);
86 rmapSourceLogicalAddressSpinBox->setRange(0, 255);
86 rmapSourceLogicalAddressSpinBox->setRange(0, 255);
87 rmapSourceLogicalAddressSpinBox->setValue(33);
87 rmapSourceLogicalAddressSpinBox->setValue(33);
88 rmapTargetLogicalAddressSpinBox->setRange(0, 255);
88 rmapTargetLogicalAddressSpinBox->setRange(0, 255);
89 rmapTargetLogicalAddressSpinBox->setValue(254);
90 spwLinkSpinBox->setRange(0, 2);
89 spwLinkSpinBox->setRange(0, 2);
91 spwLinkSpinBox->setValue(0);
90 spwLinkSpinBox->setValue(0);
92 CCSDSTargetLogicalAddressSpinBox->setRange(0,255);
91 CCSDSTargetLogicalAddressSpinBox->setRange(0,255);
93 CCSDSTargetLogicalAddressSpinBox->setValue(254);
92 CCSDSTargetLogicalAddressSpinBox->setValue(254);
94
93
95 //*** MISC **//
94 //*** MISC **//
96 starDundee = new StarDundee;
95 starDundee = new StarDundee;
97 gresbBridge = new gresb;
96 gresbBridge = new gresb;
98 console = new QTextEdit;
97 console = new QTextEdit;
99 gresbBridgeIPDialogBox = new QIPDialogBox;
98 gresbBridgeIPDialogBox = new QIPDialogBox;
100 gresbStatusQueryDialog = new QDialog;
99 gresbStatusQueryDialog = new QDialog;
101 logEnableCheckBox = new QCheckBox(tr("Enable Logs"));
100 logEnableCheckBox = new QCheckBox(tr("Enable Logs"));
102 RMAP_write_verify = new QCheckBox(tr("data checked before write\nlimited to 4 bytes\nNOT IMPLEMENTED"));
101 RMAP_write_verify = new QCheckBox(tr("data checked before write\nlimited to 4 bytes\nNOT IMPLEMENTED"));
103 RMAP_write_reply = new QCheckBox(tr("reply to the write command required\nlast reply status: unavailable"));
102 RMAP_write_reply = new QCheckBox(tr("reply to the write command required\nlast reply status: unavailable"));
104 spwLinkStatusEnquiry = new gresbStatusEnquiry;
103 spwLinkStatusEnquiry = new gresbStatusEnquiry;
105 logFile = new QFile();
104 logFile = new QFile();
106
105
107 logFileEn = false;
106 logFileEn = false;
108
107
109 connectionLayout->addWidget(gresbBridgeIPLabel, 0, 0, 0);
108 connectionLayout->addWidget(gresbBridgeIPLabel, 0, 0, 0);
110 connectionLayout->addWidget(gresbBridgeIPDialogBox, 0, 1, 0);
109 connectionLayout->addWidget(gresbBridgeIPDialogBox, 0, 1, 0);
111 connectionLayout->addWidget(gresbVirtualLinkLabel, 1, 0, 0);
110 connectionLayout->addWidget(gresbVirtualLinkLabel, 1, 0, 0);
112 connectionLayout->addWidget(gresbVirtualLinkSpinBox, 1, 1, 0);
111 connectionLayout->addWidget(gresbVirtualLinkSpinBox, 1, 1, 0);
113 connectionLayout->addWidget(spwLinkLabel, 2, 0, 0);
112 connectionLayout->addWidget(spwLinkLabel, 2, 0, 0);
114 connectionLayout->addWidget(spwLinkSpinBox, 2, 1, 0);
113 connectionLayout->addWidget(spwLinkSpinBox, 2, 1, 0);
115 connectionLayout->addWidget(rmapSourceLogicalAddressLabel, 3, 0, 0);
114 connectionLayout->addWidget(rmapSourceLogicalAddressLabel, 3, 0, 0);
116 connectionLayout->addWidget(rmapSourceLogicalAddressSpinBox, 3, 1, 0);
115 connectionLayout->addWidget(rmapSourceLogicalAddressSpinBox, 3, 1, 0);
117 connectionLayout->addWidget(rmapSendStateLabel, 4, 0, 1, 2);
116 connectionLayout->addWidget(rmapSendStateLabel, 4, 0, 1, 2);
118 connectionLayout->addWidget(rmapReceiveStateLabel, 5, 0, 1, 2);
117 connectionLayout->addWidget(rmapReceiveStateLabel, 5, 0, 1, 2);
119 connectionLayout->addWidget(gresbStatusQueryLabel, 6, 0, 1, 2);
118 connectionLayout->addWidget(gresbStatusQueryLabel, 6, 0, 1, 2);
120
119
121 connectionLayout->setRowStretch(7, 1);
120 connectionLayout->setRowStretch(7, 1);
122 connectionLayout->setColumnStretch(2, 1);
121 connectionLayout->setColumnStretch(2, 1);
123
122
124 bridgeSelection_LAYOUT->addWidget(selectGRESB_BUTTON, 0, 0, 1, 1);
123 bridgeSelection_LAYOUT->addWidget(selectGRESB_BUTTON, 0, 0, 1, 1);
125 bridgeSelection_LAYOUT->addWidget(selectStarDundee_BUTTON, 0, 1, 1, 1);
124 bridgeSelection_LAYOUT->addWidget(selectStarDundee_BUTTON, 0, 1, 1, 1);
126 bridgeSelection_LAYOUT->setRowStretch(1, 1);
125 bridgeSelection_LAYOUT->setRowStretch(1, 1);
127 bridgeSelection_LAYOUT->setColumnStretch(2, 1);
126 bridgeSelection_LAYOUT->setColumnStretch(2, 1);
128
127
129 generalParameters_LAYOUT->addWidget(logEnableCheckBox, 0, 0, 1, 1);
128 generalParameters_LAYOUT->addWidget(logEnableCheckBox, 0, 0, 1, 1);
130 generalParameters_LAYOUT->addWidget(logFileChooseButton, 0, 1, 1, 1);
129 generalParameters_LAYOUT->addWidget(logFileChooseButton, 0, 1, 1, 1);
131 generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressLabel, 1, 0, 0);
130 generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressLabel, 1, 0, 0);
132 generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressSpinBox, 1, 1, 0);
131 generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressSpinBox, 1, 1, 0);
133 generalParameters_LAYOUT->addWidget(rmapOpenCommunicationButton, 2, 0, 1, 2);
132 generalParameters_LAYOUT->addWidget(rmapOpenCommunicationButton, 2, 0, 1, 1);
134 generalParameters_LAYOUT->addWidget(rmapCloseCommunicationButton, 3, 0, 1, 2);
133 generalParameters_LAYOUT->addWidget(rmapCloseCommunicationButton, 2, 1, 1, 1);
135 generalParameters_LAYOUT->addWidget(RMAP_write_verify, 4, 0, 1, 2);
134 generalParameters_LAYOUT->addWidget(RMAP_write_verify, 3, 0, 1, 2);
136 generalParameters_LAYOUT->addWidget(RMAP_write_reply, 5, 0, 1, 2);
135 generalParameters_LAYOUT->addWidget(RMAP_write_reply, 4, 0, 1, 2);
137 generalParameters_LAYOUT->setRowStretch(6, 1);
136 generalParameters_LAYOUT->setRowStretch(5, 1);
138 generalParameters_LAYOUT->setColumnStretch(2, 1);
137 generalParameters_LAYOUT->setColumnStretch(2, 1);
139
138
140 gresb_GROUPBOX->setLayout(connectionLayout);
139 gresb_GROUPBOX->setLayout(connectionLayout);
141 gresb_GROUPBOX->setVisible(false);
140 gresb_GROUPBOX->setVisible(false);
142 stardundee_GROUPBOX->setLayout(starDundee->layout());
141 stardundee_GROUPBOX->setLayout(starDundee->layout());
143 stardundee_GROUPBOX->setVisible(false);
142 stardundee_GROUPBOX->setVisible(false);
144 selection_GROUPBOX->setLayout(bridgeSelection_LAYOUT);
143 selection_GROUPBOX->setLayout(bridgeSelection_LAYOUT);
145 generalParameters_GROUPBOX->setLayout(generalParameters_LAYOUT);
144 generalParameters_GROUPBOX->setLayout(generalParameters_LAYOUT);
146 selectionLayout->addWidget(selection_GROUPBOX);
145 selectionLayout->addWidget(selection_GROUPBOX);
147 selectionLayout->addWidget(generalParameters_GROUPBOX);
146 selectionLayout->addWidget(generalParameters_GROUPBOX);
148 selectionLayout->addWidget(gresb_GROUPBOX);
147 selectionLayout->addWidget(gresb_GROUPBOX);
149 selectionLayout->addWidget(stardundee_GROUPBOX);
148 selectionLayout->addWidget(stardundee_GROUPBOX);
150
149
151 ccsdsLayout->addWidget(sendCCSDSCommandButton);
150 ccsdsLayout->addWidget(sendCCSDSCommandButton);
152 ccsdsLayout->addWidget(send_TC_LFR_UPDATE_TIME_Button);
151 ccsdsLayout->addWidget(send_TC_LFR_UPDATE_TIME_Button);
153 ccsdsLayout->addWidget(reset_TC_LFR_UPDATE_TIME_Button);
152 ccsdsLayout->addWidget(reset_TC_LFR_UPDATE_TIME_Button);
154 ccsdsLayout->addWidget(sendCCSDSCommandLabel);
153 ccsdsLayout->addWidget(sendCCSDSCommandLabel);
155 ccsdsLayout->addWidget(CCSDSTargetLogicalAddressSpinBox);
154 ccsdsLayout->addWidget(CCSDSTargetLogicalAddressSpinBox);
156
155
157 consoleLayout->addWidget(console);
156 consoleLayout->addWidget(console);
158 consoleLayout->addWidget(clearConsoleButton);
157 consoleLayout->addWidget(clearConsoleButton);
159
158
160 connect(this->logFileChooseButton, SIGNAL(clicked()), this, SLOT(chooseLogFile()));
159 connect(this->logFileChooseButton, SIGNAL(clicked()), this, SLOT(chooseLogFile()));
161 connect(this, SIGNAL(setLogFileName(QString)), this->logFileName, SLOT(setText(QString)));
160 connect(this, SIGNAL(setLogFileName(QString)), this->logFileName, SLOT(setText(QString)));
162 connect(this->logEnableCheckBox, SIGNAL(stateChanged(int)), this, SLOT(logFileEnDisable(int)));
161 connect(this->logEnableCheckBox, SIGNAL(stateChanged(int)), this, SLOT(logFileEnDisable(int)));
163
162
164 spwTabWidget->addTab(spwTabWidgetPage0, tr("connection"));
163 spwTabWidget->addTab(spwTabWidgetPage0, tr("connection"));
165 spwTabWidget->addTab(spwTabWidgetPage1, tr("ccsds"));
164 spwTabWidget->addTab(spwTabWidgetPage1, tr("ccsds"));
166 spwTabWidget->addTab(spwTabWidgetPage2, tr("status"));
165 spwTabWidget->addTab(spwTabWidgetPage2, tr("status"));
167 spwTabWidget->addTab(spwTabWidgetPage3, tr("console"));
166 spwTabWidget->addTab(spwTabWidgetPage3, tr("console"));
168 spwTabWidget->addTab(spwTabWidgetPage4, tr("DMA"));
167 spwTabWidget->addTab(spwTabWidgetPage4, tr("DMA"));
169 spwTabWidget->addTab(spwTabWidgetPage5, tr("gresb"));
168 spwTabWidget->addTab(spwTabWidgetPage5, tr("gresb"));
170
169
171 spwTabWidgetPage0->setLayout(selectionLayout);
170 spwTabWidgetPage0->setLayout(selectionLayout);
172 spwTabWidgetPage1->setLayout(ccsdsLayout);
171 spwTabWidgetPage1->setLayout(ccsdsLayout);
173 spwTabWidgetPage2->setLayout(this->spwLinkStatusEnquiry->mainLayout);
172 spwTabWidgetPage2->setLayout(this->spwLinkStatusEnquiry->mainLayout);
174 spwTabWidgetPage3->setLayout(consoleLayout);
173 spwTabWidgetPage3->setLayout(consoleLayout);
175 spwTabWidgetPage4->setLayout(spectralMatricesDMASimulator->mainLayout);
174 spwTabWidgetPage4->setLayout(spectralMatricesDMASimulator->mainLayout);
176 spwTabWidgetPage5->setLayout(gresbBridge->layout());
175 spwTabWidgetPage5->setLayout(gresbBridge->layout());
177 mainLayout->addWidget(spwTabWidget);
176 mainLayout->addWidget(spwTabWidget);
178 setLayout(mainLayout);
177 setLayout(mainLayout);
179
178
180 // GRESB STATUS QUERY DIALOG
179 // GRESB STATUS QUERY DIALOG
181 gresbStatusQueryDialogLayout = new QGridLayout;
180 gresbStatusQueryDialogLayout = new QGridLayout;
182 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryDialogLabel, 0, 0, 1, 2);
181 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryDialogLabel, 0, 0, 1, 2);
183 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryRetryButton, 1, 0, 0);
182 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryRetryButton, 1, 0, 0);
184 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryAbortButton, 1, 1, 0);
183 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryAbortButton, 1, 1, 0);
185 gresbStatusQueryDialog->setLayout(gresbStatusQueryDialogLayout);
184 gresbStatusQueryDialog->setLayout(gresbStatusQueryDialogLayout);
186
185
187 connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject()));
186 connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject()));
188 connect(this->clearConsoleButton, SIGNAL(clicked()), this->console, SLOT(clear()));
187 connect(this->clearConsoleButton, SIGNAL(clicked()), this->console, SLOT(clear()));
189 connect(this->selectGRESB_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee()));
188 connect(this->selectGRESB_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee()));
190 connect(this->selectStarDundee_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee()));
189 connect(this->selectStarDundee_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee()));
191 connect(this->starDundee, SIGNAL(starDundeeIsOpen(bool)), this, SLOT(starDundeeIsOpen(bool)));
190 connect(this->starDundee, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool)));
191 connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->starDundee, SLOT(targetHasChanged(int)));
192
192
193 // command code
193 // command code
194 connect(this->RMAP_write_reply, SIGNAL(clicked()), this, SLOT(getCommandCode()));
194 connect(this->RMAP_write_reply, SIGNAL(clicked()), this, SLOT(getCommandCode()));
195 connect(this->RMAP_write_verify, SIGNAL(clicked()), this, SLOT(getCommandCode()));
195 connect(this->RMAP_write_verify, SIGNAL(clicked()), this, SLOT(getCommandCode()));
196 connect(this, SIGNAL(commandCodeHasChanged(RMAP_command_codes)), this->starDundee, SLOT(updateCommandCode(RMAP_command_codes)));
196 connect(this, SIGNAL(commandCodeHasChanged(RMAP_command_codes)), this->starDundee, SLOT(commandCodeHasChanged(RMAP_command_codes)));
197
197
198 getCommandCode(); // init the command code value
198 getCommandCode(); // init the command code value
199 rmapTargetLogicalAddressSpinBox->setValue(254);
199 }
200 }
200
201
201 void rmapPluginUI::connectPort()
202 void rmapPluginUI::connectPort()
202 {
203 {
203 //emit this->connectPortsig(ui->PortName->text(),ui->PortspeedSlider->value());
204 //emit this->connectPortsig(ui->PortName->text(),ui->PortspeedSlider->value());
204 }
205 }
205
206
206 void rmapPluginUI::setConnected(bool connected)
207 void rmapPluginUI::setConnected(bool connected)
207 {
208 {
208 /*if(connected == true)
209 /*if(connected == true)
209 {
210 {
210 ui->OpenPort->setText(tr("Close port"));
211 ui->OpenPort->setText(tr("Close port"));
211 }
212 }
212 else
213 else
213 ui->OpenPort->setText(tr("Open port"));*/
214 ui->OpenPort->setText(tr("Open port"));*/
214 }
215 }
215
216
216 rmapPluginUI::~rmapPluginUI()
217 rmapPluginUI::~rmapPluginUI()
217 {
218 {
218 //delete ui;
219 //delete ui;
219 }
220 }
220
221
221 void rmapPluginUI::chooseLogFile()
222 void rmapPluginUI::chooseLogFile()
222 {
223 {
223 if(this->logFile->isOpen())
224 if(this->logFile->isOpen())
224 this->logFile->close();
225 this->logFile->close();
225 this->logFile->setFileName(QFileDialog::getSaveFileName(this,tr("Open Log file"),
226 this->logFile->setFileName(QFileDialog::getSaveFileName(this,tr("Open Log file"),
226 QDir::homePath()
227 QDir::homePath()
227 + "/"
228 + "/"
228 + QDate::currentDate().toString()
229 + QDate::currentDate().toString()
229 + "_"
230 + "_"
230 + QTime::currentTime().toString()
231 + QTime::currentTime().toString()
231 + "_rmapPluginUI.log",
232 + "_rmapPluginUI.log",
232 tr("Log Files (*.txt *.log)")));
233 tr("Log Files (*.txt *.log)")));
233 if(this->logFile->open(QIODevice::WriteOnly))
234 if(this->logFile->open(QIODevice::WriteOnly))
234 {
235 {
235 this->logFileStrm = new QTextStream(this->logFile);
236 this->logFileStrm = new QTextStream(this->logFile);
236 emit this->setLogFileName(this->logFile->fileName());
237 emit this->setLogFileName(this->logFile->fileName());
237 }
238 }
238 }
239 }
239
240
240 void rmapPluginUI::logFileEnDisable(int state)
241 void rmapPluginUI::logFileEnDisable(int state)
241 {
242 {
242 if(state==Qt::Checked)
243 if(state==Qt::Checked)
243 {
244 {
244 this->logFileEn = true;
245 this->logFileEn = true;
245 }
246 }
246 else if(state==Qt::Unchecked)
247 else if(state==Qt::Unchecked)
247 {
248 {
248 this->logFileEn = false;
249 this->logFileEn = false;
249 }
250 }
250 }
251 }
251
252
252 bool rmapPluginUI::islogfileenable()
253 bool rmapPluginUI::islogfileenable()
253 {
254 {
254 return this->logFileEn;
255 return this->logFileEn;
255 }
256 }
256
257
257 void rmapPluginUI::appendToLogFile(const QString & text)
258 void rmapPluginUI::appendToLogFile(const QString & text)
258 {
259 {
259 if(this->logFileEn && this->logFile->isOpen())
260 if(this->logFileEn && this->logFile->isOpen())
260 {
261 {
261 *(this->logFileStrm) << text << endl;
262 *(this->logFileStrm) << text << endl;
262 }
263 }
263 }
264 }
264
265
265 void rmapPluginUI::closeEvent(QCloseEvent *event)
266 void rmapPluginUI::closeEvent(QCloseEvent *event)
266 {
267 {
267 if(this->logFile->isOpen())
268 if(this->logFile->isOpen())
268 {
269 {
269 this->logFileStrm->flush();
270 this->logFileStrm->flush();
270 this->logFile->waitForBytesWritten(3000);
271 this->logFile->waitForBytesWritten(3000);
271 this->logFile->close();
272 this->logFile->close();
272 }
273 }
273 event->accept();
274 event->accept();
274 }
275 }
275
276
276 RMAP_command_codes rmapPluginUI::getCommandCode()
277 RMAP_command_codes rmapPluginUI::getCommandCode()
277 {
278 {
278 RMAP_command_codes commandCode = invalid0;
279 RMAP_command_codes commandCode = invalid0;
279 if (RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) commandCode = writeSingle_ver_rep;
280 if (RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) commandCode = writeSingle_ver_rep;
280 if (RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) commandCode = writeSingle_ver_noRep;
281 if (RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) commandCode = writeSingle_ver_noRep;
281 if (!RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) commandCode = writeSingle_noVer_Rep;
282 if (!RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) commandCode = writeSingle_noVer_Rep;
282 if (!RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) commandCode = writeSingle_noVer_noRep;
283 if (!RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) commandCode = writeSingle_noVer_noRep;
283 emit commandCodeHasChanged(commandCode);
284 emit commandCodeHasChanged(commandCode);
284 return commandCode;
285 return commandCode;
285 }
286 }
286
287
287 // SLOT
288 // SLOT
288
289
289 void rmapPluginUI::selectionBetweenGresbAndStarDundee() //SLOT
290 void rmapPluginUI::selectionBetweenGresbAndStarDundee() //SLOT
290 {
291 {
291 if (selectGRESB_BUTTON->isChecked())
292 if (selectGRESB_BUTTON->isChecked())
292 {
293 {
293 gresb_GROUPBOX->setVisible(true);
294 gresb_GROUPBOX->setVisible(true);
294 stardundee_GROUPBOX->setVisible(false);
295 stardundee_GROUPBOX->setVisible(false);
295 rmapOpenCommunicationButton->setEnabled(true);
296 rmapOpenCommunicationButton->setEnabled(true);
296 emit bridgeHasChanged(selectedBridgeIsGRESB);
297 emit bridgeHasChanged(selectedBridgeIsGRESB);
297 }
298 }
298 if (selectStarDundee_BUTTON->isChecked())
299 if (selectStarDundee_BUTTON->isChecked())
299 {
300 {
300 stardundee_GROUPBOX->setVisible(true);
301 stardundee_GROUPBOX->setVisible(true);
301 gresb_GROUPBOX->setVisible(false);
302 gresb_GROUPBOX->setVisible(false);
302 rmapOpenCommunicationButton->setEnabled(true);
303 rmapOpenCommunicationButton->setEnabled(true);
303 emit bridgeHasChanged(selectedBridgeIsStarDundee);
304 emit bridgeHasChanged(selectedBridgeIsStarDundee);
304 }
305 }
305 }
306 }
306
307
307 void rmapPluginUI::starDundeeIsOpen(bool flag)
308 void rmapPluginUI::isOpen(bool flag)
308 {
309 {
309 if (flag == true)
310 if (flag == true)
310 {
311 {
311 selection_GROUPBOX->setEnabled(false);
312 selection_GROUPBOX->setEnabled(false);
312 this->rmapOpenCommunicationButton->setEnabled(false);
313 this->rmapOpenCommunicationButton->setEnabled(false);
313 this->rmapCloseCommunicationButton->setEnabled(true);
314 this->rmapCloseCommunicationButton->setEnabled(true);
314 }
315 }
315 if (flag == false)
316 if (flag == false)
316 {
317 {
317 selection_GROUPBOX->setEnabled(true);
318 selection_GROUPBOX->setEnabled(true);
318 this->rmapOpenCommunicationButton->setEnabled(true);
319 this->rmapOpenCommunicationButton->setEnabled(true);
319 this->rmapCloseCommunicationButton->setEnabled(false);
320 this->rmapCloseCommunicationButton->setEnabled(false);
320 }
321 }
321 }
322 }
322
323
323
324
@@ -1,160 +1,161
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
2 -- This file is a part of the LPPMON Software
3 -- Copyright (C) 20011, Laboratory of Plasma Physics - CNRS
3 -- Copyright (C) 20011, Laboratory of Plasma Physics - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Paul Leroy
19 /*-- Author : Paul Leroy
20 -- Mail : paul.leroy@lpp.polytechnique.fr
20 -- Mail : paul.leroy@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22 #ifndef RMAPPLUGINUI_H
22 #ifndef RMAPPLUGINUI_H
23 #define RMAPPLUGINUI_H
23 #define RMAPPLUGINUI_H
24
24
25 #include <QWidget>
25 #include <QWidget>
26 #include <QPushButton>
26 #include <QPushButton>
27 #include <QLabel>
27 #include <QLabel>
28 #include <QSlider>
28 #include <QSlider>
29 #include <QSpinBox>
29 #include <QSpinBox>
30 #include <QGridLayout>
30 #include <QGridLayout>
31 #include <QCheckBox>
31 #include <QCheckBox>
32 #include <QFile>
32 #include <QFile>
33 #include <QTextStream>
33 #include <QTextStream>
34 #include <QFileDialog>
34 #include <QFileDialog>
35 #include <QDir>
35 #include <QDir>
36 #include <QDialog>
36 #include <QDialog>
37 #include <QCloseEvent>
37 #include <QCloseEvent>
38 #include <QTabWidget>
38 #include <QTabWidget>
39 #include "qipdialogbox.h"
39 #include "qipdialogbox.h"
40 #include <rmapoperations.h>
40 #include <rmapoperations.h>
41 #include <gresbstatusenquiry.h>
41 #include <gresbstatusenquiry.h>
42 #include <QTextEdit>
42 #include <QTextEdit>
43 #include "spectralmatricesdmasimulator.h"
43 #include "spectralmatricesdmasimulator.h"
44 #include <stardundee.h>
44 #include <stardundee.h>
45 #include <gresb.h>
45 #include <gresb.h>
46 #include <QRadioButton>
46 #include <QRadioButton>
47 #include <QGroupBox>
47 #include <QGroupBox>
48
48
49 enum selectedBridge{
49 enum selectedBridge{
50 selectedBridgeIsUnknown,
50 selectedBridgeIsUnknown,
51 selectedBridgeIsGRESB,
51 selectedBridgeIsGRESB,
52 selectedBridgeIsStarDundee
52 selectedBridgeIsStarDundee
53 };
53 };
54
54
55 class rmapPluginUI : public QWidget
55 class rmapPluginUI : public QWidget
56 {
56 {
57 Q_OBJECT
57 Q_OBJECT
58
58
59 public:
59 public:
60 explicit rmapPluginUI(QWidget *parent = 0);
60 explicit rmapPluginUI(QWidget *parent = 0);
61 ~rmapPluginUI();
61 ~rmapPluginUI();
62
62
63 QPushButton* rmapOpenCommunicationButton;
63 QPushButton* rmapOpenCommunicationButton;
64 QPushButton* rmapCloseCommunicationButton;
64 QPushButton* rmapCloseCommunicationButton;
65 QPushButton* logFileChooseButton;
65 QPushButton* logFileChooseButton;
66 QPushButton* gresbStatusQueryRetryButton;
66 QPushButton* gresbStatusQueryRetryButton;
67 QPushButton* gresbStatusQueryAbortButton;
67 QPushButton* gresbStatusQueryAbortButton;
68 QPushButton* sendCCSDSCommandButton;
68 QPushButton* sendCCSDSCommandButton;
69 QPushButton* send_TC_LFR_UPDATE_TIME_Button;
69 QPushButton* send_TC_LFR_UPDATE_TIME_Button;
70 QPushButton* reset_TC_LFR_UPDATE_TIME_Button;
70 QPushButton* reset_TC_LFR_UPDATE_TIME_Button;
71 QPushButton* clearConsoleButton;
71 QPushButton* clearConsoleButton;
72
72
73 QRadioButton* selectGRESB_BUTTON;
73 QRadioButton* selectGRESB_BUTTON;
74 QRadioButton* selectStarDundee_BUTTON;
74 QRadioButton* selectStarDundee_BUTTON;
75
75
76 QGroupBox *selection_GROUPBOX;
76 QGroupBox *selection_GROUPBOX;
77
77
78 QSpinBox* gresbVirtualLinkSpinBox;
78 QSpinBox* gresbVirtualLinkSpinBox;
79 QSpinBox* spwLinkSpinBox;
79 QSpinBox* spwLinkSpinBox;
80 QSpinBox* rmapSourceLogicalAddressSpinBox;
80 QSpinBox* rmapSourceLogicalAddressSpinBox;
81 QSpinBox* rmapTargetLogicalAddressSpinBox;
81 QSpinBox* rmapTargetLogicalAddressSpinBox;
82 QSpinBox* CCSDSTargetLogicalAddressSpinBox;
82 QSpinBox* CCSDSTargetLogicalAddressSpinBox;
83
83
84 QIPDialogBox* gresbBridgeIPDialogBox;
84 QIPDialogBox* gresbBridgeIPDialogBox;
85
85
86 QCheckBox *logEnableCheckBox;
86 QCheckBox *logEnableCheckBox;
87 QCheckBox *RMAP_write_verify;
87 QCheckBox *RMAP_write_verify;
88 QCheckBox *RMAP_write_reply;
88 QCheckBox *RMAP_write_reply;
89
89
90 QLabel* rmapSendStateLabel;
90 QLabel* rmapSendStateLabel;
91 QLabel* rmapReceiveStateLabel;
91 QLabel* rmapReceiveStateLabel;
92 QLabel* gresbStatusQueryLabel;
92 QLabel* gresbStatusQueryLabel;
93 QLabel* gresbStatusQueryDialogLabel;
93 QLabel* gresbStatusQueryDialogLabel;
94 QLabel* sendCCSDSCommandLabel;
94 QLabel* sendCCSDSCommandLabel;
95
95
96 QDialog* gresbStatusQueryDialog;
96 QDialog* gresbStatusQueryDialog;
97
97
98 gresbStatusEnquiry* spwLinkStatusEnquiry;
98 gresbStatusEnquiry* spwLinkStatusEnquiry;
99
99
100 SpectralMatricesDMASimulator *spectralMatricesDMASimulator;
100 SpectralMatricesDMASimulator *spectralMatricesDMASimulator;
101
101
102 QTextEdit* console;
102 QTextEdit* console;
103
103
104 StarDundee *starDundee;
104 StarDundee *starDundee;
105
105
106 gresb *gresbBridge;
106 gresb *gresbBridge;
107
107
108 bool islogfileenable();
108 bool islogfileenable();
109 void appendToLogFile(const QString & text);
109 void appendToLogFile(const QString & text);
110 void closeEvent(QCloseEvent *event);
110 void closeEvent(QCloseEvent *event);
111
111
112 public slots:
112 public slots:
113 void setConnected(bool connected);
113 void setConnected(bool connected);
114 void connectPort();
114 void connectPort();
115 void chooseLogFile();
115 void chooseLogFile();
116 void logFileEnDisable(int state);
116 void logFileEnDisable(int state);
117 RMAP_command_codes getCommandCode();
117 RMAP_command_codes getCommandCode();
118
118
119 private slots:
119 private slots:
120 void selectionBetweenGresbAndStarDundee();
120 void selectionBetweenGresbAndStarDundee();
121 void starDundeeIsOpen(bool flag);
121 void isOpen(bool flag);
122
122
123 signals:
123 signals:
124 void connectPortsig(QString PortName,int baudrate);
124 void connectPortsig(QString PortName,int baudrate);
125 void setLogFileName(QString FileName);
125 void setLogFileName(QString FileName);
126 void commandCodeHasChanged(RMAP_command_codes commandCode);
126 void commandCodeHasChanged(RMAP_command_codes commandCode);
127 void bridgeHasChanged(selectedBridge bridge);
127 void bridgeHasChanged(selectedBridge bridge);
128 void targetHasChanged(unsigned char target);
128
129
129 private:
130 private:
130 QLabel *gresbBridgeIPLabel;
131 QLabel *gresbBridgeIPLabel;
131 QLabel *gresbVirtualLinkLabel;
132 QLabel *gresbVirtualLinkLabel;
132 QLabel *spwLinkLabel;
133 QLabel *spwLinkLabel;
133 QLabel *rmapSourceLogicalAddressLabel;
134 QLabel *rmapSourceLogicalAddressLabel;
134 QLabel *rmapTargetLogicalAddressLabel;
135 QLabel *rmapTargetLogicalAddressLabel;
135 QLabel *logFileName;
136 QLabel *logFileName;
136
137
137 QGridLayout *bridgeSelection_LAYOUT;
138 QGridLayout *bridgeSelection_LAYOUT;
138 QVBoxLayout *selectionLayout;
139 QVBoxLayout *selectionLayout;
139 QVBoxLayout *mainLayout;
140 QVBoxLayout *mainLayout;
140 QGridLayout *connectionLayout;
141 QGridLayout *connectionLayout;
141 QVBoxLayout *ccsdsLayout;
142 QVBoxLayout *ccsdsLayout;
142 QVBoxLayout *consoleLayout;
143 QVBoxLayout *consoleLayout;
143 QGridLayout *gresbStatusQueryDialogLayout;
144 QGridLayout *gresbStatusQueryDialogLayout;
144 QGridLayout *generalParameters_LAYOUT;
145 QGridLayout *generalParameters_LAYOUT;
145
146
146 QTabWidget *spwTabWidget;
147 QTabWidget *spwTabWidget;
147
148
148 QWidget* bridgeWidget;
149 QWidget* bridgeWidget;
149
150
150 QGroupBox *gresb_GROUPBOX;
151 QGroupBox *gresb_GROUPBOX;
151 QGroupBox *stardundee_GROUPBOX;
152 QGroupBox *stardundee_GROUPBOX;
152 QGroupBox *generalParameters_GROUPBOX;
153 QGroupBox *generalParameters_GROUPBOX;
153
154
154 QFile *logFile;
155 QFile *logFile;
155 QTextStream *logFileStrm;
156 QTextStream *logFileStrm;
156 bool logFileEn;
157 bool logFileEn;
157
158
158 };
159 };
159
160
160 #endif // RMAPPLUGINUI_H
161 #endif // RMAPPLUGINUI_H
This diff has been collapsed as it changes many lines, (628 lines changed) Show them Hide them
@@ -1,529 +1,713
1 #include "stardundee.h"
1 #include "stardundee.h"
2 #include <QTime>
2 #include <QTime>
3 #include <math.h>
3 #include <math.h>
4
4
5 StarDundee::StarDundee(QWidget *parent) :
5 StarDundee::StarDundee(QWidget *parent) :
6 QWidget(parent)
6 QWidget(parent)
7 {
7 {
8 // Packet receiver
9 rmapPacketSEMAPHORE = new QSemaphore;
10 ccsdsPacketSEMAPHORE = new QSemaphore;
11 rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH);
12 ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH);
13 spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) );
14
8 commandCode = invalid0; // initialization of the cmmand code for the RMAP transfers
15 commandCode = invalid0; // initialization of the cmmand code for the RMAP transfers
9 rmapPacket = (unsigned char*) malloc(RMAP_MAX_PACKET_LENGTH);
10
16
11 rmapTargetLogicalAddress = 0xfe;
12 rmapSourceLogicalAddress = 0x20;
17 rmapSourceLogicalAddress = 0x20;
13 connection_LAYOUT = new QGridLayout;
18 connection_LAYOUT = new QGridLayout;
14
19
15 sendPacket_BUTTON = new QPushButton(tr("Send a packet"));
16 sendRMAPPacket_BUTTON = new QPushButton(tr("Write RMAP packet to the specified target"));
17 readRMAPPacket_BUTTON = new QPushButton(tr("Read RMAP packet from the specified target"));
18 getRoutingTableEntry_BUTTON = new QPushButton(tr("Get routing table entry (target logical address)"));
19
20 usbDeviceNumber_LABEL = new QLabel(tr("USB device number: "));
20 usbDeviceNumber_LABEL = new QLabel(tr("USB device number: "));
21 linkNumber_LABEL = new QLabel(tr("SpaceWire link number: "));
21 linkNumber_LABEL = new QLabel(tr("SpaceWire link number: "));
22 routingTableEntry_LABEL = new QLabel(tr("Target logical address: "));
23 sourceLogicalAddress_LABEL = new QLabel(tr("Source logical address: "));
22 sourceLogicalAddress_LABEL = new QLabel(tr("Source logical address: "));
24
23
25 usbDeviceNumber_SPINBOX = new QSpinBox;
24 usbDeviceNumber_SPINBOX = new QSpinBox;
26 usbDeviceNumber_SPINBOX->setRange(0,32);
25 usbDeviceNumber_SPINBOX->setRange(0,32);
27 usbDeviceNumber_SPINBOX->setValue(0);
26 usbDeviceNumber_SPINBOX->setValue(0);
28 linkNumber_SPINBOX = new QSpinBox;
27 linkNumber_SPINBOX = new QSpinBox;
29 linkNumber_SPINBOX->setRange(1,2);
28 linkNumber_SPINBOX->setRange(1,2);
30 linkNumber_SPINBOX->setValue(1);
29 linkNumber_SPINBOX->setValue(1);
31 routingTableEntry_SPINBOX = new QSpinBox;
32 routingTableEntry_SPINBOX->setRange(0, 254);
33 routingTableEntry_SPINBOX->setValue(254);
34 sourceLogicalAddress_SPINBOX = new QSpinBox;
30 sourceLogicalAddress_SPINBOX = new QSpinBox;
35 sourceLogicalAddress_SPINBOX->setRange(0,254);
31 sourceLogicalAddress_SPINBOX->setRange(0,254);
36 sourceLogicalAddress_SPINBOX->setValue(32);
32 sourceLogicalAddress_SPINBOX->setValue(32);
37
33
38 sendPacket_BUTTON->setEnabled(false);
39 sendRMAPPacket_BUTTON->setEnabled(false);
40 readRMAPPacket_BUTTON->setEnabled(false);
41 getRoutingTableEntry_BUTTON->setEnabled(false);
42
43 connection_LAYOUT->addWidget(usbDeviceNumber_LABEL, 0, 0, 1, 1);
34 connection_LAYOUT->addWidget(usbDeviceNumber_LABEL, 0, 0, 1, 1);
44 connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 0, 1, 1, 1);
35 connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 0, 1, 1, 1);
45 connection_LAYOUT->addWidget(sendPacket_BUTTON, 1, 0, 1, 2);
36 connection_LAYOUT->addWidget(linkNumber_LABEL, 1, 0, 1, 1);
46 connection_LAYOUT->addWidget(linkNumber_LABEL, 2, 0, 1, 1);
37 connection_LAYOUT->addWidget(linkNumber_SPINBOX, 1, 1, 1, 1);
47 connection_LAYOUT->addWidget(linkNumber_SPINBOX, 2, 1, 1, 1);
38 connection_LAYOUT->addWidget(sourceLogicalAddress_LABEL, 2, 0, 1, 1);
48 connection_LAYOUT->addWidget(sourceLogicalAddress_LABEL, 3, 0, 1, 1);
39 connection_LAYOUT->addWidget(sourceLogicalAddress_SPINBOX, 2, 1, 1, 1);
49 connection_LAYOUT->addWidget(sourceLogicalAddress_SPINBOX, 3, 1, 1, 1);
50 connection_LAYOUT->addWidget(routingTableEntry_LABEL, 4, 0, 1, 1);
51 connection_LAYOUT->addWidget(routingTableEntry_SPINBOX, 4, 1, 1, 1);
52 connection_LAYOUT->addWidget(sendRMAPPacket_BUTTON, 5, 0, 1, 2);
53 connection_LAYOUT->addWidget(readRMAPPacket_BUTTON, 6, 0, 1, 2);
54 connection_LAYOUT->addWidget(getRoutingTableEntry_BUTTON, 7, 0, 1, 2);
55
40
56 connection_LAYOUT->setRowStretch(8, 1);
41 connection_LAYOUT->setRowStretch(3, 1);
57 connection_LAYOUT->setColumnStretch(2, 1);
42 connection_LAYOUT->setColumnStretch(2, 1);
58
43
59 this->setLayout(connection_LAYOUT);
44 this->setLayout(connection_LAYOUT);
60
45
61 connect(this->sendPacket_BUTTON, SIGNAL(clicked()), this, SLOT(SendPacket()));
46 connect(this->sourceLogicalAddress_SPINBOX, SIGNAL(valueChanged(int)), this, SLOT(sourceHasChanged(int)));
62 connect(this->readRMAPPacket_BUTTON, SIGNAL(clicked()),this, SLOT(ReadRMAP()));
63 connect(this->sendRMAPPacket_BUTTON, SIGNAL(clicked()), this, SLOT(SendRMAP()));
64 connect(this->getRoutingTableEntry_BUTTON, SIGNAL(clicked()), this, SLOT(GetRoutingTableEntry()));
65 }
47 }
66
48
67 StarDundee::~StarDundee()
49 StarDundee::~StarDundee()
68 {
50 {
51 free(rmapPacket);
52 free(ccsdsPacket);
53 free(spwPacket);
69 USBSpaceWire_Close(hDevice); // Close the device
54 USBSpaceWire_Close(hDevice); // Close the device
70 }
55 }
71
56
72 unsigned int StarDundee::OpenStarDundee()
57 unsigned int StarDundee::Open()
73 {
58 {
74 int status;
59 int status;
75 U32 statusControl;
60 U32 statusControl;
76 U32 routingTableEntry;
61 U32 routingTableEntry;
77 int tableEntry;
62 int tableEntry;
78
63
79 if (!USBSpaceWire_Open(&hDevice, usbDeviceNumber_SPINBOX->value())) // Open the USB device
64 if (!USBSpaceWire_Open(&hDevice, usbDeviceNumber_SPINBOX->value())) // Open the USB device
80 {
65 {
81 emit sendMessage("stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))");
66 emit sendMessage("stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))");
82 return -1;
67 return -1;
83 }
68 }
84 emit sendMessage("stardundee *** Open *** USBSpaceWire_Open successful, device number: "
69 emit sendMessage("stardundee *** Open *** USBSpaceWire_Open successful, device number: "
85 + QString::number(usbDeviceNumber_SPINBOX->value()));
70 + QString::number(usbDeviceNumber_SPINBOX->value()));
86
71
87 USBSpaceWire_EnableNetworkMode(hDevice, 0); // deactivate the network mode
72 USBSpaceWire_EnableNetworkMode(hDevice, 0); // deactivate the network mode
88 CFGSpaceWire_EnableRMAP(1); // Enable the use of RMAP
73 CFGSpaceWire_EnableRMAP(1); // Enable the use of RMAP
89 CFGSpaceWire_SetRMAPDestinationKey(0x20); // Set the destination key expected by STAR-Dundee devices
74 CFGSpaceWire_SetRMAPDestinationKey(0x20); // Set the destination key expected by STAR-Dundee devices
90
75
91 // Set the path and return path to the device
76 // Set the path and return path to the device
92 CFGSpaceWire_StackClear();
77 CFGSpaceWire_StackClear();
93 CFGSpaceWire_AddrStackPush(0);
78 CFGSpaceWire_AddrStackPush(0);
94 CFGSpaceWire_AddrStackPush(254);
79 CFGSpaceWire_AddrStackPush(254);
95 CFGSpaceWire_RetAddrStackPush(254);
80 CFGSpaceWire_RetAddrStackPush(254);
96
81
97 // set the base transmit rate to 100 MHz
82 // set the base transmit rate to 100 MHz
98 status = CFGSpaceWire_SetBrickBaseTransmitRate( hDevice, CFG_BRK_CLK_100_MHZ, CFG_BRK_DVDR_1, 0xff);
83 status = CFGSpaceWire_SetBrickBaseTransmitRate( hDevice, CFG_BRK_CLK_100_MHZ, CFG_BRK_DVDR_1, 0xff);
99 if (status != CFG_TRANSFER_SUCCESS)
84 if (status != CFG_TRANSFER_SUCCESS)
100 {
85 {
101 emit sendMessage("ERROR CFGSpaceWire_SetBrickBaseTransmitRate");
86 emit sendMessage("ERROR CFGSpaceWire_SetBrickBaseTransmitRate");
102 }
87 }
103 else emit sendMessage("OK CFGSpaceWire_SetBrickBaseTransmitRate, base rate = 100 MHz");
88 else emit sendMessage("OK CFGSpaceWire_SetBrickBaseTransmitRate, base rate = 100 MHz");
104 // read the link status
89 // read the link status
105 if (CFGSpaceWire_GetLinkStatusControl(hDevice, linkNumber_SPINBOX->value(), &statusControl) != CFG_TRANSFER_SUCCESS)
90 if (CFGSpaceWire_GetLinkStatusControl(hDevice, linkNumber_SPINBOX->value(), &statusControl) != CFG_TRANSFER_SUCCESS)
106 {
91 {
107 emit sendMessage("Could not read link status control for link " + QString::number(linkNumber_SPINBOX->value()));
92 emit sendMessage("Could not read link status control for link " + QString::number(linkNumber_SPINBOX->value()));
108 }
93 }
109 else
94 else
110 {
95 {
111 emit sendMessage("OK CFGSpaceWire_GetLinkStatusControl of link " + QString::number(linkNumber_SPINBOX->value()));
96 emit sendMessage("OK CFGSpaceWire_GetLinkStatusControl of link " + QString::number(linkNumber_SPINBOX->value()));
112
97
113 // Set the link status control register properties
98 // Set the link status control register properties
114 CFGSpaceWire_LSEnableAutoStart(&statusControl, 1);
99 CFGSpaceWire_LSEnableAutoStart(&statusControl, 1);
115 CFGSpaceWire_LSEnableStart(&statusControl, 1);
100 CFGSpaceWire_LSEnableStart(&statusControl, 1);
116 CFGSpaceWire_LSEnableDisabled(&statusControl, 0);
101 CFGSpaceWire_LSEnableDisabled(&statusControl, 0);
117 CFGSpaceWire_LSEnableTristate(&statusControl, 0);
102 CFGSpaceWire_LSEnableTristate(&statusControl, 0);
118 CFGSpaceWire_LSSetOperatingSpeed(&statusControl, 9); // sets the link speed to ( 100 MHz / (9+1) ) = 10 MHz
103 CFGSpaceWire_LSSetOperatingSpeed(&statusControl, 9); // sets the link speed to ( 100 MHz / (9+1) ) = 10 MHz
119
104
120 // Set the link status control register
105 // Set the link status control register
121 if (CFGSpaceWire_SetLinkStatusControl(hDevice, linkNumber_SPINBOX->value(), statusControl) != CFG_TRANSFER_SUCCESS)
106 if (CFGSpaceWire_SetLinkStatusControl(hDevice, linkNumber_SPINBOX->value(), statusControl) != CFG_TRANSFER_SUCCESS)
122 {
107 {
123 emit sendMessage("Could not set the link status control for link " + QString::number(linkNumber_SPINBOX->value()));
108 emit sendMessage("Could not set the link status control for link " + QString::number(linkNumber_SPINBOX->value()));
124 }
109 }
125 else emit sendMessage("Set the link status control for link " + QString::number(linkNumber_SPINBOX->value()));
110 else emit sendMessage("Set the link status control for link " + QString::number(linkNumber_SPINBOX->value()));
126 }
111 }
127
112
128 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET 254 <=> 0xfe
113 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET 254 <=> 0xfe
129 tableEntry = routingTableEntry_SPINBOX->value();
114 tableEntry = rmapTargetLogicalAddress;
130 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
115 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
131 {
116 {
132 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
117 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
133 }
118 }
134 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] cleared");
119 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] cleared");
135 // Build the routing table entry to route out of port 1 with header deletion disabled and priority normal
120 // Build the routing table entry to route out of port 1 with header deletion disabled and priority normal
136 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
121 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
137 (1<<linkNumber_SPINBOX->value()), // 0x02 = 0000 0010
122 (1<<linkNumber_SPINBOX->value()), // 0x02 = 0000 0010
138 0,
123 0,
139 0);
124 0);
140 // Set the routing table entry for logical address tableEntry
125 // Set the routing table entry for logical address tableEntry
141 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
126 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
142 {
127 {
143 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
128 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
144 }
129 }
145 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
130 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
146
131
147 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET 32 <=> 0x20
132 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET 32 <=> 0x20
148 tableEntry = sourceLogicalAddress_SPINBOX->value();
133 tableEntry = sourceLogicalAddress_SPINBOX->value();
149 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
134 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
150 {
135 {
151 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
136 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
152 }
137 }
153 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] cleared");
138 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] cleared");
154
139
155 // Build the routing table entry to route out of port 3 with header deletion disabled and priority normal
140 // Build the routing table entry to route out of port 3 with header deletion disabled and priority normal
156 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
141 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
157 (1<<3), // 0x02 = 0000 0010
142 (1<<3), // 0x02 = 0000 0010
158 0,
143 0,
159 0);
144 0);
160 // Set the routing table entry for logical address tableEntry
145 // Set the routing table entry for logical address tableEntry
161 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
146 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
162 {
147 {
163 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
148 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
164 }
149 }
165 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
150 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
166
151
167 emit sendMessage("The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes");
152 emit sendMessage("The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes");
168
153
169 sendPacket_BUTTON->setEnabled(true);
154 USBSpaceWire_RegisterReceiveOnAllPorts(hDevice); // Register to receive on all ports
170 sendRMAPPacket_BUTTON->setEnabled(true);
155 USBSpaceWire_ClearEndpoints(hDevice); // clear the USB endpoints
171 readRMAPPacket_BUTTON->setEnabled(true);
172 getRoutingTableEntry_BUTTON->setEnabled(true);
173
156
174 USBSpaceWire_RegisterReceiveOnAllPorts(hDevice); // Register to receive on all ports
157 // initialize SPW packet semaphores
158 while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire();
159 while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire();
175
160
176 emit starDundeeIsOpen(true);
161 emit isOpen(true);
177
178 emit sendMessage("command code: " + QString::number(commandCode,16) );
179
162
180 return 1;
163 return 1;
181 }
164 }
182
165
183 unsigned int StarDundee::CloseStarDundee()
166 unsigned int StarDundee::Close()
184 {
167 {
185 USBSpaceWire_Close(hDevice); // Close the device
168 USBSpaceWire_Close(hDevice); // Close the device
186 emit sendMessage("stardundee *** Close *** USBSpaceWire_Close, device: " + QString::number(usbDeviceNumber_SPINBOX->value()));
169 emit sendMessage("stardundee *** Close *** USBSpaceWire_Close, device: " + QString::number(usbDeviceNumber_SPINBOX->value()));
187 sendPacket_BUTTON->setEnabled(false);
188 sendRMAPPacket_BUTTON->setEnabled(false);
189 readRMAPPacket_BUTTON->setEnabled(false);
190 getRoutingTableEntry_BUTTON->setEnabled(false);
191
170
192 USBSpaceWire_UnregisterReceiveOnAllPorts(hDevice); // Stop receiving on all ports
171 USBSpaceWire_UnregisterReceiveOnAllPorts(hDevice); // Stop receiving on all ports
193
172
194 emit starDundeeIsOpen(false);
173 emit isOpen(false);
195
174
196 return 1;
175 return 1;
197 }
176 }
198
177
199 unsigned int StarDundee::GetRoutingTableEntry()
178 unsigned int StarDundee::GetRoutingTableEntry()
200 {
179 {
201 U32 routingTableEntry, outputPorts;
180 U32 routingTableEntry, outputPorts;
202 char enabled, delHead, priority;
181 char enabled, delHead, priority;
203 int portNum;
182 int portNum;
204 int tableEntry;
183 int tableEntry;
205
184
206 tableEntry = routingTableEntry_SPINBOX->value();
185 tableEntry = rmapTargetLogicalAddress;
207
186
208 // Set the path and return path to the device
187 // Set the path and return path to the device
209 CFGSpaceWire_StackClear();
188 CFGSpaceWire_StackClear();
210 CFGSpaceWire_AddrStackPush(0);
189 CFGSpaceWire_AddrStackPush(0);
211 CFGSpaceWire_AddrStackPush(254);
190 CFGSpaceWire_AddrStackPush(254);
212 CFGSpaceWire_RetAddrStackPush(254);
191 CFGSpaceWire_RetAddrStackPush(254);
213
192
214 // Read the routing table entry
193 // Read the routing table entry
215 if (CFGSpaceWire_GetRoutingTableEntry(hDevice, tableEntry, &routingTableEntry) != CFG_TRANSFER_SUCCESS)
194 if (CFGSpaceWire_GetRoutingTableEntry(hDevice, tableEntry, &routingTableEntry) != CFG_TRANSFER_SUCCESS)
216 {
195 {
217 emit sendMessage("Could not read routing table entry [" + QString::number(tableEntry) + "]");
196 emit sendMessage("Could not read routing table entry [" + QString::number(tableEntry) + "]");
218 }
197 }
219 else
198 else
220 {
199 {
221 // Display the routing table entry properties
200 // Display the routing table entry properties
222 CFGSpaceWire_RTIsEnabled(routingTableEntry, &enabled);
201 CFGSpaceWire_RTIsEnabled(routingTableEntry, &enabled);
223 CFGSpaceWire_RTIsDelHead(routingTableEntry, &delHead);
202 CFGSpaceWire_RTIsDelHead(routingTableEntry, &delHead);
224 CFGSpaceWire_RTIsPriority(routingTableEntry, &priority);
203 CFGSpaceWire_RTIsPriority(routingTableEntry, &priority);
225 CFGSpaceWire_RTGetOutputPorts(routingTableEntry, &outputPorts);
204 CFGSpaceWire_RTGetOutputPorts(routingTableEntry, &outputPorts);
226 emit sendMessage("CFGSpaceWire_RTIsEnabled : " + QString::number(enabled));
205 emit sendMessage("CFGSpaceWire_RTIsEnabled : " + QString::number(enabled));
227 emit sendMessage("CFGSpaceWire_RTIsDelHead : " + QString::number(delHead));
206 emit sendMessage("CFGSpaceWire_RTIsDelHead : " + QString::number(delHead));
228 emit sendMessage("CFGSpaceWire_RTIsPriority : " + QString::number(priority));
207 emit sendMessage("CFGSpaceWire_RTIsPriority : " + QString::number(priority));
229 emit sendMessage("CFGSpaceWire_RTGetOutputPorts : ");
208 emit sendMessage("CFGSpaceWire_RTGetOutputPorts : ");
230 for (portNum = 0; portNum < 32; portNum++)
209 for (portNum = 0; portNum < 32; portNum++)
231 {
210 {
232 if (outputPorts & (1 << portNum))
211 if (outputPorts & (1 << portNum))
233 {
212 {
234 emit sendMessage(QString::number(portNum));
213 emit sendMessage(QString::number(portNum));
235 }
214 }
236 }
215 }
237 }
216 }
238
217
239 return 1;
218 return 1;
240 }
219 }
241
220
242 unsigned int StarDundee::SendPacket()
221 unsigned int StarDundee::Write(unsigned int *Value, unsigned int count, unsigned int address)
243 {
222 {
244 U32 nBufferSize; // The amount of data, in bytes, to be transmitted.
223 unsigned int remainingCount = count;
245 char bWait; // If bWait is 0 then the transfer is started and the function returns immediately.
224 unsigned int iOffset = 0;
246 // If bWait is not 0 then the function will return only when the transfer is completed or an error is detected.
225 QString console_message;
226 char* data;
227
228 if(rmapPacketSEMAPHORE->available()!=0)
229 {
230 emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped");
231 return 1;
232 }
233
234 emit this->RMAP_write_reply_setText("reply to the write command required\nlast reply status: unavailable");
235
236 data = (char*) malloc(READ_WRITE_MAX_COUNTS*4);
237
238 emit appendToLog(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16));
239
240 while (remainingCount > READ_WRITE_MAX_COUNTS)
241 {
242 for (int i = 0; i<READ_WRITE_MAX_COUNTS; i++)
243 {
244 data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]);
245 data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8);
246 data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16);
247 data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24);
248 }
249
250 console_message.sprintf("remainingCount: %d => ", remainingCount);
251 emit appendToLog(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16));
247
252
248 nBufferSize = 10;
253 if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0)
249 bWait = 1;
254 {
250 // Send the packet and wait on it completing
255 emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed");
251 result = USBSpaceWire_SendPacket(hDevice, pBuffer, nBufferSize, bWait, &pIdentifier);
256 return 1;
252 if (result != TRANSFER_SUCCESS)
257 }
258
259 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
260 address = address + READ_WRITE_MAX_COUNTS * 4;
261 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
262 }
263
264 if (remainingCount > 0)
253 {
265 {
254 emit sendMessage("Error: Could not send the packet");
266 for (unsigned int i = 0; i<remainingCount; i++)
255 }
267 {
256 else emit sendMessage("The packet has been successfully sent");
268 data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]);
269 data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8);
270 data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16);
271 data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24);
272 }
273
274 console_message.sprintf("remainingCount: %d => ", remainingCount);
275 emit appendToLog(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16));
257
276
258 // Free the send
277 if (WriteBLOCK(data, remainingCount*4, address)==0)
259 USBSpaceWire_FreeSend(hDevice, pIdentifier);
278 {
279 emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed");
280 return 1;
281 }
282 }
260
283
261 return 1;
284 emit appendToLog(QString("*** STOP *** WRITE"));
285 free(data);
286 return count;
262 }
287 }
263
288
264 unsigned int StarDundee::SendRMAP()
289 unsigned int StarDundee::Read(unsigned int *Value, unsigned int count, unsigned int address)
265 {
290 {
266 unsigned int Value[4];
291 unsigned int remainingCount = count;
267 unsigned int count = 4;
292 unsigned int iOffset = 0;
268 unsigned int address = 0x40000000;
293 QString console_message;
269 Value[0] = 0xabcd1234;
294
270 Value[1] = 0xbb;
295 if(rmapPacketSEMAPHORE->available()!=0)
271 Value[2] = 0xab;
296 {
272 Value[3] = 0xcd;
297 emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped");
273 WriteStarDundee(Value, count, address);
298 return 1;
274 return 1;
299 }
300 emit appendToLog(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16));
301
302 while (remainingCount > READ_WRITE_MAX_COUNTS)
303 {
304 console_message.sprintf("remainingCount: %d => ", remainingCount);
305 emit appendToLog(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16));
306
307 if (this->ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0)
308 {
309 emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received");
310 return 1;
311 }
312
313 for(int i=0;i<READ_WRITE_MAX_COUNTS;i++)
314 {
315 Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH];
316 for(int j=1;j<4;j++)
317 {
318 Value[i+iOffset]= ((unsigned char) (rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH]))
319 + Value[i+iOffset]*256;
320 }
321 }
322
323 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
324 address = address + READ_WRITE_MAX_COUNTS * 4;
325 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
326 this->acquireRMAPSemaphore();
327 }
328
329 if (remainingCount > 0)
330 {
331 console_message.sprintf("remainingCount: %d => ", remainingCount);
332 emit appendToLog(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16));
333
334 if (this->ReadBLOCK(4*remainingCount, address)==0)
335 {
336 emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received");
337 return 1;
338 }
339
340 for(unsigned int i=0;i<remainingCount;i++)
341 {
342 Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH];
343 for(int j=1;j<4;j++)
344 {
345 Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256;
346 }
347 }
348 this->acquireRMAPSemaphore();
349 }
350
351 emit appendToLog(QString("*** STOP *** READ "));
352 return count;
275 }
353 }
276
354
277 unsigned int StarDundee::ReadRMAP()
355 unsigned int StarDundee::WriteBLOCK(char *data, unsigned int nbBytes, unsigned int address)
278 {
279 unsigned int Value[100000];
280 unsigned int count = 100000;
281 unsigned int address = 0x40000000;
282 unsigned int result;
283 result = ReadStarDundee(Value, count, address);
284 emit sendMessage("ReadRMAP, nbBytes: " + QString::number(result));
285 emit sendMessage("Value[0]: " + QString::number(Value[0], 16));
286 emit sendMessage("Value[1]: " + QString::number(Value[1], 16));
287 emit sendMessage("Value[2]: " + QString::number(Value[2], 16));
288 emit sendMessage("Value[3]: " + QString::number(Value[3], 16));
289 return 1;
290 }
291
292 unsigned int StarDundee::ReadStarDundee(unsigned int *Value, unsigned int count, unsigned int address)
293 {
356 {
294 RMAP *RMAPCommand;
357 RMAP *RMAPCommand;
295 rmap_read_reply_PcktHdr_t rmapReplyHeader;
358 char * packet;
296 USB_SPACEWIRE_STATUS result; // The result of the receive operation
359 unsigned char offset, headerSize, CRCSize;
297 USB_SPACEWIRE_PACKET_PROPERTIES properties; // The properties of the read
360 char* aux;
298 unsigned int nbBytes;
361 unsigned int totalSize;
299 unsigned char* packet;
362 int errorCode;
300 U32 nPacketNum;
363 QString console_message;
301 unsigned int offset;
302 unsigned int i;
303
364
304 //**********************
365 if (getLinkStatus(this->linkNumber_SPINBOX->value()) == 0)
305 // SEND THE READ COMMAND
306 nbBytes = 4 * count;
307 if (nbBytes > 4)
308 {
366 {
309 RMAPCommand = new RMAP(read_Inc, // build the command
367 this->Close();
310 rmapTargetLogicalAddress,
368 return 1;
311 rmapSourceLogicalAddress,
312 address,
313 nbBytes,
314 NULL);
315 }
316 else
317 {
318 RMAPCommand = new RMAP(read_Single, // build the command
319 rmapTargetLogicalAddress,
320 rmapSourceLogicalAddress,
321 address,
322 nbBytes,
323 NULL);
324 }
369 }
325
370
326 result = USBSpaceWire_SendPacket(hDevice,
371 RMAPCommand = new RMAP(this->commandCode,
327 (unsigned char*) ((void*) &RMAPCommand->RMAPHeader),
328 sizeof(RMAPCommand->RMAPHeader),
329 BWAIT_1, &pIdentifier);
330 if (result != TRANSFER_SUCCESS) emit sendMessage("ERROR *** ReadStarDundee when sending the READ command ");
331 else emit sendMessage("OK *** ReadStarDundee when sending the READ command");
332
333 //*****************
334 // RECEIVE THE DATA
335 nbBytes = sizeof(rmapReplyHeader) + 4 * count + 1; // 1 is for the data CRC
336 packet = (unsigned char *) malloc(nbBytes);
337 nPacketNum = 1;
338 result = USBSpaceWire_ReadPackets(hDevice, packet, nbBytes, nPacketNum, BWAIT_1, &properties, &pIdentifier);
339 if (result != TRANSFER_SUCCESS) emit sendMessage("Error: Could not receive the packet");
340 else
341 {
342 emit sendMessage("A packet of length " + QString::number(properties.len) + " has been successfully received");
343 offset = sizeof(rmapReplyHeader);
344 for(i=0; i<count; i++)
345 {
346 Value[i] = packet[offset+3];
347 Value[i] = Value[i] + packet[offset+2] * pow(2, 8);
348 Value[i] = Value[i] + packet[offset+1] * pow(2, 16);
349 Value[i] = Value[i] + packet[offset+0] * pow(2, 24);
350 offset = offset + 4;
351 }
352 free(packet);
353 USBSpaceWire_FreeRead(hDevice, pIdentifier); // Free the receive
354 return count;
355 }
356
357 return 1;
358 }
359
360 unsigned int StarDundee::WriteStarDundee(unsigned int *Value, unsigned int count, unsigned int address)
361 {
362 RMAP *RMAPCommand;
363 unsigned char *data;
364 char *dataCHAR;
365 unsigned char *aux;
366 unsigned int offset;
367 U32 dataSize, headerSize, CRCSize, totalSize; // sizes in bytes
368 U32 nPacketNum;
369 USB_SPACEWIRE_PACKET_PROPERTIES properties; // The properties of the read
370 rmap_write_reply_t rmapReplyHeader;
371
372 dataSize = count * 4;
373 dataCHAR = (char *) malloc(dataSize);
374 for (unsigned int i = 0; i<count; i++)
375 {
376 dataCHAR[i*4+3] = (char) ((unsigned int) Value[i]);
377 dataCHAR[i*4+2] = (char) ((unsigned int) Value[i]>>8);
378 dataCHAR[i*4+1] = (char) ((unsigned int) Value[i]>>16);
379 dataCHAR[i*4+0] = (char) ((unsigned int) Value[i]>>24);
380 }
381
382 RMAPCommand = new RMAP(commandCode,
383 rmapTargetLogicalAddress,
372 rmapTargetLogicalAddress,
384 rmapSourceLogicalAddress,
373 rmapSourceLogicalAddress,
385 address,
374 address,
386 dataSize,
375 nbBytes,
387 dataCHAR);
376 data);
388 free(dataCHAR);
389 headerSize = sizeof(RMAPCommand->RMAPHeader);
377 headerSize = sizeof(RMAPCommand->RMAPHeader);
390 CRCSize = 1;
378 CRCSize = 1;
391
379
392 //*************************
380 //*************************
393 // BUILD THE PACKET TO SEND
381 // BUILD THE PACKET TO SEND
394 totalSize = headerSize + dataSize + CRCSize;
382 totalSize = headerSize + nbBytes + CRCSize;
395 data = (unsigned char*) malloc( totalSize );
383 packet = (char*) malloc( totalSize );
396 aux = (unsigned char*) ((void*) &RMAPCommand->RMAPHeader);
384 aux = (char*) ((void*) &RMAPCommand->RMAPHeader);
397 for(unsigned int i = 0; i<headerSize; i++) data[i] = aux[i];
385 for(unsigned int i = 0; i<headerSize; i++) packet[i] = aux[i];
398 offset = headerSize;
386 offset = headerSize;
399 for(unsigned int i = 0; i<count; i++)
387 for(unsigned int i = 0; i<nbBytes; i++)
400 {
388 {
401 data[offset+3] = (unsigned char) (Value[i]);
389 packet[i+offset] = data[i];
402 data[offset+2] = (unsigned char) (Value[i]>>8);
403 data[offset+1] = (unsigned char) (Value[i]>>16);
404 data[offset] = (unsigned char) (Value[i]>>24);
405 offset = offset + 4;
406 }
390 }
407 data[offset] = RMAPCommand->dataCRC;
391 packet[nbBytes+offset] = RMAPCommand->dataCRC;
408
392
409 //************
393 //****************
410 // SEND THE PACKET
394 // SEND THE PACKET
411 result = USBSpaceWire_SendPacket(hDevice,
395 result = USBSpaceWire_SendPacket(hDevice,
412 data,
396 packet,
413 totalSize,
397 totalSize,
414 BWAIT_1, &pIdentifier);
398 BWAIT_1, &pIdentifier);
415 if (result != TRANSFER_SUCCESS)
399 if (result != TRANSFER_SUCCESS)
416 {
400 {
417 emit sendMessage("ERROR *** WriteStarDundee when sending packet of size "
401 emit sendMessage("ERROR *** WriteStarDundee when sending packet of size "
418 + QString::number(totalSize) +", with code: " + QString::number(result));
402 + QString::number(totalSize) +", with code: " + QString::number(result));
419 USBSpaceWire_FreeSend(hDevice, pIdentifier);
403 USBSpaceWire_FreeSend(hDevice, pIdentifier);
420 free(data);
404 free(data);
421 return 1;
405 return 1;
422 }
406 }
423 else emit sendMessage("OK *** WriteStarDundee when sending packet of size " + QString::number(totalSize));
407 else emit sendMessage("OK *** WriteStarDundee when sending packet of size " + QString::number(totalSize));
424
408
425 //**************
409 //**************
426 // Free the send
410 // Free the send
427 USBSpaceWire_FreeSend(hDevice, pIdentifier);
411 USBSpaceWire_FreeSend(hDevice, pIdentifier);
428 free(data);
412 free(packet);
429
413
430 if ( (commandCode == writeSingle_noVer_Rep) | (commandCode == writeInc_noVer_Rep) |
414 if ( (commandCode == writeSingle_noVer_Rep) | (commandCode == writeInc_noVer_Rep) |
431 (commandCode == writeSingle_ver_rep) | (commandCode == writeInc_ver_rep) )
415 (commandCode == writeSingle_ver_rep) | (commandCode == writeInc_ver_rep) )
432 {
416 {
433 //***********************
417 // WAIT FOR THE RMAP REPLY PACKET
434 // RECEIVE THE RMAP REPLY
418 errorCode = this->receiveSPWPacket(1);
435 totalSize = sizeof(rmapReplyHeader);
419 if (errorCode<=0)
436 nPacketNum = 1;
437 result = USBSpaceWire_ReadPackets(hDevice, (char *) &rmapReplyHeader, totalSize, nPacketNum, BWAIT_1, &properties, &pIdentifier);
438 if (result != TRANSFER_SUCCESS)
439 {
420 {
440 emit sendMessage("Error: Could not receive the RMAP reply");
421 emit appendToLog("WARNING === in function WriteBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode));
441 USBSpaceWire_FreeRead(hDevice, pIdentifier); // Free the receive
422 return 0;
442 return 1;
443 }
444 else
445 {
446 emit sendMessage("An RMAP reply of length " + QString::number(properties.len) + " has been successfully received");
447 USBSpaceWire_FreeRead(hDevice, pIdentifier); // Free the receive
448 }
423 }
449 if(properties.len != 8)
424 if(rmapPacketSize != 8)
450 {
425 {
451 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** write reply format not compliant\n");
426 console_message.sprintf("WARNING === in function WRITE (with reply) of rmapplugin *** write reply format not compliant\n");
452 return 1;
427 emit appendToLog(console_message);
428 return 0;
453 }
429 }
454 emit sendMessage("data CRC " + QString::number(RMAPCommand->dataCRC, 16) );
430 switch (this->rmapPacket[3]) // byte 4 is the status byte in the reply
455 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.initiatorLogicalAddress, 16) );
456 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.protocolIdentifier, 16) );
457 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.instruction, 16) );
458 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.status, 16) );
459 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.targetLogicalAddress, 16) );
460 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.transactionIdentifier1, 16) );
461 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.transactionIdentifier2, 16) );
462 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.headerCRC, 16) );
463 switch (rmapReplyHeader.status) // byte 4 is the status byte in the reply
464 {
431 {
465 case 0:
432 case 0:
466 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 0 Successfull");
433 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 0 Successfull");
467 break;
434 break;
468 case 1:
435 case 1:
469 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** General error code");
436 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** General error code");
470 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 1 General error code");
437 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 1 General error code");
471 break;
438 break;
472 case 2:
439 case 2:
473 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Unused RMAP packet type or command code");
440 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Unused RMAP packet type or command code");
474 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 2 Unused RMAP packet type or command code");
441 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 2 Unused RMAP packet type or command code");
475 break;
442 break;
476 case 3:
443 case 3:
477 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid key");
444 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid key");
478 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 3 Invalid key");
445 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 3 Invalid key");
479 break;
446 break;
480 case 4:
447 case 4:
481 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid data CRC");
448 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid data CRC");
482 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 4 Invalid data CRC");
449 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 4 Invalid data CRC");
483 break;
450 break;
484 case 5:
451 case 5:
485 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Early EOP");
452 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Early EOP");
486 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 5 Early EOP");
453 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 5 Early EOP");
487 break;
454 break;
488 case 6:
455 case 6:
489 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Too much data");
456 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Too much data");
490 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 6 Too much data");
457 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 6 Too much data");
491 break;
458 break;
492 case 7:
459 case 7:
493 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** EEP");
460 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** EEP");
494 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 7 EEP");
461 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 7 EEP");
495 break;
462 break;
496 case 8:
463 case 8:
497 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Reserved");
464 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Reserved");
498 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 8 Reserved");
465 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 8 Reserved");
499 break;
466 break;
500 case 9:
467 case 9:
501 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Verify buffer overrun");
468 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Verify buffer overrun");
502 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 9 Verify buffer overrun");
469 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 9 Verify buffer overrun");
503 break;
470 break;
504 case 10:
471 case 10:
505 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMAP command not implemented or not authorised");
472 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMAP command not implemented or not authorised");
506 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 10 RMAP command not implemented or not authorised");
473 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 10 RMAP command not implemented or not authorised");
507 break;
474 break;
508 case 11:
475 case 11:
509 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMW data length error");
476 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMW data length error");
510 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 11 RMAP RMW data length error");
477 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 11 RMAP RMW data length error");
511 break;
478 break;
512 case 12:
479 case 12:
513 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid target logical address");
480 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid target logical address");
514 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 12 Invalid target logical address");
481 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 12 Invalid target logical address");
515 break;
482 break;
516 }
483 }
484 this->acquireRMAPSemaphore();
517 }
485 }
518 else
486 else
519 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: unavailable");
487 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: unavailable");
520 return count;
488
489 return nbBytes;
490 }
491
492 unsigned int StarDundee::ReadBLOCK(unsigned int nbBytes, unsigned int address)
493 {
494 int errorCode;
495 RMAP *RMAPCommand;
496 unsigned int dataLength;
497
498 //**********************
499 // Check the link status
500 if ( getLinkStatus( this->linkNumber_SPINBOX->value() ) == 0 )
501 {
502 this->Close();
503 emit appendToLog("WARNING === in function WriteSPW of StarDundee *** SPW link not running\n");
504 return 0;
505 }
506
507 //**********************
508 // SEND THE READ COMMAND
509 if (nbBytes > 4)
510 {
511 RMAPCommand = new RMAP(read_Inc,
512 rmapTargetLogicalAddress,
513 rmapSourceLogicalAddress,
514 address,
515 nbBytes,
516 NULL);
517 }
518 else
519 {
520 RMAPCommand = new RMAP(read_Single,
521 rmapTargetLogicalAddress,
522 rmapSourceLogicalAddress,
523 address,
524 nbBytes,
525 NULL);
526 }
527 result = USBSpaceWire_SendPacket(hDevice,
528 (unsigned char*) ((void*) &RMAPCommand->RMAPHeader),
529 sizeof(RMAPCommand->RMAPHeader),
530 BWAIT_1, &pIdentifier);
531 if (result != TRANSFER_SUCCESS) emit sendMessage("ERR *** ReadStarDundee *** ReadBLOCK *** sending the READ command ");
532 else emit sendMessage("OK *** ReadStarDundee *** ReadBLOCK *** sending the READ command");
533
534 //*********************************
535 // RECEIVE THE INCOMING RMAP PACKET
536 errorCode = this->receiveSPWPacket(1); // request ID 1 is for RMAP packet
537 if (errorCode<=0)
538 {
539 emit appendToLog("WARNING === in function ReadBLOCK of StarDundee *** RMAP packet reception failed with code " + QString::number(errorCode));
540 return 0;
541 }
542 dataLength = rmapPacketSize - RMAP_READ_REPLY_HEADER_LENGTH - RMAP_DATA_CRC_LENGTH;
543 if(dataLength != nbBytes)
544 {
545 emit appendToLog("WARNING === in function READ of StarDundee *** number of data received ("
546 +QString::number(dataLength)
547 +") not equal to number of data requested ("
548 +QString::number(nbBytes)
549 +")");
550 return 0;
551 }
552 return dataLength;
521 }
553 }
522
554
523 //******
555 unsigned int StarDundee::WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication)
524 // SLOTS
556 {
557 char protocoleIdentifier = 0x02;
558 char reserved = 0x00;
559 char *SPWData;
560 unsigned int totalSize;
561
562 if (count>248)
563 {
564 emit appendToLog("WARNING === in function WRITE of rmapplugin *** CCSDS packet size > 248 bytes\n");
565 return 1;
566 }
567
568 emit appendToLog("*** START *** Send CCSDS packet of "+ QString::number(count) + " byte(s)");
569
570 if ( getLinkStatus( this->linkNumber_SPINBOX->value() ) == 0 )
571 {
572 this->Close();
573 emit appendToLog("WARNING === in function WriteSPW of StarDundee *** SPW link not running\n");
574 return 1;
575 }
576
577 totalSize = count + 4;
578 SPWData = (char*) malloc(totalSize);
579 // SPW HEADER
580 SPWData[0] = targetLogicalAddress;
581 SPWData[1] = protocoleIdentifier;
582 SPWData[2] = reserved;
583 SPWData[3] = userApplication;
584 // CCSDS PACKET
585 for (unsigned int i = 0; i<count; i++)
586 {
587 SPWData[i+4] = Value[i];
588 }
589
590 //************
591 // SEND THE PACKET
592 result = USBSpaceWire_SendPacket(hDevice,
593 SPWData,
594 totalSize,
595 BWAIT_1, &pIdentifier);
596 if (result != TRANSFER_SUCCESS)
597 {
598 emit sendMessage("ERROR *** WriteSPW when sending packet of size "
599 + QString::number(totalSize) +", with code: " + QString::number(result));
600 USBSpaceWire_FreeSend(hDevice, pIdentifier);
601 free(SPWData);
602 return 0;
603 }
604 else emit sendMessage("OK *** WriteSPW when sending packet of size " + QString::number(totalSize));
605
606 //**************
607 // Free the send
608 USBSpaceWire_FreeSend(hDevice, pIdentifier);
609 free(SPWData);
610
611 emit appendToLog(QString("*** CCSDS packet sent"));
612
613 return 1;
614 }
615
616 unsigned int StarDundee::getLinkStatus(unsigned char link)
617 {
618 U32 statusControl, errorStatus, portType;
619 U32 linkStatus, operatingSpeed, outputPortConnection;
620 char isLinkRunning, isAutoStart, isStart, isDisabled, isTristate;
525
621
526 void StarDundee::updateCommandCode(RMAP_command_codes code)
622 // Read the link status control register
623 if (CFGSpaceWire_GetLinkStatusControl(hDevice, 1, &statusControl) != CFG_TRANSFER_SUCCESS)
624 {
625 emit appendToLog("Could not read link status control for link" + QString::number(link));
626 }
627 else
628 {
629 // Display the link status control register properties
630 CFGSpaceWire_LSPortType(statusControl, &portType);
631 if (portType == CFG_CONFIGURATION_PORT)
632 {
633 CFGSpaceWire_LSConfigErrorStatus(statusControl, &errorStatus);
634 //emit appendToLog("Configuration port error status = " + QString::number(errorStatus));
635 }
636 else if (portType == CFG_SPACEWIRE_EXTERNAL_PORT)
637 {
638 CFGSpaceWire_LSExternalErrorStatus(statusControl, &errorStatus);
639 //emit appendToLog("External port error status = " + QString::number(errorStatus));
640 }
641 else
642 {
643 CFGSpaceWire_LSErrorStatus(statusControl, &errorStatus);
644 //emit appendToLog("SpaceWire link error status = " + QString::number(errorStatus));
645 }
646 CFGSpaceWire_LSLinkState(statusControl, &linkStatus);
647 CFGSpaceWire_LSIsLinkRunning(statusControl, &isLinkRunning);
648 CFGSpaceWire_LSIsAutoStart(statusControl, &isAutoStart);
649 CFGSpaceWire_LSIsStart(statusControl, &isStart);
650 CFGSpaceWire_LSIsDisabled(statusControl, &isDisabled);
651 CFGSpaceWire_LSIsTristate(statusControl, &isTristate);
652 CFGSpaceWire_LSOperatingSpeed(statusControl, &operatingSpeed);
653 CFGSpaceWire_LSOutputPortConnection(statusControl, &outputPortConnection);
654 //emit appendToLog("The link state is = " + QString::number(linkStatus));
655 //emit appendToLog("The link is running = " + QString::number(isLinkRunning));
656 //emit appendToLog("The autostart bit is enabled = " + QString::number(isAutoStart));
657 //emit appendToLog("The start bit is enabled = " + QString::number(isStart));
658 //emit appendToLog("The link is disabled = " + QString::number(isDisabled));
659 //emit appendToLog("The tri-state bit is enabled = " + QString::number(isAutoStart));
660 //emit appendToLog("The operating speed is = " + QString::number(operatingSpeed));
661 //emit appendToLog("This port is currently connected to output port = " + QString::number(outputPortConnection));
662 }
663 if (linkStatus == 5) return 1;
664 else return 0;
665 }
666
667 int StarDundee::receiveSPWPacket(unsigned char requestID) // SLOT
527 {
668 {
528 this->commandCode = code;
669 unsigned int packetLength;
670 unsigned int nbBytes;
671 unsigned nPacketNum;
672 USB_SPACEWIRE_PACKET_PROPERTIES properties; // The properties of the read
673
674 if (requestID==1)
675 {
676 if (rmapPacketSEMAPHORE->available()) return rmapPacketSize;
677 }
678
679 //********************
680 // TRY TO RECEIVE DATA
681 nbBytes = qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH); // maximum size of the packet to receive
682 nPacketNum = 1;
683 result = USBSpaceWire_ReadPackets(hDevice, spwPacket, nbBytes, nPacketNum, BWAIT_1, &properties, &pIdentifier);
684 if (result != TRANSFER_SUCCESS) emit sendMessage("Error: Could not receive the packet");
685 else
686 {
687 emit sendMessage("A packet of length " + QString::number(properties.len) + " has been successfully received");
688 USBSpaceWire_FreeRead(hDevice, pIdentifier); // Free the receive
689 }
690 packetLength = properties.len;
691
692 switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet
693 {
694 case 1: // 0x01 is the protocole identifier for RMAP packets
695 if (rmapPacketSEMAPHORE->available()!=0) return -3; // ERROR === previous RMAP packet not processed yet
696 for(unsigned int i=0; i<packetLength; i++) rmapPacket[i] = spwPacket[i];
697 rmapPacketSize = packetLength;
698 rmapPacketSEMAPHORE->release();
699 emit sendMessage("RMAP packet of size " + QString::number(packetLength) + " received");
700 return packetLength;
701
702 case 2: // 0x02 is the protocole identifier for CCSDS packets
703 if (ccsdsPacketSEMAPHORE->available()!=0) return -4; // ERROR === previous CCSDS packet not processed yet
704 for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i];
705 ccsdsPacketSize = packetLength;
706 ccsdsPacketSEMAPHORE->release();
707 emit(ccsdsPacketAvailable(ccsdsPacket, packetLength));
708 return packetLength;
709 }
710 return 0;
529 }
711 }
712
713
@@ -1,72 +1,82
1 #ifndef STARDUNDEE_H
1 #ifndef STARDUNDEE_H
2 #define STARDUNDEE_H
2 #define STARDUNDEE_H
3
3
4 #include <QWidget>
4 #include <QWidget>
5 #include "spw_usb_api.h"
5 #include "spw_usb_api.h"
6 #include "spw_config_library.h"
6 #include "spw_config_library.h"
7 #include <QPushButton>
7 #include <QPushButton>
8 #include <QGridLayout>
8 #include <QGridLayout>
9 #include <QSpinBox>
9 #include <QSpinBox>
10 #include <QLabel>
10 #include <QLabel>
11 #include <QSemaphore>
11 #include "rmapoperations.h"
12 #include "rmapoperations.h"
12
13
13 #define BWAIT_0 0
14 #define BWAIT_0 0
14 #define BWAIT_1 1
15 #define BWAIT_1 1
15
16
16 class StarDundee : public QWidget
17 class StarDundee : public QWidget
17 {
18 {
18 Q_OBJECT
19 Q_OBJECT
19 public:
20 public:
20 explicit StarDundee(QWidget *parent = 0);
21 explicit StarDundee(QWidget *parent = 0);
21 ~StarDundee();
22 ~StarDundee();
22 unsigned int WriteStarDundee(unsigned int *Value,unsigned int count,unsigned int address=0);
23 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
23 unsigned int ReadStarDundee(unsigned int *Value,unsigned int count,unsigned int address=0);
24 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
25 unsigned int WriteStarDundee(unsigned int *Value, unsigned int count, unsigned int address);
26 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
27 unsigned int getLinkStatus(unsigned char link);
24
28
25 signals:
29 signals:
26 void sendMessage(QString message);
30 void sendMessage(QString message);
27 void starDundeeIsOpen(bool);
31 void isOpen(bool);
28 void RMAP_write_reply_setText(QString);
32 void RMAP_write_reply_setText(QString);
29 void appendToLog(QString);
33 void appendToLog(QString);
34 void ccsdsPacketAvailable(unsigned char*, unsigned int);
30
35
31 public slots:
36 public slots:
32 unsigned int OpenStarDundee();
37 unsigned int Open();
33 unsigned int CloseStarDundee();
38 unsigned int Close();
34 unsigned int SendPacket();
39 int receiveSPWPacket(unsigned char requestID);
35 unsigned int SendRMAP();
40 void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
36 unsigned int ReadRMAP();
41 void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
37 unsigned int GetRoutingTableEntry();
42 void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;}
38 void updateCommandCode(RMAP_command_codes code);
39
43
40 private:
44 private:
41 char rmapTargetLogicalAddress ;
45 unsigned int GetRoutingTableEntry();
42 char rmapSourceLogicalAddress ;
46 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
47 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
48 void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->acquire();}
49 void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->acquire();}
43
50
44 QPushButton *sendPacket_BUTTON;
51 unsigned char rmapTargetLogicalAddress ;
45 QPushButton *sendRMAPPacket_BUTTON;
52 unsigned char rmapSourceLogicalAddress ;
46 QPushButton *readRMAPPacket_BUTTON;
53
47 QPushButton *getRoutingTableEntry_BUTTON;
54 RMAP_command_codes commandCode;
48
55
49 QLabel *usbDeviceNumber_LABEL;
56 QLabel *usbDeviceNumber_LABEL;
50 QLabel *linkNumber_LABEL;
57 QLabel *linkNumber_LABEL;
51 QLabel *routingTableEntry_LABEL;
52 QLabel *sourceLogicalAddress_LABEL;
58 QLabel *sourceLogicalAddress_LABEL;
53
59
54 QSpinBox *usbDeviceNumber_SPINBOX;
60 QSpinBox *usbDeviceNumber_SPINBOX;
55 QSpinBox *linkNumber_SPINBOX;
61 QSpinBox *linkNumber_SPINBOX;
56 QSpinBox *routingTableEntry_SPINBOX;
57 QSpinBox *sourceLogicalAddress_SPINBOX;
62 QSpinBox *sourceLogicalAddress_SPINBOX;
58
63
59 QGridLayout *connection_LAYOUT;
64 QGridLayout *connection_LAYOUT;
60
65
61 unsigned char pBuffer[10]; // Pointer to the start of the user buffer from which to transmit data
66 unsigned char pBuffer[10]; // Pointer to the start of the user buffer from which to transmit data
62 unsigned char* rmapPacket; // The buffer to receive RMAP READ packets
63 USB_SPACEWIRE_ID pIdentifier; // A pointer to a variable which will be set to contain a unique identifier for the send
67 USB_SPACEWIRE_ID pIdentifier; // A pointer to a variable which will be set to contain a unique identifier for the send
64
68
65 RMAP_command_codes commandCode;
66
67 star_device_handle hDevice; // Handle to the SpaceWire device
69 star_device_handle hDevice; // Handle to the SpaceWire device
68 USB_SPACEWIRE_STATUS result; // The result of the send operation
70 USB_SPACEWIRE_STATUS result; // The result of the send operation
69
71
72 // Packet receiver
73 QSemaphore *rmapPacketSEMAPHORE;
74 QSemaphore *ccsdsPacketSEMAPHORE;
75 char* rmapPacket; // The buffer to receive RMAP READ packets
76 unsigned char *ccsdsPacket;
77 char *spwPacket;
78 unsigned int rmapPacketSize;
79 unsigned int ccsdsPacketSize;
70 };
80 };
71
81
72 #endif // STARDUNDEE_H
82 #endif // STARDUNDEE_H
General Comments 0
You need to be logged in to leave comments. Login now