/** * \\n * \date 08-November-2005\n * \brief Handle a MEASURE_START_REQUEST event by requesting driver mode.\n * * Function Scope \e Public.\n * \param hMeasurementSrv - handle to the Measurement SRV object.\n * \return always TI_OK.\n */ TI_STATUS measurementSRVSM_requestDriverMode( TI_HANDLE hMeasurementSRV ) { measurementSRV_t *pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV; TI_STATUS PSStatus; TTwdParamInfo paramInfo; /* get the current channel */ paramInfo.paramType = TWD_CURRENT_CHANNEL_PARAM_ID; cmdBld_GetParam (pMeasurementSRV->hCmdBld, ¶mInfo); /* check if the request is on the serving channel */ if ( paramInfo.content.halCtrlCurrentChannel == pMeasurementSRV->msrRequest.channel ) { /* Switch Power Save SRV to driver mode w/o changing power save mode*/ PSStatus = powerSrv_ReservePS( pMeasurementSRV->hPowerSaveSRV, POWER_SAVE_KEEP_CURRENT, TI_TRUE, hMeasurementSRV, MacServices_measurementSRV_powerSaveCB ); } else { /* Switch Power Save SRV to driver mode with PS mode */ PSStatus = powerSrv_ReservePS( pMeasurementSRV->hPowerSaveSRV, POWER_SAVE_ON, TI_TRUE, hMeasurementSRV, MacServices_measurementSRV_powerSaveCB ); } switch (PSStatus) { case POWER_SAVE_802_11_IS_CURRENT: TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Driver mode entered successfully\n"); /* send a power save success event */ return measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState), MSR_SRV_EVENT_DRIVER_MODE_SUCCESS ); case POWER_SAVE_802_11_PENDING: case TI_OK: TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Driver mode pending\n"); break; default: /* Error */ TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": Error %d when requesting driver mode\n",PSStatus); /* Set the return status to TI_NOK */ pMeasurementSRV->returnStatus = PSStatus; /* send a power save failure event */ measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState), MSR_SRV_EVENT_DRIVER_MODE_FAILURE ); break; } return TI_OK; }
/**************************************************************************************** * MacServices_powerSrv_ReservePS * **************************************************************************************** DESCRIPTION: This function is a wrapper for the power server's powerSrv_ReservePS function INPUT: - hMacServices - handle to the Mac services object. - psMode - Power save/Active request - sendNullDataOnExit - - powerSaveCBObject - handle to the Callback function module. - powerSaveCompleteCB - Callback function - for success/faild notification. OUTPUT: RETURN: TI_STATUS - TI_OK / PENDING / TI_NOK. ****************************************************************************************/ TI_STATUS MacServices_powerSrv_ReservePS( TI_HANDLE hMacServices, E80211PsMode psMode, TI_BOOL sendNullDataOnExit, void * powerSaveCBObject, TPowerSaveCompleteCb powerSaveCompleteCB) { MacServices_t *pMacServices = (MacServices_t*)hMacServices; return powerSrv_ReservePS(pMacServices->hPowerSrv,psMode,sendNullDataOnExit,powerSaveCBObject,powerSaveCompleteCB); }
/** * \\n * \date 10-Jan-2005\n * \brief Request to enter driver mode from the power manager module.\n * * Function Scope \e Private.\n * \param hScanSrv - handle to the scan SRV object.\n * \return TI_OK if successful, TI_NOK otherwise.\n */ TI_STATUS scanSRVSM_requestPS( TI_HANDLE hScanSrv ) { scanSRV_t *pScanSRV = (scanSRV_t*)hScanSrv; TI_STATUS psStatus; psStatus = powerSrv_ReservePS( pScanSRV->hPowerSrv, pScanSRV->psRequest, pScanSRV->bSendNullData, hScanSrv, MacServices_scanSRV_powerSaveCB); switch (psStatus) { /* if successful */ case POWER_SAVE_802_11_IS_CURRENT: /* send a PS_SUCCESS event */ return scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_SUCCESS ); /* if pending */ case POWER_SAVE_802_11_PENDING: case TI_OK: /* send a PS_PEND event */ return scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_PEND ); /* if not successful */ default: /* mark not to exit from driver mode (no entry was performed) */ pScanSRV->bExitFromDriverMode = TI_FALSE; /* if still wishing to scan */ if ( pScanSRV->bScanOnDriverModeFailure ) { /* send a PS_SUCCESS event - scan will proceed regardless of the error */ scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_SUCCESS ); } /* otherwise, return */ else { /* mark the return code */ pScanSRV->returnStatus = TI_NOK; /* send a PS_FAIL event */ scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_FAIL ); } break; } return TI_OK; }