@@ -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-10T1 |
|
3 | <!-- Written by Qt Creator 2.4.1, 2012-12-10T15:32:54. --> | |
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,156 +1,155 | |||||
1 | #include "bridge.h" |
|
1 | #include "bridge.h" | |
2 |
|
2 | |||
3 | bridge::bridge(QWidget *parent) : |
|
3 | bridge::bridge(QWidget *parent) : | |
4 | QWidget(parent) |
|
4 | QWidget(parent) | |
5 | { |
|
5 | { | |
6 | // Packet receiver |
|
6 | // Packet receiver | |
7 | rmapPacketSEMAPHORE = new QSemaphore; |
|
7 | rmapPacketSEMAPHORE = new QSemaphore; | |
8 | ccsdsPacketSEMAPHORE = new QSemaphore; |
|
8 | ccsdsPacketSEMAPHORE = new QSemaphore; | |
9 | rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH); |
|
9 | rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH); | |
10 | ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH); |
|
10 | ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH); | |
11 | spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) ); |
|
11 | spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) ); | |
12 |
|
12 | |||
13 | bridge_LAYOUT = new QGridLayout; |
|
13 | bridge_LAYOUT = new QGridLayout; | |
14 | } |
|
14 | } | |
15 |
|
15 | |||
16 | bridge::~bridge() |
|
16 | bridge::~bridge() | |
17 | { |
|
17 | { | |
18 | free(rmapPacket); |
|
18 | free(rmapPacket); | |
19 | free(ccsdsPacket); |
|
19 | free(ccsdsPacket); | |
20 | free(spwPacket); |
|
20 | free(spwPacket); | |
21 | } |
|
21 | } | |
22 |
|
22 | |||
23 | unsigned int bridge::Write(unsigned int *Value, unsigned int count, unsigned int address) |
|
23 | unsigned int bridge::Write(unsigned int *Value, unsigned int count, unsigned int address) | |
24 | { |
|
24 | { | |
25 | unsigned int remainingCount = count; |
|
25 | unsigned int remainingCount = count; | |
26 | unsigned int iOffset = 0; |
|
26 | unsigned int iOffset = 0; | |
27 | QString console_message; |
|
27 | QString console_message; | |
28 | char* data; |
|
28 | char* data; | |
29 |
|
29 | |||
30 | if(rmapPacketSEMAPHORE->available()!=0) |
|
30 | if(rmapPacketSEMAPHORE->available()!=0) | |
31 | { |
|
31 | { | |
32 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped"); |
|
32 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped"); | |
33 | return 1; |
|
33 | return 1; | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | emit this->RMAP_write_reply_setText("reply to the write command required\nlast reply status: unavailable"); |
|
36 | emit this->RMAP_write_reply_setText("reply to the write command required\nlast reply status: unavailable"); | |
37 |
|
37 | |||
38 | data = (char*) malloc(READ_WRITE_MAX_COUNTS*4); |
|
38 | data = (char*) malloc(READ_WRITE_MAX_COUNTS*4); | |
39 |
|
39 | |||
40 | emit appendToLog(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); |
|
40 | emit appendToLog(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); | |
41 |
|
41 | |||
42 | while (remainingCount > READ_WRITE_MAX_COUNTS) |
|
42 | while (remainingCount > READ_WRITE_MAX_COUNTS) | |
43 | { |
|
43 | { | |
44 | for (int i = 0; i<READ_WRITE_MAX_COUNTS; i++) |
|
44 | for (int i = 0; i<READ_WRITE_MAX_COUNTS; i++) | |
45 | { |
|
45 | { | |
46 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); |
|
46 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); | |
47 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); |
|
47 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); | |
48 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); |
|
48 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); | |
49 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); |
|
49 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); | |
50 | } |
|
50 | } | |
51 |
|
51 | |||
52 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
52 | console_message.sprintf("remainingCount: %d => ", remainingCount); | |
53 | emit appendToLog(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
53 | emit appendToLog(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16)); | |
54 |
|
54 | |||
55 | if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0) |
|
55 | if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0) | |
56 | { |
|
56 | { | |
57 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); |
|
57 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); | |
58 | return 1; |
|
58 | return 1; | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; |
|
61 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; | |
62 | address = address + READ_WRITE_MAX_COUNTS * 4; |
|
62 | address = address + READ_WRITE_MAX_COUNTS * 4; | |
63 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; |
|
63 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | if (remainingCount > 0) |
|
66 | if (remainingCount > 0) | |
67 | { |
|
67 | { | |
68 | for (unsigned int i = 0; i<remainingCount; i++) |
|
68 | for (unsigned int i = 0; i<remainingCount; i++) | |
69 | { |
|
69 | { | |
70 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); |
|
70 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); | |
71 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); |
|
71 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); | |
72 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); |
|
72 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); | |
73 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); |
|
73 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
76 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
76 | console_message.sprintf("remainingCount: %d => ", remainingCount); | |
77 | emit appendToLog(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
77 | emit appendToLog(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16)); | |
78 |
|
78 | |||
79 | if (WriteBLOCK(data, remainingCount*4, address)==0) |
|
79 | if (WriteBLOCK(data, remainingCount*4, address)==0) | |
80 | { |
|
80 | { | |
81 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); |
|
81 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); | |
82 | return 1; |
|
82 | return 1; | |
83 | } |
|
83 | } | |
84 | } |
|
84 | } | |
85 |
|
85 | |||
86 | emit appendToLog(QString("*** STOP *** WRITE")); |
|
86 | emit appendToLog(QString("*** STOP *** WRITE")); | |
87 | free(data); |
|
87 | free(data); | |
88 | return count; |
|
88 | return count; | |
89 | } |
|
89 | } | |
90 |
|
90 | |||
91 | unsigned int bridge::Read(unsigned int *Value, unsigned int count, unsigned int address) |
|
91 | unsigned int bridge::Read(unsigned int *Value, unsigned int count, unsigned int address) | |
92 | { |
|
92 | { | |
93 | unsigned int remainingCount = count; |
|
93 | unsigned int remainingCount = count; | |
94 | unsigned int iOffset = 0; |
|
94 | unsigned int iOffset = 0; | |
95 | QString console_message; |
|
95 | QString console_message; | |
96 |
|
96 | |||
97 | if(rmapPacketSEMAPHORE->available()!=0) |
|
97 | if(rmapPacketSEMAPHORE->available()!=0) | |
98 | { |
|
98 | { | |
99 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped"); |
|
99 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped"); | |
100 | return 1; |
|
100 | return 1; | |
101 | } |
|
101 | } | |
102 | emit appendToLog(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); |
|
102 | emit appendToLog(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); | |
103 |
|
103 | |||
104 | while (remainingCount > READ_WRITE_MAX_COUNTS) |
|
104 | while (remainingCount > READ_WRITE_MAX_COUNTS) | |
105 | { |
|
105 | { | |
106 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
106 | console_message.sprintf("remainingCount: %d => ", remainingCount); | |
107 | emit appendToLog(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
107 | emit appendToLog(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16)); | |
108 |
|
108 | |||
109 | if (this->ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0) |
|
109 | if (this->ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0) | |
110 | { |
|
110 | { | |
111 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received"); |
|
111 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received"); | |
112 | return 1; |
|
112 | return 1; | |
113 | } |
|
113 | } | |
114 |
|
114 | |||
115 | for(int i=0;i<READ_WRITE_MAX_COUNTS;i++) |
|
115 | for(int i=0;i<READ_WRITE_MAX_COUNTS;i++) | |
116 | { |
|
116 | { | |
117 | Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; |
|
117 | Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; | |
118 | for(int j=1;j<4;j++) |
|
118 | for(int j=1;j<4;j++) | |
119 | { |
|
119 | { | |
120 | Value[i+iOffset]= ((unsigned char) (rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) |
|
120 | Value[i+iOffset]= ((unsigned char) (rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) | |
121 | + Value[i+iOffset]*256; |
|
121 | + Value[i+iOffset]*256; | |
122 | } |
|
122 | } | |
123 | } |
|
123 | } | |
124 |
|
124 | |||
125 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; |
|
125 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; | |
126 | address = address + READ_WRITE_MAX_COUNTS * 4; |
|
126 | address = address + READ_WRITE_MAX_COUNTS * 4; | |
127 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; |
|
127 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; | |
128 | rmapPacketSEMAPHORE->acquire(); |
|
128 | rmapPacketSEMAPHORE->acquire(); | |
129 | } |
|
129 | } | |
130 |
|
130 | |||
131 | if (remainingCount > 0) |
|
131 | if (remainingCount > 0) | |
132 | { |
|
132 | { | |
133 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
133 | console_message.sprintf("remainingCount: %d => ", remainingCount); | |
134 | emit appendToLog(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
134 | emit appendToLog(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16)); | |
135 |
|
135 | |||
136 | if (this->ReadBLOCK(4*remainingCount, address)==0) |
|
136 | if (this->ReadBLOCK(4*remainingCount, address)==0) | |
137 | { |
|
137 | { | |
138 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received"); |
|
138 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received"); | |
139 | return 1; |
|
139 | return 1; | |
140 | } |
|
140 | } | |
141 |
|
141 | |||
142 | for(unsigned int i=0;i<remainingCount;i++) |
|
142 | for(unsigned int i=0;i<remainingCount;i++) | |
143 | { |
|
143 | { | |
144 | Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; |
|
144 | Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; | |
145 | for(int j=1;j<4;j++) |
|
145 | for(int j=1;j<4;j++) | |
146 | { |
|
146 | { | |
147 | Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256; |
|
147 | Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256; | |
148 | } |
|
148 | } | |
149 | } |
|
149 | } | |
150 | rmapPacketSEMAPHORE->acquire(); |
|
150 | rmapPacketSEMAPHORE->acquire(); | |
151 | } |
|
151 | } | |
152 |
|
152 | |||
153 | emit appendToLog(QString("*** STOP *** READ ")); |
|
153 | emit appendToLog(QString("*** STOP *** READ ")); | |
154 | return count; |
|
154 | return count; | |
155 | } |
|
155 | } | |
156 |
|
@@ -1,54 +1,54 | |||||
1 | #ifndef BRIDGE_H |
|
1 | #ifndef BRIDGE_H | |
2 | #define BRIDGE_H |
|
2 | #define BRIDGE_H | |
3 |
|
3 | |||
4 | #include <QWidget> |
|
4 | #include <QWidget> | |
5 | #include <QSemaphore> |
|
5 | #include <QSemaphore> | |
6 | #include <QGridLayout> |
|
6 | #include <QGridLayout> | |
7 | #include "rmapoperations.h" |
|
7 | #include "rmapoperations.h" | |
8 |
|
8 | |||
9 | class bridge : public QWidget |
|
9 | class bridge : public QWidget | |
10 | { |
|
10 | { | |
11 | Q_OBJECT |
|
11 | Q_OBJECT | |
12 | public: |
|
12 | public: | |
13 | explicit bridge(QWidget *parent = 0); |
|
13 | explicit bridge(QWidget *parent = 0); | |
14 | ~bridge(); |
|
14 | ~bridge(); | |
15 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
15 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); | |
16 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
16 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); | |
17 | virtual unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); |
|
17 | //virtual unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); | |
18 | virtual unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0) = 0; |
|
18 | virtual unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0) = 0; | |
19 | virtual unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0) = 0; |
|
19 | virtual unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0) = 0; | |
20 | virtual unsigned int getLinkStatus(unsigned char link) = 0; |
|
20 | //virtual unsigned int getLinkStatus(unsigned char link) = 0; | |
21 |
|
21 | |||
22 | unsigned char rmapTargetLogicalAddress ; |
|
22 | unsigned char rmapTargetLogicalAddress ; | |
23 | unsigned char rmapSourceLogicalAddress ; |
|
23 | unsigned char rmapSourceLogicalAddress ; | |
24 |
|
24 | |||
25 | RMAP_command_codes commandCode; |
|
25 | RMAP_command_codes commandCode; | |
26 |
|
26 | |||
27 | QGridLayout *bridge_LAYOUT; |
|
27 | QGridLayout *bridge_LAYOUT; | |
28 |
|
28 | |||
29 | QSemaphore *rmapPacketSEMAPHORE; |
|
29 | QSemaphore *rmapPacketSEMAPHORE; | |
30 | QSemaphore *ccsdsPacketSEMAPHORE; |
|
30 | QSemaphore *ccsdsPacketSEMAPHORE; | |
31 |
|
31 | |||
32 | char *spwPacket; |
|
32 | char *spwPacket; | |
33 | char* rmapPacket; |
|
33 | char* rmapPacket; | |
34 | unsigned char *ccsdsPacket; |
|
34 | unsigned char *ccsdsPacket; | |
35 |
|
35 | |||
36 | signals: |
|
36 | signals: | |
37 | void sendMessage(QString message); |
|
37 | void sendMessage(QString message); | |
38 | void isOpen(bool); |
|
38 | void isOpen(bool); | |
39 | void RMAP_write_reply_setText(QString); |
|
39 | void RMAP_write_reply_setText(QString); | |
40 | void appendToLog(QString); |
|
40 | void appendToLog(QString); | |
41 | void ccsdsPacketAvailable(unsigned char*, unsigned int); |
|
41 | void ccsdsPacketAvailable(unsigned char*, unsigned int); | |
42 |
|
42 | |||
43 | public slots: |
|
43 | public slots: | |
44 | unsigned int Open(); |
|
44 | //unsigned int Open(); | |
45 | unsigned int Close(); |
|
45 | //unsigned int Close(); | |
46 | virtual int receiveSPWPacket(unsigned char requestID) = 0; |
|
46 | //virtual int receiveSPWPacket(unsigned char requestID) = 0; | |
47 | void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} |
|
47 | void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} | |
48 | void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} |
|
48 | void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} | |
49 | void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;} |
|
49 | void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;} | |
50 |
|
50 | |||
51 | private: |
|
51 | private: | |
52 | }; |
|
52 | }; | |
53 |
|
53 | |||
54 | #endif // BRIDGE_H |
|
54 | #endif // BRIDGE_H |
@@ -1,687 +1,799 | |||||
1 | #include "gresb.h" |
|
1 | #include "gresb.h" | |
2 | #include <QTime> |
|
2 | #include <QTime> | |
3 | #include <QHostAddress> |
|
3 | #include <QHostAddress> | |
4 |
|
4 | |||
5 | gresb::gresb(QWidget *parent) : |
|
5 | gresb::gresb(QWidget *parent) : | |
6 | QWidget(parent) |
|
6 | QWidget(parent) | |
7 | { |
|
7 | { | |
8 | RMAPSend_SOCKET = new QTcpSocket; |
|
8 | RMAPSend_SOCKET = new QTcpSocket; | |
9 | RMAPReceive_SOCKET = new QTcpSocket; |
|
9 | RMAPReceive_SOCKET = new QTcpSocket; | |
10 | GRESBStatusQuery_SOCKET = new QTcpSocket; |
|
10 | GRESBStatusQuery_SOCKET = new QTcpSocket; | |
11 |
|
11 | |||
|
12 | rmapPacketSEMAPHORE = new QSemaphore; | |||
|
13 | ccsdsPacketSEMAPHORE = new QSemaphore; | |||
12 | rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH); |
|
14 | rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH); | |
13 | ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH); |
|
15 | ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH); | |
14 | spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) ); |
|
16 | spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) ); | |
15 |
|
17 | |||
16 | commandCode = invalid0; // initialization of the command code for the RMAP transfers |
|
18 | commandCode = invalid0; // initialization of the command code for the RMAP transfers | |
17 |
|
19 | |||
18 | //*** QLABEL ***// |
|
20 | //*** QLABEL ***// | |
19 | gresbBridgeIPLabel = new QLabel(tr("GRESB Bridge IP: ")); |
|
21 | gresbBridgeIPLabel = new QLabel(tr("GRESB Bridge IP: ")); | |
20 | gresbVirtualLinkLabel = new QLabel(tr("GRESB Virtual Link: ")); |
|
22 | gresbVirtualLinkLabel = new QLabel(tr("GRESB Virtual Link: ")); | |
21 | spwLinkLabel = new QLabel(tr("GRESB SPW Link: ")); |
|
23 | spwLinkLabel = new QLabel(tr("GRESB SPW Link: ")); | |
22 | rmapSourceLogicalAddressLabel = new QLabel(tr("RMAP Source Logical Address: ")); |
|
24 | rmapSourceLogicalAddressLabel = new QLabel(tr("RMAP Source Logical Address: ")); | |
23 | rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection")); |
|
25 | rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection")); | |
24 | rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection")); |
|
26 | rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection")); | |
25 | gresbStatusQueryLabel = new QLabel(tr("GRESB status query socket (port 3010): waiting for connection")); |
|
27 | gresbStatusQueryLabel = new QLabel(tr("GRESB status query socket (port 3010): waiting for connection")); | |
26 | gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running")); |
|
28 | gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running")); | |
27 |
|
29 | |||
28 | //*** SPINBOX ***// |
|
30 | //*** SPINBOX ***// | |
29 | gresbVirtualLinkSpinBox = new QSpinBox; |
|
31 | gresbVirtualLinkSpinBox = new QSpinBox; | |
30 | rmapSourceLogicalAddressSpinBox = new QSpinBox; |
|
32 | rmapSourceLogicalAddressSpinBox = new QSpinBox; | |
31 | spwLinkSpinBox = new QSpinBox;; |
|
33 | spwLinkSpinBox = new QSpinBox;; | |
32 | gresbVirtualLinkSpinBox->setRange(0, 4); |
|
34 | gresbVirtualLinkSpinBox->setRange(0, 4); | |
33 | gresbVirtualLinkSpinBox->setValue(1); |
|
35 | gresbVirtualLinkSpinBox->setValue(1); | |
34 | rmapSourceLogicalAddressSpinBox->setRange(0, 255); |
|
36 | rmapSourceLogicalAddressSpinBox->setRange(0, 255); | |
35 | rmapSourceLogicalAddressSpinBox->setValue(33); |
|
37 | rmapSourceLogicalAddressSpinBox->setValue(33); | |
36 | spwLinkSpinBox->setRange(0, 2); |
|
38 | spwLinkSpinBox->setRange(0, 2); | |
37 | spwLinkSpinBox->setValue(0); |
|
39 | spwLinkSpinBox->setValue(0); | |
38 |
|
40 | |||
39 | //*** QPUSHBUTTON ***// |
|
41 | //*** QPUSHBUTTON ***// | |
40 | gresbStatusQueryRetryButton = new QPushButton(tr("Retry")); |
|
42 | gresbStatusQueryRetryButton = new QPushButton(tr("Retry")); | |
41 | gresbStatusQueryAbortButton = new QPushButton(tr("Abort")); |
|
43 | gresbStatusQueryAbortButton = new QPushButton(tr("Abort")); | |
42 |
|
44 | |||
43 | //*** LAYOUT ***// |
|
45 | //*** LAYOUT ***// | |
44 | connectionLayout = new QGridLayout; |
|
46 | connectionLayout = new QGridLayout; | |
45 |
|
47 | |||
46 | //*** MISC ***// |
|
48 | //*** MISC ***// | |
47 | gresbStatusQueryDialog = new QDialog; |
|
49 | gresbStatusQueryDialog = new QDialog; | |
48 | gresbBridgeIPDialogBox = new QIPDialogBox; |
|
50 | gresbBridgeIPDialogBox = new QIPDialogBox; | |
49 | spwLinkStatusEnquiry = new gresbStatusEnquiry; |
|
51 | spwLinkStatusEnquiry = new gresbStatusEnquiry; | |
50 |
|
52 | |||
51 | connectionLayout->addWidget(gresbBridgeIPLabel, 0, 0, 0); |
|
53 | connectionLayout->addWidget(gresbBridgeIPLabel, 0, 0, 0); | |
52 | connectionLayout->addWidget(gresbBridgeIPDialogBox, 0, 1, 0); |
|
54 | connectionLayout->addWidget(gresbBridgeIPDialogBox, 0, 1, 0); | |
53 | connectionLayout->addWidget(gresbVirtualLinkLabel, 1, 0, 0); |
|
55 | connectionLayout->addWidget(gresbVirtualLinkLabel, 1, 0, 0); | |
54 | connectionLayout->addWidget(gresbVirtualLinkSpinBox, 1, 1, 0); |
|
56 | connectionLayout->addWidget(gresbVirtualLinkSpinBox, 1, 1, 0); | |
55 | connectionLayout->addWidget(spwLinkLabel, 2, 0, 0); |
|
57 | connectionLayout->addWidget(spwLinkLabel, 2, 0, 0); | |
56 | connectionLayout->addWidget(spwLinkSpinBox, 2, 1, 0); |
|
58 | connectionLayout->addWidget(spwLinkSpinBox, 2, 1, 0); | |
57 | connectionLayout->addWidget(rmapSourceLogicalAddressLabel, 3, 0, 0); |
|
59 | connectionLayout->addWidget(rmapSourceLogicalAddressLabel, 3, 0, 0); | |
58 | connectionLayout->addWidget(rmapSourceLogicalAddressSpinBox, 3, 1, 0); |
|
60 | connectionLayout->addWidget(rmapSourceLogicalAddressSpinBox, 3, 1, 0); | |
59 | connectionLayout->addWidget(rmapSendStateLabel, 4, 0, 1, 2); |
|
61 | connectionLayout->addWidget(rmapSendStateLabel, 4, 0, 1, 2); | |
60 | connectionLayout->addWidget(rmapReceiveStateLabel, 5, 0, 1, 2); |
|
62 | connectionLayout->addWidget(rmapReceiveStateLabel, 5, 0, 1, 2); | |
61 | connectionLayout->addWidget(gresbStatusQueryLabel, 6, 0, 1, 2); |
|
63 | connectionLayout->addWidget(gresbStatusQueryLabel, 6, 0, 1, 2); | |
62 |
|
64 | |||
63 | connectionLayout->setRowStretch(7, 1); |
|
65 | connectionLayout->setRowStretch(7, 1); | |
64 | connectionLayout->setColumnStretch(2, 1); |
|
66 | connectionLayout->setColumnStretch(2, 1); | |
65 |
|
67 | |||
66 | // GRESB STATUS QUERY DIALOG |
|
68 | // GRESB STATUS QUERY DIALOG | |
67 | gresbStatusQueryDialogLayout = new QGridLayout; |
|
69 | gresbStatusQueryDialogLayout = new QGridLayout; | |
68 | gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryDialogLabel, 0, 0, 1, 2); |
|
70 | gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryDialogLabel, 0, 0, 1, 2); | |
69 | gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryRetryButton, 1, 0, 0); |
|
71 | gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryRetryButton, 1, 0, 0); | |
70 | gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryAbortButton, 1, 1, 0); |
|
72 | gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryAbortButton, 1, 1, 0); | |
71 | gresbStatusQueryDialog->setLayout(gresbStatusQueryDialogLayout); |
|
73 | gresbStatusQueryDialog->setLayout(gresbStatusQueryDialogLayout); | |
72 |
|
74 | |||
73 | this->setLayout(connectionLayout); |
|
75 | this->setLayout(connectionLayout); | |
74 |
|
76 | |||
|
77 | connect(RMAPSend_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPSendConnectionState(QAbstractSocket::SocketState))); | |||
|
78 | connect(RMAPReceive_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPReceiveConnectionState(QAbstractSocket::SocketState))); | |||
|
79 | connect(GRESBStatusQuery_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(GRESBConnectionState(QAbstractSocket::SocketState))); | |||
|
80 | connect(gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink())); | |||
|
81 | connect(spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery())); | |||
|
82 | connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacket())); | |||
|
83 | ||||
75 | connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject())); |
|
84 | connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject())); | |
76 | connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacket())); |
|
85 | connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacket())); | |
77 | } |
|
86 | } | |
78 |
|
87 | |||
79 | gresb::~gresb() |
|
88 | gresb::~gresb() | |
80 | { |
|
89 | { | |
81 | free(rmapPacket); |
|
90 | free(rmapPacket); | |
82 | free(ccsdsPacket); |
|
91 | free(ccsdsPacket); | |
83 | free(spwPacket); |
|
92 | free(spwPacket); | |
84 | } |
|
93 | } | |
85 |
|
94 | |||
86 | unsigned int gresb::Write(unsigned int *Value, unsigned int count, unsigned int address) |
|
95 | unsigned int gresb::Write(unsigned int *Value, unsigned int count, unsigned int address) | |
87 | { |
|
96 | { | |
88 | unsigned int remainingCount = count; |
|
97 | unsigned int remainingCount = count; | |
89 | unsigned int iOffset = 0; |
|
98 | unsigned int iOffset = 0; | |
90 | QString console_message; |
|
99 | QString console_message; | |
91 | char* data; |
|
100 | char* data; | |
92 |
|
101 | |||
93 | if(rmapPacketSEMAPHORE->available()!=0) |
|
102 | if(rmapPacketSEMAPHORE->available()!=0) | |
94 | { |
|
103 | { | |
95 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped"); |
|
104 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped"); | |
96 | return 1; |
|
105 | return 1; | |
97 | } |
|
106 | } | |
98 |
|
107 | |||
99 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: unavailable"); |
|
108 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: unavailable"); | |
100 |
|
109 | |||
101 | data = (char*) malloc(READ_WRITE_MAX_COUNTS*4); |
|
110 | data = (char*) malloc(READ_WRITE_MAX_COUNTS*4); | |
102 |
|
111 | |||
103 | emit appendToLog(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); |
|
112 | emit appendToLog(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); | |
104 |
|
113 | |||
105 | while (remainingCount > READ_WRITE_MAX_COUNTS) |
|
114 | while (remainingCount > READ_WRITE_MAX_COUNTS) | |
106 | { |
|
115 | { | |
107 | for (int i = 0; i<READ_WRITE_MAX_COUNTS; i++) |
|
116 | for (int i = 0; i<READ_WRITE_MAX_COUNTS; i++) | |
108 | { |
|
117 | { | |
109 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); |
|
118 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); | |
110 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); |
|
119 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); | |
111 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); |
|
120 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); | |
112 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); |
|
121 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); | |
113 | } |
|
122 | } | |
114 |
|
123 | |||
115 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
124 | console_message.sprintf("remainingCount: %d => ", remainingCount); | |
116 | emit appendToLog(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
125 | emit appendToLog(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16)); | |
117 |
|
126 | |||
118 | if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0) |
|
127 | if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0) | |
119 | { |
|
128 | { | |
120 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); |
|
129 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); | |
121 | return 1; |
|
130 | return 1; | |
122 | } |
|
131 | } | |
123 |
|
132 | |||
124 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; |
|
133 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; | |
125 | address = address + READ_WRITE_MAX_COUNTS * 4; |
|
134 | address = address + READ_WRITE_MAX_COUNTS * 4; | |
126 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; |
|
135 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; | |
127 | } |
|
136 | } | |
128 |
|
137 | |||
129 | if (remainingCount > 0) |
|
138 | if (remainingCount > 0) | |
130 | { |
|
139 | { | |
131 | for (unsigned int i = 0; i<remainingCount; i++) |
|
140 | for (unsigned int i = 0; i<remainingCount; i++) | |
132 | { |
|
141 | { | |
133 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); |
|
142 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); | |
134 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); |
|
143 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); | |
135 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); |
|
144 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); | |
136 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); |
|
145 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); | |
137 | } |
|
146 | } | |
138 |
|
147 | |||
139 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
148 | console_message.sprintf("remainingCount: %d => ", remainingCount); | |
140 | emit appendToLog(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
149 | emit appendToLog(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16)); | |
141 |
|
150 | |||
142 | if (WriteBLOCK(data, remainingCount*4, address)==0) |
|
151 | if (WriteBLOCK(data, remainingCount*4, address)==0) | |
143 | { |
|
152 | { | |
144 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); |
|
153 | emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); | |
145 | return 1; |
|
154 | return 1; | |
146 | } |
|
155 | } | |
147 | } |
|
156 | } | |
148 |
|
157 | |||
149 | emit appendToLog(QString("*** STOP *** WRITE")); |
|
158 | emit appendToLog(QString("*** STOP *** WRITE")); | |
150 | free(data); |
|
159 | free(data); | |
151 | return count; |
|
160 | return count; | |
152 | } |
|
161 | } | |
153 |
|
162 | |||
154 | unsigned int gresb::Read(unsigned int *Value, unsigned int count, unsigned int address) |
|
163 | unsigned int gresb::Read(unsigned int *Value, unsigned int count, unsigned int address) | |
155 | { |
|
164 | { | |
156 | unsigned int remainingCount = count; |
|
165 | unsigned int remainingCount = count; | |
157 | unsigned int iOffset = 0; |
|
166 | unsigned int iOffset = 0; | |
158 | QString console_message; |
|
167 | QString console_message; | |
159 |
|
168 | |||
160 | if(rmapPacketSEMAPHORE->available()!=0) |
|
169 | if(rmapPacketSEMAPHORE->available()!=0) | |
161 | { |
|
170 | { | |
162 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped"); |
|
171 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped"); | |
163 | return 1; |
|
172 | return 1; | |
164 | } |
|
173 | } | |
165 | emit appendToLog(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); |
|
174 | emit appendToLog(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); | |
166 |
|
175 | |||
167 | while (remainingCount > READ_WRITE_MAX_COUNTS) |
|
176 | while (remainingCount > READ_WRITE_MAX_COUNTS) | |
168 | { |
|
177 | { | |
169 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
178 | console_message.sprintf("remainingCount: %d => ", remainingCount); | |
170 | emit appendToLog(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
179 | emit appendToLog(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16)); | |
171 |
|
180 | |||
172 | if (ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0) |
|
181 | if (ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0) | |
173 | { |
|
182 | { | |
174 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received"); |
|
183 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received"); | |
175 | return 1; |
|
184 | return 1; | |
176 | } |
|
185 | } | |
177 |
|
186 | |||
178 | for(int i=0;i<READ_WRITE_MAX_COUNTS;i++) |
|
187 | for(int i=0;i<READ_WRITE_MAX_COUNTS;i++) | |
179 | { |
|
188 | { | |
180 | Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; |
|
189 | Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; | |
181 | for(int j=1;j<4;j++) |
|
190 | for(int j=1;j<4;j++) | |
182 | { |
|
191 | { | |
183 | Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256; |
|
192 | Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256; | |
184 | } |
|
193 | } | |
185 | } |
|
194 | } | |
186 |
|
195 | |||
187 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; |
|
196 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; | |
188 | address = address + READ_WRITE_MAX_COUNTS * 4; |
|
197 | address = address + READ_WRITE_MAX_COUNTS * 4; | |
189 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; |
|
198 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; | |
190 | acquireRMAPSemaphore(); |
|
199 | acquireRMAPSemaphore(); | |
191 | } |
|
200 | } | |
192 |
|
201 | |||
193 | if (remainingCount > 0) |
|
202 | if (remainingCount > 0) | |
194 | { |
|
203 | { | |
195 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
204 | console_message.sprintf("remainingCount: %d => ", remainingCount); | |
196 | emit appendToLog(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
205 | emit appendToLog(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16)); | |
197 |
|
206 | |||
198 | if (ReadBLOCK(4*remainingCount, address)==0) |
|
207 | if (ReadBLOCK(4*remainingCount, address)==0) | |
199 | { |
|
208 | { | |
200 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received"); |
|
209 | emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received"); | |
201 | return 1; |
|
210 | return 1; | |
202 | } |
|
211 | } | |
203 |
|
212 | |||
204 | for(unsigned int i=0;i<remainingCount;i++) |
|
213 | for(unsigned int i=0;i<remainingCount;i++) | |
205 | { |
|
214 | { | |
206 | Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; |
|
215 | Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; | |
207 | for(int j=1;j<4;j++) |
|
216 | for(int j=1;j<4;j++) | |
208 | { |
|
217 | { | |
209 | Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256; |
|
218 | Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256; | |
210 | } |
|
219 | } | |
211 | } |
|
220 | } | |
212 | acquireRMAPSemaphore(); |
|
221 | acquireRMAPSemaphore(); | |
213 | } |
|
222 | } | |
214 |
|
223 | |||
215 | emit appendToLog(QString("*** STOP *** READ ")); |
|
224 | emit appendToLog(QString("*** STOP *** READ ")); | |
216 | return count; |
|
225 | return count; | |
217 | } |
|
226 | } | |
218 |
|
227 | |||
219 | unsigned int gresb::WriteBLOCK(char *data, unsigned int nbBytes, unsigned int address) |
|
228 | unsigned int gresb::WriteBLOCK(char *data, unsigned int nbBytes, unsigned int address) | |
220 | { |
|
229 | { | |
221 | QTime RMAPTimeout; |
|
230 | QTime RMAPTimeout; | |
222 | RMAP *RMAPCommand; |
|
231 | RMAP *RMAPCommand; | |
223 | int errorCode; |
|
232 | int errorCode; | |
224 | QString console_message; |
|
233 | QString console_message; | |
225 |
|
234 | |||
226 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 1) |
|
235 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 1) | |
227 | { |
|
236 | { | |
228 | this->Close(); |
|
237 | this->Close(); | |
229 | return 1; |
|
238 | return 1; | |
230 | } |
|
239 | } | |
231 |
|
240 | |||
232 | RMAPCommand = new RMAP(commandCode, |
|
241 | RMAPCommand = new RMAP(commandCode, | |
233 | rmapTargetLogicalAddress, |
|
242 | rmapTargetLogicalAddress, | |
234 | rmapSourceLogicalAddress, |
|
243 | rmapSourceLogicalAddressSpinBox->value(), | |
235 | address, |
|
244 | address, | |
236 | nbBytes, |
|
245 | nbBytes, | |
237 | data); |
|
246 | data); | |
238 |
|
247 | |||
239 | // SEND GRESB HEADER |
|
248 | // SEND GRESB HEADER | |
240 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4); |
|
249 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4); | |
241 | // SEND SPACEWIRE PACKET HEADER |
|
250 | // SEND SPACEWIRE PACKET HEADER | |
242 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader)); |
|
251 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader)); | |
243 | // SEND DATA |
|
252 | // SEND DATA | |
244 | RMAPSend_SOCKET->write( data, nbBytes); |
|
253 | RMAPSend_SOCKET->write( data, nbBytes); | |
245 | // SEND DATA CRC |
|
254 | // SEND DATA CRC | |
246 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->dataCRC), 1); |
|
255 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->dataCRC), 1); | |
247 | RMAPTimeout.start(); |
|
256 | RMAPTimeout.start(); | |
248 | while(RMAPSend_SOCKET->bytesToWrite() > 0) |
|
257 | while(RMAPSend_SOCKET->bytesToWrite() > 0) | |
249 | { |
|
258 | { | |
250 | RMAPSend_SOCKET->waitForBytesWritten(100); |
|
259 | RMAPSend_SOCKET->waitForBytesWritten(100); | |
251 | if(RMAPTimeout.elapsed()>1000) |
|
260 | if(RMAPTimeout.elapsed()>1000) | |
252 | { |
|
261 | { | |
253 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** sending Write RMAP Command timeout"); |
|
262 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** sending Write RMAP Command timeout"); | |
254 | return 0; |
|
263 | return 0; | |
255 | } |
|
264 | } | |
256 | } |
|
265 | } | |
257 |
|
266 | |||
258 | if ( (commandCode == writeSingle_noVer_Rep) | (commandCode == writeInc_noVer_Rep) | |
|
267 | if ( (commandCode == writeSingle_noVer_Rep) | (commandCode == writeInc_noVer_Rep) | | |
259 | (commandCode == writeSingle_ver_rep) | (commandCode == writeInc_ver_rep) ) |
|
268 | (commandCode == writeSingle_ver_rep) | (commandCode == writeInc_ver_rep) ) | |
260 | { |
|
269 | { | |
261 | // WAIT FOR THE RMAP REPLY PACKET |
|
270 | // WAIT FOR THE RMAP REPLY PACKET | |
262 | errorCode = receiveSPWPacket(1); |
|
271 | errorCode = receiveSPWPacket(1); | |
263 | if (errorCode<=0) |
|
272 | if (errorCode<=0) | |
264 | { |
|
273 | { | |
265 | emit appendToLog("WARNING === in function WriteBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode)); |
|
274 | emit appendToLog("WARNING === in function WriteBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode)); | |
266 | return 0; |
|
275 | return 0; | |
267 | } |
|
276 | } | |
268 | if(rmapPacketSize != 8) |
|
277 | if(rmapPacketSize != 8) | |
269 | { |
|
278 | { | |
270 | console_message.sprintf("WARNING === in function WRITE (with reply) of rmapplugin *** write reply format not compliant\n"); |
|
279 | console_message.sprintf("WARNING === in function WRITE (with reply) of rmapplugin *** write reply format not compliant\n"); | |
271 | emit appendToLog(console_message); |
|
280 | emit appendToLog(console_message); | |
272 | return 0; |
|
281 | return 0; | |
273 | } |
|
282 | } | |
274 | switch (rmapPacket[3]) // byte 4 is the status byte in the reply |
|
283 | switch (rmapPacket[3]) // byte 4 is the status byte in the reply | |
275 | { |
|
284 | { | |
276 | case 0: |
|
285 | case 0: | |
277 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 0 Successfull"); |
|
286 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 0 Successfull"); | |
278 | break; |
|
287 | break; | |
279 | case 1: |
|
288 | case 1: | |
280 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** General error code"); |
|
289 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** General error code"); | |
281 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 1 General error code"); |
|
290 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 1 General error code"); | |
282 | break; |
|
291 | break; | |
283 | case 2: |
|
292 | case 2: | |
284 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Unused RMAP packet type or command code"); |
|
293 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Unused RMAP packet type or command code"); | |
285 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 2 Unused RMAP packet type or command code"); |
|
294 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 2 Unused RMAP packet type or command code"); | |
286 | break; |
|
295 | break; | |
287 | case 3: |
|
296 | case 3: | |
288 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid key"); |
|
297 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid key"); | |
289 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 3 Invalid key"); |
|
298 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 3 Invalid key"); | |
290 | break; |
|
299 | break; | |
291 | case 4: |
|
300 | case 4: | |
292 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid data CRC"); |
|
301 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid data CRC"); | |
293 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 4 Invalid data CRC"); |
|
302 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 4 Invalid data CRC"); | |
294 | break; |
|
303 | break; | |
295 | case 5: |
|
304 | case 5: | |
296 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Early EOP"); |
|
305 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Early EOP"); | |
297 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 5 Early EOP"); |
|
306 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 5 Early EOP"); | |
298 | break; |
|
307 | break; | |
299 | case 6: |
|
308 | case 6: | |
300 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Too much data"); |
|
309 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Too much data"); | |
301 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 6 Too much data"); |
|
310 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 6 Too much data"); | |
302 | break; |
|
311 | break; | |
303 | case 7: |
|
312 | case 7: | |
304 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** EEP"); |
|
313 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** EEP"); | |
305 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 7 EEP"); |
|
314 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 7 EEP"); | |
306 | break; |
|
315 | break; | |
307 | case 8: |
|
316 | case 8: | |
308 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Reserved"); |
|
317 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Reserved"); | |
309 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 8 Reserved"); |
|
318 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 8 Reserved"); | |
310 | break; |
|
319 | break; | |
311 | case 9: |
|
320 | case 9: | |
312 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Verify buffer overrun"); |
|
321 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Verify buffer overrun"); | |
313 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 9 Verify buffer overrun"); |
|
322 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 9 Verify buffer overrun"); | |
314 | break; |
|
323 | break; | |
315 | case 10: |
|
324 | case 10: | |
316 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMAP command not implemented or not authorised"); |
|
325 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMAP command not implemented or not authorised"); | |
317 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 10 RMAP command not implemented or not authorised"); |
|
326 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 10 RMAP command not implemented or not authorised"); | |
318 | break; |
|
327 | break; | |
319 | case 11: |
|
328 | case 11: | |
320 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMW data length error"); |
|
329 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMW data length error"); | |
321 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 11 RMAP RMW data length error"); |
|
330 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 11 RMAP RMW data length error"); | |
322 | break; |
|
331 | break; | |
323 | case 12: |
|
332 | case 12: | |
324 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid target logical address"); |
|
333 | emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid target logical address"); | |
325 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 12 Invalid target logical address"); |
|
334 | RMAP_write_reply_setText("reply to the write command required\nlast reply status: 12 Invalid target logical address"); | |
326 | break; |
|
335 | break; | |
327 | } |
|
336 | } | |
328 | acquireRMAPSemaphore(); |
|
337 | acquireRMAPSemaphore(); | |
329 | } |
|
338 | } | |
330 | return nbBytes; |
|
339 | return nbBytes; | |
331 | } |
|
340 | } | |
332 |
|
341 | |||
333 | unsigned int gresb::ReadBLOCK(unsigned int nbBytes, unsigned int address) |
|
342 | unsigned int gresb::ReadBLOCK(unsigned int nbBytes, unsigned int address) | |
334 | { |
|
343 | { | |
335 | int errorCode; |
|
344 | int errorCode; | |
336 | RMAP *RMAPCommand; |
|
345 | RMAP *RMAPCommand; | |
337 | QTime RMAPTimeout; |
|
346 | QTime RMAPTimeout; | |
338 | unsigned int dataLength; |
|
347 | unsigned int dataLength; | |
339 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 1) |
|
348 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 1) | |
340 | { |
|
349 | { | |
341 | this->Close(); |
|
350 | this->Close(); | |
342 | return 1; |
|
351 | return 1; | |
343 | } |
|
352 | } | |
344 |
|
353 | |||
345 | if (nbBytes > 4) |
|
354 | if (nbBytes > 4) | |
346 | { |
|
355 | { | |
347 | RMAPCommand = new RMAP(read_Inc, |
|
356 | RMAPCommand = new RMAP(read_Inc, | |
348 | rmapTargetLogicalAddress, |
|
357 | rmapTargetLogicalAddress, | |
349 | rmapSourceLogicalAddress, |
|
358 | rmapSourceLogicalAddressSpinBox->value(), | |
350 | address, |
|
359 | address, | |
351 | nbBytes, |
|
360 | nbBytes, | |
352 | NULL); |
|
361 | NULL); | |
353 | } |
|
362 | } | |
354 | else |
|
363 | else | |
355 | { |
|
364 | { | |
356 | RMAPCommand = new RMAP(read_Single, |
|
365 | RMAPCommand = new RMAP(read_Single, | |
357 | rmapTargetLogicalAddress, |
|
366 | rmapTargetLogicalAddress, | |
358 | rmapSourceLogicalAddress, |
|
367 | rmapSourceLogicalAddressSpinBox->value(), | |
359 | address, |
|
368 | address, | |
360 | nbBytes, |
|
369 | nbBytes, | |
361 | NULL); |
|
370 | NULL); | |
362 | } |
|
371 | } | |
363 |
|
372 | |||
364 | // SEND THE GRESB HEADER FOR THE RMAP READ COMMAND |
|
373 | // SEND THE GRESB HEADER FOR THE RMAP READ COMMAND | |
365 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4); |
|
374 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4); | |
366 | // SEND THE SPACEWIRE PACKET FOR THE RMAP READ COMMAND |
|
375 | // SEND THE SPACEWIRE PACKET FOR THE RMAP READ COMMAND | |
367 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader)); |
|
376 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader)); | |
368 | RMAPSend_SOCKET->waitForBytesWritten(100); |
|
377 | RMAPSend_SOCKET->waitForBytesWritten(100); | |
369 | RMAPTimeout.start(); |
|
378 | RMAPTimeout.start(); | |
370 | // write timeout |
|
379 | // write timeout | |
371 | while(RMAPSend_SOCKET->bytesToWrite() > 0) |
|
380 | while(RMAPSend_SOCKET->bytesToWrite() > 0) | |
372 | { |
|
381 | { | |
373 | RMAPSend_SOCKET->waitForBytesWritten(100); |
|
382 | RMAPSend_SOCKET->waitForBytesWritten(100); | |
374 | if(RMAPTimeout.elapsed()>1000) |
|
383 | if(RMAPTimeout.elapsed()>1000) | |
375 | { |
|
384 | { | |
376 | emit appendToLog("WARNING === in function READ of rmapplugin *** sending Read RMAP Command timeout\n"); |
|
385 | emit appendToLog("WARNING === in function READ of rmapplugin *** sending Read RMAP Command timeout\n"); | |
377 | return 0; |
|
386 | return 0; | |
378 | } |
|
387 | } | |
379 | } |
|
388 | } | |
380 |
|
389 | |||
381 | // RECEIVE THE INCOMING RMAP PACKET |
|
390 | // RECEIVE THE INCOMING RMAP PACKET | |
382 | errorCode = receiveSPWPacket(1); // request ID 1 is for RMAP packet |
|
391 | errorCode = receiveSPWPacket(1); // request ID 1 is for RMAP packet | |
383 | if (errorCode<=0) |
|
392 | if (errorCode<=0) | |
384 | { |
|
393 | { | |
385 | emit appendToLog("WARNING === in function ReadBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode)); |
|
394 | emit appendToLog("WARNING === in function ReadBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode)); | |
386 | return 0; |
|
395 | return 0; | |
387 | } |
|
396 | } | |
388 | dataLength = rmapPacketSize - RMAP_READ_REPLY_HEADER_LENGTH - RMAP_DATA_CRC_LENGTH; |
|
397 | dataLength = rmapPacketSize - RMAP_READ_REPLY_HEADER_LENGTH - RMAP_DATA_CRC_LENGTH; | |
389 | if(dataLength != nbBytes) |
|
398 | if(dataLength != nbBytes) | |
390 | { |
|
399 | { | |
391 | emit appendToLog("WARNING === in function READ of rmapplugin *** number of data received (" |
|
400 | emit appendToLog("WARNING === in function READ of rmapplugin *** number of data received (" | |
392 | +QString::number(dataLength) |
|
401 | +QString::number(dataLength) | |
393 | +") not equal to number of data requested (" |
|
402 | +") not equal to number of data requested (" | |
394 | +QString::number(READ_WRITE_MAX_COUNTS*4) |
|
403 | +QString::number(READ_WRITE_MAX_COUNTS*4) | |
395 | +")"); |
|
404 | +")"); | |
396 | return 0; |
|
405 | return 0; | |
397 | } |
|
406 | } | |
398 | return dataLength; |
|
407 | return dataLength; | |
399 | } |
|
408 | } | |
400 |
|
409 | |||
401 | unsigned int gresb::WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) |
|
410 | unsigned int gresb::WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) | |
402 | { |
|
411 | { | |
403 | char protocoleIdentifier = 0x02; |
|
412 | char protocoleIdentifier = 0x02; | |
404 | char reserved = 0x00; |
|
413 | char reserved = 0x00; | |
405 | char gresbProtocole = 0x00; |
|
414 | char gresbProtocole = 0x00; | |
406 | unsigned char size[3]; |
|
415 | unsigned char size[3]; | |
407 | unsigned int spwPacketSize = count + 4; |
|
416 | unsigned int spwPacketSize = count + 4; | |
408 | QTime SPWTimeout; |
|
417 | QTime SPWTimeout; | |
409 |
|
418 | |||
410 | if (count>248) |
|
419 | if (count>248) | |
411 | { |
|
420 | { | |
412 | appendToLog("WARNING === in function WRITE of rmapplugin *** CCSDS packet size > 248 bytes\n"); |
|
421 | appendToLog("WARNING === in function WRITE of rmapplugin *** CCSDS packet size > 248 bytes\n"); | |
413 | return 1; |
|
422 | return 1; | |
414 | } |
|
423 | } | |
415 |
|
424 | |||
416 | appendToLog(QString("*** START *** Send CCSDS packet of ")+ QString::number(count) + QString(" byte(s)")); |
|
425 | appendToLog(QString("*** START *** Send CCSDS packet of ")+ QString::number(count) + QString(" byte(s)")); | |
417 |
|
426 | |||
418 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 1) |
|
427 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 1) | |
419 | { |
|
428 | { | |
420 | this->Close(); |
|
429 | this->Close(); | |
421 | appendToLog("WARNING === in function WRITE of rmapplugin *** SPW link not running\n"); |
|
430 | appendToLog("WARNING === in function WRITE of rmapplugin *** SPW link not running\n"); | |
422 | return 1; |
|
431 | return 1; | |
423 | } |
|
432 | } | |
424 |
|
433 | |||
425 | // SEND GRESB HEADER |
|
434 | // SEND GRESB HEADER | |
426 | size[0] = (unsigned char) ((unsigned int) spwPacketSize>>16); |
|
435 | size[0] = (unsigned char) ((unsigned int) spwPacketSize>>16); | |
427 | size[1] = (unsigned char) ((unsigned int) spwPacketSize>>8); |
|
436 | size[1] = (unsigned char) ((unsigned int) spwPacketSize>>8); | |
428 | size[2] = (unsigned char) ((unsigned int) spwPacketSize); |
|
437 | size[2] = (unsigned char) ((unsigned int) spwPacketSize); | |
429 | RMAPSend_SOCKET->write(&gresbProtocole, 1); |
|
438 | RMAPSend_SOCKET->write(&gresbProtocole, 1); | |
430 | RMAPSend_SOCKET->write((char*) size, 3); |
|
439 | RMAPSend_SOCKET->write((char*) size, 3); | |
431 | // SEND SPW HEADER |
|
440 | // SEND SPW HEADER | |
432 | RMAPSend_SOCKET->write(&targetLogicalAddress, 1); |
|
441 | RMAPSend_SOCKET->write(&targetLogicalAddress, 1); | |
433 | RMAPSend_SOCKET->write(&protocoleIdentifier, 1); |
|
442 | RMAPSend_SOCKET->write(&protocoleIdentifier, 1); | |
434 | RMAPSend_SOCKET->write(&reserved, 1); |
|
443 | RMAPSend_SOCKET->write(&reserved, 1); | |
435 | RMAPSend_SOCKET->write(&userApplication, 1); |
|
444 | RMAPSend_SOCKET->write(&userApplication, 1); | |
436 | // SEND CCSDS PACKET |
|
445 | // SEND CCSDS PACKET | |
437 | RMAPSend_SOCKET->write(Value, count); |
|
446 | RMAPSend_SOCKET->write(Value, count); | |
438 | SPWTimeout.start(); |
|
447 | SPWTimeout.start(); | |
439 | while(RMAPSend_SOCKET->bytesToWrite() > 0) |
|
448 | while(RMAPSend_SOCKET->bytesToWrite() > 0) | |
440 | { |
|
449 | { | |
441 | RMAPSend_SOCKET->waitForBytesWritten(100); |
|
450 | RMAPSend_SOCKET->waitForBytesWritten(100); | |
442 | if(SPWTimeout.elapsed()>1000) |
|
451 | if(SPWTimeout.elapsed()>1000) | |
443 | { |
|
452 | { | |
444 | appendToLog("WARNING === in function WRITE of rmapplugin *** sending CCSDS packet timeout\n"); |
|
453 | appendToLog("WARNING === in function WRITE of rmapplugin *** sending CCSDS packet timeout\n"); | |
445 | return 1; |
|
454 | return 1; | |
446 | } |
|
455 | } | |
447 | } |
|
456 | } | |
448 |
|
457 | |||
449 | appendToLog(QString("*** CCSDS packet sent")); |
|
458 | appendToLog(QString("*** CCSDS packet sent")); | |
450 |
|
459 | |||
451 | return count; |
|
460 | return count; | |
452 | } |
|
461 | } | |
453 |
|
462 | |||
454 | int gresb::receiveSPWPacket(unsigned char requestID) // SLOT |
|
463 | int gresb::receiveSPWPacket(unsigned char requestID) // SLOT | |
455 | { |
|
464 | { | |
456 | QTime spwPacketReceiverTimeout; |
|
465 | QTime spwPacketReceiverTimeout; | |
457 | // GRESB HEADER |
|
466 | // GRESB HEADER | |
458 | char RES_TR_EP; // 6 bits REserved + 1 bit TRuncated + 1 bit EP error end of packet |
|
467 | char RES_TR_EP; // 6 bits REserved + 1 bit TRuncated + 1 bit EP error end of packet | |
459 | unsigned char packetLength2; |
|
468 | unsigned char packetLength2; | |
460 | unsigned char packetLength1; |
|
469 | unsigned char packetLength1; | |
461 | unsigned char packetLength0; |
|
470 | unsigned char packetLength0; | |
462 | unsigned int packetLength; |
|
471 | unsigned int packetLength; | |
463 |
|
472 | |||
464 | if (requestID==1) |
|
473 | if (requestID==1) | |
465 | { |
|
474 | { | |
466 | if (rmapPacketSEMAPHORE->available()) return rmapPacketSize; |
|
475 | if (rmapPacketSEMAPHORE->available()) return rmapPacketSize; | |
467 | } |
|
476 | } | |
468 |
|
477 | |||
469 | RMAPReceive_SOCKET->blockSignals(1); // block the signals of the socket during packet reception |
|
478 | RMAPReceive_SOCKET->blockSignals(1); // block the signals of the socket during packet reception | |
470 | // READ THE GRESB HEADER OF THE INCOMING PACKET |
|
479 | // READ THE GRESB HEADER OF THE INCOMING PACKET | |
471 | spwPacketReceiverTimeout.start(); |
|
480 | spwPacketReceiverTimeout.start(); | |
472 | while(RMAPReceive_SOCKET->bytesAvailable() < 4) |
|
481 | while(RMAPReceive_SOCKET->bytesAvailable() < 4) | |
473 | { |
|
482 | { | |
474 | RMAPReceive_SOCKET->waitForReadyRead(100); |
|
483 | RMAPReceive_SOCKET->waitForReadyRead(100); | |
475 | if(spwPacketReceiverTimeout.elapsed()>1000) return -1; // ERROR === read GRSEB header TIMEOUT |
|
484 | if(spwPacketReceiverTimeout.elapsed()>1000) return -1; // ERROR === read GRSEB header TIMEOUT | |
476 | } |
|
485 | } | |
477 | RMAPReceive_SOCKET->read(&RES_TR_EP, 1); |
|
486 | RMAPReceive_SOCKET->read(&RES_TR_EP, 1); | |
478 | RMAPReceive_SOCKET->read( (char*) &packetLength2, 1); |
|
487 | RMAPReceive_SOCKET->read( (char*) &packetLength2, 1); | |
479 | RMAPReceive_SOCKET->read( (char*) &packetLength1, 1); |
|
488 | RMAPReceive_SOCKET->read( (char*) &packetLength1, 1); | |
480 | RMAPReceive_SOCKET->read( (char*) &packetLength0, 1); |
|
489 | RMAPReceive_SOCKET->read( (char*) &packetLength0, 1); | |
481 | packetLength = (packetLength2<<16) + (packetLength1<<8) + (packetLength0); |
|
490 | packetLength = (packetLength2<<16) + (packetLength1<<8) + (packetLength0); | |
482 | spwPacket = (char*) malloc(packetLength); |
|
491 | spwPacket = (char*) malloc(packetLength); | |
483 |
|
492 | |||
484 | // READ THE SPW PACKET |
|
493 | // READ THE SPW PACKET | |
485 | while(RMAPReceive_SOCKET->bytesAvailable() < packetLength) |
|
494 | while(RMAPReceive_SOCKET->bytesAvailable() < packetLength) | |
486 | { |
|
495 | { | |
487 | RMAPReceive_SOCKET->waitForReadyRead(100); |
|
496 | RMAPReceive_SOCKET->waitForReadyRead(100); | |
488 | if(spwPacketReceiverTimeout.elapsed()>1000) return -2; // ERROR === read SPW packet TIMEOUT |
|
497 | if(spwPacketReceiverTimeout.elapsed()>1000) return -2; // ERROR === read SPW packet TIMEOUT | |
489 | } |
|
498 | } | |
490 | RMAPReceive_SOCKET->read( spwPacket, packetLength ); |
|
499 | RMAPReceive_SOCKET->read( spwPacket, packetLength ); | |
491 | RMAPReceive_SOCKET->blockSignals(0); |
|
500 | RMAPReceive_SOCKET->blockSignals(0); | |
492 |
|
501 | |||
493 | switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet |
|
502 | switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet | |
494 | { |
|
503 | { | |
495 | case 1: // 0x01 is the protocole identifier for RMAP packets |
|
504 | case 1: // 0x01 is the protocole identifier for RMAP packets | |
496 | if (rmapPacketSEMAPHORE->available()!=0) return -3; // ERROR === previous RMAP packet not processed yet |
|
505 | if (rmapPacketSEMAPHORE->available()!=0) return -3; // ERROR === previous RMAP packet not processed yet | |
497 | for(unsigned int i=0; i<packetLength; i++) rmapPacket[i] = spwPacket[i]; |
|
506 | for(unsigned int i=0; i<packetLength; i++) rmapPacket[i] = spwPacket[i]; | |
498 | rmapPacketSize = packetLength; |
|
507 | rmapPacketSize = packetLength; | |
499 | rmapPacketSEMAPHORE->release(); |
|
508 | rmapPacketSEMAPHORE->release(); | |
500 | //emit sendMessage("RMAP packet of size " + QString::number(packetLength) + " received"); |
|
509 | //emit sendMessage("RMAP packet of size " + QString::number(packetLength) + " received"); | |
501 | return packetLength; |
|
510 | return packetLength; | |
502 |
|
511 | |||
503 | case 2: // 0x02 is the protocole identifier for CCSDS packets |
|
512 | case 2: // 0x02 is the protocole identifier for CCSDS packets | |
504 | if (ccsdsPacketSEMAPHORE->available()!=0) return -4; // ERROR === previous CCSDS packet not processed yet |
|
513 | if (ccsdsPacketSEMAPHORE->available()!=0) return -4; // ERROR === previous CCSDS packet not processed yet | |
505 | for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i]; |
|
514 | for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i]; | |
506 | ccsdsPacketSize = packetLength; |
|
515 | ccsdsPacketSize = packetLength; | |
507 | ccsdsPacketSEMAPHORE->release(); |
|
516 | ccsdsPacketSEMAPHORE->release(); | |
508 | emit(ccsdsPacketAvailable(ccsdsPacket, packetLength)); |
|
517 | emit(ccsdsPacketAvailable(ccsdsPacket, packetLength)); | |
509 | return packetLength; |
|
518 | return packetLength; | |
510 | } |
|
519 | } | |
511 | return 0; |
|
520 | return 0; | |
512 | } |
|
521 | } | |
513 |
|
522 | |||
514 | void gresb::Open() // SLOT |
|
523 | void gresb::Open() // SLOT | |
515 | { |
|
524 | { | |
516 | bool spwRunning = true; |
|
525 | bool spwRunning = true; | |
517 | RMAPSend_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()), |
|
526 | RMAPSend_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()), | |
518 | 3000 + gresbVirtualLinkSpinBox->value()*2, |
|
527 | 3000 + gresbVirtualLinkSpinBox->value()*2, | |
519 | QIODevice::WriteOnly); |
|
528 | QIODevice::WriteOnly); | |
520 | RMAPReceive_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()), |
|
529 | RMAPReceive_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()), | |
521 | 3000 + gresbVirtualLinkSpinBox->value()*2+1, |
|
530 | 3000 + gresbVirtualLinkSpinBox->value()*2+1, | |
522 | QIODevice::ReadOnly); |
|
531 | QIODevice::ReadOnly); | |
523 | GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()), |
|
532 | GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()), | |
524 | 3010, |
|
533 | 3010, | |
525 | QIODevice::ReadWrite); |
|
534 | QIODevice::ReadWrite); | |
526 | GRESBStatusQuery_SOCKET->waitForConnected(10000); |
|
535 | GRESBStatusQuery_SOCKET->waitForConnected(10000); | |
527 | RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket |
|
536 | RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket | |
528 | // initialize SPW packet semaphores |
|
537 | // initialize SPW packet semaphores | |
529 | while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire(); |
|
538 | while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire(); | |
530 | while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire(); |
|
539 | while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire(); | |
531 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) != 0) |
|
540 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) != 0) | |
532 | { |
|
541 | { | |
533 | spwRunning = gresbStatusQueryDialog->exec(); |
|
542 | spwRunning = gresbStatusQueryDialog->exec(); | |
534 | } |
|
543 | } | |
535 | if (spwRunning == false) this->Close(); |
|
544 | if (spwRunning == false) this->Close(); | |
536 | else |
|
545 | else | |
537 | { |
|
546 | { | |
538 | emit appendToLog(QString("SpaceWire running on virtual link ")+ QString::number(spwLinkSpinBox->value())); |
|
547 | emit appendToLog(QString("SpaceWire running on virtual link ")+ QString::number(spwLinkSpinBox->value())); | |
539 | emit isOpen(true); |
|
548 | emit isOpen(true); | |
540 | } |
|
549 | } | |
541 | } |
|
550 | } | |
542 |
|
551 | |||
543 | void gresb::Close() // SLOT |
|
552 | void gresb::Close() // SLOT | |
544 | { |
|
553 | { | |
545 | RMAPSend_SOCKET->disconnectFromHost(); |
|
554 | RMAPSend_SOCKET->disconnectFromHost(); | |
546 | RMAPReceive_SOCKET->disconnectFromHost(); |
|
555 | RMAPReceive_SOCKET->disconnectFromHost(); | |
547 | GRESBStatusQuery_SOCKET->disconnectFromHost(); |
|
556 | GRESBStatusQuery_SOCKET->disconnectFromHost(); | |
548 | emit isOpen(false); |
|
557 | emit isOpen(false); | |
549 | } |
|
558 | } | |
550 |
|
559 | |||
551 | int gresb::GRESBStatusQuery() // SLOT |
|
560 | int gresb::GRESBStatusQuery() // SLOT | |
552 | { |
|
561 | { | |
553 | GRESBStatusQueryRequest(LinkStatus, 0); |
|
562 | GRESBStatusQueryRequest(LinkStatus, 0); | |
554 | GRESBStatusQueryRequest(LinkStatus, 1); |
|
563 | GRESBStatusQueryRequest(LinkStatus, 1); | |
555 | GRESBStatusQueryRequest(LinkStatus, 2); |
|
564 | GRESBStatusQueryRequest(LinkStatus, 2); | |
556 | GRESBStatusQueryRequest(LinkStatistics, 0); |
|
565 | GRESBStatusQueryRequest(LinkStatistics, 0); | |
557 | GRESBStatusQueryRequest(LinkStatistics, 1); |
|
566 | GRESBStatusQueryRequest(LinkStatistics, 1); | |
558 | GRESBStatusQueryRequest(LinkStatistics, 2); |
|
567 | GRESBStatusQueryRequest(LinkStatistics, 2); | |
559 | return 0; |
|
568 | return 0; | |
560 | } |
|
569 | } | |
561 |
|
570 | |||
562 | int gresb::GRESBStatusQueryRequest(GresbStatusQueryOption option, char link) |
|
571 | int gresb::GRESBStatusQueryRequest(GresbStatusQueryOption option, char link) | |
563 | { |
|
572 | { | |
564 | gresb_status_query_t statusQueryCommand; |
|
573 | gresb_status_query_t statusQueryCommand; | |
565 | gresb_link_status_reply_t linkStatusReply; |
|
574 | gresb_link_status_reply_t linkStatusReply; | |
566 | gresb_link_statistics_reply_t linkStatisticsReply; |
|
575 | gresb_link_statistics_reply_t linkStatisticsReply; | |
567 | QTime statusQueryTimeout; |
|
576 | QTime statusQueryTimeout; | |
568 | QString console_message; |
|
577 | QString console_message; | |
569 |
|
578 | |||
570 | statusQueryCommand.protocolIdentifier = (char) 0x02; |
|
579 | statusQueryCommand.protocolIdentifier = (char) 0x02; | |
571 | statusQueryCommand.reserved1 = (char) 0x00; |
|
580 | statusQueryCommand.reserved1 = (char) 0x00; | |
572 | statusQueryCommand.reserved0 = (char) 0x00; |
|
581 | statusQueryCommand.reserved0 = (char) 0x00; | |
573 | statusQueryCommand.option = (char) option; |
|
582 | statusQueryCommand.option = (char) option; | |
574 | statusQueryCommand.value3 = (char) 0x00; |
|
583 | statusQueryCommand.value3 = (char) 0x00; | |
575 | statusQueryCommand.value2 = (char) 0x00; |
|
584 | statusQueryCommand.value2 = (char) 0x00; | |
576 | statusQueryCommand.value1 = (char) 0x00; |
|
585 | statusQueryCommand.value1 = (char) 0x00; | |
577 | statusQueryCommand.value0 = (char) link; |
|
586 | statusQueryCommand.value0 = (char) link; | |
578 |
|
587 | |||
579 | GRESBStatusQuery_SOCKET->write((char*) ((void*) &statusQueryCommand), sizeof(statusQueryCommand)); |
|
588 | GRESBStatusQuery_SOCKET->write((char*) ((void*) &statusQueryCommand), sizeof(statusQueryCommand)); | |
580 | GRESBStatusQuery_SOCKET->flush(); |
|
589 | GRESBStatusQuery_SOCKET->flush(); | |
581 | GRESBStatusQuery_SOCKET->waitForBytesWritten(1000); |
|
590 | GRESBStatusQuery_SOCKET->waitForBytesWritten(1000); | |
582 |
|
591 | |||
583 | statusQueryTimeout.start(); |
|
592 | statusQueryTimeout.start(); | |
584 | while(GRESBStatusQuery_SOCKET->bytesToWrite() > 0) |
|
593 | while(GRESBStatusQuery_SOCKET->bytesToWrite() > 0) | |
585 | { |
|
594 | { | |
586 | GRESBStatusQuery_SOCKET->waitForBytesWritten(100); |
|
595 | GRESBStatusQuery_SOCKET->waitForBytesWritten(100); | |
587 | if(statusQueryTimeout.elapsed()>1000) |
|
596 | if(statusQueryTimeout.elapsed()>1000) | |
588 | { |
|
597 | { | |
589 | emit appendToLog("WARNING === in function GRESBStatusQueryRequest of rmapplugin *** sending StatusQueryCommand timeout"); |
|
598 | emit appendToLog("WARNING === in function GRESBStatusQueryRequest of rmapplugin *** sending StatusQueryCommand timeout"); | |
590 | return 1; |
|
599 | return 1; | |
591 | } |
|
600 | } | |
592 | } |
|
601 | } | |
593 |
|
602 | |||
594 | switch (option) |
|
603 | switch (option) | |
595 | { |
|
604 | { | |
596 | case LinkStatus: |
|
605 | case LinkStatus: | |
597 | { |
|
606 | { | |
598 | statusQueryTimeout.start(); |
|
607 | statusQueryTimeout.start(); | |
599 | while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatusReply)) |
|
608 | while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatusReply)) | |
600 | { |
|
609 | { | |
601 | GRESBStatusQuery_SOCKET->waitForReadyRead(100); |
|
610 | GRESBStatusQuery_SOCKET->waitForReadyRead(100); | |
602 | if(statusQueryTimeout.elapsed()>1000) |
|
611 | if(statusQueryTimeout.elapsed()>1000) | |
603 | { |
|
612 | { | |
604 | console_message.sprintf("GRESBStatusQueryRequest / LinkStatus => error timeout bytesAvailable()\n"); |
|
613 | console_message.sprintf("GRESBStatusQueryRequest / LinkStatus => error timeout bytesAvailable()\n"); | |
605 | emit appendToLog(console_message); |
|
614 | emit appendToLog(console_message); | |
606 | return 1; |
|
615 | return 1; | |
607 | } |
|
616 | } | |
608 | } |
|
617 | } | |
609 | GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatusReply), (int) sizeof(linkStatusReply)); |
|
618 | GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatusReply), (int) sizeof(linkStatusReply)); | |
610 | console_message.sprintf("%x", linkStatusReply.byte0); |
|
619 | console_message.sprintf("%x", linkStatusReply.byte0); | |
611 | spwLinkStatusEnquiry->statusQueryTable->item(0, link)->setText(console_message); |
|
620 | spwLinkStatusEnquiry->statusQueryTable->item(0, link)->setText(console_message); | |
612 | console_message.sprintf("%d", linkStatusReply.byte1); |
|
621 | console_message.sprintf("%d", linkStatusReply.byte1); | |
613 | spwLinkStatusEnquiry->statusQueryTable->item(1, link)->setText(console_message); |
|
622 | spwLinkStatusEnquiry->statusQueryTable->item(1, link)->setText(console_message); | |
614 | if (linkStatusReply.byte0 == 0) return 1; |
|
623 | if (linkStatusReply.byte0 == 0) return 1; | |
615 | break; |
|
624 | break; | |
616 | } |
|
625 | } | |
617 | case LinkStatistics: |
|
626 | case LinkStatistics: | |
618 | { |
|
627 | { | |
619 | statusQueryTimeout.start(); |
|
628 | statusQueryTimeout.start(); | |
620 | while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatisticsReply)) |
|
629 | while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatisticsReply)) | |
621 | { |
|
630 | { | |
622 | GRESBStatusQuery_SOCKET->waitForReadyRead(100); |
|
631 | GRESBStatusQuery_SOCKET->waitForReadyRead(100); | |
623 | if(statusQueryTimeout.elapsed()>1000) |
|
632 | if(statusQueryTimeout.elapsed()>1000) | |
624 | { |
|
633 | { | |
625 | console_message.sprintf("GRESBStatusQueryRequest / LinkStatistics => error timeout bytesAvailable()\n"); |
|
634 | console_message.sprintf("GRESBStatusQueryRequest / LinkStatistics => error timeout bytesAvailable()\n"); | |
626 | emit appendToLog(console_message); |
|
635 | emit appendToLog(console_message); | |
627 | return 1; |
|
636 | return 1; | |
628 | } |
|
637 | } | |
629 | } |
|
638 | } | |
630 | GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatisticsReply), sizeof(linkStatisticsReply)); |
|
639 | GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatisticsReply), sizeof(linkStatisticsReply)); | |
631 | /*console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataTransmitted)); |
|
640 | /*console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataTransmitted)); | |
632 | UI->spwLinkStatusEnquiry->statusQueryTable->item(9, link)->setText(console_message); |
|
641 | UI->spwLinkStatusEnquiry->statusQueryTable->item(9, link)->setText(console_message); | |
633 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsTransmitted)); |
|
642 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsTransmitted)); | |
634 | UI->spwLinkStatusEnquiry->statusQueryTable->item(8, link)->setText(console_message); |
|
643 | UI->spwLinkStatusEnquiry->statusQueryTable->item(8, link)->setText(console_message); | |
635 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfTruncatedPacketsReceived)); |
|
644 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfTruncatedPacketsReceived)); | |
636 | UI->spwLinkStatusEnquiry->statusQueryTable->item(6, link)->setText(console_message); |
|
645 | UI->spwLinkStatusEnquiry->statusQueryTable->item(6, link)->setText(console_message); | |
637 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsWithEEPReceived)); |
|
646 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsWithEEPReceived)); | |
638 | UI->spwLinkStatusEnquiry->statusQueryTable->item(5, link)->setText(console_message); |
|
647 | UI->spwLinkStatusEnquiry->statusQueryTable->item(5, link)->setText(console_message); | |
639 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataReceived)); |
|
648 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataReceived)); | |
640 | UI->spwLinkStatusEnquiry->statusQueryTable->item(4, link)->setText(console_message); |
|
649 | UI->spwLinkStatusEnquiry->statusQueryTable->item(4, link)->setText(console_message); | |
641 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsReceived)); |
|
650 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsReceived)); | |
642 | UI->spwLinkStatusEnquiry->statusQueryTable->item(3, link)->setText(console_message);*/ |
|
651 | UI->spwLinkStatusEnquiry->statusQueryTable->item(3, link)->setText(console_message);*/ | |
643 | break; |
|
652 | break; | |
644 | } |
|
653 | } | |
645 | case NodeAddressStatistics: |
|
654 | case NodeAddressStatistics: | |
646 | { |
|
655 | { | |
647 | break; |
|
656 | break; | |
648 | } |
|
657 | } | |
649 | case GetRoute: |
|
658 | case GetRoute: | |
650 | { |
|
659 | { | |
651 | break; |
|
660 | break; | |
652 | } |
|
661 | } | |
653 | } |
|
662 | } | |
654 | return 0; |
|
663 | return 0; | |
655 | } |
|
664 | } | |
656 |
|
665 | |||
657 | void gresb::processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size) // SLOT |
|
666 | void gresb::processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size) // SLOT | |
658 | { |
|
667 | { | |
659 | QString message; |
|
668 | QString message; | |
660 | unsigned int fine_time_value = 0; |
|
669 | unsigned int fine_time_value = 0; | |
661 | fine_time_value = ((unsigned int) ccsdsPacket[7]<<24) |
|
670 | fine_time_value = ((unsigned int) ccsdsPacket[7]<<24) | |
662 | + ((unsigned int) ccsdsPacket[6]<<16) |
|
671 | + ((unsigned int) ccsdsPacket[6]<<16) | |
663 | + ((unsigned int) ccsdsPacket[5]<<8) |
|
672 | + ((unsigned int) ccsdsPacket[5]<<8) | |
664 | + ((unsigned int) ccsdsPacket[4]); |
|
673 | + ((unsigned int) ccsdsPacket[4]); | |
665 | message.append(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": "); |
|
674 | message.append(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": "); | |
666 | message.append("size " |
|
675 | message.append("size " | |
667 | + QString::number(size) |
|
676 | + QString::number(size) | |
668 | +" *** header " |
|
677 | +" *** header " | |
669 | + QString::number(ccsdsPacket[0], 16) |
|
678 | + QString::number(ccsdsPacket[0], 16) | |
670 | + " " |
|
679 | + " " | |
671 | + QString::number(ccsdsPacket[1], 16) |
|
680 | + QString::number(ccsdsPacket[1], 16) | |
672 | + " " |
|
681 | + " " | |
673 | + QString::number(ccsdsPacket[2], 16) |
|
682 | + QString::number(ccsdsPacket[2], 16) | |
674 | + " " |
|
683 | + " " | |
675 | + QString::number(ccsdsPacket[3], 16) |
|
684 | + QString::number(ccsdsPacket[3], 16) | |
676 | + " *** coarse time " |
|
685 | + " *** coarse time " | |
677 | + QString::number(fine_time_value)); |
|
686 | + QString::number(fine_time_value)); | |
678 | //+ QString::number(ccsdsPacket[4], 16) |
|
687 | //+ QString::number(ccsdsPacket[4], 16) | |
679 | //+" " |
|
688 | //+" " | |
680 | //+ QString::number(ccsdsPacket[5], 16) |
|
689 | //+ QString::number(ccsdsPacket[5], 16) | |
681 | //+" " |
|
690 | //+" " | |
682 | //+ QString::number(ccsdsPacket[6], 16) |
|
691 | //+ QString::number(ccsdsPacket[6], 16) | |
683 | //+" " |
|
692 | //+" " | |
684 | //+ QString::number(ccsdsPacket[7], 16)); |
|
693 | //+ QString::number(ccsdsPacket[7], 16)); | |
685 | ccsdsPacketSEMAPHORE->acquire(); |
|
694 | ccsdsPacketSEMAPHORE->acquire(); | |
686 | emit sendMessage(message); |
|
695 | emit sendMessage(message); | |
687 | } |
|
696 | } | |
|
697 | ||||
|
698 | void gresb::reTestSPWLink() // SLOT | |||
|
699 | { | |||
|
700 | if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 0) | |||
|
701 | { | |||
|
702 | gresbStatusQueryDialog->accept(); | |||
|
703 | } | |||
|
704 | } | |||
|
705 | ||||
|
706 | void gresb::RMAPSendConnectionState(QAbstractSocket::SocketState socketState) // SLOT | |||
|
707 | { | |||
|
708 | rmapSendStateLabel->setText(""); | |||
|
709 | QString socketMessage = "RMAP Send Socket State: "; | |||
|
710 | switch(socketState) | |||
|
711 | { | |||
|
712 | case QAbstractSocket::UnconnectedState : | |||
|
713 | socketMessage.append("0 => Unconnected"); | |||
|
714 | break; | |||
|
715 | case 1: | |||
|
716 | socketMessage.append("1 => HostLookup"); | |||
|
717 | break; | |||
|
718 | case 2: | |||
|
719 | socketMessage.append("2 => Connecting"); | |||
|
720 | break; | |||
|
721 | case 3: | |||
|
722 | socketMessage.append("3 => Connected"); | |||
|
723 | break; | |||
|
724 | case 4: | |||
|
725 | socketMessage.append("4 => Bound"); | |||
|
726 | break; | |||
|
727 | case 5: | |||
|
728 | socketMessage.append("5 => Closing"); | |||
|
729 | break; | |||
|
730 | case 6: | |||
|
731 | socketMessage.append("6 => Listening"); | |||
|
732 | break; | |||
|
733 | } | |||
|
734 | rmapSendStateLabel->setText(socketMessage); | |||
|
735 | emit appendToLog(socketMessage); | |||
|
736 | } | |||
|
737 | ||||
|
738 | void gresb::RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState) // SLOT | |||
|
739 | { | |||
|
740 | rmapReceiveStateLabel->setText(""); | |||
|
741 | QString socketMessage = "RMAP Receive Socket State: "; | |||
|
742 | switch(socketState) | |||
|
743 | { | |||
|
744 | case QAbstractSocket::UnconnectedState : | |||
|
745 | socketMessage.append("0 => Unconnected"); | |||
|
746 | break; | |||
|
747 | case 1: | |||
|
748 | socketMessage.append("1 => HostLookup"); | |||
|
749 | break; | |||
|
750 | case 2: | |||
|
751 | socketMessage.append("2 => Connecting"); | |||
|
752 | break; | |||
|
753 | case 3: | |||
|
754 | socketMessage.append("3 => Connected"); | |||
|
755 | break; | |||
|
756 | case 4: | |||
|
757 | socketMessage.append("4 => Bound"); | |||
|
758 | break; | |||
|
759 | case 5: | |||
|
760 | socketMessage.append("5 => Closing"); | |||
|
761 | break; | |||
|
762 | case 6: | |||
|
763 | socketMessage.append("6 => Listening"); | |||
|
764 | break; | |||
|
765 | } | |||
|
766 | rmapReceiveStateLabel->setText(socketMessage); | |||
|
767 | emit appendToLog(socketMessage); | |||
|
768 | } | |||
|
769 | ||||
|
770 | void gresb::GRESBConnectionState(QAbstractSocket::SocketState socketState) // SLOT | |||
|
771 | { | |||
|
772 | gresbStatusQueryLabel->setText(""); | |||
|
773 | QString socketMessage = "GRESB status query socket (port 3010): "; | |||
|
774 | switch(socketState) | |||
|
775 | { | |||
|
776 | case QAbstractSocket::UnconnectedState : | |||
|
777 | socketMessage.append("0 => Unconnected"); | |||
|
778 | break; | |||
|
779 | case 1: | |||
|
780 | socketMessage.append("1 => HostLookup"); | |||
|
781 | break; | |||
|
782 | case 2: | |||
|
783 | socketMessage.append("2 => Connecting"); | |||
|
784 | break; | |||
|
785 | case 3: | |||
|
786 | socketMessage.append("3 => Connected"); | |||
|
787 | break; | |||
|
788 | case 4: | |||
|
789 | socketMessage.append("4 => Bound"); | |||
|
790 | break; | |||
|
791 | case 5: | |||
|
792 | socketMessage.append("5 => Closing"); | |||
|
793 | break; | |||
|
794 | case 6: | |||
|
795 | socketMessage.append("6 => Listening"); | |||
|
796 | break; | |||
|
797 | } | |||
|
798 | gresbStatusQueryLabel->setText(socketMessage); | |||
|
799 | } |
@@ -1,99 +1,101 | |||||
1 | #ifndef GRESB_H |
|
1 | #ifndef GRESB_H | |
2 | #define GRESB_H |
|
2 | #define GRESB_H | |
3 |
|
3 | |||
4 | #include <QWidget> |
|
4 | #include <QWidget> | |
5 | #include <QLabel> |
|
5 | #include <QLabel> | |
6 | #include <QPushButton> |
|
6 | #include <QPushButton> | |
7 | #include <QSpinBox> |
|
7 | #include <QSpinBox> | |
8 | #include <QGridLayout> |
|
8 | #include <QGridLayout> | |
9 | #include <QTcpSocket> |
|
9 | #include <QTcpSocket> | |
10 | #include <QDialog> |
|
10 | #include <QDialog> | |
11 | #include <QSemaphore> |
|
11 | #include <QSemaphore> | |
12 |
|
12 | |||
13 | #include "gresbstatusenquiry.h" |
|
13 | #include "gresbstatusenquiry.h" | |
14 | #include "spwpacketreceiver.h" |
|
14 | #include "spwpacketreceiver.h" | |
15 | #include "rmapoperations.h" |
|
15 | #include "rmapoperations.h" | |
16 | #include "qipdialogbox.h" |
|
16 | #include "qipdialogbox.h" | |
17 |
|
17 | |||
18 | class gresb : public QWidget |
|
18 | class gresb : public QWidget | |
19 | { |
|
19 | { | |
20 | Q_OBJECT |
|
20 | Q_OBJECT | |
21 | public: |
|
21 | public: | |
22 | explicit gresb(QWidget *parent = 0); |
|
22 | explicit gresb(QWidget *parent = 0); | |
23 | ~gresb(); |
|
23 | ~gresb(); | |
24 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
24 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); | |
25 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
25 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); | |
26 | unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); |
|
26 | unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); | |
27 | //unsigned int getLinkStatus(unsigned char link); |
|
|||
28 |
|
27 | |||
29 | signals: |
|
28 | signals: | |
30 | void sendMessage(QString message); |
|
29 | void sendMessage(QString message); | |
31 | void isOpen(bool); |
|
30 | void isOpen(bool); | |
32 | void RMAP_write_reply_setText(QString); |
|
31 | void RMAP_write_reply_setText(QString); | |
33 | void appendToLog(QString); |
|
32 | void appendToLog(QString); | |
34 | void ccsdsPacketAvailable(unsigned char*, unsigned int); |
|
33 | void ccsdsPacketAvailable(unsigned char*, unsigned int); | |
35 |
|
34 | |||
36 | public slots: |
|
35 | public slots: | |
37 | void Open(); |
|
36 | void Open(); | |
38 | void Close(); |
|
37 | void Close(); | |
39 | int receiveSPWPacket(unsigned char requestID=0); |
|
38 | int receiveSPWPacket(unsigned char requestID=0); | |
40 | void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size); |
|
39 | void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size); | |
|
40 | void reTestSPWLink(); | |||
|
41 | void RMAPSendConnectionState(QAbstractSocket::SocketState socketState); | |||
|
42 | void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState); | |||
|
43 | void GRESBConnectionState(QAbstractSocket::SocketState socketState); | |||
41 | void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} |
|
44 | void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} | |
42 | void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} |
|
45 | void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} | |
43 | void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;} |
|
|||
44 |
|
46 | |||
45 | private slots: |
|
47 | private slots: | |
46 | int GRESBStatusQuery(); |
|
48 | int GRESBStatusQuery(); | |
47 |
|
49 | |||
48 | private: |
|
50 | private: | |
49 | unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0); |
|
51 | unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0); | |
50 | unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0); |
|
52 | unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0); | |
51 | void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->acquire();} |
|
53 | void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->acquire();} | |
52 | void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->acquire();} |
|
54 | void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->acquire();} | |
53 | int GRESBStatusQueryRequest(GresbStatusQueryOption option, char link); |
|
55 | int GRESBStatusQueryRequest(GresbStatusQueryOption option, char link); | |
54 |
|
56 | |||
55 | unsigned char rmapTargetLogicalAddress ; |
|
57 | unsigned char rmapTargetLogicalAddress ; | |
56 | unsigned char rmapSourceLogicalAddress ; |
|
58 | unsigned char rmapSourceLogicalAddress ; | |
57 |
|
59 | |||
58 | RMAP_command_codes commandCode; |
|
60 | RMAP_command_codes commandCode; | |
59 |
|
61 | |||
60 | QPushButton *gresbStatusQueryRetryButton; |
|
62 | QPushButton *gresbStatusQueryRetryButton; | |
61 | QPushButton *gresbStatusQueryAbortButton; |
|
63 | QPushButton *gresbStatusQueryAbortButton; | |
62 |
|
64 | |||
63 | QLabel *gresbBridgeIPLabel; |
|
65 | QLabel *gresbBridgeIPLabel; | |
64 | QLabel *gresbVirtualLinkLabel; |
|
66 | QLabel *gresbVirtualLinkLabel; | |
65 | QLabel *spwLinkLabel; |
|
67 | QLabel *spwLinkLabel; | |
66 | QLabel *rmapSourceLogicalAddressLabel; |
|
68 | QLabel *rmapSourceLogicalAddressLabel; | |
67 | QLabel *rmapSendStateLabel; |
|
69 | QLabel *rmapSendStateLabel; | |
68 | QLabel *rmapReceiveStateLabel; |
|
70 | QLabel *rmapReceiveStateLabel; | |
69 | QLabel *gresbStatusQueryLabel; |
|
71 | QLabel *gresbStatusQueryLabel; | |
70 | QLabel *gresbStatusQueryDialogLabel; |
|
72 | QLabel *gresbStatusQueryDialogLabel; | |
71 |
|
73 | |||
72 | QDialog *gresbStatusQueryDialog; |
|
74 | QDialog *gresbStatusQueryDialog; | |
73 |
|
75 | |||
74 | QIPDialogBox* gresbBridgeIPDialogBox; |
|
76 | QIPDialogBox* gresbBridgeIPDialogBox; | |
75 |
|
77 | |||
76 | QSpinBox *gresbVirtualLinkSpinBox; |
|
78 | QSpinBox *gresbVirtualLinkSpinBox; | |
77 | QSpinBox *spwLinkSpinBox; |
|
79 | QSpinBox *spwLinkSpinBox; | |
78 | QSpinBox *rmapSourceLogicalAddressSpinBox; |
|
80 | QSpinBox *rmapSourceLogicalAddressSpinBox; | |
79 |
|
81 | |||
80 | QGridLayout *connectionLayout; |
|
82 | QGridLayout *connectionLayout; | |
81 | QGridLayout *gresbStatusQueryDialogLayout; |
|
83 | QGridLayout *gresbStatusQueryDialogLayout; | |
82 |
|
84 | |||
83 | QTcpSocket *RMAPSend_SOCKET; |
|
85 | QTcpSocket *RMAPSend_SOCKET; | |
84 | QTcpSocket *RMAPReceive_SOCKET; |
|
86 | QTcpSocket *RMAPReceive_SOCKET; | |
85 | QTcpSocket *GRESBStatusQuery_SOCKET; |
|
87 | QTcpSocket *GRESBStatusQuery_SOCKET; | |
86 |
|
88 | |||
87 | gresbStatusEnquiry* spwLinkStatusEnquiry; |
|
89 | gresbStatusEnquiry* spwLinkStatusEnquiry; | |
88 |
|
90 | |||
89 | // Packet receiver |
|
91 | // Packet receiver | |
90 | QSemaphore *rmapPacketSEMAPHORE; |
|
92 | QSemaphore *rmapPacketSEMAPHORE; | |
91 | QSemaphore *ccsdsPacketSEMAPHORE; |
|
93 | QSemaphore *ccsdsPacketSEMAPHORE; | |
92 | char* rmapPacket; // The buffer to receive RMAP READ packets |
|
94 | char* rmapPacket; // The buffer to receive RMAP READ packets | |
93 | unsigned char *ccsdsPacket; |
|
95 | unsigned char *ccsdsPacket; | |
94 | char *spwPacket; |
|
96 | char *spwPacket; | |
95 | unsigned int rmapPacketSize; |
|
97 | unsigned int rmapPacketSize; | |
96 | unsigned int ccsdsPacketSize; |
|
98 | unsigned int ccsdsPacketSize; | |
97 | }; |
|
99 | }; | |
98 |
|
100 | |||
99 | #endif // GRESB_H |
|
101 | #endif // GRESB_H |
This diff has been collapsed as it changes many lines, (717 lines changed) Show them Hide them | |||||
@@ -1,923 +1,286 | |||||
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 | ||
35 | RMAPReceive_SOCKET = new QTcpSocket; |
|
|||
36 | GRESBStatusQuery_SOCKET = new QTcpSocket; |
|
|||
37 | spwPacketReceiverOBJECT = new spwpacketreceiver; |
|
|||
38 | spwPacketReceiverOBJECT->gresbReceptionSocket = RMAPReceive_SOCKET; |
|
|||
39 | timeCode = 0; |
|
35 | timeCode = 0; | |
40 | time_COARSE = 0; |
|
36 | time_COARSE = 0; | |
41 | time_FINE = 0; |
|
37 | time_FINE = 0; | |
42 | currentBridge = selectedBridgeIsUnknown; |
|
38 | currentBridge = selectedBridgeIsUnknown; | |
43 |
|
39 | |||
44 | /*Python wrapper*/ |
|
40 | /*Python wrapper*/ | |
45 | this->pyObject = new rmappluginPythonWrapper(); |
|
41 | this->pyObject = new rmappluginPythonWrapper(); | |
46 | connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint))); |
|
42 | 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))); |
|
43 | connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint))); | |
48 | /*==============*/ |
|
44 | /*==============*/ | |
49 |
|
45 | |||
50 | connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(openBridge())); |
|
46 | connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(openBridge())); | |
51 | connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(closeBridge())); |
|
47 | connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(closeBridge())); | |
52 | connect(RMAPSend_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPSendConnectionState(QAbstractSocket::SocketState))); |
|
|||
53 | connect(RMAPReceive_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPReceiveConnectionState(QAbstractSocket::SocketState))); |
|
|||
54 | connect(GRESBStatusQuery_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(GRESBConnectionState(QAbstractSocket::SocketState))); |
|
|||
55 | connect(UI->gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink())); |
|
|||
56 | connect(this->UI->spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery())); |
|
|||
57 | connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this->spwPacketReceiverOBJECT, SLOT(receiveSPWPacket())); |
|
|||
58 |
|
48 | |||
59 | // CCSDS |
|
49 | // CCSDS | |
60 | connect(this->UI->sendCCSDSCommandButton, SIGNAL(clicked()), this, SLOT(sendCCSDS())); |
|
50 | connect(this->UI->sendCCSDSCommandButton, SIGNAL(clicked()), this, SLOT(sendCCSDS())); | |
61 | connect(this->UI->send_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(send_TC_LFR_UPDATE_TIME())); |
|
51 | connect(this->UI->send_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(send_TC_LFR_UPDATE_TIME())); | |
62 | connect(this->UI->reset_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(reset_TC_LFR_UPDATE_TIME())); |
|
52 | connect(this->UI->reset_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(reset_TC_LFR_UPDATE_TIME())); | |
63 |
|
53 | |||
64 | // CONSOLE |
|
|||
65 | connect(this->spwPacketReceiverOBJECT, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); |
|
|||
66 | connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); |
|
|||
67 |
|
||||
68 | // spectralMAtricesDMASimulator |
|
54 | // spectralMAtricesDMASimulator | |
69 | connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginRead(uint*,uint,uint)), this, SLOT(Read(uint*,uint,uint))); |
|
55 | connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginRead(uint*,uint,uint)), this, SLOT(Read(uint*,uint,uint))); | |
70 | connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginWrite(uint*,uint,uint)), this, SLOT(Write(uint*,uint,uint))); |
|
56 | connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginWrite(uint*,uint,uint)), this, SLOT(Write(uint*,uint,uint))); | |
71 | connect(this->UI->spectralMatricesDMASimulator, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); |
|
57 | connect(this->UI->spectralMatricesDMASimulator, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); | |
72 |
|
58 | |||
73 | // GRESB |
|
59 | // GRESB | |
74 |
connect(this, SIGNAL( |
|
60 | connect(this->UI->gresbBridge, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); | |
|
61 | connect(this->UI->gresbBridge, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool))); | |||
|
62 | connect(this->UI->gresbBridge, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString))); | |||
|
63 | connect(this->UI->gresbBridge, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString))); | |||
75 |
|
64 | |||
76 | // Star Dundee |
|
65 | // Star Dundee | |
77 |
connect(this->UI->starDundee, SIGNAL( |
|
66 | connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); | |
|
67 | connect(this->UI->starDundee, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool))); | |||
78 | connect(this->UI->starDundee, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString))); |
|
68 | connect(this->UI->starDundee, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString))); | |
79 | connect(this->UI->starDundee, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString))); |
|
69 | connect(this->UI->starDundee, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString))); | |
80 |
|
70 | |||
81 | connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(bridgeHasChanged(selectedBridge))); |
|
71 | connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(bridgeHasChanged(selectedBridge))); | |
82 | } |
|
72 | } | |
83 |
|
73 | |||
84 | rmapplugin::~rmapplugin() |
|
74 | rmapplugin::~rmapplugin() | |
85 | { |
|
75 | { | |
86 | if (!RMAPSend_SOCKET->isOpen()) RMAPSend_SOCKET->disconnectFromHost(); |
|
76 | if (!RMAPSend_SOCKET->isOpen()) RMAPSend_SOCKET->disconnectFromHost(); | |
87 | if (!RMAPReceive_SOCKET->isOpen()) RMAPReceive_SOCKET->disconnectFromHost(); |
|
77 | if (!RMAPReceive_SOCKET->isOpen()) RMAPReceive_SOCKET->disconnectFromHost(); | |
88 | if (!GRESBStatusQuery_SOCKET->isOpen()) GRESBStatusQuery_SOCKET->disconnectFromHost(); |
|
78 | if (!GRESBStatusQuery_SOCKET->isOpen()) GRESBStatusQuery_SOCKET->disconnectFromHost(); | |
89 | } |
|
79 | } | |
90 |
|
80 | |||
91 | unsigned int rmapplugin::Write(unsigned int *Value, unsigned int count, unsigned int address) |
|
81 | unsigned int rmapplugin::Write(unsigned int *Value, unsigned int count, unsigned int address) | |
92 | { |
|
82 | { | |
93 | unsigned int result; |
|
83 | unsigned int result; | |
94 | switch(currentBridge) |
|
84 | switch(currentBridge) | |
95 | { |
|
85 | { | |
96 | case selectedBridgeIsGRESB : |
|
86 | case selectedBridgeIsGRESB : | |
97 |
result = Write |
|
87 | result = UI->gresbBridge->Write(Value, count, address); | |
98 | break; |
|
88 | break; | |
99 | case selectedBridgeIsStarDundee : |
|
89 | case selectedBridgeIsStarDundee : | |
100 | result = UI->starDundee->Write(Value, count, address); |
|
90 | result = UI->starDundee->Write(Value, count, address); | |
101 | break; |
|
91 | break; | |
102 | default: |
|
92 | default: | |
103 | result = 1; |
|
93 | result = 1; | |
104 | break; |
|
94 | break; | |
105 | } |
|
95 | } | |
106 | return result; |
|
96 | return result; | |
107 | } |
|
97 | } | |
108 |
|
98 | |||
109 | unsigned int rmapplugin::Read(unsigned int *Value, unsigned int count, unsigned int address) |
|
99 | unsigned int rmapplugin::Read(unsigned int *Value, unsigned int count, unsigned int address) | |
110 | { |
|
100 | { | |
111 | unsigned int result; |
|
101 | unsigned int result; | |
112 | switch(currentBridge) |
|
102 | switch(currentBridge) | |
113 | { |
|
103 | { | |
114 | case selectedBridgeIsGRESB : |
|
104 | case selectedBridgeIsGRESB : | |
115 |
result = Read |
|
105 | result = UI->gresbBridge->Read(Value, count, address); | |
116 | break; |
|
106 | break; | |
117 | case selectedBridgeIsStarDundee : |
|
107 | case selectedBridgeIsStarDundee : | |
118 | result = UI->starDundee->Read(Value, count, address); |
|
108 | result = UI->starDundee->Read(Value, count, address); | |
119 | break; |
|
109 | break; | |
120 | default: |
|
110 | default: | |
121 | result = 1; |
|
111 | result = 1; | |
122 | break; |
|
112 | break; | |
123 | } |
|
113 | } | |
124 | return result; |
|
114 | return result; | |
125 | } |
|
115 | } | |
126 |
|
116 | |||
127 | unsigned int rmapplugin::WriteGRESB(unsigned int *Value, unsigned int count, unsigned int address) |
|
|||
128 | { |
|
|||
129 | unsigned int remainingCount = count; |
|
|||
130 | unsigned int iOffset = 0; |
|
|||
131 | QString console_message; |
|
|||
132 | char* data; |
|
|||
133 |
|
||||
134 | if(spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0) |
|
|||
135 | { |
|
|||
136 | APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped"); |
|
|||
137 | return 1; |
|
|||
138 | } |
|
|||
139 |
|
||||
140 | UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: unavailable"); |
|
|||
141 |
|
||||
142 | data = (char*) malloc(READ_WRITE_MAX_COUNTS*4); |
|
|||
143 |
|
||||
144 | APPENDTOLOG(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); |
|
|||
145 |
|
||||
146 | while (remainingCount > READ_WRITE_MAX_COUNTS) |
|
|||
147 | { |
|
|||
148 | for (int i = 0; i<READ_WRITE_MAX_COUNTS; i++) |
|
|||
149 | { |
|
|||
150 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); |
|
|||
151 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); |
|
|||
152 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); |
|
|||
153 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); |
|
|||
154 | } |
|
|||
155 |
|
||||
156 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
|||
157 | APPENDTOLOG(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
|||
158 |
|
||||
159 | if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0) |
|
|||
160 | { |
|
|||
161 | APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); |
|
|||
162 | return 1; |
|
|||
163 | } |
|
|||
164 |
|
||||
165 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; |
|
|||
166 | address = address + READ_WRITE_MAX_COUNTS * 4; |
|
|||
167 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; |
|
|||
168 | } |
|
|||
169 |
|
||||
170 | if (remainingCount > 0) |
|
|||
171 | { |
|
|||
172 | for (unsigned int i = 0; i<remainingCount; i++) |
|
|||
173 | { |
|
|||
174 | data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]); |
|
|||
175 | data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8); |
|
|||
176 | data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); |
|
|||
177 | data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); |
|
|||
178 | } |
|
|||
179 |
|
||||
180 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
|||
181 | APPENDTOLOG(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
|||
182 |
|
||||
183 | if (WriteBLOCK(data, remainingCount*4, address)==0) |
|
|||
184 | { |
|
|||
185 | APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); |
|
|||
186 | return 1; |
|
|||
187 | } |
|
|||
188 | } |
|
|||
189 |
|
||||
190 | APPENDTOLOG(QString("*** STOP *** WRITE")); |
|
|||
191 | free(data); |
|
|||
192 | return count; |
|
|||
193 | } |
|
|||
194 |
|
||||
195 | unsigned int rmapplugin::ReadGRESB(unsigned int *Value, unsigned int count, unsigned int address) |
|
|||
196 | { |
|
|||
197 | unsigned int remainingCount = count; |
|
|||
198 | unsigned int iOffset = 0; |
|
|||
199 | QString console_message; |
|
|||
200 |
|
||||
201 | if(spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0) |
|
|||
202 | { |
|
|||
203 | APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped"); |
|
|||
204 | return 1; |
|
|||
205 | } |
|
|||
206 | APPENDTOLOG(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); |
|
|||
207 |
|
||||
208 | while (remainingCount > READ_WRITE_MAX_COUNTS) |
|
|||
209 | { |
|
|||
210 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
|||
211 | APPENDTOLOG(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
|||
212 |
|
||||
213 | if (ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0) |
|
|||
214 | { |
|
|||
215 | APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP packet not received"); |
|
|||
216 | return 1; |
|
|||
217 | } |
|
|||
218 |
|
||||
219 | for(int i=0;i<READ_WRITE_MAX_COUNTS;i++) |
|
|||
220 | { |
|
|||
221 | Value[i+iOffset] = (unsigned char) spwPacketReceiverOBJECT->rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; |
|
|||
222 | for(int j=1;j<4;j++) |
|
|||
223 | { |
|
|||
224 | Value[i+iOffset]= ((unsigned char)(spwPacketReceiverOBJECT->rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256; |
|
|||
225 | } |
|
|||
226 | } |
|
|||
227 |
|
||||
228 | remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; |
|
|||
229 | address = address + READ_WRITE_MAX_COUNTS * 4; |
|
|||
230 | iOffset = iOffset + READ_WRITE_MAX_COUNTS; |
|
|||
231 | spwPacketReceiverOBJECT->acquireRMAPSemaphore(); |
|
|||
232 | } |
|
|||
233 |
|
||||
234 | if (remainingCount > 0) |
|
|||
235 | { |
|
|||
236 | console_message.sprintf("remainingCount: %d => ", remainingCount); |
|
|||
237 | APPENDTOLOG(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16)); |
|
|||
238 |
|
||||
239 | if (ReadBLOCK(4*remainingCount, address)==0) |
|
|||
240 | { |
|
|||
241 | APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP packet not received"); |
|
|||
242 | return 1; |
|
|||
243 | } |
|
|||
244 |
|
||||
245 | for(unsigned int i=0;i<remainingCount;i++) |
|
|||
246 | { |
|
|||
247 | Value[i+iOffset] = (unsigned char) spwPacketReceiverOBJECT->rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; |
|
|||
248 | for(int j=1;j<4;j++) |
|
|||
249 | { |
|
|||
250 | Value[i+iOffset]= ((unsigned char)(spwPacketReceiverOBJECT->rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256; |
|
|||
251 | } |
|
|||
252 | } |
|
|||
253 | spwPacketReceiverOBJECT->acquireRMAPSemaphore(); |
|
|||
254 | } |
|
|||
255 |
|
||||
256 | APPENDTOLOG(QString("*** STOP *** READ ")); |
|
|||
257 | return count; |
|
|||
258 | } |
|
|||
259 |
|
||||
260 | unsigned int rmapplugin::WriteBLOCK(char *data, unsigned int nbBytes, unsigned int address) |
|
|||
261 | { |
|
|||
262 | QTime RMAPTimeout; |
|
|||
263 | RMAP *RMAPCommand; |
|
|||
264 | int errorCode; |
|
|||
265 | QString console_message; |
|
|||
266 |
|
||||
267 | if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1) |
|
|||
268 | { |
|
|||
269 | RMAP_DISCONNECT(); |
|
|||
270 | return 1; |
|
|||
271 | } |
|
|||
272 |
|
||||
273 | RMAPCommand = new RMAP(UI->getCommandCode(), |
|
|||
274 | UI->rmapTargetLogicalAddressSpinBox->value(), |
|
|||
275 | UI->rmapSourceLogicalAddressSpinBox->value(), |
|
|||
276 | address, |
|
|||
277 | nbBytes, |
|
|||
278 | data); |
|
|||
279 |
|
||||
280 | // SEND GRESB HEADER |
|
|||
281 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4); |
|
|||
282 | // SEND SPACEWIRE PACKET HEADER |
|
|||
283 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader)); |
|
|||
284 | // SEND DATA |
|
|||
285 | RMAPSend_SOCKET->write( data, nbBytes); |
|
|||
286 | // SEND DATA CRC |
|
|||
287 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->dataCRC), 1); |
|
|||
288 | RMAPTimeout.start(); |
|
|||
289 | while(RMAPSend_SOCKET->bytesToWrite() > 0) |
|
|||
290 | { |
|
|||
291 | RMAPSend_SOCKET->waitForBytesWritten(100); |
|
|||
292 | if(RMAPTimeout.elapsed()>1000) |
|
|||
293 | { |
|
|||
294 | APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** sending Write RMAP Command timeout"); |
|
|||
295 | return 0; |
|
|||
296 | } |
|
|||
297 | } |
|
|||
298 |
|
||||
299 | if (UI->RMAP_write_reply->isChecked()) |
|
|||
300 | { |
|
|||
301 | // WAIT FOR THE RMAP REPLY PACKET |
|
|||
302 | errorCode = spwPacketReceiverOBJECT->receiveSPWPacket(1); |
|
|||
303 | if (errorCode<=0) |
|
|||
304 | { |
|
|||
305 | APPENDTOLOG("WARNING === in function WriteBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode)); |
|
|||
306 | return 0; |
|
|||
307 | } |
|
|||
308 | if(spwPacketReceiverOBJECT->rmapPacketSize != 8) |
|
|||
309 | { |
|
|||
310 | console_message.sprintf("WARNING === in function WRITE (with reply) of rmapplugin *** write reply format not compliant\n"); |
|
|||
311 | APPENDTOLOG(console_message); |
|
|||
312 | return 0; |
|
|||
313 | } |
|
|||
314 | switch (spwPacketReceiverOBJECT->rmapPacket[3]) // byte 4 is the status byte in the reply |
|
|||
315 | { |
|
|||
316 | case 0: |
|
|||
317 | UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 0 Successfull"); |
|
|||
318 | break; |
|
|||
319 | case 1: |
|
|||
320 | APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** General error code"); |
|
|||
321 | UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 1 General error code"); |
|
|||
322 | break; |
|
|||
323 | case 2: |
|
|||
324 | APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** 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"); |
|
|||
326 | break; |
|
|||
327 | case 3: |
|
|||
328 | APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid key"); |
|
|||
329 | UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 3 Invalid key"); |
|
|||
330 | break; |
|
|||
331 | case 4: |
|
|||
332 | APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid data CRC"); |
|
|||
333 | UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 4 Invalid data CRC"); |
|
|||
334 | break; |
|
|||
335 | case 5: |
|
|||
336 | APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Early EOP"); |
|
|||
337 | UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 5 Early EOP"); |
|
|||
338 | break; |
|
|||
339 | case 6: |
|
|||
340 | APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Too much data"); |
|
|||
341 | UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 6 Too much data"); |
|
|||
342 | break; |
|
|||
343 | case 7: |
|
|||
344 | APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** EEP"); |
|
|||
345 | UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 7 EEP"); |
|
|||
346 | break; |
|
|||
347 | case 8: |
|
|||
348 | APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Reserved"); |
|
|||
349 | UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 8 Reserved"); |
|
|||
350 | break; |
|
|||
351 | case 9: |
|
|||
352 | APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Verify buffer overrun"); |
|
|||
353 | UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 9 Verify buffer overrun"); |
|
|||
354 | break; |
|
|||
355 | case 10: |
|
|||
356 | APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** 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"); |
|
|||
358 | break; |
|
|||
359 | case 11: |
|
|||
360 | APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** 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"); |
|
|||
362 | break; |
|
|||
363 | case 12: |
|
|||
364 | APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid target logical address"); |
|
|||
365 | UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 12 Invalid target logical address"); |
|
|||
366 | break; |
|
|||
367 | } |
|
|||
368 | spwPacketReceiverOBJECT->acquireRMAPSemaphore(); |
|
|||
369 | } |
|
|||
370 | return nbBytes; |
|
|||
371 | } |
|
|||
372 |
|
||||
373 | unsigned int rmapplugin::ReadBLOCK(unsigned int nbBytes, unsigned int address) |
|
|||
374 | { |
|
|||
375 | int errorCode; |
|
|||
376 | RMAP *RMAPCommand; |
|
|||
377 | QTime RMAPTimeout; |
|
|||
378 | unsigned int dataLength; |
|
|||
379 | if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1) |
|
|||
380 | { |
|
|||
381 | RMAP_DISCONNECT(); |
|
|||
382 | return 1; |
|
|||
383 | } |
|
|||
384 |
|
||||
385 | if (nbBytes > 4) |
|
|||
386 | { |
|
|||
387 | RMAPCommand = new RMAP(read_Inc, |
|
|||
388 | UI->rmapTargetLogicalAddressSpinBox->value(), |
|
|||
389 | UI->rmapSourceLogicalAddressSpinBox->value(), |
|
|||
390 | address, |
|
|||
391 | nbBytes, |
|
|||
392 | NULL); |
|
|||
393 | } |
|
|||
394 | else |
|
|||
395 | { |
|
|||
396 | RMAPCommand = new RMAP(read_Single, |
|
|||
397 | UI->rmapTargetLogicalAddressSpinBox->value(), |
|
|||
398 | UI->rmapSourceLogicalAddressSpinBox->value(), |
|
|||
399 | address, |
|
|||
400 | nbBytes, |
|
|||
401 | NULL); |
|
|||
402 | } |
|
|||
403 |
|
||||
404 | // SEND THE GRESB HEADER FOR THE RMAP READ COMMAND |
|
|||
405 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4); |
|
|||
406 | // SEND THE SPACEWIRE PACKET FOR THE RMAP READ COMMAND |
|
|||
407 | RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader)); |
|
|||
408 | RMAPSend_SOCKET->waitForBytesWritten(100); |
|
|||
409 | RMAPTimeout.start(); |
|
|||
410 | // write timeout |
|
|||
411 | while(RMAPSend_SOCKET->bytesToWrite() > 0) |
|
|||
412 | { |
|
|||
413 | RMAPSend_SOCKET->waitForBytesWritten(100); |
|
|||
414 | if(RMAPTimeout.elapsed()>1000) |
|
|||
415 | { |
|
|||
416 | APPENDTOLOG("WARNING === in function READ of rmapplugin *** sending Read RMAP Command timeout\n"); |
|
|||
417 | return 0; |
|
|||
418 | } |
|
|||
419 | } |
|
|||
420 |
|
||||
421 | // RECEIVE THE INCOMING RMAP PACKET |
|
|||
422 | errorCode = spwPacketReceiverOBJECT->receiveSPWPacket(1); // request ID 1 is for RMAP packet |
|
|||
423 | if (errorCode<=0) |
|
|||
424 | { |
|
|||
425 | APPENDTOLOG("WARNING === in function ReadBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode)); |
|
|||
426 | return 0; |
|
|||
427 | } |
|
|||
428 | dataLength = spwPacketReceiverOBJECT->rmapPacketSize - RMAP_READ_REPLY_HEADER_LENGTH - RMAP_DATA_CRC_LENGTH; |
|
|||
429 | if(dataLength != nbBytes) |
|
|||
430 | { |
|
|||
431 | APPENDTOLOG("WARNING === in function READ of rmapplugin *** number of data received (" |
|
|||
432 | +QString::number(dataLength) |
|
|||
433 | +") not equal to number of data requested (" |
|
|||
434 | +QString::number(READ_WRITE_MAX_COUNTS*4) |
|
|||
435 | +")"); |
|
|||
436 | return 0; |
|
|||
437 | } |
|
|||
438 | return dataLength; |
|
|||
439 | } |
|
|||
440 |
|
||||
441 | //////// |
|
117 | //////// | |
442 | // SLOTS |
|
118 | // SLOTS | |
443 |
|
119 | |||
444 | unsigned int rmapplugin::WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) // SLOT |
|
120 | unsigned int rmapplugin::WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) // SLOT | |
445 | { |
|
121 | { | |
446 | unsigned int result; |
|
122 | unsigned int result; | |
447 | switch(currentBridge) |
|
123 | switch(currentBridge) | |
448 | { |
|
124 | { | |
449 | case selectedBridgeIsGRESB : |
|
125 | case selectedBridgeIsGRESB : | |
450 |
result = WriteSPW |
|
126 | result = UI->gresbBridge->WriteSPW(Value, count, targetLogicalAddress, userApplication); | |
451 | break; |
|
127 | break; | |
452 | case selectedBridgeIsStarDundee : |
|
128 | case selectedBridgeIsStarDundee : | |
453 | result = UI->starDundee->WriteSPW(Value, count, targetLogicalAddress, userApplication); |
|
129 | result = UI->starDundee->WriteSPW(Value, count, targetLogicalAddress, userApplication); | |
454 | break; |
|
130 | break; | |
455 | default: |
|
131 | default: | |
456 | result = 1; |
|
132 | result = 1; | |
457 | break; |
|
133 | break; | |
458 | } |
|
134 | } | |
459 | return result; |
|
135 | return result; | |
460 | } |
|
136 | } | |
461 |
|
137 | |||
462 | unsigned int rmapplugin::WriteSPWGRESB(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) |
|
|||
463 | { |
|
|||
464 | char protocoleIdentifier = 0x02; |
|
|||
465 | char reserved = 0x00; |
|
|||
466 | char gresbProtocole = 0x00; |
|
|||
467 | unsigned char size[3]; |
|
|||
468 | unsigned int spwPacketSize = count + 4; |
|
|||
469 | QTime SPWTimeout; |
|
|||
470 |
|
||||
471 | if (count>248) |
|
|||
472 | { |
|
|||
473 | APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** CCSDS packet size > 248 bytes\n"); |
|
|||
474 | return 1; |
|
|||
475 | } |
|
|||
476 |
|
||||
477 | APPENDTOLOG(QString("*** START *** Send CCSDS packet of ")+ QString::number(count) + QString(" byte(s)")); |
|
|||
478 |
|
||||
479 | if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1) |
|
|||
480 | { |
|
|||
481 | RMAP_DISCONNECT(); |
|
|||
482 | APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** SPW link not running\n"); |
|
|||
483 | return 1; |
|
|||
484 | } |
|
|||
485 |
|
||||
486 | // SEND GRESB HEADER |
|
|||
487 | size[0] = (unsigned char) ((unsigned int) spwPacketSize>>16); |
|
|||
488 | size[1] = (unsigned char) ((unsigned int) spwPacketSize>>8); |
|
|||
489 | size[2] = (unsigned char) ((unsigned int) spwPacketSize); |
|
|||
490 | RMAPSend_SOCKET->write(&gresbProtocole, 1); |
|
|||
491 | RMAPSend_SOCKET->write((char*) size, 3); |
|
|||
492 | // SEND SPW HEADER |
|
|||
493 | RMAPSend_SOCKET->write(&targetLogicalAddress, 1); |
|
|||
494 | RMAPSend_SOCKET->write(&protocoleIdentifier, 1); |
|
|||
495 | RMAPSend_SOCKET->write(&reserved, 1); |
|
|||
496 | RMAPSend_SOCKET->write(&userApplication, 1); |
|
|||
497 | // SEND CCSDS PACKET |
|
|||
498 | RMAPSend_SOCKET->write(Value, count); |
|
|||
499 | SPWTimeout.start(); |
|
|||
500 | while(RMAPSend_SOCKET->bytesToWrite() > 0) |
|
|||
501 | { |
|
|||
502 | RMAPSend_SOCKET->waitForBytesWritten(100); |
|
|||
503 | if(SPWTimeout.elapsed()>1000) |
|
|||
504 | { |
|
|||
505 | APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** sending CCSDS packet timeout\n"); |
|
|||
506 | return 1; |
|
|||
507 | } |
|
|||
508 | } |
|
|||
509 |
|
||||
510 | APPENDTOLOG(QString("*** CCSDS packet sent")); |
|
|||
511 |
|
||||
512 | return count; |
|
|||
513 | } |
|
|||
514 |
|
||||
515 | void rmapplugin::sendCCSDS() // SLOT |
|
138 | void rmapplugin::sendCCSDS() // SLOT | |
516 | { |
|
139 | { | |
517 | unsigned int nbBYTES_application_data = 8; |
|
140 | unsigned int nbBYTES_application_data = 8; | |
518 | unsigned int count; |
|
141 | unsigned int count; | |
519 | char *tab; |
|
142 | char *tab; | |
520 | unsigned char packetErrorControl1 = 0xaa; |
|
143 | unsigned char packetErrorControl1 = 0xaa; | |
521 | unsigned char packetErrorControl0 = 0xbb; |
|
144 | unsigned char packetErrorControl0 = 0xbb; | |
522 |
|
145 | |||
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 |
|
146 | 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 | |
524 | /* unsigned char data_field_header, |
|
147 | /* unsigned char data_field_header, | |
525 | unsigned char processID, |
|
148 | unsigned char processID, | |
526 | unsigned int sequence_count, |
|
149 | unsigned int sequence_count, | |
527 | unsigned int packet_length, |
|
150 | unsigned int packet_length, | |
528 | unsigned char acceptance, |
|
151 | unsigned char acceptance, | |
529 | unsigned int completion, |
|
152 | unsigned int completion, | |
530 | unsigned char service_type, |
|
153 | unsigned char service_type, | |
531 | unsigned char service_subtype, |
|
154 | unsigned char service_subtype, | |
532 | unsigned char sourceID*/ |
|
155 | unsigned char sourceID*/ | |
533 |
|
156 | |||
534 | count = nbBYTES_application_data+12; // 12 is the size in bytes of the header |
|
157 | count = nbBYTES_application_data+12; // 12 is the size in bytes of the header | |
535 | tab = (char*) malloc(count); |
|
158 | tab = (char*) malloc(count); | |
536 | tab[0] = ccsds_command->ccsds_header->packetId1; |
|
159 | tab[0] = ccsds_command->ccsds_header->packetId1; | |
537 | tab[1] = ccsds_command->ccsds_header->packetId0; |
|
160 | tab[1] = ccsds_command->ccsds_header->packetId0; | |
538 | tab[2] = ccsds_command->ccsds_header->packetSequenceControl1; |
|
161 | tab[2] = ccsds_command->ccsds_header->packetSequenceControl1; | |
539 | tab[3] = ccsds_command->ccsds_header->packetSequenceControl0; |
|
162 | tab[3] = ccsds_command->ccsds_header->packetSequenceControl0; | |
540 | tab[4] = ccsds_command->ccsds_header->packetLength1; |
|
163 | tab[4] = ccsds_command->ccsds_header->packetLength1; | |
541 | tab[5] = ccsds_command->ccsds_header->packetLength0; |
|
164 | tab[5] = ccsds_command->ccsds_header->packetLength0; | |
542 | tab[6] = ccsds_command->ccsds_header->dataFieldHeader3; |
|
165 | tab[6] = ccsds_command->ccsds_header->dataFieldHeader3; | |
543 | tab[7] = ccsds_command->ccsds_header->dataFieldHeader2; |
|
166 | tab[7] = ccsds_command->ccsds_header->dataFieldHeader2; | |
544 | tab[8] = ccsds_command->ccsds_header->dataFieldHeader1; |
|
167 | tab[8] = ccsds_command->ccsds_header->dataFieldHeader1; | |
545 | tab[9] = ccsds_command->ccsds_header->dataFieldHeader0; |
|
168 | tab[9] = ccsds_command->ccsds_header->dataFieldHeader0; | |
546 | tab[10]=0x00; |
|
169 | tab[10]=0x00; | |
547 | tab[11]=0x00; |
|
170 | tab[11]=0x00; | |
548 | tab[12]=0x00; |
|
171 | tab[12]=0x00; | |
549 | tab[13]=0x00; |
|
172 | tab[13]=0x00; | |
550 | tab[14]=0x00; |
|
173 | tab[14]=0x00; | |
551 | tab[15]=0x00; |
|
174 | tab[15]=0x00; | |
552 | tab[nbBYTES_application_data+10] = packetErrorControl1; |
|
175 | tab[nbBYTES_application_data+10] = packetErrorControl1; | |
553 | tab[nbBYTES_application_data+11] = packetErrorControl0; |
|
176 | tab[nbBYTES_application_data+11] = packetErrorControl0; | |
554 |
|
177 | |||
555 | WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00); |
|
178 | WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00); | |
556 |
|
179 | |||
557 | free(tab); |
|
180 | free(tab); | |
558 | } |
|
181 | } | |
559 |
|
182 | |||
|
183 | void rmapplugin::openBridge() | |||
|
184 | { | |||
|
185 | switch(currentBridge) | |||
|
186 | { | |||
|
187 | case selectedBridgeIsGRESB : | |||
|
188 | this->UI->gresbBridge->Open(); | |||
|
189 | break; | |||
|
190 | case selectedBridgeIsStarDundee : | |||
|
191 | this->UI->starDundee->Open(); | |||
|
192 | break; | |||
|
193 | default: | |||
|
194 | break; | |||
|
195 | } | |||
|
196 | } | |||
|
197 | ||||
|
198 | void rmapplugin::closeBridge() | |||
|
199 | { | |||
|
200 | switch(currentBridge) | |||
|
201 | { | |||
|
202 | case selectedBridgeIsGRESB : | |||
|
203 | this->UI->gresbBridge->Close(); | |||
|
204 | break; | |||
|
205 | case selectedBridgeIsStarDundee : | |||
|
206 | this->UI->starDundee->Close(); | |||
|
207 | break; | |||
|
208 | default: | |||
|
209 | break; | |||
|
210 | } | |||
|
211 | } | |||
|
212 | ||||
560 | void rmapplugin::send_TC_LFR_UPDATE_TIME() |
|
213 | void rmapplugin::send_TC_LFR_UPDATE_TIME() | |
561 | { |
|
214 | { | |
562 | unsigned int nbBYTES_application_data = 6; // Time at CUC format is on 48 bits / 6 bytes |
|
215 | unsigned int nbBYTES_application_data = 6; // Time at CUC format is on 48 bits / 6 bytes | |
563 | unsigned int count; |
|
216 | unsigned int count; | |
564 | char *tab; |
|
217 | char *tab; | |
565 | unsigned char packetErrorControl1 = 0xaa; |
|
218 | unsigned char packetErrorControl1 = 0xaa; | |
566 | unsigned char packetErrorControl0 = 0xbb; |
|
219 | unsigned char packetErrorControl0 = 0xbb; | |
567 |
|
220 | |||
568 | ccsds_command = new ccsds(1, 11, 0, nbBYTES_application_data, 1, 1, 9, 129, 0); |
|
221 | ccsds_command = new ccsds(1, 11, 0, nbBYTES_application_data, 1, 1, 9, 129, 0); | |
569 | /* unsigned char data_field_header, |
|
222 | /* unsigned char data_field_header, | |
570 | unsigned char processID, |
|
223 | unsigned char processID, | |
571 | unsigned int sequence_count, |
|
224 | unsigned int sequence_count, | |
572 | unsigned int packet_length, |
|
225 | unsigned int packet_length, | |
573 | unsigned char acceptance, |
|
226 | unsigned char acceptance, | |
574 | unsigned int completion, |
|
227 | unsigned int completion, | |
575 | unsigned char service_type, |
|
228 | unsigned char service_type, | |
576 | unsigned char service_subtype, |
|
229 | unsigned char service_subtype, | |
577 | unsigned char sourceID*/ |
|
230 | unsigned char sourceID*/ | |
578 |
|
231 | |||
579 | count = nbBYTES_application_data+12; // +12 => packet header 6 bytes + data field header 4 bytes + packet error control 2 bytes |
|
232 | count = nbBYTES_application_data+12; // +12 => packet header 6 bytes + data field header 4 bytes + packet error control 2 bytes | |
580 | tab = (char*) malloc(count); |
|
233 | tab = (char*) malloc(count); | |
581 | tab[0] = ccsds_command->ccsds_header->packetId1; |
|
234 | tab[0] = ccsds_command->ccsds_header->packetId1; | |
582 | tab[1] = ccsds_command->ccsds_header->packetId0; |
|
235 | tab[1] = ccsds_command->ccsds_header->packetId0; | |
583 | tab[2] = ccsds_command->ccsds_header->packetSequenceControl1; |
|
236 | tab[2] = ccsds_command->ccsds_header->packetSequenceControl1; | |
584 | tab[3] = ccsds_command->ccsds_header->packetSequenceControl0; |
|
237 | tab[3] = ccsds_command->ccsds_header->packetSequenceControl0; | |
585 | tab[4] = ccsds_command->ccsds_header->packetLength1; |
|
238 | tab[4] = ccsds_command->ccsds_header->packetLength1; | |
586 | tab[5] = ccsds_command->ccsds_header->packetLength0; |
|
239 | tab[5] = ccsds_command->ccsds_header->packetLength0; | |
587 | tab[6] = ccsds_command->ccsds_header->dataFieldHeader3; |
|
240 | tab[6] = ccsds_command->ccsds_header->dataFieldHeader3; | |
588 | tab[7] = ccsds_command->ccsds_header->dataFieldHeader2; |
|
241 | tab[7] = ccsds_command->ccsds_header->dataFieldHeader2; | |
589 | tab[8] = ccsds_command->ccsds_header->dataFieldHeader1; |
|
242 | tab[8] = ccsds_command->ccsds_header->dataFieldHeader1; | |
590 | tab[9] = ccsds_command->ccsds_header->dataFieldHeader0; |
|
243 | tab[9] = ccsds_command->ccsds_header->dataFieldHeader0; | |
591 | tab[10] = (unsigned char) (time_COARSE>>24); |
|
244 | tab[10] = (unsigned char) (time_COARSE>>24); | |
592 | tab[11] = (unsigned char) (time_COARSE>>18); |
|
245 | tab[11] = (unsigned char) (time_COARSE>>18); | |
593 | tab[12] = (unsigned char) (time_COARSE>>8); |
|
246 | tab[12] = (unsigned char) (time_COARSE>>8); | |
594 | tab[13] = (unsigned char) (time_COARSE); |
|
247 | tab[13] = (unsigned char) (time_COARSE); | |
595 | tab[14] = (unsigned char) (time_FINE>>8); |
|
248 | tab[14] = (unsigned char) (time_FINE>>8); | |
596 | tab[15] = (unsigned char) (time_FINE); |
|
249 | tab[15] = (unsigned char) (time_FINE); | |
597 | tab[nbBYTES_application_data+10] = packetErrorControl1; |
|
250 | tab[nbBYTES_application_data+10] = packetErrorControl1; | |
598 | tab[nbBYTES_application_data+11] = packetErrorControl0; |
|
251 | tab[nbBYTES_application_data+11] = packetErrorControl0; | |
599 |
|
252 | |||
600 | WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00); |
|
253 | WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00); | |
601 |
|
254 | |||
602 | time_COARSE = time_COARSE+1; |
|
255 | time_COARSE = time_COARSE+1; | |
603 |
|
256 | |||
604 | free(tab); |
|
257 | free(tab); | |
605 | } |
|
258 | } | |
606 |
|
259 | |||
607 | void rmapplugin::reset_TC_LFR_UPDATE_TIME() |
|
260 | void rmapplugin::reset_TC_LFR_UPDATE_TIME() | |
608 | { |
|
261 | { | |
609 | time_COARSE = 0; |
|
262 | time_COARSE = 0; | |
610 | time_FINE = 0; |
|
263 | time_FINE = 0; | |
611 | } |
|
264 | } | |
612 |
|
265 | |||
613 | void rmapplugin::openBridge() |
|
|||
614 | { |
|
|||
615 | switch(currentBridge) |
|
|||
616 | { |
|
|||
617 | case selectedBridgeIsGRESB : |
|
|||
618 | RMAP_CONNECT(); |
|
|||
619 | break; |
|
|||
620 | case selectedBridgeIsStarDundee : |
|
|||
621 | this->UI->starDundee->Open(); |
|
|||
622 | break; |
|
|||
623 | default: |
|
|||
624 | break; |
|
|||
625 | } |
|
|||
626 | } |
|
|||
627 |
|
||||
628 | void rmapplugin::closeBridge() |
|
|||
629 | { |
|
|||
630 | switch(currentBridge) |
|
|||
631 | { |
|
|||
632 | case selectedBridgeIsGRESB : |
|
|||
633 | RMAP_DISCONNECT(); |
|
|||
634 | break; |
|
|||
635 | case selectedBridgeIsStarDundee : |
|
|||
636 | this->UI->starDundee->Close(); |
|
|||
637 | break; |
|
|||
638 | default: |
|
|||
639 | break; |
|
|||
640 | } |
|
|||
641 | } |
|
|||
642 |
|
||||
643 | void rmapplugin::RMAP_CONNECT() // SLOT |
|
|||
644 | { |
|
|||
645 | bool spwRunning = true; |
|
|||
646 | RMAPSend_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()), |
|
|||
647 | 3000 + UI->gresbVirtualLinkSpinBox->value()*2, |
|
|||
648 | QIODevice::WriteOnly); |
|
|||
649 | RMAPReceive_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()), |
|
|||
650 | 3000 + UI->gresbVirtualLinkSpinBox->value()*2+1, |
|
|||
651 | QIODevice::ReadOnly); |
|
|||
652 | GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()), |
|
|||
653 | 3010, |
|
|||
654 | QIODevice::ReadWrite); |
|
|||
655 | GRESBStatusQuery_SOCKET->waitForConnected(10000); |
|
|||
656 | RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket |
|
|||
657 | // initialize SPW packet semaphores |
|
|||
658 | while (spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->acquire(); |
|
|||
659 | while (spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->acquire(); |
|
|||
660 | if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) != 0) |
|
|||
661 | { |
|
|||
662 | spwRunning = UI->gresbStatusQueryDialog->exec(); |
|
|||
663 | } |
|
|||
664 | if (spwRunning == false) RMAP_DISCONNECT(); |
|
|||
665 | else |
|
|||
666 | { |
|
|||
667 | APPENDTOLOG(QString("SpaceWire running on virtual link ")+ QString::number(UI->spwLinkSpinBox->value())); |
|
|||
668 | emit this->activateSig(true); |
|
|||
669 | emit gresbIsOpen(true); |
|
|||
670 | } |
|
|||
671 | } |
|
|||
672 |
|
||||
673 | void rmapplugin::RMAP_DISCONNECT() // SLOT |
|
|||
674 | { |
|
|||
675 | RMAPSend_SOCKET->disconnectFromHost(); |
|
|||
676 | RMAPReceive_SOCKET->disconnectFromHost(); |
|
|||
677 | GRESBStatusQuery_SOCKET->disconnectFromHost(); |
|
|||
678 | emit this->activateSig(false); |
|
|||
679 | emit gresbIsOpen(false); |
|
|||
680 | } |
|
|||
681 |
|
||||
682 | void rmapplugin::RMAPSendConnectionState(QAbstractSocket::SocketState socketState) // SLOT |
|
|||
683 | { |
|
|||
684 | UI->rmapSendStateLabel->setText(""); |
|
|||
685 | QString socketMessage = "RMAP Send Socket State: "; |
|
|||
686 | switch(socketState) |
|
|||
687 | { |
|
|||
688 | case QAbstractSocket::UnconnectedState : |
|
|||
689 | socketMessage.append("0 => Unconnected"); |
|
|||
690 | UI->rmapOpenCommunicationButton->setEnabled(true); |
|
|||
691 | UI->rmapCloseCommunicationButton->setEnabled(false); |
|
|||
692 | emit this->activateSig(false); |
|
|||
693 | break; |
|
|||
694 | case 1: |
|
|||
695 | socketMessage.append("1 => HostLookup"); |
|
|||
696 | break; |
|
|||
697 | case 2: |
|
|||
698 | socketMessage.append("2 => Connecting"); |
|
|||
699 | break; |
|
|||
700 | case 3: |
|
|||
701 | socketMessage.append("3 => Connected"); |
|
|||
702 | UI->rmapOpenCommunicationButton->setEnabled(false); |
|
|||
703 | UI->rmapCloseCommunicationButton->setEnabled(true); |
|
|||
704 | break; |
|
|||
705 | case 4: |
|
|||
706 | socketMessage.append("4 => Bound"); |
|
|||
707 | break; |
|
|||
708 | case 5: |
|
|||
709 | socketMessage.append("5 => Closing"); |
|
|||
710 | break; |
|
|||
711 | case 6: |
|
|||
712 | socketMessage.append("6 => Listening"); |
|
|||
713 | break; |
|
|||
714 | } |
|
|||
715 | UI->rmapSendStateLabel->setText(socketMessage); |
|
|||
716 | APPENDTOLOG(socketMessage); |
|
|||
717 | } |
|
|||
718 |
|
||||
719 | void rmapplugin::RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState) // SLOT |
|
|||
720 | { |
|
|||
721 | UI->rmapReceiveStateLabel->setText(""); |
|
|||
722 | QString socketMessage = "RMAP Receive Socket State: "; |
|
|||
723 | switch(socketState) |
|
|||
724 | { |
|
|||
725 | case QAbstractSocket::UnconnectedState : |
|
|||
726 | socketMessage.append("0 => Unconnected"); |
|
|||
727 | break; |
|
|||
728 | case 1: |
|
|||
729 | socketMessage.append("1 => HostLookup"); |
|
|||
730 | break; |
|
|||
731 | case 2: |
|
|||
732 | socketMessage.append("2 => Connecting"); |
|
|||
733 | break; |
|
|||
734 | case 3: |
|
|||
735 | socketMessage.append("3 => Connected"); |
|
|||
736 | break; |
|
|||
737 | case 4: |
|
|||
738 | socketMessage.append("4 => Bound"); |
|
|||
739 | break; |
|
|||
740 | case 5: |
|
|||
741 | socketMessage.append("5 => Closing"); |
|
|||
742 | break; |
|
|||
743 | case 6: |
|
|||
744 | socketMessage.append("6 => Listening"); |
|
|||
745 | break; |
|
|||
746 | } |
|
|||
747 | UI->rmapReceiveStateLabel->setText(socketMessage); |
|
|||
748 | APPENDTOLOG(socketMessage); |
|
|||
749 | } |
|
|||
750 |
|
||||
751 | void rmapplugin::GRESBConnectionState(QAbstractSocket::SocketState socketState) // SLOT |
|
|||
752 | { |
|
|||
753 | UI->gresbStatusQueryLabel->setText(""); |
|
|||
754 | QString socketMessage = "GRESB status query socket (port 3010): "; |
|
|||
755 | switch(socketState) |
|
|||
756 | { |
|
|||
757 | case QAbstractSocket::UnconnectedState : |
|
|||
758 | socketMessage.append("0 => Unconnected"); |
|
|||
759 | break; |
|
|||
760 | case 1: |
|
|||
761 | socketMessage.append("1 => HostLookup"); |
|
|||
762 | break; |
|
|||
763 | case 2: |
|
|||
764 | socketMessage.append("2 => Connecting"); |
|
|||
765 | break; |
|
|||
766 | case 3: |
|
|||
767 | socketMessage.append("3 => Connected"); |
|
|||
768 | break; |
|
|||
769 | case 4: |
|
|||
770 | socketMessage.append("4 => Bound"); |
|
|||
771 | break; |
|
|||
772 | case 5: |
|
|||
773 | socketMessage.append("5 => Closing"); |
|
|||
774 | break; |
|
|||
775 | case 6: |
|
|||
776 | socketMessage.append("6 => Listening"); |
|
|||
777 | break; |
|
|||
778 | } |
|
|||
779 | UI->gresbStatusQueryLabel->setText(socketMessage); |
|
|||
780 | } |
|
|||
781 |
|
||||
782 | void rmapplugin::reTestSPWLink() // SLOT |
|
|||
783 | { |
|
|||
784 | if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 0) |
|
|||
785 | { |
|
|||
786 | UI->gresbStatusQueryDialog->accept(); |
|
|||
787 | } |
|
|||
788 | } |
|
|||
789 |
|
||||
790 | int rmapplugin::GRESBStatusQuery() // SLOT |
|
|||
791 | { |
|
|||
792 | GRESBStatusQueryRequest(LinkStatus, 0); |
|
|||
793 | GRESBStatusQueryRequest(LinkStatus, 1); |
|
|||
794 | GRESBStatusQueryRequest(LinkStatus, 2); |
|
|||
795 | GRESBStatusQueryRequest(LinkStatistics, 0); |
|
|||
796 | GRESBStatusQueryRequest(LinkStatistics, 1); |
|
|||
797 | GRESBStatusQueryRequest(LinkStatistics, 2); |
|
|||
798 | return 0; |
|
|||
799 | } |
|
|||
800 |
|
||||
801 | void rmapplugin::RMAP_write_reply_setText(QString text) |
|
266 | void rmapplugin::RMAP_write_reply_setText(QString text) | |
802 | { |
|
267 | { | |
803 | this->UI->RMAP_write_reply->setText(text); |
|
268 | this->UI->RMAP_write_reply->setText(text); | |
804 | } |
|
269 | } | |
805 |
|
270 | |||
806 | void rmapplugin::appendToLog(QString text) |
|
271 | void rmapplugin::appendToLog(QString text) | |
807 | { |
|
272 | { | |
808 | APPENDTOLOG(text); |
|
273 | APPENDTOLOG(text); | |
809 | } |
|
274 | } | |
810 |
|
275 | |||
811 | ///////////////////// |
|
276 | ///////////////////// | |
812 | // INTERNAL FUNCTIONS |
|
277 | // INTERNAL FUNCTIONS | |
813 |
|
278 | |||
814 | int rmapplugin::GRESBStatusQueryRequest(GresbStatusQueryOption option, char link) |
|
|||
815 | { |
|
|||
816 | gresb_status_query_t statusQueryCommand; |
|
|||
817 | gresb_link_status_reply_t linkStatusReply; |
|
|||
818 | gresb_link_statistics_reply_t linkStatisticsReply; |
|
|||
819 | QTime statusQueryTimeout; |
|
|||
820 | QString console_message; |
|
|||
821 |
|
||||
822 | statusQueryCommand.protocolIdentifier = (char) 0x02; |
|
|||
823 | statusQueryCommand.reserved1 = (char) 0x00; |
|
|||
824 | statusQueryCommand.reserved0 = (char) 0x00; |
|
|||
825 | statusQueryCommand.option = (char) option; |
|
|||
826 | statusQueryCommand.value3 = (char) 0x00; |
|
|||
827 | statusQueryCommand.value2 = (char) 0x00; |
|
|||
828 | statusQueryCommand.value1 = (char) 0x00; |
|
|||
829 | statusQueryCommand.value0 = (char) link; |
|
|||
830 |
|
||||
831 | GRESBStatusQuery_SOCKET->write((char*) ((void*) &statusQueryCommand), sizeof(statusQueryCommand)); |
|
|||
832 | GRESBStatusQuery_SOCKET->flush(); |
|
|||
833 | GRESBStatusQuery_SOCKET->waitForBytesWritten(1000); |
|
|||
834 |
|
||||
835 | statusQueryTimeout.start(); |
|
|||
836 | while(GRESBStatusQuery_SOCKET->bytesToWrite() > 0) |
|
|||
837 | { |
|
|||
838 | GRESBStatusQuery_SOCKET->waitForBytesWritten(100); |
|
|||
839 | if(statusQueryTimeout.elapsed()>1000) |
|
|||
840 | { |
|
|||
841 | APPENDTOLOG("WARNING === in function GRESBStatusQueryRequest of rmapplugin *** sending StatusQueryCommand timeout"); |
|
|||
842 | return 1; |
|
|||
843 | } |
|
|||
844 | } |
|
|||
845 |
|
||||
846 | switch (option) |
|
|||
847 | { |
|
|||
848 | case LinkStatus: |
|
|||
849 | { |
|
|||
850 | statusQueryTimeout.start(); |
|
|||
851 | while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatusReply)) |
|
|||
852 | { |
|
|||
853 | GRESBStatusQuery_SOCKET->waitForReadyRead(100); |
|
|||
854 | if(statusQueryTimeout.elapsed()>1000) |
|
|||
855 | { |
|
|||
856 | console_message.sprintf("GRESBStatusQueryRequest / LinkStatus => error timeout bytesAvailable()\n"); |
|
|||
857 | APPENDTOLOG(console_message); |
|
|||
858 | return 1; |
|
|||
859 | } |
|
|||
860 | } |
|
|||
861 | GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatusReply), (int) sizeof(linkStatusReply)); |
|
|||
862 | console_message.sprintf("%x", linkStatusReply.byte0); |
|
|||
863 | UI->spwLinkStatusEnquiry->statusQueryTable->item(0, link)->setText(console_message); |
|
|||
864 | console_message.sprintf("%d", linkStatusReply.byte1); |
|
|||
865 | UI->spwLinkStatusEnquiry->statusQueryTable->item(1, link)->setText(console_message); |
|
|||
866 | if (linkStatusReply.byte0 == 0) return 1; |
|
|||
867 | break; |
|
|||
868 | } |
|
|||
869 | case LinkStatistics: |
|
|||
870 | { |
|
|||
871 | statusQueryTimeout.start(); |
|
|||
872 | while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatisticsReply)) |
|
|||
873 | { |
|
|||
874 | GRESBStatusQuery_SOCKET->waitForReadyRead(100); |
|
|||
875 | if(statusQueryTimeout.elapsed()>1000) |
|
|||
876 | { |
|
|||
877 | console_message.sprintf("GRESBStatusQueryRequest / LinkStatistics => error timeout bytesAvailable()\n"); |
|
|||
878 | APPENDTOLOG(console_message); |
|
|||
879 | return 1; |
|
|||
880 | } |
|
|||
881 | } |
|
|||
882 | GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatisticsReply), sizeof(linkStatisticsReply)); |
|
|||
883 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataTransmitted)); |
|
|||
884 | UI->spwLinkStatusEnquiry->statusQueryTable->item(9, link)->setText(console_message); |
|
|||
885 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsTransmitted)); |
|
|||
886 | UI->spwLinkStatusEnquiry->statusQueryTable->item(8, link)->setText(console_message); |
|
|||
887 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfTruncatedPacketsReceived)); |
|
|||
888 | UI->spwLinkStatusEnquiry->statusQueryTable->item(6, link)->setText(console_message); |
|
|||
889 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsWithEEPReceived)); |
|
|||
890 | UI->spwLinkStatusEnquiry->statusQueryTable->item(5, link)->setText(console_message); |
|
|||
891 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataReceived)); |
|
|||
892 | UI->spwLinkStatusEnquiry->statusQueryTable->item(4, link)->setText(console_message); |
|
|||
893 | console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsReceived)); |
|
|||
894 | UI->spwLinkStatusEnquiry->statusQueryTable->item(3, link)->setText(console_message); |
|
|||
895 | break; |
|
|||
896 | } |
|
|||
897 | case NodeAddressStatistics: |
|
|||
898 | { |
|
|||
899 | break; |
|
|||
900 | } |
|
|||
901 | case GetRoute: |
|
|||
902 | { |
|
|||
903 | break; |
|
|||
904 | } |
|
|||
905 | } |
|
|||
906 | return 0; |
|
|||
907 | } |
|
|||
908 |
|
||||
909 | int rmapplugin::charTab_TO_int(char *charTab) |
|
|||
910 | { |
|
|||
911 | int result = 0; |
|
|||
912 | result = (charTab[0]<<24) +(charTab[1]<<16) +(charTab[2]<<8) + charTab[3]; |
|
|||
913 | return result; |
|
|||
914 | } |
|
|||
915 |
|
||||
916 | void rmapplugin::gresbSelection(bool flag) |
|
279 | void rmapplugin::gresbSelection(bool flag) | |
917 | { |
|
280 | { | |
918 | if (flag == true) UI->selection_GROUPBOX->setEnabled(false); |
|
281 | if (flag == true) UI->selection_GROUPBOX->setEnabled(false); | |
919 | if (flag == false) UI->selection_GROUPBOX->setEnabled(true); |
|
282 | if (flag == false) UI->selection_GROUPBOX->setEnabled(true); | |
920 | } |
|
283 | } | |
921 |
|
284 | |||
922 |
|
285 | |||
923 |
|
286 |
@@ -1,108 +1,89 | |||||
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); |
|
|||
54 | int charTab_TO_int(char *charTab); |
|
|||
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); |
|
|||
57 | unsigned int WriteSPWGRESB(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); |
|
|||
58 |
|
53 | |||
59 | public slots: |
|
54 | public slots: | |
60 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
55 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); | |
61 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
56 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); | |
|
57 | unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); | |||
|
58 | void openBridge(); | |||
|
59 | void closeBridge(); | |||
62 | // |
|
60 | // | |
63 | unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); |
|
|||
64 | void sendCCSDS(); |
|
61 | void sendCCSDS(); | |
65 | void send_TC_LFR_UPDATE_TIME(); |
|
62 | void send_TC_LFR_UPDATE_TIME(); | |
66 | void reset_TC_LFR_UPDATE_TIME(); |
|
63 | void reset_TC_LFR_UPDATE_TIME(); | |
67 | int GRESBStatusQuery(); |
|
|||
68 | void displayOnConsole(QString message) {this->UI->console->append(message);} |
|
64 | void displayOnConsole(QString message) {this->UI->console->append(message);} | |
69 | // |
|
65 | // | |
70 | void RMAP_CONNECT(); |
|
|||
71 | void RMAP_DISCONNECT(); |
|
|||
72 | void openBridge(); |
|
|||
73 | void closeBridge(); |
|
|||
74 | int RMAPSendReadCommand(); |
|
|||
75 | int RMAPSendWriteCommand(); |
|
|||
76 | void reTestSPWLink(); |
|
|||
77 | // |
|
|||
78 | void RMAPSendConnectionState(QAbstractSocket::SocketState socketState); |
|
|||
79 | void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState); |
|
|||
80 | void GRESBConnectionState(QAbstractSocket::SocketState socketState); |
|
|||
81 | // |
|
|||
82 | void gresbSelection(bool flag); |
|
66 | void gresbSelection(bool flag); | |
83 | void activatePluginViaStarDundee(bool flag) {emit activateSig(flag);} |
|
|||
84 | void RMAP_write_reply_setText(QString text); |
|
67 | void RMAP_write_reply_setText(QString text); | |
85 | void appendToLog(QString text); |
|
68 | void appendToLog(QString text); | |
|
69 | // | |||
|
70 | void activatePlugin(bool flag) {emit activateSig(flag);} | |||
86 | void bridgeHasChanged(selectedBridge bridge) {currentBridge = bridge;} |
|
71 | void bridgeHasChanged(selectedBridge bridge) {currentBridge = bridge;} | |
87 |
|
72 | |||
88 | signals: |
|
73 | signals: | |
89 | void ccsdsPacketReadyRead(char *ccsdsPacket, unsigned int size); |
|
|||
90 | void gresbIsOpen(bool); |
|
|||
91 |
|
74 | |||
92 | private: |
|
75 | private: | |
93 | selectedBridge currentBridge; |
|
76 | selectedBridge currentBridge; | |
94 | rmapPluginUI* UI; |
|
77 | rmapPluginUI* UI; | |
95 | QTcpSocket* GRESBStatusQuery_SOCKET; |
|
78 | QTcpSocket* GRESBStatusQuery_SOCKET; | |
96 | QTcpSocket* RMAPSend_SOCKET; |
|
79 | QTcpSocket* RMAPSend_SOCKET; | |
97 | QTcpSocket* RMAPReceive_SOCKET; |
|
80 | QTcpSocket* RMAPReceive_SOCKET; | |
98 | ccsds* ccsds_command; |
|
81 | ccsds* ccsds_command; | |
99 | unsigned int rmapPacketSize; |
|
82 | unsigned int rmapPacketSize; | |
100 | unsigned int time_COARSE; |
|
83 | unsigned int time_COARSE; | |
101 | unsigned int time_FINE; |
|
84 | unsigned int time_FINE; | |
102 | spwpacketreceiver* spwPacketReceiverOBJECT; |
|
85 | spwpacketreceiver* spwPacketReceiverOBJECT; | |
103 | unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0); |
|
|||
104 | unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0); |
|
|||
105 | char timeCode; |
|
86 | char timeCode; | |
106 | }; |
|
87 | }; | |
107 |
|
88 | |||
108 | #endif // DRIVER1_H |
|
89 | #endif // DRIVER1_H |
@@ -1,310 +1,293 | |||||
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; |
|
|||
35 | bridgeWidget = new QWidget; |
|
34 | bridgeWidget = new QWidget; | |
36 | mainLayout = new QVBoxLayout; |
|
35 | mainLayout = new QVBoxLayout; | |
37 | connectionLayout = new QGridLayout; |
|
36 | connectionLayout = new QGridLayout; | |
38 | ccsdsLayout = new QVBoxLayout; |
|
37 | ccsdsLayout = new QVBoxLayout; | |
39 | consoleLayout = new QVBoxLayout; |
|
38 | consoleLayout = new QVBoxLayout; | |
40 | selectionLayout = new QVBoxLayout; |
|
39 | selectionLayout = new QVBoxLayout; | |
41 | bridgeSelection_LAYOUT = new QGridLayout; |
|
40 | bridgeSelection_LAYOUT = new QGridLayout; | |
42 | generalParameters_LAYOUT = new QGridLayout; |
|
41 | generalParameters_LAYOUT = new QGridLayout; | |
43 |
|
42 | |||
44 | gresb_GROUPBOX = new QGroupBox(tr("GRESB bridge parameters")); |
|
43 | gresb_GROUPBOX = new QGroupBox(tr("GRESB bridge parameters")); | |
45 | stardundee_GROUPBOX = new QGroupBox(tr("Star Dundee brick parameters")); |
|
44 | stardundee_GROUPBOX = new QGroupBox(tr("Star Dundee brick parameters")); | |
46 | selection_GROUPBOX = new QGroupBox(tr("Bridge selection")); |
|
45 | selection_GROUPBOX = new QGroupBox(tr("Bridge selection")); | |
47 | generalParameters_GROUPBOX = new QGroupBox(tr("General parameters")); |
|
46 | generalParameters_GROUPBOX = new QGroupBox(tr("General parameters")); | |
48 |
|
47 | |||
49 | //*** QLABEL ***// |
|
48 | //*** QLABEL ***// | |
50 | gresbBridgeIPLabel = new QLabel(tr("Bridge IP: ")); |
|
49 | gresbBridgeIPLabel = new QLabel(tr("Bridge IP: ")); | |
51 | gresbVirtualLinkLabel = new QLabel(tr("Virtual Link: ")); |
|
50 | gresbVirtualLinkLabel = new QLabel(tr("Virtual Link: ")); | |
52 | spwLinkLabel = new QLabel(tr("SPW Link: ")); |
|
51 | spwLinkLabel = new QLabel(tr("SPW Link: ")); | |
53 | rmapSourceLogicalAddressLabel = new QLabel(tr("RMAP Source Logical Address: ")); |
|
52 | rmapSourceLogicalAddressLabel = new QLabel(tr("RMAP Source Logical Address: ")); | |
54 | rmapTargetLogicalAddressLabel = new QLabel(tr("RMAP Target Logical Address: ")); |
|
53 | rmapTargetLogicalAddressLabel = new QLabel(tr("RMAP Target Logical Address: ")); | |
55 | rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection")); |
|
|||
56 | rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection")); |
|
|||
57 | logFileName = new QLabel; |
|
54 | logFileName = new QLabel; | |
58 | gresbStatusQueryLabel = new QLabel(tr("Status query socket (port 3010): waiting for connection")); |
|
55 | gresbStatusQueryLabel = new QLabel(tr("Status query socket (port 3010): waiting for connection")); | |
59 | gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running")); |
|
56 | gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running")); | |
60 | sendCCSDSCommandLabel = new QLabel(tr("Address of the target")); |
|
57 | sendCCSDSCommandLabel = new QLabel(tr("Address of the target")); | |
61 |
|
58 | |||
62 | //*** QPUSHBUTTON ***// |
|
59 | //*** QPUSHBUTTON ***// | |
63 | rmapOpenCommunicationButton = new QPushButton(tr("Open selected bridge")); |
|
60 | rmapOpenCommunicationButton = new QPushButton(tr("Open selected bridge")); | |
64 | rmapCloseCommunicationButton = new QPushButton(tr("Close selected bridge")); |
|
61 | rmapCloseCommunicationButton = new QPushButton(tr("Close selected bridge")); | |
65 | rmapOpenCommunicationButton->setEnabled(false); |
|
62 | rmapOpenCommunicationButton->setEnabled(false); | |
66 | rmapCloseCommunicationButton->setEnabled(false); |
|
63 | rmapCloseCommunicationButton->setEnabled(false); | |
67 | logFileChooseButton = new QPushButton(tr("Choose file")); |
|
64 | logFileChooseButton = new QPushButton(tr("Choose file")); | |
68 | gresbStatusQueryRetryButton = new QPushButton(tr("Retry")); |
|
65 | gresbStatusQueryRetryButton = new QPushButton(tr("Retry")); | |
69 | gresbStatusQueryAbortButton = new QPushButton(tr("Abort")); |
|
66 | gresbStatusQueryAbortButton = new QPushButton(tr("Abort")); | |
70 | sendCCSDSCommandButton = new QPushButton(tr("Send CCSDS Command")); |
|
67 | sendCCSDSCommandButton = new QPushButton(tr("Send CCSDS Command")); | |
71 | send_TC_LFR_UPDATE_TIME_Button = new QPushButton(tr("Send TC_LFR_UPDATE_TIME Packet")); |
|
68 | 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")); |
|
69 | 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")); |
|
70 | clearConsoleButton = new QPushButton(tr("Clear")); | |
74 |
|
71 | |||
75 | selectGRESB_BUTTON = new QRadioButton(tr("GRESB")); |
|
72 | selectGRESB_BUTTON = new QRadioButton(tr("GRESB")); | |
76 | selectStarDundee_BUTTON = new QRadioButton(tr("Star Dundee")); |
|
73 | selectStarDundee_BUTTON = new QRadioButton(tr("Star Dundee")); | |
77 |
|
74 | |||
78 | //*** SPINBOX ***// |
|
75 | //*** SPINBOX ***// | |
79 | gresbVirtualLinkSpinBox = new QSpinBox; |
|
76 | gresbVirtualLinkSpinBox = new QSpinBox; | |
80 | rmapSourceLogicalAddressSpinBox = new QSpinBox; |
|
77 | rmapSourceLogicalAddressSpinBox = new QSpinBox; | |
81 | rmapTargetLogicalAddressSpinBox = new QSpinBox; |
|
78 | rmapTargetLogicalAddressSpinBox = new QSpinBox; | |
82 | spwLinkSpinBox = new QSpinBox;; |
|
79 | spwLinkSpinBox = new QSpinBox;; | |
83 | CCSDSTargetLogicalAddressSpinBox = new QSpinBox; |
|
80 | CCSDSTargetLogicalAddressSpinBox = new QSpinBox; | |
84 | gresbVirtualLinkSpinBox->setRange(0, 4); |
|
81 | gresbVirtualLinkSpinBox->setRange(0, 4); | |
85 | gresbVirtualLinkSpinBox->setValue(1); |
|
82 | gresbVirtualLinkSpinBox->setValue(1); | |
86 | rmapSourceLogicalAddressSpinBox->setRange(0, 255); |
|
83 | rmapSourceLogicalAddressSpinBox->setRange(0, 255); | |
87 | rmapSourceLogicalAddressSpinBox->setValue(33); |
|
84 | rmapSourceLogicalAddressSpinBox->setValue(33); | |
88 | rmapTargetLogicalAddressSpinBox->setRange(0, 255); |
|
85 | rmapTargetLogicalAddressSpinBox->setRange(0, 255); | |
89 | spwLinkSpinBox->setRange(0, 2); |
|
86 | spwLinkSpinBox->setRange(0, 2); | |
90 | spwLinkSpinBox->setValue(0); |
|
87 | spwLinkSpinBox->setValue(0); | |
91 | CCSDSTargetLogicalAddressSpinBox->setRange(0,255); |
|
88 | CCSDSTargetLogicalAddressSpinBox->setRange(0,255); | |
92 | CCSDSTargetLogicalAddressSpinBox->setValue(254); |
|
89 | CCSDSTargetLogicalAddressSpinBox->setValue(254); | |
93 |
|
90 | |||
94 | //*** MISC **// |
|
91 | //*** MISC **// | |
95 | starDundee = new StarDundee; |
|
92 | starDundee = new StarDundee; | |
96 | gresbBridge = new gresb; |
|
93 | gresbBridge = new gresb; | |
97 | console = new QTextEdit; |
|
94 | console = new QTextEdit; | |
98 | gresbBridgeIPDialogBox = new QIPDialogBox; |
|
95 | gresbBridgeIPDialogBox = new QIPDialogBox; | |
99 | gresbStatusQueryDialog = new QDialog; |
|
96 | gresbStatusQueryDialog = new QDialog; | |
100 | logEnableCheckBox = new QCheckBox(tr("Enable Logs")); |
|
97 | logEnableCheckBox = new QCheckBox(tr("Enable Logs")); | |
101 | RMAP_write_verify = new QCheckBox(tr("data checked before write\nlimited to 4 bytes\nNOT IMPLEMENTED")); |
|
98 | RMAP_write_verify = new QCheckBox(tr("data checked before write\nlimited to 4 bytes\nNOT IMPLEMENTED")); | |
102 | RMAP_write_reply = new QCheckBox(tr("reply to the write command required\nlast reply status: unavailable")); |
|
99 | RMAP_write_reply = new QCheckBox(tr("reply to the write command required\nlast reply status: unavailable")); | |
103 | spwLinkStatusEnquiry = new gresbStatusEnquiry; |
|
100 | spwLinkStatusEnquiry = new gresbStatusEnquiry; | |
104 | logFile = new QFile(); |
|
101 | logFile = new QFile(); | |
105 |
|
102 | |||
106 | logFileEn = false; |
|
103 | logFileEn = false; | |
107 |
|
104 | |||
108 | connectionLayout->addWidget(gresbBridgeIPLabel, 0, 0, 0); |
|
|||
109 | connectionLayout->addWidget(gresbBridgeIPDialogBox, 0, 1, 0); |
|
|||
110 | connectionLayout->addWidget(gresbVirtualLinkLabel, 1, 0, 0); |
|
|||
111 | connectionLayout->addWidget(gresbVirtualLinkSpinBox, 1, 1, 0); |
|
|||
112 | connectionLayout->addWidget(spwLinkLabel, 2, 0, 0); |
|
|||
113 | connectionLayout->addWidget(spwLinkSpinBox, 2, 1, 0); |
|
|||
114 | connectionLayout->addWidget(rmapSourceLogicalAddressLabel, 3, 0, 0); |
|
|||
115 | connectionLayout->addWidget(rmapSourceLogicalAddressSpinBox, 3, 1, 0); |
|
|||
116 | connectionLayout->addWidget(rmapSendStateLabel, 4, 0, 1, 2); |
|
|||
117 | connectionLayout->addWidget(rmapReceiveStateLabel, 5, 0, 1, 2); |
|
|||
118 | connectionLayout->addWidget(gresbStatusQueryLabel, 6, 0, 1, 2); |
|
|||
119 |
|
||||
120 | connectionLayout->setRowStretch(7, 1); |
|
105 | connectionLayout->setRowStretch(7, 1); | |
121 | connectionLayout->setColumnStretch(2, 1); |
|
106 | connectionLayout->setColumnStretch(2, 1); | |
122 |
|
107 | |||
123 | bridgeSelection_LAYOUT->addWidget(selectGRESB_BUTTON, 0, 0, 1, 1); |
|
108 | bridgeSelection_LAYOUT->addWidget(selectGRESB_BUTTON, 0, 0, 1, 1); | |
124 | bridgeSelection_LAYOUT->addWidget(selectStarDundee_BUTTON, 0, 1, 1, 1); |
|
109 | bridgeSelection_LAYOUT->addWidget(selectStarDundee_BUTTON, 0, 1, 1, 1); | |
125 | bridgeSelection_LAYOUT->setRowStretch(1, 1); |
|
110 | bridgeSelection_LAYOUT->setRowStretch(1, 1); | |
126 | bridgeSelection_LAYOUT->setColumnStretch(2, 1); |
|
111 | bridgeSelection_LAYOUT->setColumnStretch(2, 1); | |
127 |
|
112 | |||
128 | generalParameters_LAYOUT->addWidget(logEnableCheckBox, 0, 0, 1, 1); |
|
113 | generalParameters_LAYOUT->addWidget(logEnableCheckBox, 0, 0, 1, 1); | |
129 | generalParameters_LAYOUT->addWidget(logFileChooseButton, 0, 1, 1, 1); |
|
114 | generalParameters_LAYOUT->addWidget(logFileChooseButton, 0, 1, 1, 1); | |
130 | generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressLabel, 1, 0, 0); |
|
115 | generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressLabel, 1, 0, 0); | |
131 | generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressSpinBox, 1, 1, 0); |
|
116 | generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressSpinBox, 1, 1, 0); | |
132 | generalParameters_LAYOUT->addWidget(rmapOpenCommunicationButton, 2, 0, 1, 1); |
|
117 | generalParameters_LAYOUT->addWidget(rmapOpenCommunicationButton, 2, 0, 1, 1); | |
133 | generalParameters_LAYOUT->addWidget(rmapCloseCommunicationButton, 2, 1, 1, 1); |
|
118 | generalParameters_LAYOUT->addWidget(rmapCloseCommunicationButton, 2, 1, 1, 1); | |
134 | generalParameters_LAYOUT->addWidget(RMAP_write_verify, 3, 0, 1, 2); |
|
119 | generalParameters_LAYOUT->addWidget(RMAP_write_verify, 3, 0, 1, 2); | |
135 | generalParameters_LAYOUT->addWidget(RMAP_write_reply, 4, 0, 1, 2); |
|
120 | generalParameters_LAYOUT->addWidget(RMAP_write_reply, 4, 0, 1, 2); | |
136 | generalParameters_LAYOUT->setRowStretch(5, 1); |
|
121 | generalParameters_LAYOUT->setRowStretch(5, 1); | |
137 | generalParameters_LAYOUT->setColumnStretch(2, 1); |
|
122 | generalParameters_LAYOUT->setColumnStretch(2, 1); | |
138 |
|
123 | |||
139 |
gresb_GROUPBOX->setLayout( |
|
124 | gresb_GROUPBOX->setLayout(gresbBridge->layout()); | |
140 | //gresb_GROUPBOX->setLayout(gresbBridge->layout()); |
|
|||
141 | gresb_GROUPBOX->setVisible(false); |
|
125 | gresb_GROUPBOX->setVisible(false); | |
142 | stardundee_GROUPBOX->setLayout(starDundee->layout()); |
|
126 | stardundee_GROUPBOX->setLayout(starDundee->layout()); | |
143 | stardundee_GROUPBOX->setVisible(false); |
|
127 | stardundee_GROUPBOX->setVisible(false); | |
144 | selection_GROUPBOX->setLayout(bridgeSelection_LAYOUT); |
|
128 | selection_GROUPBOX->setLayout(bridgeSelection_LAYOUT); | |
145 | generalParameters_GROUPBOX->setLayout(generalParameters_LAYOUT); |
|
129 | generalParameters_GROUPBOX->setLayout(generalParameters_LAYOUT); | |
146 | selectionLayout->addWidget(selection_GROUPBOX); |
|
130 | selectionLayout->addWidget(selection_GROUPBOX); | |
147 | selectionLayout->addWidget(generalParameters_GROUPBOX); |
|
131 | selectionLayout->addWidget(generalParameters_GROUPBOX); | |
148 | selectionLayout->addWidget(gresb_GROUPBOX); |
|
132 | selectionLayout->addWidget(gresb_GROUPBOX); | |
149 | selectionLayout->addWidget(stardundee_GROUPBOX); |
|
133 | selectionLayout->addWidget(stardundee_GROUPBOX); | |
150 |
|
134 | |||
151 | ccsdsLayout->addWidget(sendCCSDSCommandButton); |
|
135 | ccsdsLayout->addWidget(sendCCSDSCommandButton); | |
152 | ccsdsLayout->addWidget(send_TC_LFR_UPDATE_TIME_Button); |
|
136 | ccsdsLayout->addWidget(send_TC_LFR_UPDATE_TIME_Button); | |
153 | ccsdsLayout->addWidget(reset_TC_LFR_UPDATE_TIME_Button); |
|
137 | ccsdsLayout->addWidget(reset_TC_LFR_UPDATE_TIME_Button); | |
154 | ccsdsLayout->addWidget(sendCCSDSCommandLabel); |
|
138 | ccsdsLayout->addWidget(sendCCSDSCommandLabel); | |
155 | ccsdsLayout->addWidget(CCSDSTargetLogicalAddressSpinBox); |
|
139 | ccsdsLayout->addWidget(CCSDSTargetLogicalAddressSpinBox); | |
156 |
|
140 | |||
157 | consoleLayout->addWidget(console); |
|
141 | consoleLayout->addWidget(console); | |
158 | consoleLayout->addWidget(clearConsoleButton); |
|
142 | consoleLayout->addWidget(clearConsoleButton); | |
159 |
|
143 | |||
160 | connect(this->logFileChooseButton, SIGNAL(clicked()), this, SLOT(chooseLogFile())); |
|
144 | connect(this->logFileChooseButton, SIGNAL(clicked()), this, SLOT(chooseLogFile())); | |
161 | connect(this, SIGNAL(setLogFileName(QString)), this->logFileName, SLOT(setText(QString))); |
|
145 | connect(this, SIGNAL(setLogFileName(QString)), this->logFileName, SLOT(setText(QString))); | |
162 | connect(this->logEnableCheckBox, SIGNAL(stateChanged(int)), this, SLOT(logFileEnDisable(int))); |
|
146 | connect(this->logEnableCheckBox, SIGNAL(stateChanged(int)), this, SLOT(logFileEnDisable(int))); | |
163 |
|
147 | |||
164 | spwTabWidget->addTab(spwTabWidgetPage0, tr("connection")); |
|
148 | spwTabWidget->addTab(spwTabWidgetPage0, tr("connection")); | |
165 | spwTabWidget->addTab(spwTabWidgetPage1, tr("ccsds")); |
|
149 | spwTabWidget->addTab(spwTabWidgetPage1, tr("ccsds")); | |
166 | spwTabWidget->addTab(spwTabWidgetPage2, tr("status")); |
|
150 | spwTabWidget->addTab(spwTabWidgetPage2, tr("status")); | |
167 | spwTabWidget->addTab(spwTabWidgetPage3, tr("console")); |
|
151 | spwTabWidget->addTab(spwTabWidgetPage3, tr("console")); | |
168 | spwTabWidget->addTab(spwTabWidgetPage4, tr("DMA")); |
|
152 | spwTabWidget->addTab(spwTabWidgetPage4, tr("DMA")); | |
169 | spwTabWidget->addTab(spwTabWidgetPage5, tr("gresb")); |
|
|||
170 |
|
153 | |||
171 | spwTabWidgetPage0->setLayout(selectionLayout); |
|
154 | spwTabWidgetPage0->setLayout(selectionLayout); | |
172 | spwTabWidgetPage1->setLayout(ccsdsLayout); |
|
155 | spwTabWidgetPage1->setLayout(ccsdsLayout); | |
173 | spwTabWidgetPage2->setLayout(this->spwLinkStatusEnquiry->mainLayout); |
|
156 | spwTabWidgetPage2->setLayout(this->spwLinkStatusEnquiry->mainLayout); | |
174 | spwTabWidgetPage3->setLayout(consoleLayout); |
|
157 | spwTabWidgetPage3->setLayout(consoleLayout); | |
175 | spwTabWidgetPage4->setLayout(spectralMatricesDMASimulator->mainLayout); |
|
158 | spwTabWidgetPage4->setLayout(spectralMatricesDMASimulator->mainLayout); | |
176 | spwTabWidgetPage5->setLayout(gresbBridge->layout()); |
|
159 | ||
177 | mainLayout->addWidget(spwTabWidget); |
|
160 | mainLayout->addWidget(spwTabWidget); | |
178 | setLayout(mainLayout); |
|
161 | setLayout(mainLayout); | |
179 |
|
162 | |||
180 | // GRESB STATUS QUERY DIALOG |
|
163 | //connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject())); | |
181 | gresbStatusQueryDialogLayout = new QGridLayout; |
|
|||
182 | gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryDialogLabel, 0, 0, 1, 2); |
|
|||
183 | gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryRetryButton, 1, 0, 0); |
|
|||
184 | gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryAbortButton, 1, 1, 0); |
|
|||
185 | gresbStatusQueryDialog->setLayout(gresbStatusQueryDialogLayout); |
|
|||
186 |
|
||||
187 | connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject())); |
|
|||
188 | connect(this->clearConsoleButton, SIGNAL(clicked()), this->console, SLOT(clear())); |
|
164 | connect(this->clearConsoleButton, SIGNAL(clicked()), this->console, SLOT(clear())); | |
|
165 | // briges | |||
189 | connect(this->selectGRESB_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee())); |
|
166 | connect(this->selectGRESB_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee())); | |
190 | connect(this->selectStarDundee_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee())); |
|
167 | connect(this->selectStarDundee_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee())); | |
191 | connect(this->starDundee, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool))); |
|
168 | connect(this->starDundee, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool))); | |
|
169 | connect(this->gresbBridge, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool))); | |||
|
170 | ||||
192 | connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->starDundee, SLOT(targetHasChanged(int))); |
|
171 | connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->starDundee, SLOT(targetHasChanged(int))); | |
|
172 | connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->gresbBridge, SLOT(targetHasChanged(int))); | |||
193 |
|
173 | |||
194 | // command code |
|
174 | // command code | |
195 | connect(this->RMAP_write_reply, SIGNAL(clicked()), this, SLOT(getCommandCode())); |
|
175 | connect(this->RMAP_write_reply, SIGNAL(clicked()), this, SLOT(getCommandCode())); | |
196 | connect(this->RMAP_write_verify, SIGNAL(clicked()), this, SLOT(getCommandCode())); |
|
176 | connect(this->RMAP_write_verify, SIGNAL(clicked()), this, SLOT(getCommandCode())); | |
197 |
connect(this, SIGNAL(commandCodeHasChanged(RMAP_command_codes)), |
|
177 | connect(this, SIGNAL(commandCodeHasChanged(RMAP_command_codes)), | |
|
178 | this->starDundee, SLOT(commandCodeHasChanged(RMAP_command_codes))); | |||
|
179 | connect(this, SIGNAL(commandCodeHasChanged(RMAP_command_codes)), | |||
|
180 | this->gresbBridge, SLOT(commandCodeHasChanged(RMAP_command_codes))); | |||
198 |
|
181 | |||
199 | getCommandCode(); // init the command code value |
|
182 | getCommandCode(); // init the command code value | |
200 | rmapTargetLogicalAddressSpinBox->setValue(254); |
|
183 | rmapTargetLogicalAddressSpinBox->setValue(254); | |
201 | } |
|
184 | } | |
202 |
|
185 | |||
203 | rmapPluginUI::~rmapPluginUI() |
|
186 | rmapPluginUI::~rmapPluginUI() | |
204 | { |
|
187 | { | |
205 | //delete ui; |
|
188 | //delete ui; | |
206 | } |
|
189 | } | |
207 |
|
190 | |||
208 | void rmapPluginUI::chooseLogFile() |
|
191 | void rmapPluginUI::chooseLogFile() | |
209 | { |
|
192 | { | |
210 | if(this->logFile->isOpen()) |
|
193 | if(this->logFile->isOpen()) | |
211 | this->logFile->close(); |
|
194 | this->logFile->close(); | |
212 | this->logFile->setFileName(QFileDialog::getSaveFileName(this,tr("Open Log file"), |
|
195 | this->logFile->setFileName(QFileDialog::getSaveFileName(this,tr("Open Log file"), | |
213 | QDir::homePath() |
|
196 | QDir::homePath() | |
214 | + "/" |
|
197 | + "/" | |
215 | + QDate::currentDate().toString() |
|
198 | + QDate::currentDate().toString() | |
216 | + "_" |
|
199 | + "_" | |
217 | + QTime::currentTime().toString() |
|
200 | + QTime::currentTime().toString() | |
218 | + "_rmapPluginUI.log", |
|
201 | + "_rmapPluginUI.log", | |
219 | tr("Log Files (*.txt *.log)"))); |
|
202 | tr("Log Files (*.txt *.log)"))); | |
220 | if(this->logFile->open(QIODevice::WriteOnly)) |
|
203 | if(this->logFile->open(QIODevice::WriteOnly)) | |
221 | { |
|
204 | { | |
222 | this->logFileStrm = new QTextStream(this->logFile); |
|
205 | this->logFileStrm = new QTextStream(this->logFile); | |
223 | emit this->setLogFileName(this->logFile->fileName()); |
|
206 | emit this->setLogFileName(this->logFile->fileName()); | |
224 | } |
|
207 | } | |
225 | } |
|
208 | } | |
226 |
|
209 | |||
227 | void rmapPluginUI::logFileEnDisable(int state) |
|
210 | void rmapPluginUI::logFileEnDisable(int state) | |
228 | { |
|
211 | { | |
229 | if(state==Qt::Checked) |
|
212 | if(state==Qt::Checked) | |
230 | { |
|
213 | { | |
231 | this->logFileEn = true; |
|
214 | this->logFileEn = true; | |
232 | } |
|
215 | } | |
233 | else if(state==Qt::Unchecked) |
|
216 | else if(state==Qt::Unchecked) | |
234 | { |
|
217 | { | |
235 | this->logFileEn = false; |
|
218 | this->logFileEn = false; | |
236 | } |
|
219 | } | |
237 | } |
|
220 | } | |
238 |
|
221 | |||
239 | bool rmapPluginUI::islogfileenable() |
|
222 | bool rmapPluginUI::islogfileenable() | |
240 | { |
|
223 | { | |
241 | return this->logFileEn; |
|
224 | return this->logFileEn; | |
242 | } |
|
225 | } | |
243 |
|
226 | |||
244 | void rmapPluginUI::appendToLogFile(const QString & text) |
|
227 | void rmapPluginUI::appendToLogFile(const QString & text) | |
245 | { |
|
228 | { | |
246 | if(this->logFileEn && this->logFile->isOpen()) |
|
229 | if(this->logFileEn && this->logFile->isOpen()) | |
247 | { |
|
230 | { | |
248 | *(this->logFileStrm) << text << endl; |
|
231 | *(this->logFileStrm) << text << endl; | |
249 | } |
|
232 | } | |
250 | } |
|
233 | } | |
251 |
|
234 | |||
252 | void rmapPluginUI::closeEvent(QCloseEvent *event) |
|
235 | void rmapPluginUI::closeEvent(QCloseEvent *event) | |
253 | { |
|
236 | { | |
254 | if(this->logFile->isOpen()) |
|
237 | if(this->logFile->isOpen()) | |
255 | { |
|
238 | { | |
256 | this->logFileStrm->flush(); |
|
239 | this->logFileStrm->flush(); | |
257 | this->logFile->waitForBytesWritten(3000); |
|
240 | this->logFile->waitForBytesWritten(3000); | |
258 | this->logFile->close(); |
|
241 | this->logFile->close(); | |
259 | } |
|
242 | } | |
260 | event->accept(); |
|
243 | event->accept(); | |
261 | } |
|
244 | } | |
262 |
|
245 | |||
263 | RMAP_command_codes rmapPluginUI::getCommandCode() |
|
246 | RMAP_command_codes rmapPluginUI::getCommandCode() | |
264 | { |
|
247 | { | |
265 | RMAP_command_codes commandCode = invalid0; |
|
248 | RMAP_command_codes commandCode = invalid0; | |
266 | if (RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) commandCode = writeSingle_ver_rep; |
|
249 | if (RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) commandCode = writeSingle_ver_rep; | |
267 | if (RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) commandCode = writeSingle_ver_noRep; |
|
250 | if (RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) commandCode = writeSingle_ver_noRep; | |
268 | if (!RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) commandCode = writeSingle_noVer_Rep; |
|
251 | if (!RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) commandCode = writeSingle_noVer_Rep; | |
269 | if (!RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) commandCode = writeSingle_noVer_noRep; |
|
252 | if (!RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) commandCode = writeSingle_noVer_noRep; | |
270 | emit commandCodeHasChanged(commandCode); |
|
253 | emit commandCodeHasChanged(commandCode); | |
271 | return commandCode; |
|
254 | return commandCode; | |
272 | } |
|
255 | } | |
273 |
|
256 | |||
274 | // SLOT |
|
257 | // SLOT | |
275 |
|
258 | |||
276 | void rmapPluginUI::selectionBetweenGresbAndStarDundee() //SLOT |
|
259 | void rmapPluginUI::selectionBetweenGresbAndStarDundee() //SLOT | |
277 | { |
|
260 | { | |
278 | if (selectGRESB_BUTTON->isChecked()) |
|
261 | if (selectGRESB_BUTTON->isChecked()) | |
279 | { |
|
262 | { | |
280 | gresb_GROUPBOX->setVisible(true); |
|
263 | gresb_GROUPBOX->setVisible(true); | |
281 | stardundee_GROUPBOX->setVisible(false); |
|
264 | stardundee_GROUPBOX->setVisible(false); | |
282 | rmapOpenCommunicationButton->setEnabled(true); |
|
265 | rmapOpenCommunicationButton->setEnabled(true); | |
283 | emit bridgeHasChanged(selectedBridgeIsGRESB); |
|
266 | emit bridgeHasChanged(selectedBridgeIsGRESB); | |
284 | } |
|
267 | } | |
285 | if (selectStarDundee_BUTTON->isChecked()) |
|
268 | if (selectStarDundee_BUTTON->isChecked()) | |
286 | { |
|
269 | { | |
287 | stardundee_GROUPBOX->setVisible(true); |
|
270 | stardundee_GROUPBOX->setVisible(true); | |
288 | gresb_GROUPBOX->setVisible(false); |
|
271 | gresb_GROUPBOX->setVisible(false); | |
289 | rmapOpenCommunicationButton->setEnabled(true); |
|
272 | rmapOpenCommunicationButton->setEnabled(true); | |
290 | emit bridgeHasChanged(selectedBridgeIsStarDundee); |
|
273 | emit bridgeHasChanged(selectedBridgeIsStarDundee); | |
291 | } |
|
274 | } | |
292 | } |
|
275 | } | |
293 |
|
276 | |||
294 | void rmapPluginUI::isOpen(bool flag) |
|
277 | void rmapPluginUI::isOpen(bool flag) | |
295 | { |
|
278 | { | |
296 | if (flag == true) |
|
279 | if (flag == true) | |
297 | { |
|
280 | { | |
298 | selection_GROUPBOX->setEnabled(false); |
|
281 | selection_GROUPBOX->setEnabled(false); | |
299 | this->rmapOpenCommunicationButton->setEnabled(false); |
|
282 | this->rmapOpenCommunicationButton->setEnabled(false); | |
300 | this->rmapCloseCommunicationButton->setEnabled(true); |
|
283 | this->rmapCloseCommunicationButton->setEnabled(true); | |
301 | } |
|
284 | } | |
302 | if (flag == false) |
|
285 | if (flag == false) | |
303 | { |
|
286 | { | |
304 | selection_GROUPBOX->setEnabled(true); |
|
287 | selection_GROUPBOX->setEnabled(true); | |
305 | this->rmapOpenCommunicationButton->setEnabled(true); |
|
288 | this->rmapOpenCommunicationButton->setEnabled(true); | |
306 | this->rmapCloseCommunicationButton->setEnabled(false); |
|
289 | this->rmapCloseCommunicationButton->setEnabled(false); | |
307 | } |
|
290 | } | |
308 | } |
|
291 | } | |
309 |
|
292 | |||
310 |
|
293 |
General Comments 0
You need to be logged in to leave comments.
Login now