# HG changeset patch # User jeandet # Date 2014-03-06 00:28:23 # Node ID f4bd616a53e5ffd88b5b0e0de42ea7b6783305ce # Parent c8a3067321d8f8bba92e25f47b1b036284c21938 Added stop function to dsu3plugin Added pywrapper to spwplugin Added timeout config for spwplugin diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -5,3 +5,4 @@ moc_* *.so* ui_*.h Makefile +qrc_*.cpp diff --git a/APBUARTPLUGIN/APBUARTPLUGIN.pro b/APBUARTPLUGIN/APBUARTPLUGIN.pro --- a/APBUARTPLUGIN/APBUARTPLUGIN.pro +++ b/APBUARTPLUGIN/APBUARTPLUGIN.pro @@ -17,7 +17,7 @@ TARGET = ApbUartPlugin$${DEBUG_EXT} DEFINES += PLUGIN=ApbUartPlugin DEFINES += PLUGINHEADER="\"\\\"APBUARTPLUGIN.h"\\\"\" -DEFINES += driver_Name="\"\\\"APB UART PLUGIN"\\\"\" +DEFINES += driver_Name="\"\\\"APB_UART_PLUGIN"\\\"\" DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@member.fsf.org"\\\"\" DEFINES += driver_Version="\"\\\"0.0.1"\\\"\" DEFINES += driver_Description="\"\\\"This plugin provides a terminal widget connected to Gaisler\'s APBUART with or without loop-back mode."\\\"\" diff --git a/dsu3plugin/dsu3plugin.cpp b/dsu3plugin/dsu3plugin.cpp --- a/dsu3plugin/dsu3plugin.cpp +++ b/dsu3plugin/dsu3plugin.cpp @@ -34,10 +34,12 @@ dsu3plugin::dsu3plugin(QWidget *parent): QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(openFile(QString)),this,SLOT(openFile(QString))); QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(loadFile()),this,SLOT(flashTarget())); QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(run()),this,SLOT(run())); + QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(stop()),this,SLOT(stop())); connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile())); connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget())); - connect(this->UI,SIGNAL(run()),this,SLOT(run())); + connect(this->UI,SIGNAL(run()),this,SLOT(toggleRun())); connect(this,SIGNAL(updateInfo(elfparser*)),this->UI,SIGNAL(updateInfo(elfparser*))); + this->running = false; } @@ -140,6 +142,26 @@ void dsu3plugin::run() if(DSUBASEADDRESS == (unsigned int)-1) DSUBASEADDRESS = 0x90000000; WriteRegs(uIntlist()<<0,DSUBASEADDRESS+0x020); + this->running = true; + this->UI->setRunning(true); +} + +void dsu3plugin::stop() +{ + unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0); + if(DSUBASEADDRESS == (unsigned int)-1) + DSUBASEADDRESS = 0x90000000; + WriteRegs(uIntlist()<<0xFFFF,DSUBASEADDRESS+0x020); + this->running = false; + this->UI->setRunning(false); +} + +void dsu3plugin::toggleRun() +{ + if(this->running) + this->stop(); + else + this->run(); } void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address) diff --git a/dsu3plugin/dsu3plugin.h b/dsu3plugin/dsu3plugin.h --- a/dsu3plugin/dsu3plugin.h +++ b/dsu3plugin/dsu3plugin.h @@ -48,6 +48,8 @@ public slots: bool configureTarget(); bool flashTarget(); void run(); + void stop(); + void toggleRun(); signals: void updateInfo(elfparser* parser); private: @@ -56,6 +58,7 @@ private: void writeSection(const QString& name); dsu3pluginui* UI; elfparser* elfparserInst; + bool running; }; #endif // DSU3PLUGIN_H diff --git a/dsu3plugin/dsu3pluginpywrapper.h b/dsu3plugin/dsu3pluginpywrapper.h --- a/dsu3plugin/dsu3pluginpywrapper.h +++ b/dsu3plugin/dsu3pluginpywrapper.h @@ -12,6 +12,7 @@ signals: bool openFile(QString fileName); bool loadFile(); bool run(); + bool stop(); public slots: }; diff --git a/dsu3plugin/dsu3pluginui.cpp b/dsu3plugin/dsu3pluginui.cpp --- a/dsu3plugin/dsu3pluginui.cpp +++ b/dsu3plugin/dsu3pluginui.cpp @@ -42,6 +42,13 @@ dsu3pluginui::dsu3pluginui(QWidget *pare } +void dsu3pluginui::setRunning(bool running) +{ + if(running) + this->runQpb->setText("Stop"); + else + this->runQpb->setText("Run"); +} @@ -52,3 +59,4 @@ dsu3pluginui::dsu3pluginui(QWidget *pare + diff --git a/dsu3plugin/dsu3pluginui.h b/dsu3plugin/dsu3pluginui.h --- a/dsu3plugin/dsu3pluginui.h +++ b/dsu3plugin/dsu3pluginui.h @@ -38,7 +38,7 @@ public: explicit dsu3pluginui(QWidget *parent = 0); public slots: - + void setRunning(bool running); signals: void openFile(); void updateInfo(elfparser* parser); @@ -50,7 +50,6 @@ private: QPushButton* flashTargetQpb; QPushButton* runQpb; elfInfoWdgt* elfInfoWdgtInst; - }; #endif // DSU3PLUGINUI_H diff --git a/spwplugin/SpwTcpPacketServer/spwtcppacketserver.cpp b/spwplugin/SpwTcpPacketServer/spwtcppacketserver.cpp --- a/spwplugin/SpwTcpPacketServer/spwtcppacketserver.cpp +++ b/spwplugin/SpwTcpPacketServer/spwtcppacketserver.cpp @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ #include "spwtcppacketserver.h" #include "ui_spwtcppacketserver.h" diff --git a/spwplugin/SpwTcpPacketServer/spwtcppacketserver.h b/spwplugin/SpwTcpPacketServer/spwtcppacketserver.h --- a/spwplugin/SpwTcpPacketServer/spwtcppacketserver.h +++ b/spwplugin/SpwTcpPacketServer/spwtcppacketserver.h @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ #ifndef SPWTCPPACKETSERVER_H #define SPWTCPPACKETSERVER_H diff --git a/spwplugin/spwplugin.cpp b/spwplugin/spwplugin.cpp --- a/spwplugin/spwplugin.cpp +++ b/spwplugin/spwplugin.cpp @@ -23,12 +23,13 @@ #include "spwplugin.h" #include "stardundeespw_usb.h" #include - -spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,true) +#include "spwpywrapper.h" +spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,false) { Q_UNUSED(parent) this->bridge = NULL; this->scanDone = false; + this->pyObject = new spwPyWrapper(this); this->mainGroupBox = new QGroupBox("SpaceWire Plugin Configuration",this); this->bridgeSelector = new QComboBox(this); this->mainLayout = new QGridLayout(this); @@ -82,6 +83,15 @@ void spwplugin::bridgeSelectionChanged(c this->bridge = new stardundeeSPW_USB(this); this->mainLayout->addWidget(this->bridge->getGUI(),1,0,1,2); connect(this->bridge,SIGNAL(setConnected(bool)),this,SLOT(setConnected(bool))); + connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSelectBrick(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectBrick(int))); + connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSelectLinkNumber(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectLinkNumber(int))); + connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSelectLinkSpeed(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectLinkSpeed(int))); + connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetDestinationKey(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetDestinationKey(QString))); + connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetRmapAddress(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetRmapAddress(QString))); + connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetRmapKey(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetRmapKey(QString))); + connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetRmapTimeout(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetRmapTimeout(QString))); + connect(((spwPyWrapper*)this->pyObject),SIGNAL(connectBridge()),((stardundeeSPW_USB*)bridge),SLOT(connectBridge())); + connect(((spwPyWrapper*)this->pyObject),SIGNAL(disconnectBridge()),((stardundeeSPW_USB*)bridge),SLOT(disconnectBridge())); } } @@ -91,6 +101,11 @@ void spwplugin::setConnected(bool connec this->bridgeSelector->setDisabled(connected); this->Connected = connected; emit activateSig(connected); + if(!this->scanDone) + { + socexplorerproxy::loadChildSysDriver(this,"AMBA_PLUGIN"); + this->scanDone=true; + } } diff --git a/spwplugin/spwplugin.pro b/spwplugin/spwplugin.pro --- a/spwplugin/spwplugin.pro +++ b/spwplugin/spwplugin.pro @@ -38,7 +38,8 @@ HEADERS += \ abstractspwbridge.h \ spw.h \ stardundeegui.h \ - SpwTcpPacketServer/spwtcppacketserver.h + SpwTcpPacketServer/spwtcppacketserver.h \ + spwpywrapper.h SOURCES += \ @@ -46,7 +47,8 @@ SOURCES += \ stardundeespw_usb.cpp \ abstractspwbridge.cpp \ stardundeegui.cpp \ - SpwTcpPacketServer/spwtcppacketserver.cpp + SpwTcpPacketServer/spwtcppacketserver.cpp \ + spwpywrapper.cpp FORMS += \ stardundeeGUI.ui \ diff --git a/spwplugin/spwpywrapper.cpp b/spwplugin/spwpywrapper.cpp new file mode 100644 --- /dev/null +++ b/spwplugin/spwpywrapper.cpp @@ -0,0 +1,27 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the SocExplorer Software +-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ +#include "spwpywrapper.h" + +spwPyWrapper::spwPyWrapper(socexplorerplugin *parent) : + genericPySysdriver(parent) +{ +} diff --git a/spwplugin/spwpywrapper.h b/spwplugin/spwpywrapper.h new file mode 100644 --- /dev/null +++ b/spwplugin/spwpywrapper.h @@ -0,0 +1,25 @@ +#ifndef SPWPYWRAPPER_H +#define SPWPYWRAPPER_H +#include + +class spwPyWrapper : public genericPySysdriver +{ + Q_OBJECT +public: + explicit spwPyWrapper(socexplorerplugin *parent = 0); + +signals: + bool connectBridge(); + bool disconnectBridge(); + void StarDundeeSelectBrick(int brickIndex); + void StarDundeeSelectLinkNumber(int linkIndex); + void StarDundeeSelectLinkSpeed(int linkSpeed); + void StarDundeeSetDestinationKey(const QString & destKey); + void StarDundeeSetRmapAddress(const QString & address); + void StarDundeeSetRmapKey(const QString & key); + void StarDundeeSetRmapTimeout(const QString & timeout); +public slots: + +}; + +#endif // SPWPYWRAPPER_H diff --git a/spwplugin/stardundeeGUI.ui b/spwplugin/stardundeeGUI.ui --- a/spwplugin/stardundeeGUI.ui +++ b/spwplugin/stardundeeGUI.ui @@ -6,8 +6,8 @@ 0 0 - 778 - 271 + 397 + 243 @@ -148,13 +148,39 @@ - + Connect + + + + <html><head/><body><p>Set the RMAP timeout, when waiting for a RMAP answer the driver will give up after this time if it doesn't get any answer.</p></body></html> + + + Qt::ImhDigitsOnly + + + + + + 500 + + + 5 + + + + + + + RMAP timeout(ms) + + + diff --git a/spwplugin/stardundeegui.cpp b/spwplugin/stardundeegui.cpp --- a/spwplugin/stardundeegui.cpp +++ b/spwplugin/stardundeegui.cpp @@ -35,6 +35,7 @@ StarDundeeGUI::StarDundeeGUI(QWidget *pa connect(this->ui->destKeyLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(destinationKeyChanged(QString))); connect(this->ui->RMAPAddresslineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(rmapAddressChanged(QString))); connect(this->ui->RMAPKeylineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(rmapKeyChanged(QString))); + connect(this->ui->RMAPTimeoutLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(rmapTimeoutChanged(QString))); connect(this->ui->connectQpb,SIGNAL(clicked()),this,SIGNAL(connectClicked())); } @@ -69,6 +70,11 @@ QString StarDundeeGUI::getRmapKey() return ui->RMAPKeylineEdit->text(); } +QString StarDundeeGUI::getRmapTimeout() +{ + return ui->RMAPTimeoutLineEdit->text(); +} + void StarDundeeGUI::lock(bool lock) @@ -79,6 +85,7 @@ void StarDundeeGUI::lock(bool lock) this->ui->destKeyLineEdit->setDisabled(lock); this->ui->RMAPAddresslineEdit->setDisabled(lock); this->ui->RMAPKeylineEdit->setDisabled(lock); + this->ui->RMAPTimeoutLineEdit->setDisabled(lock); if(lock) this->ui->connectQpb->setText("Disconnect"); else @@ -105,3 +112,63 @@ void StarDundeeGUI::updateAvailableBrick count>>=1; } } + +void StarDundeeGUI::setRmapTimeout(const QString &timeout) +{ + this->ui->RMAPTimeoutLineEdit->setText(timeout); +} + +void StarDundeeGUI::selectBrick(int brickIndex) +{ + if(brickIndex>=0&& brickIndexui->selectBrickCmbx->count()) + { + this->ui->selectBrickCmbx->setCurrentIndex(brickIndex); + } +} + +void StarDundeeGUI::selectLinkNumber(int linkNumber) +{ + if(linkNumber==1 || linkNumber==2) + { + this->ui->selectLinkCmbx->setCurrentIndex(linkNumber-1); + } +} + +void StarDundeeGUI::selectLinkSpeed(int linkSpeed) +{ +#define MHz *(1000*1000) + if(linkSpeed==10 MHz) + { + this->ui->selectLinkCmbx->setCurrentIndex(0); + } +} + +void StarDundeeGUI::setDestinationKey(const QString &destKey) +{ + bool ok; + int Key=destKey.toInt(&ok,10); + if(ok) + { + this->ui->destKeyLineEdit->setText(destKey); + } +} + +void StarDundeeGUI::setRmapAddress(const QString &address) +{ + bool ok; + int tmp=address.toInt(&ok,10); + if(ok) + { + this->ui->RMAPAddresslineEdit->setText(address); + } +} + +void StarDundeeGUI::setRmapKey(const QString &key) +{ + bool ok; + int tmp=key.toInt(&ok,10); + if(ok) + { + this->ui->RMAPKeylineEdit->setText(key); + } +} diff --git a/spwplugin/stardundeegui.h b/spwplugin/stardundeegui.h --- a/spwplugin/stardundeegui.h +++ b/spwplugin/stardundeegui.h @@ -39,6 +39,7 @@ public: QString getDestinationKey(); QString getRmapAddress(); QString getRmapKey(); + QString getRmapTimeout(); signals: void brickSelectionChanged(int brickIndex); void linkNumberSelectionChanged(int linkIndex); @@ -46,11 +47,18 @@ signals: void destinationKeyChanged(const QString & destKey); void rmapAddressChanged(const QString & address); void rmapKeyChanged(const QString & key); + void rmapTimeoutChanged(const QString & timeout); void connectClicked(); public slots: void lock(bool lock); void updateAvailableBrickCount(int count); - + void selectBrick(int brickIndex); + void selectLinkNumber(int linkIndex); + void selectLinkSpeed(int linkSpeed); + void setDestinationKey(const QString & destKey); + void setRmapAddress(const QString & address); + void setRmapKey(const QString & key); + void setRmapTimeout(const QString & timeout); private: Ui::StarDundeeUI *ui; }; diff --git a/spwplugin/stardundeespw_usb.cpp b/spwplugin/stardundeespw_usb.cpp --- a/spwplugin/stardundeespw_usb.cpp +++ b/spwplugin/stardundeespw_usb.cpp @@ -43,32 +43,37 @@ void stardundeeSPW_USB::toggleBridgeConn { if(this->plugin->isConnected()) { - if(this->disconnectBridge()) - { - ((StarDundeeGUI*)this->p_GUI)->lock(false); - emit setConnected(false); - } + this->disconnectBridge(); } else { - if(this->connectBridge()) - { - ((StarDundeeGUI*)this->p_GUI)->lock(true); - emit setConnected(true); - } + this->connectBridge(); } } bool stardundeeSPW_USB::connectBridge() { - return this->manager->connectBridge(); + if(this->manager->connectBridge()) + { + ((StarDundeeGUI*)this->p_GUI)->lock(true); + emit setConnected(true); + return true; + } + return false; } bool stardundeeSPW_USB::disconnectBridge() { - return this->manager->disconnectBridge(); + if(this->manager->disconnectBridge()) + { + ((StarDundeeGUI*)this->p_GUI)->lock(false); + emit setConnected(false); + return true; + } + return false; } + int stardundeeSPW_USB::pushRMAPPacket(char *packet, int size) { return this->manager->sendPacket(packet,size); @@ -82,8 +87,12 @@ unsigned int stardundeeSPW_USB::Write(un int written=0; SocExplorerEngine::message(this->plugin,"Enter Write function",2); QProgressBar* progress=NULL; + SocExplorerAutoProgressBar autopb; if(count>RMAP_MAX_XFER_SIZE) + { progress= SocExplorerEngine::getProgressBar("Writing on SPW @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count); + autopb.setProgressBar(progress); + } //Quite stupide loop, I guess that I always get the number of byte I asked for! while(count>=RMAP_MAX_XFER_SIZE) { @@ -119,10 +128,10 @@ unsigned int stardundeeSPW_USB::Write(un qApp->processEvents(); } } - if(progress!=NULL) - { - SocExplorerEngine::deleteProgressBar(progress); - } +// if(progress!=NULL) +// { +// SocExplorerEngine::deleteProgressBar(progress); +// } return written; } @@ -134,8 +143,12 @@ unsigned int stardundeeSPW_USB::Read(uns int transactionID = 0; int read=0; QProgressBar* progress=NULL; + SocExplorerAutoProgressBar autopb; if(count>RMAP_MAX_XFER_SIZE) + { progress= SocExplorerEngine::getProgressBar("Reading on SPW @0x"+QString::number(address,16)+" %v of "+QString::number(count)+" words ",count); + autopb.setProgressBar(progress); + } SocExplorerEngine::message(this->plugin,QString("Enter read function, count=%1, RMAP_MAX_XFER_SIZE=%2").arg(count).arg(RMAP_MAX_XFER_SIZE),2); //Quite stupide loop, I guess that I always get the number of byte I asked for! @@ -195,50 +208,63 @@ unsigned int stardundeeSPW_USB::Read(uns qApp->processEvents(); } } - if(progress!=NULL) - { - SocExplorerEngine::deleteProgressBar(progress); - } +// if(progress!=NULL) +// { +// SocExplorerEngine::deleteProgressBar(progress); +// } return read; } void stardundeeSPW_USB::brickSelectionChanged(int brickIndex) { this->manager->selectedBrick = brickIndex-1; - SocExplorerEngine::message(plugin,QString("Changing brick index: %1").arg(manager->selectedBrick)); + SocExplorerEngine::message(plugin,QString("Changing brick index: %1").arg(manager->selectedBrick),1); } void stardundeeSPW_USB::linkNumberSelectionChanged(int linkIndex) { this->manager->linkNumber = linkIndex + 1; - SocExplorerEngine::message(plugin,QString("Changing Link Number: %1").arg(manager->linkNumber)); + SocExplorerEngine::message(plugin,QString("Changing Link Number: %1").arg(manager->linkNumber),1); } void stardundeeSPW_USB::linkSpeedSelectionChanged(const QString &linkSpeed) { this->manager->linkSpeed = linkSpeed.toInt(); - SocExplorerEngine::message(plugin,QString("Changing Link Speed: %1").arg(manager->linkSpeed)); + SocExplorerEngine::message(plugin,QString("Changing Link Speed: %1").arg(manager->linkSpeed),1); } void stardundeeSPW_USB::destinationKeyChanged(const QString &destKey) { this->manager->destinationKey = destKey.toInt(); - SocExplorerEngine::message(plugin,QString("Changing Destination Key: %1").arg(manager->destinationKey)); + SocExplorerEngine::message(plugin,QString("Changing Destination Key: %1").arg(manager->destinationKey),1); } void stardundeeSPW_USB::rmapAddressChanged(const QString &rmapaddress) { this->manager->rmapAddress = rmapaddress.toInt(); - SocExplorerEngine::message(plugin,QString("Changing RMAP address: %1").arg(manager->rmapAddress)); + SocExplorerEngine::message(plugin,QString("Changing RMAP address: %1").arg(manager->rmapAddress),1); } void stardundeeSPW_USB::rmapKeyChanged(const QString &key) { this->manager->rmapKey = key.toInt(); - SocExplorerEngine::message(plugin,QString("Changing RMAP Key: %1").arg(manager->rmapKey)); + SocExplorerEngine::message(plugin,QString("Changing RMAP Key: %1").arg(manager->rmapKey),1); } +void stardundeeSPW_USB::rmapTimeoutChanged(const QString &timeout) +{ + int tim=timeout.toInt(); + if(tim<50) + { + tim = 50; + ((StarDundeeGUI*)this->p_GUI)->setRmapTimeout(QString("%1").arg(tim)); + } + this->manager->RMAPtimeout = tim; + SocExplorerEngine::message(plugin,QString("Changing RMAP Timeout: %1").arg(manager->RMAPtimeout),1); +} + + void stardundeeSPW_USB::makeGUI(socexplorerplugin *parent) { this->p_GUI = new StarDundeeGUI(); @@ -251,12 +277,23 @@ void stardundeeSPW_USB::makeGUI(socexplo connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(destinationKeyChanged(QString)),this,SLOT(destinationKeyChanged(QString))); connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(rmapAddressChanged(QString)),this,SLOT(rmapAddressChanged(QString))); connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(rmapKeyChanged(QString)),this,SLOT(rmapKeyChanged(QString))); + connect(((StarDundeeGUI*)this->p_GUI),SIGNAL(rmapTimeoutChanged(QString)),this,SLOT(rmapTimeoutChanged(QString))); + this->brickSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getBrickSelection()); this->linkNumberSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getLinkNumberSelection()); this->linkSpeedSelectionChanged(((StarDundeeGUI*)this->p_GUI)->getLinkSpeedSelection()); this->destinationKeyChanged(((StarDundeeGUI*)this->p_GUI)->getDestinationKey()); this->rmapAddressChanged(((StarDundeeGUI*)this->p_GUI)->getRmapAddress()); this->rmapKeyChanged(((StarDundeeGUI*)this->p_GUI)->getRmapKey()); + this->rmapTimeoutChanged(((StarDundeeGUI*)this->p_GUI)->getRmapTimeout()); + + connect(this,SIGNAL(SelectBrick(int)),((StarDundeeGUI*)this->p_GUI),SLOT(selectBrick(int))); + connect(this,SIGNAL(SelectLinkNumber(int)),((StarDundeeGUI*)this->p_GUI),SLOT(selectLinkNumber(int))); + connect(this,SIGNAL(SelectLinkSpeed(int)),((StarDundeeGUI*)this->p_GUI),SLOT(selectLinkSpeed(int))); + connect(this,SIGNAL(SetDestinationKey(QString)),((StarDundeeGUI*)this->p_GUI),SLOT(setDestinationKey(QString))); + connect(this,SIGNAL(SetRmapAddress(QString)),((StarDundeeGUI*)this->p_GUI),SLOT(setRmapAddress(QString))); + connect(this,SIGNAL(SetRmapKey(QString)),((StarDundeeGUI*)this->p_GUI),SLOT(setRmapKey(QString))); + connect(this,SIGNAL(SetRmapTimeout(QString)),((StarDundeeGUI*)this->p_GUI),SLOT(setRmapTimeout(QString))); } @@ -306,7 +343,7 @@ void stardundeeSPW_USB_Manager::run() SocExplorerEngine::message(this->plugin,"It's a SPW packet",2); if(USBSpaceWire_GetReadEOPStatus(&properties, 0)== SPACEWIRE_USB_EOP) { - SocExplorerEngine::message(this->plugin,"Got end of packet"); + SocExplorerEngine::message(this->plugin,"Got end of packet",2); if(buffer[1]==(char)SPW_PROTO_ID_RMAP) //RMAP packet { SocExplorerEngine::message(this->plugin,"Got RMAP packet",2); @@ -368,7 +405,7 @@ void stardundeeSPW_USB_Manager::run() this->brickList = list; emit updateAvailableBrickCount(this->brickList); } - sleep(1); + usleep(RMAPtimeout/2); } usleep(1000); } diff --git a/spwplugin/stardundeespw_usb.h b/spwplugin/stardundeespw_usb.h --- a/spwplugin/stardundeespw_usb.h +++ b/spwplugin/stardundeespw_usb.h @@ -96,6 +96,15 @@ public: signals: + void setRmapTimeout(const QString & timeout); + void SelectBrick(int brickIndex); + void SelectLinkNumber(int linkIndex); + void SelectLinkSpeed(int linkSpeed); + void SetDestinationKey(const QString & destKey); + void SetRmapAddress(const QString & address); + void SetRmapKey(const QString & key); + void SetRmapTimeout(const QString & timeout); + public slots: void toggleBridgeConnection(); bool connectBridge(); @@ -109,6 +118,7 @@ public slots: void destinationKeyChanged(const QString & destKey); void rmapAddressChanged(const QString & rmapaddress); void rmapKeyChanged(const QString & key); + void rmapTimeoutChanged(const QString & timeout); private: void makeGUI(socexplorerplugin *parent); stardundeeSPW_USB_Manager* manager;