##// END OF EJS Templates
Merge
admin@pc-p-leroy3.LAB-LPP.LOCAL -
r30:80c27716b2cd merge default
parent child
Show More
@@ -1,6 +1,6
1 1 #############################################################################
2 2 # Makefile for building: PAULs_LPPMON_PLUGINS
3 # Generated by qmake (2.01a) (Qt 4.8.4) on: Fri Feb 1 12:36:21 2013
3 # Generated by qmake (2.01a) (Qt 4.8.4) on: Fri Apr 5 15:41:42 2013
4 4 # Project: PAULs_LPPMON_PLUGINS.pro
5 5 # Template: subdirs
6 6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro
@@ -29,10 +29,10 SUBTARGETS = \
29 29
30 30 rmapplugin/$(MAKEFILE):
31 31 @$(CHK_DIR_EXISTS) rmapplugin/ || $(MKDIR) rmapplugin/
32 cd rmapplugin/ && $(QMAKE) /home/admin/opt/LPPMON_PLUGINS_PLE/rmapplugin/rmapplugin.pro -spec /usr/lib64/qt4/mkspecs/linux-g++ -o $(MAKEFILE)
32 cd rmapplugin/ && $(QMAKE) /opt/LPPMON_PLUGINS_PAUL/rmapplugin/rmapplugin.pro -spec /usr/lib64/qt4/mkspecs/linux-g++ -o $(MAKEFILE)
33 33 sub-rmapplugin-qmake_all: FORCE
34 34 @$(CHK_DIR_EXISTS) rmapplugin/ || $(MKDIR) rmapplugin/
35 cd rmapplugin/ && $(QMAKE) /home/admin/opt/LPPMON_PLUGINS_PLE/rmapplugin/rmapplugin.pro -spec /usr/lib64/qt4/mkspecs/linux-g++ -o $(MAKEFILE)
35 cd rmapplugin/ && $(QMAKE) /opt/LPPMON_PLUGINS_PAUL/rmapplugin/rmapplugin.pro -spec /usr/lib64/qt4/mkspecs/linux-g++ -o $(MAKEFILE)
36 36 sub-rmapplugin: rmapplugin/$(MAKEFILE) FORCE
37 37 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE)
38 38 sub-rmapplugin-make_default-ordered: rmapplugin/$(MAKEFILE) FORCE
@@ -1,6 +1,6
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by Qt Creator 2.4.1, 2013-03-09T22:08:02. -->
3 <!-- Written by Qt Creator 2.4.1, 2013-04-05T17:42:05. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -63,7 +63,7
63 63 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
64 64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
65 65 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
66 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
66 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
67 67 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
68 68 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
69 69 </valuemap>
@@ -97,15 +97,65
97 97 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
98 98 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
99 99 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
100 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.3 in PATH (System) Release</value>
100 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
101 101 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
102 102 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
103 103 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
104 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/admin/opt/LPPMON_PLUGINS_PLE</value>
104 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value>
105 105 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
106 106 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
107 107 </valuemap>
108 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
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>
110 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
111 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
115 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
116 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
117 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
118 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
119 </valuemap>
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
121 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
122 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
124 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
125 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
126 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
127 </valuemap>
128 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
131 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
132 </valuemap>
133 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
134 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
137 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
138 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
139 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
140 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
141 </valuemap>
142 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
143 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
144 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
146 </valuemap>
147 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
148 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
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>
151 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
153 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
154 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value>
155 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
156 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
157 </valuemap>
158 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
109 159 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
110 160 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
111 161 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
@@ -196,7 +246,85
196 246 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
197 247 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
198 248 </valuemap>
199 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
249 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
250 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
251 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
252 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
253 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
254 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
255 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
256 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
257 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
258 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
259 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
260 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
261 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
262 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
263 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
264 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
265 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
266 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
267 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
268 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
269 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
270 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
271 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
272 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
273 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
274 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
275 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
276 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
277 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
278 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
279 <value type="int">0</value>
280 <value type="int">1</value>
281 <value type="int">2</value>
282 <value type="int">3</value>
283 <value type="int">4</value>
284 <value type="int">5</value>
285 <value type="int">6</value>
286 <value type="int">7</value>
287 <value type="int">8</value>
288 <value type="int">9</value>
289 <value type="int">10</value>
290 <value type="int">11</value>
291 <value type="int">12</value>
292 <value type="int">13</value>
293 <value type="int">14</value>
294 </valuelist>
295 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
296 <value type="int">0</value>
297 <value type="int">1</value>
298 <value type="int">2</value>
299 <value type="int">3</value>
300 <value type="int">4</value>
301 <value type="int">5</value>
302 <value type="int">6</value>
303 <value type="int">7</value>
304 <value type="int">8</value>
305 <value type="int">9</value>
306 <value type="int">10</value>
307 <value type="int">11</value>
308 <value type="int">12</value>
309 <value type="int">13</value>
310 <value type="int">14</value>
311 </valuelist>
312 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">spwtimegenerator</value>
313 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
314 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration</value>
315 <value type="int" key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase">2</value>
316 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
317 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">spwtimegenerator/spwtimegenerator/spwtimegenerator.pro</value>
318 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
319 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
320 <valuelist type="QVariantList" key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges"/>
321 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
322 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
323 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
324 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
325 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
326 </valuemap>
327 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
200 328 </valuemap>
201 329 </data>
202 330 <data>
@@ -205,7 +333,7
205 333 </data>
206 334 <data>
207 335 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
208 <value type="QString">{cdbf9cdc-1e84-406e-889b-c4feef49e75c}</value>
336 <value type="QString">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
209 337 </data>
210 338 <data>
211 339 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
@@ -59,11 +59,21 void QIPDialogBox::valueChanged() // SLO
59 59 gresbIP.append(addressPart3->cleanText());
60 60 gresbIP.append(".");
61 61 gresbIP.append(addressPart4->cleanText());
62 //labelGRESBIP->setText("IP used for the gresb module: " + gresbIP);
63 62 }
64 63
65 QString QIPDialogBox::getGRESBIP()
64 QString QIPDialogBox::getIP()
66 65 {
67 66 return(gresbIP);
68 67 }
69 68
69 void QIPDialogBox::setIP(unsigned char address1, unsigned char address2, unsigned char address3, unsigned char address4)
70 {
71 addressPart1->setValue(address1);
72 addressPart2->setValue(address2);
73 addressPart3->setValue(address3);
74 addressPart4->setValue(address4);
75 addressPart1->repaint();
76 addressPart2->repaint();
77 addressPart3->repaint();
78 addressPart4->repaint();
79 }
@@ -11,12 +11,13 class QIPDialogBox : public QWidget
11 11 Q_OBJECT
12 12 public:
13 13 explicit QIPDialogBox(QWidget *parent = 0);
14 QString getGRESBIP();
14 void setIP(unsigned char address1, unsigned char address2, unsigned char address3, unsigned char address4);
15 15
16 16 signals:
17 17
18 18 public slots:
19 19 void valueChanged();
20 QString getIP();
20 21
21 22 private:
22 23 QSpinBox *addressPart1;
@@ -1,6 +1,6
1 1 #############################################################################
2 2 # Makefile for building: librmapplugin.so.1.0.0
3 # Generated by qmake (2.01a) (Qt 4.8.4) on: Fri Feb 1 12:36:22 2013
3 # Generated by qmake (2.01a) (Qt 4.8.4) on: Fri Apr 5 15:41:42 2013
4 4 # Project: rmapplugin.pro
5 5 # Template: lib
6 6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro
@@ -10,13 +10,13
10 10
11 11 CC = gcc
12 12 CXX = g++
13 DEFINES = -DPLUGIN=rmapplugin -DPLUGINHEADER="\"rmapplugin.h\"" -Ddriver_Name="\"RMAPPlugin\"" -Ddriver_Author="\"Paul Leroy paul.leroy@lpp.polytechnique.fr\"" -Ddriver_Version="\"1.1.2\"" -Ddriver_Description="\"AHB bus controler, works with Gaisler's AHB plugn' play bus.\"" -Ddriver_can_be_root=1 -Ddriver_can_be_child=0 -Ddriver_VID=0 -Ddriver_PID=0 -DUNIXTRANSLATIONPATH -DLPPMON_PLUGINS_INSTALL_PATH="QDir::homePath()+\"/.lppmon/plugins\"" -DLPPMON_CONFIG_PATH="QDir::homePath()+\"/.lppmon/config\"" -DLPPMON_TRANSLATION_PATH="\"/etc/lppmon/translations\"" -DLPPMONPLUGIN_LIBRARY -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
13 DEFINES = -DPLUGIN=rmapplugin -DPLUGINHEADER="\"rmapplugin.h\"" -Ddriver_Name="\"RMAPPlugin\"" -Ddriver_Author="\"Paul Leroy paul.leroy@lpp.polytechnique.fr\"" -Ddriver_Version="\"1.1.2\"" -Ddriver_Description="\"AHB bus controler, works with Gaisler's AHB plugn' play bus.\"" -Ddriver_can_be_root=1 -Ddriver_can_be_child=0 -Ddriver_VID=0 -Ddriver_PID=0 -DLPPMON_VERSION="\"0.0.1\"" -DUNIXTRANSLATIONPATH -DLPPMON_PLUGINS_INSTALL_PATH="QDir::homePath()+\"/.lppmon/plugins\"" -DLPPMON_CONFIG_PATH="QDir::homePath()+\"/.lppmon/config\"" -DLPPMON_TRANSLATION_PATH="\"/etc/lppmon/translations\"" -DLPPMONPLUGIN_LIBRARY -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
14 14 CFLAGS = -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
15 15 CXXFLAGS = -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -O2 -I/usr/include/python2.7 -I/usr/include/python2.7 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
16 16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtXml -I/usr/include -I. -I../common_PLE -I../spw_usb_driver_v2.61/inc -I/usr/include/lppmon/common -I/usr/include/lppmon -I/usr/include/lppmon/pluginsInterface -I/usr/include/PythonQt -Imoc
17 17 LINK = g++
18 18 LFLAGS = -Wl,-O1 -Wl,-z,relro -shared -Wl,-soname,librmapplugin.so.1
19 LIBS = $(SUBLIBS) -L/usr/lib64 ../spw_usb_driver_v2.61/lib/x86_64/libSpaceWireUSBAPI.so ../spw_usb_driver_v2.61/lib/x86_64/libConfigLibraryUSB.so -ldl -lutil -lm -lpython2.7 -lPythonQt_QtAll -lPythonQt -lQtXml -lQtGui -lQtNetwork -lQtCore -lpthread
19 LIBS = $(SUBLIBS) -L/usr/lib64 ../spw_usb_driver_v2.62/lib/x86_64/libSpaceWireUSBAPI.so ../spw_usb_driver_v2.62/lib/x86_64/libConfigLibraryUSB.so -ldl -lutil -lm -lpython2.7 -lPythonQt_QtAll -lPythonQt -lQtXml -lQtGui -lQtNetwork -lQtCore -lpthread
20 20 AR = ar cqs
21 21 RANLIB =
22 22 QMAKE = /usr/bin/qmake-qt4
@@ -53,7 +53,8 SOURCES = rmapplugin.cpp \
53 53 rmappluginpythonwrapper.cpp \
54 54 stardundee.cpp \
55 55 gresb.cpp \
56 bridge.cpp \
56 tcpackettosend.cpp \
57 tmpackettoread.cpp \
57 58 /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp moc/moc_rmappluginui.cpp \
58 59 moc/moc_rmapplugin.cpp \
59 60 moc/moc_qipdialogbox.cpp \
@@ -62,7 +63,10 SOURCES = rmapplugin.cpp \
62 63 moc/moc_rmappluginpythonwrapper.cpp \
63 64 moc/moc_stardundee.cpp \
64 65 moc/moc_gresb.cpp \
65 moc/moc_bridge.cpp
66 moc/moc_tcpackettosend.cpp \
67 moc/moc_tmpackettoread.cpp \
68 moc/moc_genericPySysdriver.cpp \
69 moc/moc_lppmonplugin.cpp
66 70 OBJECTS = obj/rmapplugin.o \
67 71 obj/rmappluginui.o \
68 72 obj/rmapoperations.o \
@@ -73,7 +77,8 OBJECTS = obj/rmapplugin.o \
73 77 obj/rmappluginpythonwrapper.o \
74 78 obj/stardundee.o \
75 79 obj/gresb.o \
76 obj/bridge.o \
80 obj/tcpackettosend.o \
81 obj/tmpackettoread.o \
77 82 obj/lppmonplugininterface.o \
78 83 obj/moc_rmappluginui.o \
79 84 obj/moc_rmapplugin.o \
@@ -83,7 +88,10 OBJECTS = obj/rmapplugin.o \
83 88 obj/moc_rmappluginpythonwrapper.o \
84 89 obj/moc_stardundee.o \
85 90 obj/moc_gresb.o \
86 obj/moc_bridge.o
91 obj/moc_tcpackettosend.o \
92 obj/moc_tmpackettoread.o \
93 obj/moc_genericPySysdriver.o \
94 obj/moc_lppmonplugin.o
87 95 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
88 96 /usr/lib64/qt4/mkspecs/common/linux.conf \
89 97 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
@@ -231,7 +239,7 qmake: FORCE
231 239
232 240 dist:
233 241 @$(CHK_DIR_EXISTS) obj/rmapplugin1.0.0 || $(MKDIR) obj/rmapplugin1.0.0
234 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmappluginui.h rmapplugin.h rmapoperations.h ccsds.h ../common_PLE/qipdialogbox.h ../common_PLE/gresbstatusenquiry.h spectralmatricesdmasimulator.h rmappluginpythonwrapper.h stardundee.h ../spw_usb_driver_v2.61/inc/spw_usb_api.h ../spw_usb_driver_v2.61/inc/spw_config_library.h gresb.h bridge.h /usr/include/genericPySysdriver.h /usr/include/lppmonplugin.h obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmapplugin.cpp rmappluginui.cpp rmapoperations.cpp ccsds.cpp ../common_PLE/qipdialogbox.cpp ../common_PLE/gresbstatusenquiry.cpp spectralmatricesdmasimulator.cpp rmappluginpythonwrapper.cpp stardundee.cpp gresb.cpp bridge.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp obj/rmapplugin1.0.0/ && (cd `dirname obj/rmapplugin1.0.0` && $(TAR) rmapplugin1.0.0.tar rmapplugin1.0.0 && $(COMPRESS) rmapplugin1.0.0.tar) && $(MOVE) `dirname obj/rmapplugin1.0.0`/rmapplugin1.0.0.tar.gz . && $(DEL_FILE) -r obj/rmapplugin1.0.0
242 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmappluginui.h rmapplugin.h rmapoperations.h ccsds.h ../common_PLE/qipdialogbox.h ../common_PLE/gresbstatusenquiry.h spectralmatricesdmasimulator.h rmappluginpythonwrapper.h stardundee.h ../spw_usb_driver_v2.61/inc/spw_usb_api.h ../spw_usb_driver_v2.61/inc/spw_config_library.h gresb.h tcpackettosend.h tmpackettoread.h /usr/include/lppmon/genericPySysdriver.h /usr/include/lppmon/lppmonplugin.h obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmapplugin.cpp rmappluginui.cpp rmapoperations.cpp ccsds.cpp ../common_PLE/qipdialogbox.cpp ../common_PLE/gresbstatusenquiry.cpp spectralmatricesdmasimulator.cpp rmappluginpythonwrapper.cpp stardundee.cpp gresb.cpp tcpackettosend.cpp tmpackettoread.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp obj/rmapplugin1.0.0/ && (cd `dirname obj/rmapplugin1.0.0` && $(TAR) rmapplugin1.0.0.tar rmapplugin1.0.0 && $(COMPRESS) rmapplugin1.0.0.tar) && $(MOVE) `dirname obj/rmapplugin1.0.0`/rmapplugin1.0.0.tar.gz . && $(DEL_FILE) -r obj/rmapplugin1.0.0
235 243
236 244
237 245 clean:compiler_clean
@@ -253,12 +261,14 mocclean: compiler_moc_header_clean comp
253 261
254 262 mocables: compiler_moc_header_make_all compiler_moc_source_make_all
255 263
256 compiler_moc_header_make_all: moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp
264 compiler_moc_header_make_all: moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_tcpackettosend.cpp moc/moc_tmpackettoread.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
257 265 compiler_moc_header_clean:
258 -$(DEL_FILE) moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp
266 -$(DEL_FILE) moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_tcpackettosend.cpp moc/moc_tmpackettoread.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
259 267 moc/moc_rmappluginui.cpp: rmapoperations.h \
260 268 spectralmatricesdmasimulator.h \
261 269 stardundee.h \
270 ccsds.h \
271 tmpackettoread.h \
262 272 gresb.h \
263 273 rmappluginui.h
264 274 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginui.h -o moc/moc_rmappluginui.cpp
@@ -267,8 +277,9 moc/moc_rmapplugin.cpp: rmappluginui.h \
267 277 rmapoperations.h \
268 278 spectralmatricesdmasimulator.h \
269 279 stardundee.h \
280 ccsds.h \
281 tmpackettoread.h \
270 282 gresb.h \
271 ccsds.h \
272 283 rmapplugin.h
273 284 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmapplugin.h -o moc/moc_rmapplugin.cpp
274 285
@@ -281,20 +292,36 moc/moc_gresbstatusenquiry.cpp: ../commo
281 292 moc/moc_spectralmatricesdmasimulator.cpp: spectralmatricesdmasimulator.h
282 293 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) spectralmatricesdmasimulator.h -o moc/moc_spectralmatricesdmasimulator.cpp
283 294
284 moc/moc_rmappluginpythonwrapper.cpp: rmappluginpythonwrapper.h
295 moc/moc_rmappluginpythonwrapper.cpp: rmapoperations.h \
296 ccsds.h \
297 tcpackettosend.h \
298 tmpackettoread.h \
299 rmappluginpythonwrapper.h
285 300 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginpythonwrapper.h -o moc/moc_rmappluginpythonwrapper.cpp
286 301
287 302 moc/moc_stardundee.cpp: rmapoperations.h \
303 ccsds.h \
304 tmpackettoread.h \
288 305 stardundee.h
289 306 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) stardundee.h -o moc/moc_stardundee.cpp
290 307
291 308 moc/moc_gresb.cpp: rmapoperations.h \
309 ccsds.h \
310 tmpackettoread.h \
292 311 gresb.h
293 312 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) gresb.h -o moc/moc_gresb.cpp
294 313
295 moc/moc_bridge.cpp: rmapoperations.h \
296 bridge.h
297 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) bridge.h -o moc/moc_bridge.cpp
314 moc/moc_tcpackettosend.cpp: tcpackettosend.h
315 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) tcpackettosend.h -o moc/moc_tcpackettosend.cpp
316
317 moc/moc_tmpackettoread.cpp: tmpackettoread.h
318 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) tmpackettoread.h -o moc/moc_tmpackettoread.cpp
319
320 moc/moc_genericPySysdriver.cpp: /usr/include/lppmon/genericPySysdriver.h
321 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/lppmon/genericPySysdriver.h -o moc/moc_genericPySysdriver.cpp
322
323 moc/moc_lppmonplugin.cpp: /usr/include/lppmon/lppmonplugin.h
324 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/lppmon/lppmonplugin.h -o moc/moc_lppmonplugin.cpp
298 325
299 326 compiler_rcc_make_all:
300 327 compiler_rcc_clean:
@@ -320,9 +347,11 obj/rmapplugin.o: rmapplugin.cpp rmapplu
320 347 rmapoperations.h \
321 348 spectralmatricesdmasimulator.h \
322 349 stardundee.h \
350 ccsds.h \
351 tmpackettoread.h \
323 352 gresb.h \
324 ccsds.h \
325 rmappluginpythonwrapper.h
353 rmappluginpythonwrapper.h \
354 tcpackettosend.h
326 355 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmapplugin.o rmapplugin.cpp
327 356
328 357 obj/rmappluginui.o: rmappluginui.cpp rmapplugin.h \
@@ -330,8 +359,9 obj/rmappluginui.o: rmappluginui.cpp rma
330 359 rmapoperations.h \
331 360 spectralmatricesdmasimulator.h \
332 361 stardundee.h \
333 gresb.h \
334 ccsds.h
362 ccsds.h \
363 tmpackettoread.h \
364 gresb.h
335 365 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginui.o rmappluginui.cpp
336 366
337 367 obj/rmapoperations.o: rmapoperations.cpp rmapoperations.h
@@ -349,20 +379,30 obj/gresbstatusenquiry.o: ../common_PLE/
349 379 obj/spectralmatricesdmasimulator.o: spectralmatricesdmasimulator.cpp spectralmatricesdmasimulator.h
350 380 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spectralmatricesdmasimulator.o spectralmatricesdmasimulator.cpp
351 381
352 obj/rmappluginpythonwrapper.o: rmappluginpythonwrapper.cpp rmappluginpythonwrapper.h
382 obj/rmappluginpythonwrapper.o: rmappluginpythonwrapper.cpp rmappluginpythonwrapper.h \
383 rmapoperations.h \
384 ccsds.h \
385 tcpackettosend.h \
386 tmpackettoread.h
353 387 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginpythonwrapper.o rmappluginpythonwrapper.cpp
354 388
355 389 obj/stardundee.o: stardundee.cpp stardundee.h \
356 rmapoperations.h
390 rmapoperations.h \
391 ccsds.h \
392 tmpackettoread.h
357 393 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/stardundee.o stardundee.cpp
358 394
359 395 obj/gresb.o: gresb.cpp gresb.h \
360 rmapoperations.h
396 rmapoperations.h \
397 ccsds.h \
398 tmpackettoread.h
361 399 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresb.o gresb.cpp
362 400
363 obj/bridge.o: bridge.cpp bridge.h \
364 rmapoperations.h
365 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/bridge.o bridge.cpp
401 obj/tcpackettosend.o: tcpackettosend.cpp tcpackettosend.h
402 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/tcpackettosend.o tcpackettosend.cpp
403
404 obj/tmpackettoread.o: tmpackettoread.cpp tmpackettoread.h
405 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/tmpackettoread.o tmpackettoread.cpp
366 406
367 407 obj/lppmonplugininterface.o: /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.h \
368 408 /usr/include/lppmon/pluginsInterface/lppmonplugininterface_global.h
@@ -392,24 +432,33 obj/moc_stardundee.o: moc/moc_stardundee
392 432 obj/moc_gresb.o: moc/moc_gresb.cpp
393 433 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_gresb.o moc/moc_gresb.cpp
394 434
395 obj/moc_bridge.o: moc/moc_bridge.cpp
396 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_bridge.o moc/moc_bridge.cpp
435 obj/moc_tcpackettosend.o: moc/moc_tcpackettosend.cpp
436 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_tcpackettosend.o moc/moc_tcpackettosend.cpp
437
438 obj/moc_tmpackettoread.o: moc/moc_tmpackettoread.cpp
439 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_tmpackettoread.o moc/moc_tmpackettoread.cpp
440
441 obj/moc_genericPySysdriver.o: moc/moc_genericPySysdriver.cpp
442 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_genericPySysdriver.o moc/moc_genericPySysdriver.cpp
443
444 obj/moc_lppmonplugin.o: moc/moc_lppmonplugin.cpp
445 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_lppmonplugin.o moc/moc_lppmonplugin.cpp
397 446
398 447 ####### Install
399 448
400 449 install_target: first FORCE
401 @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/home/admin/.lppmon/plugins/ || $(MKDIR) $(INSTALL_ROOT)/home/admin/.lppmon/plugins/
402 -$(INSTALL_PROGRAM) "bin/$(TARGET)" "$(INSTALL_ROOT)/home/admin/.lppmon/plugins/$(TARGET)"
403 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/admin/.lppmon/plugins/$(TARGET0)"
404 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/admin/.lppmon/plugins/$(TARGET1)"
405 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/admin/.lppmon/plugins/$(TARGET2)"
450 @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/home/paul/.lppmon/plugins/ || $(MKDIR) $(INSTALL_ROOT)/home/paul/.lppmon/plugins/
451 -$(INSTALL_PROGRAM) "bin/$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET)"
452 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET0)"
453 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET1)"
454 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET2)"
406 455
407 456 uninstall_target: FORCE
408 -$(DEL_FILE) "$(INSTALL_ROOT)/home/admin/.lppmon/plugins/$(TARGET)"
409 -$(DEL_FILE) "$(INSTALL_ROOT)/home/admin/.lppmon/plugins/$(TARGET0)"
410 -$(DEL_FILE) "$(INSTALL_ROOT)/home/admin/.lppmon/plugins/$(TARGET1)"
411 -$(DEL_FILE) "$(INSTALL_ROOT)/home/admin/.lppmon/plugins/$(TARGET2)"
412 -$(DEL_DIR) $(INSTALL_ROOT)/home/admin/.lppmon/plugins/
457 -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET)"
458 -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET0)"
459 -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET1)"
460 -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET2)"
461 -$(DEL_DIR) $(INSTALL_ROOT)/home/paul/.lppmon/plugins/
413 462
414 463
415 464 install: install_target FORCE
@@ -1,6 +1,15
1 1 #ifndef CCSDS_H
2 2 #define CCSDS_H
3 3
4 #define CCSDS_MAX_PACKET_LENGTH 4412 // in bytes, specified in the LFR Software Requirements Specification
5
6 struct ccsdsPacketToProcess_str
7 {
8 unsigned int size;
9 unsigned char data[CCSDS_MAX_PACKET_LENGTH];
10 };
11 typedef ccsdsPacketToProcess_str ccsdsPacketToProcess_t;
12
4 13 struct ccsds_telecommand_source_packet_hdr_str
5 14 {
6 15 unsigned char packetId1;
@@ -16,12 +16,13 gresb::gresb(QWidget *parent) :
16 16 spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) );
17 17
18 18 commandCode = invalid0; // initialization of the command code for the RMAP transfers
19 rmapTargetLogicalAddress = DEFAULT_TARGET;
20 rmapSourceLogicalAddress = DEFAULT_SOURCE;
19 21
20 22 //*** QLABEL ***//
21 23 gresbBridgeIPLabel = new QLabel(tr("GRESB Bridge IP: "));
22 24 gresbVirtualLinkLabel = new QLabel(tr("GRESB Virtual Link: "));
23 25 spwLinkLabel = new QLabel(tr("GRESB SPW Link: "));
24 rmapSourceLogicalAddressLabel = new QLabel(tr("RMAP Source Logical Address: "));
25 26 rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection"));
26 27 rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection"));
27 28 gresbStatusQueryLabel = new QLabel(tr("GRESB status query socket (port 3010): waiting for connection"));
@@ -29,12 +30,9 gresb::gresb(QWidget *parent) :
29 30
30 31 //*** SPINBOX ***//
31 32 gresbVirtualLinkSpinBox = new QSpinBox;
32 rmapSourceLogicalAddressSpinBox = new QSpinBox;
33 33 spwLinkSpinBox = new QSpinBox;;
34 34 gresbVirtualLinkSpinBox->setRange(0, 4);
35 35 gresbVirtualLinkSpinBox->setValue(1);
36 rmapSourceLogicalAddressSpinBox->setRange(0, 255);
37 rmapSourceLogicalAddressSpinBox->setValue(33);
38 36 spwLinkSpinBox->setRange(0, 2);
39 37 spwLinkSpinBox->setValue(0);
40 38
@@ -56,13 +54,11 gresb::gresb(QWidget *parent) :
56 54 connectionLayout->addWidget(gresbVirtualLinkSpinBox, 1, 1, 0);
57 55 connectionLayout->addWidget(spwLinkLabel, 2, 0, 0);
58 56 connectionLayout->addWidget(spwLinkSpinBox, 2, 1, 0);
59 connectionLayout->addWidget(rmapSourceLogicalAddressLabel, 3, 0, 0);
60 connectionLayout->addWidget(rmapSourceLogicalAddressSpinBox, 3, 1, 0);
61 connectionLayout->addWidget(rmapSendStateLabel, 4, 0, 1, 2);
62 connectionLayout->addWidget(rmapReceiveStateLabel, 5, 0, 1, 2);
63 connectionLayout->addWidget(gresbStatusQueryLabel, 6, 0, 1, 2);
57 connectionLayout->addWidget(rmapSendStateLabel, 3, 0, 1, 2);
58 connectionLayout->addWidget(rmapReceiveStateLabel, 4, 0, 1, 2);
59 connectionLayout->addWidget(gresbStatusQueryLabel, 5, 0, 1, 2);
64 60
65 connectionLayout->setRowStretch(7, 1);
61 connectionLayout->setRowStretch(6, 1);
66 62 connectionLayout->setColumnStretch(2, 1);
67 63
68 64 // GRESB STATUS QUERY DIALOG
@@ -80,7 +76,7 gresb::gresb(QWidget *parent) :
80 76 connect(gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink()));
81 77 connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject()));
82 78 connect(spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery()));
83 connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacket()));
79 connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacketLoop()));
84 80 }
85 81
86 82 gresb::~gresb()
@@ -238,7 +234,7 unsigned int gresb::WriteBLOCK(char *dat
238 234
239 235 RMAPCommand = new RMAP(commandCode,
240 236 rmapTargetLogicalAddress,
241 rmapSourceLogicalAddressSpinBox->value(),
237 rmapSourceLogicalAddress,
242 238 address,
243 239 nbBytes,
244 240 data);
@@ -353,7 +349,7 unsigned int gresb::ReadBLOCK(unsigned i
353 349 {
354 350 RMAPCommand = new RMAP(read_Inc,
355 351 rmapTargetLogicalAddress,
356 rmapSourceLogicalAddressSpinBox->value(),
352 rmapSourceLogicalAddress,
357 353 address,
358 354 nbBytes,
359 355 NULL);
@@ -362,7 +358,7 unsigned int gresb::ReadBLOCK(unsigned i
362 358 {
363 359 RMAPCommand = new RMAP(read_Single,
364 360 rmapTargetLogicalAddress,
365 rmapSourceLogicalAddressSpinBox->value(),
361 rmapSourceLogicalAddress,
366 362 address,
367 363 nbBytes,
368 364 NULL);
@@ -458,6 +454,20 unsigned int gresb::WriteSPW(char *Value
458 454 return count;
459 455 }
460 456
457 int gresb::receiveSPWPacketLoop(unsigned char requestID)
458 {
459 int result = 0;
460 while (RMAPReceive_SOCKET->bytesAvailable())
461 {
462 result = receiveSPWPacket(requestID);
463 }
464 if (!ccsdsPacketStore.isEmpty())
465 {
466 emit packetStoreNotEmpty();
467 }
468 return result;
469 }
470
461 471 int gresb::receiveSPWPacket(unsigned char requestID) // SLOT
462 472 {
463 473 QTime spwPacketReceiverTimeout;
@@ -508,31 +518,42 int gresb::receiveSPWPacket(unsigned cha
508 518 return packetLength;
509 519
510 520 case 2: // 0x02 is the protocole identifier for CCSDS packets
511 if (ccsdsPacketSEMAPHORE->available()!=0) return -4; // ERROR === previous CCSDS packet not processed yet
521 /*if (ccsdsPacketSEMAPHORE->available()!=0)
522 {
523 emit sendMessage("in function [receiveSPWPacket] === ERROR === previous CCSDS packet not processed yet");
524 return -4; // ERROR === previous CCSDS packet not processed yet
525 }*/
512 526 for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i];
513 527 ccsdsPacketSize = packetLength;
514 ccsdsPacketSEMAPHORE->release();
515 emit(ccsdsPacketAvailable(ccsdsPacket, packetLength));
516 //emit sendMessage("CCSDS packet of size " + QString::number(packetLength) + " received");
528 storeCCSDSPacket(ccsdsPacket, packetLength);
517 529 return packetLength;
518 530 }
519 531 return 0;
520 532 }
521 533
534 unsigned int gresb::storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size)
535 {
536 TMPacketToRead *packet;
537
538 packet = new TMPacketToRead(ccsdsPacket, size);
539 ccsdsPacketStore.append(packet);
540
541 return 1;
542 }
543
522 544 void gresb::Open() // SLOT
523 545 {
524 546 bool spwRunning = true;
525 RMAPSend_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()),
547 RMAPSend_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getIP()),
526 548 3000 + gresbVirtualLinkSpinBox->value()*2,
527 549 QIODevice::WriteOnly);
528 RMAPReceive_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()),
550 RMAPReceive_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getIP()),
529 551 3000 + gresbVirtualLinkSpinBox->value()*2+1,
530 552 QIODevice::ReadOnly);
531 GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()),
553 GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getIP()),
532 554 3010,
533 555 QIODevice::ReadWrite);
534 556 GRESBStatusQuery_SOCKET->waitForConnected(10000);
535 RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket
536 557 // initialize SPW packet semaphores
537 558 while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire();
538 559 while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire();
@@ -543,7 +564,8 void gresb::Open() // SLOT
543 564 if (spwRunning == false) this->Close();
544 565 else
545 566 {
546 emit appendToLog(QString("SpaceWire running on virtual link ")+ QString::number(spwLinkSpinBox->value()));
567 emit appendToLog(QString("SpaceWire running on link ")+ QString::number(spwLinkSpinBox->value()));
568 RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket
547 569 emit isOpen(true);
548 570 }
549 571 }
@@ -764,3 +786,4 void gresb::GRESBConnectionState(QAbstra
764 786 }
765 787 gresbStatusQueryLabel->setText(socketMessage);
766 788 }
789
@@ -13,6 +13,8
13 13 #include "gresbstatusenquiry.h"
14 14 #include "rmapoperations.h"
15 15 #include "qipdialogbox.h"
16 #include "ccsds.h"
17 #include "tmpackettoread.h"
16 18
17 19 class gresb : public QWidget
18 20 {
@@ -23,6 +25,9 public:
23 25 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
24 26 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
25 27 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
28
29 unsigned int storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size);
30 QList<TMPacketToRead*> ccsdsPacketStore;
26 31
27 32 signals:
28 33 void sendMessage(QString message);
@@ -30,19 +35,25 signals:
30 35 void RMAP_write_reply_setText(QString);
31 36 void appendToLog(QString);
32 37 void ccsdsPacketAvailable(unsigned char*, unsigned int);
38 void packetStoreNotEmpty();
33 39
34 40 public slots:
35 41 void Open();
36 42 void Close();
43 int receiveSPWPacketLoop(unsigned char requestID=0);
37 44 int receiveSPWPacket(unsigned char requestID=0);
38 45 void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
39 46 void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
47 void sourceHasChanged(int source) {rmapSourceLogicalAddress = (unsigned char) source;}
40 48 void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();}
41 49 void reTestSPWLink();
42 50 //
43 51 void RMAPSendConnectionState(QAbstractSocket::SocketState socketState);
44 52 void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState);
45 53 void GRESBConnectionState(QAbstractSocket::SocketState socketState);
54 //
55 void setIP(unsigned char address1, unsigned char address2, unsigned char address3, unsigned char address4)
56 {this->gresbBridgeIPDialogBox->setIP(address1, address2, address3, address4);}
46 57
47 58 private slots:
48 59 int GRESBStatusQuery();
@@ -65,7 +76,6 private:
65 76 QLabel *gresbBridgeIPLabel;
66 77 QLabel *gresbVirtualLinkLabel;
67 78 QLabel *spwLinkLabel;
68 QLabel *rmapSourceLogicalAddressLabel;
69 79 QLabel *rmapSendStateLabel;
70 80 QLabel *rmapReceiveStateLabel;
71 81 QLabel *gresbStatusQueryLabel;
@@ -77,7 +87,6 private:
77 87
78 88 QSpinBox *gresbVirtualLinkSpinBox;
79 89 QSpinBox *spwLinkSpinBox;
80 QSpinBox *rmapSourceLogicalAddressSpinBox;
81 90
82 91 QGridLayout *connectionLayout;
83 92 QGridLayout *gresbStatusQueryDialogLayout;
@@ -1,6 +1,7
1 1 #include "rmapoperations.h"
2 2
3 RMAP::RMAP(RMAP_command_codes commandCode, char targetLogicalAddress, char initiatorLogicalAddress, int startAddress, int nbBytes, char* data)
3 RMAP::RMAP(RMAP_command_codes commandCode, unsigned char targetLogicalAddress, unsigned char initiatorLogicalAddress,
4 int startAddress, int nbBytes, char* data)
4 5 {
5 6 char packetType; // 2 most Significant Bits
6 7 char command; // 4 bits
@@ -37,9 +38,9 RMAP::RMAP(RMAP_command_codes commandCod
37 38 break;
38 39 }
39 40 RMAPHeader.targetLogicalAddress = targetLogicalAddress ;
40 RMAPHeader.protocolIdentifier = 0x01; // 0x01 is the protocole identifier for RMAP
41 RMAPHeader.protocolIdentifier = 0x01; // 0x01 is the protocole identifier for RMAP
41 42 RMAPHeader.instruction = (packetType<<6) + (command<<2) + (replyAddressLength);
42 RMAPHeader.key = 0; // used for command authorization
43 RMAPHeader.key = initiatorLogicalAddress; // used for command authorization
43 44 RMAPHeader.initiatorLogicalAddress = initiatorLogicalAddress; // 0 is the default address for the GRESB module
44 45 RMAPHeader.transactionIdentifier1 = 0x00;
45 46 RMAPHeader.transactionIdentifier0 = 0x01;
@@ -9,7 +9,9
9 9 #define RMAP_READ_COMMAND_HEADER_LENGTH 16 // in bytes => ECSS
10 10 #define RMAP_DATA_CRC_LENGTH 1 // in bytes => ECSS
11 11 #define RMAP_MAX_PACKET_LENGTH RMAP_READ_REPLY_HEADER_LENGTH + RMAP_MAX_DATA_LENGTH + RMAP_DATA_CRC_LENGTH
12 #define CCSDS_MAX_PACKET_LENGTH 4412 // in bytes, specified in the LFR Software Requirements Specification
12
13 #define DEFAULT_SOURCE 0
14 #define DEFAULT_TARGET 254
13 15
14 16 static const unsigned char RMAP_CRCTable[] = {
15 17 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75,
@@ -71,9 +73,9 struct rmap_command_format_str
71 73 char targetLogicalAddress;
72 74 char protocolIdentifier;
73 75 char instruction;
74 char key; // used for command authorization => check Gaisler GRSPW for compliance
76 unsigned char key; // used for command authorization => check Gaisler GRSPW for compliance
75 77 //char replyAddress[]; // not needed if logical addressing is used (replyAddressLength = 0b00)
76 char initiatorLogicalAddress;
78 unsigned char initiatorLogicalAddress;
77 79 char transactionIdentifier1;
78 80 char transactionIdentifier0;
79 81 char extendedAddress;
@@ -132,8 +134,8 class RMAP
132 134 {
133 135 public:
134 136 RMAP(RMAP_command_codes commandCode,
135 char targetLogicalAddress,
136 char initiatorLogicalAddress,
137 unsigned char targetLogicalAddress,
138 unsigned char initiatorLogicalAddress,
137 139 int startAddress,
138 140 int nbBytes,
139 141 char *data);
@@ -24,6 +24,8
24 24 #include <QIODevice>
25 25 #include <QApplication>
26 26 #include <rmappluginpythonwrapper.h>
27 #include <PythonQt.h>
28 #include <QTimer>
27 29
28 30 rmapplugin::rmapplugin(QWidget *parent)
29 31 :lppmonplugin(parent,false)
@@ -37,11 +39,38 rmapplugin::rmapplugin(QWidget *parent)
37 39 time_FINE = 0;
38 40 currentBridge = selectedBridgeIsUnknown;
39 41
40 /*Python wrapper*/
42 //**************
43 //Python wrapper
41 44 this->pyObject = new rmappluginPythonWrapper();
42 45 connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
43 46 connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
44 /*==============*/
47 //**
48 connect( (rmappluginPythonWrapper*)this->pyObject, SIGNAL( WriteSPWSig(char*,uint,char,char) ),
49 this, SLOT( WriteSPW(char*,uint,char,char)), Qt::DirectConnection );
50 //**
51 connect( (rmappluginPythonWrapper*)this->pyObject, SIGNAL( updateTargetAddress(unsigned char) ),
52 this, SLOT( setValueTargetAddress(unsigned char)) );
53 //**
54 connect( (rmappluginPythonWrapper*)this->pyObject, SIGNAL( updateSourceAddress(unsigned char) ),
55 this, SLOT( setValueSourceAddress(unsigned char)) );
56 //**
57 connect( (rmappluginPythonWrapper*)this->pyObject, SIGNAL(sendMessage(QString)),
58 this, SLOT(displayOnConsole(QString)) );
59 //**
60 connect( (rmappluginPythonWrapper*)this->pyObject, SIGNAL(fetchPacketSig()),
61 this, SLOT(fetchPacket()), Qt::DirectConnection );
62 //**************
63
64 //**************
65 // get a smart pointer to the __main__ module of the Python interpreter
66 PythonQtObjectPtr context = PythonQt::self()->getMainModule();
67 // add a QObject as variable of name "BUTTON_rmapOpenCommunication" to the namespace of the __main__ module
68 context.addObject("BUTTON_rmapOpenCommunication", UI->rmapOpenCommunicationButton);
69 context.addObject("BUTTON_rmapCloseCommunication", UI->rmapCloseCommunicationButton);
70 context.addObject("BUTTON_selectStarDundee", UI->selectStarDundee_BUTTON);
71 context.addObject("BUTTON_selectGRESB", UI->selectGRESB_BUTTON);
72 context.addObject("GRESB_Bridge", UI->gresbBridge);
73 //**************
45 74
46 75 connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(openBridge()));
47 76 connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(closeBridge()));
@@ -64,6 +93,12 rmapplugin::rmapplugin(QWidget *parent)
64 93 connect(this->UI->gresbBridge, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)),
65 94 this, SLOT(processCCSDSPacket(unsigned char*,uint)));
66 95 connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->gresbBridge, SLOT(ccsdsPacketIsProcessed()));
96 connect(this->UI->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)),
97 this->UI->gresbBridge, SLOT(targetHasChanged(int)));
98 connect(this->UI->rmapSourceLogicalAddressSpinBox, SIGNAL(valueChanged(int)),
99 this->UI->gresbBridge, SLOT(sourceHasChanged(int)));
100 connect(this->UI->gresbBridge, SIGNAL(packetStoreNotEmpty()),
101 this, SLOT(processPacketStore()));
67 102
68 103 // Star Dundee
69 104 connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
@@ -73,15 +108,32 rmapplugin::rmapplugin(QWidget *parent)
73 108 connect(this->UI->starDundee, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)),
74 109 this, SLOT(processCCSDSPacket(unsigned char*,uint)));
75 110 connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->starDundee, SLOT(ccsdsPacketIsProcessed()));
111 connect(this->UI->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)),
112 this->UI->starDundee, SLOT(targetHasChanged(int)));
113 connect(this->UI->rmapSourceLogicalAddressSpinBox, SIGNAL(valueChanged(int)),
114 this->UI->starDundee, SLOT(sourceHasChanged(int)));
115 connect(this->UI->starDundee, SIGNAL(packetStoreNotEmpty()),
116 this, SLOT(processPacketStore()));
76 117
77 118 connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(bridgeHasChanged(selectedBridge)));
119 connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(updatePacketStore(selectedBridge)));
120
78 121 }
79 122
80 123 rmapplugin::~rmapplugin()
81 124 {
82 if (!RMAPSend_SOCKET->isOpen()) RMAPSend_SOCKET->disconnectFromHost();
83 if (!RMAPReceive_SOCKET->isOpen()) RMAPReceive_SOCKET->disconnectFromHost();
84 if (!GRESBStatusQuery_SOCKET->isOpen()) GRESBStatusQuery_SOCKET->disconnectFromHost();
125 switch(currentBridge)
126 {
127 case selectedBridgeIsGRESB :
128 if (RMAPSend_SOCKET->isOpen()) RMAPSend_SOCKET->disconnectFromHost();
129 if (RMAPReceive_SOCKET->isOpen()) RMAPReceive_SOCKET->disconnectFromHost();
130 if (GRESBStatusQuery_SOCKET->isOpen()) GRESBStatusQuery_SOCKET->disconnectFromHost();
131 break;
132 case selectedBridgeIsStarDundee :
133 break;
134 default:
135 break;
136 }
85 137 }
86 138
87 139 unsigned int rmapplugin::Write(unsigned int *Value, unsigned int count, unsigned int address)
@@ -279,6 +331,16 void rmapplugin::appendToLog(QString tex
279 331 APPENDTOLOG(text);
280 332 }
281 333
334 void rmapplugin::setValueTargetAddress(unsigned char newAddress)
335 {
336 this->UI->rmapTargetLogicalAddressSpinBox->setValue(newAddress);
337 }
338
339 void rmapplugin::setValueSourceAddress(unsigned char newAddress)
340 {
341 this->UI->rmapSourceLogicalAddressSpinBox->setValue(newAddress);
342 }
343
282 344 /////////////////////
283 345 // INTERNAL FUNCTIONS
284 346
@@ -311,6 +373,44 void rmapplugin::processCCSDSPacket(unsi
311 373 //+" "
312 374 //+ QString::number(ccsdsPacket[7], 16));
313 375 displayOnConsole(message);
376 //((rmappluginPythonWrapper*)this->pyObject)->storeCCSDSPacket(ccsdsPacket, size);
314 377 emit ccsdsPacketIsProcessed();
315 378 }
316 379
380 void rmapplugin::processPacketStore()
381 {
382 ((rmappluginPythonWrapper*)this->pyObject)->processPacketStore();
383 }
384
385 void rmapplugin::updatePacketStore(selectedBridge bridge)
386 {
387 switch(bridge)
388 {
389 case selectedBridgeIsGRESB :
390 ((rmappluginPythonWrapper*)this->pyObject)->ccsdsPacketStore = &(this->UI->gresbBridge->ccsdsPacketStore);
391 break;
392 case selectedBridgeIsStarDundee :
393 ((rmappluginPythonWrapper*)this->pyObject)->ccsdsPacketStore = &(this->UI->starDundee->ccsdsPacketStore);
394 break;
395 default:
396 break;
397 }
398 }
399
400 int rmapplugin::fetchPacket()
401 {
402 int ret = 0;
403
404 switch(currentBridge)
405 {
406 case selectedBridgeIsGRESB :
407 break;
408 case selectedBridgeIsStarDundee :
409 ret = this->UI->starDundee->receiveSPWPacketLoop();
410 break;
411 default:
412 break;
413 }
414
415 return ret;
416 }
@@ -54,9 +54,14 public slots:
54 54 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
55 55 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
56 56 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
57 void setValueTargetAddress(unsigned char newAddress);
58 void setValueSourceAddress(unsigned char newAddress);
57 59 void openBridge();
58 60 void closeBridge();
59 61 void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size);
62 void processPacketStore();
63 void updatePacketStore(selectedBridge bridge);
64 int fetchPacket();
60 65 //
61 66 void sendCCSDS();
62 67 void send_TC_LFR_UPDATE_TIME();
@@ -20,8 +20,8 DEFINES += driver_PID=0
20 20
21 21 QT += network
22 22
23 LIBS += ../spw_usb_driver_v2.61/lib/x86_64/libSpaceWireUSBAPI.so \
24 ../spw_usb_driver_v2.61/lib/x86_64/libConfigLibraryUSB.so
23 LIBS += ../spw_usb_driver_v2.62/lib/x86_64/libSpaceWireUSBAPI.so \
24 ../spw_usb_driver_v2.62/lib/x86_64/libConfigLibraryUSB.so
25 25
26 26
27 27 INCLUDEPATH += \
@@ -43,7 +43,8 HEADERS += \
43 43 ../spw_usb_driver_v2.61/inc/spw_usb_api.h \
44 44 ../spw_usb_driver_v2.61/inc/spw_config_library.h \
45 45 gresb.h \
46 bridge.h
46 tcpackettosend.h \
47 tmpackettoread.h
47 48
48 49
49 50 SOURCES += \
@@ -57,7 +58,8 SOURCES += \
57 58 rmappluginpythonwrapper.cpp \
58 59 stardundee.cpp \
59 60 gresb.cpp \
60 bridge.cpp
61 tcpackettosend.cpp \
62 tmpackettoread.cpp
61 63
62 64
63 65
@@ -1,19 +1,165
1 1 #include "rmappluginpythonwrapper.h"
2 2 #include <math.h>
3 #include <QApplication>
3 4
4 5 rmappluginPythonWrapper::rmappluginPythonWrapper(QObject *parent) :
5 6 genericPySysdriver(parent)
6 7 {
8 timer = new QTimer;
9 timer->setSingleShot(true);
10 connect(timer, SIGNAL(timeout()), this, SLOT(sendTC()));
11 connect(this, SIGNAL(activateTCLoopSig()), this, SLOT(sendTCLoop()));
12 }
13
14 QList<QVariant> rmappluginPythonWrapper::ReadSPW(unsigned int size) // size is not used
15 {
16 QList<QVariant> result;
17 TMPacketToRead *ccsdsPacket;
18
19 if (!ccsdsPacketStore->isEmpty())
20 {
21 ccsdsPacket = ccsdsPacketStore->takeFirst();
22 for(unsigned int i = 0;i<ccsdsPacket->size;i++)
23 {
24 result.append((QVariant)ccsdsPacket->Value[i]);
25 }
26 delete(ccsdsPacket);
27 }
28
29 return result;
30 }
31
32 void rmappluginPythonWrapper::WriteSPW(QList<int> dataList)
33 {
34 char targetLogicalAddress;
35 char userApplication;
36 unsigned int count;
37 char *Value;
38
39 unsigned char data[dataList.count()];
40
41 for(int i = 0; i<dataList.count(); i++) // get the data as unsigned char
42 {
43 data[i] = (unsigned char)dataList.at(i);
44 }
45 // read the first bytes of the data to get the targetLogicalAddress and the userApplication parameters
46 targetLogicalAddress = data[0];
47 userApplication = data[3];
48
49 count = dataList.count() - 4; // the CCSDS header (4 bytes) is added by LPPMON
50 Value = (char*) &data[4];
51
52 emit WriteSPWSig(Value, count, targetLogicalAddress, userApplication);
53 }
54
55 void rmappluginPythonWrapper::WriteSPWDelay(QList<int> dataList, unsigned int delay)
56 {
57 char targetLogicalAddress;
58 char userApplication;
59 unsigned int count;
60 char *Value;
61 TCPacketToSend *packet;
62
63 unsigned char data[dataList.count()];
64
65 for(int i = 0; i<dataList.count(); i++) // get the data as unsigned char
66 {
67 data[i] = (unsigned char)dataList.at(i);
68 }
69 // read the first bytes of the data to get the targetLogicalAddress and the userApplication parameters
70 targetLogicalAddress = data[0];
71 userApplication = data[3];
72
73 count = dataList.count() - 4; // the CCSDS header (4 bytes) is added by LPPMON
74 Value = (char*) &data[4];
75
76 packet = new TCPacketToSend(Value, count, targetLogicalAddress, userApplication, delay);
77 TCPacketStore.append(packet);
78
79 emit(activateTCLoopSig());
80
7 81 }
8 82
83 void rmappluginPythonWrapper::processPacketStoreLater(unsigned int delay)
84 {
85 emit sendMessage(
86 "*** process packet store in " + QString::number(delay) + " ms"
87 );
88 QTimer::singleShot(delay, this, SLOT(sendProcessPacketStoreNowSig()));
89 }
9 90
10 QList<QVariant> rmappluginPythonWrapper::getData()
91 void rmappluginPythonWrapper::sendTCLoop()
11 92 {
12 QList<QVariant> data;
13 for (int i = 0; i<1024; i++)
93 unsigned int delay;
94
95 if (!timer->isActive())
96 {
97 if (!TCPacketStore.isEmpty())
98 {
99 delay = TCPacketStore.at(0)->delay;
100 timer->setInterval(delay);
101 timer->start();
102 }
103 }
104 }
105
106 void rmappluginPythonWrapper::sendTC()
107 {
108 TCPacketToSend *packet;
109 unsigned int delay;
110
111 packet = TCPacketStore.takeFirst();
112 // the signal is connected with the option Qt::DirectConnection, thus it is processed immediately
113 emit(WriteSPWSig(packet->Value, packet->count,packet->targetLogicalAddress, packet->userApplication));
114 delete(packet);
115 if (!TCPacketStore.isEmpty())
14 116 {
15 QVariant t(1000*cos(0.1*i));
16 data.append(t);
117 delay = TCPacketStore.at(0)->delay;
118 timer->setInterval(delay);
119 timer->start();
120 }
121 }
122
123 /*unsigned int rmappluginPythonWrapper::storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size)
124 {
125 unsigned int i;
126 TMPacketToRead ccsdsPacketToStore;
127
128 ccsdsPacketToStore.size = size;
129 for(i=0; i<size; i++)
130 {
131 //ccsdsPacket0[i] = ccsdsPacket[i];
132 ccsdsPacketToStore.data[i] = ccsdsPacket[i];
17 133 }
18 return data;
134 ccsdsPacketStore->append(ccsdsPacketToStore);
135 emit ccsdsPacketIsAvailable(size);
136 return 1;
137 }*/
138
139 void rmappluginPythonWrapper::processPacketStore()
140 {
141 while (!ccsdsPacketStore->isEmpty())
142 {
143 emit ccsdsPacketIsAvailable(ccsdsPacketStore->at(0)->size);
144 }
19 145 }
146
147 void rmappluginPythonWrapper::setTargetAddressValue(unsigned int address)
148 {
149 unsigned char newAddress;
150 newAddress = (unsigned char) address;
151 emit updateTargetAddress(newAddress);
152 }
153
154 void rmappluginPythonWrapper::setSourceAddressValue(unsigned int address)
155 {
156 unsigned char newAddress;
157 newAddress = (unsigned char) address;
158 emit updateSourceAddress(newAddress);
159 }
160
161 void rmappluginPythonWrapper::ProcessPendingEvents()
162 {
163 QCoreApplication::processEvents();
164 }
165
@@ -5,17 +5,52
5 5 #include <genericPySysdriver.h>
6 6 #include <QList>
7 7 #include <QVariant>
8 #include "rmapoperations.h"
9 #include "ccsds.h"
10 #include <tcpackettosend.h>
11 #include <tmpackettoread.h>
12 #include <QTimer>
8 13
9 14 class rmappluginPythonWrapper : public genericPySysdriver
10 15 {
11 16 Q_OBJECT
12 17 public:
13 18 explicit rmappluginPythonWrapper(QObject *parent = 0);
19
20 QList<TMPacketToRead*> *ccsdsPacketStore;
21 void processPacketStore();
22 unsigned int storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size);
23
24 QList<TCPacketToSend*> TCPacketStore;
25 QTimer *timer;
14 26
15 27 signals:
28 void ccsdsPacketIsAvailable(unsigned int size);
29 void wakeUpCallingThread();
30 unsigned int WriteSPWSig(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
31 void updateTargetAddress(unsigned char newAddress);
32 void updateSourceAddress(unsigned char newAddress);
33 void activateTCLoopSig();
34 void processPacketStoreNowSig();
35 void sendMessage(QString message);
36 int fetchPacketSig();
16 37
17 38 public slots:
18 QList<QVariant> getData();
39 QList<QVariant> ReadSPW(unsigned int size=0);
40 int fetchPacket() {return emit fetchPacketSig();}
41 void WriteSPW(QList<int> dataList);
42 void WriteSPWDelay(QList<int> dataList, unsigned int delay=0);
43 void processPacketStoreLater(unsigned int delay);
44 void sendProcessPacketStoreNowSig(){emit processPacketStoreNowSig();}
45 void sendTCLoop();
46 void sendTC();
47 void reEmitWriteSPWSig(char *Value, unsigned int count, char targetLogicalAddress, char userApplication)
48 {emit WriteSPWSig(Value, count, targetLogicalAddress, userApplication);}
49
50 void setTargetAddressValue(unsigned int address);
51 void setSourceAddressValue(unsigned int address);
52 void ProcessPendingEvents();
53 void BlockAllSignals();
19 54
20 55 };
21 56
@@ -55,6 +55,7 rmapPluginUI::rmapPluginUI(QWidget *pare
55 55 gresbStatusQueryLabel = new QLabel(tr("Status query socket (port 3010): waiting for connection"));
56 56 gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running"));
57 57 sendCCSDSCommandLabel = new QLabel(tr("Address of the target"));
58 nbPacketInStore = new QLabel(tr("nb packets in store: -"));
58 59
59 60 //*** QPUSHBUTTON ***//
60 61 rmapOpenCommunicationButton = new QPushButton(tr("Open selected bridge"));
@@ -81,18 +82,18 rmapPluginUI::rmapPluginUI(QWidget *pare
81 82 gresbVirtualLinkSpinBox->setRange(0, 4);
82 83 gresbVirtualLinkSpinBox->setValue(1);
83 84 rmapSourceLogicalAddressSpinBox->setRange(0, 255);
84 rmapSourceLogicalAddressSpinBox->setValue(33);
85 rmapSourceLogicalAddressSpinBox->setValue(0);
85 86 rmapTargetLogicalAddressSpinBox->setRange(0, 255);
86 87 spwLinkSpinBox->setRange(0, 2);
87 88 spwLinkSpinBox->setValue(0);
88 89 CCSDSTargetLogicalAddressSpinBox->setRange(0,255);
89 CCSDSTargetLogicalAddressSpinBox->setValue(254);
90 CCSDSTargetLogicalAddressSpinBox->setValue(0);
90 91
91 92 //*** MISC **//
92 93 starDundee = new StarDundee;
93 94 gresbBridge = new gresb;
94 95 console = new QTextEdit;
95 gresbBridgeIPDialogBox = new QIPDialogBox;
96 //gresbBridgeIPDialogBox = new QIPDialogBox;
96 97 gresbStatusQueryDialog = new QDialog;
97 98 logEnableCheckBox = new QCheckBox(tr("Enable Logs"));
98 99 RMAP_write_verify = new QCheckBox(tr("data checked before write\nlimited to 4 bytes\nNOT IMPLEMENTED"));
@@ -112,13 +113,16 rmapPluginUI::rmapPluginUI(QWidget *pare
112 113
113 114 generalParameters_LAYOUT->addWidget(logEnableCheckBox, 0, 0, 1, 1);
114 115 generalParameters_LAYOUT->addWidget(logFileChooseButton, 0, 1, 1, 1);
115 generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressLabel, 1, 0, 0);
116 generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressSpinBox, 1, 1, 0);
117 generalParameters_LAYOUT->addWidget(rmapOpenCommunicationButton, 2, 0, 1, 1);
118 generalParameters_LAYOUT->addWidget(rmapCloseCommunicationButton, 2, 1, 1, 1);
119 generalParameters_LAYOUT->addWidget(RMAP_write_verify, 3, 0, 1, 2);
120 generalParameters_LAYOUT->addWidget(RMAP_write_reply, 4, 0, 1, 2);
121 generalParameters_LAYOUT->setRowStretch(5, 1);
116 generalParameters_LAYOUT->addWidget(rmapSourceLogicalAddressLabel, 1, 0, 0);
117 generalParameters_LAYOUT->addWidget(rmapSourceLogicalAddressSpinBox, 1, 1, 0);
118 generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressLabel, 2, 0, 0);
119 generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressSpinBox, 2, 1, 0);
120 generalParameters_LAYOUT->addWidget(rmapOpenCommunicationButton, 3, 0, 1, 1);
121 generalParameters_LAYOUT->addWidget(rmapCloseCommunicationButton, 3, 1, 1, 1);
122 generalParameters_LAYOUT->addWidget(RMAP_write_verify, 4, 0, 1, 2);
123 generalParameters_LAYOUT->addWidget(RMAP_write_reply, 5, 0, 1, 2);
124
125 generalParameters_LAYOUT->setRowStretch(6, 1);
122 126 generalParameters_LAYOUT->setColumnStretch(2, 1);
123 127
124 128 gresb_GROUPBOX->setLayout(gresbBridge->layout());
@@ -140,6 +144,7 rmapPluginUI::rmapPluginUI(QWidget *pare
140 144
141 145 consoleLayout->addWidget(console);
142 146 consoleLayout->addWidget(clearConsoleButton);
147 consoleLayout->addWidget(nbPacketInStore);
143 148
144 149 connect(this->logFileChooseButton, SIGNAL(clicked()), this, SLOT(chooseLogFile()));
145 150 connect(this, SIGNAL(setLogFileName(QString)), this->logFileName, SLOT(setText(QString)));
@@ -168,8 +173,10 rmapPluginUI::rmapPluginUI(QWidget *pare
168 173 connect(this->starDundee, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool)));
169 174 connect(this->gresbBridge, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool)));
170 175
176 connect(this->rmapSourceLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->gresbBridge, SLOT(sourceHasChanged(int)));
177 connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->gresbBridge, SLOT(targetHasChanged(int)));
178 connect(this->rmapSourceLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->starDundee, SLOT(sourceHasChanged(int)));
171 179 connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->starDundee, SLOT(targetHasChanged(int)));
172 connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->gresbBridge, SLOT(targetHasChanged(int)));
173 180
174 181 // command code
175 182 connect(this->RMAP_write_reply, SIGNAL(clicked()), this, SLOT(getCommandCode()));
@@ -180,7 +187,8 rmapPluginUI::rmapPluginUI(QWidget *pare
180 187 this->gresbBridge, SLOT(commandCodeHasChanged(RMAP_command_codes)));
181 188
182 189 getCommandCode(); // init the command code value
183 rmapTargetLogicalAddressSpinBox->setValue(254);
190 rmapSourceLogicalAddressSpinBox->setValue(DEFAULT_SOURCE);
191 rmapTargetLogicalAddressSpinBox->setValue(DEFAULT_TARGET);
184 192 }
185 193
186 194 rmapPluginUI::~rmapPluginUI()
@@ -81,7 +81,7 public:
81 81 QSpinBox* rmapTargetLogicalAddressSpinBox;
82 82 QSpinBox* CCSDSTargetLogicalAddressSpinBox;
83 83
84 QIPDialogBox* gresbBridgeIPDialogBox;
84 //QIPDialogBox* gresbBridgeIPDialogBox;
85 85
86 86 QCheckBox *logEnableCheckBox;
87 87 QCheckBox *RMAP_write_verify;
@@ -92,6 +92,7 public:
92 92 QLabel* gresbStatusQueryLabel;
93 93 QLabel* gresbStatusQueryDialogLabel;
94 94 QLabel* sendCCSDSCommandLabel;
95 QLabel* nbPacketInStore;
95 96
96 97 QDialog* gresbStatusQueryDialog;
97 98
@@ -101,8 +102,8 public:
101 102
102 103 QTextEdit* console;
103 104
105 // SPACEWIRE BRIDGES
104 106 StarDundee *starDundee;
105
106 107 gresb *gresbBridge;
107 108
108 109 bool islogfileenable();
@@ -124,6 +125,7 signals:
124 125 void commandCodeHasChanged(RMAP_command_codes commandCode);
125 126 void bridgeHasChanged(selectedBridge bridge);
126 127 void targetHasChanged(unsigned char target);
128 void sourceHasChanged(unsigned char source);
127 129
128 130 private:
129 131 QLabel *gresbBridgeIPLabel;
@@ -1,6 +1,7
1 1 #include "stardundee.h"
2 2 #include <QTime>
3 3 #include <math.h>
4 #include "ccsds.h"
4 5
5 6 StarDundee::StarDundee(QWidget *parent) :
6 7 QWidget(parent)
@@ -16,13 +17,13 StarDundee::StarDundee(QWidget *parent)
16 17 starDundeeStatusQueryDialog = new QDialog;
17 18
18 19 commandCode = invalid0; // initialization of the cmmand code for the RMAP transfers
20 rmapTargetLogicalAddress = DEFAULT_TARGET;
21 rmapSourceLogicalAddress = DEFAULT_SOURCE;
19 22
20 rmapSourceLogicalAddress = 0x20;
21 23 connection_LAYOUT = new QGridLayout;
22 24
23 25 usbDeviceNumber_LABEL = new QLabel(tr("USB device number: "));
24 26 linkNumber_LABEL = new QLabel(tr("SpaceWire link number: "));
25 sourceLogicalAddress_LABEL = new QLabel(tr("Source logical address: "));
26 27 starDundeeStatusQueryDialogLabel = new QLabel(tr("SpaceWire link not running"));
27 28
28 29 //*** QPUSHBUTTON ***//
@@ -35,9 +36,6 StarDundee::StarDundee(QWidget *parent)
35 36 linkNumber_SPINBOX = new QSpinBox;
36 37 linkNumber_SPINBOX->setRange(1,2);
37 38 linkNumber_SPINBOX->setValue(1);
38 sourceLogicalAddress_SPINBOX = new QSpinBox;
39 sourceLogicalAddress_SPINBOX->setRange(0,254);
40 sourceLogicalAddress_SPINBOX->setValue(32);
41 39
42 40 // STAR DUNDEE STATUS QUERY DIALOG
43 41 starDundeeStatusQueryDialogLayout = new QGridLayout;
@@ -50,21 +48,16 StarDundee::StarDundee(QWidget *parent)
50 48 connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 0, 1, 1, 1);
51 49 connection_LAYOUT->addWidget(linkNumber_LABEL, 1, 0, 1, 1);
52 50 connection_LAYOUT->addWidget(linkNumber_SPINBOX, 1, 1, 1, 1);
53 connection_LAYOUT->addWidget(sourceLogicalAddress_LABEL, 2, 0, 1, 1);
54 connection_LAYOUT->addWidget(sourceLogicalAddress_SPINBOX, 2, 1, 1, 1);
55 51
56 connection_LAYOUT->setRowStretch(3, 1);
52 connection_LAYOUT->setRowStretch(2, 1);
57 53 connection_LAYOUT->setColumnStretch(2, 1);
58 54
59 55 this->setLayout(connection_LAYOUT);
60 56
61 connect(this->sourceLogicalAddress_SPINBOX, SIGNAL(valueChanged(int)), this, SLOT(sourceHasChanged(int)));
62
63 57 connect(starDundeeStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink()));
64 58 connect(starDundeeStatusQueryAbortButton, SIGNAL(clicked()), starDundeeStatusQueryDialog, SLOT(reject()));
65 59
66 60 connect(this->timer, SIGNAL(timeout()), this, SLOT(receivePollingLoop()));
67 timer->start(100); // starts the periodical timer, perdio = 100ms
68 61 }
69 62
70 63 StarDundee::~StarDundee()
@@ -82,14 +75,14 void StarDundee::Open()
82 75
83 76 if (!USBSpaceWire_Open(&hDevice, usbDeviceNumber_SPINBOX->value())) // Open the USB device
84 77 {
85 emit sendMessage("stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))");
86 return;
78 emit sendMessage("stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))");
79 return;
87 80 }
88 81 emit sendMessage("stardundee *** Open *** USBSpaceWire_Open successful, device number: "
89 82 + QString::number(usbDeviceNumber_SPINBOX->value()));
90 83
91 84 USBSpaceWire_EnableNetworkMode(hDevice, 0); // deactivate the network mode
92 CFGSpaceWire_EnableRMAP(1); // Enable the use of RMAP
85 CFGSpaceWire_EnableRMAP(1); // Enable the use of RMAP for the StarDundee brick configuration
93 86 CFGSpaceWire_SetRMAPDestinationKey(0x20); // Set the destination key expected by STAR-Dundee devices
94 87
95 88 // Set the path and return path to the device
@@ -129,15 +122,27 void StarDundee::Open()
129 122 else emit sendMessage("Set the link status control for link " + QString::number(linkNumber_SPINBOX->value()));
130 123 }
131 124
132 setRoutingTableEntry(rmapTargetLogicalAddress, (1<<linkNumber_SPINBOX->value()));
133 setRoutingTableEntry(sourceLogicalAddress_SPINBOX->value(), (1<<3));
134 //setRoutingTableEntry(33, (1<<3));
125 if (CFGSpaceWire_SetAsInterface(hDevice, 1, 0) != CFG_TRANSFER_SUCCESS)
126 {
127 emit sendMessage("Could not set the device to be an interface");
128 }
129 else
130 {
131 emit sendMessage("Device set to be an interface");
132 }
135 133
136 emit sendMessage("The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes");
134 //setRoutingTableEntry(rmapTargetLogicalAddress, (1<<linkNumber_SPINBOX->value()));
135 //setRoutingTableEntry(rmapSourceLogicalAddress, (1<<3));
136 //GetRoutingTableEntry(rmapTargetLogicalAddress);
137 //GetRoutingTableEntry(rmapSourceLogicalAddress);
137 138
138 139 USBSpaceWire_RegisterReceiveOnAllPorts(hDevice); // Register to receive on all ports
139 140 USBSpaceWire_ClearEndpoints(hDevice); // clear the USB endpoints
140 141
142 emit sendMessage("The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes");
143 emit sendMessage("The driver's current read buffer size is " + QString::number(USBSpaceWire_GetDriverReadBufferSize(hDevice)) + " bytes");
144 emit sendMessage("USBSpaceWire_IsReadThrottling is " + QString::number(USBSpaceWire_IsReadThrottling(hDevice)));
145
141 146 // initialize SPW packet semaphores
142 147 while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire();
143 148 while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire();
@@ -145,10 +150,11 void StarDundee::Open()
145 150 if (getLinkStatus(linkNumber_SPINBOX->value()))
146 151 {
147 152 emit isOpen(true);
153 timer->start(100); // starts the periodical timer, period = 100ms
148 154 }
149 155 else
150 156 {
151
157 starDundeeStatusQueryDialog->exec();
152 158 }
153 159 }
154 160
@@ -162,21 +168,35 void StarDundee::Close()
162 168 emit isOpen(false);
163 169 }
164 170
165 unsigned int StarDundee::GetRoutingTableEntry()
171 unsigned char StarDundee::setRoutingTableEntry(int tableEntry, U32 dwOutputPorts)
172 {
173 U32 routingTableEntry;
174 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET entryNumber
175 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
176 {
177 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
178 }
179 // Build the routing table entry
180 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
181 dwOutputPorts, // route out of port dwOutputPorts
182 0, // header deletion disabled
183 0); // priority normal
184 // Set the routing table entry for logical address tableEntry
185 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
186 {
187 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
188 }
189 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
190 return 1;
191 }
192
193 unsigned int StarDundee::GetRoutingTableEntry(int tableEntry)
166 194 {
167 195 U32 routingTableEntry, outputPorts;
168 196 char enabled, delHead, priority;
169 197 int portNum;
170 int tableEntry;
171 198
172 tableEntry = rmapTargetLogicalAddress;
173
174 // Set the path and return path to the device
175 CFGSpaceWire_StackClear();
176 CFGSpaceWire_AddrStackPush(0);
177 CFGSpaceWire_AddrStackPush(254);
178 CFGSpaceWire_RetAddrStackPush(254);
179
199 emit sendMessage("GetRoutingTableEntry [" + QString::number(tableEntry) + "]");
180 200 // Read the routing table entry
181 201 if (CFGSpaceWire_GetRoutingTableEntry(hDevice, tableEntry, &routingTableEntry) != CFG_TRANSFER_SUCCESS)
182 202 {
@@ -343,8 +363,8 unsigned int StarDundee::WriteBLOCK(char
343 363 {
344 364 RMAP *RMAPCommand;
345 365 char * packet;
366 char* aux;
346 367 unsigned char offset, headerSize, CRCSize;
347 char* aux;
348 368 unsigned int totalSize;
349 369 int errorCode;
350 370 QString console_message;
@@ -366,16 +386,17 unsigned int StarDundee::WriteBLOCK(char
366 386
367 387 //*************************
368 388 // BUILD THE PACKET TO SEND
369 totalSize = headerSize + nbBytes + CRCSize;
389 totalSize = headerSize + nbBytes + CRCSize + PATH_ADDRESSING_OFFSET;
370 390 packet = (char*) malloc( totalSize );
371 391 aux = (char*) ((void*) &RMAPCommand->RMAPHeader);
372 for(unsigned int i = 0; i<headerSize; i++) packet[i] = aux[i];
392 packet[0] = this->linkNumber_SPINBOX->value();
393 for(unsigned int i = 0; i<headerSize; i++) packet[i+PATH_ADDRESSING_OFFSET] = aux[i];
373 394 offset = headerSize;
374 395 for(unsigned int i = 0; i<nbBytes; i++)
375 396 {
376 packet[i+offset] = data[i];
397 packet[i+offset+PATH_ADDRESSING_OFFSET] = data[i];
377 398 }
378 packet[nbBytes+offset] = RMAPCommand->dataCRC;
399 packet[nbBytes+offset+PATH_ADDRESSING_OFFSET] = RMAPCommand->dataCRC;
379 400
380 401 //****************
381 402 // SEND THE PACKET
@@ -480,7 +501,10 unsigned int StarDundee::ReadBLOCK(unsig
480 501 {
481 502 int errorCode;
482 503 RMAP *RMAPCommand;
483 unsigned int dataLength;
504 char *packet;
505 char *aux;
506 unsigned int dataLength = 0;
507 unsigned int totalSize = 0;
484 508
485 509 //**********************
486 510 // Check the link status
@@ -511,12 +535,39 unsigned int StarDundee::ReadBLOCK(unsig
511 535 nbBytes,
512 536 NULL);
513 537 }
538
539 //*************************
540 // BUILD THE PACKET TO SEND
541 totalSize = sizeof(RMAPCommand->RMAPHeader) + PATH_ADDRESSING_OFFSET;
542 packet = (char*) malloc( totalSize );
543 aux = (char*) ((void*) &RMAPCommand->RMAPHeader);
544 packet[0] = this->linkNumber_SPINBOX->value();
545 for (unsigned int i = 0; i<sizeof(RMAPCommand->RMAPHeader); i++)
546 packet[i+PATH_ADDRESSING_OFFSET] = aux[i];
547
548 //****************
549 // SEND THE PACKET
514 550 result = USBSpaceWire_SendPacket(hDevice,
515 (unsigned char*) ((void*) &RMAPCommand->RMAPHeader),
516 sizeof(RMAPCommand->RMAPHeader),
551 packet,
552 totalSize,
517 553 BWAIT_1, &pIdentifier);
518 554 if (result != TRANSFER_SUCCESS) emit sendMessage("ERR *** ReadStarDundee *** ReadBLOCK *** sending the READ command ");
519 else emit sendMessage("OK *** ReadStarDundee *** ReadBLOCK *** sending the READ command");
555 else
556 {
557 emit sendMessage("OK *** ReadStarDundee *** ReadBLOCK *** sending the READ command");
558 emit appendToLog("packet sent, B0 = " + QString::number(packet[0], 16)
559 + " *** B1 = " + QString::number(packet[1], 16)
560 + " *** B2 = " + QString::number(packet[2], 16)
561 + " *** B3 = " + QString::number(packet[3], 16)
562 + " *** B4 = " + QString::number(packet[4], 16)
563 + " *** B5 = " + QString::number(packet[5], 16)
564 );
565 }
566
567 //**************
568 // Free the send
569 USBSpaceWire_FreeSend(hDevice, pIdentifier);
570 free(packet);
520 571
521 572 //*********************************
522 573 // RECEIVE THE INCOMING RMAP PACKET
@@ -561,20 +612,21 unsigned int StarDundee::WriteSPW(char *
561 612 return 1;
562 613 }
563 614
564 totalSize = count + 4;
615 totalSize = count + 4 + PATH_ADDRESSING_OFFSET; // The StarDundee brick is in PATH addressing
565 616 SPWData = (char*) malloc(totalSize);
566 617 // SPW HEADER
567 SPWData[0] = targetLogicalAddress;
568 SPWData[1] = protocoleIdentifier;
569 SPWData[2] = reserved;
570 SPWData[3] = userApplication;
618 SPWData[0] = this->linkNumber_SPINBOX->value(); // 1 by default, value can be 1 or 2
619 SPWData[0+PATH_ADDRESSING_OFFSET] = targetLogicalAddress;
620 SPWData[1+PATH_ADDRESSING_OFFSET] = protocoleIdentifier;
621 SPWData[2+PATH_ADDRESSING_OFFSET] = reserved;
622 SPWData[3+PATH_ADDRESSING_OFFSET] = userApplication;
571 623 // CCSDS PACKET
572 624 for (unsigned int i = 0; i<count; i++)
573 625 {
574 SPWData[i+4] = Value[i];
626 SPWData[i+4+PATH_ADDRESSING_OFFSET] = Value[i];
575 627 }
576 628
577 //************
629 //****************
578 630 // SEND THE PACKET
579 631 result = USBSpaceWire_SendPacket(hDevice,
580 632 SPWData,
@@ -588,7 +640,21 unsigned int StarDundee::WriteSPW(char *
588 640 free(SPWData);
589 641 return 0;
590 642 }
591 else emit sendMessage("OK *** WriteSPW when sending packet of size " + QString::number(totalSize));
643 else emit sendMessage("OK *** WriteSPW when sending packet of size " + QString::number(totalSize-1));
644 emit appendToLog("packet sent, B0 = " + QString::number(SPWData[0])
645 + " *** B1 = " + QString::number(SPWData[1])
646 + " *** B2 = " + QString::number(SPWData[2])
647 + " *** B3 = " + QString::number(SPWData[3])
648 + " *** B4 = " + QString::number(SPWData[4])
649 + " *** B5 = " + QString::number(SPWData[5])
650 + " *** B6 = " + QString::number(SPWData[6])
651 + " *** B7 = " + QString::number(SPWData[7])
652 + " *** B8 = " + QString::number(SPWData[8])
653 + " *** B9 = " + QString::number(SPWData[9])
654 + " *** B10 = " + QString::number(SPWData[10])
655 + " *** B11 = " + QString::number(SPWData[11])
656 + " *** B12 = " + QString::number(SPWData[12])
657 );
592 658
593 659 //**************
594 660 // Free the send
@@ -651,6 +717,30 unsigned int StarDundee::getLinkStatus(u
651 717 else return 0;
652 718 }
653 719
720 void StarDundee::receivePollingLoop()
721 {
722 timer->blockSignals(true);
723 if (USBSpaceWire_WaitOnReadPacketAvailable(hDevice, 0)) receiveSPWPacketLoop(0);
724 timer->blockSignals(false);
725 }
726
727 int StarDundee::receiveSPWPacketLoop(unsigned char requestID)
728 {
729 int result = 0;
730 emit appendToLog("Number of packets dropped by the driver: " +
731 QString::number(USBSpaceWire_GetDriverDroppedPackets(hDevice)));
732
733 while (USBSpaceWire_WaitOnReadPacketAvailable(hDevice, 0))
734 {
735 result = receiveSPWPacket(requestID);
736 }
737 if (!ccsdsPacketStore.isEmpty())
738 {
739 emit packetStoreNotEmpty();
740 }
741 return result;
742 }
743
654 744 int StarDundee::receiveSPWPacket(unsigned char requestID) // SLOT
655 745 {
656 746 unsigned int packetLength;
@@ -670,16 +760,30 int StarDundee::receiveSPWPacket(unsigne
670 760 // TRY TO RECEIVE DATA
671 761 nbBytes = qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH); // maximum size of the packet to receive
672 762 nPacketNum = 1;
673 result = USBSpaceWire_ReadPackets(hDevice, spwPacket, nbBytes, nPacketNum, BWAIT_1, &properties, &pIdentifier);
763 result = USBSpaceWire_ReadPackets(hDevice, spwPacket, nbBytes, nPacketNum, BWAIT_1, &properties, &pIdentifierRead);
674 764 if (result != TRANSFER_SUCCESS)
675 765 {
676 766 emit sendMessage("Error: Could not receive the packet");
767 USBSpaceWire_FreeRead(hDevice, pIdentifierRead); // Free the read buffer
677 768 return 0;
678 769 }
679 770 else
680 771 {
681 772 packetLength = properties.len;
682 USBSpaceWire_FreeRead(hDevice, pIdentifier); // Free the receive
773 if (properties.eop == SPACEWIRE_USB_NO_EOP)
774 {
775 emit appendToLog("No end of packet marker received");
776 }
777 else if (properties.eop == SPACEWIRE_USB_EOP)
778 {
779 emit appendToLog("Normal end of packet marker received");
780 }
781 else if (properties.eop == SPACEWIRE_USB_EEP)
782 {
783 emit appendToLog("Error end of packet marker received");
784 }
785
786 USBSpaceWire_FreeRead(hDevice, pIdentifierRead); // Free the read buffer
683 787 }
684 788
685 789 switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet
@@ -690,45 +794,57 int StarDundee::receiveSPWPacket(unsigne
690 794 rmapPacketSize = packetLength;
691 795 rmapPacketSEMAPHORE->release();
692 796 emit appendToLog("RMAP packet of size " + QString::number(packetLength) + " received");
797 emit appendToLog("packet received, B0 = " + QString::number(spwPacket[0], 16)
798 + " *** B1 = " + QString::number(spwPacket[1], 16)
799 + " *** B2 = " + QString::number(spwPacket[2], 16)
800 + " *** B3 = " + QString::number(spwPacket[3], 16)
801 + " *** B4 = " + QString::number(spwPacket[4], 16)
802 + " *** B5 = " + QString::number(spwPacket[5], 16)
803 );
693 804 return packetLength;
694 805
695 806 case 2: // 0x02 is the protocole identifier for CCSDS packets
696 if (ccsdsPacketSEMAPHORE->available()!=0) return -4; // ERROR === previous CCSDS packet not processed yet
807 if (ccsdsPacketSEMAPHORE->available()!=0)
808 {
809 emit sendMessage("in function [receiveSPWPacket] === ERROR === previous CCSDS packet not processed yet");
810 return -4; // ERROR === previous CCSDS packet not processed yet
811 }
697 812 for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i];
698 813 ccsdsPacketSize = packetLength;
699 ccsdsPacketSEMAPHORE->release();
814 //ccsdsPacketSEMAPHORE->release();
815 //emit(ccsdsPacketAvailable(ccsdsPacket, packetLength));
700 816 emit appendToLog("CCSDS packet of size " + QString::number(packetLength) + " received");
701 emit(ccsdsPacketAvailable(ccsdsPacket, packetLength));
817 emit appendToLog("packet received, byte0 " + QString::number(spwPacket[0], 16)
818 + " *** byte1 " + QString::number(spwPacket[1], 16)
819 + " *** byte2 " + QString::number(spwPacket[2], 16)
820 + " *** byte3 " + QString::number(spwPacket[3], 16));
821 storeCCSDSPacket(ccsdsPacket, packetLength);
702 822 return packetLength;
823 default:
824 emit appendToLog("packet received, byte0 " + QString::number(spwPacket[0], 16)
825 + " *** byte1 " + QString::number(spwPacket[1], 16)
826 + " *** byte2 " + QString::number(spwPacket[2], 16)
827 + " *** byte3 " + QString::number(spwPacket[3], 16));
828 return 0;
703 829 }
704 830 return 0;
705 831 }
706 832
707 void StarDundee::receivePollingLoop()
833 unsigned int StarDundee::storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size)
708 834 {
709 timer->blockSignals(true);
710 if (USBSpaceWire_WaitOnReadPacketAvailable(hDevice, 0)) receiveSPWPacket(0);
711 timer->blockSignals(false);
835 TMPacketToRead *packet;
836
837 packet = new TMPacketToRead(ccsdsPacket, size);
838 ccsdsPacketStore.append(packet);
839
840 return 1;
712 841 }
713 842
714 unsigned char StarDundee::setRoutingTableEntry(int tableEntry, U32 dwOutputPorts)
843 void StarDundee::reTestSPWLink() // SLOT
715 844 {
716 U32 routingTableEntry;
717 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET entryNumber
718 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
845 if (getLinkStatus(linkNumber_SPINBOX->value()))
719 846 {
720 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
847 emit isOpen(true);
848 starDundeeStatusQueryDialog->accept();
721 849 }
722 // Build the routing table entry
723 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
724 dwOutputPorts, // route out of port dwOutputPorts
725 0, // header deletion disabled
726 0); // priority normal
727 // Set the routing table entry for logical address tableEntry
728 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
729 {
730 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
731 }
732 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
733
734 850 }
@@ -13,9 +13,12
13 13 #include "rmapoperations.h"
14 14 #include "spw_usb_api.h"
15 15 #include "spw_config_library.h"
16 #include "ccsds.h"
17 #include "tmpackettoread.h"
16 18
17 19 #define BWAIT_0 0
18 20 #define BWAIT_1 1
21 #define PATH_ADDRESSING_OFFSET 1
19 22
20 23 class StarDundee : public QWidget
21 24 {
@@ -27,23 +30,28 public:
27 30 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
28 31 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
29 32
33 unsigned int storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size);
34 QList<TMPacketToRead*> ccsdsPacketStore;
35
30 36 signals:
31 37 void sendMessage(QString message);
32 38 void isOpen(bool);
33 39 void RMAP_write_reply_setText(QString);
34 40 void appendToLog(QString);
35 41 void ccsdsPacketAvailable(unsigned char*, unsigned int);
42 void packetStoreNotEmpty();
36 43
37 44 public slots:
38 45 void Open();
39 46 void Close();
40 int receiveSPWPacket(unsigned char requestID);
47 void reTestSPWLink();
48 int receiveSPWPacketLoop(unsigned char requestID=0);
49 int receiveSPWPacket(unsigned char requestID=0);
41 50 void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
42 51 void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
52 void sourceHasChanged(int source) {rmapSourceLogicalAddress = (unsigned char) source;}
43 53 void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();}
44 void reTestSPWLink() {getLinkStatus(linkNumber_SPINBOX->value());}
45 54 //
46 void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;}
47 55 void receivePollingLoop();
48 56
49 57 private:
@@ -54,7 +62,7 private:
54 62 unsigned char setRoutingTableEntry(int tableEntry, U32 dwOutputPorts);
55 63
56 64 unsigned int getLinkStatus(unsigned char link);
57 unsigned int GetRoutingTableEntry();
65 unsigned int GetRoutingTableEntry(int tableEntry);
58 66
59 67 unsigned char rmapTargetLogicalAddress ;
60 68 unsigned char rmapSourceLogicalAddress ;
@@ -63,12 +71,10 private:
63 71
64 72 QLabel *usbDeviceNumber_LABEL;
65 73 QLabel *linkNumber_LABEL;
66 QLabel *sourceLogicalAddress_LABEL;
67 74 QLabel *starDundeeStatusQueryDialogLabel;
68 75
69 76 QSpinBox *usbDeviceNumber_SPINBOX;
70 77 QSpinBox *linkNumber_SPINBOX;
71 QSpinBox *sourceLogicalAddress_SPINBOX;
72 78
73 79 QGridLayout *connection_LAYOUT;
74 80 QGridLayout *starDundeeStatusQueryDialogLayout;
@@ -80,8 +86,9 private:
80 86
81 87 QTimer *timer;
82 88
83 unsigned char pBuffer[10]; // Pointer to the start of the user buffer from which to transmit data
84 USB_SPACEWIRE_ID pIdentifier; // A pointer to a variable which will be set to contain a unique identifier for the send
89 unsigned char pBuffer[10]; // Pointer to the start of the user buffer from which to transmit data
90 USB_SPACEWIRE_ID pIdentifierRead; // A pointer to a variable which will be set to contain a unique identifier for the read
91 USB_SPACEWIRE_ID pIdentifier;
85 92
86 93 star_device_handle hDevice; // Handle to the SpaceWire device
87 94 USB_SPACEWIRE_STATUS result; // The result of the send operation
General Comments 0
You need to be logged in to leave comments. Login now