@@ -1,35 +1,68 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the SocExplorer Software |
|
3 | 3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "spwtcppacketserver.h" |
|
23 | 23 | #include "ui_spwtcppacketserver.h" |
|
24 | 24 | |
|
25 | 25 | SpwTcpPacketServer::SpwTcpPacketServer(QWidget *parent) : |
|
26 | 26 | QWidget(parent), |
|
27 | 27 | ui(new Ui::SpwTcpPacketServer) |
|
28 | 28 | { |
|
29 | 29 | ui->setupUi(this); |
|
30 | this->p_bridge = NULL; | |
|
31 | this->p_server = new QTcpServer(); | |
|
32 | connect(this->ui->startServeQpb,SIGNAL(clicked(bool)),SLOT(toggleServer())); | |
|
30 | 33 | } |
|
31 | 34 | |
|
32 | 35 | SpwTcpPacketServer::~SpwTcpPacketServer() |
|
33 | 36 | { |
|
34 | 37 | delete ui; |
|
35 | 38 | } |
|
39 | ||
|
40 | void SpwTcpPacketServer::setBridge(abstractSpwBridge *bridge) | |
|
41 | { | |
|
42 | if(this->p_bridge!=NULL) | |
|
43 | { | |
|
44 | disconnect(this,SLOT(pushPacket(char*,int))); | |
|
45 | } | |
|
46 | this->p_bridge = bridge; | |
|
47 | connect(bridge,SIGNAL(pushPacketOverTCP(char*,int)),SLOT(pushPacket(char*,int))); | |
|
48 | } | |
|
49 | ||
|
50 | void SpwTcpPacketServer::pushPacket(char *packet, int size) | |
|
51 | { | |
|
52 | ||
|
53 | } | |
|
54 | ||
|
55 | void SpwTcpPacketServer::toggleServer() | |
|
56 | { | |
|
57 | if(this->p_server->isListening()) | |
|
58 | { | |
|
59 | this->ui->startServeQpb->setText("Start Server"); | |
|
60 | this->p_server->close(); | |
|
61 | } | |
|
62 | else | |
|
63 | { | |
|
64 | this->p_server->listen(QHostAddress::Any,this->ui->PortLineEdit->text().toInt()); | |
|
65 | ||
|
66 | this->ui->startServeQpb->setText("Stop Server"); | |
|
67 | } | |
|
68 | } |
@@ -1,43 +1,52 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the SocExplorer Software |
|
3 | 3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef SPWTCPPACKETSERVER_H |
|
23 | 23 | #define SPWTCPPACKETSERVER_H |
|
24 | 24 | |
|
25 | 25 | #include <QWidget> |
|
26 | #include <abstractspwbridge.h> | |
|
27 | #include <QTcpServer> | |
|
26 | 28 | |
|
27 | 29 | namespace Ui { |
|
28 | 30 | class SpwTcpPacketServer; |
|
29 | 31 | } |
|
30 | 32 | |
|
31 | 33 | class SpwTcpPacketServer : public QWidget |
|
32 | 34 | { |
|
33 | 35 | Q_OBJECT |
|
34 | 36 | |
|
35 | 37 | public: |
|
36 | 38 | explicit SpwTcpPacketServer(QWidget *parent = 0); |
|
37 | 39 | ~SpwTcpPacketServer(); |
|
38 | 40 | |
|
41 | void setBridge(abstractSpwBridge* bridge); | |
|
42 | ||
|
43 | public slots: | |
|
44 | void pushPacket(char* packet,int size); | |
|
45 | void toggleServer(); | |
|
39 | 46 | private: |
|
40 | 47 | Ui::SpwTcpPacketServer *ui; |
|
48 | abstractSpwBridge* p_bridge; | |
|
49 | QTcpServer* p_server; | |
|
41 | 50 | }; |
|
42 | 51 | |
|
43 | 52 | #endif // SPWTCPPACKETSERVER_H |
@@ -1,52 +1,53 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the SocExplorer Software |
|
3 | 3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef ABSTRACTSPWBRIDGE_H |
|
23 | 23 | #define ABSTRACTSPWBRIDGE_H |
|
24 | 24 | |
|
25 | 25 | #include <QObject> |
|
26 | 26 | #include <socexplorerplugin.h> |
|
27 | 27 | #define RMAP_MAX_XFER_SIZE 4000 //slightly less than 16kBytes |
|
28 | 28 | #include <spw.h> |
|
29 | 29 | |
|
30 | 30 | class abstractSpwBridge : public QObject |
|
31 | 31 | { |
|
32 | 32 | Q_OBJECT |
|
33 | 33 | public: |
|
34 | 34 | explicit abstractSpwBridge(socexplorerplugin *parent); |
|
35 | 35 | QWidget *getGUI(); |
|
36 | 36 | |
|
37 | 37 | public slots: |
|
38 | 38 | virtual bool connectBridge(); |
|
39 | 39 | virtual bool disconnectBridge(); |
|
40 | 40 | virtual unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0)=0; |
|
41 | 41 | virtual unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0)=0; |
|
42 | 42 | virtual int pushRMAPPacket(char* packet,int size)=0; |
|
43 | 43 | signals: |
|
44 | 44 | void setConnected(bool connected); |
|
45 | void pushPacketOverTCP(char* packet,int size); | |
|
45 | 46 | protected: |
|
46 | 47 | socexplorerplugin* plugin; |
|
47 | 48 | QWidget* p_GUI; |
|
48 | 49 | private: |
|
49 | 50 | |
|
50 | 51 | }; |
|
51 | 52 | |
|
52 | 53 | #endif // ABSTRACTSPWBRIDGE_H |
@@ -1,142 +1,146 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the SocExplorer Software |
|
3 | 3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | |
|
23 | 23 | #include "spwplugin.h" |
|
24 | 24 | #include "stardundeespw_usb.h" |
|
25 | 25 | #include <socexplorerproxy.h> |
|
26 | 26 | #include "spwpywrapper.h" |
|
27 | ||
|
27 | 28 | spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,false) |
|
28 | 29 | { |
|
29 | 30 | Q_UNUSED(parent) |
|
30 | 31 | this->bridge = NULL; |
|
31 | 32 | this->scanDone = false; |
|
32 | 33 | this->pyObject = new spwPyWrapper(this); |
|
34 | this->tcpServer = new SpwTcpPacketServer(this); | |
|
33 | 35 | this->mainGroupBox = new QGroupBox("SpaceWire Plugin Configuration",this); |
|
34 | 36 | this->bridgeSelector = new QComboBox(this); |
|
37 | this->mainTabWidgt = new QTabWidget(this); | |
|
38 | this->mainTabWidgt->addTab(this->mainGroupBox,"Bridge Configuration") | |
|
35 | 39 | this->mainLayout = new QGridLayout(this->mainGroupBox); |
|
36 | 40 | this->mainLayout->addWidget(new QLabel("Select SpaceWire bridge",this),0,0,1,1,Qt::AlignCenter); |
|
37 | 41 | this->mainLayout->addWidget(this->bridgeSelector,0,1,1,1); |
|
38 | 42 | this->mainGroupBox->setLayout(this->mainLayout); |
|
39 | 43 | this->setWidget(this->mainGroupBox); |
|
40 | 44 | this->bridgeSelector->addItem("none"); |
|
41 | 45 | this->bridgeSelector->addItem("STAR-Dundee Spw USB Brick"); |
|
42 | 46 | connect(this->bridgeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(bridgeSelectionChanged(QString))); |
|
43 | 47 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(selectBridge(QString)),this,SLOT(selectBridge(QString))); |
|
44 | 48 | } |
|
45 | 49 | |
|
46 | 50 | |
|
47 | 51 | spwplugin::~spwplugin() |
|
48 | 52 | { |
|
49 | 53 | |
|
50 | 54 | } |
|
51 | 55 | |
|
52 | 56 | |
|
53 | 57 | |
|
54 | 58 | unsigned int spwplugin::Read(unsigned int *Value,unsigned int count,unsigned int address) |
|
55 | 59 | { |
|
56 | 60 | if(Connected) |
|
57 | 61 | { |
|
58 | 62 | return bridge->Read(Value,count,address); |
|
59 | 63 | } |
|
60 | 64 | return 0; |
|
61 | 65 | } |
|
62 | 66 | |
|
63 | 67 | void spwplugin::bridgeSelectionChanged(const QString &text) |
|
64 | 68 | { |
|
65 | 69 | printf("test"); |
|
66 | 70 | if(text=="none") |
|
67 | 71 | { |
|
68 | 72 | if(this->bridge!=NULL) |
|
69 | 73 | { |
|
70 | 74 | this->mainLayout->removeWidget(this->bridge->getGUI()); |
|
71 | 75 | this->disconnect(this,SLOT(setConnected(bool))); |
|
72 | 76 | delete this->bridge; |
|
73 | 77 | this->bridge= NULL; |
|
74 | 78 | } |
|
75 | 79 | } |
|
76 | 80 | if(text=="STAR-Dundee Spw USB Brick") |
|
77 | 81 | { |
|
78 | 82 | if(this->bridge!=NULL) |
|
79 | 83 | { |
|
80 | 84 | this->mainLayout->removeWidget(this->bridge->getGUI()); |
|
81 | 85 | this->disconnect(this,SLOT(setConnected(bool))); |
|
82 | 86 | delete this->bridge; |
|
83 | 87 | } |
|
84 | 88 | this->bridge = new stardundeeSPW_USB(this); |
|
85 | 89 | this->mainLayout->addWidget(this->bridge->getGUI(),1,0,1,2); |
|
86 | 90 | connect(this->bridge,SIGNAL(setConnected(bool)),this,SLOT(setConnected(bool))); |
|
87 | 91 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSelectBrick(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectBrick(int))); |
|
88 | 92 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSelectLinkNumber(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectLinkNumber(int))); |
|
89 | 93 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSelectLinkSpeed(int)),((stardundeeSPW_USB*)bridge),SIGNAL(SelectLinkSpeed(int))); |
|
90 | 94 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetDestinationKey(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetDestinationKey(QString))); |
|
91 | 95 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetRmapAddress(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetRmapAddress(QString))); |
|
92 | 96 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetRmapKey(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetRmapKey(QString))); |
|
93 | 97 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(StarDundeeSetRmapTimeout(QString)),((stardundeeSPW_USB*)bridge),SIGNAL(SetRmapTimeout(QString))); |
|
94 | 98 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(connectBridge()),((stardundeeSPW_USB*)bridge),SLOT(connectBridge())); |
|
95 | 99 | connect(((spwPyWrapper*)this->pyObject),SIGNAL(disconnectBridge()),((stardundeeSPW_USB*)bridge),SLOT(disconnectBridge())); |
|
96 | 100 | } |
|
97 | 101 | |
|
98 | 102 | } |
|
99 | 103 | |
|
100 | 104 | void spwplugin::selectBridge(const QString &text) |
|
101 | 105 | { |
|
102 | 106 | |
|
103 | 107 | if(text=="none") |
|
104 | 108 | { |
|
105 | 109 | this->bridgeSelector->setCurrentIndex(0); |
|
106 | 110 | } |
|
107 | 111 | if(text=="STAR-Dundee Spw USB Brick") |
|
108 | 112 | { |
|
109 | 113 | this->bridgeSelector->setCurrentIndex(1); |
|
110 | 114 | } |
|
111 | 115 | } |
|
112 | 116 | |
|
113 | 117 | void spwplugin::setConnected(bool connected) |
|
114 | 118 | { |
|
115 | 119 | this->bridgeSelector->setDisabled(connected); |
|
116 | 120 | this->Connected = connected; |
|
117 | 121 | emit activateSig(connected); |
|
118 | 122 | if(!this->scanDone) |
|
119 | 123 | { |
|
120 | 124 | socexplorerproxy::loadChildSysDriver(this,"AMBA_PLUGIN"); |
|
121 | 125 | this->scanDone=true; |
|
122 | 126 | } |
|
123 | 127 | } |
|
124 | 128 | |
|
125 | 129 | |
|
126 | 130 | |
|
127 | 131 | unsigned int spwplugin::Write(unsigned int *Value,unsigned int count, unsigned int address) |
|
128 | 132 | { |
|
129 | 133 | if(Connected) |
|
130 | 134 | { |
|
131 | 135 | return bridge->Write(Value,count,address); |
|
132 | 136 | } |
|
133 | 137 | return 0; |
|
134 | 138 | } |
|
135 | 139 | |
|
136 | 140 | |
|
137 | 141 | |
|
138 | 142 | |
|
139 | 143 | |
|
140 | 144 | |
|
141 | 145 | |
|
142 | 146 |
@@ -1,72 +1,76 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the SocExplorer Software |
|
3 | 3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef spwplugin_H |
|
23 | 23 | #define spwplugin_H |
|
24 | 24 | #include <QMenuBar> |
|
25 | 25 | #include <QMenu> |
|
26 | 26 | #include <QAction> |
|
27 | 27 | #include <QLayout> |
|
28 | 28 | #include <QGroupBox> |
|
29 | 29 | #include <QComboBox> |
|
30 | 30 | #include <QLabel> |
|
31 | #include <QTabWidget> | |
|
31 | 32 | |
|
32 | 33 | #include <abstractspwbridge.h> |
|
33 | 34 | #include <socexplorerplugin.h> |
|
34 | 35 | |
|
36 | #include "SpwTcpPacketServer/spwtcppacketserver.h" | |
|
35 | 37 | |
|
36 | 38 | class spwplugin : public socexplorerplugin |
|
37 | 39 | { |
|
38 | 40 | Q_OBJECT |
|
39 | 41 | public: |
|
40 | 42 | explicit spwplugin(QWidget *parent = 0); |
|
41 | 43 | ~spwplugin(); |
|
42 | 44 | /* You can implement the folowing function if you want to overwrite |
|
43 | 45 | * their default behavior |
|
44 | 46 | */ |
|
45 | 47 | /* |
|
46 | 48 | int registermenu(QMainWindow *menuHolder); |
|
47 | 49 | int isConnected(); |
|
48 | 50 | int connect(); |
|
49 | 51 | int VID(){return driver_VID;} |
|
50 | 52 | int PID(){return driver_PID;} |
|
51 | 53 | */ |
|
52 | 54 | |
|
53 | 55 | public slots: |
|
54 | 56 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
55 | 57 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
56 | 58 | |
|
57 | 59 | void bridgeSelectionChanged( const QString & text ); |
|
58 | 60 | void selectBridge( const QString & text ); |
|
59 | 61 | void setConnected(bool connected); |
|
60 | 62 | |
|
61 | 63 | signals: |
|
62 | 64 | |
|
63 | 65 | private: |
|
64 | 66 | abstractSpwBridge* bridge; |
|
67 | SpwTcpPacketServer* tcpServer; | |
|
65 | 68 | bool scanDone; |
|
69 | QTabWidget* mainTabWidgt; | |
|
66 | 70 | QGroupBox* mainGroupBox; |
|
67 | 71 | QComboBox* bridgeSelector; |
|
68 | 72 | QGridLayout* mainLayout; |
|
69 | 73 | }; |
|
70 | 74 | |
|
71 | 75 | #endif // spwplugin_H |
|
72 | 76 |
@@ -1,82 +1,83 | |||
|
1 | 1 | # |
|
2 | 2 | # Project created by QtCreator 2011-09-20T08:15:30 |
|
3 | 3 | # |
|
4 | 4 | #------------------------------------------------- |
|
5 | 5 | |
|
6 | 6 | CONFIG += socexplorerplugin |
|
7 | QT += network | |
|
7 | 8 | win32:CONFIG += dll |
|
8 | 9 | win32:CONFIG -= static |
|
9 | 10 | CONFIG(debug, debug|release) { |
|
10 | 11 | DEBUG_EXT = _d |
|
11 | 12 | } else { |
|
12 | 13 | DEBUG_EXT = |
|
13 | 14 | } |
|
14 | 15 | TARGET = spwplugin$${DEBUG_EXT} |
|
15 | 16 | DEFINES += PLUGIN=spwplugin |
|
16 | 17 | DEFINES += PLUGINHEADER="\"\\\"spwplugin.h"\\\"\" |
|
17 | 18 | DEFINES += driver_Name="\"\\\"SpwPlugin"\\\"\" |
|
18 | 19 | DEFINES += driver_Author="\"\\\"Alexis Jeandet alexis.jeandet@member.fsf.org"\\\"\" |
|
19 | 20 | DEFINES += driver_Version="\"\\\"0.0.1"\\\"\" |
|
20 | 21 | DEFINES += driver_Description="\"\\\"Driver description"\\\"\" |
|
21 | 22 | DEFINES += driver_can_be_root=1 |
|
22 | 23 | DEFINES += driver_can_be_child=0 |
|
23 | 24 | DEFINES += driver_VID=0 |
|
24 | 25 | DEFINES += driver_PID=0 |
|
25 | 26 | |
|
26 | 27 | STARTDUNDEEPATH=/home/spacewire/usb/spw_usb_driver_v2.68/ |
|
27 | 28 | |
|
28 | 29 | LIBS += $$STARTDUNDEEPATH/lib/x86_64/libSpaceWireUSBAPI.so \ |
|
29 | 30 | $$STARTDUNDEEPATH/lib/x86_64/libConfigLibraryUSB.so |
|
30 | 31 | |
|
31 | 32 | INCLUDEPATH += \ |
|
32 | 33 | $${PWD} \ |
|
33 | 34 | $$STARTDUNDEEPATH/inc \ |
|
34 | 35 | |
|
35 | 36 | HEADERS += \ |
|
36 | 37 | spwplugin.h \ |
|
37 | 38 | stardundeespw_usb.h \ |
|
38 | 39 | abstractspwbridge.h \ |
|
39 | 40 | spw.h \ |
|
40 | 41 | stardundeegui.h \ |
|
41 | 42 | SpwTcpPacketServer/spwtcppacketserver.h \ |
|
42 | 43 | spwpywrapper.h |
|
43 | 44 | |
|
44 | 45 | |
|
45 | 46 | SOURCES += \ |
|
46 | 47 | spwplugin.cpp \ |
|
47 | 48 | stardundeespw_usb.cpp \ |
|
48 | 49 | abstractspwbridge.cpp \ |
|
49 | 50 | stardundeegui.cpp \ |
|
50 | 51 | SpwTcpPacketServer/spwtcppacketserver.cpp \ |
|
51 | 52 | spwpywrapper.cpp |
|
52 | 53 | |
|
53 | 54 | FORMS += \ |
|
54 | 55 | stardundeeGUI.ui \ |
|
55 | 56 | SpwTcpPacketServer/spwtcppacketserver.ui |
|
56 | 57 | |
|
57 | 58 | RESOURCES += \ |
|
58 | 59 | spwRessources.qrc |
|
59 | 60 | |
|
60 | 61 | |
|
61 | 62 | |
|
62 | 63 | |
|
63 | 64 | |
|
64 | 65 | |
|
65 | 66 | |
|
66 | 67 | |
|
67 | 68 | |
|
68 | 69 | |
|
69 | 70 | |
|
70 | 71 | |
|
71 | 72 | |
|
72 | 73 | |
|
73 | 74 | |
|
74 | 75 | |
|
75 | 76 | |
|
76 | 77 | |
|
77 | 78 | |
|
78 | 79 | |
|
79 | 80 | |
|
80 | 81 | |
|
81 | 82 | |
|
82 | 83 |
@@ -1,128 +1,127 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the SocExplorer Software |
|
3 | 3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef STARDUNDEESPW_USB_H |
|
23 | 23 | #define STARDUNDEESPW_USB_H |
|
24 | 24 | |
|
25 | 25 | #include <QObject> |
|
26 | 26 | #include <spw_usb_api.h> |
|
27 | 27 | #include <spw_config_library.h> |
|
28 | 28 | #include <socexplorerplugin.h> |
|
29 | 29 | #include <abstractspwbridge.h> |
|
30 | 30 | #include <QThread> |
|
31 | 31 | #include <QMutex> |
|
32 | 32 | #include <QSemaphore> |
|
33 | 33 | #include <QGridLayout> |
|
34 | 34 | #include <QPushButton> |
|
35 | 35 | #include <QComboBox> |
|
36 | 36 | #include <QLabel> |
|
37 | 37 | #include "stardundeegui.h" |
|
38 | 38 | |
|
39 | 39 | class RMAP_Answer |
|
40 | 40 | { |
|
41 | 41 | public: |
|
42 | 42 | RMAP_Answer(int ID,char* data,int len) |
|
43 | 43 | { |
|
44 | 44 | transactionID = ID; |
|
45 | 45 | this->data = data; |
|
46 | 46 | this->len = len; |
|
47 | 47 | } |
|
48 | 48 | int transactionID; |
|
49 | 49 | char* data; |
|
50 | 50 | int len; |
|
51 | 51 | }; |
|
52 | 52 | |
|
53 | 53 | class stardundeeSPW_USB_Manager: public QThread |
|
54 | 54 | { |
|
55 | 55 | Q_OBJECT |
|
56 | 56 | public: |
|
57 | 57 | explicit stardundeeSPW_USB_Manager(socexplorerplugin *plugin = 0,QObject* parent=0); |
|
58 | 58 | ~stardundeeSPW_USB_Manager(); |
|
59 | 59 | void run(); |
|
60 | 60 | bool connectBridge(); |
|
61 | 61 | bool disconnectBridge(); |
|
62 | 62 | int getRMAPtransactionID(); |
|
63 | 63 | int getRMAPanswer(int transactionID,char** buffer); |
|
64 | 64 | bool sendPacket(char* packet,int size); |
|
65 | 65 | |
|
66 | 66 | signals: |
|
67 | 67 | void updateAvailableBrickCount(int count); |
|
68 | 68 | private: |
|
69 | 69 | QMutex* handleMutex,*RMAP_AnswersMtx,*RMAP_pending_transaction_IDsMtx; |
|
70 | 70 | QSemaphore* RMAP_AnswersSem; |
|
71 | 71 | void pushRmapPacket(char* packet,int len); |
|
72 | 72 | star_device_handle hDevice; |
|
73 | 73 | socexplorerplugin* plugin; |
|
74 | 74 | bool connected; |
|
75 | 75 | char* SPWPacketBuff; |
|
76 | 76 | QList<RMAP_Answer*> RMAP_Answers; |
|
77 | 77 | QList<int> RMAP_pending_transaction_IDs; |
|
78 | 78 | |
|
79 | 79 | public: |
|
80 | 80 | int selectedBrick; |
|
81 | 81 | int linkNumber; |
|
82 | 82 | int brickList; |
|
83 | 83 | int linkSpeed; |
|
84 | 84 | int destinationKey; |
|
85 | 85 | int rmapAddress; |
|
86 | 86 | int rmapKey; |
|
87 | 87 | int RMAPtimeout; |
|
88 | 88 | }; |
|
89 | 89 | |
|
90 | 90 | class stardundeeSPW_USB : public abstractSpwBridge |
|
91 | 91 | { |
|
92 | 92 | Q_OBJECT |
|
93 | 93 | public: |
|
94 | 94 | explicit stardundeeSPW_USB(socexplorerplugin *parent = 0); |
|
95 | 95 | ~stardundeeSPW_USB(); |
|
96 | 96 | |
|
97 | 97 | signals: |
|
98 | 98 | |
|
99 | 99 | void setRmapTimeout(const QString & timeout); |
|
100 | 100 | void SelectBrick(int brickIndex); |
|
101 | 101 | void SelectLinkNumber(int linkIndex); |
|
102 | 102 | void SelectLinkSpeed(int linkSpeed); |
|
103 | 103 | void SetDestinationKey(const QString & destKey); |
|
104 | 104 | void SetRmapAddress(const QString & address); |
|
105 | 105 | void SetRmapKey(const QString & key); |
|
106 | 106 | void SetRmapTimeout(const QString & timeout); |
|
107 | 107 | |
|
108 | 108 | public slots: |
|
109 | 109 | void toggleBridgeConnection(); |
|
110 | 110 | bool connectBridge(); |
|
111 | 111 | bool disconnectBridge(); |
|
112 | 112 | int pushRMAPPacket(char* packet,int size); |
|
113 | 113 | unsigned int Write(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
114 | 114 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
115 | 115 | void brickSelectionChanged(int brickIndex); |
|
116 | 116 | void linkNumberSelectionChanged(int linkIndex); |
|
117 | 117 | void linkSpeedSelectionChanged(const QString & linkSpeed); |
|
118 | 118 | void destinationKeyChanged(const QString & destKey); |
|
119 | 119 | void rmapAddressChanged(const QString & rmapaddress); |
|
120 | 120 | void rmapKeyChanged(const QString & key); |
|
121 | 121 | void rmapTimeoutChanged(const QString & timeout); |
|
122 | 122 | private: |
|
123 | 123 | void makeGUI(socexplorerplugin *parent); |
|
124 | 124 | stardundeeSPW_USB_Manager* manager; |
|
125 | // QGridLayout* mainLayout; | |
|
126 | 125 | }; |
|
127 | 126 | |
|
128 | 127 | #endif // STARDUNDEESPW_USB_H |
General Comments 0
You need to be logged in to leave comments.
Login now