From fc455268a511d91113f59c04b50fa08b7c37b554 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 7 Jul 2012 16:23:30 -0500 Subject: Convert to frame based protocol Finish FPGA programming server/client --- clients/tde/src/part/fpgaview/part.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'clients/tde/src/part/fpgaview') diff --git a/clients/tde/src/part/fpgaview/part.cpp b/clients/tde/src/part/fpgaview/part.cpp index e4a56d4..7ac5dbf 100644 --- a/clients/tde/src/part/fpgaview/part.cpp +++ b/clients/tde/src/part/fpgaview/part.cpp @@ -1061,17 +1061,21 @@ void FPGAViewPart::finishConnectingToServer() { // Connection established! // Read magic number and proto version from server m_socket->processPendingData(); - if (m_socket->bytesAvailable() > 0) { + if (m_socket->canReadFrame()) { TQDataStream ds(m_socket); + ds.setPrintableData(true); TQ_UINT32 magicnum; TQ_UINT32 protover; ds >> magicnum; ds >> protover; + m_socket->clearFrameTail(); printf("[DEBUG] Got magic number %d and protocol version %d\n\r", magicnum, protover); fflush(stdout); // Request connection to backend server ds << TQString("SERV"); + m_socket->writeEndOfFrame(); ds << TQString(CLIENT_LIBRARY); + m_socket->writeEndOfFrame(); connToServerState = 3; } break; @@ -1080,8 +1084,10 @@ void FPGAViewPart::finishConnectingToServer() { m_socket->processPendingData(); if (m_socket->bytesAvailable() > 0) { TQDataStream ds(m_socket); + ds.setPrintableData(true); TQString response; ds >> response; + m_socket->clearFrameTail(); printf("[RAJA DEBUG 400.0] Got '%s' from the server\n\r", response.ascii()); fflush(stdout); if (response == "OK") { connToServerState = 4; @@ -1332,7 +1338,7 @@ void FPGAViewPart::updateDisplay() { KMessageBox::error(0, i18n("Unable to open selected batch output file"), i18n("Batch Failed")); m_commHandlerMode = 0; m_commHandlerState = 0; - m_base->batchTestProgressBar->setProgress(0); + m_base->batchTestProgressBar->reset(); processLockouts(); } } @@ -1340,7 +1346,7 @@ void FPGAViewPart::updateDisplay() { KMessageBox::error(0, i18n("Unable to open selected batch input file"), i18n("Batch Failed")); m_commHandlerMode = 0; m_commHandlerState = 0; - m_base->batchTestProgressBar->setProgress(0); + m_base->batchTestProgressBar->reset(); processLockouts(); } } @@ -1353,7 +1359,7 @@ void FPGAViewPart::updateDisplay() { m_batchOutputFile = NULL; m_commHandlerMode = 0; m_commHandlerState = 0; - m_base->batchTestProgressBar->setProgress(0); + m_base->batchTestProgressBar->reset(); processLockouts(); } else { @@ -1403,7 +1409,7 @@ void FPGAViewPart::updateDisplay() { m_batchOutputFile->close(); delete m_batchOutputFile; m_batchOutputFile = NULL; - m_base->batchTestProgressBar->setProgress(0); + m_base->batchTestProgressBar->reset(); m_commHandlerMode = 0; m_commHandlerState = 0; processLockouts(); @@ -1476,8 +1482,7 @@ void FPGAViewPart::updateDisplay() { KMessageBox::error(0, i18n("Unable to open selected data output file"), i18n("Data Processing Failed")); m_commHandlerMode = 0; m_commHandlerState = 0; - m_base->dataProcessingProgressBar->setTotalSteps(1); - m_base->dataProcessingProgressBar->setProgress(0); + m_base->dataProcessingProgressBar->reset(); processLockouts(); } } @@ -1485,8 +1490,7 @@ void FPGAViewPart::updateDisplay() { KMessageBox::error(0, i18n("Selected data input file exceeds the maximum allowed size of 16,384 bytes"), i18n("Data Processing Failed")); m_commHandlerMode = 0; m_commHandlerState = 0; - m_base->dataProcessingProgressBar->setTotalSteps(1); - m_base->dataProcessingProgressBar->setProgress(0); + m_base->dataProcessingProgressBar->reset(); processLockouts(); } } @@ -1494,8 +1498,7 @@ void FPGAViewPart::updateDisplay() { KMessageBox::error(0, i18n("Unable to open selected data input file"), i18n("Data Processing Failed")); m_commHandlerMode = 0; m_commHandlerState = 0; - m_base->dataProcessingProgressBar->setTotalSteps(1); - m_base->dataProcessingProgressBar->setProgress(0); + m_base->dataProcessingProgressBar->reset(); processLockouts(); } } @@ -1546,8 +1549,7 @@ void FPGAViewPart::updateDisplay() { m_dataOutputFile->close(); delete m_dataOutputFile; m_dataOutputFile = NULL; - m_base->dataProcessingProgressBar->setTotalSteps(1); - m_base->dataProcessingProgressBar->setProgress(0); + m_base->dataProcessingProgressBar->reset(); m_commHandlerMode = 0; m_commHandlerState = 0; processLockouts(); @@ -1558,8 +1560,7 @@ void FPGAViewPart::updateDisplay() { m_dataOutputFile->close(); delete m_dataOutputFile; m_dataOutputFile = NULL; - m_base->dataProcessingProgressBar->setTotalSteps(1); - m_base->dataProcessingProgressBar->setProgress(0); + m_base->dataProcessingProgressBar->reset(); m_commHandlerMode = 0; m_commHandlerState = 0; processLockouts(); -- cgit v1.2.1