##// END OF EJS Templates
Sync
Jeandet Alexis -
r18:3b7afcb93195 default
parent child
Show More
@@ -27,9 +27,42 SpwTcpPacketServer::SpwTcpPacketServer(Q
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 }
@@ -23,6 +23,8
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;
@@ -36,8 +38,15 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
@@ -42,6 +42,7 public slots:
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;
@@ -24,14 +24,18
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);
@@ -28,10 +28,12
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 {
@@ -62,7 +64,9 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;
@@ -4,6 +4,7
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) {
@@ -122,7 +122,6 public slots:
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