5 status and control, 1 s24xx_settimeout(), 2 s24xx_resetio() – Sensoray 2410 API User Manual
Page 15

Sensoray 24xx Programming Guide
11
Module-Independent Functions
5.5 Status and Control
5.5.1 s24xx_SetTimeout()
Function:
Configure a session’s network watchdog timer.
Prototype:
BOOL s24xx_SetTimeout( SESSION sess, u32 *err, u32 count, u32 units, u32 action );
Returns:
True if the operation was successful, otherwise False is returned and
err
will contain the associated error code.
Notes:
Each session employs a timer to detect the absence of communications with clients. If no communication is
received from a client within the specified time interval, the network watchdog will time-out and the specified
action will be taken. Upon time-out, the session is automatically closed. This behavior ensures that the server
session will be freed for other uses and all I/O will be (optionally) reset in the event the client shuts down
abnormally.
By default, the network watchdog timer is set to five minutes when a session is opened, and
action
is set to
ACTION_NONE
. If these defaults suit the application then there is no need to call this function.
Upon executing this function, the new time interval is effective immediately and the watchdog timer is restarted.
The time interval may be set to zero to disable the watchdog timer. This should be avoided except during
application development, as it could make it impossible to open new sessions if the client fails to properly close
previous sessions.
Example:
// Set the watchdog interval to 3.5 seconds, with no I/O reset upon time-out.
u32 err = ERR_NONE;
if
( !s24xx_SetTimeout( sess, &err, 3500, UNITS_MILLISECONDS, ACTION_NONE ) )
printf( "Error: %s\n", s24xx_ErrorText(err) );
5.5.2 s24xx_ResetIo()
Function:
Reset all I/O interfaces to their default power-up condition.
Prototype:
BOOL s24xx_ResetIo( HSESSION sess, u32 *err );
Returns:
True if the operation was successful, otherwise False is returned and
err
will contain the associated error code.
Notes:
This function resets all I/O interfaces on the target module. For example, digital and analog outputs will be set to
their default power-up states. The module will not reboot, and the session used to invoke this function will remain
open. Typically, this function is only used during application development.
Example:
// Reset all I/O interfaces.
Argument
Description
sess
Session handle obtained from
s24xx_SessionOpen()
.
err
Pointer to error code. See Section 4.3.1 for details.
count
Time interval specified in seconds or milliseconds. Set to zero to disable watchdog
(not recommended for production software).
units
Time units:
UNITS_MILLISECONDS
or UNITS_SECONDS
action
Action to be taken upon time-out:
ACTION_NONE -
terminate the session, but don’t reset any I/O interfaces
ACTION_RESET -
terminate the session and reset all I/O interfaces
Argument
Description
sess
Session handle obtained from
s24xx_SessionOpen()
.
err
Pointer to error code. See Section 4.3.1 for details.