diff options
| -rw-r--r-- | clients/tde/src/app/views/instrumentview.cpp | 15 | ||||
| -rw-r--r-- | clients/tde/src/part/fpgaprogram/Makefile.am | 8 | ||||
| -rw-r--r-- | clients/tde/src/part/fpgaprogram/layout.ui | 19 | ||||
| -rw-r--r-- | clients/tde/src/part/fpgaprogram/part.cpp | 37 | ||||
| -rw-r--r-- | clients/tde/src/part/fpgaprogram/part.h | 2 | ||||
| -rw-r--r-- | clients/tde/src/part/fpgaview/part.cpp | 27 | ||||
| -rw-r--r-- | lib/libtdekrb/src/tdekrbclientsocket.cpp | 2 | ||||
| -rw-r--r-- | lib/libtdekrb/src/tdekrbserversocket.cpp | 26 | ||||
| -rw-r--r-- | lib/libtdekrb/src/tdekrbserversocket.h | 1 | ||||
| -rw-r--r-- | lib/libtqtrla/src/tqtrla.cpp | 25 | ||||
| -rw-r--r-- | lib/libtqtrla/src/tqtrla.h | 3 | ||||
| -rw-r--r-- | servers/auth_server_lin/src/auth_conn.cpp | 12 | ||||
| -rw-r--r-- | servers/fpga_programming_server_lin/src/Makefile.am | 8 | ||||
| -rw-r--r-- | servers/fpga_programming_server_lin/src/fpga_conn.cpp | 78 | ||||
| -rw-r--r-- | servers/fpga_programming_server_lin/src/fpga_conn.h | 3 | ||||
| -rw-r--r-- | servers/fpga_programming_server_lin/src/main.cpp | 8 | ||||
| -rw-r--r-- | servers/fpga_server_lin/src/fpga_conn.cpp | 1 | ||||
| -rw-r--r-- | servers/fpga_server_lin/src/main.cpp | 4 |
18 files changed, 109 insertions, 170 deletions
diff --git a/clients/tde/src/app/views/instrumentview.cpp b/clients/tde/src/app/views/instrumentview.cpp index 24d0632..191444d 100644 --- a/clients/tde/src/app/views/instrumentview.cpp +++ b/clients/tde/src/app/views/instrumentview.cpp @@ -49,14 +49,21 @@ void InstrumentView::init() { } void InstrumentView::resizeEvent(TQResizeEvent *) { - TQWidget *childPartWidget = m_instrumentPart->widget(); - if (childPartWidget) { - setFixedSize(childPartWidget->sizeHint()); + if (m_instrumentPart) { + TQWidget *childPartWidget = m_instrumentPart->widget(); + if (childPartWidget) { + setFixedSize(childPartWidget->sizeHint()); + } } } TQPtrList<KAction> InstrumentView::menuActionList() { - return m_instrumentPart->menuActionList(); + if (m_instrumentPart) { + return m_instrumentPart->menuActionList(); + } + else { + return TQPtrList<KAction>(); + } } void InstrumentView::setStatusMessage(const TQString& message) { diff --git a/clients/tde/src/part/fpgaprogram/Makefile.am b/clients/tde/src/part/fpgaprogram/Makefile.am index 63fdf0f..e333ce1 100644 --- a/clients/tde/src/part/fpgaprogram/Makefile.am +++ b/clients/tde/src/part/fpgaprogram/Makefile.am @@ -3,7 +3,7 @@ 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 +kde_module_LTLIBRARIES = libremotelab_fpgaprogrammer.la +libremotelab_fpgaprogrammer_la_LIBADD = ../../widgets/libtracewidget.la ../../widgets/libfloatspinbox.la $(LIB_KFILE) $(LIB_KPARTS) $(LIB_TDEUI) $(LIB_QT) -ltdekrbsocket -ltqtrla +libremotelab_fpgaprogrammer_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) $(LIB_TDECORE) $(LIB_TDEUI) -lkio -ltdefx +libremotelab_fpgaprogrammer_la_SOURCES = part.cpp layout.ui diff --git a/clients/tde/src/part/fpgaprogram/layout.ui b/clients/tde/src/part/fpgaprogram/layout.ui index 985acfe..3f528bb 100644 --- a/clients/tde/src/part/fpgaprogram/layout.ui +++ b/clients/tde/src/part/fpgaprogram/layout.ui @@ -21,7 +21,7 @@ <cstring>groupFPGAProgram</cstring> </property> <property name="title"> - <string>FPGA Viewer</string> + <string>Setup</string> </property> <grid> <property name="name"> @@ -51,7 +51,7 @@ <cstring>programRunButton</cstring> </property> <property name="text"> - <cstring>Download Program</cstring> + <cstring>Upload File</cstring> </property> </widget> <widget class="TQProgressBar" row="2" column="0" colspan="3"> @@ -69,6 +69,21 @@ </widget> </grid> </widget> + <widget class="TQGroupBox" row="1" column="0"> + <property name="name"> + <cstring>groupProgrammingLog</cstring> + </property> + <property name="title"> + <string>Log</string> + </property> + <grid> + <widget class="KTextEdit" row="0" column="0" colspan="0"> + <property name="name"> + <cstring>programmingLogBox</cstring> + </property> + </widget> + </grid> + </widget> </grid> </widget> <includes> diff --git a/clients/tde/src/part/fpgaprogram/part.cpp b/clients/tde/src/part/fpgaprogram/part.cpp index bf7e46a..b51c39a 100644 --- a/clients/tde/src/part/fpgaprogram/part.cpp +++ b/clients/tde/src/part/fpgaprogram/part.cpp @@ -137,7 +137,7 @@ void FPGAProgramPart::connectionClosed() { } void FPGAProgramPart::postInit() { - connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(updateDisplay())); + connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(mainEventLoop())); } bool FPGAProgramPart::openURL(const KURL &url) { @@ -237,44 +237,21 @@ printf("[RAJA DEBUG 400.0] Got '%s' from the server\n\r", response.ascii()); ffl connToServerState = 3; connToServerConnecting = false; connect(m_socket, SIGNAL(readyRead()), m_socket, SLOT(processPendingData())); - connect(m_socket, SIGNAL(newDataReceived()), this, SLOT(updateDisplay())); + connect(m_socket, SIGNAL(newDataReceived()), this, SLOT(mainEventLoop())); 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(); + mainEventLoop(); return; } else { + TQStringList errorStrings = textForServerError(response); connToServerState = -1; connToServerConnecting = false; disconnectFromServer(); - KMessageBox::error(0, i18n("<qt>Unable to establish connection with remote server</qt>"), i18n("Connection Failed")); + KMessageBox::error(0, errorStrings[0], errorStrings[1]); close(); return; } @@ -318,11 +295,11 @@ void FPGAProgramPart::programRunButtonClicked() { 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.")); \ + setStatusMessage(i18n("Server ping timeout. Please verify the status of your network connection.")); \ m_updateTimer->start(FPGA_COMM_TIMEOUT_MS, FALSE); \ return; -void FPGAProgramPart::updateDisplay() { +void FPGAProgramPart::mainEventLoop() { m_updateTimer->stop(); TQDataStream ds(m_socket); diff --git a/clients/tde/src/part/fpgaprogram/part.h b/clients/tde/src/part/fpgaprogram/part.h index a663b11..f254cbc 100644 --- a/clients/tde/src/part/fpgaprogram/part.h +++ b/clients/tde/src/part/fpgaprogram/part.h @@ -67,7 +67,7 @@ namespace RemoteLab private slots: void postInit(); void resizeToHint(); - void updateDisplay(); + void mainEventLoop(); void processLockouts(); void connectionClosed(); void disconnectFromServer(); diff --git a/clients/tde/src/part/fpgaview/part.cpp b/clients/tde/src/part/fpgaview/part.cpp index 87ac05a..755f25c 100644 --- a/clients/tde/src/part/fpgaview/part.cpp +++ b/clients/tde/src/part/fpgaview/part.cpp @@ -1076,35 +1076,12 @@ printf("[RAJA DEBUG 400.0] Got '%s' from the server\n\r", response.ascii()); ffl 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 { + TQStringList errorStrings = textForServerError(response); connToServerState = -1; connToServerConnecting = false; disconnectFromServer(); - KMessageBox::error(0, i18n("<qt>Unable to establish connection with remote server</qt>"), i18n("Connection Failed")); + KMessageBox::error(0, errorStrings[0], errorStrings[1]); close(); return; } diff --git a/lib/libtdekrb/src/tdekrbclientsocket.cpp b/lib/libtdekrb/src/tdekrbclientsocket.cpp index ac1a1bc..a286ff6 100644 --- a/lib/libtdekrb/src/tdekrbclientsocket.cpp +++ b/lib/libtdekrb/src/tdekrbclientsocket.cpp @@ -883,7 +883,7 @@ void TDEKerberosClientSocket::continueKerberosInitialization() { int TDEKerberosClientSocket::initializeKerberosInterface() { if (state() != TQSocket::Connected) { - saslData->m_krbConnection = false; + freeKerberosConnection(); return -1; } diff --git a/lib/libtdekrb/src/tdekrbserversocket.cpp b/lib/libtdekrb/src/tdekrbserversocket.cpp index 77f4750..aa281cc 100644 --- a/lib/libtdekrb/src/tdekrbserversocket.cpp +++ b/lib/libtdekrb/src/tdekrbserversocket.cpp @@ -717,7 +717,6 @@ void TDEKerberosServerSocket::setStatusMessage(TQString message) { void TDEKerberosServerSocket::continueKerberosInitialization() { int slen; char buf[NET_SEC_BUF_SIZE]; - unsigned int len; sasl_ssf_t *ssf; if (m_krbInitRunning) { @@ -734,18 +733,18 @@ void TDEKerberosServerSocket::continueKerberosInitialization() { setStatusMessage(i18n("Kerberos connection failed")); return; } - len = slen; - if (strlen(buf) < len) { + m_krbInitLastLen = slen; + if (strlen(buf) < m_krbInitLastLen) { printf("[DEBUG] Initial response received\n\r"); // An initial response is present m_krbInitData = buf + strlen(buf) + 1; - len = len - (unsigned) strlen(buf) - 1; + m_krbInitLastLen = m_krbInitLastLen - (unsigned) strlen(buf) - 1; } else { m_krbInitData = NULL; - len = 0; + m_krbInitLastLen = 0; } - m_krbInitResult = sasl_server_start(saslData->m_krbConnection, buf, m_krbInitData, len, &m_krbInitData, &len); + m_krbInitResult = sasl_server_start(saslData->m_krbConnection, buf, m_krbInitData, m_krbInitLastLen, &m_krbInitData, &m_krbInitLastLen); if (m_krbInitResult != SASL_OK && m_krbInitResult != SASL_CONTINUE) { printf("[ERROR] Starting SASL negotiation returned %s (%d)\n\r", safe_sasl_errdetail(saslData->m_krbConnection), m_krbInitResult); freeKerberosConnection(); @@ -767,7 +766,7 @@ void TDEKerberosServerSocket::continueKerberosInitialization() { if (m_krbInitResult == SASL_CONTINUE) { if (m_krbInitData) { printf("[DEBUG] Sending response...\n\r"); - sendSASLDataToNetwork(m_krbInitData, len); + sendSASLDataToNetwork(m_krbInitData, m_krbInitLastLen); } else { printf("[ERROR] No data to send!\n\r"); @@ -803,9 +802,9 @@ void TDEKerberosServerSocket::continueKerberosInitialization() { setStatusMessage(i18n("Kerberos connection failed")); return; } - len = slen; + m_krbInitLastLen = slen; m_krbInitData = NULL; - m_krbInitResult = sasl_server_step(saslData->m_krbConnection, buf, len, &m_krbInitData, &len); + m_krbInitResult = sasl_server_step(saslData->m_krbConnection, buf, m_krbInitLastLen, &m_krbInitData, &m_krbInitLastLen); if (m_krbInitResult != SASL_OK && m_krbInitResult != SASL_CONTINUE) { printf("[ERROR] Performing SASL negotiation returned %s (%d)\n\r", safe_sasl_errdetail(saslData->m_krbConnection), m_krbInitResult); freeKerberosConnection(); @@ -828,7 +827,7 @@ void TDEKerberosServerSocket::continueKerberosInitialization() { if (state() == TQSocket::Connected) { if(m_krbInitServerLast && m_krbInitData) { printf("[DEBUG] Additional information needed to be sent\n\r"); - sendSASLDataToNetwork(m_krbInitData, len); + sendSASLDataToNetwork(m_krbInitData, m_krbInitLastLen); } m_krbInitResult = sasl_getprop(saslData->m_krbConnection, SASL_USERNAME, (const void **)&m_krbInitData); @@ -889,7 +888,7 @@ void TDEKerberosServerSocket::continueKerberosInitialization() { int TDEKerberosServerSocket::initializeKerberosInterface() { if (state() != TQSocket::Connected) { - saslData->m_krbConnection = false; + freeKerberosConnection(); return -1; } @@ -899,7 +898,6 @@ int TDEKerberosServerSocket::initializeKerberosInterface() { sasl_security_properties_t secprops; const char *ext_authid = NULL; int count; - unsigned int len; // FIXME // Populate these fields! @@ -948,7 +946,7 @@ int TDEKerberosServerSocket::initializeKerberosInterface() { } puts("[DEBUG] Generating client mechanism list..."); - m_krbInitResult = sasl_listmech(saslData->m_krbConnection, ext_authid, NULL, " ", NULL, &m_krbInitData, &len, &count); + m_krbInitResult = sasl_listmech(saslData->m_krbConnection, ext_authid, NULL, " ", NULL, &m_krbInitData, &m_krbInitLastLen, &count); if (m_krbInitResult != SASL_OK) { printf("[ERROR] Generating client mechanism list returned %s (%d)\n\r", safe_sasl_errdetail(saslData->m_krbConnection), m_krbInitResult); freeKerberosConnection(); @@ -956,7 +954,7 @@ int TDEKerberosServerSocket::initializeKerberosInterface() { } printf("[DEBUG] Sending list of %d mechanism(s)\n\r", count); - sendSASLDataToNetwork(m_krbInitData, len); + sendSASLDataToNetwork(m_krbInitData, m_krbInitLastLen); m_krbInitRunning = true; m_krbInitState = 0; diff --git a/lib/libtdekrb/src/tdekrbserversocket.h b/lib/libtdekrb/src/tdekrbserversocket.h index 61e6255..0394b49 100644 --- a/lib/libtdekrb/src/tdekrbserversocket.h +++ b/lib/libtdekrb/src/tdekrbserversocket.h @@ -114,6 +114,7 @@ class TDEKerberosServerSocket : public TQSocket unsigned int m_negotiatedMaxBufferSize; int m_krbInitResult; int m_krbInitServerLast; + unsigned int m_krbInitLastLen; const char *m_krbInitData; }; diff --git a/lib/libtqtrla/src/tqtrla.cpp b/lib/libtqtrla/src/tqtrla.cpp index e8631cc..d43c1f2 100644 --- a/lib/libtqtrla/src/tqtrla.cpp +++ b/lib/libtqtrla/src/tqtrla.cpp @@ -22,6 +22,8 @@ #include <tqwidget.h> +#include <klocale.h> + namespace KParts { class RemoteInstrumentPartPrivate @@ -77,6 +79,29 @@ namespace KParts void RemoteInstrumentPart::setStatusMessage(const TQString& message) { emit(statusMessageSet(message)); } + + TQStringList RemoteInstrumentPart::textForServerError(TQString shortError) { + TQStringList ret; + + if (shortError == "ERRNOCONN") { + ret.append(i18n("<qt>Unable to establish connection with backend server<p>Please verify that you are currently connected to a workspace</qt>")); + ret.append(i18n("Connection Failed")); + } + else if (shortError == "ERRNOTAVL") { + ret.append(i18n("<qt>The backend server is not available at this time<p>Please try a different workspace, or try again later</qt>")); + ret.append(i18n("Connection Failed")); + } + else if (shortError == "ERRNOSERV") { + ret.append(i18n("<qt>The active laboratory workspace does not support the requested service</qt>")); + ret.append(i18n("Service Unavailable")); + } + else { + ret.append(i18n("<qt>Unable to establish connection with remote server</qt>")); + ret.append(i18n("Connection Failed")); + } + + return ret; + } } bool operator==( const ServiceType &s1, const ServiceType &s2 ) { diff --git a/lib/libtqtrla/src/tqtrla.h b/lib/libtqtrla/src/tqtrla.h index 3b8ccd7..1f1ca22 100644 --- a/lib/libtqtrla/src/tqtrla.h +++ b/lib/libtqtrla/src/tqtrla.h @@ -50,6 +50,9 @@ namespace KParts virtual bool closeURL(); virtual TQPtrList<KAction> menuActionList(); + protected: + TQStringList textForServerError(TQString shortError); + protected slots: void close(); void resize(TQSize size); diff --git a/servers/auth_server_lin/src/auth_conn.cpp b/servers/auth_server_lin/src/auth_conn.cpp index db73811..51dcef0 100644 --- a/servers/auth_server_lin/src/auth_conn.cpp +++ b/servers/auth_server_lin/src/auth_conn.cpp @@ -111,7 +111,6 @@ void AuthSocket::connectionClosedHandler() { } int AuthSocket::initiateKerberosHandshake() { - // RAJA FIXME setUsingKerberos(true); while (kerberosStatus() == TDEKerberosServerSocket::KerberosInitializing) { tqApp->processEvents(); @@ -154,6 +153,7 @@ int AuthSocket::servLoop() { m_servActive = false; delete m_servClientTimeout; m_servClientTimeout = NULL; + close(); } } else { @@ -178,6 +178,7 @@ int AuthSocket::servLoop() { m_servActive = false; delete m_servClientTimeout; m_servClientTimeout = NULL; + close(); } break; case 2: @@ -195,6 +196,7 @@ int AuthSocket::servLoop() { m_servActive = false; delete m_servClientTimeout; m_servClientTimeout = NULL; + close(); } break; case 3: @@ -220,6 +222,7 @@ int AuthSocket::servLoop() { m_servActive = false; delete m_servClientTimeout; m_servClientTimeout = NULL; + close(); } } else { @@ -231,6 +234,7 @@ int AuthSocket::servLoop() { m_servActive = false; delete m_servClientTimeout; m_servClientTimeout = NULL; + close(); } } } @@ -241,6 +245,7 @@ int AuthSocket::servLoop() { m_servActive = false; delete m_servClientTimeout; m_servClientTimeout = NULL; + close(); } break; case 4: @@ -264,6 +269,7 @@ int AuthSocket::servLoop() { ds << TQString("ERRNOTAVL"); printf("[DEBUG] Connection terminated by remote host %s:%d for user %s@%s\n\r", m_srvServiceHostName.ascii(), m_srvServicePort, m_authenticatedUserName.ascii(), m_authenticatedRealmName.ascii()); fflush(stdout); m_servActive = false; + close(); } break; } @@ -339,6 +345,7 @@ void AuthSocket::commandLoop() { m_databaseServiceTypesCursor->select(TQString("serviceid=%1").arg(m_databaseServicesCursor->value("servicetype").toInt())); ServiceType svt; if (m_databaseServiceTypesCursor->next()) { + svt.type = m_databaseServiceTypesCursor->value("serviceid").toInt(); svt.name = m_databaseServiceTypesCursor->value("name").toString(); svt.description = m_databaseServiceTypesCursor->value("description").toString(); svt.clientLibrary = m_databaseServiceTypesCursor->value("client_library").toString(); @@ -409,6 +416,7 @@ void AuthSocket::commandLoop() { // Get client library name from the client TQString libname; ds >> libname; + printf("[DEBUG] SERV command parameter was %s from user %s@%s\n\r", libname.ascii(), m_authenticatedUserName.ascii(), m_authenticatedRealmName.ascii()); fflush(stdout); m_databaseActivityCursor->select(TQString("username='%1' AND realmname='%2'").arg(m_authenticatedUserName).arg(m_authenticatedRealmName)); if (m_databaseActivityCursor->next()) { @@ -434,7 +442,7 @@ void AuthSocket::commandLoop() { } else { // Attempt to connect to the backend server - m_databaseServicesCursor->select(TQString("pk=%1 AND station=%2").arg(sid).arg(m_stationID)); + m_databaseServicesCursor->select(TQString("servicetype=%1 AND station=%2").arg(sid).arg(m_stationID)); if (m_databaseServicesCursor->next()) { m_srvServiceHostName = m_databaseServicesCursor->value("hostname").toString(); m_srvServicePort = m_databaseServicesCursor->value("port").toInt(); diff --git a/servers/fpga_programming_server_lin/src/Makefile.am b/servers/fpga_programming_server_lin/src/Makefile.am index 6224e0c..bd6b9ee 100644 --- a/servers/fpga_programming_server_lin/src/Makefile.am +++ b/servers/fpga_programming_server_lin/src/Makefile.am @@ -1,11 +1,11 @@ INCLUDES= $(all_includes) $(KDE_INCLUDES)/tde -I/usr/include/sasl KDE_CXXFLAGS = $(USE_EXCEPTIONS) -bin_PROGRAMS = remotefpga_fpgaserver +bin_PROGRAMS = remotefpga_fpgaprogserver -remotefpga_fpgaserver_SOURCES = main.cpp fpga_conn.cpp +remotefpga_fpgaprogserver_SOURCES = main.cpp fpga_conn.cpp -remotefpga_fpgaserver_METASOURCES = AUTO -remotefpga_fpgaserver_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor -ltdekrbsocket -ltqtrla +remotefpga_fpgaprogserver_METASOURCES = AUTO +remotefpga_fpgaprogserver_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor -ltdekrbsocket -ltqtrla KDE_OPTIONS = nofinal diff --git a/servers/fpga_programming_server_lin/src/fpga_conn.cpp b/servers/fpga_programming_server_lin/src/fpga_conn.cpp index 3acd499..1ed0e09 100644 --- a/servers/fpga_programming_server_lin/src/fpga_conn.cpp +++ b/servers/fpga_programming_server_lin/src/fpga_conn.cpp @@ -57,7 +57,7 @@ struct exit_exception { instance of this class. */ FPGASocket::FPGASocket(int sock, TQObject *parent, const char *name) : - TDEKerberosServerSocket(parent, name), m_criticalSection(0), m_loopTimer(NULL), m_config(static_cast<FPGAServer*>(parent)->m_config) { + TDEKerberosServerSocket(parent, name), m_criticalSection(0), m_loopTimer(NULL), m_config(static_cast<FPGAServer*>(parent)->m_config), m_commandLoopState(0) { setServiceName("remotefpga"); @@ -92,7 +92,6 @@ void FPGASocket::connectionClosedHandler() { } int FPGASocket::initiateKerberosHandshake() { - // RAJA FIXME setUsingKerberos(true); while (kerberosStatus() == TDEKerberosServerSocket::KerberosInitializing) { tqApp->processEvents(); @@ -108,80 +107,15 @@ int FPGASocket::initiateKerberosHandshake() { } } -int FPGASocket::setupSerial() { - struct termios oldtio, newtio; - - m_config->setGroup("FPGA"); - TQString serialDevice = m_config->readEntry("serialdevice", "/dev/ttyS0"); - TQString desiredBaudRate = m_config->readEntry("baudrate", "9600"); - - m_fd_tty = ::open(serialDevice.ascii(), O_RDWR | O_NOCTTY | O_NONBLOCK | O_APPEND); - if (m_fd_tty < 0) { - printf("[FAIL] Unable to open serial device %s\n\r", serialDevice.ascii()); fflush(stdout); - return 1; - } - - tcgetattr(m_fd_tty, &oldtio); // Save current port settings - - long serialBaud; - if (desiredBaudRate == "1200") { - serialBaud = B1200; - } - else if (desiredBaudRate == "9600") { - serialBaud = B9600; - } - else if (desiredBaudRate == "19200") { - serialBaud = B19200; - } - else if (desiredBaudRate == "115200") { - serialBaud = B115200; - } - else { - printf("[WARNING] Invalid baudrate %s specified, selecting 9600 instead\n\r", desiredBaudRate.ascii()); fflush(stdout); - serialBaud = B9600; - } - - bzero(&newtio, sizeof(newtio)); - newtio.c_cflag = serialBaud | CS8 | CLOCAL | CREAD; - newtio.c_iflag = IGNPAR; - newtio.c_oflag = 0; - - // Set input mode (non-canonical, no echo,...) - newtio.c_lflag = 0; - - newtio.c_cc[VTIME] = 0; // Inter-character timer unused - newtio.c_cc[VMIN] = 0; // Blocking read unused - - tcflush(m_fd_tty, TCIFLUSH); - tcsetattr(m_fd_tty, TCSANOW, &newtio); - - return 0; -} - void FPGASocket::commandLoop() { - int cc; - char buffer[10000]; bool transferred_data; m_criticalSection++; try { transferred_data = false; if (state() == TQSocket::Connected) { - cc = read(m_fd_tty, buffer, 10000); - if (cc > 0) { - writeBlock(buffer, cc); - transferred_data = true; - printf("[DEBUG] Got %d bytes from the serial port\n\r", cc); fflush(stdout); - } - if (canReadData()) { - cc = readBlock(buffer, 10000); - if (cc > 0) { - if (write(m_fd_tty, buffer, cc) < 0) { - // ERROR - } - transferred_data = true; - printf("[DEBUG] Got %d bytes from the network interface\n\r", cc); fflush(stdout); - } + if (m_commandLoopState == 0) { + // RAJA FIXME } } m_criticalSection--; @@ -200,6 +134,7 @@ void FPGASocket::commandLoop() { } int FPGASocket::enterCommandLoop() { + m_commandLoopState = 0; if (!m_loopTimer) { m_loopTimer = new TQTimer(); connect(m_loopTimer, SIGNAL(timeout()), this, SLOT(commandLoop())); @@ -253,11 +188,6 @@ void FPGAServer::newConnection(int socket) { ABORT_SOCKET(s) return; } - if (s->setupSerial() != 0) { - printf("[DEBUG] Connection from %s closed due to serial port initialization failure\n\r", s->m_remoteHost.ascii()); - ABORT_SOCKET(s) - return; - } else { m_numberOfConnections++; connect(s, SIGNAL(connectionClosed()), s, SLOT(deleteLater())); diff --git a/servers/fpga_programming_server_lin/src/fpga_conn.h b/servers/fpga_programming_server_lin/src/fpga_conn.h index 717a35b..69c7c73 100644 --- a/servers/fpga_programming_server_lin/src/fpga_conn.h +++ b/servers/fpga_programming_server_lin/src/fpga_conn.h @@ -53,18 +53,17 @@ class FPGASocket : public TDEKerberosServerSocket private slots: void connectionClosedHandler(); - int setupSerial(); void commandLoop(); private: int line; int m_criticalSection; TQString m_remoteHost; - int m_fd_tty; TQTimer* m_loopTimer; KSimpleConfig* m_config; + int m_commandLoopState; friend class FPGAServer; }; diff --git a/servers/fpga_programming_server_lin/src/main.cpp b/servers/fpga_programming_server_lin/src/main.cpp index 5a264d5..5295bc4 100644 --- a/servers/fpga_programming_server_lin/src/main.cpp +++ b/servers/fpga_programming_server_lin/src/main.cpp @@ -39,13 +39,13 @@ #include "fpga_conn.h" -static const char description[] = I18N_NOOP("RemoteFPGA Kerberos Authentication Server"); +static const char description[] = I18N_NOOP("RemoteFPGA FPGA Programming Server"); static const char version[] = "v0.0.1"; int main(int argc, char *argv[]) { - KAboutData aboutData( "remotefpga_auth_server", I18N_NOOP("RemoteFPGA AuthServer"), + KAboutData aboutData( "remotefpga_fpgaprog_server", I18N_NOOP("RemoteFPGA FPGA Programming Server"), version, description, KAboutData::License_GPL, "(c) 2012, Timothy Pearson"); aboutData.addAuthor("Timothy Pearson",0, "kb9vqf@pearsoncomputing.net"); @@ -56,9 +56,9 @@ int main(int argc, char *argv[]) KStartupInfo::appStarted(); - KSimpleConfig config(TQDir::currentDirPath() + "/remotefpga_fpgaserver.conf", false); + KSimpleConfig config(TQDir::currentDirPath() + "/remotefpga_fpgaprogserver.conf", false); config.setGroup("Server"); - FPGAServer fpgasvr(0, config.readNumEntry("port", 4010), &config); + FPGAServer fpgasvr(0, config.readNumEntry("port", 4012), &config); return app.exec(); } diff --git a/servers/fpga_server_lin/src/fpga_conn.cpp b/servers/fpga_server_lin/src/fpga_conn.cpp index 3acd499..0225cea 100644 --- a/servers/fpga_server_lin/src/fpga_conn.cpp +++ b/servers/fpga_server_lin/src/fpga_conn.cpp @@ -92,7 +92,6 @@ void FPGASocket::connectionClosedHandler() { } int FPGASocket::initiateKerberosHandshake() { - // RAJA FIXME setUsingKerberos(true); while (kerberosStatus() == TDEKerberosServerSocket::KerberosInitializing) { tqApp->processEvents(); diff --git a/servers/fpga_server_lin/src/main.cpp b/servers/fpga_server_lin/src/main.cpp index 5a264d5..cfb67ad 100644 --- a/servers/fpga_server_lin/src/main.cpp +++ b/servers/fpga_server_lin/src/main.cpp @@ -39,13 +39,13 @@ #include "fpga_conn.h" -static const char description[] = I18N_NOOP("RemoteFPGA Kerberos Authentication Server"); +static const char description[] = I18N_NOOP("RemoteFPGA FPGA Viewer Server"); static const char version[] = "v0.0.1"; int main(int argc, char *argv[]) { - KAboutData aboutData( "remotefpga_auth_server", I18N_NOOP("RemoteFPGA AuthServer"), + KAboutData aboutData( "remotefpga_fpga_server", I18N_NOOP("RemoteFPGA FPGA Viewer Server"), version, description, KAboutData::License_GPL, "(c) 2012, Timothy Pearson"); aboutData.addAuthor("Timothy Pearson",0, "kb9vqf@pearsoncomputing.net"); |
