DTWAIN_SetFeederWaitTime

Top  Previous  Next

The DTWAIN_SetFeederWaitTime allows devices with document feeders that can detect whether paper is placed within the feeder to wait for a specified number of seconds before automatically starting the acquisition process.

 

DTWAIN_BOOL DTWAIN_SetFeederWaitTime (

DTWAIN_SOURCE

Source,

LONG 

WaitTime,

LONG

Flags ):

 

Parameters

Source

An open TWAIN Source.

 

WaitTime

   Maximum number of seconds to wait before the acquisition starts or terminates with no paper in the feeder    


Flags

Determines action to take if a timeout of the feeder occurs.

 

Return Values

If successful, the return value is TRUE (1).  Otherwise the return value is FALSE (0), and DTWAIN_GetLastError is set to the reason for the failure.

 

Comments

The DTWAIN_SetFeederWaitTime allows devices with document feeders that can detect whether paper is placed within the feeder to wait for a specified number of seconds before automatically starting the acquisition process.  Once paper is detected in the feeder, the acquisition will start immediately.  


DTWAIN_SetFeederWaitTime() only works if the device's user-interface is not shown during the acquisition process, i.e. your application has set the DTWAIN_Acquire... API function's show user-interface parameter to FALSE.  If the user-interface is shown, DTWAIN_SetFeederWaitTime() has no effect.


The Source argument is the TWAIN Data Source to apply DTWAIN_SetFeederWaitTime to.


WaitTime is the maximum number of seconds to wait before the acquisition starts or terminates with no paper in the feeder.


If WaitTime is 0, then no wait time is applied, and the acquisition starts immediately, whether or not there is paper in the feeder.  This is the normal behavior for the acquisition to run when no user-interface is shown.  Some TWAIN drivers will also inform the user to "please place paper in scanner" or similar error if no paper is detected.


If WaitTime is DTWAIN_WAIT_INFINITE, then the wait time is infinite until paper is placed in the device.  Use DTWAIN_WAIT_INFINITE with caution, since the application will be stuck in a timing loop until paper is placed in the feeder, or the thread that contains the TWAIN instance is terminated (if it is the main thread of the application, then the only way to terminate the application is to use the Windows Task Manager or similar to close the process).


Any other value for WaitTime will allow the feeder to wait for the number of seconds before paper is placed in the feeder, and once the paper is placed in the feeder, the acquisition starts.  If the time has elapesed without paper placed in the feeder, the Flags argument determines what should occur.


The Flags determines what occurs if the number of seconds have elapsed without paper placed in the feeder.  Flags will be either DTWAIN_FEEDER_TERMINATE or DTWAIN_FEEDER_USEFLATBED.   


If Flags is DTWAIN_FEEDER_TERMINATE, the acquisition terminates with a DTWAIN_TN_FEEDERTIMEOUT notification sent back to the application.  If Flags is DTWAIN_FEEDER_USEFLATBED, the acquisition continues, but will use the flatbed portion of the device if the device has an available flatbed.


Example (C/C++):


The small example shows usage of DTWAIN_SetFeederWaitTime.  When DTWAIN_AcquireNative() is called, if the device has a feeder that can detect paper, a maximum of 30 seconds will elapse before the acquisition is terminated.  If before 30 seconds has elapsed, paper is placed in the feeder, the acquisition will immediately start:


// Assume that Source is pointing to a valid TWAIN Data Source...

 

// Call function to set the wait time

BOOL bOK = DTWAIN_SetFeederWaitTime(Source, 30, DTWAIN_FEEDER_TERMINATE);

if ( bOK )  {

   // The value was set successfully

}

else {

   LONG lastError = DTWAIN_GetLastError();  // This will have the reason the wait time could not be set

   //...

}


// The wait time has effect only if the "show ui" parameter is FALSE

DTWAIN_AcquireNative(Source, DTWAIN_PT_DEFAULT,  DTWAIN_MAXACQUIRE, 

                                            FALSE , // This must be FALSE (this is the show-UI parameter)

                                            FALSE, NULL);  


 

Prerequisite Function Call(s)

DTWAIN_SysInitialize

DTWAIN_SelectSource