summaryrefslogtreecommitdiffstats
path: root/clients/tde
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-07-05 21:11:54 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-07-05 21:11:54 -0500
commitae2bec04efa3205c74c39ddc245d5310dbd9b9f9 (patch)
treec7ed5d2bb1ddeeb4c543193076c24277d1c6ad00 /clients/tde
parentb74c9f41d066373a73c650dbb7b93217d39c1667 (diff)
downloadulab-ae2bec04efa3205c74c39ddc245d5310dbd9b9f9.tar.gz
ulab-ae2bec04efa3205c74c39ddc245d5310dbd9b9f9.zip
Add preliminary FPGA programming client
Diffstat (limited to 'clients/tde')
-rw-r--r--clients/tde/configure.in1
-rw-r--r--clients/tde/src/part/Makefile.am2
-rw-r--r--clients/tde/src/part/fpgaprogram/Makefile.am9
-rw-r--r--clients/tde/src/part/fpgaprogram/layout.ui84
-rw-r--r--clients/tde/src/part/fpgaprogram/part.cpp471
-rw-r--r--clients/tde/src/part/fpgaprogram/part.h96
6 files changed, 662 insertions, 1 deletions
diff --git a/clients/tde/configure.in b/clients/tde/configure.in
index 59b7401..3753714 100644
--- a/clients/tde/configure.in
+++ b/clients/tde/configure.in
@@ -87,6 +87,7 @@ AC_CONFIG_FILES([ src/app/views/Makefile ])
AC_CONFIG_FILES([ src/dialogs/Makefile ])
AC_CONFIG_FILES([ src/part/Makefile ])
AC_CONFIG_FILES([ src/part/commanalyzer/Makefile ])
+AC_CONFIG_FILES([ src/part/fpgaprogram/Makefile ])
AC_CONFIG_FILES([ src/part/fpgaview/Makefile ])
AC_CONFIG_FILES([ src/widgets/Makefile ])
AC_OUTPUT
diff --git a/clients/tde/src/part/Makefile.am b/clients/tde/src/part/Makefile.am
index 900ddb1..b2962ff 100644
--- a/clients/tde/src/part/Makefile.am
+++ b/clients/tde/src/part/Makefile.am
@@ -1 +1 @@
-SUBDIRS = commanalyzer fpgaview
+SUBDIRS = commanalyzer fpgaview fpgaprogram
diff --git a/clients/tde/src/part/fpgaprogram/Makefile.am b/clients/tde/src/part/fpgaprogram/Makefile.am
new file mode 100644
index 0000000..63fdf0f
--- /dev/null
+++ b/clients/tde/src/part/fpgaprogram/Makefile.am
@@ -0,0 +1,9 @@
+INCLUDES = $(all_includes) -I$(top_srcdir)/src -I$(top_srcdir)/src/widgets $(KDE_INCLUDES)/tde
+KDE_CXXFLAGS = $(USE_EXCEPTIONS)
+METASOURCES = AUTO
+
+# Part
+kde_module_LTLIBRARIES = libremotelab_fpgaviewer.la
+libremotelab_fpgaviewer_la_LIBADD = ../../widgets/libtracewidget.la ../../widgets/libfloatspinbox.la $(LIB_KFILE) $(LIB_KPARTS) $(LIB_TDEUI) $(LIB_QT) -ltdekrbsocket -ltqtrla
+libremotelab_fpgaviewer_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) $(LIB_TDECORE) $(LIB_TDEUI) -lkio -ltdefx
+libremotelab_fpgaviewer_la_SOURCES = part.cpp layout.ui
diff --git a/clients/tde/src/part/fpgaprogram/layout.ui b/clients/tde/src/part/fpgaprogram/layout.ui
new file mode 100644
index 0000000..985acfe
--- /dev/null
+++ b/clients/tde/src/part/fpgaprogram/layout.ui
@@ -0,0 +1,84 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+ <class>FPGAProgramBase</class>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>FPGAProgramBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>519</width>
+ <height>356</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed_grid</cstring>
+ </property>
+ <widget class="TQGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupFPGAProgram</cstring>
+ </property>
+ <property name="title">
+ <string>FPGA Viewer</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed_grid</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>unnamed_label</cstring>
+ </property>
+ <property name="text">
+ <cstring>Programming File:</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="1" column="0">
+ <property name="name">
+ <cstring>programmingInputFile</cstring>
+ </property>
+ <property name="mode">
+ <number>25</number>
+ </property>
+ <property name="filter">
+ <cstring>*.bit|Bitstream Files (*.bit)</cstring>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="1" column="2">
+ <property name="name">
+ <cstring>programRunButton</cstring>
+ </property>
+ <property name="text">
+ <cstring>Download Program</cstring>
+ </property>
+ </widget>
+ <widget class="TQProgressBar" row="2" column="0" colspan="3">
+ <property name="name">
+ <cstring>programmingProgressBar</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="3" column="1" colspan="2">
+ <property name="name">
+ <cstring>programmingStatusLabel</cstring>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <includes>
+ <include location="local" impldecl="in implementation">FPGAProgramBase.ui.h</include>
+ </includes>
+ <includes>
+ <include location="local" impldecl="in implementation">tracewidget.h</include>
+ <include location="local" impldecl="in implementation">floatspinbox.h</include>
+ <include location="local" impldecl="in implementation">part.h</include>
+ </includes>
+ <layoutdefaults spacing="3" margin="6"/>
+ <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/clients/tde/src/part/fpgaprogram/part.cpp b/clients/tde/src/part/fpgaprogram/part.cpp
new file mode 100644
index 0000000..bf7e46a
--- /dev/null
+++ b/clients/tde/src/part/fpgaprogram/part.cpp
@@ -0,0 +1,471 @@
+/*
+ * Remote Laboratory FPGA Programming Part
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * (c) 2012 Timothy Pearson
+ * Raptor Engineering
+ * http://www.raptorengineeringinc.com
+ */
+
+#include "define.h"
+#include "part.h"
+
+#include <kaboutdata.h> //::createAboutData()
+#include <kaction.h>
+#include <klocale.h>
+#include <kmessagebox.h> //::start()
+#include <kparts/genericfactory.h>
+#include <kstatusbar.h>
+#include <kstdaction.h>
+#include <knuminput.h>
+#include <kmdcodec.h>
+#include <kurlrequester.h>
+#include <tqfile.h> //encodeName()
+#include <tqtimer.h> //postInit() hack
+#include <tqvbox.h>
+#include <tqsocket.h>
+#include <tqmutex.h>
+#include <tqeventloop.h>
+#include <tqapplication.h>
+#include <tqgroupbox.h>
+#include <tqcheckbox.h>
+#include <tqpushbutton.h>
+#include <tqprogressbar.h>
+#include <unistd.h> //access()
+#include <stdint.h>
+
+#include <tqpainter.h>
+
+#include "tracewidget.h"
+#include "floatspinbox.h"
+#include "layout.h"
+
+// RAJA UNCOMMENT ME
+//#define SERVER_TIMEOUT_MS 10000
+// RAJA DEBUG ONLY
+#define SERVER_TIMEOUT_MS 100000
+#define FPGA_COMM_TIMEOUT_MS 500
+#define FPGA_DATA_PROCESSING_TIMEOUT_MS 2500
+
+namespace RemoteLab {
+
+typedef KParts::GenericFactory<RemoteLab::FPGAProgramPart> Factory;
+#define CLIENT_LIBRARY "libremotelab_fpgaprogrammer"
+K_EXPORT_COMPONENT_FACTORY(libremotelab_fpgaprogrammer, RemoteLab::Factory)
+
+FPGAProgramPart::FPGAProgramPart(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name, const TQStringList&)
+ : RemoteInstrumentPart( parent, name ), m_socket(0), m_base(0), connToServerConnecting(false), connToServerState(-1), connToServerTimeoutTimer(NULL),
+ m_commHandlerState(0), m_connectionActiveAndValid(false), m_tickerState(0)
+{
+ // Initialize mutex
+ m_connectionMutex = new TQMutex(false);
+
+ // Initialize kpart
+ setInstance(Factory::instance());
+ setWidget(new TQVBox(parentWidget, widgetName));
+
+ // Create timers
+ m_updateTimer = new TQTimer(this);
+
+ // Create widgets
+ m_base = new FPGAProgramBase(widget());
+
+ // Initialize widgets
+ connect(m_base->programRunButton, SIGNAL(clicked()), this, SLOT(programRunButtonClicked()));
+
+ TQTimer::singleShot(0, this, TQT_SLOT(postInit()));
+}
+
+FPGAProgramPart::~FPGAProgramPart() {
+ if (m_connectionMutex->locked()) {
+ printf("[WARNING] Exiting when data transfer still in progress!\n\r"); fflush(stdout);
+ }
+
+ disconnectFromServer();
+ delete m_connectionMutex;
+}
+
+void FPGAProgramPart::processLockouts() {
+ TQWidget* mainWidget = widget();
+ if (mainWidget) {
+ if ((m_socket) && (m_socket->state() == TQSocket::Connected) && (connToServerState > 0) && (connToServerConnecting == false)) {
+ mainWidget->setEnabled(true);
+ }
+ else {
+ mainWidget->setEnabled(false);
+ }
+ }
+
+ if ((m_base->programmingInputFile->url() != "") && (m_commHandlerMode == 0) && (m_connectionActiveAndValid == true)) {
+ m_base->programRunButton->setEnabled(true);
+ }
+ else {
+ m_base->programRunButton->setEnabled(false);
+ }
+
+ if (m_commHandlerMode == 1) {
+ m_base->programmingInputFile->setEnabled(false);
+ }
+ else {
+ m_base->programmingInputFile->setEnabled(true);
+ }
+
+ if ((m_connectionActiveAndValid == true) && (m_commHandlerMode == 0)) {
+ m_base->programmingStatusLabel->setText(i18n("Ready"));
+ }
+}
+
+void FPGAProgramPart::resizeToHint() {
+ resize(widget()->sizeHint());
+}
+
+void FPGAProgramPart::connectionClosed() {
+ closeURL();
+}
+
+void FPGAProgramPart::postInit() {
+ connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(updateDisplay()));
+}
+
+bool FPGAProgramPart::openURL(const KURL &url) {
+ int ret;
+ ret = connectToServer(url.url());
+ processLockouts();
+ return (ret != 0);
+}
+
+bool FPGAProgramPart::closeURL() {
+ disconnectFromServer();
+ m_url = KURL();
+ return true;
+}
+
+void FPGAProgramPart::disconnectFromServer() {
+ if (m_socket) {
+ m_socket->clearPendingData();
+ m_socket->close();
+ delete m_socket;
+ m_socket = NULL;
+ }
+ processLockouts();
+}
+
+void FPGAProgramPart::finishConnectingToServer() {
+ if (!m_socket) {
+ connToServerState = -1;
+ connToServerConnecting = false;
+ processLockouts();
+ return;
+ }
+
+ if (connToServerConnecting) {
+ switch(connToServerState) {
+ case 0:
+ if (!connToServerTimeoutTimer) {
+ connToServerTimeoutTimer = new TQTimer;
+ connToServerTimeoutTimer->start(SERVER_TIMEOUT_MS, TRUE);
+ }
+ if ((m_socket->state() == TQSocket::Connecting) || (m_socket->state() == TQSocket::HostLookup)) {
+ if (!connToServerTimeoutTimer->isActive()) {
+ connToServerState = -3;
+ connToServerConnecting = false;
+ disconnectFromServer();
+ KMessageBox::error(0, i18n("<qt>Unable to establish connection to remote server</qt>"), i18n("Connection Failed"));
+ }
+ }
+ else {
+ if (m_socket->state() == TQSocket::Connected) {
+ printf("[DEBUG] Initial connection established...\n\r"); fflush(stdout);
+ m_socket->setDataTimeout(SERVER_TIMEOUT_MS);
+ m_socket->setUsingKerberos(true);
+ connToServerState = 1;
+ }
+ else {
+ connToServerState = -1;
+ connToServerConnecting = false;
+ disconnectFromServer();
+ KMessageBox::error(0, i18n("<qt>Unable to establish connection to remote server</qt>"), i18n("Connection Failed"));
+ }
+ }
+ break;
+ case 1:
+ if (m_socket->kerberosStatus() == TDEKerberosClientSocket::KerberosInitializing) {
+ // Do nothing
+ }
+ else {
+ if (m_socket->kerberosStatus() != TDEKerberosClientSocket::KerberosInUse) {
+ connToServerState = -1;
+ connToServerConnecting = false;
+ disconnectFromServer();
+ KMessageBox::error(0, i18n("<qt>Unable to establish Kerberos protocol with remote server<p>Please verify that you currently hold a valid Kerberos ticket</qt>"), i18n("Connection Failed"));
+ }
+ else {
+ connToServerState = 2;
+ }
+ }
+ break;
+ case 2:
+ // Connection established!
+ // Read magic number and proto version from server
+ TQDataStream ds(m_socket);
+ TQ_UINT32 magicnum;
+ TQ_UINT32 protover;
+ ds >> magicnum;
+ ds >> protover;
+ printf("[DEBUG] Got magic number %d and protocol version %d\n\r", magicnum, protover); fflush(stdout);
+
+ // Request connection to backend server
+ TQString response;
+ ds << TQString("SERV");
+ ds << TQString(CLIENT_LIBRARY);
+ ds >> response;
+printf("[RAJA DEBUG 400.0] Got '%s' from the server\n\r", response.ascii()); fflush(stdout);
+ if (response == "OK") {
+ connToServerState = 3;
+ connToServerConnecting = false;
+ connect(m_socket, SIGNAL(readyRead()), m_socket, SLOT(processPendingData()));
+ connect(m_socket, SIGNAL(newDataReceived()), this, SLOT(updateDisplay()));
+ m_tickerState = 0;
+ m_commHandlerState = 0;
+ m_commHandlerMode = 0;
+ m_updateTimer->start(FPGA_COMM_TIMEOUT_MS, FALSE);
+ processLockouts();
+ updateDisplay();
+ return;
+ }
+ else if (response == "ERRNOCONN") {
+ connToServerState = -1;
+ connToServerConnecting = false;
+ disconnectFromServer();
+ KMessageBox::error(0, i18n("<qt>Unable to establish connection with backend server<p>Please verify that you are currently connected to a workspace</qt>"), i18n("Connection Failed"));
+ close();
+ return;
+ }
+ else if (response == "ERRNOTAVL") {
+ connToServerState = -1;
+ connToServerConnecting = false;
+ disconnectFromServer();
+ KMessageBox::error(0, i18n("<qt>The backend server is not available at this time<p>Please try a different workspace, or try again later</qt>"), i18n("Connection Failed"));
+ close();
+ return;
+ }
+ else if (response == "ERRNOSERV") {
+ connToServerState = -1;
+ connToServerConnecting = false;
+ disconnectFromServer();
+ KMessageBox::error(0, i18n("<qt>The active laboratory workspace does not support the requested service</qt>"), i18n("Service Unavailable"));
+ close();
+ return;
+ }
+ else {
+ connToServerState = -1;
+ connToServerConnecting = false;
+ disconnectFromServer();
+ KMessageBox::error(0, i18n("<qt>Unable to establish connection with remote server</qt>"), i18n("Connection Failed"));
+ close();
+ return;
+ }
+ break;
+ }
+
+ TQTimer::singleShot(0, this, SLOT(finishConnectingToServer()));
+ }
+}
+
+int FPGAProgramPart::connectToServer(TQString server) {
+ if (m_socket) {
+ return -1;
+ }
+ if (!m_socket) {
+ m_socket = new TDEKerberosClientSocket(this);
+ connect(m_socket, TQT_SIGNAL(statusMessageUpdated(const TQString&)), this, TQT_SLOT(setStatusMessage(const TQString&) ));
+ }
+ m_socket->setServiceName("remotefpga");
+ m_socket->setServerFQDN(server);
+ m_socket->connectToHost(server, 4004);
+
+ // Finish connecting when appropriate
+ connToServerState = 0;
+ connToServerConnecting = true;
+ TQTimer::singleShot(0, this, SLOT(finishConnectingToServer()));
+
+ return 0;
+}
+
+void FPGAProgramPart::programRunButtonClicked() {
+ m_commHandlerState = 0;
+ m_commHandlerMode = 1;
+ processLockouts();
+}
+
+#define UPDATEDISPLAY_TIMEOUT m_connectionActiveAndValid = false; \
+ m_tickerState = 0; \
+ m_commHandlerState = 0; \
+ m_commHandlerMode = 0; \
+ while (m_socket->bytesAvailable() > 0) { \
+ m_socket->readBlock(data, 64); \
+ } \
+ setStatusMessage(i18n("Debug interface timeout, still waiting for data. Please verify that the FPGA is properly configured.")); \
+ m_updateTimer->start(FPGA_COMM_TIMEOUT_MS, FALSE); \
+ return;
+
+void FPGAProgramPart::updateDisplay() {
+ m_updateTimer->stop();
+ TQDataStream ds(m_socket);
+
+ if (m_socket) {
+ char data[64];
+
+ if (m_commHandlerMode == 0) {
+ // Normal operation
+ switch (m_commHandlerState) {
+ case 0:
+ // Get status of remote system
+ // RAJA FIXME
+
+ ds << TQString("STATUS");
+ m_updateTimer->start(FPGA_COMM_TIMEOUT_MS, FALSE);
+
+ m_commHandlerState = 1;
+ break;
+ case 1:
+ // Get all data
+ if (m_socket->bytesAvailable() > 0) {
+ // RAJA FIXME
+ TQStringList statusDetails;
+ ds >> statusDetails;
+
+ m_connectionActiveAndValid = true;
+ TQString tickerChar;
+ switch (m_tickerState) {
+ case 0:
+ tickerChar = "-";
+ break;
+ case 1:
+ tickerChar = "\\";
+ break;
+ case 2:
+ tickerChar = "|";
+ break;
+ case 3:
+ tickerChar = "/";
+ break;
+ }
+ setStatusMessage(i18n("Running") + TQString("... %1").arg(tickerChar));
+ m_tickerState++;
+ if (m_tickerState > 3) {
+ m_tickerState = 0;
+ }
+ m_updateTimer->start(FPGA_COMM_TIMEOUT_MS, FALSE);
+
+ m_commHandlerState = 0;
+ }
+ else {
+ if (!m_updateTimer->isActive()) {
+ UPDATEDISPLAY_TIMEOUT
+ }
+ }
+
+ break;
+ }
+ }
+ else if (m_commHandlerMode == 1) {
+ // Program mode!
+ // RAJA FIXME
+ if (m_commHandlerState == 0) {
+ m_base->programmingStatusLabel->setText(i18n("Reading input file") + "...");
+ TQFile file(m_base->programmingInputFile->url());
+ if (file.open(IO_ReadOnly)) {
+ m_programmingFileData = file.readAll();
+ file.close();
+
+ m_base->programmingProgressBar->setTotalSteps(0);
+ m_base->programmingProgressBar->setProgress(0);
+ m_base->programmingStatusLabel->setText(i18n("Sending data to server") + "...");
+
+ ds << TQString("FILE");
+ // RAJA FIXME
+ // Transmit file to remote server...
+ ds << m_programmingFileData;
+
+ m_base->programmingStatusLabel->setText(i18n("Programming device") + "...");
+ ds << TQString("PROGRAM");
+
+ m_commHandlerState = 1;
+ }
+ else {
+ KMessageBox::error(0, i18n("<qt>Unable to open selected programming file</qt>"), i18n("Program Failed"));
+ m_commHandlerMode = 0;
+ m_commHandlerState = 0;
+ m_base->programmingProgressBar->setTotalSteps(1);
+ m_base->programmingProgressBar->setProgress(0);
+ processLockouts();
+ }
+ }
+ else if (m_commHandlerState == 1) {
+ // Get response
+ if (m_socket->bytesAvailable() > 0) {
+ // RAJA FIXME
+ TQString result;
+ ds >> result;
+
+ if (result == "PROGRAMMING") {
+ // RAJA FIXME
+ }
+ else if (result == "DONE") {
+ int retCode;
+ TQString log;
+
+ ds >> retCode;
+ ds >> log;
+
+ // RAJA FIXME
+ // Handle errors
+
+ // Done!
+ m_commHandlerMode = 0;
+ m_commHandlerState = 0;
+ m_base->programmingProgressBar->setTotalSteps(1);
+ m_base->programmingProgressBar->setProgress(0);
+ processLockouts();
+ }
+ }
+ else {
+ if (!m_updateTimer->isActive()) {
+ m_base->programmingProgressBar->setTotalSteps(1);
+ m_base->programmingProgressBar->setProgress(0);
+ m_commHandlerMode = 0;
+ m_commHandlerState = 0;
+ processLockouts();
+ UPDATEDISPLAY_TIMEOUT
+ }
+ }
+ }
+ }
+ }
+ else {
+ m_commHandlerState = 0;
+ m_commHandlerMode = 0;
+ }
+}
+
+KAboutData* FPGAProgramPart::createAboutData() {
+ return new KAboutData( APP_NAME, I18N_NOOP( APP_PRETTYNAME ), APP_VERSION );
+}
+
+} //namespace RemoteLab
+
+#include "part.moc"
diff --git a/clients/tde/src/part/fpgaprogram/part.h b/clients/tde/src/part/fpgaprogram/part.h
new file mode 100644
index 0000000..a663b11
--- /dev/null
+++ b/clients/tde/src/part/fpgaprogram/part.h
@@ -0,0 +1,96 @@
+/*
+ * Remote Laboratory FPGA Programming Part
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * (c) 2012 Timothy Pearson
+ * Raptor Engineering
+ * http://www.raptorengineeringinc.com
+ */
+
+#ifndef REMOTELAB_FPGAPROGRAMPART_H
+#define REMOTELAB_FPGAPROGRAMPART_H
+
+#include <tdekrbclientsocket.h>
+
+#include <tqcstring.h>
+#include <tqframe.h>
+#include <tqimage.h>
+
+#include <kparts/browserextension.h>
+#include <kparts/statusbarextension.h>
+#include <kparts/part.h>
+#include <kurl.h>
+#include <kled.h>
+
+#include <tqtrla.h>
+
+class KAboutData;
+using KParts::StatusBarExtension;
+class TraceWidget;
+class TQSocket;
+class TQTimer;
+class TQMutex;
+class TQFile;
+class FPGAProgramBase;
+
+namespace RemoteLab
+{
+ class FPGAProgramPart : public KParts::RemoteInstrumentPart
+ {
+ Q_OBJECT
+
+ public:
+ FPGAProgramPart(TQWidget *, const char *, TQObject *, const char *, const TQStringList&);
+ ~FPGAProgramPart();
+
+ virtual bool openFile() { return false; } // pure virtual in the base class
+ virtual bool closeURL();
+ static KAboutData *createAboutData();
+ int connectToServer(TQString server);
+
+ public slots:
+ virtual bool openURL(const KURL &url);
+
+ private slots:
+ void postInit();
+ void resizeToHint();
+ void updateDisplay();
+ void processLockouts();
+ void connectionClosed();
+ void disconnectFromServer();
+ void finishConnectingToServer();
+
+ void programRunButtonClicked();
+
+ private:
+ TDEKerberosClientSocket* m_socket;
+ FPGAProgramBase* m_base;
+ TQMutex* m_connectionMutex;
+ TQTimer* m_updateTimer;
+
+ bool connToServerConnecting;
+ int connToServerState;
+ TQTimer *connToServerTimeoutTimer;
+
+ int m_commHandlerState;
+ int m_commHandlerMode;
+ bool m_connectionActiveAndValid;
+ unsigned char m_tickerState;
+ TQByteArray m_programmingFileData;
+ };
+}
+
+#endif