This chapter offers advice and suggestions to guide programmers in designing and coding a Dialogic SCX160 SCxbus Adapter application for a Windows environment.
This chapter offers advice and suggestions to guide programmers in designing and coding a Dialogic SCX160 SCxbus Adapter application for a Windows environment.
This section provides SCX160 SCxbus Adapter programming guidelines:
9.1.1. General GuidelinesGeneral guidelines for writing Dialogic applications are explained in the following sections:
Check Return CodesMost SCX160 SCxbus Adapter library functions return an error code if they fail. Any call to an SCX160 SCxbus Adapter library function should therefore check for a return value indicating an error. This can be done using a format similar to the following:
if (scx_xxxxx(devh, arguments) == -1) {
printf("ERROR: scx_xxxxx( ) failed: %s (0x%X)\n"'
ATDV_ERRMSG(devh), ATDV_LASTERR(devh));
/* Error Handling Routine */
.
.
}
/* Successful Function Call - Continue Processing ... */
Use Symbolic DefinesApplications containing numerical values for defines are subject to obsolescence and require frequent modification. In general, do not use a numerical value in your application when an equivalent symbolic define is available.
Include Header FilesVarious header files provided with the Package Release must be included in your application. These files provide equates, structures and prototypes needed to compile application programs.
9.1.2. InitializationBefore an SCX160 SCxbus Adapter application performs any processing, it should initialize the SCX160 SCxbus Adapter hardware to reflect the physical configuration of your system and set the parameters necessary to support the application. Tasks performed as part of initialization generally include:
The tasks above are accomplished using the following library functions:
Set Hardware ConfigurationUse scx_setbrdparm( ) to set hardware configuration, clocking configuration and error threshold levels. See scx_setbrdparm( ) function in Chapter 6. Function Reference for specific settings.
Set Event Mask on SCX160 SCxbus AdapterUse the scx_setevtmsk( ) function for setting and the scx_clrevtmsk( ) function for clearing the mask for alarm events.
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation