PREV TOC HOME INDEX NEXT


gc_Close( )


Termination Events | Cautions | Errors | Example | See Also

Name: int gc_Close(linedev)
Inputs:

LINEDEV linedev

  • Global Call line device handle
Returns:

0 if successful

<0 if failure

Includes:

gclib.h

gcerr.h

Category:

system controls and tools

Mode:

synchronous

Platform and Technology:

All

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

Description

The gc_Close( ) function closes a previously opened device. The application can no longer access the device via the linedev parameter and inbound call notification is disabled. Other devices are not affected. The gc_Close( ) function should be issued while the line device is in the Null call state. The Null call state occurs immediately after a call to gc_OpenEx( ), gc_ResetLineDev( ), or gc_ReleaseCallEx( ).

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

Parameter

Description

linedev Global Call line device to close

Termination Events

None

Cautions

Errors

If this function returns <0 to indicate failure, use the gc_ErrorInfo( ) function to retrieve the reason for the error. 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]; 
struct linebag *pline;               /* pointer to access line device */ 
int close_line_device(int port_num)
{
    LINEDEV     ldev;             /* GlobalCall line device handle */
    GC_INFO     gc_error_info;    /* GlobalCall error information data */ 
    /* Find info for this time slot, specified by 'port_num' */
    /* (Assumes port_num is valid) */
    pline = port + port_num;
    ldev = pline -> ldev;
    /*
     * close the line device to remove the channel from service
     */
    if (gc_Close(ldev) != GC_SUCCESS) {
        /* process error return as shown */
        gc_ErrorInfo( &gc_error_info );
        printf ("Error: gc_Close() on device handle: 0x%lx, GC ErrorValue: 0x%hx - %s, CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n",
               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);    }
    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