NCM_DetectBoardsEx( )
Description | Cautions | Example | /Error Codes | See Also
NCMRetCode NCM_DetectBoardsEx( pdetectInfo, pdetectResult )
NCM_DETECTION_INFO *pdetectInfo NCM_DETECTION_RESULT *pdetectResult NCM_SUCCESS if success NCM error code if failure NCMApi.h synchronous Description
The NCM_DetectBoardsEx( ) function initiates auto -detection. This function initiates a process that detects any auto-detectable Intel® Dialogic boards installed on the system. For more information about auto-detection, see Section 2.6.1, Auto Detection.
The function parameters are defined as follows:
Cautions
All auto-detectable Intel® Dialogic devices in the system must be detected using either the NCM_DetectBoards( ) function or the NCM_DetectBoardsEx( ) function before the NCM_StartDlgSrv( ) function can be used to start the Intel® Dialogic System Service. Refer to Section 2.6.1, Auto Detection for information about auto-detectable Intel® Dialogic devices.
The pdetectInfo pointer points to a NCM_DETECTION_INFO structure which contains the structure size and the following two callback function pointers:
- NCM_CALLBACK_FCN: points to the function which must be called to retrieve the progress of the detection routine. If this pointer is NULL, then no progress indication can be returned.
The callback function must have the following format:
int func_name (UINT percentageCompleted, const char *message);
- percentageCompleted is an unsigned integer variable that the board detection function will fill to indicate the progress of the detection process as a percentage of overall time required for detection.
- message is a NULL-terminated character string containing a message to indicate detection progress status, such as "Detected Board #5".
When using the NCM_DETECTION_INFO structure, the structure size must be filled into the first parameter of the structure, structSize.
- NCM_PCDFILE_SELECTION_FCN: used to determine the PCD file to be associated with each DM3 board. This pointer should be set to NULL for non-DM3 boards. If this pointer is NULL for DM3 boards, then a NCME_PCD_SELECTION error is returned.
The selection function must have the following format:
int func_name (NCMFileInfo *fileList, size_t numFiles, NCMDevInfo devinfo, int * index);
For further details on data structure format, see Section 3.2, Structures for Extended Functions.
Example
#include "NCMApi.h" int CallBackFunc( UINT uipercent, const char *message ) { printf ("%d percent complete \n Status message: %s \n", uipercent, message); return TRUE; } int GetPCDFile (NCMFIleInfo *fileList, int numFiles, NCMDevInfo devInfo, int *index) { //if necessary, print out the devInfo, it contains information about the device //for (int i=0; I<numFiles; I ++) //displays file index and file name printf ("index %d, file name = %s\n", i, fileList [i]); printf ("please select file index"); scanf ("%d", index); return *index; } bool DetectBoardsEx ( ) { NCMRetCode ncmRc = NCM_SUCCESS; NCM_DETECTION_INFO detectionInfo; NCM_DETECTION_RESULT detectionResult; detectionInfo.structSize = sizeof (NCM_DETECTION_INFO); detectionInfo.callbackFcn = (NCM_CALLBACK_FCN*) CallBackFunc; detectioninfo.pcdFileSelectionFcn = (NCM_PCDFILE_SELECTION_FCN*) GetPCDFile; ncmRc = NCM_DetectBoardsEx (detectionInfo, detectionResult); if (ncmRc ! = NCM_SUCCESS) { NCMErrorMsg * pncmErrorMsg = NULL; ncmRc = NCM_GetErrorMsg (ncmRc, & pncmErrorMsg); if (ncmRc == NCM_SUCCESS) printf ("NCM_DetectBoardsEx ( ) returns error: %s \n", pncmErrorMsg -> name); else { printf ("NCM_DetectBoardsEx ( ) returns unknown error \n"; NCM_Dealloc (pncmErrorMsg); return false; } else { printf (NCM_DetectBoardsEx ( ) success, detected %d boards \n", detectionResult.totalDetectedBoards); return true; } } }/Error Codes
See Also
Click here to contact Telecom Support Resources
Copyright 2003, Intel Corporation