PREV TOC HOME INDEX NEXT


gc_ResetLineDev( )


Termination Events | Cautions | Errors | Example | See Also

Name: int gc_ResetLineDev(linedev, mode)
Inputs:

LINEDEV linedev

  • Global Call line device handle
 

unsigned long mode

  • async or sync
Returns:

0 if successful

<0 if failure

Includes:

gclib.h

gcerr.h

Category:

system controls and tools

Mode:

asynchronous or synchronous

Platform and Technology:

All

See the Global Call Technology User's Guides for additional information.

Description

The gc_ResetLineDev( ) function resets the line device state and disconnects calls on the line device. All calls being set up are aborted. This function typically is used after a recovery from a trunk error, a recovery from an alarm condition, or to reset the channel to the Null state.

When used in asynchronous mode, the GCEV_RESETLINEDEV event indicates successful termination of the gc_ResetLineDev( ) function. After receiving this event, the application must issue a new gc_WaitCall( ) function to receive the next incoming call on the channel.

See also the appropriate Global Call Technology User's Guide for technology-specific information.

Parameter

Description

linedev Global Call line device
mode set to EV_ASYNC for asynchronous execution or to EV_SYNC for synchronous execution

Termination Events

GCEV_RESETLINEDEV
indicates that the function was successful, that is, the line device was reset to the Null state.
GCEV_RESTARTFAIL
indicates that the function failed. See the "Error Handling" section in the Global Call API Programming Guide.
GCEV_TASKFAIL
indicates that the function failed.
Note: See the appropriate Global Call Technology User's Guide for technology-specific information.

Cautions

Errors

If this function returns <0 to indicate failure, use the gc_ErrorInfo( ) function for error information. If the GCEV_RESTARTFAIL or GCEV_TASKFAIL event is received, use the gc_ResultInfo( ) function to retrieve information about the event. See the "Error Handling" section in the Global Call API Programming Guide. All Global Call error codes are defined in the gcerr.h file. If the error returned is technology specific, see the technology-specific error header file(s) for the error definition (for example, ccerr.h or isdnerr.h file for the ISDN call control library).

Example

#include <stdio.h>
#include <srllib.h>
#include <gclib.h>
#include <gcerr.h>
#define MAXCHAN   30      /* max. number of channels in system */
/*
 * Data structure which stores all information for each line
 */
struct linebag {
    LINEDEV  ldev;         /* GlobalCall line device handle */
    CRN      crn;          /* GlobalCall API call handle */
    int      state;        /* state of first layer state machine */
} port[MAXCHAN+1]; 
/*
 * Assume the following has been done:
 *    1. Opened line devices for each time slot on DTIB1.
 *    2. Application has received GCEV_BLOCKED due to an alarm
 *       condition on the line
 *    3. Application has received GCEV_UNBLOCKED due to alarm
 *       recovered
 * 
 * At this point, the application can 'reset'
 * all of it's line devices back to normal.
 * (Alternatively, this could be called at any time)
 */ 
int restart(void)
{
    int      i;               /* index for 'port' */
    int      ts;              /* network time slot number */
    GC_INFO  gc_error_info;   /* GlobalCall error information data */ 
    /*
     * Clean up and get ready to generate/accept calls again.
     */
    for (ts = 1,i=1; ts <= MAXCHAN; ts++,i++) {
       if (gc_ResetLineDev(port[i].ldev, EV_SYNC) != GC_SUCCESS) {
           /* get cause value and process error */
           gc_ErrorInfo( &gc_error_info );
           printf ("Error: gc_ResetLineDev() on device handle: 0x%lx, GC ErrorValue: 0x%hx - %s, 
                 CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n",
                 port[i].ldev, gc_error_info.gcValue, gc_error_info.gcMsg, 
                 gc_error_info.ccLibId, gc_error_info.ccLibName,
                 gc_error_info.ccValue, gc_error_info.ccMsg);
          return (gc_error_info.gcValue); 
       } 
       /*
        * Application will need to re-issue gc_WaitCall() to wait
        * for incoming calls
        */
    }
    return (0);
} 

See Also


PREV TOC HOME INDEX NEXT

Click here to contact Telecom Support Resources

Copyright 2003, Intel Corporation
All rights reserved
This page generated February, 2003