##// END OF EJS Templates
the two bridges, Star Dundee and GRESB are fully functional
leroy -
r10:74729fe49979 default
parent child
Show More
@@ -1,6 +1,6
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by Qt Creator 2.4.1, 2012-12-10T15:32:54. -->
3 <!-- Written by Qt Creator 2.4.1, 2012-12-11T14:32:09. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -1,6 +1,6
1 1 #############################################################################
2 2 # Makefile for building: librmapplugin.so.1.0.0
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 10 09:02:30 2012
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 10 16:03:39 2012
4 4 # Project: rmapplugin.pro
5 5 # Template: lib
6 6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro
@@ -47,7 +47,6 SOURCES = rmapplugin.cpp \
47 47 rmappluginui.cpp \
48 48 rmapoperations.cpp \
49 49 ccsds.cpp \
50 spwpacketreceiver.cpp \
51 50 ../common_PLE/qipdialogbox.cpp \
52 51 ../common_PLE/gresbstatusenquiry.cpp \
53 52 spectralmatricesdmasimulator.cpp \
@@ -57,7 +56,6 SOURCES = rmapplugin.cpp \
57 56 bridge.cpp \
58 57 /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp moc/moc_rmappluginui.cpp \
59 58 moc/moc_rmapplugin.cpp \
60 moc/moc_spwpacketreceiver.cpp \
61 59 moc/moc_qipdialogbox.cpp \
62 60 moc/moc_gresbstatusenquiry.cpp \
63 61 moc/moc_spectralmatricesdmasimulator.cpp \
@@ -71,7 +69,6 OBJECTS = obj/rmapplugin.o \
71 69 obj/rmappluginui.o \
72 70 obj/rmapoperations.o \
73 71 obj/ccsds.o \
74 obj/spwpacketreceiver.o \
75 72 obj/qipdialogbox.o \
76 73 obj/gresbstatusenquiry.o \
77 74 obj/spectralmatricesdmasimulator.o \
@@ -82,7 +79,6 OBJECTS = obj/rmapplugin.o \
82 79 obj/lppmonplugininterface.o \
83 80 obj/moc_rmappluginui.o \
84 81 obj/moc_rmapplugin.o \
85 obj/moc_spwpacketreceiver.o \
86 82 obj/moc_qipdialogbox.o \
87 83 obj/moc_gresbstatusenquiry.o \
88 84 obj/moc_spectralmatricesdmasimulator.o \
@@ -237,7 +233,7 qmake: FORCE
237 233
238 234 dist:
239 235 @$(CHK_DIR_EXISTS) obj/rmapplugin1.0.0 || $(MKDIR) obj/rmapplugin1.0.0
240 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmappluginui.h rmapplugin.h rmapoperations.h ccsds.h spwpacketreceiver.h ../common_PLE/qipdialogbox.h ../common_PLE/gresbstatusenquiry.h spectralmatricesdmasimulator.h rmappluginpythonwrapper.h stardundee.h ../spw_usb_driver_v2.61/inc/spw_usb_api.h ../spw_usb_driver_v2.61/inc/spw_config_library.h gresb.h bridge.h /usr/include/genericPySysdriver.h /usr/include/lppmonplugin.h obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmapplugin.cpp rmappluginui.cpp rmapoperations.cpp ccsds.cpp spwpacketreceiver.cpp ../common_PLE/qipdialogbox.cpp ../common_PLE/gresbstatusenquiry.cpp spectralmatricesdmasimulator.cpp rmappluginpythonwrapper.cpp stardundee.cpp gresb.cpp bridge.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp obj/rmapplugin1.0.0/ && (cd `dirname obj/rmapplugin1.0.0` && $(TAR) rmapplugin1.0.0.tar rmapplugin1.0.0 && $(COMPRESS) rmapplugin1.0.0.tar) && $(MOVE) `dirname obj/rmapplugin1.0.0`/rmapplugin1.0.0.tar.gz . && $(DEL_FILE) -r obj/rmapplugin1.0.0
236 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmappluginui.h rmapplugin.h rmapoperations.h ccsds.h ../common_PLE/qipdialogbox.h ../common_PLE/gresbstatusenquiry.h spectralmatricesdmasimulator.h rmappluginpythonwrapper.h stardundee.h ../spw_usb_driver_v2.61/inc/spw_usb_api.h ../spw_usb_driver_v2.61/inc/spw_config_library.h gresb.h bridge.h /usr/include/genericPySysdriver.h /usr/include/lppmonplugin.h obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmapplugin.cpp rmappluginui.cpp rmapoperations.cpp ccsds.cpp ../common_PLE/qipdialogbox.cpp ../common_PLE/gresbstatusenquiry.cpp spectralmatricesdmasimulator.cpp rmappluginpythonwrapper.cpp stardundee.cpp gresb.cpp bridge.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp obj/rmapplugin1.0.0/ && (cd `dirname obj/rmapplugin1.0.0` && $(TAR) rmapplugin1.0.0.tar rmapplugin1.0.0 && $(COMPRESS) rmapplugin1.0.0.tar) && $(MOVE) `dirname obj/rmapplugin1.0.0`/rmapplugin1.0.0.tar.gz . && $(DEL_FILE) -r obj/rmapplugin1.0.0
241 237
242 238
243 239 clean:compiler_clean
@@ -259,14 +255,13 mocclean: compiler_moc_header_clean comp
259 255
260 256 mocables: compiler_moc_header_make_all compiler_moc_source_make_all
261 257
262 compiler_moc_header_make_all: moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_spwpacketreceiver.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
258 compiler_moc_header_make_all: moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
263 259 compiler_moc_header_clean:
264 -$(DEL_FILE) moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_spwpacketreceiver.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
260 -$(DEL_FILE) moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
265 261 moc/moc_rmappluginui.cpp: rmapoperations.h \
266 262 spectralmatricesdmasimulator.h \
267 263 stardundee.h \
268 264 gresb.h \
269 spwpacketreceiver.h \
270 265 rmappluginui.h
271 266 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginui.h -o moc/moc_rmappluginui.cpp
272 267
@@ -275,14 +270,10 moc/moc_rmapplugin.cpp: rmappluginui.h \
275 270 spectralmatricesdmasimulator.h \
276 271 stardundee.h \
277 272 gresb.h \
278 spwpacketreceiver.h \
279 273 ccsds.h \
280 274 rmapplugin.h
281 275 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmapplugin.h -o moc/moc_rmapplugin.cpp
282 276
283 moc/moc_spwpacketreceiver.cpp: spwpacketreceiver.h
284 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) spwpacketreceiver.h -o moc/moc_spwpacketreceiver.cpp
285
286 277 moc/moc_qipdialogbox.cpp: ../common_PLE/qipdialogbox.h
287 278 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) ../common_PLE/qipdialogbox.h -o moc/moc_qipdialogbox.cpp
288 279
@@ -299,12 +290,12 moc/moc_stardundee.cpp: rmapoperations.h
299 290 stardundee.h
300 291 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) stardundee.h -o moc/moc_stardundee.cpp
301 292
302 moc/moc_gresb.cpp: spwpacketreceiver.h \
303 rmapoperations.h \
293 moc/moc_gresb.cpp: rmapoperations.h \
304 294 gresb.h
305 295 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) gresb.h -o moc/moc_gresb.cpp
306 296
307 moc/moc_bridge.cpp: bridge.h
297 moc/moc_bridge.cpp: rmapoperations.h \
298 bridge.h
308 299 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) bridge.h -o moc/moc_bridge.cpp
309 300
310 301 moc/moc_genericPySysdriver.cpp: /usr/include/genericPySysdriver.h
@@ -338,7 +329,6 obj/rmapplugin.o: rmapplugin.cpp rmapplu
338 329 spectralmatricesdmasimulator.h \
339 330 stardundee.h \
340 331 gresb.h \
341 spwpacketreceiver.h \
342 332 ccsds.h \
343 333 rmappluginpythonwrapper.h
344 334 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmapplugin.o rmapplugin.cpp
@@ -349,7 +339,6 obj/rmappluginui.o: rmappluginui.cpp rma
349 339 spectralmatricesdmasimulator.h \
350 340 stardundee.h \
351 341 gresb.h \
352 spwpacketreceiver.h \
353 342 ccsds.h
354 343 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginui.o rmappluginui.cpp
355 344
@@ -359,10 +348,6 obj/rmapoperations.o: rmapoperations.cpp
359 348 obj/ccsds.o: ccsds.cpp ccsds.h
360 349 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/ccsds.o ccsds.cpp
361 350
362 obj/spwpacketreceiver.o: spwpacketreceiver.cpp spwpacketreceiver.h \
363 rmapoperations.h
364 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spwpacketreceiver.o spwpacketreceiver.cpp
365
366 351 obj/qipdialogbox.o: ../common_PLE/qipdialogbox.cpp ../common_PLE/qipdialogbox.h
367 352 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/qipdialogbox.o ../common_PLE/qipdialogbox.cpp
368 353
@@ -380,11 +365,11 obj/stardundee.o: stardundee.cpp stardun
380 365 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/stardundee.o stardundee.cpp
381 366
382 367 obj/gresb.o: gresb.cpp gresb.h \
383 spwpacketreceiver.h \
384 368 rmapoperations.h
385 369 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresb.o gresb.cpp
386 370
387 obj/bridge.o: bridge.cpp bridge.h
371 obj/bridge.o: bridge.cpp bridge.h \
372 rmapoperations.h
388 373 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/bridge.o bridge.cpp
389 374
390 375 obj/lppmonplugininterface.o: /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.h \
@@ -397,9 +382,6 obj/moc_rmappluginui.o: moc/moc_rmapplug
397 382 obj/moc_rmapplugin.o: moc/moc_rmapplugin.cpp
398 383 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_rmapplugin.o moc/moc_rmapplugin.cpp
399 384
400 obj/moc_spwpacketreceiver.o: moc/moc_spwpacketreceiver.cpp
401 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_spwpacketreceiver.o moc/moc_spwpacketreceiver.cpp
402
403 385 obj/moc_qipdialogbox.o: moc/moc_qipdialogbox.cpp
404 386 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_qipdialogbox.o moc/moc_qipdialogbox.cpp
405 387
@@ -78,11 +78,9 gresb::gresb(QWidget *parent) :
78 78 connect(RMAPReceive_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPReceiveConnectionState(QAbstractSocket::SocketState)));
79 79 connect(GRESBStatusQuery_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(GRESBConnectionState(QAbstractSocket::SocketState)));
80 80 connect(gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink()));
81 connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject()));
81 82 connect(spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery()));
82 83 connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacket()));
83
84 connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject()));
85 connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacket()));
86 84 }
87 85
88 86 gresb::~gresb()
@@ -196,7 +194,7 unsigned int gresb::Read(unsigned int *V
196 194 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
197 195 address = address + READ_WRITE_MAX_COUNTS * 4;
198 196 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
199 acquireRMAPSemaphore();
197 rmapPacketSEMAPHORE->acquire();
200 198 }
201 199
202 200 if (remainingCount > 0)
@@ -218,7 +216,7 unsigned int gresb::Read(unsigned int *V
218 216 Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256;
219 217 }
220 218 }
221 acquireRMAPSemaphore();
219 rmapPacketSEMAPHORE->acquire();
222 220 }
223 221
224 222 emit appendToLog(QString("*** STOP *** READ "));
@@ -400,7 +398,7 unsigned int gresb::ReadBLOCK(unsigned i
400 398 emit appendToLog("WARNING === in function READ of rmapplugin *** number of data received ("
401 399 +QString::number(dataLength)
402 400 +") not equal to number of data requested ("
403 +QString::number(READ_WRITE_MAX_COUNTS*4)
401 +QString::number(nbBytes)
404 402 +")");
405 403 return 0;
406 404 }
@@ -488,7 +486,6 int gresb::receiveSPWPacket(unsigned cha
488 486 RMAPReceive_SOCKET->read( (char*) &packetLength1, 1);
489 487 RMAPReceive_SOCKET->read( (char*) &packetLength0, 1);
490 488 packetLength = (packetLength2<<16) + (packetLength1<<8) + (packetLength0);
491 spwPacket = (char*) malloc(packetLength);
492 489
493 490 // READ THE SPW PACKET
494 491 while(RMAPReceive_SOCKET->bytesAvailable() < packetLength)
@@ -498,6 +495,7 int gresb::receiveSPWPacket(unsigned cha
498 495 }
499 496 RMAPReceive_SOCKET->read( spwPacket, packetLength );
500 497 RMAPReceive_SOCKET->blockSignals(0);
498 //emit sendMessage("Packet of size " + QString::number(packetLength) + " received");
501 499
502 500 switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet
503 501 {
@@ -506,7 +504,7 int gresb::receiveSPWPacket(unsigned cha
506 504 for(unsigned int i=0; i<packetLength; i++) rmapPacket[i] = spwPacket[i];
507 505 rmapPacketSize = packetLength;
508 506 rmapPacketSEMAPHORE->release();
509 //emit sendMessage("RMAP packet of size " + QString::number(packetLength) + " received");
507 emit sendMessage("RMAP packet of size " + QString::number(packetLength) + " received");
510 508 return packetLength;
511 509
512 510 case 2: // 0x02 is the protocole identifier for CCSDS packets
@@ -515,6 +513,7 int gresb::receiveSPWPacket(unsigned cha
515 513 ccsdsPacketSize = packetLength;
516 514 ccsdsPacketSEMAPHORE->release();
517 515 emit(ccsdsPacketAvailable(ccsdsPacket, packetLength));
516 //emit sendMessage("CCSDS packet of size " + QString::number(packetLength) + " received");
518 517 return packetLength;
519 518 }
520 519 return 0;
@@ -663,38 +662,6 int gresb::GRESBStatusQueryRequest(Gresb
663 662 return 0;
664 663 }
665 664
666 void gresb::processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size) // SLOT
667 {
668 QString message;
669 unsigned int fine_time_value = 0;
670 fine_time_value = ((unsigned int) ccsdsPacket[7]<<24)
671 + ((unsigned int) ccsdsPacket[6]<<16)
672 + ((unsigned int) ccsdsPacket[5]<<8)
673 + ((unsigned int) ccsdsPacket[4]);
674 message.append(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": ");
675 message.append("size "
676 + QString::number(size)
677 +" *** header "
678 + QString::number(ccsdsPacket[0], 16)
679 + " "
680 + QString::number(ccsdsPacket[1], 16)
681 + " "
682 + QString::number(ccsdsPacket[2], 16)
683 + " "
684 + QString::number(ccsdsPacket[3], 16)
685 + " *** coarse time "
686 + QString::number(fine_time_value));
687 //+ QString::number(ccsdsPacket[4], 16)
688 //+" "
689 //+ QString::number(ccsdsPacket[5], 16)
690 //+" "
691 //+ QString::number(ccsdsPacket[6], 16)
692 //+" "
693 //+ QString::number(ccsdsPacket[7], 16));
694 ccsdsPacketSEMAPHORE->acquire();
695 emit sendMessage(message);
696 }
697
698 665 void gresb::reTestSPWLink() // SLOT
699 666 {
700 667 if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 0)
@@ -11,7 +11,6
11 11 #include <QSemaphore>
12 12
13 13 #include "gresbstatusenquiry.h"
14 #include "spwpacketreceiver.h"
15 14 #include "rmapoperations.h"
16 15 #include "qipdialogbox.h"
17 16
@@ -36,13 +35,14 public slots:
36 35 void Open();
37 36 void Close();
38 37 int receiveSPWPacket(unsigned char requestID=0);
39 void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size);
38 void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
39 void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
40 void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();}
40 41 void reTestSPWLink();
42 //
41 43 void RMAPSendConnectionState(QAbstractSocket::SocketState socketState);
42 44 void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState);
43 45 void GRESBConnectionState(QAbstractSocket::SocketState socketState);
44 void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
45 void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
46 46
47 47 private slots:
48 48 int GRESBStatusQuery();
@@ -50,8 +50,8 private slots:
50 50 private:
51 51 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
52 52 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
53 void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->acquire();}
54 void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->acquire();}
53 void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->tryAcquire();}
54 void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->tryAcquire();}
55 55 int GRESBStatusQueryRequest(GresbStatusQueryOption option, char link);
56 56
57 57 unsigned char rmapTargetLogicalAddress ;
@@ -61,12 +61,18 rmapplugin::rmapplugin(QWidget *parent)
61 61 connect(this->UI->gresbBridge, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool)));
62 62 connect(this->UI->gresbBridge, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString)));
63 63 connect(this->UI->gresbBridge, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString)));
64 connect(this->UI->gresbBridge, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)),
65 this, SLOT(processCCSDSPacket(unsigned char*,uint)));
66 connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->gresbBridge, SLOT(ccsdsPacketIsProcessed()));
64 67
65 68 // Star Dundee
66 69 connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
67 70 connect(this->UI->starDundee, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool)));
68 71 connect(this->UI->starDundee, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString)));
69 72 connect(this->UI->starDundee, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString)));
73 connect(this->UI->starDundee, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)),
74 this, SLOT(processCCSDSPacket(unsigned char*,uint)));
75 connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->starDundee, SLOT(ccsdsPacketIsProcessed()));
70 76
71 77 connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(bridgeHasChanged(selectedBridge)));
72 78 }
@@ -276,11 +282,35 void rmapplugin::appendToLog(QString tex
276 282 /////////////////////
277 283 // INTERNAL FUNCTIONS
278 284
279 void rmapplugin::gresbSelection(bool flag)
285 void rmapplugin::processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size) // SLOT
280 286 {
281 if (flag == true) UI->selection_GROUPBOX->setEnabled(false);
282 if (flag == false) UI->selection_GROUPBOX->setEnabled(true);
287 QString message;
288 unsigned int fine_time_value = 0;
289 fine_time_value = ((unsigned int) ccsdsPacket[7]<<24)
290 + ((unsigned int) ccsdsPacket[6]<<16)
291 + ((unsigned int) ccsdsPacket[5]<<8)
292 + ((unsigned int) ccsdsPacket[4]);
293 message.append(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": ");
294 message.append("size "
295 + QString::number(size)
296 +" *** header "
297 + QString::number(ccsdsPacket[0], 16)
298 + " "
299 + QString::number(ccsdsPacket[1], 16)
300 + " "
301 + QString::number(ccsdsPacket[2], 16)
302 + " "
303 + QString::number(ccsdsPacket[3], 16)
304 + " *** coarse time "
305 + QString::number(fine_time_value));
306 //+ QString::number(ccsdsPacket[4], 16)
307 //+" "
308 //+ QString::number(ccsdsPacket[5], 16)
309 //+" "
310 //+ QString::number(ccsdsPacket[6], 16)
311 //+" "
312 //+ QString::number(ccsdsPacket[7], 16));
313 displayOnConsole(message);
314 emit ccsdsPacketIsProcessed();
283 315 }
284 316
285
286
@@ -31,7 +31,6
31 31 #include <QTime>
32 32 #include <ccsds.h>
33 33 #include <QSemaphore>
34 #include <spwpacketreceiver.h>
35 34
36 35 #include <lppmonplugin.h>
37 36
@@ -57,13 +56,13 public slots:
57 56 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
58 57 void openBridge();
59 58 void closeBridge();
59 void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size);
60 60 //
61 61 void sendCCSDS();
62 62 void send_TC_LFR_UPDATE_TIME();
63 63 void reset_TC_LFR_UPDATE_TIME();
64 64 void displayOnConsole(QString message) {this->UI->console->append(message);}
65 65 //
66 void gresbSelection(bool flag);
67 66 void RMAP_write_reply_setText(QString text);
68 67 void appendToLog(QString text);
69 68 //
@@ -71,6 +70,7 public slots:
71 70 void bridgeHasChanged(selectedBridge bridge) {currentBridge = bridge;}
72 71
73 72 signals:
73 void ccsdsPacketIsProcessed();
74 74
75 75 private:
76 76 selectedBridge currentBridge;
@@ -82,7 +82,6 private:
82 82 unsigned int rmapPacketSize;
83 83 unsigned int time_COARSE;
84 84 unsigned int time_FINE;
85 spwpacketreceiver* spwPacketReceiverOBJECT;
86 85 char timeCode;
87 86 };
88 87
@@ -35,7 +35,6 HEADERS += \
35 35 rmapplugin.h \
36 36 rmapoperations.h \
37 37 ccsds.h \
38 spwpacketreceiver.h \
39 38 ../common_PLE/qipdialogbox.h \
40 39 ../common_PLE/gresbstatusenquiry.h \
41 40 spectralmatricesdmasimulator.h \
@@ -52,7 +51,6 SOURCES += \
52 51 rmappluginui.cpp \
53 52 rmapoperations.cpp \
54 53 ccsds.cpp \
55 spwpacketreceiver.cpp \
56 54 ../common_PLE/qipdialogbox.cpp \
57 55 ../common_PLE/gresbstatusenquiry.cpp \
58 56 spectralmatricesdmasimulator.cpp \
@@ -160,8 +160,8 rmapPluginUI::rmapPluginUI(QWidget *pare
160 160 mainLayout->addWidget(spwTabWidget);
161 161 setLayout(mainLayout);
162 162
163 //connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject()));
164 163 connect(this->clearConsoleButton, SIGNAL(clicked()), this->console, SLOT(clear()));
164
165 165 // briges
166 166 connect(this->selectGRESB_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee()));
167 167 connect(this->selectStarDundee_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee()));
@@ -6,12 +6,15 StarDundee::StarDundee(QWidget *parent)
6 6 QWidget(parent)
7 7 {
8 8 // Packet receiver
9 timer = new QTimer;
9 10 rmapPacketSEMAPHORE = new QSemaphore;
10 11 ccsdsPacketSEMAPHORE = new QSemaphore;
11 12 rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH);
12 13 ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH);
13 14 spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) );
14 15
16 starDundeeStatusQueryDialog = new QDialog;
17
15 18 commandCode = invalid0; // initialization of the cmmand code for the RMAP transfers
16 19
17 20 rmapSourceLogicalAddress = 0x20;
@@ -20,6 +23,11 StarDundee::StarDundee(QWidget *parent)
20 23 usbDeviceNumber_LABEL = new QLabel(tr("USB device number: "));
21 24 linkNumber_LABEL = new QLabel(tr("SpaceWire link number: "));
22 25 sourceLogicalAddress_LABEL = new QLabel(tr("Source logical address: "));
26 starDundeeStatusQueryDialogLabel = new QLabel(tr("SpaceWire link not running"));
27
28 //*** QPUSHBUTTON ***//
29 starDundeeStatusQueryRetryButton = new QPushButton(tr("Retry"));
30 starDundeeStatusQueryAbortButton = new QPushButton(tr("Abort"));
23 31
24 32 usbDeviceNumber_SPINBOX = new QSpinBox;
25 33 usbDeviceNumber_SPINBOX->setRange(0,32);
@@ -31,6 +39,13 StarDundee::StarDundee(QWidget *parent)
31 39 sourceLogicalAddress_SPINBOX->setRange(0,254);
32 40 sourceLogicalAddress_SPINBOX->setValue(32);
33 41
42 // STAR DUNDEE STATUS QUERY DIALOG
43 starDundeeStatusQueryDialogLayout = new QGridLayout;
44 starDundeeStatusQueryDialogLayout->addWidget(starDundeeStatusQueryDialogLabel, 0, 0, 1, 2);
45 starDundeeStatusQueryDialogLayout->addWidget(starDundeeStatusQueryRetryButton, 1, 0, 0);
46 starDundeeStatusQueryDialogLayout->addWidget(starDundeeStatusQueryAbortButton, 1, 1, 0);
47 starDundeeStatusQueryDialog->setLayout(starDundeeStatusQueryDialogLayout);
48
34 49 connection_LAYOUT->addWidget(usbDeviceNumber_LABEL, 0, 0, 1, 1);
35 50 connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 0, 1, 1, 1);
36 51 connection_LAYOUT->addWidget(linkNumber_LABEL, 1, 0, 1, 1);
@@ -44,6 +59,12 StarDundee::StarDundee(QWidget *parent)
44 59 this->setLayout(connection_LAYOUT);
45 60
46 61 connect(this->sourceLogicalAddress_SPINBOX, SIGNAL(valueChanged(int)), this, SLOT(sourceHasChanged(int)));
62
63 connect(starDundeeStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink()));
64 connect(starDundeeStatusQueryAbortButton, SIGNAL(clicked()), starDundeeStatusQueryDialog, SLOT(reject()));
65
66 connect(this->timer, SIGNAL(timeout()), this, SLOT(receivePollingLoop()));
67 timer->start(100); // starts the periodical timer, perdio = 100ms
47 68 }
48 69
49 70 StarDundee::~StarDundee()
@@ -58,8 +79,6 void StarDundee::Open()
58 79 {
59 80 int status;
60 81 U32 statusControl;
61 U32 routingTableEntry;
62 int tableEntry;
63 82
64 83 if (!USBSpaceWire_Open(&hDevice, usbDeviceNumber_SPINBOX->value())) // Open the USB device
65 84 {
@@ -110,44 +129,9 void StarDundee::Open()
110 129 else emit sendMessage("Set the link status control for link " + QString::number(linkNumber_SPINBOX->value()));
111 130 }
112 131
113 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET 254 <=> 0xfe
114 tableEntry = rmapTargetLogicalAddress;
115 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
116 {
117 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
118 }
119 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] cleared");
120 // Build the routing table entry to route out of port 1 with header deletion disabled and priority normal
121 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
122 (1<<linkNumber_SPINBOX->value()), // 0x02 = 0000 0010
123 0,
124 0);
125 // Set the routing table entry for logical address tableEntry
126 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
127 {
128 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
129 }
130 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
131
132 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET 32 <=> 0x20
133 tableEntry = sourceLogicalAddress_SPINBOX->value();
134 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
135 {
136 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
137 }
138 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] cleared");
139
140 // Build the routing table entry to route out of port 3 with header deletion disabled and priority normal
141 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
142 (1<<3), // 0x02 = 0000 0010
143 0,
144 0);
145 // Set the routing table entry for logical address tableEntry
146 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
147 {
148 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
149 }
150 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
132 setRoutingTableEntry(rmapTargetLogicalAddress, (1<<linkNumber_SPINBOX->value()));
133 setRoutingTableEntry(sourceLogicalAddress_SPINBOX->value(), (1<<3));
134 //setRoutingTableEntry(33, (1<<3));
151 135
152 136 emit sendMessage("The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes");
153 137
@@ -158,7 +142,14 void StarDundee::Open()
158 142 while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire();
159 143 while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire();
160 144
161 emit isOpen(true);
145 if (getLinkStatus(linkNumber_SPINBOX->value()))
146 {
147 emit isOpen(true);
148 }
149 else
150 {
151
152 }
162 153 }
163 154
164 155 void StarDundee::Close()
@@ -669,7 +660,10 int StarDundee::receiveSPWPacket(unsigne
669 660
670 661 if (requestID==1)
671 662 {
672 if (rmapPacketSEMAPHORE->available()) return rmapPacketSize;
663 if (rmapPacketSEMAPHORE->available())
664 {
665 return rmapPacketSize;
666 }
673 667 }
674 668
675 669 //********************
@@ -677,13 +671,16 int StarDundee::receiveSPWPacket(unsigne
677 671 nbBytes = qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH); // maximum size of the packet to receive
678 672 nPacketNum = 1;
679 673 result = USBSpaceWire_ReadPackets(hDevice, spwPacket, nbBytes, nPacketNum, BWAIT_1, &properties, &pIdentifier);
680 if (result != TRANSFER_SUCCESS) emit sendMessage("Error: Could not receive the packet");
674 if (result != TRANSFER_SUCCESS)
675 {
676 emit sendMessage("Error: Could not receive the packet");
677 return 0;
678 }
681 679 else
682 680 {
683 emit sendMessage("A packet of length " + QString::number(properties.len) + " has been successfully received");
681 packetLength = properties.len;
684 682 USBSpaceWire_FreeRead(hDevice, pIdentifier); // Free the receive
685 683 }
686 packetLength = properties.len;
687 684
688 685 switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet
689 686 {
@@ -692,7 +689,7 int StarDundee::receiveSPWPacket(unsigne
692 689 for(unsigned int i=0; i<packetLength; i++) rmapPacket[i] = spwPacket[i];
693 690 rmapPacketSize = packetLength;
694 691 rmapPacketSEMAPHORE->release();
695 emit sendMessage("RMAP packet of size " + QString::number(packetLength) + " received");
692 emit appendToLog("RMAP packet of size " + QString::number(packetLength) + " received");
696 693 return packetLength;
697 694
698 695 case 2: // 0x02 is the protocole identifier for CCSDS packets
@@ -700,10 +697,38 int StarDundee::receiveSPWPacket(unsigne
700 697 for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i];
701 698 ccsdsPacketSize = packetLength;
702 699 ccsdsPacketSEMAPHORE->release();
700 emit appendToLog("CCSDS packet of size " + QString::number(packetLength) + " received");
703 701 emit(ccsdsPacketAvailable(ccsdsPacket, packetLength));
704 702 return packetLength;
705 703 }
706 704 return 0;
707 705 }
708 706
707 void StarDundee::receivePollingLoop()
708 {
709 timer->blockSignals(true);
710 if (USBSpaceWire_WaitOnReadPacketAvailable(hDevice, 0)) receiveSPWPacket(0);
711 timer->blockSignals(false);
712 }
709 713
714 unsigned char StarDundee::setRoutingTableEntry(int tableEntry, U32 dwOutputPorts)
715 {
716 U32 routingTableEntry;
717 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET entryNumber
718 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
719 {
720 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
721 }
722 // Build the routing table entry
723 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
724 dwOutputPorts, // route out of port dwOutputPorts
725 0, // header deletion disabled
726 0); // priority normal
727 // Set the routing table entry for logical address tableEntry
728 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
729 {
730 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
731 }
732 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
733
734 }
@@ -2,14 +2,17
2 2 #define STARDUNDEE_H
3 3
4 4 #include <QWidget>
5 #include "spw_usb_api.h"
6 #include "spw_config_library.h"
7 5 #include <QPushButton>
8 6 #include <QGridLayout>
9 7 #include <QSpinBox>
10 8 #include <QLabel>
11 9 #include <QSemaphore>
10 #include <QTimer>
11 #include <QDialog>
12
12 13 #include "rmapoperations.h"
14 #include "spw_usb_api.h"
15 #include "spw_config_library.h"
13 16
14 17 #define BWAIT_0 0
15 18 #define BWAIT_1 1
@@ -37,13 +40,18 public slots:
37 40 int receiveSPWPacket(unsigned char requestID);
38 41 void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
39 42 void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
43 void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();}
44 void reTestSPWLink() {getLinkStatus(linkNumber_SPINBOX->value());}
45 //
40 46 void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;}
47 void receivePollingLoop();
41 48
42 49 private:
43 50 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
44 51 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
45 void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->acquire();}
46 void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->acquire();}
52 void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->tryAcquire();}
53 void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->tryAcquire();}
54 unsigned char setRoutingTableEntry(int tableEntry, U32 dwOutputPorts);
47 55
48 56 unsigned int getLinkStatus(unsigned char link);
49 57 unsigned int GetRoutingTableEntry();
@@ -56,12 +64,21 private:
56 64 QLabel *usbDeviceNumber_LABEL;
57 65 QLabel *linkNumber_LABEL;
58 66 QLabel *sourceLogicalAddress_LABEL;
67 QLabel *starDundeeStatusQueryDialogLabel;
59 68
60 69 QSpinBox *usbDeviceNumber_SPINBOX;
61 70 QSpinBox *linkNumber_SPINBOX;
62 71 QSpinBox *sourceLogicalAddress_SPINBOX;
63 72
64 73 QGridLayout *connection_LAYOUT;
74 QGridLayout *starDundeeStatusQueryDialogLayout;
75
76 QDialog *starDundeeStatusQueryDialog;
77
78 QPushButton *starDundeeStatusQueryRetryButton;
79 QPushButton *starDundeeStatusQueryAbortButton;
80
81 QTimer *timer;
65 82
66 83 unsigned char pBuffer[10]; // Pointer to the start of the user buffer from which to transmit data
67 84 USB_SPACEWIRE_ID pIdentifier; // A pointer to a variable which will be set to contain a unique identifier for the send
General Comments 0
You need to be logged in to leave comments. Login now