##// END OF EJS Templates
Space wire plugin GUI Work In Progress.
Jeandet Alexis -
r8:aeda472c02a8 default
parent child
Show More
@@ -1,9 +1,31
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 ----------------------------------------------------------------------------*/
1 #include "abstractspwbridge.h"
22 #include "abstractspwbridge.h"
2
23
3 abstractSpwBridge::abstractSpwBridge(socexplorerplugin *parent)
24 abstractSpwBridge::abstractSpwBridge(socexplorerplugin *parent)
4 :QObject((QObject*)parent)
25 :QObject((QObject*)parent)
5 {
26 {
6 this->plugin = parent;
27 this->plugin = parent;
28 this->p_GUI=NULL;
7 }
29 }
8
30
9 QWidget *abstractSpwBridge::getGUI()
31 QWidget *abstractSpwBridge::getGUI()
@@ -1,3 +1,24
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 ----------------------------------------------------------------------------*/
1 #ifndef ABSTRACTSPWBRIDGE_H
22 #ifndef ABSTRACTSPWBRIDGE_H
2 #define ABSTRACTSPWBRIDGE_H
23 #define ABSTRACTSPWBRIDGE_H
3
24
@@ -1,3 +1,24
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 ----------------------------------------------------------------------------*/
1 #ifndef SPW_H
22 #ifndef SPW_H
2 #define SPW_H
23 #define SPW_H
3 #include <stdint.h>
24 #include <stdint.h>
@@ -1,8 +1,25
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
3 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
4 -- Mail : alexis.jeandet@member.fsf.org
20 -- Mail : alexis.jeandet@member.fsf.org
5 ----------------------------------------------------------------------------*/
21 ----------------------------------------------------------------------------*/
22
6 #include "spwplugin.h"
23 #include "spwplugin.h"
7 #include "stardundeespw_usb.h"
24 #include "stardundeespw_usb.h"
8 #include <socexplorerproxy.h>
25 #include <socexplorerproxy.h>
@@ -10,13 +27,18
10 spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,true)
27 spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,true)
11 {
28 {
12 Q_UNUSED(parent)
29 Q_UNUSED(parent)
13 this->bridge = new stardundeeSPW_USB(this);
30 this->bridge = NULL;
14 this->scanDone = false;
31 this->scanDone = false;
15 if(this->bridge->connectBridge())
32 this->mainGroupBox = new QGroupBox("SpaceWire Plugin Configuration",this);
16 {
33 this->bridgeSelector = new QComboBox(this);
17 this->Connected = true;
34 this->mainLayout = new QGridLayout(this);
18 emit this->activateSig(true);
35 this->mainLayout->addWidget(new QLabel("Select SpaceWire bridge",this),0,0,1,1,Qt::AlignCenter);
19 }
36 this->mainLayout->addWidget(this->bridgeSelector,0,1,1,1);
37 this->mainGroupBox->setLayout(this->mainLayout);
38 this->setWidget(this->mainGroupBox);
39 this->bridgeSelector->addItem("none");
40 this->bridgeSelector->addItem("STAR-Dundee Spw USB Brick");
41 connect(this->bridgeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(bridgeSelectionChanged(QString)));
20 }
42 }
21
43
22
44
@@ -36,6 +58,31 unsigned int spwplugin::Read(unsigned in
36 return 0;
58 return 0;
37 }
59 }
38
60
61 void spwplugin::bridgeSelectionChanged(const QString &text)
62 {
63 printf("test");
64 if(text=="none")
65 {
66 if(this->bridge!=NULL)
67 {
68 this->mainLayout->removeWidget(this->bridge->getGUI());
69 delete this->bridge;
70 this->bridge= NULL;
71 }
72 }
73 if(text=="STAR-Dundee Spw USB Brick")
74 {
75 if(this->bridge!=NULL)
76 {
77 this->mainLayout->removeWidget(this->bridge->getGUI());
78 delete this->bridge;
79 }
80 this->bridge = new stardundeeSPW_USB(this);
81 this->mainLayout->addWidget(this->bridge->getGUI(),1,0,1,2);
82 }
83
84 }
85
39
86
40
87
41 unsigned int spwplugin::Write(unsigned int *Value,unsigned int count, unsigned int address)
88 unsigned int spwplugin::Write(unsigned int *Value,unsigned int count, unsigned int address)
@@ -1,4 +1,20
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
3 /*-- Author : Alexis Jeandet
19 /*-- Author : Alexis Jeandet
4 -- Mail : alexis.jeandet@member.fsf.org
20 -- Mail : alexis.jeandet@member.fsf.org
@@ -9,6 +25,9
9 #include <QMenu>
25 #include <QMenu>
10 #include <QAction>
26 #include <QAction>
11 #include <QLayout>
27 #include <QLayout>
28 #include <QGroupBox>
29 #include <QComboBox>
30 #include <QLabel>
12
31
13 #include <abstractspwbridge.h>
32 #include <abstractspwbridge.h>
14 #include <socexplorerplugin.h>
33 #include <socexplorerplugin.h>
@@ -35,12 +54,16 public slots:
35 unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0);
54 unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0);
36 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
55 unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0);
37
56
57 void bridgeSelectionChanged( const QString & text );
58
38 signals:
59 signals:
39
60
40 private:
61 private:
41 abstractSpwBridge* bridge;
62 abstractSpwBridge* bridge;
42 bool scanDone;
63 bool scanDone;
43
64 QGroupBox* mainGroupBox;
65 QComboBox* bridgeSelector;
66 QGridLayout* mainLayout;
44 };
67 };
45
68
46 #endif // spwplugin_H
69 #endif // spwplugin_H
@@ -1,3 +1,25
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 ----------------------------------------------------------------------------*/
22
1 #include "stardundeespw_usb.h"
23 #include "stardundeespw_usb.h"
2 #include <socexplorerengine.h>
24 #include <socexplorerengine.h>
3 #include <qhexedit.h>
25 #include <qhexedit.h>
@@ -6,10 +28,40 stardundeeSPW_USB::stardundeeSPW_USB(soc
6 abstractSpwBridge(parent)
28 abstractSpwBridge(parent)
7 {
29 {
8 Q_UNUSED(parent)
30 Q_UNUSED(parent)
9 this->manager = new stardundeeSPW_USB_Manager(parent);
31 this->p_GUI = new QWidget(parent);
32 this->mainLayout = new QGridLayout(this->p_GUI);
33 this->p_GUI->setLayout(mainLayout);
34 this->connectBridgeButton = new QPushButton("Connect");
35 this->mainLayout->addWidget(this->connectBridgeButton,1,0,1,1);
36 connect(this->connectBridgeButton,SIGNAL(clicked()),this,SLOT(toggleBridgeConnection()));
37 this->manager = new stardundeeSPW_USB_Manager(parent,this);
10 this->manager->start();
38 this->manager->start();
11 }
39 }
12
40
41 stardundeeSPW_USB::~stardundeeSPW_USB()
42 {
43 this->manager->requestInterruption();
44 delete this->p_GUI;
45 }
46
47 void stardundeeSPW_USB::toggleBridgeConnection()
48 {
49 if(this->plugin->isConnected())
50 {
51 if(this->disconnectBridge())
52 {
53 this->connectBridgeButton->setText("Connect");
54 }
55 }
56 else
57 {
58 if(this->connectBridge())
59 {
60 this->connectBridgeButton->setText("Disconnect");
61 }
62 }
63 }
64
13 bool stardundeeSPW_USB::connectBridge()
65 bool stardundeeSPW_USB::connectBridge()
14 {
66 {
15 return this->manager->connectBridge();
67 return this->manager->connectBridge();
@@ -143,14 +195,14 unsigned int stardundeeSPW_USB::Read(uns
143 return read;
195 return read;
144 }
196 }
145
197
146 stardundeeSPW_USB_Manager::stardundeeSPW_USB_Manager(socexplorerplugin *parent)
198 stardundeeSPW_USB_Manager::stardundeeSPW_USB_Manager(socexplorerplugin *plugin, QObject *parent)
147 :QThread((QObject*)parent)
199 :QThread((QObject*)parent)
148 {
200 {
149 this->handleMutex = new QMutex(QMutex::NonRecursive);
201 this->handleMutex = new QMutex(QMutex::NonRecursive);
150 this->RMAP_AnswersSem = new QSemaphore(0);
202 this->RMAP_AnswersSem = new QSemaphore(0);
151 this->RMAP_AnswersMtx=new QMutex(QMutex::Recursive);
203 this->RMAP_AnswersMtx=new QMutex(QMutex::Recursive);
152 this->RMAP_pending_transaction_IDsMtx=new QMutex(QMutex::Recursive);
204 this->RMAP_pending_transaction_IDsMtx=new QMutex(QMutex::Recursive);
153 this->plugin = parent;
205 this->plugin = plugin;
154 connected = false;
206 connected = false;
155 }
207 }
156
208
@@ -1,3 +1,24
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the SocExplorer Software
3 -- Copyright (C) 2014, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@member.fsf.org
21 ----------------------------------------------------------------------------*/
1 #ifndef STARDUNDEESPW_USB_H
22 #ifndef STARDUNDEESPW_USB_H
2 #define STARDUNDEESPW_USB_H
23 #define STARDUNDEESPW_USB_H
3
24
@@ -9,6 +30,8
9 #include <QThread>
30 #include <QThread>
10 #include <QMutex>
31 #include <QMutex>
11 #include <QSemaphore>
32 #include <QSemaphore>
33 #include <QGridLayout>
34 #include <QPushButton>
12
35
13 class RMAP_Answer
36 class RMAP_Answer
14 {
37 {
@@ -28,7 +51,7 class stardundeeSPW_USB_Manager: public
28 {
51 {
29 Q_OBJECT
52 Q_OBJECT
30 public:
53 public:
31 explicit stardundeeSPW_USB_Manager(socexplorerplugin *parent = 0);
54 explicit stardundeeSPW_USB_Manager(socexplorerplugin *plugin = 0,QObject* parent=0);
32 ~stardundeeSPW_USB_Manager();
55 ~stardundeeSPW_USB_Manager();
33 void run();
56 void run();
34 bool connectBridge();
57 bool connectBridge();
@@ -53,10 +76,12 class stardundeeSPW_USB : public abstrac
53 Q_OBJECT
76 Q_OBJECT
54 public:
77 public:
55 explicit stardundeeSPW_USB(socexplorerplugin *parent = 0);
78 explicit stardundeeSPW_USB(socexplorerplugin *parent = 0);
79 ~stardundeeSPW_USB();
56
80
57 signals:
81 signals:
58
82
59 public slots:
83 public slots:
84 void toggleBridgeConnection();
60 bool connectBridge();
85 bool connectBridge();
61 bool disconnectBridge();
86 bool disconnectBridge();
62 int pushRMAPPacket(char* packet,int size);
87 int pushRMAPPacket(char* packet,int size);
@@ -65,7 +90,8 public slots:
65
90
66 private:
91 private:
67 stardundeeSPW_USB_Manager* manager;
92 stardundeeSPW_USB_Manager* manager;
68
93 QGridLayout* mainLayout;
94 QPushButton* connectBridgeButton;
69 };
95 };
70
96
71 #endif // STARDUNDEESPW_USB_H
97 #endif // STARDUNDEESPW_USB_H
General Comments 0
You need to be logged in to leave comments. Login now