Important Update:
- DeviceCore: - Allow adjustable reply timeout with SetWaitForReply()
This commit is contained in:
@@ -432,6 +432,7 @@ bool CDeviceCore::SetPollParam( int pPollInterval )
|
|||||||
|
|
||||||
bool CDeviceCore::SetReplyParam( int pReplyTimeout, int pMaxRetries )
|
bool CDeviceCore::SetReplyParam( int pReplyTimeout, int pMaxRetries )
|
||||||
{
|
{
|
||||||
|
DefReplyTimeout = pReplyTimeout;
|
||||||
ReplyTimeout = pReplyTimeout;
|
ReplyTimeout = pReplyTimeout;
|
||||||
MaxRetries = pMaxRetries;
|
MaxRetries = pMaxRetries;
|
||||||
return true;
|
return true;
|
||||||
@@ -456,12 +457,13 @@ bool CDeviceCore::DeviceOnline( TDevice * Device, bool Online )
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void CDeviceCore::SetWaitForReply()
|
void CDeviceCore::SetWaitForReply( int CustomTimeout )
|
||||||
{
|
{
|
||||||
// Start timer
|
// Start timer
|
||||||
SetStartTime( &PollWait );
|
SetStartTime( &PollWait );
|
||||||
|
|
||||||
// Set flag
|
// Set flag
|
||||||
|
ReplyTimeout = (CustomTimeout >= 0)? CustomTimeout : DefReplyTimeout;
|
||||||
WaitingForReply = true;
|
WaitingForReply = true;
|
||||||
InvalidReply = false;
|
InvalidReply = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ protected:
|
|||||||
// Reply
|
// Reply
|
||||||
bool WaitingForReply; // Command sent, waiting for reply
|
bool WaitingForReply; // Command sent, waiting for reply
|
||||||
bool InvalidReply; // Invalid reply received
|
bool InvalidReply; // Invalid reply received
|
||||||
|
long DefReplyTimeout; // Default Max waiting time for reply
|
||||||
long ReplyTimeout; // Max waiting time for reply
|
long ReplyTimeout; // Max waiting time for reply
|
||||||
|
|
||||||
// Retry
|
// Retry
|
||||||
@@ -306,7 +307,7 @@ protected:
|
|||||||
virtual bool DeviceOnline( TDevice * Device, bool Online );
|
virtual bool DeviceOnline( TDevice * Device, bool Online );
|
||||||
|
|
||||||
// Handle Reply Timing
|
// Handle Reply Timing
|
||||||
virtual void SetWaitForReply();
|
virtual void SetWaitForReply( int CustomTimeout = -1 );
|
||||||
virtual void ValidReplyReceived();
|
virtual void ValidReplyReceived();
|
||||||
virtual bool CheckReplyTimeout();
|
virtual bool CheckReplyTimeout();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user