gc_Close( )
Termination Events | Cautions | Errors | Example | See Also
Name: int gc_Close(linedev) Inputs: Returns: Includes: Category: Mode: Platform and Technology: †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.
linedev Global Call line device to close Termination Events
Cautions
- The gc_Close( ) function only affects the link between the calling process and the device. Other processes and devices are unaffected.
- If a media resource is attached to the linedev device, the media resource will be closed by the Global Call API. To keep the media resource open for other operations, use the gc_Detach( ) function to detach the media resource from the Global Call device before issuing the gc_Close( ) function.
- The gc_Close( ) function must not be called from a Standard Runtime Library (SRL) handler. If the gc_Close( ) function is called from an SRL handler, the application may hang or SRL functionality may fail.
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
- gc_AttachResource( )
- gc_Attach( ) (deprecated)
- gc_Detach( )
- gc_OpenEx( )
Click here to contact Telecom Support Resources
Copyright 2003, Intel Corporation