# HG changeset patch # User Paul LEROY # Date 2012-12-10 14:34:13 # Node ID bf36b48e03cd40eb357ee8f3daf4613e8e3f00e3 # Parent 7f877774dc5c76cc35421818ba228eb85c8f850a class gresb fully functional, writeSPW function not tested yet 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/bridge.cpp b/rmapplugin/bridge.cpp --- a/rmapplugin/bridge.cpp +++ b/rmapplugin/bridge.cpp @@ -153,4 +153,3 @@ unsigned int bridge::Read(unsigned int * emit appendToLog(QString("*** STOP *** READ ")); return count; } - diff --git a/rmapplugin/bridge.h b/rmapplugin/bridge.h --- a/rmapplugin/bridge.h +++ b/rmapplugin/bridge.h @@ -14,10 +14,10 @@ public: ~bridge(); 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); - virtual unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); + //virtual unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); virtual unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0) = 0; virtual unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0) = 0; - virtual unsigned int getLinkStatus(unsigned char link) = 0; + //virtual unsigned int getLinkStatus(unsigned char link) = 0; unsigned char rmapTargetLogicalAddress ; unsigned char rmapSourceLogicalAddress ; @@ -41,9 +41,9 @@ signals: void ccsdsPacketAvailable(unsigned char*, unsigned int); public slots: - unsigned int Open(); - unsigned int Close(); - virtual int receiveSPWPacket(unsigned char requestID) = 0; + //unsigned int Open(); + //unsigned int Close(); + //virtual int receiveSPWPacket(unsigned char requestID) = 0; 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;} diff --git a/rmapplugin/gresb.cpp b/rmapplugin/gresb.cpp --- a/rmapplugin/gresb.cpp +++ b/rmapplugin/gresb.cpp @@ -9,6 +9,8 @@ gresb::gresb(QWidget *parent) : RMAPReceive_SOCKET = new QTcpSocket; GRESBStatusQuery_SOCKET = new QTcpSocket; + rmapPacketSEMAPHORE = new QSemaphore; + ccsdsPacketSEMAPHORE = new QSemaphore; rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH); ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH); spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) ); @@ -72,6 +74,13 @@ gresb::gresb(QWidget *parent) : this->setLayout(connectionLayout); + connect(RMAPSend_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPSendConnectionState(QAbstractSocket::SocketState))); + connect(RMAPReceive_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPReceiveConnectionState(QAbstractSocket::SocketState))); + connect(GRESBStatusQuery_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(GRESBConnectionState(QAbstractSocket::SocketState))); + connect(gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink())); + connect(spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery())); + connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacket())); + connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject())); connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacket())); } @@ -231,7 +240,7 @@ unsigned int gresb::WriteBLOCK(char *dat RMAPCommand = new RMAP(commandCode, rmapTargetLogicalAddress, - rmapSourceLogicalAddress, + rmapSourceLogicalAddressSpinBox->value(), address, nbBytes, data); @@ -346,7 +355,7 @@ unsigned int gresb::ReadBLOCK(unsigned i { RMAPCommand = new RMAP(read_Inc, rmapTargetLogicalAddress, - rmapSourceLogicalAddress, + rmapSourceLogicalAddressSpinBox->value(), address, nbBytes, NULL); @@ -355,7 +364,7 @@ unsigned int gresb::ReadBLOCK(unsigned i { RMAPCommand = new RMAP(read_Single, rmapTargetLogicalAddress, - rmapSourceLogicalAddress, + rmapSourceLogicalAddressSpinBox->value(), address, nbBytes, NULL); @@ -685,3 +694,106 @@ void gresb::processCCSDSPacket(unsigned ccsdsPacketSEMAPHORE->acquire(); emit sendMessage(message); } + +void gresb::reTestSPWLink() // SLOT +{ + if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 0) + { + gresbStatusQueryDialog->accept(); + } +} + +void gresb::RMAPSendConnectionState(QAbstractSocket::SocketState socketState) // SLOT +{ + rmapSendStateLabel->setText(""); + QString socketMessage = "RMAP Send Socket State: "; + switch(socketState) + { + case QAbstractSocket::UnconnectedState : + socketMessage.append("0 => Unconnected"); + break; + case 1: + socketMessage.append("1 => HostLookup"); + break; + case 2: + socketMessage.append("2 => Connecting"); + break; + case 3: + socketMessage.append("3 => Connected"); + break; + case 4: + socketMessage.append("4 => Bound"); + break; + case 5: + socketMessage.append("5 => Closing"); + break; + case 6: + socketMessage.append("6 => Listening"); + break; + } + rmapSendStateLabel->setText(socketMessage); + emit appendToLog(socketMessage); +} + +void gresb::RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState) // SLOT +{ + rmapReceiveStateLabel->setText(""); + QString socketMessage = "RMAP Receive Socket State: "; + switch(socketState) + { + case QAbstractSocket::UnconnectedState : + socketMessage.append("0 => Unconnected"); + break; + case 1: + socketMessage.append("1 => HostLookup"); + break; + case 2: + socketMessage.append("2 => Connecting"); + break; + case 3: + socketMessage.append("3 => Connected"); + break; + case 4: + socketMessage.append("4 => Bound"); + break; + case 5: + socketMessage.append("5 => Closing"); + break; + case 6: + socketMessage.append("6 => Listening"); + break; + } + rmapReceiveStateLabel->setText(socketMessage); + emit appendToLog(socketMessage); +} + +void gresb::GRESBConnectionState(QAbstractSocket::SocketState socketState) // SLOT +{ + gresbStatusQueryLabel->setText(""); + QString socketMessage = "GRESB status query socket (port 3010): "; + switch(socketState) + { + case QAbstractSocket::UnconnectedState : + socketMessage.append("0 => Unconnected"); + break; + case 1: + socketMessage.append("1 => HostLookup"); + break; + case 2: + socketMessage.append("2 => Connecting"); + break; + case 3: + socketMessage.append("3 => Connected"); + break; + case 4: + socketMessage.append("4 => Bound"); + break; + case 5: + socketMessage.append("5 => Closing"); + break; + case 6: + socketMessage.append("6 => Listening"); + break; + } + gresbStatusQueryLabel->setText(socketMessage); +} diff --git a/rmapplugin/gresb.h b/rmapplugin/gresb.h --- a/rmapplugin/gresb.h +++ b/rmapplugin/gresb.h @@ -24,7 +24,6 @@ public: 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); @@ -38,9 +37,12 @@ public slots: void Close(); int receiveSPWPacket(unsigned char requestID=0); void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size); + void reTestSPWLink(); + void RMAPSendConnectionState(QAbstractSocket::SocketState socketState); + void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState); + void GRESBConnectionState(QAbstractSocket::SocketState socketState); 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(); diff --git a/rmapplugin/rmapplugin.cpp b/rmapplugin/rmapplugin.cpp --- a/rmapplugin/rmapplugin.cpp +++ b/rmapplugin/rmapplugin.cpp @@ -31,11 +31,7 @@ rmapplugin::rmapplugin(QWidget *parent) this->UI = new rmapPluginUI(); this->setWindowTitle(tr("RMAP and SPW Communication")); this->setWidget((QWidget*)this->UI); - RMAPSend_SOCKET = new QTcpSocket; - RMAPReceive_SOCKET = new QTcpSocket; - GRESBStatusQuery_SOCKET = new QTcpSocket; - spwPacketReceiverOBJECT = new spwpacketreceiver; - spwPacketReceiverOBJECT->gresbReceptionSocket = RMAPReceive_SOCKET; + timeCode = 0; time_COARSE = 0; time_FINE = 0; @@ -49,32 +45,26 @@ rmapplugin::rmapplugin(QWidget *parent) connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(openBridge())); connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(closeBridge())); - connect(RMAPSend_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPSendConnectionState(QAbstractSocket::SocketState))); - connect(RMAPReceive_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPReceiveConnectionState(QAbstractSocket::SocketState))); - connect(GRESBStatusQuery_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(GRESBConnectionState(QAbstractSocket::SocketState))); - connect(UI->gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink())); - connect(this->UI->spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery())); - connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this->spwPacketReceiverOBJECT, SLOT(receiveSPWPacket())); // CCSDS connect(this->UI->sendCCSDSCommandButton, SIGNAL(clicked()), this, SLOT(sendCCSDS())); connect(this->UI->send_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(send_TC_LFR_UPDATE_TIME())); connect(this->UI->reset_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(reset_TC_LFR_UPDATE_TIME())); - // CONSOLE - connect(this->spwPacketReceiverOBJECT, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); - connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); - // spectralMAtricesDMASimulator connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginRead(uint*,uint,uint)), this, SLOT(Read(uint*,uint,uint))); connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginWrite(uint*,uint,uint)), this, SLOT(Write(uint*,uint,uint))); connect(this->UI->spectralMatricesDMASimulator, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); // GRESB - connect(this, SIGNAL(gresbIsOpen(bool)), this, SLOT(gresbSelection(bool))); + connect(this->UI->gresbBridge, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); + connect(this->UI->gresbBridge, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool))); + connect(this->UI->gresbBridge, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString))); + connect(this->UI->gresbBridge, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString))); // Star Dundee - connect(this->UI->starDundee, SIGNAL(isOpen(bool)), this, SLOT(activatePluginViaStarDundee(bool))); + connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString))); + connect(this->UI->starDundee, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool))); connect(this->UI->starDundee, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString))); connect(this->UI->starDundee, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString))); @@ -94,7 +84,7 @@ unsigned int rmapplugin::Write(unsigned switch(currentBridge) { case selectedBridgeIsGRESB : - result = WriteGRESB(Value, count, address); + result = UI->gresbBridge->Write(Value, count, address); break; case selectedBridgeIsStarDundee : result = UI->starDundee->Write(Value, count, address); @@ -112,7 +102,7 @@ unsigned int rmapplugin::Read(unsigned i switch(currentBridge) { case selectedBridgeIsGRESB : - result = ReadGRESB(Value, count, address); + result = UI->gresbBridge->Read(Value, count, address); break; case selectedBridgeIsStarDundee : result = UI->starDundee->Read(Value, count, address); @@ -124,320 +114,6 @@ unsigned int rmapplugin::Read(unsigned i return result; } -unsigned int rmapplugin::WriteGRESB(unsigned int *Value, unsigned int count, unsigned int address) -{ - unsigned int remainingCount = count; - unsigned int iOffset = 0; - QString console_message; - char* data; - - if(spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0) - { - APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped"); - return 1; - } - - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: unavailable"); - - data = (char*) malloc(READ_WRITE_MAX_COUNTS*4); - - APPENDTOLOG(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); - - while (remainingCount > READ_WRITE_MAX_COUNTS) - { - for (int i = 0; i>8); - data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); - data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); - } - - console_message.sprintf("remainingCount: %d => ", remainingCount); - APPENDTOLOG(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16)); - - if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0) - { - APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); - return 1; - } - - remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; - address = address + READ_WRITE_MAX_COUNTS * 4; - iOffset = iOffset + READ_WRITE_MAX_COUNTS; - } - - if (remainingCount > 0) - { - for (unsigned int i = 0; i>8); - data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16); - data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24); - } - - console_message.sprintf("remainingCount: %d => ", remainingCount); - APPENDTOLOG(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16)); - - if (WriteBLOCK(data, remainingCount*4, address)==0) - { - APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP write command failed"); - return 1; - } - } - - APPENDTOLOG(QString("*** STOP *** WRITE")); - free(data); - return count; -} - -unsigned int rmapplugin::ReadGRESB(unsigned int *Value, unsigned int count, unsigned int address) -{ - unsigned int remainingCount = count; - unsigned int iOffset = 0; - QString console_message; - - if(spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0) - { - APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped"); - return 1; - } - APPENDTOLOG(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16)); - - while (remainingCount > READ_WRITE_MAX_COUNTS) - { - console_message.sprintf("remainingCount: %d => ", remainingCount); - APPENDTOLOG(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16)); - - if (ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0) - { - APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP packet not received"); - return 1; - } - - for(int i=0;irmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; - for(int j=1;j<4;j++) - { - Value[i+iOffset]= ((unsigned char)(spwPacketReceiverOBJECT->rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256; - } - } - - remainingCount = remainingCount - READ_WRITE_MAX_COUNTS; - address = address + READ_WRITE_MAX_COUNTS * 4; - iOffset = iOffset + READ_WRITE_MAX_COUNTS; - spwPacketReceiverOBJECT->acquireRMAPSemaphore(); - } - - if (remainingCount > 0) - { - console_message.sprintf("remainingCount: %d => ", remainingCount); - APPENDTOLOG(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16)); - - if (ReadBLOCK(4*remainingCount, address)==0) - { - APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP packet not received"); - return 1; - } - - for(unsigned int i=0;irmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH]; - for(int j=1;j<4;j++) - { - Value[i+iOffset]= ((unsigned char)(spwPacketReceiverOBJECT->rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256; - } - } - spwPacketReceiverOBJECT->acquireRMAPSemaphore(); - } - - APPENDTOLOG(QString("*** STOP *** READ ")); - return count; -} - -unsigned int rmapplugin::WriteBLOCK(char *data, unsigned int nbBytes, unsigned int address) -{ - QTime RMAPTimeout; - RMAP *RMAPCommand; - int errorCode; - QString console_message; - - if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1) - { - RMAP_DISCONNECT(); - return 1; - } - - RMAPCommand = new RMAP(UI->getCommandCode(), - UI->rmapTargetLogicalAddressSpinBox->value(), - UI->rmapSourceLogicalAddressSpinBox->value(), - address, - nbBytes, - data); - - // SEND GRESB HEADER - RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4); - // SEND SPACEWIRE PACKET HEADER - RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader)); - // SEND DATA - RMAPSend_SOCKET->write( data, nbBytes); - // SEND DATA CRC - RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->dataCRC), 1); - RMAPTimeout.start(); - while(RMAPSend_SOCKET->bytesToWrite() > 0) - { - RMAPSend_SOCKET->waitForBytesWritten(100); - if(RMAPTimeout.elapsed()>1000) - { - APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** sending Write RMAP Command timeout"); - return 0; - } - } - - if (UI->RMAP_write_reply->isChecked()) - { - // WAIT FOR THE RMAP REPLY PACKET - errorCode = spwPacketReceiverOBJECT->receiveSPWPacket(1); - if (errorCode<=0) - { - APPENDTOLOG("WARNING === in function WriteBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode)); - return 0; - } - if(spwPacketReceiverOBJECT->rmapPacketSize != 8) - { - console_message.sprintf("WARNING === in function WRITE (with reply) of rmapplugin *** write reply format not compliant\n"); - APPENDTOLOG(console_message); - return 0; - } - switch (spwPacketReceiverOBJECT->rmapPacket[3]) // byte 4 is the status byte in the reply - { - case 0: - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 0 Successfull"); - break; - case 1: - APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** General error code"); - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 1 General error code"); - break; - case 2: - APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Unused RMAP packet type or command code"); - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 2 Unused RMAP packet type or command code"); - break; - case 3: - APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid key"); - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 3 Invalid key"); - break; - case 4: - APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid data CRC"); - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 4 Invalid data CRC"); - break; - case 5: - APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Early EOP"); - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 5 Early EOP"); - break; - case 6: - APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Too much data"); - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 6 Too much data"); - break; - case 7: - APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** EEP"); - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 7 EEP"); - break; - case 8: - APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Reserved"); - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 8 Reserved"); - break; - case 9: - APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Verify buffer overrun"); - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 9 Verify buffer overrun"); - break; - case 10: - APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** RMAP command not implemented or not authorised"); - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 10 RMAP command not implemented or not authorised"); - break; - case 11: - APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** RMW data length error"); - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 11 RMAP RMW data length error"); - break; - case 12: - APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid target logical address"); - UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 12 Invalid target logical address"); - break; - } - spwPacketReceiverOBJECT->acquireRMAPSemaphore(); - } - return nbBytes; -} - -unsigned int rmapplugin::ReadBLOCK(unsigned int nbBytes, unsigned int address) -{ - int errorCode; - RMAP *RMAPCommand; - QTime RMAPTimeout; - unsigned int dataLength; - if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1) - { - RMAP_DISCONNECT(); - return 1; - } - - if (nbBytes > 4) - { - RMAPCommand = new RMAP(read_Inc, - UI->rmapTargetLogicalAddressSpinBox->value(), - UI->rmapSourceLogicalAddressSpinBox->value(), - address, - nbBytes, - NULL); - } - else - { - RMAPCommand = new RMAP(read_Single, - UI->rmapTargetLogicalAddressSpinBox->value(), - UI->rmapSourceLogicalAddressSpinBox->value(), - address, - nbBytes, - NULL); - } - - // SEND THE GRESB HEADER FOR THE RMAP READ COMMAND - RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4); - // SEND THE SPACEWIRE PACKET FOR THE RMAP READ COMMAND - RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader)); - RMAPSend_SOCKET->waitForBytesWritten(100); - RMAPTimeout.start(); - // write timeout - while(RMAPSend_SOCKET->bytesToWrite() > 0) - { - RMAPSend_SOCKET->waitForBytesWritten(100); - if(RMAPTimeout.elapsed()>1000) - { - APPENDTOLOG("WARNING === in function READ of rmapplugin *** sending Read RMAP Command timeout\n"); - return 0; - } - } - - // RECEIVE THE INCOMING RMAP PACKET - errorCode = spwPacketReceiverOBJECT->receiveSPWPacket(1); // request ID 1 is for RMAP packet - if (errorCode<=0) - { - APPENDTOLOG("WARNING === in function ReadBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode)); - return 0; - } - dataLength = spwPacketReceiverOBJECT->rmapPacketSize - RMAP_READ_REPLY_HEADER_LENGTH - RMAP_DATA_CRC_LENGTH; - if(dataLength != nbBytes) - { - APPENDTOLOG("WARNING === in function READ of rmapplugin *** number of data received (" - +QString::number(dataLength) - +") not equal to number of data requested (" - +QString::number(READ_WRITE_MAX_COUNTS*4) - +")"); - return 0; - } - return dataLength; -} - //////// // SLOTS @@ -447,7 +123,7 @@ unsigned int rmapplugin::WriteSPW(char * switch(currentBridge) { case selectedBridgeIsGRESB : - result = WriteSPWGRESB(Value, count, targetLogicalAddress, userApplication); + result = UI->gresbBridge->WriteSPW(Value, count, targetLogicalAddress, userApplication); break; case selectedBridgeIsStarDundee : result = UI->starDundee->WriteSPW(Value, count, targetLogicalAddress, userApplication); @@ -459,59 +135,6 @@ unsigned int rmapplugin::WriteSPW(char * return result; } -unsigned int rmapplugin::WriteSPWGRESB(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) -{ - char protocoleIdentifier = 0x02; - char reserved = 0x00; - char gresbProtocole = 0x00; - unsigned char size[3]; - unsigned int spwPacketSize = count + 4; - QTime SPWTimeout; - - if (count>248) - { - APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** CCSDS packet size > 248 bytes\n"); - return 1; - } - - APPENDTOLOG(QString("*** START *** Send CCSDS packet of ")+ QString::number(count) + QString(" byte(s)")); - - if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1) - { - RMAP_DISCONNECT(); - APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** SPW link not running\n"); - return 1; - } - - // SEND GRESB HEADER - size[0] = (unsigned char) ((unsigned int) spwPacketSize>>16); - size[1] = (unsigned char) ((unsigned int) spwPacketSize>>8); - size[2] = (unsigned char) ((unsigned int) spwPacketSize); - RMAPSend_SOCKET->write(&gresbProtocole, 1); - RMAPSend_SOCKET->write((char*) size, 3); - // SEND SPW HEADER - RMAPSend_SOCKET->write(&targetLogicalAddress, 1); - RMAPSend_SOCKET->write(&protocoleIdentifier, 1); - RMAPSend_SOCKET->write(&reserved, 1); - RMAPSend_SOCKET->write(&userApplication, 1); - // SEND CCSDS PACKET - RMAPSend_SOCKET->write(Value, count); - SPWTimeout.start(); - while(RMAPSend_SOCKET->bytesToWrite() > 0) - { - RMAPSend_SOCKET->waitForBytesWritten(100); - if(SPWTimeout.elapsed()>1000) - { - APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** sending CCSDS packet timeout\n"); - return 1; - } - } - - APPENDTOLOG(QString("*** CCSDS packet sent")); - - return count; -} - void rmapplugin::sendCCSDS() // SLOT { unsigned int nbBYTES_application_data = 8; @@ -557,6 +180,36 @@ void rmapplugin::sendCCSDS() // SLOT free(tab); } +void rmapplugin::openBridge() +{ + switch(currentBridge) + { + case selectedBridgeIsGRESB : + this->UI->gresbBridge->Open(); + break; + case selectedBridgeIsStarDundee : + this->UI->starDundee->Open(); + break; + default: + break; + } +} + +void rmapplugin::closeBridge() +{ + switch(currentBridge) + { + case selectedBridgeIsGRESB : + this->UI->gresbBridge->Close(); + break; + case selectedBridgeIsStarDundee : + this->UI->starDundee->Close(); + break; + default: + break; + } +} + void rmapplugin::send_TC_LFR_UPDATE_TIME() { unsigned int nbBYTES_application_data = 6; // Time at CUC format is on 48 bits / 6 bytes @@ -610,194 +263,6 @@ void rmapplugin::reset_TC_LFR_UPDATE_TIM time_FINE = 0; } -void rmapplugin::openBridge() -{ - switch(currentBridge) - { - case selectedBridgeIsGRESB : - RMAP_CONNECT(); - break; - case selectedBridgeIsStarDundee : - this->UI->starDundee->Open(); - break; - default: - break; - } -} - -void rmapplugin::closeBridge() -{ - switch(currentBridge) - { - case selectedBridgeIsGRESB : - RMAP_DISCONNECT(); - break; - case selectedBridgeIsStarDundee : - this->UI->starDundee->Close(); - break; - default: - break; - } -} - -void rmapplugin::RMAP_CONNECT() // SLOT -{ - bool spwRunning = true; - RMAPSend_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()), - 3000 + UI->gresbVirtualLinkSpinBox->value()*2, - QIODevice::WriteOnly); - RMAPReceive_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()), - 3000 + UI->gresbVirtualLinkSpinBox->value()*2+1, - QIODevice::ReadOnly); - GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(UI->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, UI->spwLinkSpinBox->value()) != 0) - { - spwRunning = UI->gresbStatusQueryDialog->exec(); - } - if (spwRunning == false) RMAP_DISCONNECT(); - else - { - APPENDTOLOG(QString("SpaceWire running on virtual link ")+ QString::number(UI->spwLinkSpinBox->value())); - emit this->activateSig(true); - emit gresbIsOpen(true); - } -} - -void rmapplugin::RMAP_DISCONNECT() // SLOT -{ - RMAPSend_SOCKET->disconnectFromHost(); - RMAPReceive_SOCKET->disconnectFromHost(); - GRESBStatusQuery_SOCKET->disconnectFromHost(); - emit this->activateSig(false); - emit gresbIsOpen(false); -} - -void rmapplugin::RMAPSendConnectionState(QAbstractSocket::SocketState socketState) // SLOT -{ - UI->rmapSendStateLabel->setText(""); - QString socketMessage = "RMAP Send Socket State: "; - switch(socketState) - { - case QAbstractSocket::UnconnectedState : - socketMessage.append("0 => Unconnected"); - UI->rmapOpenCommunicationButton->setEnabled(true); - UI->rmapCloseCommunicationButton->setEnabled(false); - emit this->activateSig(false); - break; - case 1: - socketMessage.append("1 => HostLookup"); - break; - case 2: - socketMessage.append("2 => Connecting"); - break; - case 3: - socketMessage.append("3 => Connected"); - UI->rmapOpenCommunicationButton->setEnabled(false); - UI->rmapCloseCommunicationButton->setEnabled(true); - break; - case 4: - socketMessage.append("4 => Bound"); - break; - case 5: - socketMessage.append("5 => Closing"); - break; - case 6: - socketMessage.append("6 => Listening"); - break; - } - UI->rmapSendStateLabel->setText(socketMessage); - APPENDTOLOG(socketMessage); -} - -void rmapplugin::RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState) // SLOT -{ - UI->rmapReceiveStateLabel->setText(""); - QString socketMessage = "RMAP Receive Socket State: "; - switch(socketState) - { - case QAbstractSocket::UnconnectedState : - socketMessage.append("0 => Unconnected"); - break; - case 1: - socketMessage.append("1 => HostLookup"); - break; - case 2: - socketMessage.append("2 => Connecting"); - break; - case 3: - socketMessage.append("3 => Connected"); - break; - case 4: - socketMessage.append("4 => Bound"); - break; - case 5: - socketMessage.append("5 => Closing"); - break; - case 6: - socketMessage.append("6 => Listening"); - break; - } - UI->rmapReceiveStateLabel->setText(socketMessage); - APPENDTOLOG(socketMessage); -} - -void rmapplugin::GRESBConnectionState(QAbstractSocket::SocketState socketState) // SLOT -{ - UI->gresbStatusQueryLabel->setText(""); - QString socketMessage = "GRESB status query socket (port 3010): "; - switch(socketState) - { - case QAbstractSocket::UnconnectedState : - socketMessage.append("0 => Unconnected"); - break; - case 1: - socketMessage.append("1 => HostLookup"); - break; - case 2: - socketMessage.append("2 => Connecting"); - break; - case 3: - socketMessage.append("3 => Connected"); - break; - case 4: - socketMessage.append("4 => Bound"); - break; - case 5: - socketMessage.append("5 => Closing"); - break; - case 6: - socketMessage.append("6 => Listening"); - break; - } - UI->gresbStatusQueryLabel->setText(socketMessage); -} - -void rmapplugin::reTestSPWLink() // SLOT -{ - if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 0) - { - UI->gresbStatusQueryDialog->accept(); - } -} - -int rmapplugin::GRESBStatusQuery() // SLOT -{ - GRESBStatusQueryRequest(LinkStatus, 0); - GRESBStatusQueryRequest(LinkStatus, 1); - GRESBStatusQueryRequest(LinkStatus, 2); - GRESBStatusQueryRequest(LinkStatistics, 0); - GRESBStatusQueryRequest(LinkStatistics, 1); - GRESBStatusQueryRequest(LinkStatistics, 2); - return 0; -} - void rmapplugin::RMAP_write_reply_setText(QString text) { this->UI->RMAP_write_reply->setText(text); @@ -811,108 +276,6 @@ void rmapplugin::appendToLog(QString tex ///////////////////// // INTERNAL FUNCTIONS -int rmapplugin::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) - { - 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"); - APPENDTOLOG(console_message); - return 1; - } - } - GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatusReply), (int) sizeof(linkStatusReply)); - console_message.sprintf("%x", linkStatusReply.byte0); - UI->spwLinkStatusEnquiry->statusQueryTable->item(0, link)->setText(console_message); - console_message.sprintf("%d", linkStatusReply.byte1); - UI->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"); - 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; -} - -int rmapplugin::charTab_TO_int(char *charTab) -{ - int result = 0; - result = (charTab[0]<<24) +(charTab[1]<<16) +(charTab[2]<<8) + charTab[3]; - return result; -} - void rmapplugin::gresbSelection(bool flag) { if (flag == true) UI->selection_GROUPBOX->setEnabled(false); diff --git a/rmapplugin/rmapplugin.h b/rmapplugin/rmapplugin.h --- a/rmapplugin/rmapplugin.h +++ b/rmapplugin/rmapplugin.h @@ -50,44 +50,27 @@ class rmapplugin : public lppmonplugin public: explicit rmapplugin(QWidget *parent = 0); ~rmapplugin(); - int GRESBStatusQueryRequest(GresbStatusQueryOption option, char link); - int charTab_TO_int(char *charTab); - unsigned int ReadGRESB(unsigned int *Value,unsigned int count,unsigned int address=0); - unsigned int WriteGRESB(unsigned int *Value,unsigned int count,unsigned int address=0); - unsigned int WriteSPWGRESB(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); public slots: 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); + void openBridge(); + void closeBridge(); // - unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); void sendCCSDS(); void send_TC_LFR_UPDATE_TIME(); void reset_TC_LFR_UPDATE_TIME(); - int GRESBStatusQuery(); void displayOnConsole(QString message) {this->UI->console->append(message);} // - void RMAP_CONNECT(); - void RMAP_DISCONNECT(); - void openBridge(); - void closeBridge(); - int RMAPSendReadCommand(); - int RMAPSendWriteCommand(); - void reTestSPWLink(); - // - void RMAPSendConnectionState(QAbstractSocket::SocketState socketState); - void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState); - void GRESBConnectionState(QAbstractSocket::SocketState socketState); - // void gresbSelection(bool flag); - void activatePluginViaStarDundee(bool flag) {emit activateSig(flag);} void RMAP_write_reply_setText(QString text); void appendToLog(QString text); + // + void activatePlugin(bool flag) {emit activateSig(flag);} void bridgeHasChanged(selectedBridge bridge) {currentBridge = bridge;} signals: - void ccsdsPacketReadyRead(char *ccsdsPacket, unsigned int size); - void gresbIsOpen(bool); private: selectedBridge currentBridge; @@ -100,8 +83,6 @@ private: unsigned int time_COARSE; unsigned int time_FINE; spwpacketreceiver* spwPacketReceiverOBJECT; - unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0); - unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0); char timeCode; }; diff --git a/rmapplugin/rmappluginui.cpp b/rmapplugin/rmappluginui.cpp --- a/rmapplugin/rmappluginui.cpp +++ b/rmapplugin/rmappluginui.cpp @@ -31,7 +31,6 @@ rmapPluginUI::rmapPluginUI(QWidget *pare QWidget* spwTabWidgetPage2 = new QWidget; QWidget* spwTabWidgetPage3 = new QWidget; QWidget* spwTabWidgetPage4 = new QWidget; - QWidget* spwTabWidgetPage5 = new QWidget; bridgeWidget = new QWidget; mainLayout = new QVBoxLayout; connectionLayout = new QGridLayout; @@ -52,8 +51,6 @@ rmapPluginUI::rmapPluginUI(QWidget *pare spwLinkLabel = new QLabel(tr("SPW Link: ")); rmapSourceLogicalAddressLabel = new QLabel(tr("RMAP Source Logical Address: ")); rmapTargetLogicalAddressLabel = new QLabel(tr("RMAP Target Logical Address: ")); - rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection")); - rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection")); logFileName = new QLabel; gresbStatusQueryLabel = new QLabel(tr("Status query socket (port 3010): waiting for connection")); gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running")); @@ -105,18 +102,6 @@ rmapPluginUI::rmapPluginUI(QWidget *pare logFileEn = false; - connectionLayout->addWidget(gresbBridgeIPLabel, 0, 0, 0); - connectionLayout->addWidget(gresbBridgeIPDialogBox, 0, 1, 0); - connectionLayout->addWidget(gresbVirtualLinkLabel, 1, 0, 0); - connectionLayout->addWidget(gresbVirtualLinkSpinBox, 1, 1, 0); - connectionLayout->addWidget(spwLinkLabel, 2, 0, 0); - connectionLayout->addWidget(spwLinkSpinBox, 2, 1, 0); - connectionLayout->addWidget(rmapSourceLogicalAddressLabel, 3, 0, 0); - connectionLayout->addWidget(rmapSourceLogicalAddressSpinBox, 3, 1, 0); - connectionLayout->addWidget(rmapSendStateLabel, 4, 0, 1, 2); - connectionLayout->addWidget(rmapReceiveStateLabel, 5, 0, 1, 2); - connectionLayout->addWidget(gresbStatusQueryLabel, 6, 0, 1, 2); - connectionLayout->setRowStretch(7, 1); connectionLayout->setColumnStretch(2, 1); @@ -136,8 +121,7 @@ rmapPluginUI::rmapPluginUI(QWidget *pare generalParameters_LAYOUT->setRowStretch(5, 1); generalParameters_LAYOUT->setColumnStretch(2, 1); - gresb_GROUPBOX->setLayout(connectionLayout); - //gresb_GROUPBOX->setLayout(gresbBridge->layout()); + gresb_GROUPBOX->setLayout(gresbBridge->layout()); gresb_GROUPBOX->setVisible(false); stardundee_GROUPBOX->setLayout(starDundee->layout()); stardundee_GROUPBOX->setVisible(false); @@ -166,35 +150,34 @@ rmapPluginUI::rmapPluginUI(QWidget *pare spwTabWidget->addTab(spwTabWidgetPage2, tr("status")); spwTabWidget->addTab(spwTabWidgetPage3, tr("console")); spwTabWidget->addTab(spwTabWidgetPage4, tr("DMA")); - spwTabWidget->addTab(spwTabWidgetPage5, tr("gresb")); spwTabWidgetPage0->setLayout(selectionLayout); spwTabWidgetPage1->setLayout(ccsdsLayout); spwTabWidgetPage2->setLayout(this->spwLinkStatusEnquiry->mainLayout); spwTabWidgetPage3->setLayout(consoleLayout); spwTabWidgetPage4->setLayout(spectralMatricesDMASimulator->mainLayout); - spwTabWidgetPage5->setLayout(gresbBridge->layout()); + mainLayout->addWidget(spwTabWidget); setLayout(mainLayout); - // 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); - - connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject())); + //connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject())); connect(this->clearConsoleButton, SIGNAL(clicked()), this->console, SLOT(clear())); + // briges connect(this->selectGRESB_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee())); connect(this->selectStarDundee_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee())); connect(this->starDundee, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool))); + connect(this->gresbBridge, SIGNAL(isOpen(bool)), this, SLOT(isOpen(bool))); + connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->starDundee, SLOT(targetHasChanged(int))); + connect(this->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)), this->gresbBridge, SLOT(targetHasChanged(int))); // command code connect(this->RMAP_write_reply, SIGNAL(clicked()), this, SLOT(getCommandCode())); connect(this->RMAP_write_verify, SIGNAL(clicked()), this, SLOT(getCommandCode())); - connect(this, SIGNAL(commandCodeHasChanged(RMAP_command_codes)), this->starDundee, SLOT(commandCodeHasChanged(RMAP_command_codes))); + connect(this, SIGNAL(commandCodeHasChanged(RMAP_command_codes)), + this->starDundee, SLOT(commandCodeHasChanged(RMAP_command_codes))); + connect(this, SIGNAL(commandCodeHasChanged(RMAP_command_codes)), + this->gresbBridge, SLOT(commandCodeHasChanged(RMAP_command_codes))); getCommandCode(); // init the command code value rmapTargetLogicalAddressSpinBox->setValue(254);