Beispiel #1
0
TI_STATUS MacServices_powerSrv_ReleasePS(   TI_HANDLE                   hMacServices,
                                    TI_BOOL                        sendNullDataOnExit,
                                    void *                          powerSaveCBObject,
                                    TPowerSaveCompleteCb              powerSaveCompleteCB)
{
    MacServices_t *pMacServices = (MacServices_t*)hMacServices;

    return powerSrv_ReleasePS(pMacServices->hPowerSrv,sendNullDataOnExit,powerSaveCBObject,powerSaveCompleteCB);
}
Beispiel #2
0
TI_STATUS scanSRVSM_releasePS( TI_HANDLE hScanSrv )
{
      scanSRV_t *pScanSRV = (scanSRV_t*)hScanSrv;
      TI_STATUS psStatus;
    
     /* stop timer */
    if ( TI_TRUE == pScanSRV->bTimerRunning )
    {
        tmr_StopTimer (pScanSRV->hScanSrvTimer);
        pScanSRV->bTimerRunning = TI_FALSE;
    }
  
    /* if exit from driver mode requested, do so */
    if ( TI_TRUE == pScanSRV->bExitFromDriverMode )
    {
        /* here we need to get an answer if we succeeded to exit driver mode */
 
        psStatus = powerSrv_ReleasePS(  pScanSRV->hPowerSrv,
                                pScanSRV->bSendNullData,
                                hScanSrv,
                                MacServices_scanSRV_powerSaveCB);


    }
    else            /* no need to exit PS - send PS_SUCCESS */
    {
        return scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_SUCCESS );
    }


    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:
        /* stay in the PS_EXIT state */
        break; 
        
        /* if not successful */
    default:
        
        /* send a PS_FAIL event */
        return scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_FAIL );

    }

    return TI_OK;
}
Beispiel #3
0
/**
 * \\n
 * \date 08-November-2005\n
 * \brief handle a START_FAILURE event by exiting driver mode and calling the complete CB.\n
 *
 * Function Scope \e Public.\n
 * \param hMeasurementSrv - handle to the Measurement SRV object.\n
 * \return always TI_OK.\n
 */
TI_STATUS measurementSRVSM_measureStartFailure( TI_HANDLE hMeasurementSRV )
{
	measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;

	/* This function can be called from within a request context (if the driver mode entry process
	   was immediate), or from the driver mode CB context. Regardless of teh context in which it runs,
	   The error indicates that something is wrong in the HAL. There is no way to solve this (other than debug it).
	   The error is either indicating by the measurement start API return status (if still in the request context),
	   or by calling the response (if available, only in GWSI) and complete CBs with invalid status */

	/* Switch Power save SRV back to user mode */
	powerSrv_ReleasePS( pMeasurementSRV->hPowerSaveSRV, pMeasurementSRV->bSendNullDataWhenExitPs, NULL, NULL );

	/* if we are running within a request context, don't call the CB! The startMeasurement function
	   will return an invalid status instead */
	if ( TI_FALSE == pMeasurementSRV->bInRequest )
	{
		/* if a response CB is available (GWSI) call it */
		if ( NULL != pMeasurementSRV->commandResponseCBFunc )
		{
			pMeasurementSRV->commandResponseCBFunc( pMeasurementSRV->commandResponseCBObj, TI_NOK );
		}

		/* if a complete CB is available (both GWSI and TI driver), call it */
		if ( NULL != pMeasurementSRV->measurmentCompleteCBFunc )
		{
			/* mark that all types has failed */
			TI_INT32 i;
			for ( i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++ )
			{
				pMeasurementSRV->msrReply.msrTypes[ i ].status = TI_NOK;
			}
			/* call the complete CB */
			pMeasurementSRV->measurmentCompleteCBFunc( pMeasurementSRV->measurementCompleteCBObj,
			        &(pMeasurementSRV->msrReply));
		}
		else
		{
			TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": Start measurement failure and response and complete CBs are NULL!!!\n");
		}
	}

	return TI_OK;
}
Beispiel #4
0
/**
 * \\n
 * \date 08-November-2005\n
 * \brief Handle a STOP_COMPLETE event by exiting driver mode and calling the complete CB.\n
 *
 * Function Scope \e Public.\n
 * \param hMeasurementSrv - handle to the Measurement SRV object.\n
 * \return always TI_OK.\n
 */
TI_STATUS measurementSRVSM_completeMeasure( TI_HANDLE hMeasurementSRV )
{
	measurementSRV_t *pMeasurementSRV = (measurementSRV_t *)hMeasurementSRV;

	/* Switch Power Save SRV back to user mode */
	powerSrv_ReleasePS( pMeasurementSRV->hPowerSaveSRV, pMeasurementSRV->bSendNullDataWhenExitPs, NULL, NULL );

	/* if the response CB is still pending, call it (when requestExpiryTimeStamp was reached) */
	if ( NULL != pMeasurementSRV->commandResponseCBFunc )
	{
		pMeasurementSRV->commandResponseCBFunc( pMeasurementSRV->commandResponseCBObj, TI_OK );
	}

	/* call the complete CB */
	if ( NULL != pMeasurementSRV->measurmentCompleteCBFunc )
	{
		pMeasurementSRV->measurmentCompleteCBFunc( pMeasurementSRV->measurementCompleteCBObj,
		        &(pMeasurementSRV->msrReply));
	}

	return TI_OK;
}
Beispiel #5
0
/**
 * \\n
 * \date 08-November-2005\n
 * \brief Handle a STOP_REQUEST event when in WAIT_FOR_DRIVER_MODE state by exiting driver mode.
 *
 * Function Scope \e Public.\n
 * \param hMeasurementSrv - handle to the Measurement SRV object.\n
 * \return always TI_OK.\n
 */
TI_STATUS measurementSRVSM_stopFromWaitForDriverMode( TI_HANDLE hMeasurementSRV )
{
	measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;

	/* Switch Power Save SRV back to user mode */
	powerSrv_ReleasePS( pMeasurementSRV->hPowerSaveSRV, pMeasurementSRV->bSendNullDataWhenExitPs, NULL, NULL );

	/* if we are not running within a stop request context (shouldn't happen), call the CBs */
	if ( TI_FALSE == pMeasurementSRV->bInRequest )
	{
		TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": stop from wait for driver mode: not within a request context?!? \n");

		/* call the response CB - this shouldn't happen, as only GWSI has response CB, and it shouldn't call
		   stop before driver */
		if ( NULL != pMeasurementSRV->commandResponseCBFunc )
		{
			TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": stop from wait for driver mode: command response CB is not NULL?!? \n");
			pMeasurementSRV->commandResponseCBFunc( pMeasurementSRV->commandResponseCBObj, TI_OK );

			pMeasurementSRV->commandResponseCBFunc = NULL;
			pMeasurementSRV->commandResponseCBObj = NULL;
		}
		/* call the complete CB */
		if ( NULL != pMeasurementSRV->measurmentCompleteCBFunc )
		{
			/* mark that all types has failed */
			TI_INT32 i;
			for ( i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++ )
			{
				pMeasurementSRV->msrReply.msrTypes[ i ].status = TI_NOK;
			}
			/* call the complete CB */
			pMeasurementSRV->measurmentCompleteCBFunc( pMeasurementSRV->measurementCompleteCBObj,
			        &(pMeasurementSRV->msrReply));
		}
		else
		{
			TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": stop from wait for driver mode and response CB is NULL!!!\n");
		}
	}
	/* we are within a stop request context */
	else
	{
		/* if the command response Cb is valid, send a measure stop command to the FW -
		   although it is not necessary, we need it to get a different context for the command response.
		   This shouldn't happen, as only GWSI has command response, and it shouldn't call stop measure
		   before it got the commadn response for start measure */
		if ( NULL != pMeasurementSRV->commandResponseCBFunc )
		{
			/* shouldn't happen - a command response is valid (GWSI) and stop measure called
			   before measure start response was received (driver) */
			TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": stop from wait for driver mode - within request context and command response is not NULL?!?\n");

			cmdBld_CmdMeasurementStop (pMeasurementSRV->hCmdBld,
			                           (void *)pMeasurementSRV->commandResponseCBFunc,
			                           pMeasurementSRV->commandResponseCBObj);

			pMeasurementSRV->commandResponseCBFunc = NULL;
			pMeasurementSRV->commandResponseCBObj = NULL;
		}
		if ( NULL != pMeasurementSRV->measurmentCompleteCBFunc )
		{
			/* Note: this is being called from request context, but there's npthing else that can be done */
			/* mark that all types has failed */
			TI_INT32 i;
			for ( i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++ )
			{
				pMeasurementSRV->msrReply.msrTypes[ i ].status = TI_NOK;
			}
			/* call the complete CB */
			pMeasurementSRV->measurmentCompleteCBFunc( pMeasurementSRV->measurementCompleteCBObj,
			        &(pMeasurementSRV->msrReply));
		}
	}

	return TI_OK;
}