beautypg.com

Sensoray 2410 API User Manual

Page 28

background image

Sensoray 24xx Programming Guide

24

Model 2410 Digital I/O Module

Notes:

This function disables event capturing on an arbitrary set of digital input channels.

The boolean bits in

flags[]

specify the channels that are to be affected. A boolean True disables capture on the

associated channel, while False will leave the channel’s capture mode unchanged. When this function disables
capturing on a channel, the channel’s previous capture mode (i.e., one-shot or continuous) is no longer in effect.

If asynchronous event notification is enabled, the application’s callback function will be called with message type

CAPMSG_DISABLED

when the specified channels become disabled for capture.

Example:

// Disable event capturing on channels 0 through 15.

u32 err = ERR_NONE;
u16 flags[3] = { 0, 0, 0xFFFF };

if

( !s2410_WriteCapDisable( sess, &err, flags ) )

printf( "Error: %s\n", s24xx_ErrorText(err) );

6.4.9 s2410_WriteCapTimer()

Function:

Start a timer that will notify the client if no events are captured within a time interval.

Prototype:

BOOL s2410_WriteCapTimer( SESSION sess, u32 *err, u16 msec );

Returns:

True if the operation was successful, otherwise False is returned and

err

will contain the associated error code.

Notes:

This API function starts a timer that monitors the elapsed time between successive event captures. If no events are
captured within the specified time interval, the application’s notification callback will be called with message type

CAPMSG_EVENT

, with no capture flags asserted. This can be useful in cases where the application expects an event to

be captured within a certain time frame but no events occur during that time.

The timer is cancelled if an event is captured within the specified time interval. If the timer is started and an event
is captured before the time interval expires, the timer will no longer be active.

The application’s callback function will be called with message type

CAPMSG_TIMER

when the timer is started or

cancelled by this function in order to inform the application of the change in the timer’s operational status.

s2410_WriteCapTimer()

should not be called if the application employs polling to detect captured events. It

should only be called when asynchronous event notifications have been enabled by a previous call to

s2410_AsyncCapBegin()

.

Example:

// Send a notification if no events are captured within the next 5 seconds.

u32 err = ERR_NONE;

if

( !s2410_WriteCapTimer( sess, &err, 5000 ) )

printf( "Error: %s\n", s24xx_ErrorText(err) );

Argument

Description

sess

Session handle obtained from

s24xx_SessionOpen()

.

err

Pointer to error code. See Section 4.3.1 for details.

msec

Time interval, in milliseconds, to wait for an event before issuing a client
notification. Set to zero to disable the timer.