コード例 #1
0
/**
 * \\n
 * \date 08-November-2005\n
 * \brief Creates the measurement SRV object
 *
 * Function Scope \e Public.\n
 * \param hOS - handle to the OS object.\n
 * \return a handle to the measurement SRV object, NULL if an error occurred.\n
 */
TI_HANDLE MacServices_measurementSRV_create( TI_HANDLE hOS )
{
	measurementSRV_t* pMeasurementSRV;

	/* allocate the measurement SRV object */
	pMeasurementSRV = os_memoryAlloc( hOS, sizeof(measurementSRV_t));
	if ( NULL == pMeasurementSRV ) {
		WLAN_OS_REPORT( ("ERROR: Failed to create measurement SRV object."));
		return NULL;
	}

	/* nullify the object */
	os_memoryZero( hOS, pMeasurementSRV, sizeof(measurementSRV_t));

	/* store OS handle */
	pMeasurementSRV->hOS = hOS;

	/* allocate the SM */
	if ( TI_OK != fsm_Create( hOS, &(pMeasurementSRV->SM), MSR_SRV_NUM_OF_STATES, MSR_SRV_NUM_OF_EVENTS )) {
		pMeasurementSRV->SM = NULL;
		WLAN_OS_REPORT(("Failed to create measurement SRV state machine.\n"));
		MacServices_measurementSRV_destroy( pMeasurementSRV );
		return NULL;
	}

	return (TI_HANDLE)pMeasurementSRV;
}
コード例 #2
0
ファイル: MacServices.c プロジェクト: bluewater-cn/ti_wilink
/****************************************************************************************
 *                        MacServices_destroy                                                    *
 *****************************************************************************************
DESCRIPTION: destroys MacServices module
                                                                                                                               
INPUT:          hMacServices - handle to the Mac Services object.
OUTPUT:     
RETURN:     
****************************************************************************************/
void MacServices_destroy( TI_HANDLE hMacServices ) 
{
    MacServices_t *pMacServices = (MacServices_t*)hMacServices;
    
    /* destroy all SRV modules */
    if ( NULL != pMacServices->hScanSRV )
    {
        MacServices_scanSRV_destroy( pMacServices->hScanSRV );
    }
    if ( NULL != pMacServices->hMeasurementSRV )
    {
        MacServices_measurementSRV_destroy( pMacServices->hMeasurementSRV );
    }

    if(pMacServices->hPowerSrv)
    powerSrv_destroy(pMacServices->hPowerSrv);

    /* free the Mac services allocated context */
    os_memoryFree( pMacServices->hOS, (TI_HANDLE)pMacServices , sizeof(MacServices_t) );
}