@@ -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 | 22 | #include "abstractspwbridge.h" |
|
2 | 23 | |
|
3 | 24 | abstractSpwBridge::abstractSpwBridge(socexplorerplugin *parent) |
|
4 | 25 | :QObject((QObject*)parent) |
|
5 | 26 | { |
|
6 | 27 | this->plugin = parent; |
|
28 | this->p_GUI=NULL; | |
|
7 | 29 | } |
|
8 | 30 | |
|
9 | 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 | 22 | #ifndef ABSTRACTSPWBRIDGE_H |
|
2 | 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 | 22 | #ifndef SPW_H |
|
2 | 23 | #define SPW_H |
|
3 | 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 | 19 | /*-- Author : Alexis Jeandet |
|
4 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
5 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | ||
|
6 | 23 | #include "spwplugin.h" |
|
7 | 24 | #include "stardundeespw_usb.h" |
|
8 | 25 | #include <socexplorerproxy.h> |
@@ -10,13 +27,18 | |||
|
10 | 27 | spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,true) |
|
11 | 28 | { |
|
12 | 29 | Q_UNUSED(parent) |
|
13 | this->bridge = new stardundeeSPW_USB(this); | |
|
30 | this->bridge = NULL; | |
|
14 | 31 | this->scanDone = false; |
|
15 | if(this->bridge->connectBridge()) | |
|
16 | { | |
|
17 | this->Connected = true; | |
|
18 | emit this->activateSig(true); | |
|
19 | } | |
|
32 | this->mainGroupBox = new QGroupBox("SpaceWire Plugin Configuration",this); | |
|
33 | this->bridgeSelector = new QComboBox(this); | |
|
34 | this->mainLayout = new QGridLayout(this); | |
|
35 | this->mainLayout->addWidget(new QLabel("Select SpaceWire bridge",this),0,0,1,1,Qt::AlignCenter); | |
|
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 | 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 | 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 | 19 | /*-- Author : Alexis Jeandet |
|
4 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
@@ -9,6 +25,9 | |||
|
9 | 25 | #include <QMenu> |
|
10 | 26 | #include <QAction> |
|
11 | 27 | #include <QLayout> |
|
28 | #include <QGroupBox> | |
|
29 | #include <QComboBox> | |
|
30 | #include <QLabel> | |
|
12 | 31 | |
|
13 | 32 | #include <abstractspwbridge.h> |
|
14 | 33 | #include <socexplorerplugin.h> |
@@ -35,12 +54,16 public slots: | |||
|
35 | 54 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
36 | 55 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
37 | 56 | |
|
57 | void bridgeSelectionChanged( const QString & text ); | |
|
58 | ||
|
38 | 59 | signals: |
|
39 | 60 | |
|
40 | 61 | private: |
|
41 | 62 | abstractSpwBridge* bridge; |
|
42 | 63 | bool scanDone; |
|
43 | ||
|
64 | QGroupBox* mainGroupBox; | |
|
65 | QComboBox* bridgeSelector; | |
|
66 | QGridLayout* mainLayout; | |
|
44 | 67 | }; |
|
45 | 68 | |
|
46 | 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 | 23 | #include "stardundeespw_usb.h" |
|
2 | 24 | #include <socexplorerengine.h> |
|
3 | 25 | #include <qhexedit.h> |
@@ -6,10 +28,40 stardundeeSPW_USB::stardundeeSPW_USB(soc | |||
|
6 | 28 | abstractSpwBridge(parent) |
|
7 | 29 | { |
|
8 | 30 | Q_UNUSED(parent) |
|
9 |
this-> |
|
|
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 | 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 | 65 | bool stardundeeSPW_USB::connectBridge() |
|
14 | 66 | { |
|
15 | 67 | return this->manager->connectBridge(); |
@@ -143,14 +195,14 unsigned int stardundeeSPW_USB::Read(uns | |||
|
143 | 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 | 199 | :QThread((QObject*)parent) |
|
148 | 200 | { |
|
149 | 201 | this->handleMutex = new QMutex(QMutex::NonRecursive); |
|
150 | 202 | this->RMAP_AnswersSem = new QSemaphore(0); |
|
151 | 203 | this->RMAP_AnswersMtx=new QMutex(QMutex::Recursive); |
|
152 | 204 | this->RMAP_pending_transaction_IDsMtx=new QMutex(QMutex::Recursive); |
|
153 |
this->plugin = p |
|
|
205 | this->plugin = plugin; | |
|
154 | 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 | 22 | #ifndef STARDUNDEESPW_USB_H |
|
2 | 23 | #define STARDUNDEESPW_USB_H |
|
3 | 24 | |
@@ -9,6 +30,8 | |||
|
9 | 30 | #include <QThread> |
|
10 | 31 | #include <QMutex> |
|
11 | 32 | #include <QSemaphore> |
|
33 | #include <QGridLayout> | |
|
34 | #include <QPushButton> | |
|
12 | 35 | |
|
13 | 36 | class RMAP_Answer |
|
14 | 37 | { |
@@ -28,7 +51,7 class stardundeeSPW_USB_Manager: public | |||
|
28 | 51 | { |
|
29 | 52 | Q_OBJECT |
|
30 | 53 | public: |
|
31 |
explicit stardundeeSPW_USB_Manager(socexplorerplugin *p |
|
|
54 | explicit stardundeeSPW_USB_Manager(socexplorerplugin *plugin = 0,QObject* parent=0); | |
|
32 | 55 | ~stardundeeSPW_USB_Manager(); |
|
33 | 56 | void run(); |
|
34 | 57 | bool connectBridge(); |
@@ -53,10 +76,12 class stardundeeSPW_USB : public abstrac | |||
|
53 | 76 | Q_OBJECT |
|
54 | 77 | public: |
|
55 | 78 | explicit stardundeeSPW_USB(socexplorerplugin *parent = 0); |
|
79 | ~stardundeeSPW_USB(); | |
|
56 | 80 | |
|
57 | 81 | signals: |
|
58 | 82 | |
|
59 | 83 | public slots: |
|
84 | void toggleBridgeConnection(); | |
|
60 | 85 | bool connectBridge(); |
|
61 | 86 | bool disconnectBridge(); |
|
62 | 87 | int pushRMAPPacket(char* packet,int size); |
@@ -65,7 +90,8 public slots: | |||
|
65 | 90 | |
|
66 | 91 | private: |
|
67 | 92 | stardundeeSPW_USB_Manager* manager; |
|
68 | ||
|
93 | QGridLayout* mainLayout; | |
|
94 | QPushButton* connectBridgeButton; | |
|
69 | 95 | }; |
|
70 | 96 | |
|
71 | 97 | #endif // STARDUNDEESPW_USB_H |
General Comments 0
You need to be logged in to leave comments.
Login now