gc_GetLinedevState( )
Termination Events | Cautions | Errors | Example | See Also
Name: int gc_GetLinedevState(linedev, type, state_buf) Inputs: Returns: Includes: Category: Mode: Platform and Technology: Description
The gc_GetLinedevState( ) function retrieves the status of the line device specified by the linedev parameter.
Termination Events
Cautions
If this function is invoked for an unsupported technology, the function fails. The error value EGC_UNSUPPORTED will be the Global Call value returned when the gc_ErrorInfo( ) function is used to retrieve the error code.
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> #include <gcisdn.h> int get_line_dev_state(void) { LINEDEV bdd; /* Board level device */ LINEDEV ldev; /* Line device */ char bdevname[40]; /* Board device name */ char ldevname[40]; /* Line device name */ int type; /* Type of line device */ int statebuf; /* Buffer to store line device state */ GC_INFO gc_error_info; /* GlobalCall error information data */ sprintf(bdevname, ":N_dtiB1:P_isdn"); sprintf(ldevname, ":N_dtiB1T1:P_isdn"); /* * Open two devices, dtiB1 and dtiB1T1. */ if(gc_OpenEx(&bdd, bdevname, EV_SYNC, &bdd) != GC_SUCCESS) { /* process error return as shown */ gc_ErrorInfo( &gc_error_info ); printf ("Error: gc_OpenEx() on devname: %s, GC ErrorValue: 0x%hx - %s, CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n", bdevname, 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); } if(gc_OpenEx(&ldev, ldevname, EV_SYNC, &ldev) != GC_SUCCESS) { /* process error return as shown */ gc_ErrorInfo( &gc_error_info ); printf ("Error: gc_OpenEx() on devname: %s, GC ErrorValue: 0x%hx - %s, CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n", ldevname, 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); } /* * Find the status of the board. * The D Channel can be in one of two states DATA_LINK_UP or * DATA_LINK_DOWN. */ type = GCGLS_DCHANNEL; if(gc_GetLinedevState(bdd, type, &statebuf) != GC_SUCCESS) { gc_ErrorInfo( &gc_error_info ); printf ("Error: gc_GetLinedevState() on linedev: 0x%lx, GC ErrorValue: 0x%hx - %s, CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n", bdd, 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); } else { printf("D Channel Status: %s\n", statebuf); } /* * Find the status of the line. * the B Channel can be in one of three states GCLS_INSERVICE, * GCLS_MAINTENANCE, or GCLS_OUT_OF_SERVICE. */ type = GCGLS_BCHANNEL; if(gc_GetLinedevState(ldev, type, &statebuf) != GC_SUCCESS) { gc_ErrorInfo( &gc_error_info ); printf ("Error: gc_GetLinedevState() on linedev: 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); } else { printf("B Channel Status: %s\n", statebuf); } gc_Close(bdd); gc_Close(ldev); return (0); }See Also
Click here to contact Telecom Support Resources
Copyright 2003, Intel Corporation