@@ -1,6 +1,6 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: PAULs_LPPMON_PLUGINS |
|
2 | # Makefile for building: PAULs_LPPMON_PLUGINS | |
3 |
# Generated by qmake (2.01a) (Qt 4.8. |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.4) on: Tue Mar 5 08:11:23 2013 | |
4 | # Project: PAULs_LPPMON_PLUGINS.pro |
|
4 | # Project: PAULs_LPPMON_PLUGINS.pro | |
5 | # Template: subdirs |
|
5 | # Template: subdirs | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro |
@@ -1,6 +1,6 | |||||
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, 201 |
|
3 | <!-- Written by Qt Creator 2.4.1, 2013-03-21T08:38:26. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -59,11 +59,21 void QIPDialogBox::valueChanged() // SLO | |||||
59 | gresbIP.append(addressPart3->cleanText()); |
|
59 | gresbIP.append(addressPart3->cleanText()); | |
60 | gresbIP.append("."); |
|
60 | gresbIP.append("."); | |
61 | gresbIP.append(addressPart4->cleanText()); |
|
61 | gresbIP.append(addressPart4->cleanText()); | |
62 | //labelGRESBIP->setText("IP used for the gresb module: " + gresbIP); |
|
|||
63 | } |
|
62 | } | |
64 |
|
63 | |||
65 |
QString QIPDialogBox::get |
|
64 | QString QIPDialogBox::getIP() | |
66 | { |
|
65 | { | |
67 | return(gresbIP); |
|
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 | Q_OBJECT |
|
11 | Q_OBJECT | |
12 | public: |
|
12 | public: | |
13 | explicit QIPDialogBox(QWidget *parent = 0); |
|
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 | signals: |
|
16 | signals: | |
17 |
|
17 | |||
18 | public slots: |
|
18 | public slots: | |
19 | void valueChanged(); |
|
19 | void valueChanged(); | |
|
20 | QString getIP(); | |||
20 |
|
21 | |||
21 | private: |
|
22 | private: | |
22 | QSpinBox *addressPart1; |
|
23 | QSpinBox *addressPart1; |
@@ -1,6 +1,6 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: librmapplugin.so.1.0.0 |
|
2 | # Makefile for building: librmapplugin.so.1.0.0 | |
3 |
# Generated by qmake (2.01a) (Qt 4.8. |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.4) on: Tue Mar 19 07:43:19 2013 | |
4 | # Project: rmapplugin.pro |
|
4 | # Project: rmapplugin.pro | |
5 | # Template: lib |
|
5 | # Template: lib | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro | |
@@ -10,13 +10,13 | |||||
10 |
|
10 | |||
11 | CC = gcc |
|
11 | CC = gcc | |
12 | CXX = g++ |
|
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_TRANSLATION_PATH="\"/etc/lppmon/translations\"" -DLPPMONPLUGIN_LIBRARY -DQT_NO_DEBUG -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 -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 | 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) |
|
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 | 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) |
|
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 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include -I. -I../common_PLE -I../spw_usb_driver_v2.61/inc -I/usr/include/lppmon/pluginsInterface -I/usr/include/PythonQt -Imoc |
|
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 | LINK = g++ |
|
17 | LINK = g++ | |
18 | LFLAGS = -Wl,-O1 -Wl,-z,relro -shared -Wl,-soname,librmapplugin.so.1 |
|
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 -lQtGui -lQtNetwork -lQtCore -lpthread |
|
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 | |
20 | AR = ar cqs |
|
20 | AR = ar cqs | |
21 | RANLIB = |
|
21 | RANLIB = | |
22 | QMAKE = /usr/bin/qmake-qt4 |
|
22 | QMAKE = /usr/bin/qmake-qt4 | |
@@ -53,7 +53,7 SOURCES = rmapplugin.cpp \ | |||||
53 | rmappluginpythonwrapper.cpp \ |
|
53 | rmappluginpythonwrapper.cpp \ | |
54 | stardundee.cpp \ |
|
54 | stardundee.cpp \ | |
55 | gresb.cpp \ |
|
55 | gresb.cpp \ | |
56 | bridge.cpp \ |
|
56 | tcpackettosend.cpp \ | |
57 | /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp moc/moc_rmappluginui.cpp \ |
|
57 | /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp moc/moc_rmappluginui.cpp \ | |
58 | moc/moc_rmapplugin.cpp \ |
|
58 | moc/moc_rmapplugin.cpp \ | |
59 | moc/moc_qipdialogbox.cpp \ |
|
59 | moc/moc_qipdialogbox.cpp \ | |
@@ -62,7 +62,7 SOURCES = rmapplugin.cpp \ | |||||
62 | moc/moc_rmappluginpythonwrapper.cpp \ |
|
62 | moc/moc_rmappluginpythonwrapper.cpp \ | |
63 | moc/moc_stardundee.cpp \ |
|
63 | moc/moc_stardundee.cpp \ | |
64 | moc/moc_gresb.cpp \ |
|
64 | moc/moc_gresb.cpp \ | |
65 |
moc/moc_ |
|
65 | moc/moc_tcpackettosend.cpp \ | |
66 | moc/moc_genericPySysdriver.cpp \ |
|
66 | moc/moc_genericPySysdriver.cpp \ | |
67 | moc/moc_lppmonplugin.cpp |
|
67 | moc/moc_lppmonplugin.cpp | |
68 | OBJECTS = obj/rmapplugin.o \ |
|
68 | OBJECTS = obj/rmapplugin.o \ | |
@@ -75,7 +75,7 OBJECTS = obj/rmapplugin.o \ | |||||
75 | obj/rmappluginpythonwrapper.o \ |
|
75 | obj/rmappluginpythonwrapper.o \ | |
76 | obj/stardundee.o \ |
|
76 | obj/stardundee.o \ | |
77 | obj/gresb.o \ |
|
77 | obj/gresb.o \ | |
78 | obj/bridge.o \ |
|
78 | obj/tcpackettosend.o \ | |
79 | obj/lppmonplugininterface.o \ |
|
79 | obj/lppmonplugininterface.o \ | |
80 | obj/moc_rmappluginui.o \ |
|
80 | obj/moc_rmappluginui.o \ | |
81 | obj/moc_rmapplugin.o \ |
|
81 | obj/moc_rmapplugin.o \ | |
@@ -85,7 +85,7 OBJECTS = obj/rmapplugin.o \ | |||||
85 | obj/moc_rmappluginpythonwrapper.o \ |
|
85 | obj/moc_rmappluginpythonwrapper.o \ | |
86 | obj/moc_stardundee.o \ |
|
86 | obj/moc_stardundee.o \ | |
87 | obj/moc_gresb.o \ |
|
87 | obj/moc_gresb.o \ | |
88 |
obj/moc_ |
|
88 | obj/moc_tcpackettosend.o \ | |
89 | obj/moc_genericPySysdriver.o \ |
|
89 | obj/moc_genericPySysdriver.o \ | |
90 | obj/moc_lppmonplugin.o |
|
90 | obj/moc_lppmonplugin.o | |
91 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
91 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
@@ -195,8 +195,9 Makefile: rmapplugin.pro /usr/lib64/qt4 | |||||
195 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
195 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
196 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
196 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
197 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
197 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ | |
|
198 | /usr/lib64/libQtXml.prl \ | |||
|
199 | /usr/lib64/libQtCore.prl \ | |||
198 | /usr/lib64/libQtGui.prl \ |
|
200 | /usr/lib64/libQtGui.prl \ | |
199 | /usr/lib64/libQtCore.prl \ |
|
|||
200 | /usr/lib64/libQtNetwork.prl |
|
201 | /usr/lib64/libQtNetwork.prl | |
201 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro |
|
202 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro | |
202 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
203 | /usr/lib64/qt4/mkspecs/common/unix.conf: | |
@@ -225,15 +226,16 Makefile: rmapplugin.pro /usr/lib64/qt4 | |||||
225 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
226 | /usr/lib64/qt4/mkspecs/features/yacc.prf: | |
226 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
227 | /usr/lib64/qt4/mkspecs/features/lex.prf: | |
227 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
228 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: | |
|
229 | /usr/lib64/libQtXml.prl: | |||
|
230 | /usr/lib64/libQtCore.prl: | |||
228 | /usr/lib64/libQtGui.prl: |
|
231 | /usr/lib64/libQtGui.prl: | |
229 | /usr/lib64/libQtCore.prl: |
|
|||
230 | /usr/lib64/libQtNetwork.prl: |
|
232 | /usr/lib64/libQtNetwork.prl: | |
231 | qmake: FORCE |
|
233 | qmake: FORCE | |
232 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro |
|
234 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro | |
233 |
|
235 | |||
234 | dist: |
|
236 | dist: | |
235 | @$(CHK_DIR_EXISTS) obj/rmapplugin1.0.0 || $(MKDIR) obj/rmapplugin1.0.0 |
|
237 | @$(CHK_DIR_EXISTS) obj/rmapplugin1.0.0 || $(MKDIR) obj/rmapplugin1.0.0 | |
236 |
$(COPY_FILE) --parents $(SOURCES) $(DIST) obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmappluginui.h rmapplugin.h rmapoperations.h ccsds.h ../common_PLE/qipdialogbox.h ../common_PLE/gresbstatusenquiry.h spectralmatricesdmasimulator.h rmappluginpythonwrapper.h stardundee.h ../spw_usb_driver_v2.61/inc/spw_usb_api.h ../spw_usb_driver_v2.61/inc/spw_config_library.h gresb.h |
|
238 | $(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 /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 tcpackettosend.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 | |
237 |
|
239 | |||
238 |
|
240 | |||
239 | clean:compiler_clean |
|
241 | clean:compiler_clean | |
@@ -255,12 +257,13 mocclean: compiler_moc_header_clean comp | |||||
255 |
|
257 | |||
256 | mocables: compiler_moc_header_make_all compiler_moc_source_make_all |
|
258 | mocables: compiler_moc_header_make_all compiler_moc_source_make_all | |
257 |
|
259 | |||
258 |
compiler_moc_header_make_all: moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_ |
|
260 | 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_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp | |
259 | compiler_moc_header_clean: |
|
261 | compiler_moc_header_clean: | |
260 |
-$(DEL_FILE) moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_ |
|
262 | -$(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_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp | |
261 | moc/moc_rmappluginui.cpp: rmapoperations.h \ |
|
263 | moc/moc_rmappluginui.cpp: rmapoperations.h \ | |
262 | spectralmatricesdmasimulator.h \ |
|
264 | spectralmatricesdmasimulator.h \ | |
263 | stardundee.h \ |
|
265 | stardundee.h \ | |
|
266 | ccsds.h \ | |||
264 | gresb.h \ |
|
267 | gresb.h \ | |
265 | rmappluginui.h |
|
268 | rmappluginui.h | |
266 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginui.h -o moc/moc_rmappluginui.cpp |
|
269 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginui.h -o moc/moc_rmappluginui.cpp | |
@@ -269,8 +272,8 moc/moc_rmapplugin.cpp: rmappluginui.h \ | |||||
269 | rmapoperations.h \ |
|
272 | rmapoperations.h \ | |
270 | spectralmatricesdmasimulator.h \ |
|
273 | spectralmatricesdmasimulator.h \ | |
271 | stardundee.h \ |
|
274 | stardundee.h \ | |
|
275 | ccsds.h \ | |||
272 | gresb.h \ |
|
276 | gresb.h \ | |
273 | ccsds.h \ |
|
|||
274 | rmapplugin.h |
|
277 | rmapplugin.h | |
275 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmapplugin.h -o moc/moc_rmapplugin.cpp |
|
278 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmapplugin.h -o moc/moc_rmapplugin.cpp | |
276 |
|
279 | |||
@@ -283,20 +286,23 moc/moc_gresbstatusenquiry.cpp: ../commo | |||||
283 | moc/moc_spectralmatricesdmasimulator.cpp: spectralmatricesdmasimulator.h |
|
286 | moc/moc_spectralmatricesdmasimulator.cpp: spectralmatricesdmasimulator.h | |
284 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) spectralmatricesdmasimulator.h -o moc/moc_spectralmatricesdmasimulator.cpp |
|
287 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) spectralmatricesdmasimulator.h -o moc/moc_spectralmatricesdmasimulator.cpp | |
285 |
|
288 | |||
286 |
moc/moc_rmappluginpythonwrapper.cpp: rmap |
|
289 | moc/moc_rmappluginpythonwrapper.cpp: rmapoperations.h \ | |
|
290 | ccsds.h \ | |||
|
291 | rmappluginpythonwrapper.h | |||
287 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginpythonwrapper.h -o moc/moc_rmappluginpythonwrapper.cpp |
|
292 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginpythonwrapper.h -o moc/moc_rmappluginpythonwrapper.cpp | |
288 |
|
293 | |||
289 | moc/moc_stardundee.cpp: rmapoperations.h \ |
|
294 | moc/moc_stardundee.cpp: rmapoperations.h \ | |
|
295 | ccsds.h \ | |||
290 | stardundee.h |
|
296 | stardundee.h | |
291 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) stardundee.h -o moc/moc_stardundee.cpp |
|
297 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) stardundee.h -o moc/moc_stardundee.cpp | |
292 |
|
298 | |||
293 | moc/moc_gresb.cpp: rmapoperations.h \ |
|
299 | moc/moc_gresb.cpp: rmapoperations.h \ | |
|
300 | ccsds.h \ | |||
294 | gresb.h |
|
301 | gresb.h | |
295 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) gresb.h -o moc/moc_gresb.cpp |
|
302 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) gresb.h -o moc/moc_gresb.cpp | |
296 |
|
303 | |||
297 | moc/moc_bridge.cpp: rmapoperations.h \ |
|
304 | moc/moc_tcpackettosend.cpp: tcpackettosend.h | |
298 | bridge.h |
|
305 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) tcpackettosend.h -o moc/moc_tcpackettosend.cpp | |
299 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) bridge.h -o moc/moc_bridge.cpp |
|
|||
300 |
|
306 | |||
301 | moc/moc_genericPySysdriver.cpp: /usr/include/genericPySysdriver.h |
|
307 | moc/moc_genericPySysdriver.cpp: /usr/include/genericPySysdriver.h | |
302 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/genericPySysdriver.h -o moc/moc_genericPySysdriver.cpp |
|
308 | /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/genericPySysdriver.h -o moc/moc_genericPySysdriver.cpp | |
@@ -328,8 +334,8 obj/rmapplugin.o: rmapplugin.cpp rmapplu | |||||
328 | rmapoperations.h \ |
|
334 | rmapoperations.h \ | |
329 | spectralmatricesdmasimulator.h \ |
|
335 | spectralmatricesdmasimulator.h \ | |
330 | stardundee.h \ |
|
336 | stardundee.h \ | |
|
337 | ccsds.h \ | |||
331 | gresb.h \ |
|
338 | gresb.h \ | |
332 | ccsds.h \ |
|
|||
333 | rmappluginpythonwrapper.h |
|
339 | rmappluginpythonwrapper.h | |
334 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmapplugin.o rmapplugin.cpp |
|
340 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmapplugin.o rmapplugin.cpp | |
335 |
|
341 | |||
@@ -338,8 +344,8 obj/rmappluginui.o: rmappluginui.cpp rma | |||||
338 | rmapoperations.h \ |
|
344 | rmapoperations.h \ | |
339 | spectralmatricesdmasimulator.h \ |
|
345 | spectralmatricesdmasimulator.h \ | |
340 | stardundee.h \ |
|
346 | stardundee.h \ | |
341 |
|
|
347 | ccsds.h \ | |
342 | ccsds.h |
|
348 | gresb.h | |
343 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginui.o rmappluginui.cpp |
|
349 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginui.o rmappluginui.cpp | |
344 |
|
350 | |||
345 | obj/rmapoperations.o: rmapoperations.cpp rmapoperations.h |
|
351 | obj/rmapoperations.o: rmapoperations.cpp rmapoperations.h | |
@@ -357,20 +363,24 obj/gresbstatusenquiry.o: ../common_PLE/ | |||||
357 | obj/spectralmatricesdmasimulator.o: spectralmatricesdmasimulator.cpp spectralmatricesdmasimulator.h |
|
363 | obj/spectralmatricesdmasimulator.o: spectralmatricesdmasimulator.cpp spectralmatricesdmasimulator.h | |
358 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spectralmatricesdmasimulator.o spectralmatricesdmasimulator.cpp |
|
364 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spectralmatricesdmasimulator.o spectralmatricesdmasimulator.cpp | |
359 |
|
365 | |||
360 | obj/rmappluginpythonwrapper.o: rmappluginpythonwrapper.cpp rmappluginpythonwrapper.h |
|
366 | obj/rmappluginpythonwrapper.o: rmappluginpythonwrapper.cpp rmappluginpythonwrapper.h \ | |
|
367 | rmapoperations.h \ | |||
|
368 | ccsds.h \ | |||
|
369 | tcpackettosend.h | |||
361 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginpythonwrapper.o rmappluginpythonwrapper.cpp |
|
370 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginpythonwrapper.o rmappluginpythonwrapper.cpp | |
362 |
|
371 | |||
363 | obj/stardundee.o: stardundee.cpp stardundee.h \ |
|
372 | obj/stardundee.o: stardundee.cpp stardundee.h \ | |
364 | rmapoperations.h |
|
373 | rmapoperations.h \ | |
|
374 | ccsds.h | |||
365 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/stardundee.o stardundee.cpp |
|
375 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/stardundee.o stardundee.cpp | |
366 |
|
376 | |||
367 | obj/gresb.o: gresb.cpp gresb.h \ |
|
377 | obj/gresb.o: gresb.cpp gresb.h \ | |
368 | rmapoperations.h |
|
378 | rmapoperations.h \ | |
|
379 | ccsds.h | |||
369 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresb.o gresb.cpp |
|
380 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresb.o gresb.cpp | |
370 |
|
381 | |||
371 | obj/bridge.o: bridge.cpp bridge.h \ |
|
382 | obj/tcpackettosend.o: tcpackettosend.cpp tcpackettosend.h | |
372 | rmapoperations.h |
|
383 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/tcpackettosend.o tcpackettosend.cpp | |
373 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/bridge.o bridge.cpp |
|
|||
374 |
|
384 | |||
375 | obj/lppmonplugininterface.o: /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.h \ |
|
385 | obj/lppmonplugininterface.o: /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.h \ | |
376 | /usr/include/lppmon/pluginsInterface/lppmonplugininterface_global.h |
|
386 | /usr/include/lppmon/pluginsInterface/lppmonplugininterface_global.h | |
@@ -400,8 +410,8 obj/moc_stardundee.o: moc/moc_stardundee | |||||
400 | obj/moc_gresb.o: moc/moc_gresb.cpp |
|
410 | obj/moc_gresb.o: moc/moc_gresb.cpp | |
401 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_gresb.o moc/moc_gresb.cpp |
|
411 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_gresb.o moc/moc_gresb.cpp | |
402 |
|
412 | |||
403 |
obj/moc_ |
|
413 | obj/moc_tcpackettosend.o: moc/moc_tcpackettosend.cpp | |
404 |
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_ |
|
414 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_tcpackettosend.o moc/moc_tcpackettosend.cpp | |
405 |
|
415 | |||
406 | obj/moc_genericPySysdriver.o: moc/moc_genericPySysdriver.cpp |
|
416 | obj/moc_genericPySysdriver.o: moc/moc_genericPySysdriver.cpp | |
407 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_genericPySysdriver.o moc/moc_genericPySysdriver.cpp |
|
417 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_genericPySysdriver.o moc/moc_genericPySysdriver.cpp |
@@ -1,6 +1,15 | |||||
1 | #ifndef CCSDS_H |
|
1 | #ifndef CCSDS_H | |
2 | #define CCSDS_H |
|
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 | struct ccsds_telecommand_source_packet_hdr_str |
|
13 | struct ccsds_telecommand_source_packet_hdr_str | |
5 | { |
|
14 | { | |
6 | unsigned char packetId1; |
|
15 | unsigned char packetId1; |
@@ -16,12 +16,13 gresb::gresb(QWidget *parent) : | |||||
16 | 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) ); | |
17 |
|
17 | |||
18 | commandCode = invalid0; // initialization of the command code for the RMAP transfers |
|
18 | commandCode = invalid0; // initialization of the command code for the RMAP transfers | |
|
19 | rmapTargetLogicalAddress = DEFAULT_TARGET; | |||
|
20 | rmapSourceLogicalAddress = DEFAULT_SOURCE; | |||
19 |
|
21 | |||
20 | //*** QLABEL ***// |
|
22 | //*** QLABEL ***// | |
21 | gresbBridgeIPLabel = new QLabel(tr("GRESB Bridge IP: ")); |
|
23 | gresbBridgeIPLabel = new QLabel(tr("GRESB Bridge IP: ")); | |
22 | gresbVirtualLinkLabel = new QLabel(tr("GRESB Virtual Link: ")); |
|
24 | gresbVirtualLinkLabel = new QLabel(tr("GRESB Virtual Link: ")); | |
23 | spwLinkLabel = new QLabel(tr("GRESB SPW Link: ")); |
|
25 | spwLinkLabel = new QLabel(tr("GRESB SPW Link: ")); | |
24 | rmapSourceLogicalAddressLabel = new QLabel(tr("RMAP Source Logical Address: ")); |
|
|||
25 | rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection")); |
|
26 | rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection")); | |
26 | rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection")); |
|
27 | rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection")); | |
27 | gresbStatusQueryLabel = new QLabel(tr("GRESB status query socket (port 3010): waiting for connection")); |
|
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 | //*** SPINBOX ***// |
|
31 | //*** SPINBOX ***// | |
31 | gresbVirtualLinkSpinBox = new QSpinBox; |
|
32 | gresbVirtualLinkSpinBox = new QSpinBox; | |
32 | rmapSourceLogicalAddressSpinBox = new QSpinBox; |
|
|||
33 | spwLinkSpinBox = new QSpinBox;; |
|
33 | spwLinkSpinBox = new QSpinBox;; | |
34 | gresbVirtualLinkSpinBox->setRange(0, 4); |
|
34 | gresbVirtualLinkSpinBox->setRange(0, 4); | |
35 | gresbVirtualLinkSpinBox->setValue(1); |
|
35 | gresbVirtualLinkSpinBox->setValue(1); | |
36 | rmapSourceLogicalAddressSpinBox->setRange(0, 255); |
|
|||
37 | rmapSourceLogicalAddressSpinBox->setValue(33); |
|
|||
38 | spwLinkSpinBox->setRange(0, 2); |
|
36 | spwLinkSpinBox->setRange(0, 2); | |
39 | spwLinkSpinBox->setValue(0); |
|
37 | spwLinkSpinBox->setValue(0); | |
40 |
|
38 | |||
@@ -56,13 +54,11 gresb::gresb(QWidget *parent) : | |||||
56 | connectionLayout->addWidget(gresbVirtualLinkSpinBox, 1, 1, 0); |
|
54 | connectionLayout->addWidget(gresbVirtualLinkSpinBox, 1, 1, 0); | |
57 | connectionLayout->addWidget(spwLinkLabel, 2, 0, 0); |
|
55 | connectionLayout->addWidget(spwLinkLabel, 2, 0, 0); | |
58 | connectionLayout->addWidget(spwLinkSpinBox, 2, 1, 0); |
|
56 | connectionLayout->addWidget(spwLinkSpinBox, 2, 1, 0); | |
59 |
connectionLayout->addWidget(rmapS |
|
57 | connectionLayout->addWidget(rmapSendStateLabel, 3, 0, 1, 2); | |
60 |
connectionLayout->addWidget(rmap |
|
58 | connectionLayout->addWidget(rmapReceiveStateLabel, 4, 0, 1, 2); | |
61 |
connectionLayout->addWidget( |
|
59 | connectionLayout->addWidget(gresbStatusQueryLabel, 5, 0, 1, 2); | |
62 | connectionLayout->addWidget(rmapReceiveStateLabel, 5, 0, 1, 2); |
|
|||
63 | connectionLayout->addWidget(gresbStatusQueryLabel, 6, 0, 1, 2); |
|
|||
64 |
|
60 | |||
65 |
connectionLayout->setRowStretch( |
|
61 | connectionLayout->setRowStretch(6, 1); | |
66 | connectionLayout->setColumnStretch(2, 1); |
|
62 | connectionLayout->setColumnStretch(2, 1); | |
67 |
|
63 | |||
68 | // GRESB STATUS QUERY DIALOG |
|
64 | // GRESB STATUS QUERY DIALOG | |
@@ -80,7 +76,7 gresb::gresb(QWidget *parent) : | |||||
80 | connect(gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink())); |
|
76 | connect(gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink())); | |
81 | connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject())); |
|
77 | connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject())); | |
82 | connect(spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery())); |
|
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 | gresb::~gresb() |
|
82 | gresb::~gresb() | |
@@ -238,7 +234,7 unsigned int gresb::WriteBLOCK(char *dat | |||||
238 |
|
234 | |||
239 | RMAPCommand = new RMAP(commandCode, |
|
235 | RMAPCommand = new RMAP(commandCode, | |
240 | rmapTargetLogicalAddress, |
|
236 | rmapTargetLogicalAddress, | |
241 |
rmapSourceLogicalAddress |
|
237 | rmapSourceLogicalAddress, | |
242 | address, |
|
238 | address, | |
243 | nbBytes, |
|
239 | nbBytes, | |
244 | data); |
|
240 | data); | |
@@ -353,7 +349,7 unsigned int gresb::ReadBLOCK(unsigned i | |||||
353 | { |
|
349 | { | |
354 | RMAPCommand = new RMAP(read_Inc, |
|
350 | RMAPCommand = new RMAP(read_Inc, | |
355 | rmapTargetLogicalAddress, |
|
351 | rmapTargetLogicalAddress, | |
356 |
rmapSourceLogicalAddress |
|
352 | rmapSourceLogicalAddress, | |
357 | address, |
|
353 | address, | |
358 | nbBytes, |
|
354 | nbBytes, | |
359 | NULL); |
|
355 | NULL); | |
@@ -362,7 +358,7 unsigned int gresb::ReadBLOCK(unsigned i | |||||
362 | { |
|
358 | { | |
363 | RMAPCommand = new RMAP(read_Single, |
|
359 | RMAPCommand = new RMAP(read_Single, | |
364 | rmapTargetLogicalAddress, |
|
360 | rmapTargetLogicalAddress, | |
365 |
rmapSourceLogicalAddress |
|
361 | rmapSourceLogicalAddress, | |
366 | address, |
|
362 | address, | |
367 | nbBytes, |
|
363 | nbBytes, | |
368 | NULL); |
|
364 | NULL); | |
@@ -458,6 +454,20 unsigned int gresb::WriteSPW(char *Value | |||||
458 | return count; |
|
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 | int gresb::receiveSPWPacket(unsigned char requestID) // SLOT |
|
471 | int gresb::receiveSPWPacket(unsigned char requestID) // SLOT | |
462 | { |
|
472 | { | |
463 | QTime spwPacketReceiverTimeout; |
|
473 | QTime spwPacketReceiverTimeout; | |
@@ -508,31 +518,51 int gresb::receiveSPWPacket(unsigned cha | |||||
508 | return packetLength; |
|
518 | return packetLength; | |
509 |
|
519 | |||
510 | case 2: // 0x02 is the protocole identifier for CCSDS packets |
|
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 | for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i]; |
|
526 | for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i]; | |
513 | ccsdsPacketSize = packetLength; |
|
527 | ccsdsPacketSize = packetLength; | |
514 | ccsdsPacketSEMAPHORE->release(); |
|
528 | //ccsdsPacketSEMAPHORE->release(); | |
515 | emit(ccsdsPacketAvailable(ccsdsPacket, packetLength)); |
|
529 | //emit(ccsdsPacketAvailable(ccsdsPacket, packetLength)); | |
516 | //emit sendMessage("CCSDS packet of size " + QString::number(packetLength) + " received"); |
|
530 | //emit sendMessage("CCSDS packet of size " + QString::number(packetLength) + " received"); | |
|
531 | storeCCSDSPacket(ccsdsPacket, packetLength); | |||
517 | return packetLength; |
|
532 | return packetLength; | |
518 | } |
|
533 | } | |
519 | return 0; |
|
534 | return 0; | |
520 | } |
|
535 | } | |
521 |
|
536 | |||
|
537 | unsigned int gresb::storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size) | |||
|
538 | { | |||
|
539 | unsigned int i; | |||
|
540 | ccsdsPacketToProcess_t ccsdsPacketToStore; | |||
|
541 | ||||
|
542 | ccsdsPacketToStore.size = size; | |||
|
543 | for(i=0; i<size; i++) | |||
|
544 | { | |||
|
545 | ccsdsPacketToStore.data[i] = ccsdsPacket[i]; | |||
|
546 | } | |||
|
547 | ccsdsPacketStore << ccsdsPacketToStore; | |||
|
548 | //emit(ccsdsPacketAvailable(ccsdsPacket, packetLength)); | |||
|
549 | //emit ccsdsPacketIsAvailable(size); | |||
|
550 | return 1; | |||
|
551 | } | |||
|
552 | ||||
522 | void gresb::Open() // SLOT |
|
553 | void gresb::Open() // SLOT | |
523 | { |
|
554 | { | |
524 | bool spwRunning = true; |
|
555 | bool spwRunning = true; | |
525 |
RMAPSend_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->get |
|
556 | RMAPSend_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getIP()), | |
526 | 3000 + gresbVirtualLinkSpinBox->value()*2, |
|
557 | 3000 + gresbVirtualLinkSpinBox->value()*2, | |
527 | QIODevice::WriteOnly); |
|
558 | QIODevice::WriteOnly); | |
528 |
RMAPReceive_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->get |
|
559 | RMAPReceive_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getIP()), | |
529 | 3000 + gresbVirtualLinkSpinBox->value()*2+1, |
|
560 | 3000 + gresbVirtualLinkSpinBox->value()*2+1, | |
530 | QIODevice::ReadOnly); |
|
561 | QIODevice::ReadOnly); | |
531 |
GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->get |
|
562 | GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getIP()), | |
532 | 3010, |
|
563 | 3010, | |
533 | QIODevice::ReadWrite); |
|
564 | QIODevice::ReadWrite); | |
534 | GRESBStatusQuery_SOCKET->waitForConnected(10000); |
|
565 | GRESBStatusQuery_SOCKET->waitForConnected(10000); | |
535 | RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket |
|
|||
536 | // initialize SPW packet semaphores |
|
566 | // initialize SPW packet semaphores | |
537 | while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire(); |
|
567 | while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire(); | |
538 | while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire(); |
|
568 | while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire(); | |
@@ -543,7 +573,8 void gresb::Open() // SLOT | |||||
543 | if (spwRunning == false) this->Close(); |
|
573 | if (spwRunning == false) this->Close(); | |
544 | else |
|
574 | else | |
545 | { |
|
575 | { | |
546 |
emit appendToLog(QString("SpaceWire running on |
|
576 | emit appendToLog(QString("SpaceWire running on link ")+ QString::number(spwLinkSpinBox->value())); | |
|
577 | RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket | |||
547 | emit isOpen(true); |
|
578 | emit isOpen(true); | |
548 | } |
|
579 | } | |
549 | } |
|
580 | } | |
@@ -764,3 +795,4 void gresb::GRESBConnectionState(QAbstra | |||||
764 | } |
|
795 | } | |
765 | gresbStatusQueryLabel->setText(socketMessage); |
|
796 | gresbStatusQueryLabel->setText(socketMessage); | |
766 | } |
|
797 | } | |
|
798 |
@@ -13,6 +13,7 | |||||
13 | #include "gresbstatusenquiry.h" |
|
13 | #include "gresbstatusenquiry.h" | |
14 | #include "rmapoperations.h" |
|
14 | #include "rmapoperations.h" | |
15 | #include "qipdialogbox.h" |
|
15 | #include "qipdialogbox.h" | |
|
16 | #include "ccsds.h" | |||
16 |
|
17 | |||
17 | class gresb : public QWidget |
|
18 | class gresb : public QWidget | |
18 | { |
|
19 | { | |
@@ -23,6 +24,9 public: | |||||
23 | 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); | |
24 | 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); | |
25 | 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 | ||||
|
28 | unsigned int storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size); | |||
|
29 | QList<ccsdsPacketToProcess_t> ccsdsPacketStore; | |||
26 |
|
30 | |||
27 | signals: |
|
31 | signals: | |
28 | void sendMessage(QString message); |
|
32 | void sendMessage(QString message); | |
@@ -30,19 +34,25 signals: | |||||
30 | void RMAP_write_reply_setText(QString); |
|
34 | void RMAP_write_reply_setText(QString); | |
31 | void appendToLog(QString); |
|
35 | void appendToLog(QString); | |
32 | void ccsdsPacketAvailable(unsigned char*, unsigned int); |
|
36 | void ccsdsPacketAvailable(unsigned char*, unsigned int); | |
|
37 | void packetStoreNotEmpty(); | |||
33 |
|
38 | |||
34 | public slots: |
|
39 | public slots: | |
35 | void Open(); |
|
40 | void Open(); | |
36 | void Close(); |
|
41 | void Close(); | |
|
42 | int receiveSPWPacketLoop(unsigned char requestID=0); | |||
37 | int receiveSPWPacket(unsigned char requestID=0); |
|
43 | int receiveSPWPacket(unsigned char requestID=0); | |
38 | void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} |
|
44 | void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} | |
39 | void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} |
|
45 | void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} | |
|
46 | void sourceHasChanged(int source) {rmapSourceLogicalAddress = (unsigned char) source;} | |||
40 | void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();} |
|
47 | void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();} | |
41 | void reTestSPWLink(); |
|
48 | void reTestSPWLink(); | |
42 | // |
|
49 | // | |
43 | void RMAPSendConnectionState(QAbstractSocket::SocketState socketState); |
|
50 | void RMAPSendConnectionState(QAbstractSocket::SocketState socketState); | |
44 | void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState); |
|
51 | void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState); | |
45 | void GRESBConnectionState(QAbstractSocket::SocketState socketState); |
|
52 | void GRESBConnectionState(QAbstractSocket::SocketState socketState); | |
|
53 | // | |||
|
54 | void setIP(unsigned char address1, unsigned char address2, unsigned char address3, unsigned char address4) | |||
|
55 | {this->gresbBridgeIPDialogBox->setIP(address1, address2, address3, address4);} | |||
46 |
|
56 | |||
47 | private slots: |
|
57 | private slots: | |
48 | int GRESBStatusQuery(); |
|
58 | int GRESBStatusQuery(); | |
@@ -65,7 +75,6 private: | |||||
65 | QLabel *gresbBridgeIPLabel; |
|
75 | QLabel *gresbBridgeIPLabel; | |
66 | QLabel *gresbVirtualLinkLabel; |
|
76 | QLabel *gresbVirtualLinkLabel; | |
67 | QLabel *spwLinkLabel; |
|
77 | QLabel *spwLinkLabel; | |
68 | QLabel *rmapSourceLogicalAddressLabel; |
|
|||
69 | QLabel *rmapSendStateLabel; |
|
78 | QLabel *rmapSendStateLabel; | |
70 | QLabel *rmapReceiveStateLabel; |
|
79 | QLabel *rmapReceiveStateLabel; | |
71 | QLabel *gresbStatusQueryLabel; |
|
80 | QLabel *gresbStatusQueryLabel; | |
@@ -77,7 +86,6 private: | |||||
77 |
|
86 | |||
78 | QSpinBox *gresbVirtualLinkSpinBox; |
|
87 | QSpinBox *gresbVirtualLinkSpinBox; | |
79 | QSpinBox *spwLinkSpinBox; |
|
88 | QSpinBox *spwLinkSpinBox; | |
80 | QSpinBox *rmapSourceLogicalAddressSpinBox; |
|
|||
81 |
|
89 | |||
82 | QGridLayout *connectionLayout; |
|
90 | QGridLayout *connectionLayout; | |
83 | QGridLayout *gresbStatusQueryDialogLayout; |
|
91 | QGridLayout *gresbStatusQueryDialogLayout; |
@@ -1,6 +1,7 | |||||
1 | #include "rmapoperations.h" |
|
1 | #include "rmapoperations.h" | |
2 |
|
2 | |||
3 |
RMAP::RMAP(RMAP_command_codes commandCode, char targetLogicalAddress, char initiatorLogicalAddress, |
|
3 | RMAP::RMAP(RMAP_command_codes commandCode, unsigned char targetLogicalAddress, unsigned char initiatorLogicalAddress, | |
|
4 | int startAddress, int nbBytes, char* data) | |||
4 | { |
|
5 | { | |
5 | char packetType; // 2 most Significant Bits |
|
6 | char packetType; // 2 most Significant Bits | |
6 | char command; // 4 bits |
|
7 | char command; // 4 bits | |
@@ -37,9 +38,9 RMAP::RMAP(RMAP_command_codes commandCod | |||||
37 | break; |
|
38 | break; | |
38 | } |
|
39 | } | |
39 | RMAPHeader.targetLogicalAddress = targetLogicalAddress ; |
|
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 | RMAPHeader.instruction = (packetType<<6) + (command<<2) + (replyAddressLength); |
|
42 | RMAPHeader.instruction = (packetType<<6) + (command<<2) + (replyAddressLength); | |
42 |
RMAPHeader.key = |
|
43 | RMAPHeader.key = initiatorLogicalAddress; // used for command authorization | |
43 | RMAPHeader.initiatorLogicalAddress = initiatorLogicalAddress; // 0 is the default address for the GRESB module |
|
44 | RMAPHeader.initiatorLogicalAddress = initiatorLogicalAddress; // 0 is the default address for the GRESB module | |
44 | RMAPHeader.transactionIdentifier1 = 0x00; |
|
45 | RMAPHeader.transactionIdentifier1 = 0x00; | |
45 | RMAPHeader.transactionIdentifier0 = 0x01; |
|
46 | RMAPHeader.transactionIdentifier0 = 0x01; |
@@ -9,7 +9,9 | |||||
9 | #define RMAP_READ_COMMAND_HEADER_LENGTH 16 // in bytes => ECSS |
|
9 | #define RMAP_READ_COMMAND_HEADER_LENGTH 16 // in bytes => ECSS | |
10 | #define RMAP_DATA_CRC_LENGTH 1 // in bytes => ECSS |
|
10 | #define RMAP_DATA_CRC_LENGTH 1 // in bytes => ECSS | |
11 | #define RMAP_MAX_PACKET_LENGTH RMAP_READ_REPLY_HEADER_LENGTH + RMAP_MAX_DATA_LENGTH + RMAP_DATA_CRC_LENGTH |
|
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 | static const unsigned char RMAP_CRCTable[] = { |
|
16 | static const unsigned char RMAP_CRCTable[] = { | |
15 | 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75, |
|
17 | 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75, | |
@@ -71,9 +73,9 struct rmap_command_format_str | |||||
71 | char targetLogicalAddress; |
|
73 | char targetLogicalAddress; | |
72 | char protocolIdentifier; |
|
74 | char protocolIdentifier; | |
73 | char instruction; |
|
75 | char instruction; | |
74 |
char key; |
|
76 | unsigned char key; // used for command authorization => check Gaisler GRSPW for compliance | |
75 | //char replyAddress[]; // not needed if logical addressing is used (replyAddressLength = 0b00) |
|
77 | //char replyAddress[]; // not needed if logical addressing is used (replyAddressLength = 0b00) | |
76 | char initiatorLogicalAddress; |
|
78 | unsigned char initiatorLogicalAddress; | |
77 | char transactionIdentifier1; |
|
79 | char transactionIdentifier1; | |
78 | char transactionIdentifier0; |
|
80 | char transactionIdentifier0; | |
79 | char extendedAddress; |
|
81 | char extendedAddress; | |
@@ -132,8 +134,8 class RMAP | |||||
132 | { |
|
134 | { | |
133 | public: |
|
135 | public: | |
134 | RMAP(RMAP_command_codes commandCode, |
|
136 | RMAP(RMAP_command_codes commandCode, | |
135 | char targetLogicalAddress, |
|
137 | unsigned char targetLogicalAddress, | |
136 | char initiatorLogicalAddress, |
|
138 | unsigned char initiatorLogicalAddress, | |
137 | int startAddress, |
|
139 | int startAddress, | |
138 | int nbBytes, |
|
140 | int nbBytes, | |
139 | char *data); |
|
141 | char *data); |
@@ -24,6 +24,8 | |||||
24 | #include <QIODevice> |
|
24 | #include <QIODevice> | |
25 | #include <QApplication> |
|
25 | #include <QApplication> | |
26 | #include <rmappluginpythonwrapper.h> |
|
26 | #include <rmappluginpythonwrapper.h> | |
|
27 | #include <PythonQt.h> | |||
|
28 | #include <QTimer> | |||
27 |
|
29 | |||
28 | rmapplugin::rmapplugin(QWidget *parent) |
|
30 | rmapplugin::rmapplugin(QWidget *parent) | |
29 | :lppmonplugin(parent,false) |
|
31 | :lppmonplugin(parent,false) | |
@@ -37,11 +39,35 rmapplugin::rmapplugin(QWidget *parent) | |||||
37 | time_FINE = 0; |
|
39 | time_FINE = 0; | |
38 | currentBridge = selectedBridgeIsUnknown; |
|
40 | currentBridge = selectedBridgeIsUnknown; | |
39 |
|
41 | |||
40 | /*Python wrapper*/ |
|
42 | //************** | |
|
43 | //Python wrapper | |||
41 | this->pyObject = new rmappluginPythonWrapper(); |
|
44 | this->pyObject = new rmappluginPythonWrapper(); | |
42 | connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint))); |
|
45 | connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint))); | |
43 | connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint))); |
|
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 | ||||
|
61 | //************** | |||
|
62 | // get a smart pointer to the __main__ module of the Python interpreter | |||
|
63 | PythonQtObjectPtr context = PythonQt::self()->getMainModule(); | |||
|
64 | // add a QObject as variable of name "BUTTON_rmapOpenCommunication" to the namespace of the __main__ module | |||
|
65 | context.addObject("BUTTON_rmapOpenCommunication", UI->rmapOpenCommunicationButton); | |||
|
66 | context.addObject("BUTTON_rmapCloseCommunication", UI->rmapCloseCommunicationButton); | |||
|
67 | context.addObject("BUTTON_selectStarDundee", UI->selectStarDundee_BUTTON); | |||
|
68 | context.addObject("BUTTON_selectGRESB", UI->selectGRESB_BUTTON); | |||
|
69 | context.addObject("GRESB_Bridge", UI->gresbBridge); | |||
|
70 | //************** | |||
45 |
|
71 | |||
46 | connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(openBridge())); |
|
72 | connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(openBridge())); | |
47 | connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(closeBridge())); |
|
73 | connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(closeBridge())); | |
@@ -64,6 +90,12 rmapplugin::rmapplugin(QWidget *parent) | |||||
64 | connect(this->UI->gresbBridge, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)), |
|
90 | connect(this->UI->gresbBridge, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)), | |
65 | this, SLOT(processCCSDSPacket(unsigned char*,uint))); |
|
91 | this, SLOT(processCCSDSPacket(unsigned char*,uint))); | |
66 | connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->gresbBridge, SLOT(ccsdsPacketIsProcessed())); |
|
92 | connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->gresbBridge, SLOT(ccsdsPacketIsProcessed())); | |
|
93 | connect(this->UI->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), | |||
|
94 | this->UI->gresbBridge, SLOT(targetHasChanged(int))); | |||
|
95 | connect(this->UI->rmapSourceLogicalAddressSpinBox, SIGNAL(valueChanged(int)), | |||
|
96 | this->UI->gresbBridge, SLOT(sourceHasChanged(int))); | |||
|
97 | connect(this->UI->gresbBridge, SIGNAL(packetStoreNotEmpty()), | |||
|
98 | this, SLOT(processPacketStore())); | |||
67 |
|
99 | |||
68 | // Star Dundee |
|
100 | // Star Dundee | |
69 | connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); |
|
101 | connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); | |
@@ -73,15 +105,31 rmapplugin::rmapplugin(QWidget *parent) | |||||
73 | connect(this->UI->starDundee, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)), |
|
105 | connect(this->UI->starDundee, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)), | |
74 | this, SLOT(processCCSDSPacket(unsigned char*,uint))); |
|
106 | this, SLOT(processCCSDSPacket(unsigned char*,uint))); | |
75 | connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->starDundee, SLOT(ccsdsPacketIsProcessed())); |
|
107 | connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->starDundee, SLOT(ccsdsPacketIsProcessed())); | |
|
108 | connect(this->UI->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), | |||
|
109 | this->UI->starDundee, SLOT(targetHasChanged(int))); | |||
|
110 | connect(this->UI->rmapSourceLogicalAddressSpinBox, SIGNAL(valueChanged(int)), | |||
|
111 | this->UI->starDundee, SLOT(sourceHasChanged(int))); | |||
|
112 | connect(this->UI->starDundee, SIGNAL(packetStoreNotEmpty()), | |||
|
113 | this, SLOT(processPacketStore())); | |||
76 |
|
114 | |||
77 | connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(bridgeHasChanged(selectedBridge))); |
|
115 | connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(bridgeHasChanged(selectedBridge))); | |
|
116 | ||||
78 | } |
|
117 | } | |
79 |
|
118 | |||
80 | rmapplugin::~rmapplugin() |
|
119 | rmapplugin::~rmapplugin() | |
81 | { |
|
120 | { | |
82 | if (!RMAPSend_SOCKET->isOpen()) RMAPSend_SOCKET->disconnectFromHost(); |
|
121 | switch(currentBridge) | |
83 | if (!RMAPReceive_SOCKET->isOpen()) RMAPReceive_SOCKET->disconnectFromHost(); |
|
122 | { | |
84 | if (!GRESBStatusQuery_SOCKET->isOpen()) GRESBStatusQuery_SOCKET->disconnectFromHost(); |
|
123 | case selectedBridgeIsGRESB : | |
|
124 | if (RMAPSend_SOCKET->isOpen()) RMAPSend_SOCKET->disconnectFromHost(); | |||
|
125 | if (RMAPReceive_SOCKET->isOpen()) RMAPReceive_SOCKET->disconnectFromHost(); | |||
|
126 | if (GRESBStatusQuery_SOCKET->isOpen()) GRESBStatusQuery_SOCKET->disconnectFromHost(); | |||
|
127 | break; | |||
|
128 | case selectedBridgeIsStarDundee : | |||
|
129 | break; | |||
|
130 | default: | |||
|
131 | break; | |||
|
132 | } | |||
85 | } |
|
133 | } | |
86 |
|
134 | |||
87 | unsigned int rmapplugin::Write(unsigned int *Value, unsigned int count, unsigned int address) |
|
135 | unsigned int rmapplugin::Write(unsigned int *Value, unsigned int count, unsigned int address) | |
@@ -279,6 +327,16 void rmapplugin::appendToLog(QString tex | |||||
279 | APPENDTOLOG(text); |
|
327 | APPENDTOLOG(text); | |
280 | } |
|
328 | } | |
281 |
|
329 | |||
|
330 | void rmapplugin::setValueTargetAddress(unsigned char newAddress) | |||
|
331 | { | |||
|
332 | this->UI->rmapTargetLogicalAddressSpinBox->setValue(newAddress); | |||
|
333 | } | |||
|
334 | ||||
|
335 | void rmapplugin::setValueSourceAddress(unsigned char newAddress) | |||
|
336 | { | |||
|
337 | this->UI->rmapSourceLogicalAddressSpinBox->setValue(newAddress); | |||
|
338 | } | |||
|
339 | ||||
282 | ///////////////////// |
|
340 | ///////////////////// | |
283 | // INTERNAL FUNCTIONS |
|
341 | // INTERNAL FUNCTIONS | |
284 |
|
342 | |||
@@ -311,6 +369,22 void rmapplugin::processCCSDSPacket(unsi | |||||
311 | //+" " |
|
369 | //+" " | |
312 | //+ QString::number(ccsdsPacket[7], 16)); |
|
370 | //+ QString::number(ccsdsPacket[7], 16)); | |
313 | displayOnConsole(message); |
|
371 | displayOnConsole(message); | |
|
372 | ((rmappluginPythonWrapper*)this->pyObject)->storeCCSDSPacket(ccsdsPacket, size); | |||
314 | emit ccsdsPacketIsProcessed(); |
|
373 | emit ccsdsPacketIsProcessed(); | |
315 | } |
|
374 | } | |
316 |
|
375 | |||
|
376 | void rmapplugin::processPacketStore() | |||
|
377 | { | |||
|
378 | switch(currentBridge) | |||
|
379 | { | |||
|
380 | case selectedBridgeIsGRESB : | |||
|
381 | ((rmappluginPythonWrapper*)this->pyObject)->ccsdsPacketStore = &(this->UI->gresbBridge->ccsdsPacketStore); | |||
|
382 | break; | |||
|
383 | case selectedBridgeIsStarDundee : | |||
|
384 | ((rmappluginPythonWrapper*)this->pyObject)->ccsdsPacketStore = &(this->UI->starDundee->ccsdsPacketStore); | |||
|
385 | break; | |||
|
386 | default: | |||
|
387 | break; | |||
|
388 | } | |||
|
389 | ((rmappluginPythonWrapper*)this->pyObject)->processPacketStore(); | |||
|
390 | } |
@@ -54,9 +54,12 public slots: | |||||
54 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
54 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); | |
55 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
55 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); | |
56 | unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); |
|
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 | void openBridge(); |
|
59 | void openBridge(); | |
58 | void closeBridge(); |
|
60 | void closeBridge(); | |
59 | void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size); |
|
61 | void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size); | |
|
62 | void processPacketStore(); | |||
60 | // |
|
63 | // | |
61 | void sendCCSDS(); |
|
64 | void sendCCSDS(); | |
62 | void send_TC_LFR_UPDATE_TIME(); |
|
65 | void send_TC_LFR_UPDATE_TIME(); |
@@ -43,7 +43,7 HEADERS += \ | |||||
43 | ../spw_usb_driver_v2.61/inc/spw_usb_api.h \ |
|
43 | ../spw_usb_driver_v2.61/inc/spw_usb_api.h \ | |
44 | ../spw_usb_driver_v2.61/inc/spw_config_library.h \ |
|
44 | ../spw_usb_driver_v2.61/inc/spw_config_library.h \ | |
45 | gresb.h \ |
|
45 | gresb.h \ | |
46 | bridge.h |
|
46 | tcpackettosend.h | |
47 |
|
47 | |||
48 |
|
48 | |||
49 | SOURCES += \ |
|
49 | SOURCES += \ | |
@@ -57,7 +57,7 SOURCES += \ | |||||
57 | rmappluginpythonwrapper.cpp \ |
|
57 | rmappluginpythonwrapper.cpp \ | |
58 | stardundee.cpp \ |
|
58 | stardundee.cpp \ | |
59 | gresb.cpp \ |
|
59 | gresb.cpp \ | |
60 | bridge.cpp |
|
60 | tcpackettosend.cpp | |
61 |
|
61 | |||
62 |
|
62 | |||
63 |
|
63 |
@@ -1,12 +1,16 | |||||
1 | #include "rmappluginpythonwrapper.h" |
|
1 | #include "rmappluginpythonwrapper.h" | |
2 | #include <math.h> |
|
2 | #include <math.h> | |
|
3 | #include <QApplication> | |||
3 |
|
4 | |||
4 | rmappluginPythonWrapper::rmappluginPythonWrapper(QObject *parent) : |
|
5 | rmappluginPythonWrapper::rmappluginPythonWrapper(QObject *parent) : | |
5 | genericPySysdriver(parent) |
|
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())); | |||
7 | } |
|
12 | } | |
8 |
|
13 | |||
9 |
|
||||
10 | QList<QVariant> rmappluginPythonWrapper::getData() |
|
14 | QList<QVariant> rmappluginPythonWrapper::getData() | |
11 | { |
|
15 | { | |
12 | QList<QVariant> data; |
|
16 | QList<QVariant> data; | |
@@ -17,3 +21,154 QList<QVariant> rmappluginPythonWrapper: | |||||
17 | } |
|
21 | } | |
18 | return data; |
|
22 | return data; | |
19 | } |
|
23 | } | |
|
24 | ||||
|
25 | QList<QVariant> rmappluginPythonWrapper::ReadSPW(unsigned int size) | |||
|
26 | { | |||
|
27 | QList<QVariant> result; | |||
|
28 | ccsdsPacketToProcess_t ccsdsPacket; | |||
|
29 | ||||
|
30 | if (!ccsdsPacketStore->isEmpty()) | |||
|
31 | { | |||
|
32 | ccsdsPacket = ccsdsPacketStore->takeFirst(); | |||
|
33 | for(unsigned int i = 0;i<size;i++) | |||
|
34 | { | |||
|
35 | result.append((QVariant)ccsdsPacket.data[i]); | |||
|
36 | } | |||
|
37 | } | |||
|
38 | return result; | |||
|
39 | } | |||
|
40 | ||||
|
41 | void rmappluginPythonWrapper::WriteSPW(QList<int> dataList) | |||
|
42 | { | |||
|
43 | char targetLogicalAddress; | |||
|
44 | char userApplication; | |||
|
45 | unsigned int count; | |||
|
46 | char *Value; | |||
|
47 | ||||
|
48 | unsigned char data[dataList.count()]; | |||
|
49 | ||||
|
50 | for(int i = 0; i<dataList.count(); i++) // get the data as unsigned char | |||
|
51 | { | |||
|
52 | data[i] = (unsigned char)dataList.at(i); | |||
|
53 | } | |||
|
54 | // read the first bytes of the data to get the targetLogicalAddress and the userApplication parameters | |||
|
55 | targetLogicalAddress = data[0]; | |||
|
56 | userApplication = data[3]; | |||
|
57 | ||||
|
58 | count = dataList.count() - 4; // the CCSDS header (4 bytes) is added by LPPMON | |||
|
59 | Value = (char*) &data[4]; | |||
|
60 | ||||
|
61 | emit WriteSPWSig(Value, count, targetLogicalAddress, userApplication); | |||
|
62 | } | |||
|
63 | ||||
|
64 | void rmappluginPythonWrapper::WriteSPWDelay(QList<int> dataList, unsigned int delay) | |||
|
65 | { | |||
|
66 | char targetLogicalAddress; | |||
|
67 | char userApplication; | |||
|
68 | unsigned int count; | |||
|
69 | char *Value; | |||
|
70 | TCPacketToSend *packet; | |||
|
71 | ||||
|
72 | unsigned char data[dataList.count()]; | |||
|
73 | ||||
|
74 | for(int i = 0; i<dataList.count(); i++) // get the data as unsigned char | |||
|
75 | { | |||
|
76 | data[i] = (unsigned char)dataList.at(i); | |||
|
77 | } | |||
|
78 | // read the first bytes of the data to get the targetLogicalAddress and the userApplication parameters | |||
|
79 | targetLogicalAddress = data[0]; | |||
|
80 | userApplication = data[3]; | |||
|
81 | ||||
|
82 | count = dataList.count() - 4; // the CCSDS header (4 bytes) is added by LPPMON | |||
|
83 | Value = (char*) &data[4]; | |||
|
84 | ||||
|
85 | packet = new TCPacketToSend(Value, count, targetLogicalAddress, userApplication, delay); | |||
|
86 | TCPacketStore.append(packet); | |||
|
87 | ||||
|
88 | emit(activateTCLoopSig()); | |||
|
89 | ||||
|
90 | } | |||
|
91 | ||||
|
92 | void rmappluginPythonWrapper::processPacketStoreLater(unsigned int delay) | |||
|
93 | { | |||
|
94 | emit sendMessage( | |||
|
95 | "*** process packet store in " + QString::number(delay) + " ms" | |||
|
96 | ); | |||
|
97 | QTimer::singleShot(delay, this, SLOT(sendProcessPacketStoreNowSig())); | |||
|
98 | } | |||
|
99 | ||||
|
100 | void rmappluginPythonWrapper::sendTCLoop() | |||
|
101 | { | |||
|
102 | unsigned int delay; | |||
|
103 | ||||
|
104 | if (!timer->isActive()) | |||
|
105 | { | |||
|
106 | if (!TCPacketStore.isEmpty()) | |||
|
107 | { | |||
|
108 | delay = TCPacketStore.at(0)->delay; | |||
|
109 | timer->setInterval(delay); | |||
|
110 | timer->start(); | |||
|
111 | } | |||
|
112 | } | |||
|
113 | } | |||
|
114 | ||||
|
115 | void rmappluginPythonWrapper::sendTC() | |||
|
116 | { | |||
|
117 | TCPacketToSend *packet; | |||
|
118 | unsigned int delay; | |||
|
119 | ||||
|
120 | packet = TCPacketStore.takeFirst(); | |||
|
121 | // the signal is connected with the option Qt::DirectConnection, thus it is processed immediately | |||
|
122 | emit(WriteSPWSig(packet->Value, packet->count,packet->targetLogicalAddress, packet->userApplication)); | |||
|
123 | delete(packet); | |||
|
124 | if (!TCPacketStore.isEmpty()) | |||
|
125 | { | |||
|
126 | delay = TCPacketStore.at(0)->delay; | |||
|
127 | timer->setInterval(delay); | |||
|
128 | timer->start(); | |||
|
129 | } | |||
|
130 | } | |||
|
131 | ||||
|
132 | unsigned int rmappluginPythonWrapper::storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size) | |||
|
133 | { | |||
|
134 | unsigned int i; | |||
|
135 | ccsdsPacketToProcess_t ccsdsPacketToStore; | |||
|
136 | ||||
|
137 | ccsdsPacketToStore.size = size; | |||
|
138 | for(i=0; i<size; i++) | |||
|
139 | { | |||
|
140 | //ccsdsPacket0[i] = ccsdsPacket[i]; | |||
|
141 | ccsdsPacketToStore.data[i] = ccsdsPacket[i]; | |||
|
142 | } | |||
|
143 | ccsdsPacketStore->append(ccsdsPacketToStore); | |||
|
144 | emit ccsdsPacketIsAvailable(size); | |||
|
145 | return 1; | |||
|
146 | } | |||
|
147 | ||||
|
148 | void rmappluginPythonWrapper::processPacketStore() | |||
|
149 | { | |||
|
150 | while (!ccsdsPacketStore->isEmpty()) | |||
|
151 | { | |||
|
152 | emit ccsdsPacketIsAvailable(ccsdsPacketStore->at(0).size); | |||
|
153 | ProcessPendingEvents(); | |||
|
154 | } | |||
|
155 | } | |||
|
156 | ||||
|
157 | void rmappluginPythonWrapper::setTargetAddressValue(unsigned int address) | |||
|
158 | { | |||
|
159 | unsigned char newAddress; | |||
|
160 | newAddress = (unsigned char) address; | |||
|
161 | emit updateTargetAddress(newAddress); | |||
|
162 | } | |||
|
163 | ||||
|
164 | void rmappluginPythonWrapper::setSourceAddressValue(unsigned int address) | |||
|
165 | { | |||
|
166 | unsigned char newAddress; | |||
|
167 | newAddress = (unsigned char) address; | |||
|
168 | emit updateSourceAddress(newAddress); | |||
|
169 | } | |||
|
170 | ||||
|
171 | void rmappluginPythonWrapper::ProcessPendingEvents() | |||
|
172 | { | |||
|
173 | QCoreApplication::processEvents(); | |||
|
174 | } |
@@ -5,17 +5,50 | |||||
5 | #include <genericPySysdriver.h> |
|
5 | #include <genericPySysdriver.h> | |
6 | #include <QList> |
|
6 | #include <QList> | |
7 | #include <QVariant> |
|
7 | #include <QVariant> | |
|
8 | #include "rmapoperations.h" | |||
|
9 | #include "ccsds.h" | |||
|
10 | #include <tcpackettosend.h> | |||
|
11 | #include <QTimer> | |||
8 |
|
12 | |||
9 | class rmappluginPythonWrapper : public genericPySysdriver |
|
13 | class rmappluginPythonWrapper : public genericPySysdriver | |
10 | { |
|
14 | { | |
11 | Q_OBJECT |
|
15 | Q_OBJECT | |
12 | public: |
|
16 | public: | |
13 | explicit rmappluginPythonWrapper(QObject *parent = 0); |
|
17 | explicit rmappluginPythonWrapper(QObject *parent = 0); | |
|
18 | ||||
|
19 | QList<ccsdsPacketToProcess_t> *ccsdsPacketStore; | |||
|
20 | void processPacketStore(); | |||
|
21 | unsigned int storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size); | |||
|
22 | ||||
|
23 | QList<TCPacketToSend*> TCPacketStore; | |||
|
24 | QTimer *timer; | |||
14 |
|
25 | |||
15 | signals: |
|
26 | signals: | |
|
27 | void ccsdsPacketIsAvailable(unsigned int size); | |||
|
28 | void wakeUpCallingThread(); | |||
|
29 | unsigned int WriteSPWSig(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); | |||
|
30 | void updateTargetAddress(unsigned char newAddress); | |||
|
31 | void updateSourceAddress(unsigned char newAddress); | |||
|
32 | void activateTCLoopSig(); | |||
|
33 | void processPacketStoreNowSig(); | |||
|
34 | void sendMessage(QString message); | |||
16 |
|
35 | |||
17 | public slots: |
|
36 | public slots: | |
18 | QList<QVariant> getData(); |
|
37 | QList<QVariant> getData(); | |
|
38 | ||||
|
39 | QList<QVariant> ReadSPW(unsigned int size); | |||
|
40 | void WriteSPW(QList<int> dataList); | |||
|
41 | void WriteSPWDelay(QList<int> dataList, unsigned int delay=0); | |||
|
42 | void processPacketStoreLater(unsigned int delay); | |||
|
43 | void sendProcessPacketStoreNowSig(){emit processPacketStoreNowSig();} | |||
|
44 | void sendTCLoop(); | |||
|
45 | void sendTC(); | |||
|
46 | void reEmitWriteSPWSig(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) | |||
|
47 | {emit WriteSPWSig(Value, count, targetLogicalAddress, userApplication);} | |||
|
48 | ||||
|
49 | void setTargetAddressValue(unsigned int address); | |||
|
50 | void setSourceAddressValue(unsigned int address); | |||
|
51 | void ProcessPendingEvents(); | |||
19 |
|
52 | |||
20 | }; |
|
53 | }; | |
21 |
|
54 |
@@ -81,18 +81,18 rmapPluginUI::rmapPluginUI(QWidget *pare | |||||
81 | gresbVirtualLinkSpinBox->setRange(0, 4); |
|
81 | gresbVirtualLinkSpinBox->setRange(0, 4); | |
82 | gresbVirtualLinkSpinBox->setValue(1); |
|
82 | gresbVirtualLinkSpinBox->setValue(1); | |
83 | rmapSourceLogicalAddressSpinBox->setRange(0, 255); |
|
83 | rmapSourceLogicalAddressSpinBox->setRange(0, 255); | |
84 |
rmapSourceLogicalAddressSpinBox->setValue( |
|
84 | rmapSourceLogicalAddressSpinBox->setValue(0); | |
85 | rmapTargetLogicalAddressSpinBox->setRange(0, 255); |
|
85 | rmapTargetLogicalAddressSpinBox->setRange(0, 255); | |
86 | spwLinkSpinBox->setRange(0, 2); |
|
86 | spwLinkSpinBox->setRange(0, 2); | |
87 | spwLinkSpinBox->setValue(0); |
|
87 | spwLinkSpinBox->setValue(0); | |
88 | CCSDSTargetLogicalAddressSpinBox->setRange(0,255); |
|
88 | CCSDSTargetLogicalAddressSpinBox->setRange(0,255); | |
89 |
CCSDSTargetLogicalAddressSpinBox->setValue( |
|
89 | CCSDSTargetLogicalAddressSpinBox->setValue(0); | |
90 |
|
90 | |||
91 | //*** MISC **// |
|
91 | //*** MISC **// | |
92 | starDundee = new StarDundee; |
|
92 | starDundee = new StarDundee; | |
93 | gresbBridge = new gresb; |
|
93 | gresbBridge = new gresb; | |
94 | console = new QTextEdit; |
|
94 | console = new QTextEdit; | |
95 | gresbBridgeIPDialogBox = new QIPDialogBox; |
|
95 | //gresbBridgeIPDialogBox = new QIPDialogBox; | |
96 | gresbStatusQueryDialog = new QDialog; |
|
96 | gresbStatusQueryDialog = new QDialog; | |
97 | logEnableCheckBox = new QCheckBox(tr("Enable Logs")); |
|
97 | logEnableCheckBox = new QCheckBox(tr("Enable Logs")); | |
98 | 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")); | |
@@ -112,13 +112,15 rmapPluginUI::rmapPluginUI(QWidget *pare | |||||
112 |
|
112 | |||
113 | generalParameters_LAYOUT->addWidget(logEnableCheckBox, 0, 0, 1, 1); |
|
113 | generalParameters_LAYOUT->addWidget(logEnableCheckBox, 0, 0, 1, 1); | |
114 | generalParameters_LAYOUT->addWidget(logFileChooseButton, 0, 1, 1, 1); |
|
114 | generalParameters_LAYOUT->addWidget(logFileChooseButton, 0, 1, 1, 1); | |
115 |
generalParameters_LAYOUT->addWidget(rmap |
|
115 | generalParameters_LAYOUT->addWidget(rmapSourceLogicalAddressLabel, 1, 0, 0); | |
116 |
generalParameters_LAYOUT->addWidget(rmap |
|
116 | generalParameters_LAYOUT->addWidget(rmapSourceLogicalAddressSpinBox, 1, 1, 0); | |
117 |
generalParameters_LAYOUT->addWidget(rmap |
|
117 | generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressLabel, 2, 0, 0); | |
118 |
generalParameters_LAYOUT->addWidget(rmap |
|
118 | generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressSpinBox, 2, 1, 0); | |
119 |
generalParameters_LAYOUT->addWidget( |
|
119 | generalParameters_LAYOUT->addWidget(rmapOpenCommunicationButton, 3, 0, 1, 1); | |
120 |
generalParameters_LAYOUT->addWidget( |
|
120 | generalParameters_LAYOUT->addWidget(rmapCloseCommunicationButton, 3, 1, 1, 1); | |
121 |
generalParameters_LAYOUT-> |
|
121 | generalParameters_LAYOUT->addWidget(RMAP_write_verify, 4, 0, 1, 2); | |
|
122 | generalParameters_LAYOUT->addWidget(RMAP_write_reply, 5, 0, 1, 2); | |||
|
123 | generalParameters_LAYOUT->setRowStretch(6, 1); | |||
122 | generalParameters_LAYOUT->setColumnStretch(2, 1); |
|
124 | generalParameters_LAYOUT->setColumnStretch(2, 1); | |
123 |
|
125 | |||
124 | gresb_GROUPBOX->setLayout(gresbBridge->layout()); |
|
126 | gresb_GROUPBOX->setLayout(gresbBridge->layout()); | |
@@ -168,8 +170,10 rmapPluginUI::rmapPluginUI(QWidget *pare | |||||
168 | connect(this->starDundee, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool))); |
|
170 | connect(this->starDundee, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool))); | |
169 | connect(this->gresbBridge, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool))); |
|
171 | connect(this->gresbBridge, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool))); | |
170 |
|
172 | |||
|
173 | connect(this->rmapSourceLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->gresbBridge, SLOT(sourceHasChanged(int))); | |||
|
174 | connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->gresbBridge, SLOT(targetHasChanged(int))); | |||
|
175 | connect(this->rmapSourceLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->starDundee, SLOT(sourceHasChanged(int))); | |||
171 | connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->starDundee, SLOT(targetHasChanged(int))); |
|
176 | connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->starDundee, SLOT(targetHasChanged(int))); | |
172 | connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->gresbBridge, SLOT(targetHasChanged(int))); |
|
|||
173 |
|
177 | |||
174 | // command code |
|
178 | // command code | |
175 | connect(this->RMAP_write_reply, SIGNAL(clicked()), this, SLOT(getCommandCode())); |
|
179 | connect(this->RMAP_write_reply, SIGNAL(clicked()), this, SLOT(getCommandCode())); | |
@@ -180,7 +184,8 rmapPluginUI::rmapPluginUI(QWidget *pare | |||||
180 | this->gresbBridge, SLOT(commandCodeHasChanged(RMAP_command_codes))); |
|
184 | this->gresbBridge, SLOT(commandCodeHasChanged(RMAP_command_codes))); | |
181 |
|
185 | |||
182 | getCommandCode(); // init the command code value |
|
186 | getCommandCode(); // init the command code value | |
183 |
rmap |
|
187 | rmapSourceLogicalAddressSpinBox->setValue(DEFAULT_SOURCE); | |
|
188 | rmapTargetLogicalAddressSpinBox->setValue(DEFAULT_TARGET); | |||
184 | } |
|
189 | } | |
185 |
|
190 | |||
186 | rmapPluginUI::~rmapPluginUI() |
|
191 | rmapPluginUI::~rmapPluginUI() |
@@ -81,7 +81,7 public: | |||||
81 | QSpinBox* rmapTargetLogicalAddressSpinBox; |
|
81 | QSpinBox* rmapTargetLogicalAddressSpinBox; | |
82 | QSpinBox* CCSDSTargetLogicalAddressSpinBox; |
|
82 | QSpinBox* CCSDSTargetLogicalAddressSpinBox; | |
83 |
|
83 | |||
84 | QIPDialogBox* gresbBridgeIPDialogBox; |
|
84 | //QIPDialogBox* gresbBridgeIPDialogBox; | |
85 |
|
85 | |||
86 | QCheckBox *logEnableCheckBox; |
|
86 | QCheckBox *logEnableCheckBox; | |
87 | QCheckBox *RMAP_write_verify; |
|
87 | QCheckBox *RMAP_write_verify; | |
@@ -101,8 +101,8 public: | |||||
101 |
|
101 | |||
102 | QTextEdit* console; |
|
102 | QTextEdit* console; | |
103 |
|
103 | |||
|
104 | // SPACEWIRE BRIDGES | |||
104 | StarDundee *starDundee; |
|
105 | StarDundee *starDundee; | |
105 |
|
||||
106 | gresb *gresbBridge; |
|
106 | gresb *gresbBridge; | |
107 |
|
107 | |||
108 | bool islogfileenable(); |
|
108 | bool islogfileenable(); | |
@@ -124,6 +124,7 signals: | |||||
124 | void commandCodeHasChanged(RMAP_command_codes commandCode); |
|
124 | void commandCodeHasChanged(RMAP_command_codes commandCode); | |
125 | void bridgeHasChanged(selectedBridge bridge); |
|
125 | void bridgeHasChanged(selectedBridge bridge); | |
126 | void targetHasChanged(unsigned char target); |
|
126 | void targetHasChanged(unsigned char target); | |
|
127 | void sourceHasChanged(unsigned char source); | |||
127 |
|
128 | |||
128 | private: |
|
129 | private: | |
129 | QLabel *gresbBridgeIPLabel; |
|
130 | QLabel *gresbBridgeIPLabel; |
@@ -1,6 +1,7 | |||||
1 | #include "stardundee.h" |
|
1 | #include "stardundee.h" | |
2 | #include <QTime> |
|
2 | #include <QTime> | |
3 | #include <math.h> |
|
3 | #include <math.h> | |
|
4 | #include "ccsds.h" | |||
4 |
|
5 | |||
5 | StarDundee::StarDundee(QWidget *parent) : |
|
6 | StarDundee::StarDundee(QWidget *parent) : | |
6 | QWidget(parent) |
|
7 | QWidget(parent) | |
@@ -16,13 +17,13 StarDundee::StarDundee(QWidget *parent) | |||||
16 | starDundeeStatusQueryDialog = new QDialog; |
|
17 | starDundeeStatusQueryDialog = new QDialog; | |
17 |
|
18 | |||
18 | commandCode = invalid0; // initialization of the cmmand code for the RMAP transfers |
|
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 | connection_LAYOUT = new QGridLayout; |
|
23 | connection_LAYOUT = new QGridLayout; | |
22 |
|
24 | |||
23 | usbDeviceNumber_LABEL = new QLabel(tr("USB device number: ")); |
|
25 | usbDeviceNumber_LABEL = new QLabel(tr("USB device number: ")); | |
24 | linkNumber_LABEL = new QLabel(tr("SpaceWire link number: ")); |
|
26 | linkNumber_LABEL = new QLabel(tr("SpaceWire link number: ")); | |
25 | sourceLogicalAddress_LABEL = new QLabel(tr("Source logical address: ")); |
|
|||
26 | starDundeeStatusQueryDialogLabel = new QLabel(tr("SpaceWire link not running")); |
|
27 | starDundeeStatusQueryDialogLabel = new QLabel(tr("SpaceWire link not running")); | |
27 |
|
28 | |||
28 | //*** QPUSHBUTTON ***// |
|
29 | //*** QPUSHBUTTON ***// | |
@@ -35,9 +36,6 StarDundee::StarDundee(QWidget *parent) | |||||
35 | linkNumber_SPINBOX = new QSpinBox; |
|
36 | linkNumber_SPINBOX = new QSpinBox; | |
36 | linkNumber_SPINBOX->setRange(1,2); |
|
37 | linkNumber_SPINBOX->setRange(1,2); | |
37 | linkNumber_SPINBOX->setValue(1); |
|
38 | linkNumber_SPINBOX->setValue(1); | |
38 | sourceLogicalAddress_SPINBOX = new QSpinBox; |
|
|||
39 | sourceLogicalAddress_SPINBOX->setRange(0,254); |
|
|||
40 | sourceLogicalAddress_SPINBOX->setValue(32); |
|
|||
41 |
|
39 | |||
42 | // STAR DUNDEE STATUS QUERY DIALOG |
|
40 | // STAR DUNDEE STATUS QUERY DIALOG | |
43 | starDundeeStatusQueryDialogLayout = new QGridLayout; |
|
41 | starDundeeStatusQueryDialogLayout = new QGridLayout; | |
@@ -50,21 +48,17 StarDundee::StarDundee(QWidget *parent) | |||||
50 | connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 0, 1, 1, 1); |
|
48 | connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 0, 1, 1, 1); | |
51 | connection_LAYOUT->addWidget(linkNumber_LABEL, 1, 0, 1, 1); |
|
49 | connection_LAYOUT->addWidget(linkNumber_LABEL, 1, 0, 1, 1); | |
52 | connection_LAYOUT->addWidget(linkNumber_SPINBOX, 1, 1, 1, 1); |
|
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( |
|
52 | connection_LAYOUT->setRowStretch(2, 1); | |
57 | connection_LAYOUT->setColumnStretch(2, 1); |
|
53 | connection_LAYOUT->setColumnStretch(2, 1); | |
58 |
|
54 | |||
59 | this->setLayout(connection_LAYOUT); |
|
55 | this->setLayout(connection_LAYOUT); | |
60 |
|
56 | |||
61 | connect(this->sourceLogicalAddress_SPINBOX, SIGNAL(valueChanged(int)), this, SLOT(sourceHasChanged(int))); |
|
|||
62 |
|
||||
63 | connect(starDundeeStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink())); |
|
57 | connect(starDundeeStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink())); | |
64 | connect(starDundeeStatusQueryAbortButton, SIGNAL(clicked()), starDundeeStatusQueryDialog, SLOT(reject())); |
|
58 | connect(starDundeeStatusQueryAbortButton, SIGNAL(clicked()), starDundeeStatusQueryDialog, SLOT(reject())); | |
65 |
|
59 | |||
66 | connect(this->timer, SIGNAL(timeout()), this, SLOT(receivePollingLoop())); |
|
60 | connect(this->timer, SIGNAL(timeout()), this, SLOT(receivePollingLoop())); | |
67 |
timer->start(100); // starts the periodical timer, per |
|
61 | timer->start(100); // starts the periodical timer, period = 100ms | |
68 | } |
|
62 | } | |
69 |
|
63 | |||
70 | StarDundee::~StarDundee() |
|
64 | StarDundee::~StarDundee() | |
@@ -82,14 +76,14 void StarDundee::Open() | |||||
82 |
|
76 | |||
83 | if (!USBSpaceWire_Open(&hDevice, usbDeviceNumber_SPINBOX->value())) // Open the USB device |
|
77 | if (!USBSpaceWire_Open(&hDevice, usbDeviceNumber_SPINBOX->value())) // Open the USB device | |
84 | { |
|
78 | { | |
85 | emit sendMessage("stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))"); |
|
79 | emit sendMessage("stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))"); | |
86 | return; |
|
80 | return; | |
87 | } |
|
81 | } | |
88 | emit sendMessage("stardundee *** Open *** USBSpaceWire_Open successful, device number: " |
|
82 | emit sendMessage("stardundee *** Open *** USBSpaceWire_Open successful, device number: " | |
89 | + QString::number(usbDeviceNumber_SPINBOX->value())); |
|
83 | + QString::number(usbDeviceNumber_SPINBOX->value())); | |
90 |
|
84 | |||
91 | USBSpaceWire_EnableNetworkMode(hDevice, 0); // deactivate the network mode |
|
85 | USBSpaceWire_EnableNetworkMode(hDevice, 0); // deactivate the network mode | |
92 | CFGSpaceWire_EnableRMAP(1); // Enable the use of RMAP |
|
86 | CFGSpaceWire_EnableRMAP(1); // Enable the use of RMAP for the StarDundee brick configuration | |
93 | CFGSpaceWire_SetRMAPDestinationKey(0x20); // Set the destination key expected by STAR-Dundee devices |
|
87 | CFGSpaceWire_SetRMAPDestinationKey(0x20); // Set the destination key expected by STAR-Dundee devices | |
94 |
|
88 | |||
95 | // Set the path and return path to the device |
|
89 | // Set the path and return path to the device | |
@@ -129,15 +123,27 void StarDundee::Open() | |||||
129 | else emit sendMessage("Set the link status control for link " + QString::number(linkNumber_SPINBOX->value())); |
|
123 | else emit sendMessage("Set the link status control for link " + QString::number(linkNumber_SPINBOX->value())); | |
130 | } |
|
124 | } | |
131 |
|
125 | |||
132 | setRoutingTableEntry(rmapTargetLogicalAddress, (1<<linkNumber_SPINBOX->value())); |
|
126 | if (CFGSpaceWire_SetAsInterface(hDevice, 1, 0) != CFG_TRANSFER_SUCCESS) | |
133 | setRoutingTableEntry(sourceLogicalAddress_SPINBOX->value(), (1<<3)); |
|
127 | { | |
134 | //setRoutingTableEntry(33, (1<<3)); |
|
128 | emit sendMessage("Could not set the device to be an interface"); | |
|
129 | } | |||
|
130 | else | |||
|
131 | { | |||
|
132 | emit sendMessage("Device set to be an interface"); | |||
|
133 | } | |||
135 |
|
134 | |||
136 | emit sendMessage("The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes"); |
|
135 | //setRoutingTableEntry(rmapTargetLogicalAddress, (1<<linkNumber_SPINBOX->value())); | |
|
136 | //setRoutingTableEntry(rmapSourceLogicalAddress, (1<<3)); | |||
|
137 | //GetRoutingTableEntry(rmapTargetLogicalAddress); | |||
|
138 | //GetRoutingTableEntry(rmapSourceLogicalAddress); | |||
137 |
|
139 | |||
138 | USBSpaceWire_RegisterReceiveOnAllPorts(hDevice); // Register to receive on all ports |
|
140 | USBSpaceWire_RegisterReceiveOnAllPorts(hDevice); // Register to receive on all ports | |
139 | USBSpaceWire_ClearEndpoints(hDevice); // clear the USB endpoints |
|
141 | USBSpaceWire_ClearEndpoints(hDevice); // clear the USB endpoints | |
140 |
|
142 | |||
|
143 | emit sendMessage("The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes"); | |||
|
144 | emit sendMessage("The driver's current read buffer size is " + QString::number(USBSpaceWire_GetDriverReadBufferSize(hDevice)) + " bytes"); | |||
|
145 | emit sendMessage("USBSpaceWire_IsReadThrottling is " + QString::number(USBSpaceWire_IsReadThrottling(hDevice))); | |||
|
146 | ||||
141 | // initialize SPW packet semaphores |
|
147 | // initialize SPW packet semaphores | |
142 | while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire(); |
|
148 | while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire(); | |
143 | while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire(); |
|
149 | while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire(); | |
@@ -148,7 +154,7 void StarDundee::Open() | |||||
148 | } |
|
154 | } | |
149 | else |
|
155 | else | |
150 | { |
|
156 | { | |
151 |
|
157 | starDundeeStatusQueryDialog->exec(); | ||
152 | } |
|
158 | } | |
153 | } |
|
159 | } | |
154 |
|
160 | |||
@@ -162,21 +168,35 void StarDundee::Close() | |||||
162 | emit isOpen(false); |
|
168 | emit isOpen(false); | |
163 | } |
|
169 | } | |
164 |
|
170 | |||
165 |
unsigned |
|
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 | U32 routingTableEntry, outputPorts; |
|
195 | U32 routingTableEntry, outputPorts; | |
168 | char enabled, delHead, priority; |
|
196 | char enabled, delHead, priority; | |
169 | int portNum; |
|
197 | int portNum; | |
170 | int tableEntry; |
|
|||
171 |
|
198 | |||
172 | tableEntry = rmapTargetLogicalAddress; |
|
199 | emit sendMessage("GetRoutingTableEntry [" + QString::number(tableEntry) + "]"); | |
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 |
|
||||
180 | // Read the routing table entry |
|
200 | // Read the routing table entry | |
181 | if (CFGSpaceWire_GetRoutingTableEntry(hDevice, tableEntry, &routingTableEntry) != CFG_TRANSFER_SUCCESS) |
|
201 | if (CFGSpaceWire_GetRoutingTableEntry(hDevice, tableEntry, &routingTableEntry) != CFG_TRANSFER_SUCCESS) | |
182 | { |
|
202 | { | |
@@ -343,8 +363,8 unsigned int StarDundee::WriteBLOCK(char | |||||
343 | { |
|
363 | { | |
344 | RMAP *RMAPCommand; |
|
364 | RMAP *RMAPCommand; | |
345 | char * packet; |
|
365 | char * packet; | |
|
366 | char* aux; | |||
346 | unsigned char offset, headerSize, CRCSize; |
|
367 | unsigned char offset, headerSize, CRCSize; | |
347 | char* aux; |
|
|||
348 | unsigned int totalSize; |
|
368 | unsigned int totalSize; | |
349 | int errorCode; |
|
369 | int errorCode; | |
350 | QString console_message; |
|
370 | QString console_message; | |
@@ -366,16 +386,17 unsigned int StarDundee::WriteBLOCK(char | |||||
366 |
|
386 | |||
367 | //************************* |
|
387 | //************************* | |
368 | // BUILD THE PACKET TO SEND |
|
388 | // BUILD THE PACKET TO SEND | |
369 | totalSize = headerSize + nbBytes + CRCSize; |
|
389 | totalSize = headerSize + nbBytes + CRCSize + PATH_ADDRESSING_OFFSET; | |
370 | packet = (char*) malloc( totalSize ); |
|
390 | packet = (char*) malloc( totalSize ); | |
371 | aux = (char*) ((void*) &RMAPCommand->RMAPHeader); |
|
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 | offset = headerSize; |
|
394 | offset = headerSize; | |
374 | for(unsigned int i = 0; i<nbBytes; i++) |
|
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 | // SEND THE PACKET |
|
402 | // SEND THE PACKET | |
@@ -480,7 +501,10 unsigned int StarDundee::ReadBLOCK(unsig | |||||
480 | { |
|
501 | { | |
481 | int errorCode; |
|
502 | int errorCode; | |
482 | RMAP *RMAPCommand; |
|
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 | // Check the link status |
|
510 | // Check the link status | |
@@ -511,12 +535,39 unsigned int StarDundee::ReadBLOCK(unsig | |||||
511 | nbBytes, |
|
535 | nbBytes, | |
512 | NULL); |
|
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 | result = USBSpaceWire_SendPacket(hDevice, |
|
550 | result = USBSpaceWire_SendPacket(hDevice, | |
515 | (unsigned char*) ((void*) &RMAPCommand->RMAPHeader), |
|
551 | packet, | |
516 |
|
|
552 | totalSize, | |
517 | BWAIT_1, &pIdentifier); |
|
553 | BWAIT_1, &pIdentifier); | |
518 | if (result != TRANSFER_SUCCESS) emit sendMessage("ERR *** ReadStarDundee *** ReadBLOCK *** sending the READ command "); |
|
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 | // RECEIVE THE INCOMING RMAP PACKET |
|
573 | // RECEIVE THE INCOMING RMAP PACKET | |
@@ -561,20 +612,21 unsigned int StarDundee::WriteSPW(char * | |||||
561 | return 1; |
|
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 | SPWData = (char*) malloc(totalSize); |
|
616 | SPWData = (char*) malloc(totalSize); | |
566 | // SPW HEADER |
|
617 | // SPW HEADER | |
567 | SPWData[0] = targetLogicalAddress; |
|
618 | SPWData[0] = this->linkNumber_SPINBOX->value(); // 1 by default, value can be 1 or 2 | |
568 | SPWData[1] = protocoleIdentifier; |
|
619 | SPWData[0+PATH_ADDRESSING_OFFSET] = targetLogicalAddress; | |
569 | SPWData[2] = reserved; |
|
620 | SPWData[1+PATH_ADDRESSING_OFFSET] = protocoleIdentifier; | |
570 | SPWData[3] = userApplication; |
|
621 | SPWData[2+PATH_ADDRESSING_OFFSET] = reserved; | |
|
622 | SPWData[3+PATH_ADDRESSING_OFFSET] = userApplication; | |||
571 | // CCSDS PACKET |
|
623 | // CCSDS PACKET | |
572 | for (unsigned int i = 0; i<count; i++) |
|
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 | // SEND THE PACKET |
|
630 | // SEND THE PACKET | |
579 | result = USBSpaceWire_SendPacket(hDevice, |
|
631 | result = USBSpaceWire_SendPacket(hDevice, | |
580 | SPWData, |
|
632 | SPWData, | |
@@ -588,7 +640,21 unsigned int StarDundee::WriteSPW(char * | |||||
588 | free(SPWData); |
|
640 | free(SPWData); | |
589 | return 0; |
|
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 | // Free the send |
|
660 | // Free the send | |
@@ -651,6 +717,31 unsigned int StarDundee::getLinkStatus(u | |||||
651 | else return 0; |
|
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 | //sendMessage("trying to get a packet"); | |||
|
736 | result = receiveSPWPacket(requestID); | |||
|
737 | } | |||
|
738 | if (!ccsdsPacketStore.isEmpty()) | |||
|
739 | { | |||
|
740 | emit packetStoreNotEmpty(); | |||
|
741 | } | |||
|
742 | return result; | |||
|
743 | } | |||
|
744 | ||||
654 | int StarDundee::receiveSPWPacket(unsigned char requestID) // SLOT |
|
745 | int StarDundee::receiveSPWPacket(unsigned char requestID) // SLOT | |
655 | { |
|
746 | { | |
656 | unsigned int packetLength; |
|
747 | unsigned int packetLength; | |
@@ -670,7 +761,7 int StarDundee::receiveSPWPacket(unsigne | |||||
670 | // TRY TO RECEIVE DATA |
|
761 | // TRY TO RECEIVE DATA | |
671 | nbBytes = qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH); // maximum size of the packet to receive |
|
762 | nbBytes = qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH); // maximum size of the packet to receive | |
672 | nPacketNum = 1; |
|
763 | nPacketNum = 1; | |
673 | result = USBSpaceWire_ReadPackets(hDevice, spwPacket, nbBytes, nPacketNum, BWAIT_1, &properties, &pIdentifier); |
|
764 | result = USBSpaceWire_ReadPackets(hDevice, spwPacket, nbBytes, nPacketNum, BWAIT_1, &properties, &pIdentifierRead); | |
674 | if (result != TRANSFER_SUCCESS) |
|
765 | if (result != TRANSFER_SUCCESS) | |
675 | { |
|
766 | { | |
676 | emit sendMessage("Error: Could not receive the packet"); |
|
767 | emit sendMessage("Error: Could not receive the packet"); | |
@@ -679,7 +770,20 int StarDundee::receiveSPWPacket(unsigne | |||||
679 | else |
|
770 | else | |
680 | { |
|
771 | { | |
681 | packetLength = properties.len; |
|
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 | switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet |
|
789 | switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet | |
@@ -690,45 +794,62 int StarDundee::receiveSPWPacket(unsigne | |||||
690 | rmapPacketSize = packetLength; |
|
794 | rmapPacketSize = packetLength; | |
691 | rmapPacketSEMAPHORE->release(); |
|
795 | rmapPacketSEMAPHORE->release(); | |
692 | emit appendToLog("RMAP packet of size " + QString::number(packetLength) + " received"); |
|
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 | return packetLength; |
|
804 | return packetLength; | |
694 |
|
805 | |||
695 | case 2: // 0x02 is the protocole identifier for CCSDS packets |
|
806 | case 2: // 0x02 is the protocole identifier for CCSDS packets | |
696 |
if (ccsdsPacketSEMAPHORE->available()!=0) |
|
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 | for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i]; |
|
812 | for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i]; | |
698 | ccsdsPacketSize = packetLength; |
|
813 | ccsdsPacketSize = packetLength; | |
699 | ccsdsPacketSEMAPHORE->release(); |
|
814 | //ccsdsPacketSEMAPHORE->release(); | |
|
815 | //emit(ccsdsPacketAvailable(ccsdsPacket, packetLength)); | |||
700 | emit appendToLog("CCSDS packet of size " + QString::number(packetLength) + " received"); |
|
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 | return packetLength; |
|
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)); | |||
703 | } |
|
828 | } | |
704 | return 0; |
|
829 | return 0; | |
705 | } |
|
830 | } | |
706 |
|
831 | |||
707 | void StarDundee::receivePollingLoop() |
|
832 | unsigned int StarDundee::storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size) | |
708 | { |
|
833 | { | |
709 | timer->blockSignals(true); |
|
834 | unsigned int i; | |
710 | if (USBSpaceWire_WaitOnReadPacketAvailable(hDevice, 0)) receiveSPWPacket(0); |
|
835 | ccsdsPacketToProcess_t ccsdsPacketToStore; | |
711 | timer->blockSignals(false); |
|
836 | ||
|
837 | ccsdsPacketToStore.size = size; | |||
|
838 | for(i=0; i<size; i++) | |||
|
839 | { | |||
|
840 | ccsdsPacketToStore.data[i] = ccsdsPacket[i]; | |||
|
841 | } | |||
|
842 | ccsdsPacketStore << ccsdsPacketToStore; | |||
|
843 | //emit(ccsdsPacketAvailable(ccsdsPacket, packetLength)); | |||
|
844 | //emit ccsdsPacketIsAvailable(size); | |||
|
845 | return 1; | |||
712 | } |
|
846 | } | |
713 |
|
847 | |||
714 | unsigned char StarDundee::setRoutingTableEntry(int tableEntry, U32 dwOutputPorts) |
|
848 | void StarDundee::reTestSPWLink() // SLOT | |
715 | { |
|
849 | { | |
716 | U32 routingTableEntry; |
|
850 | if (getLinkStatus(linkNumber_SPINBOX->value())) | |
717 | // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET entryNumber |
|
|||
718 | if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS) |
|
|||
719 | { |
|
851 | { | |
720 | emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry)); |
|
852 | emit isOpen(true); | |
|
853 | starDundeeStatusQueryDialog->accept(); | |||
721 | } |
|
854 | } | |
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 | } |
|
855 | } |
@@ -13,9 +13,11 | |||||
13 | #include "rmapoperations.h" |
|
13 | #include "rmapoperations.h" | |
14 | #include "spw_usb_api.h" |
|
14 | #include "spw_usb_api.h" | |
15 | #include "spw_config_library.h" |
|
15 | #include "spw_config_library.h" | |
|
16 | #include "ccsds.h" | |||
16 |
|
17 | |||
17 | #define BWAIT_0 0 |
|
18 | #define BWAIT_0 0 | |
18 | #define BWAIT_1 1 |
|
19 | #define BWAIT_1 1 | |
|
20 | #define PATH_ADDRESSING_OFFSET 1 | |||
19 |
|
21 | |||
20 | class StarDundee : public QWidget |
|
22 | class StarDundee : public QWidget | |
21 | { |
|
23 | { | |
@@ -27,23 +29,28 public: | |||||
27 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
29 | unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); | |
28 | unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); |
|
30 | unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); | |
29 |
|
31 | |||
|
32 | unsigned int storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size); | |||
|
33 | QList<ccsdsPacketToProcess_t> ccsdsPacketStore; | |||
|
34 | ||||
30 | signals: |
|
35 | signals: | |
31 | void sendMessage(QString message); |
|
36 | void sendMessage(QString message); | |
32 | void isOpen(bool); |
|
37 | void isOpen(bool); | |
33 | void RMAP_write_reply_setText(QString); |
|
38 | void RMAP_write_reply_setText(QString); | |
34 | void appendToLog(QString); |
|
39 | void appendToLog(QString); | |
35 | void ccsdsPacketAvailable(unsigned char*, unsigned int); |
|
40 | void ccsdsPacketAvailable(unsigned char*, unsigned int); | |
|
41 | void packetStoreNotEmpty(); | |||
36 |
|
42 | |||
37 | public slots: |
|
43 | public slots: | |
38 | void Open(); |
|
44 | void Open(); | |
39 | void Close(); |
|
45 | void Close(); | |
40 | int receiveSPWPacket(unsigned char requestID); |
|
46 | void reTestSPWLink(); | |
|
47 | int receiveSPWPacketLoop(unsigned char requestID=0); | |||
|
48 | int receiveSPWPacket(unsigned char requestID=0); | |||
41 | void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} |
|
49 | void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} | |
42 | void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} |
|
50 | void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} | |
|
51 | void sourceHasChanged(int source) {rmapSourceLogicalAddress = (unsigned char) source;} | |||
43 | void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();} |
|
52 | void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();} | |
44 | void reTestSPWLink() {getLinkStatus(linkNumber_SPINBOX->value());} |
|
|||
45 | // |
|
53 | // | |
46 | void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;} |
|
|||
47 | void receivePollingLoop(); |
|
54 | void receivePollingLoop(); | |
48 |
|
55 | |||
49 | private: |
|
56 | private: | |
@@ -54,7 +61,7 private: | |||||
54 | unsigned char setRoutingTableEntry(int tableEntry, U32 dwOutputPorts); |
|
61 | unsigned char setRoutingTableEntry(int tableEntry, U32 dwOutputPorts); | |
55 |
|
62 | |||
56 | unsigned int getLinkStatus(unsigned char link); |
|
63 | unsigned int getLinkStatus(unsigned char link); | |
57 | unsigned int GetRoutingTableEntry(); |
|
64 | unsigned int GetRoutingTableEntry(int tableEntry); | |
58 |
|
65 | |||
59 | unsigned char rmapTargetLogicalAddress ; |
|
66 | unsigned char rmapTargetLogicalAddress ; | |
60 | unsigned char rmapSourceLogicalAddress ; |
|
67 | unsigned char rmapSourceLogicalAddress ; | |
@@ -63,12 +70,10 private: | |||||
63 |
|
70 | |||
64 | QLabel *usbDeviceNumber_LABEL; |
|
71 | QLabel *usbDeviceNumber_LABEL; | |
65 | QLabel *linkNumber_LABEL; |
|
72 | QLabel *linkNumber_LABEL; | |
66 | QLabel *sourceLogicalAddress_LABEL; |
|
|||
67 | QLabel *starDundeeStatusQueryDialogLabel; |
|
73 | QLabel *starDundeeStatusQueryDialogLabel; | |
68 |
|
74 | |||
69 | QSpinBox *usbDeviceNumber_SPINBOX; |
|
75 | QSpinBox *usbDeviceNumber_SPINBOX; | |
70 | QSpinBox *linkNumber_SPINBOX; |
|
76 | QSpinBox *linkNumber_SPINBOX; | |
71 | QSpinBox *sourceLogicalAddress_SPINBOX; |
|
|||
72 |
|
77 | |||
73 | QGridLayout *connection_LAYOUT; |
|
78 | QGridLayout *connection_LAYOUT; | |
74 | QGridLayout *starDundeeStatusQueryDialogLayout; |
|
79 | QGridLayout *starDundeeStatusQueryDialogLayout; | |
@@ -80,8 +85,9 private: | |||||
80 |
|
85 | |||
81 | QTimer *timer; |
|
86 | QTimer *timer; | |
82 |
|
87 | |||
83 | unsigned char pBuffer[10]; // Pointer to the start of the user buffer from which to transmit data |
|
88 | 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 |
|
89 | USB_SPACEWIRE_ID pIdentifierRead; // A pointer to a variable which will be set to contain a unique identifier for the read | |
|
90 | USB_SPACEWIRE_ID pIdentifier; | |||
85 |
|
91 | |||
86 | star_device_handle hDevice; // Handle to the SpaceWire device |
|
92 | star_device_handle hDevice; // Handle to the SpaceWire device | |
87 | USB_SPACEWIRE_STATUS result; // The result of the send operation |
|
93 | USB_SPACEWIRE_STATUS result; // The result of the send operation |
General Comments 0
You need to be logged in to leave comments.
Login now