[ Pobierz całość w formacie PDF ]

bufptr to the host retentive data partition starting at
offset.
offset Specifies the offset within the host retentive data partition to begin copying
Number of bytes to copy
length If length points beyond the end of the host retentive data partition, it is
truncated
If callback is:
NULL no callback function is executed (default)
callback Not NULL the power fail interrupt routine calls this function after
copying the data to the host retentive data partition
(if configured)
Description:
You can configure the power failure action in four ways:
" No action (default); the power failure interrupt is ignored (bufptr is NULL; callback is NULL)
" Copy a block of data to the host retentive data partition in dual port RAM (bufptr points to the data
to save; callback is NULL)
" Execute a user callback function (bufptr is NULL; callback points to the routine to call)
" Copy a block of data and execute a callback function (bufptr points to the data to save; callback
points to the routine to call)
A system typically has at least 10 milliseconds, and possibly as much as 50 milliseconds or more between
the power fail interrupt and the loss of power. The duration of this interval is a function of the power supply
and system configuration, and it varies from system to system. You might need to experiment to determine
the typical value for a particular system.
Data is copied to the host retentive data partition at the rate of approximately 1K bytes per millisecond.
Declare bufptr as static if the OC_SetupPowerFail function is used other than in main( ); otherwise
random data will be sent to the host retentive data area.
Publication 1747-6.5.3 June 1998
6 76 Library of Routines OC_SetupPowerFail Action
Return Value:
Name: Value: Description:
SUCCESS power fail action was registered successfully
2
ERR_OCACCESS handle does not have access to scanner
5
ERR_OCINIT scanner has not been initialized, see OC_InitScanner
8
ERR_OCPARAM parameter contains invalid value
Considerations:
Supported in the DOS API library only.
Example:
This example is for DOS only.
HANDLE Handle;
BYTE buffer1[100];
BYTE buffer2[100];
int retcode;
void PowerFailSave( void ) /* power fail callback routine */
{
len = 100;
OC_WriteRtcSRAM( buffer2, 0, &len ); /* Put data in protected area */
}
retcode = OC_SetupPowerFailAction( Handle, buffer1, 0, 100, PowerFailSave );
Publication 1747-6.5.3 June 1998
OC_WaitForDII Library of Routines 6 77
OC_WaitForDII Blocks the calling thread until a DII interrupt is received from the scanner or
msTimeout milliseconds have elapsed.
Syntax:
int OC_WaitForDII(HANDLE handle, DWORD msTimeout)
Parameters:
Parameter: Description:
handle Must be a valid handle returned from OC_OpenScanner
Specifies the number of milliseconds to wait
msTimeout
Set to INFINITE to wait forever
Description:
If a DII has been received since the last OCMSG_DIINT message was retrieved with the OC_PollScanner
function, OC_WaitForDII returns SUCCESS immediately.
Return Value:
Name: Value: Description:
SUCCESS a DII was received
10
ERR_RESPONSE msTimeout milliseconds elapsed without a DII
2
ERR_OCACCESS handle does not have access to scanner
Considerations:
Supported in the Windows NT API library only.
Example:
HANDLE handle;
intrc;
MSGBUF diiMSG
/* Wait for 10 seconds for a DII */
rc = OC_WaitForDII(handle, 10000);
switch(rc) {
case SUCCESS:/* got a DII */
/* fetch the DII message */
OC_PollScanner (handle,OCMSG_DIINT,&diiMSG);
break;
case ERR_OCRESPONSE:/* timed out */
printf( \nTimed out waiting for DII\n );
break;
default;
printf( \nError!\n );
break;
}
Publication 1747-6.5.3 June 1998
6 78 Library of Routines OC_WaitForEos
OC_WaitForEos Blocks the calling thread until an end-of-scan (EOS) notification is received from
the scanner or msTimeout milliseconds have elapsed.
Syntax:
int OC_WaitForEos(HANDLE handle, DWORD msTimeout)
Parameters:
Parameter: Description:
handle Must be a valid handle returned from OC_OpenScanner
Specifies the number of milliseconds to wait
msTimeout
Set to INFINITE to wait forever
Description:
If an EOS message has been received since the last OCMSG_EOS message was retrieved with the
OC_PollScanner function, OC_WaitForEos returns SUCCESS immediately.
You can use this function to synchronize a control application with the I/O scan. See the
OC_EnableEOSNotify function.
Return Value:
Name: Value: Description:
SUCCESS an EOS message was received
10
ERR_RESPONSE msTimeout milliseconds elapsed without an EOS
2
ERR_OCACCESS handle does not have access to scanner
Considerations:
Supported in the Windows NT API library only.
Publication 1747-6.5.3 June 1998
OC_WaitForEos Library of Routines 6 79
Example:
HANDLE handle;
intrc;
MSGBUF eosMSG
/* Wait for 10 seconds for the EOS */
rc = OC_WaitForEos(handle, 10000);
switch(rc) {
case SUCCESS:/* got EOS*/
/* reset the EOS event*/
OC_PollScanner (handle,OCMSG_EOS,&eosMSG);
break;
case ERR_OCRESPONSE:/* timed out */
printf( \nTimed out waiting for EOS\n );
break;
default;
printf( \nError!\n );
break;
}
Publication 1747-6.5.3 June 1998
6 80 Library of Routines OC_WaitForEosDmdIn
OC_WaitForEosDmdIn Blocks the calling thread until a demand input end-of-scan (EOS) notification is
received from the scanner or msTimeout milliseconds have elapsed.
Syntax:
int OC_WaitForEosDmdIn(HANDLE handle, DWORD msTimeout)
Parameters:
Parameter: Description:
handle Must be a valid handle returned from OC_OpenScanner
Specifies the number of milliseconds to wait
msTimeout
Set to INFINITE to wait forever
Description:
If a demand input EOS message has been received since the last OCMSG_EOS_DMDIN message was
retrieved with the OC_PollScanner function, OC_WaitForEosDmdIn returns SUCCESS immediately.
You can use this function to synchronize a control application with the I/O scan. See the
OC_EnableEOSNotify and OC_DemandInputScan functions.
Return Value:
Name: Value: Description:
SUCCESS demand input EOS message was received
10
ERR_RESPONSE msTimeout milliseconds elapsed without an EOS
2 [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • szkla.opx.pl
  •