##// END OF EJS Templates
Sync
Jeandet Alexis -
r18:3b7afcb93195 default
parent child
Show More
@@ -27,9 +27,42 SpwTcpPacketServer::SpwTcpPacketServer(Q
27 ui(new Ui::SpwTcpPacketServer)
27 ui(new Ui::SpwTcpPacketServer)
28 {
28 {
29 ui->setupUi(this);
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 SpwTcpPacketServer::~SpwTcpPacketServer()
35 SpwTcpPacketServer::~SpwTcpPacketServer()
33 {
36 {
34 delete ui;
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 }
@@ -23,6 +23,8
23 #define SPWTCPPACKETSERVER_H
23 #define SPWTCPPACKETSERVER_H
24
24
25 #include <QWidget>
25 #include <QWidget>
26 #include <abstractspwbridge.h>
27 #include <QTcpServer>
26
28
27 namespace Ui {
29 namespace Ui {
28 class SpwTcpPacketServer;
30 class SpwTcpPacketServer;
@@ -36,8 +38,15 public:
36 explicit SpwTcpPacketServer(QWidget *parent = 0);
38 explicit SpwTcpPacketServer(QWidget *parent = 0);
37 ~SpwTcpPacketServer();
39 ~SpwTcpPacketServer();
38
40
41 void setBridge(abstractSpwBridge* bridge);
42
43 public slots:
44 void pushPacket(char* packet,int size);
45 void toggleServer();
39 private:
46 private:
40 Ui::SpwTcpPacketServer *ui;
47 Ui::SpwTcpPacketServer *ui;
48 abstractSpwBridge* p_bridge;
49 QTcpServer* p_server;
41 };
50 };
42
51
43 #endif // SPWTCPPACKETSERVER_H
52 #endif // SPWTCPPACKETSERVER_H
@@ -42,6 +42,7 public slots:
42 virtual int pushRMAPPacket(char* packet,int size)=0;
42 virtual int pushRMAPPacket(char* packet,int size)=0;
43 signals:
43 signals:
44 void setConnected(bool connected);
44 void setConnected(bool connected);
45 void pushPacketOverTCP(char* packet,int size);
45 protected:
46 protected:
46 socexplorerplugin* plugin;
47 socexplorerplugin* plugin;
47 QWidget* p_GUI;
48 QWidget* p_GUI;
@@ -24,14 +24,18
24 #include "stardundeespw_usb.h"
24 #include "stardundeespw_usb.h"
25 #include <socexplorerproxy.h>
25 #include <socexplorerproxy.h>
26 #include "spwpywrapper.h"
26 #include "spwpywrapper.h"
27
27 spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,false)
28 spwplugin::spwplugin(QWidget *parent):socexplorerplugin(parent,false)
28 {
29 {
29 Q_UNUSED(parent)
30 Q_UNUSED(parent)
30 this->bridge = NULL;
31 this->bridge = NULL;
31 this->scanDone = false;
32 this->scanDone = false;
32 this->pyObject = new spwPyWrapper(this);
33 this->pyObject = new spwPyWrapper(this);
34 this->tcpServer = new SpwTcpPacketServer(this);
33 this->mainGroupBox = new QGroupBox("SpaceWire Plugin Configuration",this);
35 this->mainGroupBox = new QGroupBox("SpaceWire Plugin Configuration",this);
34 this->bridgeSelector = new QComboBox(this);
36 this->bridgeSelector = new QComboBox(this);
37 this->mainTabWidgt = new QTabWidget(this);
38 this->mainTabWidgt->addTab(this->mainGroupBox,"Bridge Configuration")
35 this->mainLayout = new QGridLayout(this->mainGroupBox);
39 this->mainLayout = new QGridLayout(this->mainGroupBox);
36 this->mainLayout->addWidget(new QLabel("Select SpaceWire bridge",this),0,0,1,1,Qt::AlignCenter);
40 this->mainLayout->addWidget(new QLabel("Select SpaceWire bridge",this),0,0,1,1,Qt::AlignCenter);
37 this->mainLayout->addWidget(this->bridgeSelector,0,1,1,1);
41 this->mainLayout->addWidget(this->bridgeSelector,0,1,1,1);
@@ -28,10 +28,12
28 #include <QGroupBox>
28 #include <QGroupBox>
29 #include <QComboBox>
29 #include <QComboBox>
30 #include <QLabel>
30 #include <QLabel>
31 #include <QTabWidget>
31
32
32 #include <abstractspwbridge.h>
33 #include <abstractspwbridge.h>
33 #include <socexplorerplugin.h>
34 #include <socexplorerplugin.h>
34
35
36 #include "SpwTcpPacketServer/spwtcppacketserver.h"
35
37
36 class spwplugin : public socexplorerplugin
38 class spwplugin : public socexplorerplugin
37 {
39 {
@@ -62,7 +64,9 signals:
62
64
63 private:
65 private:
64 abstractSpwBridge* bridge;
66 abstractSpwBridge* bridge;
67 SpwTcpPacketServer* tcpServer;
65 bool scanDone;
68 bool scanDone;
69 QTabWidget* mainTabWidgt;
66 QGroupBox* mainGroupBox;
70 QGroupBox* mainGroupBox;
67 QComboBox* bridgeSelector;
71 QComboBox* bridgeSelector;
68 QGridLayout* mainLayout;
72 QGridLayout* mainLayout;
@@ -4,6 +4,7
4 #-------------------------------------------------
4 #-------------------------------------------------
5
5
6 CONFIG += socexplorerplugin
6 CONFIG += socexplorerplugin
7 QT += network
7 win32:CONFIG += dll
8 win32:CONFIG += dll
8 win32:CONFIG -= static
9 win32:CONFIG -= static
9 CONFIG(debug, debug|release) {
10 CONFIG(debug, debug|release) {
@@ -122,7 +122,6 public slots:
122 private:
122 private:
123 void makeGUI(socexplorerplugin *parent);
123 void makeGUI(socexplorerplugin *parent);
124 stardundeeSPW_USB_Manager* manager;
124 stardundeeSPW_USB_Manager* manager;
125 // QGridLayout* mainLayout;
126 };
125 };
127
126
128 #endif // STARDUNDEESPW_USB_H
127 #endif // STARDUNDEESPW_USB_H
General Comments 0
You need to be logged in to leave comments. Login now