##// END OF EJS Templates
changes on the gresb class, several methods and parameters added
leroy -
r6:fb2c374505d0 default
parent child
Show More
@@ -1,6 +1,6
1 1 #############################################################################
2 2 # Makefile for building: PAULs_LPPMON_PLUGINS
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Thu Nov 29 14:02:20 2012
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 10 08:08:24 2012
4 4 # Project: PAULs_LPPMON_PLUGINS.pro
5 5 # Template: subdirs
6 6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro
@@ -1,6 +1,6
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by Qt Creator 2.4.1, 2012-12-07T14:08:53. -->
3 <!-- Written by Qt Creator 2.4.1, 2012-12-10T08:45:27. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -1,6 +1,6
1 1 #############################################################################
2 2 # Makefile for building: librmapplugin.so.1.0.0
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 3 13:45:43 2012
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 10 08:08:25 2012
4 4 # Project: rmapplugin.pro
5 5 # Template: lib
6 6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro
@@ -54,6 +54,7 SOURCES = rmapplugin.cpp \
54 54 rmappluginpythonwrapper.cpp \
55 55 stardundee.cpp \
56 56 gresb.cpp \
57 bridge.cpp \
57 58 /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp moc/moc_rmappluginui.cpp \
58 59 moc/moc_rmapplugin.cpp \
59 60 moc/moc_spwpacketreceiver.cpp \
@@ -63,6 +64,7 SOURCES = rmapplugin.cpp \
63 64 moc/moc_rmappluginpythonwrapper.cpp \
64 65 moc/moc_stardundee.cpp \
65 66 moc/moc_gresb.cpp \
67 moc/moc_bridge.cpp \
66 68 moc/moc_genericPySysdriver.cpp \
67 69 moc/moc_lppmonplugin.cpp
68 70 OBJECTS = obj/rmapplugin.o \
@@ -76,6 +78,7 OBJECTS = obj/rmapplugin.o \
76 78 obj/rmappluginpythonwrapper.o \
77 79 obj/stardundee.o \
78 80 obj/gresb.o \
81 obj/bridge.o \
79 82 obj/lppmonplugininterface.o \
80 83 obj/moc_rmappluginui.o \
81 84 obj/moc_rmapplugin.o \
@@ -86,6 +89,7 OBJECTS = obj/rmapplugin.o \
86 89 obj/moc_rmappluginpythonwrapper.o \
87 90 obj/moc_stardundee.o \
88 91 obj/moc_gresb.o \
92 obj/moc_bridge.o \
89 93 obj/moc_genericPySysdriver.o \
90 94 obj/moc_lppmonplugin.o
91 95 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
@@ -233,7 +237,7 qmake: FORCE
233 237
234 238 dist:
235 239 @$(CHK_DIR_EXISTS) obj/rmapplugin1.0.0 || $(MKDIR) obj/rmapplugin1.0.0
236 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmappluginui.h rmapplugin.h rmapoperations.h ccsds.h spwpacketreceiver.h ../common_PLE/qipdialogbox.h ../common_PLE/gresbstatusenquiry.h spectralmatricesdmasimulator.h rmappluginpythonwrapper.h stardundee.h ../spw_usb_driver_v2.61/inc/spw_usb_api.h ../spw_usb_driver_v2.61/inc/spw_config_library.h gresb.h /usr/include/genericPySysdriver.h /usr/include/lppmonplugin.h obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmapplugin.cpp rmappluginui.cpp rmapoperations.cpp ccsds.cpp spwpacketreceiver.cpp ../common_PLE/qipdialogbox.cpp ../common_PLE/gresbstatusenquiry.cpp spectralmatricesdmasimulator.cpp rmappluginpythonwrapper.cpp stardundee.cpp gresb.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp obj/rmapplugin1.0.0/ && (cd `dirname obj/rmapplugin1.0.0` && $(TAR) rmapplugin1.0.0.tar rmapplugin1.0.0 && $(COMPRESS) rmapplugin1.0.0.tar) && $(MOVE) `dirname obj/rmapplugin1.0.0`/rmapplugin1.0.0.tar.gz . && $(DEL_FILE) -r obj/rmapplugin1.0.0
240 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmappluginui.h rmapplugin.h rmapoperations.h ccsds.h spwpacketreceiver.h ../common_PLE/qipdialogbox.h ../common_PLE/gresbstatusenquiry.h spectralmatricesdmasimulator.h rmappluginpythonwrapper.h stardundee.h ../spw_usb_driver_v2.61/inc/spw_usb_api.h ../spw_usb_driver_v2.61/inc/spw_config_library.h gresb.h bridge.h /usr/include/genericPySysdriver.h /usr/include/lppmonplugin.h obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmapplugin.cpp rmappluginui.cpp rmapoperations.cpp ccsds.cpp spwpacketreceiver.cpp ../common_PLE/qipdialogbox.cpp ../common_PLE/gresbstatusenquiry.cpp spectralmatricesdmasimulator.cpp rmappluginpythonwrapper.cpp stardundee.cpp gresb.cpp bridge.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp obj/rmapplugin1.0.0/ && (cd `dirname obj/rmapplugin1.0.0` && $(TAR) rmapplugin1.0.0.tar rmapplugin1.0.0 && $(COMPRESS) rmapplugin1.0.0.tar) && $(MOVE) `dirname obj/rmapplugin1.0.0`/rmapplugin1.0.0.tar.gz . && $(DEL_FILE) -r obj/rmapplugin1.0.0
237 241
238 242
239 243 clean:compiler_clean
@@ -255,12 +259,13 mocclean: compiler_moc_header_clean comp
255 259
256 260 mocables: compiler_moc_header_make_all compiler_moc_source_make_all
257 261
258 compiler_moc_header_make_all: moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_spwpacketreceiver.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
262 compiler_moc_header_make_all: moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_spwpacketreceiver.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
259 263 compiler_moc_header_clean:
260 -$(DEL_FILE) moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_spwpacketreceiver.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
264 -$(DEL_FILE) moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_spwpacketreceiver.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
261 265 moc/moc_rmappluginui.cpp: rmapoperations.h \
262 266 spectralmatricesdmasimulator.h \
263 267 stardundee.h \
268 gresb.h \
264 269 rmappluginui.h
265 270 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginui.h -o moc/moc_rmappluginui.cpp
266 271
@@ -268,6 +273,7 moc/moc_rmapplugin.cpp: rmappluginui.h \
268 273 rmapoperations.h \
269 274 spectralmatricesdmasimulator.h \
270 275 stardundee.h \
276 gresb.h \
271 277 ccsds.h \
272 278 spwpacketreceiver.h \
273 279 rmapplugin.h
@@ -288,12 +294,16 moc/moc_spectralmatricesdmasimulator.cpp
288 294 moc/moc_rmappluginpythonwrapper.cpp: rmappluginpythonwrapper.h
289 295 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginpythonwrapper.h -o moc/moc_rmappluginpythonwrapper.cpp
290 296
291 moc/moc_stardundee.cpp: stardundee.h
297 moc/moc_stardundee.cpp: rmapoperations.h \
298 stardundee.h
292 299 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) stardundee.h -o moc/moc_stardundee.cpp
293 300
294 301 moc/moc_gresb.cpp: gresb.h
295 302 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) gresb.h -o moc/moc_gresb.cpp
296 303
304 moc/moc_bridge.cpp: bridge.h
305 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) bridge.h -o moc/moc_bridge.cpp
306
297 307 moc/moc_genericPySysdriver.cpp: /usr/include/genericPySysdriver.h
298 308 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/genericPySysdriver.h -o moc/moc_genericPySysdriver.cpp
299 309
@@ -324,6 +334,7 obj/rmapplugin.o: rmapplugin.cpp rmapplu
324 334 rmapoperations.h \
325 335 spectralmatricesdmasimulator.h \
326 336 stardundee.h \
337 gresb.h \
327 338 ccsds.h \
328 339 spwpacketreceiver.h \
329 340 rmappluginpythonwrapper.h
@@ -334,6 +345,7 obj/rmappluginui.o: rmappluginui.cpp rma
334 345 rmapoperations.h \
335 346 spectralmatricesdmasimulator.h \
336 347 stardundee.h \
348 gresb.h \
337 349 ccsds.h \
338 350 spwpacketreceiver.h
339 351 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginui.o rmappluginui.cpp
@@ -344,7 +356,8 obj/rmapoperations.o: rmapoperations.cpp
344 356 obj/ccsds.o: ccsds.cpp ccsds.h
345 357 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/ccsds.o ccsds.cpp
346 358
347 obj/spwpacketreceiver.o: spwpacketreceiver.cpp spwpacketreceiver.h
359 obj/spwpacketreceiver.o: spwpacketreceiver.cpp spwpacketreceiver.h \
360 rmapoperations.h
348 361 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spwpacketreceiver.o spwpacketreceiver.cpp
349 362
350 363 obj/qipdialogbox.o: ../common_PLE/qipdialogbox.cpp ../common_PLE/qipdialogbox.h
@@ -366,6 +379,9 obj/stardundee.o: stardundee.cpp stardun
366 379 obj/gresb.o: gresb.cpp gresb.h
367 380 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresb.o gresb.cpp
368 381
382 obj/bridge.o: bridge.cpp bridge.h
383 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/bridge.o bridge.cpp
384
369 385 obj/lppmonplugininterface.o: /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.h \
370 386 /usr/include/lppmon/pluginsInterface/lppmonplugininterface_global.h
371 387 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/lppmonplugininterface.o /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp
@@ -397,6 +413,9 obj/moc_stardundee.o: moc/moc_stardundee
397 413 obj/moc_gresb.o: moc/moc_gresb.cpp
398 414 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_gresb.o moc/moc_gresb.cpp
399 415
416 obj/moc_bridge.o: moc/moc_bridge.cpp
417 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_bridge.o moc/moc_bridge.cpp
418
400 419 obj/moc_genericPySysdriver.o: moc/moc_genericPySysdriver.cpp
401 420 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_genericPySysdriver.o moc/moc_genericPySysdriver.cpp
402 421
@@ -1,8 +1,16
1 1 #include "gresb.h"
2 #include <QTime>
3 #include <QHostAddress>
2 4
3 5 gresb::gresb(QWidget *parent) :
4 6 QWidget(parent)
5 7 {
8 RMAPSend_SOCKET = new QTcpSocket;
9 RMAPReceive_SOCKET = new QTcpSocket;
10 GRESBStatusQuery_SOCKET = new QTcpSocket;
11 spwPacketReceiverOBJECT = new spwpacketreceiver;
12 spwPacketReceiverOBJECT->gresbReceptionSocket = RMAPReceive_SOCKET;
13
6 14 //*** QLABEL ***//
7 15 gresbBridgeIPLabel = new QLabel(tr("GRESB Bridge IP: "));
8 16 gresbVirtualLinkLabel = new QLabel(tr("GRESB Virtual Link: "));
@@ -11,6 +19,7 gresb::gresb(QWidget *parent) :
11 19 rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection"));
12 20 rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection"));
13 21 gresbStatusQueryLabel = new QLabel(tr("GRESB status query socket (port 3010): waiting for connection"));
22 gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running"));
14 23
15 24 //*** SPINBOX ***//
16 25 gresbVirtualLinkSpinBox = new QSpinBox;
@@ -23,11 +32,17 gresb::gresb(QWidget *parent) :
23 32 spwLinkSpinBox->setRange(0, 2);
24 33 spwLinkSpinBox->setValue(0);
25 34
35 //*** QPUSHBUTTON ***//
36 gresbStatusQueryRetryButton = new QPushButton(tr("Retry"));
37 gresbStatusQueryAbortButton = new QPushButton(tr("Abort"));
38
26 39 //*** LAYOUT ***//
27 40 connectionLayout = new QGridLayout;
28 41
29 42 //*** MISC ***//
43 gresbStatusQueryDialog = new QDialog;
30 44 gresbBridgeIPDialogBox = new QIPDialogBox;
45 spwLinkStatusEnquiry = new gresbStatusEnquiry;
31 46
32 47 connectionLayout->addWidget(gresbBridgeIPLabel, 0, 0, 0);
33 48 connectionLayout->addWidget(gresbBridgeIPDialogBox, 0, 1, 0);
@@ -44,5 +59,157 gresb::gresb(QWidget *parent) :
44 59 connectionLayout->setRowStretch(7, 1);
45 60 connectionLayout->setColumnStretch(2, 1);
46 61
62 // GRESB STATUS QUERY DIALOG
63 gresbStatusQueryDialogLayout = new QGridLayout;
64 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryDialogLabel, 0, 0, 1, 2);
65 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryRetryButton, 1, 0, 0);
66 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryAbortButton, 1, 1, 0);
67 gresbStatusQueryDialog->setLayout(gresbStatusQueryDialogLayout);
68
47 69 this->setLayout(connectionLayout);
70
71 connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject()));
48 72 }
73
74 void gresb::Open() // SLOT
75 {
76 bool spwRunning = true;
77 RMAPSend_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()),
78 3000 + gresbVirtualLinkSpinBox->value()*2,
79 QIODevice::WriteOnly);
80 RMAPReceive_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()),
81 3000 + gresbVirtualLinkSpinBox->value()*2+1,
82 QIODevice::ReadOnly);
83 GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(gresbBridgeIPDialogBox->getGRESBIP()),
84 3010,
85 QIODevice::ReadWrite);
86 GRESBStatusQuery_SOCKET->waitForConnected(10000);
87 RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket
88 // initialize SPW packet semaphores
89 while (spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->acquire();
90 while (spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->acquire();
91 if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) != 0)
92 {
93 spwRunning = gresbStatusQueryDialog->exec();
94 }
95 if (spwRunning == false) this->Close();
96 else
97 {
98 emit appendToLog(QString("SpaceWire running on virtual link ")+ QString::number(spwLinkSpinBox->value()));
99 emit isOpen(true);
100 }
101 }
102
103 void gresb::Close() // SLOT
104 {
105 RMAPSend_SOCKET->disconnectFromHost();
106 RMAPReceive_SOCKET->disconnectFromHost();
107 GRESBStatusQuery_SOCKET->disconnectFromHost();
108 emit isOpen(false);
109 }
110
111 int gresb::GRESBStatusQuery() // SLOT
112 {
113 GRESBStatusQueryRequest(LinkStatus, 0);
114 GRESBStatusQueryRequest(LinkStatus, 1);
115 GRESBStatusQueryRequest(LinkStatus, 2);
116 GRESBStatusQueryRequest(LinkStatistics, 0);
117 GRESBStatusQueryRequest(LinkStatistics, 1);
118 GRESBStatusQueryRequest(LinkStatistics, 2);
119 return 0;
120 }
121
122 int gresb::GRESBStatusQueryRequest(GresbStatusQueryOption option, char link)
123 {
124 gresb_status_query_t statusQueryCommand;
125 gresb_link_status_reply_t linkStatusReply;
126 gresb_link_statistics_reply_t linkStatisticsReply;
127 QTime statusQueryTimeout;
128 QString console_message;
129
130 statusQueryCommand.protocolIdentifier = (char) 0x02;
131 statusQueryCommand.reserved1 = (char) 0x00;
132 statusQueryCommand.reserved0 = (char) 0x00;
133 statusQueryCommand.option = (char) option;
134 statusQueryCommand.value3 = (char) 0x00;
135 statusQueryCommand.value2 = (char) 0x00;
136 statusQueryCommand.value1 = (char) 0x00;
137 statusQueryCommand.value0 = (char) link;
138
139 GRESBStatusQuery_SOCKET->write((char*) ((void*) &statusQueryCommand), sizeof(statusQueryCommand));
140 GRESBStatusQuery_SOCKET->flush();
141 GRESBStatusQuery_SOCKET->waitForBytesWritten(1000);
142
143 statusQueryTimeout.start();
144 while(GRESBStatusQuery_SOCKET->bytesToWrite() > 0)
145 {
146 GRESBStatusQuery_SOCKET->waitForBytesWritten(100);
147 if(statusQueryTimeout.elapsed()>1000)
148 {
149 emit appendToLog("WARNING === in function GRESBStatusQueryRequest of rmapplugin *** sending StatusQueryCommand timeout");
150 return 1;
151 }
152 }
153
154 switch (option)
155 {
156 case LinkStatus:
157 {
158 statusQueryTimeout.start();
159 while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatusReply))
160 {
161 GRESBStatusQuery_SOCKET->waitForReadyRead(100);
162 if(statusQueryTimeout.elapsed()>1000)
163 {
164 console_message.sprintf("GRESBStatusQueryRequest / LinkStatus => error timeout bytesAvailable()\n");
165 emit appendToLog(console_message);
166 return 1;
167 }
168 }
169 GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatusReply), (int) sizeof(linkStatusReply));
170 console_message.sprintf("%x", linkStatusReply.byte0);
171 spwLinkStatusEnquiry->statusQueryTable->item(0, link)->setText(console_message);
172 console_message.sprintf("%d", linkStatusReply.byte1);
173 spwLinkStatusEnquiry->statusQueryTable->item(1, link)->setText(console_message);
174 if (linkStatusReply.byte0 == 0) return 1;
175 break;
176 }
177 case LinkStatistics:
178 {
179 statusQueryTimeout.start();
180 while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatisticsReply))
181 {
182 GRESBStatusQuery_SOCKET->waitForReadyRead(100);
183 if(statusQueryTimeout.elapsed()>1000)
184 {
185 console_message.sprintf("GRESBStatusQueryRequest / LinkStatistics => error timeout bytesAvailable()\n");
186 emit appendToLog(console_message);
187 return 1;
188 }
189 }
190 GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatisticsReply), sizeof(linkStatisticsReply));
191 /*console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataTransmitted));
192 UI->spwLinkStatusEnquiry->statusQueryTable->item(9, link)->setText(console_message);
193 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsTransmitted));
194 UI->spwLinkStatusEnquiry->statusQueryTable->item(8, link)->setText(console_message);
195 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfTruncatedPacketsReceived));
196 UI->spwLinkStatusEnquiry->statusQueryTable->item(6, link)->setText(console_message);
197 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsWithEEPReceived));
198 UI->spwLinkStatusEnquiry->statusQueryTable->item(5, link)->setText(console_message);
199 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataReceived));
200 UI->spwLinkStatusEnquiry->statusQueryTable->item(4, link)->setText(console_message);
201 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsReceived));
202 UI->spwLinkStatusEnquiry->statusQueryTable->item(3, link)->setText(console_message);*/
203 break;
204 }
205 case NodeAddressStatistics:
206 {
207 break;
208 }
209 case GetRoute:
210 {
211 break;
212 }
213 }
214 return 0;
215 }
@@ -6,6 +6,12
6 6 #include <QPushButton>
7 7 #include <QSpinBox>
8 8 #include <QGridLayout>
9 #include <QTcpSocket>
10 #include <QDialog>
11
12 #include "gresbstatusenquiry.h"
13 #include "spwpacketreceiver.h"
14 #include "rmapoperations.h"
9 15 #include "qipdialogbox.h"
10 16
11 17 class gresb : public QWidget
@@ -13,12 +19,41 class gresb : public QWidget
13 19 Q_OBJECT
14 20 public:
15 21 explicit gresb(QWidget *parent = 0);
22 ~gresb();
23 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
24 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
25 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
26 unsigned int getLinkStatus(unsigned char link);
16 27
17 28 signals:
18
29 void sendMessage(QString message);
30 void isOpen(bool);
31 void RMAP_write_reply_setText(QString);
32 void appendToLog(QString);
33 void ccsdsPacketAvailable(unsigned char*, unsigned int);
34
19 35 public slots:
36 void Open();
37 void Close();
38 int receiveSPWPacket(unsigned char requestID);
39 void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
40 void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
41 void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;}
42
43 private slots:
44 int GRESBStatusQuery();
20 45
21 46 private:
47 int GRESBStatusQueryRequest(GresbStatusQueryOption option, char link);
48
49 unsigned char rmapTargetLogicalAddress ;
50 unsigned char rmapSourceLogicalAddress ;
51
52 RMAP_command_codes commandCode;
53
54 QPushButton *gresbStatusQueryRetryButton;
55 QPushButton *gresbStatusQueryAbortButton;
56
22 57 QLabel *gresbBridgeIPLabel;
23 58 QLabel *gresbVirtualLinkLabel;
24 59 QLabel *spwLinkLabel;
@@ -26,6 +61,9 private:
26 61 QLabel *rmapSendStateLabel;
27 62 QLabel *rmapReceiveStateLabel;
28 63 QLabel *gresbStatusQueryLabel;
64 QLabel *gresbStatusQueryDialogLabel;
65
66 QDialog *gresbStatusQueryDialog;
29 67
30 68 QIPDialogBox* gresbBridgeIPDialogBox;
31 69
@@ -34,7 +72,15 private:
34 72 QSpinBox *rmapSourceLogicalAddressSpinBox;
35 73
36 74 QGridLayout *connectionLayout;
37
75 QGridLayout *gresbStatusQueryDialogLayout;
76
77 QTcpSocket *RMAPSend_SOCKET;
78 QTcpSocket *RMAPReceive_SOCKET;
79 QTcpSocket *GRESBStatusQuery_SOCKET;
80
81 spwpacketreceiver *spwPacketReceiverOBJECT;
82
83 gresbStatusEnquiry* spwLinkStatusEnquiry;
38 84 };
39 85
40 86 #endif // GRESB_H
@@ -54,7 +54,7 StarDundee::~StarDundee()
54 54 USBSpaceWire_Close(hDevice); // Close the device
55 55 }
56 56
57 unsigned int StarDundee::Open()
57 void StarDundee::Open()
58 58 {
59 59 int status;
60 60 U32 statusControl;
@@ -64,7 +64,7 unsigned int StarDundee::Open()
64 64 if (!USBSpaceWire_Open(&hDevice, usbDeviceNumber_SPINBOX->value())) // Open the USB device
65 65 {
66 66 emit sendMessage("stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))");
67 return -1;
67 return;
68 68 }
69 69 emit sendMessage("stardundee *** Open *** USBSpaceWire_Open successful, device number: "
70 70 + QString::number(usbDeviceNumber_SPINBOX->value()));
@@ -159,11 +159,9 unsigned int StarDundee::Open()
159 159 while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire();
160 160
161 161 emit isOpen(true);
162
163 return 1;
164 162 }
165 163
166 unsigned int StarDundee::Close()
164 void StarDundee::Close()
167 165 {
168 166 USBSpaceWire_Close(hDevice); // Close the device
169 167 emit sendMessage("stardundee *** Close *** USBSpaceWire_Close, device: " + QString::number(usbDeviceNumber_SPINBOX->value()));
@@ -171,8 +169,6 unsigned int StarDundee::Close()
171 169 USBSpaceWire_UnregisterReceiveOnAllPorts(hDevice); // Stop receiving on all ports
172 170
173 171 emit isOpen(false);
174
175 return 1;
176 172 }
177 173
178 174 unsigned int StarDundee::GetRoutingTableEntry()
@@ -22,9 +22,7 public:
22 22 ~StarDundee();
23 23 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
24 24 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
25 unsigned int WriteStarDundee(unsigned int *Value, unsigned int count, unsigned int address);
26 25 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
27 unsigned int getLinkStatus(unsigned char link);
28 26
29 27 signals:
30 28 void sendMessage(QString message);
@@ -34,14 +32,15 signals:
34 32 void ccsdsPacketAvailable(unsigned char*, unsigned int);
35 33
36 34 public slots:
37 unsigned int Open();
38 unsigned int Close();
35 void Open();
36 void Close();
39 37 int receiveSPWPacket(unsigned char requestID);
40 38 void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
41 39 void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
42 40 void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;}
43 41
44 42 private:
43 unsigned int getLinkStatus(unsigned char link);
45 44 unsigned int GetRoutingTableEntry();
46 45 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
47 46 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
General Comments 0
You need to be logged in to leave comments. Login now