@ -27,6 +27,7 @@
# include <kaction.h>
# include <kaction.h>
# include <klocale.h>
# include <klocale.h>
# include <ktextedit.h>
# include <ktextedit.h>
# include <kfiledialog.h>
# include <kmessagebox.h> //::start()
# include <kmessagebox.h> //::start()
# include <kparts/genericfactory.h>
# include <kparts/genericfactory.h>
# include <kstatusbar.h>
# include <kstatusbar.h>
@ -56,6 +57,22 @@
# define NETWORK_COMM_TIMEOUT_MS 2500
# define NETWORK_COMM_TIMEOUT_MS 2500
enum connectionModes {
ModeIdle = 0 ,
ModeProgramming = 1
} ;
enum connectionStates {
ModeIdle_StateStatusRequest = 0 ,
ModeIdle_StateProcessStatus = 1 ,
ModeIdle_StateDelay = 2 ,
ModeIdle_StateGetLogMessages = 3 ,
ModeProgramming_StateReadFile = 100 ,
ModeProgramming_StateInitProgramming = 101 ,
ModeProgramming_StateWaitForCompletion = 102 ,
ModeProgramming_StateRequestStatus = 103
} ;
namespace RemoteLab {
namespace RemoteLab {
typedef KParts : : GenericFactory < RemoteLab : : FPGAProgramPart > Factory ;
typedef KParts : : GenericFactory < RemoteLab : : FPGAProgramPart > Factory ;
@ -76,6 +93,8 @@ FPGAProgramPart::FPGAProgramPart(TQWidget *parentWidget, const char *widgetName,
setWidget ( new TQVBox ( parentWidget , widgetName ) ) ;
setWidget ( new TQVBox ( parentWidget , widgetName ) ) ;
// Create timers
// Create timers
m_forcedUpdateTimer = new TQTimer ( this ) ;
connect ( m_forcedUpdateTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( mainEventLoop ( ) ) ) ;
m_updateTimeoutTimer = new TQTimer ( this ) ;
m_updateTimeoutTimer = new TQTimer ( this ) ;
connect ( m_updateTimeoutTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( mainEventLoop ( ) ) ) ;
connect ( m_updateTimeoutTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( mainEventLoop ( ) ) ) ;
m_pingDelayTimer = new TQTimer ( this ) ;
m_pingDelayTimer = new TQTimer ( this ) ;
@ -87,6 +106,8 @@ FPGAProgramPart::FPGAProgramPart(TQWidget *parentWidget, const char *widgetName,
// Initialize widgets
// Initialize widgets
m_base - > programmingLogBox - > setReadOnly ( true ) ;
m_base - > programmingLogBox - > setReadOnly ( true ) ;
connect ( m_base - > programRunButton , SIGNAL ( clicked ( ) ) , this , SLOT ( programRunButtonClicked ( ) ) ) ;
connect ( m_base - > programRunButton , SIGNAL ( clicked ( ) ) , this , SLOT ( programRunButtonClicked ( ) ) ) ;
connect ( m_base - > clearProgrammingLogButton , SIGNAL ( clicked ( ) ) , this , SLOT ( clearProgrammingLogBox ( ) ) ) ;
connect ( m_base - > saveProgrammingLogButton , SIGNAL ( clicked ( ) ) , this , SLOT ( saveProgrammingLogBox ( ) ) ) ;
connect ( m_base - > programmingInputFile , SIGNAL ( textChanged ( const TQString & ) ) , this , SLOT ( processLockouts ( ) ) ) ;
connect ( m_base - > programmingInputFile , SIGNAL ( textChanged ( const TQString & ) ) , this , SLOT ( processLockouts ( ) ) ) ;
TQTimer : : singleShot ( 0 , this , TQT_SLOT ( postInit ( ) ) ) ;
TQTimer : : singleShot ( 0 , this , TQT_SLOT ( postInit ( ) ) ) ;
@ -140,7 +161,7 @@ void FPGAProgramPart::connectionClosed() {
}
}
void FPGAProgramPart : : postInit ( ) {
void FPGAProgramPart : : postInit ( ) {
setUsingFixedSize ( tru e) ;
setUsingFixedSize ( fals e) ;
}
}
bool FPGAProgramPart : : openURL ( const KURL & url ) {
bool FPGAProgramPart : : openURL ( const KURL & url ) {
@ -157,6 +178,7 @@ bool FPGAProgramPart::closeURL() {
}
}
void FPGAProgramPart : : disconnectFromServerCallback ( ) {
void FPGAProgramPart : : disconnectFromServerCallback ( ) {
m_forcedUpdateTimer - > stop ( ) ;
m_updateTimeoutTimer - > stop ( ) ;
m_updateTimeoutTimer - > stop ( ) ;
}
}
@ -165,8 +187,8 @@ void FPGAProgramPart::connectionFinishedCallback() {
m_socket - > processPendingData ( ) ;
m_socket - > processPendingData ( ) ;
connect ( m_socket , SIGNAL ( newDataReceived ( ) ) , this , SLOT ( mainEventLoop ( ) ) ) ;
connect ( m_socket , SIGNAL ( newDataReceived ( ) ) , this , SLOT ( mainEventLoop ( ) ) ) ;
m_tickerState = 0 ;
m_tickerState = 0 ;
m_commHandlerState = 0 ;
m_commHandlerState = ModeIdle_StateStatusRequest ;
m_commHandlerMode = 0 ;
m_commHandlerMode = ModeIdle ;
m_socket - > setDataTimeout ( NETWORK_COMM_TIMEOUT_MS ) ;
m_socket - > setDataTimeout ( NETWORK_COMM_TIMEOUT_MS ) ;
m_updateTimeoutTimer - > start ( NETWORK_COMM_TIMEOUT_MS , TRUE ) ;
m_updateTimeoutTimer - > start ( NETWORK_COMM_TIMEOUT_MS , TRUE ) ;
processLockouts ( ) ;
processLockouts ( ) ;
@ -179,23 +201,46 @@ void FPGAProgramPart::connectionStatusChangedCallback() {
}
}
void FPGAProgramPart : : programRunButtonClicked ( ) {
void FPGAProgramPart : : programRunButtonClicked ( ) {
m_commHandlerState = 0 ;
m_commHandlerState = ModeProgramming_StateReadFile ;
m_commHandlerMode = 1 ;
m_commHandlerMode = ModeProgramming ;
processLockouts ( ) ;
processLockouts ( ) ;
}
}
# define UPDATEDISPLAY_TIMEOUT m_connectionActiveAndValid = false; \
void FPGAProgramPart : : clearProgrammingLogBox ( ) {
m_tickerState = 0 ; \
m_base - > programmingLogBox - > setText ( " " ) ;
m_commHandlerState = 0 ; \
}
m_commHandlerMode = 0 ; \
m_socket - > clearIncomingData ( ) ; \
void FPGAProgramPart : : saveProgrammingLogBox ( ) {
setStatusMessage ( i18n ( " Server ping timeout. Please verify the status of your network connection. " ) ) ; \
TQString saveFileName = KFileDialog : : getSaveFileName ( TQString : : null , " *.txt|Text Files (*.txt) " , 0 , i18n ( " Save log file... " ) ) ;
m_updateTimeoutTimer - > start ( NETWORK_COMM_TIMEOUT_MS , TRUE ) ; \
if ( saveFileName ! = " " ) {
m_connectionMutex - > unlock ( ) ; \
TQFile file ( saveFileName ) ;
return ;
if ( file . open ( IO_WriteOnly ) ) {
TQCString logFile = m_base - > programmingLogBox - > text ( ) . ascii ( ) ;
m_programmingFileData = file . writeBlock ( logFile . data ( ) , logFile . size ( ) ) ;
file . close ( ) ;
}
else {
KMessageBox : : error ( 0 , i18n ( " <qt>Unable to save log file<p>Please check permissions and try again</qt> " ) , i18n ( " Save Failed " ) ) ;
}
}
}
# define SET_WATCHDOG_TIMER if (!m_updateTimeoutTimer->isActive()) m_updateTimeoutTimer->start(NETWORK_COMM_TIMEOUT_MS, TRUE);
# define UPDATEDISPLAY_TIMEOUT m_connectionActiveAndValid = false; \
# define PAT_WATCHDOG_TIMER m_updateTimeoutTimer->stop(); m_updateTimeoutTimer->start(NETWORK_COMM_TIMEOUT_MS, TRUE);
m_tickerState = 0 ; \
m_commHandlerState = ModeIdle_StateStatusRequest ; \
m_commHandlerMode = ModeIdle ; \
m_socket - > clearIncomingData ( ) ; \
setStatusMessage ( i18n ( " Server ping timeout. Please verify the status of your network connection. " ) ) ; \
m_updateTimeoutTimer - > start ( NETWORK_COMM_TIMEOUT_MS , TRUE ) ; \
m_connectionMutex - > unlock ( ) ; \
return ;
# define SET_WATCHDOG_TIMER if (!m_updateTimeoutTimer->isActive()) m_updateTimeoutTimer->start(NETWORK_COMM_TIMEOUT_MS, TRUE);
# define PAT_WATCHDOG_TIMER m_updateTimeoutTimer->stop(); m_updateTimeoutTimer->start(NETWORK_COMM_TIMEOUT_MS, TRUE);
# define SET_NEXT_STATE(x) m_commHandlerState = x;
# define EXEC_NEXT_STATE_IMMEDIATELY m_forcedUpdateTimer->start(0, TRUE);
void FPGAProgramPart : : setTickerMessage ( TQString message ) {
void FPGAProgramPart : : setTickerMessage ( TQString message ) {
m_connectionActiveAndValid = true ;
m_connectionActiveAndValid = true ;
@ -226,24 +271,24 @@ void FPGAProgramPart::mainEventLoop() {
ds . setPrintableData ( true ) ;
ds . setPrintableData ( true ) ;
if ( ! m_connectionMutex - > tryLock ( ) ) {
if ( ! m_connectionMutex - > tryLock ( ) ) {
TQTimer: : singleShot ( 0 , this , SLOT ( mainEventLoop ( ) ) ) ; // Handle the concurrently received call immediately after current execution
EXEC_NEXT_STATE_IMMEDIATELY
return ;
return ;
}
}
if ( m_socket ) {
if ( m_socket ) {
if ( m_commHandlerMode = = 0 ) {
if ( m_commHandlerMode = = ModeIdle ) {
// Normal operation
// Normal operation
switch ( m_commHandlerState ) {
switch ( m_commHandlerState ) {
case 0 :
case ModeIdle_StateStatusRequest :
// Get status of remote system
// Get status of remote system
// Clear buffers to synchronize frames in case of data corruption
// Clear buffers to synchronize frames in case of data corruption
m_socket - > clearIncomingData ( ) ;
m_socket - > clearIncomingData ( ) ;
ds < < TQString ( " STATUS " ) ;
ds < < TQString ( " STATUS " ) ;
m_socket - > writeEndOfFrame ( ) ;
m_socket - > writeEndOfFrame ( ) ;
m_commHandlerState = 1 ;
SET_NEXT_STATE( ModeIdle_StateProcessStatus )
break ;
break ;
case 1 :
case ModeIdle_StateProcessStatus :
// Get all data
// Get all data
if ( m_socket - > canReadFrame ( ) ) {
if ( m_socket - > canReadFrame ( ) ) {
PAT_WATCHDOG_TIMER
PAT_WATCHDOG_TIMER
@ -260,19 +305,18 @@ void FPGAProgramPart::mainEventLoop() {
// Do nothing
// Do nothing
}
}
else if ( status = = " LOGMESSAGES " ) {
else if ( status = = " LOGMESSAGES " ) {
// Fire next event loop immediately
EXEC_NEXT_STATE_IMMEDIATELY
TQTimer : : singleShot ( 0 , this , SLOT ( mainEventLoop ( ) ) ) ;
// Retrieve messages on next event loop
// Retrieve messages on next event loop
m_commHandlerState = 3 ;
SET_NEXT_STATE( ModeIdle_StateGetLogMessages ) ;
m_commHandlerNextState = 2 ;
m_commHandlerNextState = ModeIdle_StateDelay ;
m_commHandlerNextMode = 0 ;
m_commHandlerNextMode = ModeIdle ;
}
}
setTickerMessage ( i18n ( " Connected " ) ) ;
setTickerMessage ( i18n ( " Connected " ) ) ;
if ( m_commHandlerState = = 1 ) {
if ( m_commHandlerState = = ModeIdle_StateProcessStatus ) {
m_pingDelayTimer - > start ( 250 , TRUE ) ;
m_pingDelayTimer - > start ( 250 , TRUE ) ;
m_commHandlerState = 2 ;
SET_NEXT_STATE( ModeIdle_StateDelay ) ;
}
}
}
}
else {
else {
@ -281,17 +325,16 @@ void FPGAProgramPart::mainEventLoop() {
}
}
}
}
break ;
break ;
case 2 :
case ModeIdle_StateDelay :
// Let the client and server rest for a bit to lower CPU/network overhead
// Let the client and server rest for a bit to lower CPU/network overhead
if ( ! m_pingDelayTimer - > isActive ( ) ) {
if ( ! m_pingDelayTimer - > isActive ( ) ) {
// Fire next event loop immediately
EXEC_NEXT_STATE_IMMEDIATELY
TQTimer : : singleShot ( 0 , this , SLOT ( mainEventLoop ( ) ) ) ;
// Execute query on next event loop
// Execute query on next event loop
m_commHandlerState = 0 ;
SET_NEXT_STATE( ModeIdle_StateStatusRequest ) ;
}
}
PAT_WATCHDOG_TIMER
PAT_WATCHDOG_TIMER
break ;
break ;
case 3 :
case ModeIdle_StateGetLogMessages :
// Get new log messages
// Get new log messages
if ( m_socket - > canReadFrame ( ) ) {
if ( m_socket - > canReadFrame ( ) ) {
PAT_WATCHDOG_TIMER
PAT_WATCHDOG_TIMER
@ -308,7 +351,7 @@ void FPGAProgramPart::mainEventLoop() {
m_base - > programmingLogBox - > append ( messages ) ;
m_base - > programmingLogBox - > append ( messages ) ;
m_pingDelayTimer - > start ( 250 , TRUE ) ;
m_pingDelayTimer - > start ( 250 , TRUE ) ;
m_commHandlerState = m_commHandlerNextState ;
SET_NEXT_STATE( m_commHandlerNextState ) ;
m_commHandlerMode = m_commHandlerNextMode ;
m_commHandlerMode = m_commHandlerNextMode ;
}
}
}
}
@ -322,7 +365,7 @@ void FPGAProgramPart::mainEventLoop() {
}
}
else if ( m_commHandlerMode = = 1 ) {
else if ( m_commHandlerMode = = 1 ) {
// Program mode!
// Program mode!
if ( m_commHandlerState = = 0 ) {
if ( m_commHandlerState = = ModeProgramming_StateReadFile ) {
m_base - > programmingStatusLabel - > setText ( i18n ( " Reading input file " ) + " ... " ) ;
m_base - > programmingStatusLabel - > setText ( i18n ( " Reading input file " ) + " ... " ) ;
TQFile file ( m_base - > programmingInputFile - > url ( ) ) ;
TQFile file ( m_base - > programmingInputFile - > url ( ) ) ;
if ( file . open ( IO_ReadOnly ) ) {
if ( file . open ( IO_ReadOnly ) ) {
@ -343,18 +386,18 @@ void FPGAProgramPart::mainEventLoop() {
m_socket - > writeEndOfFrame ( ) ;
m_socket - > writeEndOfFrame ( ) ;
m_base - > programmingProgressBar - > setTotalSteps ( m_programmingFileTotalSize ) ;
m_base - > programmingProgressBar - > setTotalSteps ( m_programmingFileTotalSize ) ;
m_commHandlerState = 1 ;
SET_NEXT_STATE( ModeProgramming_StateInitProgramming ) ;
}
}
else {
else {
KMessageBox : : error ( 0 , i18n ( " <qt>Unable to open selected programming file</qt> " ) , i18n ( " Program Failed " ) ) ;
KMessageBox : : error ( 0 , i18n ( " <qt>Unable to open selected programming file</qt> " ) , i18n ( " Program Failed " ) ) ;
m_commHandlerMode = 0 ;
m_commHandlerMode = ModeIdle ;
m_commHandlerState = 0 ;
SET_NEXT_STATE( ModeIdle_StateStatusRequest ) ;
m_base - > programmingProgressBar - > reset ( ) ;
m_base - > programmingProgressBar - > reset ( ) ;
processLockouts ( ) ;
processLockouts ( ) ;
}
}
PAT_WATCHDOG_TIMER
PAT_WATCHDOG_TIMER
}
}
else if ( m_commHandlerState = = 1 ) {
else if ( m_commHandlerState = = ModeProgramming_StateInitProgramming ) {
TQ_ULONG bytesLeft = ( m_programmingFileTotalSize - m_programmingFileTransferredBytes ) ;
TQ_ULONG bytesLeft = ( m_programmingFileTotalSize - m_programmingFileTransferredBytes ) ;
TQ_ULONG bytesToTransfer = bytesLeft ;
TQ_ULONG bytesToTransfer = bytesLeft ;
TQ_ULONG maxTransferChunk = maximumSocketDataChunkSize ( ) ;
TQ_ULONG maxTransferChunk = maximumSocketDataChunkSize ( ) ;
@ -362,6 +405,7 @@ void FPGAProgramPart::mainEventLoop() {
bytesToTransfer = maxTransferChunk ;
bytesToTransfer = maxTransferChunk ;
}
}
m_programmingFileTransferredBytes = m_programmingFileTransferredBytes + m_socket - > writeBlock ( m_programmingFileData . data ( ) + m_programmingFileTransferredBytes , bytesToTransfer ) ;
m_programmingFileTransferredBytes = m_programmingFileTransferredBytes + m_socket - > writeBlock ( m_programmingFileData . data ( ) + m_programmingFileTransferredBytes , bytesToTransfer ) ;
m_socket - > flush ( ) ;
m_base - > programmingProgressBar - > setProgress ( m_programmingFileTransferredBytes ) ;
m_base - > programmingProgressBar - > setProgress ( m_programmingFileTransferredBytes ) ;
if ( m_programmingFileTransferredBytes > = m_programmingFileTotalSize ) {
if ( m_programmingFileTransferredBytes > = m_programmingFileTotalSize ) {
// Initiate programming
// Initiate programming
@ -377,38 +421,37 @@ void FPGAProgramPart::mainEventLoop() {
m_base - > programmingProgressBar - > setTotalSteps ( 0 ) ;
m_base - > programmingProgressBar - > setTotalSteps ( 0 ) ;
m_base - > programmingProgressBar - > setProgress ( 0 ) ;
m_base - > programmingProgressBar - > setProgress ( 0 ) ;
m_commHandlerState = 2 ;
SET_NEXT_STATE( ModeProgramming_StateWaitForCompletion ) ;
}
}
else {
else {
setTickerMessage ( i18n ( " Transmitting data " ) ) ;
setTickerMessage ( i18n ( " Transmitting data " ) ) ;
// Fire next event loop immediately
EXEC_NEXT_STATE_IMMEDIATELY
TQTimer : : singleShot ( 0 , this , SLOT ( mainEventLoop ( ) ) ) ;
}
}
PAT_WATCHDOG_TIMER
PAT_WATCHDOG_TIMER
}
}
else if ( m_commHandlerState = = 2 ) {
else if ( m_commHandlerState = = ModeProgramming_StateWaitForCompletion ) {
// Get response
// Get response
if ( m_socket - > canReadFrame ( ) ) {
if ( m_socket - > canReadFrame ( ) ) {
PAT_WATCHDOG_TIMER
PAT_WATCHDOG_TIMER
TQString result ;
TQString result ;
ds > > result ;
ds > > result ;
m_socket - > clearFrameTail ( ) ;
if ( result = = " PROGRAMMING " ) {
if ( result = = " PROGRAMMING " ) {
m_socket - > clearFrameTail ( ) ;
setTickerMessage ( i18n ( " Programming device " ) ) ;
setTickerMessage ( i18n ( " Programming device " ) ) ;
// Request status
// Request status
ds < < TQString ( " STATUS " ) ;
ds < < TQString ( " STATUS " ) ;
m_socket - > writeEndOfFrame ( ) ;
m_socket - > writeEndOfFrame ( ) ;
}
}
else if ( result = = " LOGMESSAGES " ) {
else if ( result = = " LOGMESSAGES " ) {
// Fire next event loop immediately
m_socket - > clearFrameTail ( ) ;
TQTimer: : singleShot ( 0 , this , SLOT ( mainEventLoop ( ) ) ) ;
EXEC_NEXT_STATE_IMMEDIATELY
// Retrieve messages on next event loop
// Retrieve messages on next event loop
m_commHandlerState = 3 ;
SET_NEXT_STATE( ModeIdle_StateGetLogMessages ) ;
m_commHandlerMode = 0 ;
m_commHandlerMode = ModeIdle ;
m_commHandlerNextState = 3 ;
m_commHandlerNextState = ModeProgramming_StateRequestStatus ;
m_commHandlerNextMode = 1 ;
m_commHandlerNextMode = ModeProgramming ;
}
}
else if ( result = = " DONE " ) {
else if ( result = = " DONE " ) {
TQ_INT32 retCode ;
TQ_INT32 retCode ;
@ -419,27 +462,28 @@ void FPGAProgramPart::mainEventLoop() {
if ( retCode ! = 0 ) {
if ( retCode ! = 0 ) {
// Error!
// Error!
m_commHandlerMode = 0 ;
m_commHandlerMode = ModeIdle ;
m_commHandlerState = 0 ;
SET_NEXT_STATE( ModeIdle_StateStatusRequest ) ;
TQTimer: : singleShot ( 0 , this , SLOT ( mainEventLoop ( ) ) ) ;
EXEC_NEXT_STATE_IMMEDIATELY
m_base - > programmingProgressBar - > reset ( ) ;
m_base - > programmingProgressBar - > reset ( ) ;
KMessageBox : : error ( 0 , i18n ( " <qt>Programming process failure<p>Please see log for details</qt> " ) , i18n ( " Program Failed " ) ) ;
KMessageBox : : error ( 0 , i18n ( " <qt>Programming process failure<p>Please see log for details</qt> " ) , i18n ( " Program Failed " ) ) ;
processLockouts ( ) ;
processLockouts ( ) ;
}
}
else {
else {
// Done!
// Done!
m_commHandlerMode = 0 ;
m_commHandlerMode = ModeIdle ;
m_commHandlerState = 0 ;
SET_NEXT_STATE( ModeIdle_StateStatusRequest ) ;
TQTimer: : singleShot ( 0 , this , SLOT ( mainEventLoop ( ) ) ) ;
EXEC_NEXT_STATE_IMMEDIATELY
m_base - > programmingProgressBar - > reset ( ) ;
m_base - > programmingProgressBar - > reset ( ) ;
processLockouts ( ) ;
processLockouts ( ) ;
}
}
}
}
else if ( result = = " ERROR " ) {
else if ( result = = " ERROR " ) {
// Error!
// Error!
m_commHandlerMode = 0 ;
m_socket - > clearFrameTail ( ) ;
m_commHandlerState = 0 ;
m_commHandlerMode = ModeIdle ;
TQTimer : : singleShot ( 0 , this , SLOT ( mainEventLoop ( ) ) ) ;
SET_NEXT_STATE ( ModeIdle_StateStatusRequest ) ;
EXEC_NEXT_STATE_IMMEDIATELY
m_base - > programmingProgressBar - > reset ( ) ;
m_base - > programmingProgressBar - > reset ( ) ;
KMessageBox : : error ( 0 , i18n ( " <qt>Unknown error</qt> " ) , i18n ( " Program Failed " ) ) ;
KMessageBox : : error ( 0 , i18n ( " <qt>Unknown error</qt> " ) , i18n ( " Program Failed " ) ) ;
processLockouts ( ) ;
processLockouts ( ) ;
@ -447,26 +491,27 @@ void FPGAProgramPart::mainEventLoop() {
else {
else {
// Unknown response
// Unknown response
// Request status
// Request status
m_socket - > clearFrameTail ( ) ;
ds < < TQString ( " STATUS " ) ;
ds < < TQString ( " STATUS " ) ;
m_socket - > writeEndOfFrame ( ) ;
m_socket - > writeEndOfFrame ( ) ;
}
}
}
}
else {
else {
if ( ! m_updateTimeoutTimer - > isActive ( ) ) {
if ( ! m_updateTimeoutTimer - > isActive ( ) ) {
m_commHandlerMode = 0 ;
m_commHandlerMode = ModeIdle ;
m_commHandlerState = 0 ;
SET_NEXT_STATE( ModeIdle_StateStatusRequest ) ;
TQTimer: : singleShot ( 0 , this , SLOT ( mainEventLoop ( ) ) ) ;
EXEC_NEXT_STATE_IMMEDIATELY
m_base - > programmingProgressBar - > reset ( ) ;
m_base - > programmingProgressBar - > reset ( ) ;
processLockouts ( ) ;
processLockouts ( ) ;
UPDATEDISPLAY_TIMEOUT
UPDATEDISPLAY_TIMEOUT
}
}
}
}
}
}
else if ( m_commHandlerState = = 3 ) {
else if ( m_commHandlerState = = ModeProgramming_StateRequestStatus ) {
// Request status
// Request status
ds < < TQString ( " STATUS " ) ;
ds < < TQString ( " STATUS " ) ;
m_socket - > writeEndOfFrame ( ) ;
m_socket - > writeEndOfFrame ( ) ;
m_commHandlerState = 2 ;
SET_NEXT_STATE( ModeProgramming_StateWaitForCompletion ) ;
PAT_WATCHDOG_TIMER
PAT_WATCHDOG_TIMER
}
}
}
}
@ -474,8 +519,8 @@ void FPGAProgramPart::mainEventLoop() {
SET_WATCHDOG_TIMER
SET_WATCHDOG_TIMER
}
}
else {
else {
m_commHandlerState = 0 ;
SET_NEXT_STATE( ModeIdle_StateStatusRequest ) ;
m_commHandlerMode = 0 ;
m_commHandlerMode = ModeIdle ;
}
}
m_connectionMutex - > unlock ( ) ;
m_connectionMutex - > unlock ( ) ;