# HG changeset patch # User Paul LEROY # Date 2012-12-10 07:56:08 # Node ID fb2c374505d087a69693107643d4e5f086f40f0d # Parent 73b8297d63900d3376bdf855dd0b4599b0405e18 changes on the gresb class, several methods and parameters added diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: PAULs_LPPMON_PLUGINS -# Generated by qmake (2.01a) (Qt 4.8.3) on: Thu Nov 29 14:02:20 2012 +# Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 10 08:08:24 2012 # Project: PAULs_LPPMON_PLUGINS.pro # Template: subdirs # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro diff --git a/PAULs_LPPMON_PLUGINS.pro.user b/PAULs_LPPMON_PLUGINS.pro.user --- a/PAULs_LPPMON_PLUGINS.pro.user +++ b/PAULs_LPPMON_PLUGINS.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/rmapplugin/Makefile b/rmapplugin/Makefile --- a/rmapplugin/Makefile +++ b/rmapplugin/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: librmapplugin.so.1.0.0 -# Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 3 13:45:43 2012 +# Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 10 08:08:25 2012 # Project: rmapplugin.pro # Template: lib # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro @@ -54,6 +54,7 @@ SOURCES = rmapplugin.cpp \ rmappluginpythonwrapper.cpp \ stardundee.cpp \ gresb.cpp \ + bridge.cpp \ /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp moc/moc_rmappluginui.cpp \ moc/moc_rmapplugin.cpp \ moc/moc_spwpacketreceiver.cpp \ @@ -63,6 +64,7 @@ SOURCES = rmapplugin.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 OBJECTS = obj/rmapplugin.o \ @@ -76,6 +78,7 @@ OBJECTS = obj/rmapplugin.o \ obj/rmappluginpythonwrapper.o \ obj/stardundee.o \ obj/gresb.o \ + obj/bridge.o \ obj/lppmonplugininterface.o \ obj/moc_rmappluginui.o \ obj/moc_rmapplugin.o \ @@ -86,6 +89,7 @@ OBJECTS = obj/rmapplugin.o \ obj/moc_rmappluginpythonwrapper.o \ obj/moc_stardundee.o \ obj/moc_gresb.o \ + obj/moc_bridge.o \ obj/moc_genericPySysdriver.o \ obj/moc_lppmonplugin.o DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ @@ -233,7 +237,7 @@ qmake: FORCE dist: @$(CHK_DIR_EXISTS) obj/rmapplugin1.0.0 || $(MKDIR) obj/rmapplugin1.0.0 - $(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 /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 /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 + $(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 clean:compiler_clean @@ -255,12 +259,13 @@ mocclean: compiler_moc_header_clean comp mocables: compiler_moc_header_make_all compiler_moc_source_make_all -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_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp +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 compiler_moc_header_clean: - -$(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_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp + -$(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 moc/moc_rmappluginui.cpp: rmapoperations.h \ spectralmatricesdmasimulator.h \ stardundee.h \ + gresb.h \ rmappluginui.h /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginui.h -o moc/moc_rmappluginui.cpp @@ -268,6 +273,7 @@ moc/moc_rmapplugin.cpp: rmappluginui.h \ rmapoperations.h \ spectralmatricesdmasimulator.h \ stardundee.h \ + gresb.h \ ccsds.h \ spwpacketreceiver.h \ rmapplugin.h @@ -288,12 +294,16 @@ moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp: rmappluginpythonwrapper.h /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginpythonwrapper.h -o moc/moc_rmappluginpythonwrapper.cpp -moc/moc_stardundee.cpp: stardundee.h +moc/moc_stardundee.cpp: rmapoperations.h \ + stardundee.h /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) stardundee.h -o moc/moc_stardundee.cpp moc/moc_gresb.cpp: gresb.h /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) gresb.h -o moc/moc_gresb.cpp +moc/moc_bridge.cpp: bridge.h + /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) bridge.h -o moc/moc_bridge.cpp + moc/moc_genericPySysdriver.cpp: /usr/include/genericPySysdriver.h /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/genericPySysdriver.h -o moc/moc_genericPySysdriver.cpp @@ -324,6 +334,7 @@ obj/rmapplugin.o: rmapplugin.cpp rmapplu rmapoperations.h \ spectralmatricesdmasimulator.h \ stardundee.h \ + gresb.h \ ccsds.h \ spwpacketreceiver.h \ rmappluginpythonwrapper.h @@ -334,6 +345,7 @@ obj/rmappluginui.o: rmappluginui.cpp rma rmapoperations.h \ spectralmatricesdmasimulator.h \ stardundee.h \ + gresb.h \ ccsds.h \ spwpacketreceiver.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginui.o rmappluginui.cpp @@ -344,7 +356,8 @@ obj/rmapoperations.o: rmapoperations.cpp obj/ccsds.o: ccsds.cpp ccsds.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/ccsds.o ccsds.cpp -obj/spwpacketreceiver.o: spwpacketreceiver.cpp spwpacketreceiver.h +obj/spwpacketreceiver.o: spwpacketreceiver.cpp spwpacketreceiver.h \ + rmapoperations.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spwpacketreceiver.o spwpacketreceiver.cpp obj/qipdialogbox.o: ../common_PLE/qipdialogbox.cpp ../common_PLE/qipdialogbox.h @@ -366,6 +379,9 @@ obj/stardundee.o: stardundee.cpp stardun obj/gresb.o: gresb.cpp gresb.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresb.o gresb.cpp +obj/bridge.o: bridge.cpp bridge.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/bridge.o bridge.cpp + obj/lppmonplugininterface.o: /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.h \ /usr/include/lppmon/pluginsInterface/lppmonplugininterface_global.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/lppmonplugininterface.o /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp @@ -397,6 +413,9 @@ obj/moc_stardundee.o: moc/moc_stardundee obj/moc_gresb.o: moc/moc_gresb.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_gresb.o moc/moc_gresb.cpp +obj/moc_bridge.o: moc/moc_bridge.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_bridge.o moc/moc_bridge.cpp + obj/moc_genericPySysdriver.o: moc/moc_genericPySysdriver.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_genericPySysdriver.o moc/moc_genericPySysdriver.cpp diff --git a/rmapplugin/gresb.cpp b/rmapplugin/gresb.cpp --- a/rmapplugin/gresb.cpp +++ b/rmapplugin/gresb.cpp @@ -1,8 +1,16 @@ #include "gresb.h" +#include +#include gresb::gresb(QWidget *parent) : QWidget(parent) { + RMAPSend_SOCKET = new QTcpSocket; + RMAPReceive_SOCKET = new QTcpSocket; + GRESBStatusQuery_SOCKET = new QTcpSocket; + spwPacketReceiverOBJECT = new spwpacketreceiver; + spwPacketReceiverOBJECT->gresbReceptionSocket = RMAPReceive_SOCKET; + //*** QLABEL ***// gresbBridgeIPLabel = new QLabel(tr("GRESB Bridge IP: ")); gresbVirtualLinkLabel = new QLabel(tr("GRESB Virtual Link: ")); @@ -11,6 +19,7 @@ gresb::gresb(QWidget *parent) : rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection")); rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection")); gresbStatusQueryLabel = new QLabel(tr("GRESB status query socket (port 3010): waiting for connection")); + gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running")); //*** SPINBOX ***// gresbVirtualLinkSpinBox = new QSpinBox; @@ -23,11 +32,17 @@ gresb::gresb(QWidget *parent) : spwLinkSpinBox->setRange(0, 2); spwLinkSpinBox->setValue(0); + //*** QPUSHBUTTON ***// + gresbStatusQueryRetryButton = new QPushButton(tr("Retry")); + gresbStatusQueryAbortButton = new QPushButton(tr("Abort")); + //*** LAYOUT ***// connectionLayout = new QGridLayout; //*** MISC ***// + gresbStatusQueryDialog = new QDialog; gresbBridgeIPDialogBox = new QIPDialogBox; + spwLinkStatusEnquiry = new gresbStatusEnquiry; connectionLayout->addWidget(gresbBridgeIPLabel, 0, 0, 0); connectionLayout->addWidget(gresbBridgeIPDialogBox, 0, 1, 0); @@ -44,5 +59,157 @@ gresb::gresb(QWidget *parent) : connectionLayout->setRowStretch(7, 1); connectionLayout->setColumnStretch(2, 1); + // GRESB STATUS QUERY DIALOG + gresbStatusQueryDialogLayout = new QGridLayout; + gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryDialogLabel, 0, 0, 1, 2); + gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryRetryButton, 1, 0, 0); + gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryAbortButton, 1, 1, 0); + gresbStatusQueryDialog->setLayout(gresbStatusQueryDialogLayout); + this->setLayout(connectionLayout); + + connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject())); } + +void gresb::Open() // SLOT +{ + bool spwRunning = true; + RMAPSend_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()), + 3000 + gresbVirtualLinkSpinBox->value()*2, + QIODevice::WriteOnly); + RMAPReceive_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()), + 3000 + gresbVirtualLinkSpinBox->value()*2+1, + QIODevice::ReadOnly); + GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()), + 3010, + QIODevice::ReadWrite); + GRESBStatusQuery_SOCKET->waitForConnected(10000); + RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket + // initialize SPW packet semaphores + while (spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->acquire(); + while (spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->acquire(); + if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) != 0) + { + spwRunning = gresbStatusQueryDialog->exec(); + } + if (spwRunning == false) this->Close(); + else + { + emit appendToLog(QString("SpaceWire running on virtual link ")+ QString::number(spwLinkSpinBox->value())); + emit isOpen(true); + } +} + +void gresb::Close() // SLOT +{ + RMAPSend_SOCKET->disconnectFromHost(); + RMAPReceive_SOCKET->disconnectFromHost(); + GRESBStatusQuery_SOCKET->disconnectFromHost(); + emit isOpen(false); +} + +int gresb::GRESBStatusQuery() // SLOT +{ + GRESBStatusQueryRequest(LinkStatus, 0); + GRESBStatusQueryRequest(LinkStatus, 1); + GRESBStatusQueryRequest(LinkStatus, 2); + GRESBStatusQueryRequest(LinkStatistics, 0); + GRESBStatusQueryRequest(LinkStatistics, 1); + GRESBStatusQueryRequest(LinkStatistics, 2); + return 0; +} + +int gresb::GRESBStatusQueryRequest(GresbStatusQueryOption option, char link) +{ + gresb_status_query_t statusQueryCommand; + gresb_link_status_reply_t linkStatusReply; + gresb_link_statistics_reply_t linkStatisticsReply; + QTime statusQueryTimeout; + QString console_message; + + statusQueryCommand.protocolIdentifier = (char) 0x02; + statusQueryCommand.reserved1 = (char) 0x00; + statusQueryCommand.reserved0 = (char) 0x00; + statusQueryCommand.option = (char) option; + statusQueryCommand.value3 = (char) 0x00; + statusQueryCommand.value2 = (char) 0x00; + statusQueryCommand.value1 = (char) 0x00; + statusQueryCommand.value0 = (char) link; + + GRESBStatusQuery_SOCKET->write((char*) ((void*) &statusQueryCommand), sizeof(statusQueryCommand)); + GRESBStatusQuery_SOCKET->flush(); + GRESBStatusQuery_SOCKET->waitForBytesWritten(1000); + + statusQueryTimeout.start(); + while(GRESBStatusQuery_SOCKET->bytesToWrite() > 0) + { + GRESBStatusQuery_SOCKET->waitForBytesWritten(100); + if(statusQueryTimeout.elapsed()>1000) + { + emit appendToLog("WARNING === in function GRESBStatusQueryRequest of rmapplugin *** sending StatusQueryCommand timeout"); + return 1; + } + } + + switch (option) + { + case LinkStatus: + { + statusQueryTimeout.start(); + while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatusReply)) + { + GRESBStatusQuery_SOCKET->waitForReadyRead(100); + if(statusQueryTimeout.elapsed()>1000) + { + console_message.sprintf("GRESBStatusQueryRequest / LinkStatus => error timeout bytesAvailable()\n"); + emit appendToLog(console_message); + return 1; + } + } + GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatusReply), (int) sizeof(linkStatusReply)); + console_message.sprintf("%x", linkStatusReply.byte0); + spwLinkStatusEnquiry->statusQueryTable->item(0, link)->setText(console_message); + console_message.sprintf("%d", linkStatusReply.byte1); + spwLinkStatusEnquiry->statusQueryTable->item(1, link)->setText(console_message); + if (linkStatusReply.byte0 == 0) return 1; + break; + } + case LinkStatistics: + { + statusQueryTimeout.start(); + while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatisticsReply)) + { + GRESBStatusQuery_SOCKET->waitForReadyRead(100); + if(statusQueryTimeout.elapsed()>1000) + { + console_message.sprintf("GRESBStatusQueryRequest / LinkStatistics => error timeout bytesAvailable()\n"); + emit appendToLog(console_message); + return 1; + } + } + GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatisticsReply), sizeof(linkStatisticsReply)); + /*console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataTransmitted)); + UI->spwLinkStatusEnquiry->statusQueryTable->item(9, link)->setText(console_message); + console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsTransmitted)); + UI->spwLinkStatusEnquiry->statusQueryTable->item(8, link)->setText(console_message); + console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfTruncatedPacketsReceived)); + UI->spwLinkStatusEnquiry->statusQueryTable->item(6, link)->setText(console_message); + console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsWithEEPReceived)); + UI->spwLinkStatusEnquiry->statusQueryTable->item(5, link)->setText(console_message); + console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataReceived)); + UI->spwLinkStatusEnquiry->statusQueryTable->item(4, link)->setText(console_message); + console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsReceived)); + UI->spwLinkStatusEnquiry->statusQueryTable->item(3, link)->setText(console_message);*/ + break; + } + case NodeAddressStatistics: + { + break; + } + case GetRoute: + { + break; + } + } + return 0; +} diff --git a/rmapplugin/gresb.h b/rmapplugin/gresb.h --- a/rmapplugin/gresb.h +++ b/rmapplugin/gresb.h @@ -6,6 +6,12 @@ #include #include #include +#include +#include + +#include "gresbstatusenquiry.h" +#include "spwpacketreceiver.h" +#include "rmapoperations.h" #include "qipdialogbox.h" class gresb : public QWidget @@ -13,12 +19,41 @@ class gresb : public QWidget Q_OBJECT public: explicit gresb(QWidget *parent = 0); + ~gresb(); + unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); + unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); + unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); + unsigned int getLinkStatus(unsigned char link); signals: - + void sendMessage(QString message); + void isOpen(bool); + void RMAP_write_reply_setText(QString); + void appendToLog(QString); + void ccsdsPacketAvailable(unsigned char*, unsigned int); + public slots: + void Open(); + void Close(); + int receiveSPWPacket(unsigned char requestID); + void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} + void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} + void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;} + +private slots: + int GRESBStatusQuery(); private: + int GRESBStatusQueryRequest(GresbStatusQueryOption option, char link); + + unsigned char rmapTargetLogicalAddress ; + unsigned char rmapSourceLogicalAddress ; + + RMAP_command_codes commandCode; + + QPushButton *gresbStatusQueryRetryButton; + QPushButton *gresbStatusQueryAbortButton; + QLabel *gresbBridgeIPLabel; QLabel *gresbVirtualLinkLabel; QLabel *spwLinkLabel; @@ -26,6 +61,9 @@ private: QLabel *rmapSendStateLabel; QLabel *rmapReceiveStateLabel; QLabel *gresbStatusQueryLabel; + QLabel *gresbStatusQueryDialogLabel; + + QDialog *gresbStatusQueryDialog; QIPDialogBox* gresbBridgeIPDialogBox; @@ -34,7 +72,15 @@ private: QSpinBox *rmapSourceLogicalAddressSpinBox; QGridLayout *connectionLayout; - + QGridLayout *gresbStatusQueryDialogLayout; + + QTcpSocket *RMAPSend_SOCKET; + QTcpSocket *RMAPReceive_SOCKET; + QTcpSocket *GRESBStatusQuery_SOCKET; + + spwpacketreceiver *spwPacketReceiverOBJECT; + + gresbStatusEnquiry* spwLinkStatusEnquiry; }; #endif // GRESB_H diff --git a/rmapplugin/stardundee.cpp b/rmapplugin/stardundee.cpp --- a/rmapplugin/stardundee.cpp +++ b/rmapplugin/stardundee.cpp @@ -54,7 +54,7 @@ StarDundee::~StarDundee() USBSpaceWire_Close(hDevice); // Close the device } -unsigned int StarDundee::Open() +void StarDundee::Open() { int status; U32 statusControl; @@ -64,7 +64,7 @@ unsigned int StarDundee::Open() if (!USBSpaceWire_Open(&hDevice, usbDeviceNumber_SPINBOX->value())) // Open the USB device { emit sendMessage("stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))"); - return -1; + return; } emit sendMessage("stardundee *** Open *** USBSpaceWire_Open successful, device number: " + QString::number(usbDeviceNumber_SPINBOX->value())); @@ -159,11 +159,9 @@ unsigned int StarDundee::Open() while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire(); emit isOpen(true); - - return 1; } -unsigned int StarDundee::Close() +void StarDundee::Close() { USBSpaceWire_Close(hDevice); // Close the device emit sendMessage("stardundee *** Close *** USBSpaceWire_Close, device: " + QString::number(usbDeviceNumber_SPINBOX->value())); @@ -171,8 +169,6 @@ unsigned int StarDundee::Close() USBSpaceWire_UnregisterReceiveOnAllPorts(hDevice); // Stop receiving on all ports emit isOpen(false); - - return 1; } unsigned int StarDundee::GetRoutingTableEntry() diff --git a/rmapplugin/stardundee.h b/rmapplugin/stardundee.h --- a/rmapplugin/stardundee.h +++ b/rmapplugin/stardundee.h @@ -22,9 +22,7 @@ public: ~StarDundee(); unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); - unsigned int WriteStarDundee(unsigned int *Value, unsigned int count, unsigned int address); unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); - unsigned int getLinkStatus(unsigned char link); signals: void sendMessage(QString message); @@ -34,14 +32,15 @@ signals: void ccsdsPacketAvailable(unsigned char*, unsigned int); public slots: - unsigned int Open(); - unsigned int Close(); + void Open(); + void Close(); int receiveSPWPacket(unsigned char requestID); void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;} private: + unsigned int getLinkStatus(unsigned char link); unsigned int GetRoutingTableEntry(); unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0); unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);