##// END OF EJS Templates
SpwPlugin:...
jeandet -
r65:67168ff4b6e7 default
parent child
Show More
@@ -0,0 +1,57
1 #include "fakestardundeespwusbgui.h"
2 #include "ui_fakestardundeespwusbgui.h"
3 #include "fakestardundeespwusb_lib.h"
4
5 FakeStardundeeSpwUsbGui::FakeStardundeeSpwUsbGui(QWidget *parent) :
6 QWidget(parent),
7 ui(new Ui::FakeStardundeeSpwUsbGui)
8 {
9 ui->setupUi(this);
10 }
11
12 FakeStardundeeSpwUsbGui::~FakeStardundeeSpwUsbGui()
13 {
14 delete ui;
15 }
16
17 void FakeStardundeeSpwUsbGui::update()
18 {
19 const QList<funcToresolve> stat=FakeStarDundeeSpwUSB_Lib::status();
20 QTableWidgetItem* item;
21 this->ui->symbolsList->clear();
22 this->ui->symbolsList->setHorizontalHeaderLabels(QStringList()<<"Symbol"<<"Status");
23 this->ui->symbolsList->setRowCount(stat.count());
24 for(int i=0;i<stat.count();i++)
25 {
26 item=new QTableWidgetItem(stat[i].symbolName);
27 item->setFlags(item->flags()^Qt::ItemIsEditable);
28 this->ui->symbolsList->setItem(i,0,item);
29 if(*(stat[i].function)==NULL)
30 {
31 item=new QTableWidgetItem("Not found");
32 item->setForeground(Qt::red);
33 item->setFlags(item->flags()^Qt::ItemIsEditable);
34 this->ui->symbolsList->setItem(i,1,item);
35 }
36 else
37 {
38 item=new QTableWidgetItem("Loaded");
39 item->setForeground(Qt::green);
40 item->setFlags(item->flags()^Qt::ItemIsEditable);
41 this->ui->symbolsList->setItem(i,1,item);
42 }
43 }
44 this->ui->symbolsList->resizeColumnsToContents();
45 }
46
47 void FakeStardundeeSpwUsbGui::changeEvent(QEvent *e)
48 {
49 QWidget::changeEvent(e);
50 switch (e->type()) {
51 case QEvent::LanguageChange:
52 ui->retranslateUi(this);
53 break;
54 default:
55 break;
56 }
57 }
@@ -0,0 +1,25
1 #ifndef FAKESTARDUNDEESPWUSBGUI_H
2 #define FAKESTARDUNDEESPWUSBGUI_H
3
4 #include <QWidget>
5
6 namespace Ui {
7 class FakeStardundeeSpwUsbGui;
8 }
9
10 class FakeStardundeeSpwUsbGui : public QWidget
11 {
12 Q_OBJECT
13
14 public:
15 explicit FakeStardundeeSpwUsbGui(QWidget *parent = 0);
16 ~FakeStardundeeSpwUsbGui();
17 void update();
18 protected:
19 void changeEvent(QEvent *e);
20
21 private:
22 Ui::FakeStardundeeSpwUsbGui *ui;
23 };
24
25 #endif // FAKESTARDUNDEESPWUSBGUI_H
@@ -0,0 +1,84
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
3 <class>FakeStardundeeSpwUsbGui</class>
4 <widget class="QWidget" name="FakeStardundeeSpwUsbGui">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>612</width>
10 <height>300</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Form</string>
15 </property>
16 <layout class="QGridLayout" name="gridLayout">
17 <item row="1" column="1">
18 <widget class="QPushButton" name="closeQpb">
19 <property name="text">
20 <string>close</string>
21 </property>
22 </widget>
23 </item>
24 <item row="1" column="0">
25 <spacer name="horizontalSpacer">
26 <property name="orientation">
27 <enum>Qt::Horizontal</enum>
28 </property>
29 <property name="sizeHint" stdset="0">
30 <size>
31 <width>40</width>
32 <height>20</height>
33 </size>
34 </property>
35 </spacer>
36 </item>
37 <item row="0" column="0" colspan="2">
38 <widget class="QTableWidget" name="symbolsList">
39 <property name="alternatingRowColors">
40 <bool>true</bool>
41 </property>
42 <property name="sortingEnabled">
43 <bool>true</bool>
44 </property>
45 <attribute name="horizontalHeaderShowSortIndicator" stdset="0">
46 <bool>true</bool>
47 </attribute>
48 <attribute name="verticalHeaderShowSortIndicator" stdset="0">
49 <bool>false</bool>
50 </attribute>
51 <column>
52 <property name="text">
53 <string>Symbol</string>
54 </property>
55 </column>
56 <column>
57 <property name="text">
58 <string>Status</string>
59 </property>
60 </column>
61 </widget>
62 </item>
63 </layout>
64 </widget>
65 <resources/>
66 <connections>
67 <connection>
68 <sender>closeQpb</sender>
69 <signal>clicked()</signal>
70 <receiver>FakeStardundeeSpwUsbGui</receiver>
71 <slot>close()</slot>
72 <hints>
73 <hint type="sourcelabel">
74 <x>560</x>
75 <y>275</y>
76 </hint>
77 <hint type="destinationlabel">
78 <x>305</x>
79 <y>149</y>
80 </hint>
81 </hints>
82 </connection>
83 </connections>
84 </ui>
@@ -88,11 +88,7 int (*resolved_CFGSpaceWire_GetTickEna
88 88 int (*resolved_CFGSpaceWire_SetTickEnableStatus)(star_device_handle hDevice, U32 dwTickEnableStatus)=NULL;
89 89
90 90
91 typedef struct funcToresolve
92 {
93 void (** function)();
94 const char* symbolName;
95 }funcToresolve;
91
96 92
97 93 QList<funcToresolve> funcTable=QList<funcToresolve>()
98 94 <<funcToresolve{(void (**)())&resolved_USBSpaceWire_Open,"USBSpaceWire_Open"}
@@ -193,6 +189,22 void FakeStarDundeeSpwUSB_Lib::resolve()
193 189 }
194 190 }
195 191
192 bool FakeStarDundeeSpwUSB_Lib::fullresolved()
193 {
194 bool success=true;
195 for(int i=0;i<funcTable.count();i++)
196 {
197 if(*(funcTable[i].function)==NULL)
198 success=false;
199 }
200 return success;
201 }
202
203 const QList<funcToresolve> &FakeStarDundeeSpwUSB_Lib::status()
204 {
205 return funcTable;
206 }
207
196 208
197 209
198 210 char USBSpaceWire_Open(star_device_handle *phDevice, int nDeviceNum)
@@ -359,7 +359,11 void CFGSpaceWire_RTGetOutputPorts(U32
359 359 int CFGSpaceWire_GetTickEnableStatus(star_device_handle hDevice, U32 *dwTickEnableStatus);
360 360 int CFGSpaceWire_SetTickEnableStatus(star_device_handle hDevice, U32 dwTickEnableStatus);
361 361
362
362 typedef struct funcToresolve
363 {
364 void (** function)();
365 const char* symbolName;
366 }funcToresolve;
363 367
364 368
365 369 class FakeStarDundeeSpwUSB_Lib
@@ -367,6 +371,8 class FakeStarDundeeSpwUSB_Lib
367 371 public:
368 372 FakeStarDundeeSpwUSB_Lib();
369 373 static void resolve();
374 static bool fullresolved();
375 static const QList<funcToresolve>& status();
370 376 };
371 377
372 378 #endif // FAKESTARDUNDEESPWUSB_LIB_H
@@ -6,22 +6,22
6 6 <rect>
7 7 <x>0</x>
8 8 <y>0</y>
9 <width>397</width>
10 <height>506</height>
9 <width>609</width>
10 <height>581</height>
11 11 </rect>
12 12 </property>
13 13 <property name="windowTitle">
14 14 <string>Form</string>
15 15 </property>
16 16 <layout class="QFormLayout" name="formLayout">
17 <item row="0" column="0">
17 <item row="7" column="0">
18 18 <widget class="QLabel" name="selectBrickLbl">
19 19 <property name="text">
20 20 <string>Select Brick</string>
21 21 </property>
22 22 </widget>
23 23 </item>
24 <item row="0" column="1">
24 <item row="7" column="1">
25 25 <widget class="QComboBox" name="selectBrickCmbx">
26 26 <property name="toolTip">
27 27 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select the brick you want to use.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@@ -36,14 +36,14
36 36 </item>
37 37 </widget>
38 38 </item>
39 <item row="1" column="0">
39 <item row="8" column="0">
40 40 <widget class="QLabel" name="selectLinkLbl">
41 41 <property name="text">
42 42 <string>Select link number</string>
43 43 </property>
44 44 </widget>
45 45 </item>
46 <item row="1" column="1">
46 <item row="8" column="1">
47 47 <widget class="QComboBox" name="selectLinkCmbx">
48 48 <property name="toolTip">
49 49 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select the link number you want to use.&lt;/p&gt;&lt;p&gt;The link number correspond to the numbers on the brick:&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;:/imgs/stardundee.tif&quot;/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@@ -60,14 +60,14
60 60 </item>
61 61 </widget>
62 62 </item>
63 <item row="2" column="0">
63 <item row="9" column="0">
64 64 <widget class="QLabel" name="selectLinkSpeedLbl">
65 65 <property name="text">
66 66 <string>Link Speed</string>
67 67 </property>
68 68 </widget>
69 69 </item>
70 <item row="2" column="1">
70 <item row="9" column="1">
71 71 <widget class="QComboBox" name="setLinkSpeedCmbx">
72 72 <property name="toolTip">
73 73 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select the Space Wire link speed you want to use.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@@ -79,14 +79,14
79 79 </item>
80 80 </widget>
81 81 </item>
82 <item row="3" column="0">
82 <item row="10" column="0">
83 83 <widget class="QLabel" name="setDestKeyLbl">
84 84 <property name="text">
85 85 <string>Source address</string>
86 86 </property>
87 87 </widget>
88 88 </item>
89 <item row="3" column="1">
89 <item row="10" column="1">
90 90 <widget class="QLineEdit" name="sourceAddressLineEdit">
91 91 <property name="toolTip">
92 92 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the Space Wire Brick destination Key, the default value is 32 (0x20).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@@ -102,14 +102,14
102 102 </property>
103 103 </widget>
104 104 </item>
105 <item row="4" column="0">
105 <item row="11" column="0">
106 106 <widget class="QLabel" name="RMAPaddressLbl">
107 107 <property name="text">
108 108 <string>Destination address</string>
109 109 </property>
110 110 </widget>
111 111 </item>
112 <item row="4" column="1">
112 <item row="11" column="1">
113 113 <widget class="QLineEdit" name="destinationAddressLineEdit">
114 114 <property name="toolTip">
115 115 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the RMAP target address, this address will be used as destination address for all the RMAP transfers.&lt;/p&gt;&lt;p&gt;This is you SOC spw address.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@@ -125,14 +125,14
125 125 </property>
126 126 </widget>
127 127 </item>
128 <item row="5" column="0">
128 <item row="12" column="0">
129 129 <widget class="QLabel" name="RMAPKeyLbl">
130 130 <property name="text">
131 131 <string>Destination key</string>
132 132 </property>
133 133 </widget>
134 134 </item>
135 <item row="5" column="1">
135 <item row="12" column="1">
136 136 <widget class="QLineEdit" name="destinationKeyLineEdit">
137 137 <property name="toolTip">
138 138 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the RMAP target key, this key will be used for all the RMAP transfers.&lt;/p&gt;&lt;p&gt;This is you SOC spw key.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@@ -148,7 +148,7
148 148 </property>
149 149 </widget>
150 150 </item>
151 <item row="6" column="1">
151 <item row="13" column="1">
152 152 <widget class="QLineEdit" name="RMAPTimeoutLineEdit">
153 153 <property name="toolTip">
154 154 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the RMAP timeout, when waiting for a RMAP answer the driver will give up after this time if it doesn't get any answer.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@@ -167,38 +167,38
167 167 </property>
168 168 </widget>
169 169 </item>
170 <item row="6" column="0">
170 <item row="13" column="0">
171 171 <widget class="QLabel" name="RMAPTimeoutLbl">
172 172 <property name="text">
173 173 <string>RMAP timeout(ms)</string>
174 174 </property>
175 175 </widget>
176 176 </item>
177 <item row="10" column="1">
177 <item row="17" column="1">
178 178 <widget class="QPushButton" name="connectQpb">
179 179 <property name="text">
180 180 <string>Connect</string>
181 181 </property>
182 182 </widget>
183 183 </item>
184 <item row="8" column="1">
184 <item row="15" column="1">
185 185 <widget class="QRadioButton" name="setInterfaceModeQrb">
186 186 <property name="text">
187 <string>interface mode</string>
187 <string>i&amp;nterface mode</string>
188 188 </property>
189 189 <property name="checked">
190 190 <bool>true</bool>
191 191 </property>
192 192 </widget>
193 193 </item>
194 <item row="9" column="1">
194 <item row="16" column="1">
195 195 <widget class="QRadioButton" name="setRouterModeQrb">
196 196 <property name="text">
197 <string>router mode</string>
197 <string>router &amp;mode</string>
198 198 </property>
199 199 </widget>
200 200 </item>
201 <item row="11" column="0" colspan="2">
201 <item row="18" column="0" colspan="2">
202 202 <layout class="QGridLayout" name="gridLayout">
203 203 <item row="1" column="0">
204 204 <widget class="QLabel" name="label_4">
@@ -277,27 +277,61
277 277 </item>
278 278 </layout>
279 279 </item>
280 <item row="8" column="0">
280 <item row="15" column="0">
281 281 <widget class="QCheckBox" name="spwTimecodes">
282 282 <property name="text">
283 283 <string>timecode</string>
284 284 </property>
285 285 </widget>
286 286 </item>
287 <item row="7" column="0">
287 <item row="14" column="0">
288 288 <widget class="QLabel" name="label">
289 289 <property name="text">
290 290 <string>Timecode f (Hz)</string>
291 291 </property>
292 292 </widget>
293 293 </item>
294 <item row="7" column="1">
294 <item row="14" column="1">
295 295 <widget class="QLineEdit" name="timecodeFrequencyLineEdit">
296 296 <property name="text">
297 297 <string>1</string>
298 298 </property>
299 299 </widget>
300 300 </item>
301 <item row="5" column="0">
302 <widget class="QLabel" name="label_2">
303 <property name="text">
304 <string>Driver Status</string>
305 </property>
306 </widget>
307 </item>
308 <item row="5" column="1">
309 <layout class="QHBoxLayout" name="horizontalLayout">
310 <property name="leftMargin">
311 <number>0</number>
312 </property>
313 <property name="topMargin">
314 <number>0</number>
315 </property>
316 <item>
317 <widget class="QLabel" name="driverstatuslbl">
318 <property name="text">
319 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;NotLoaded&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
320 </property>
321 <property name="alignment">
322 <set>Qt::AlignCenter</set>
323 </property>
324 </widget>
325 </item>
326 <item>
327 <widget class="QPushButton" name="driverStatusQpb">
328 <property name="text">
329 <string>Details</string>
330 </property>
331 </widget>
332 </item>
333 </layout>
334 </item>
301 335 </layout>
302 336 </widget>
303 337 <resources/>
@@ -23,8 +23,6
23 23
24 24 #include "ui_stardundeeGUI.h"
25 25 #include "fakestardundeespwusb_lib.h"
26 //#include <spw_usb_api.h>
27 //#include <spw_config_library.h>
28 26
29 27 StarDundeeGUI::StarDundeeGUI(QWidget *parent) :
30 28 QWidget(parent),ui(new Ui::StarDundeeUI)
@@ -45,6 +43,11 StarDundeeGUI::StarDundeeGUI(QWidget *pa
45 43 connect(this->ui->setInterfaceModeQrb, SIGNAL(toggled(bool)), this, SIGNAL(brickModeChanged(bool)));
46 44 connect(this->ui->resetStatsQpb, SIGNAL(clicked()), this, SLOT(resetStatistics()));
47 45 connect(this->ui->spwTimecodes, SIGNAL(toggled(bool)), this, SIGNAL(startSendingTimecode(bool)));
46 connect(this->ui->driverStatusQpb,SIGNAL(clicked(bool)),this,SLOT(showDriverStatus()));
47 if(FakeStarDundeeSpwUSB_Lib::fullresolved())
48 this->ui->driverstatuslbl->setText("<html><head/><body><p><span style=\" color:#00ff00;\">Driver loaded</span></p></body></html>");
49 else
50 this->ui->driverstatuslbl->setText("<html><head/><body><p><span style=\" color:#ff0000;\">Driver not loaded(error!)</span></p></body></html>");
48 51 }
49 52
50 53 int StarDundeeGUI::getBrickSelection()
@@ -97,6 +100,12 bool StarDundeeGUI::isBrickSetAsAnInterf
97 100 return ui->setInterfaceModeQrb->isChecked();
98 101 }
99 102
103 void StarDundeeGUI::showDriverStatus()
104 {
105 this->driverStatus.update();
106 this->driverStatus.show();
107 }
108
100 109 void StarDundeeGUI::setBrickAsAnInterface( bool interfaceMode )
101 110 {
102 111 if (interfaceMode == true)
@@ -24,6 +24,8
24 24
25 25 #include <QWidget>
26 26
27 #include "fakestardundeespwusbgui.h"
28
27 29 namespace Ui {
28 30 class StarDundeeUI;
29 31 }
@@ -57,6 +59,7 signals:
57 59 void brickModeChanged(bool);
58 60 void startSendingTimecode(bool);
59 61 public slots:
62 void showDriverStatus();
60 63 void lock(bool lock);
61 64 void updateAvailableBrickCount(int count);
62 65 void selectBrick(int brickIndex);
@@ -85,6 +88,7 private:
85 88 unsigned int nbPacketsReceivedFromSpw;
86 89 unsigned int nbPacketsTransmittedToSpw;
87 90 unsigned int nbCCSDSPacketsTransmittedToSpw;
91 FakeStardundeeSpwUsbGui driverStatus;
88 92 };
89 93
90 94 #endif // STARDUNDEEGUI_H
@@ -1,5 +1,5
1 1 <RCC>
2 2 <qresource prefix="/imgs">
3 <file>StarDundee/stardundee.tif</file>
3 <file alias="stardundee.tif">StarDundee/stardundee.tif</file>
4 4 </qresource>
5 5 </RCC>
@@ -80,6 +80,7 void spwplugin::bridgeSelectionChanged(c
80 80 if(this->bridge!=NULL)
81 81 {
82 82 this->mainLayout->removeWidget(this->bridge->getGUI());
83 this->bridge->getGUI()->hide();
83 84 this->disconnect(this,SLOT(setConnected(bool)));
84 85 delete this->bridge;
85 86 this->bridge= NULL;
@@ -90,6 +91,7 void spwplugin::bridgeSelectionChanged(c
90 91 if(this->bridge!=NULL)
91 92 {
92 93 this->mainLayout->removeWidget(this->bridge->getGUI());
94 this->bridge->getGUI()->hide();
93 95 this->disconnect(this,SLOT(setConnected(bool)));
94 96 delete this->bridge;
95 97 }
@@ -130,6 +132,7 void spwplugin::bridgeSelectionChanged(c
130 132 if(this->bridge!=NULL)
131 133 {
132 134 this->mainLayout->removeWidget(this->bridge->getGUI());
135 this->bridge->getGUI()->hide();
133 136 this->disconnect(this,SLOT(setConnected(bool)));
134 137 delete this->bridge;
135 138 }
@@ -12,7 +12,7 QMAKE_CFLAGS += -std=c++11
12 12
13 13 win32:CONFIG += dll
14 14 win32:CONFIG -= static
15 VERSION=0.6.0
15 VERSION=0.6.1
16 16 TARGET = spwplugin
17 17 DEFINES += PLUGIN=spwplugin
18 18 DEFINES += PLUGINHEADER="\"\\\"spwplugin.h"\\\"\"
@@ -46,7 +46,8 HEADERS += \
46 46 GR-ESB/gr_esb_bridge.h \
47 47 GR-ESB/gr_esb_ui.h \
48 48 SpwTcpPacketServer/incomingpacketparser.h \
49 StarDundee/fakestardundeespwusb_lib.h
49 StarDundee/fakestardundeespwusb_lib.h \
50 StarDundee/fakestardundeespwusbgui.h
50 51
51 52
52 53 SOURCES += \
@@ -58,12 +59,14 SOURCES += \
58 59 GR-ESB/gr_esb_bridge.cpp \
59 60 GR-ESB/gr_esb_ui.cpp \
60 61 SpwTcpPacketServer/incomingpacketparser.cpp \
61 StarDundee/fakestardundeespwusb_lib.cpp
62 StarDundee/fakestardundeespwusb_lib.cpp \
63 StarDundee/fakestardundeespwusbgui.cpp
62 64
63 65 FORMS += \
64 66 StarDundee/stardundeeGUI.ui \
65 67 SpwTcpPacketServer/spwtcppacketserver.ui \
66 GR-ESB/gr_esb_ui.ui
68 GR-ESB/gr_esb_ui.ui \
69 StarDundee/fakestardundeespwusbgui.ui
67 70
68 71 RESOURCES += \
69 72 spwRessources.qrc
General Comments 0
You need to be logged in to leave comments. Login now