TWD/MacServices/MeasurementSrvSM.h
changeset 0 10c42ec6c05f
equal deleted inserted replaced
-1:000000000000 0:10c42ec6c05f
       
     1 /*
       
     2  * MeasurementSrvSM.h
       
     3  *
       
     4  * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
       
     5  * All rights reserved.      
       
     6  * 
       
     7  * This program and the accompanying materials are made available under the 
       
     8  * terms of the Eclipse Public License v1.0 or BSD License which accompanies
       
     9  * this distribution. The Eclipse Public License is available at
       
    10  * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
       
    11  *                                                                       
       
    12  * Redistribution and use in source and binary forms, with or without    
       
    13  * modification, are permitted provided that the following conditions    
       
    14  * are met:                                                              
       
    15  *                                                                       
       
    16  *  * Redistributions of source code must retain the above copyright     
       
    17  *    notice, this list of conditions and the following disclaimer.      
       
    18  *  * Redistributions in binary form must reproduce the above copyright  
       
    19  *    notice, this list of conditions and the following disclaimer in    
       
    20  *    the documentation and/or other materials provided with the         
       
    21  *    distribution.                                                      
       
    22  *  * Neither the name Texas Instruments nor the names of its            
       
    23  *    contributors may be used to endorse or promote products derived    
       
    24  *    from this software without specific prior written permission.      
       
    25  *                                                                       
       
    26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   
       
    27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     
       
    28  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
       
    29  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  
       
    30  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
       
    31  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      
       
    32  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
       
    33  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
       
    34  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   
       
    35  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
       
    36  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    37  */
       
    38 
       
    39 /** \file MeasurementSrv.h
       
    40  *  \brief This file include private definitions for the Measurement SRV state machine.
       
    41  *  \author Ronen Kalish
       
    42  *  \date 08-November-2005
       
    43  */
       
    44 
       
    45 #ifndef __MEASUREMENT_SRV_SM_H__
       
    46 #define __MEASUREMENT_SRV_SM_H__
       
    47 
       
    48 
       
    49 /*
       
    50  ***********************************************************************
       
    51  *	Constant definitions.
       
    52  ***********************************************************************
       
    53  */
       
    54 
       
    55 
       
    56 /*
       
    57  ***********************************************************************
       
    58  *	Enums.
       
    59  ***********************************************************************
       
    60  */
       
    61 
       
    62 /** \enum measurement_SRVSMEvents_e
       
    63  * \brief enumerates the different measurement SRV state machine events.
       
    64  */
       
    65 typedef enum
       
    66 {
       
    67     MSR_SRV_EVENT_MEASURE_START_REQUEST       = 0,
       
    68     MSR_SRV_EVENT_DRIVER_MODE_SUCCESS,
       
    69     MSR_SRV_EVENT_DRIVER_MODE_FAILURE,
       
    70     MSR_SRV_EVENT_START_SUCCESS,
       
    71     MSR_SRV_EVENT_START_FAILURE,
       
    72     MSR_SRV_EVENT_ALL_TYPES_COMPLETE,
       
    73     MSR_SRV_EVENT_STOP_COMPLETE,
       
    74     MSR_SRV_EVENT_MEASURE_STOP_REQUEST,
       
    75     MSR_SRV_NUM_OF_EVENTS
       
    76 } measurement_SRVSMEvents_e;
       
    77 
       
    78 /** \enum measurement_SRVSMStates_e
       
    79  * \brief enumerates the different measurement SRV state machine states.
       
    80  */
       
    81 typedef enum
       
    82 {
       
    83     MSR_SRV_STATE_IDLE                      =0,
       
    84     MSR_SRV_STATE_WAIT_FOR_DRIVER_MODE,
       
    85     MSR_SRV_STATE_WAIT_FOR_MEASURE_START,
       
    86     MSR_SRV_STATE_MEASURE_IN_PROGRESS,
       
    87     MSR_SRV_STATE_WAIT_FOR_MEASURE_STOP,
       
    88     MSR_SRV_NUM_OF_STATES
       
    89 } measurements_SRVSMStates_e;
       
    90 
       
    91 
       
    92 /*
       
    93  ***********************************************************************
       
    94  *	Typedefs.
       
    95  ***********************************************************************
       
    96  */
       
    97 
       
    98 
       
    99 /*
       
   100  ***********************************************************************
       
   101  *	Structure definitions.
       
   102  ***********************************************************************
       
   103 */
       
   104 
       
   105 /*
       
   106  ***********************************************************************
       
   107  *	External data definitions.
       
   108  ***********************************************************************
       
   109  */
       
   110 
       
   111 /*
       
   112  ***********************************************************************
       
   113  *	External functions definitions
       
   114  ***********************************************************************
       
   115  */
       
   116 
       
   117 /**
       
   118  * \author Ronen Kalish\n
       
   119  * \date 08-November-2005\n
       
   120  * \brief Initialize the measurement SRV SM.\n
       
   121  *
       
   122  * Function Scope \e Public.\n
       
   123  * \param hMeasurementSrv - handle to the Measurement SRV object.\n
       
   124  * \return TI_OK if successful, TI_NOK otherwise.\n
       
   125  */
       
   126 TI_STATUS measurementSRVSM_init( TI_HANDLE hMeasurementSRV );
       
   127 
       
   128 /**
       
   129  * \author Ronen Kalish\n
       
   130  * \date 08-November-2005\n
       
   131  * \brief Processes an event.\n
       
   132  *
       
   133  * Function Scope \e Public.\n
       
   134  * \param hMeasurementSrv - handle to the measurement SRV object.\n
       
   135  * \param currentState - the current scan SRV SM state.\n
       
   136  * \param event - the event to handle.\n
       
   137  * \return TI_OK if successful, TI_NOK otherwise.\n
       
   138  */
       
   139 TI_STATUS measurementSRVSM_SMEvent( TI_HANDLE hMeasurementSrv, measurements_SRVSMStates_e* currentState, 
       
   140                                     measurement_SRVSMEvents_e event );
       
   141 
       
   142 /**
       
   143  * \author Ronen Kalish\n
       
   144  * \date 08-November-2005\n
       
   145  * \brief Handle a MEASURE_START_REQUEST event by requesting driver mode.\n
       
   146  *
       
   147  * Function Scope \e Public.\n
       
   148  * \param hMeasurementSrv - handle to the Measurement SRV object.\n
       
   149  * \return always TI_OK.\n
       
   150  */
       
   151 TI_STATUS measurementSRVSM_requestDriverMode( TI_HANDLE hMeasurementSRV );
       
   152 
       
   153 /**
       
   154  * \author Ronen Kalish\n
       
   155  * \date 08-November-2005\n
       
   156  * \brief Handle a DRIVER_MODE_SUCCESS event by sending start measure command to the FW.\n
       
   157  *
       
   158  * Function Scope \e Public.\n
       
   159  * \param hMeasurementSrv - handle to the Measurement SRV object.\n
       
   160  * \return always TI_OK.\n
       
   161  */
       
   162 TI_STATUS measurementSRVSM_requestMeasureStart( TI_HANDLE hMeasurementSRV );
       
   163 
       
   164 /**
       
   165  * \author Ronen Kalish\n
       
   166  * \date 08-November-2005\n
       
   167  * \brief Handle a START_SUCCESS event by starting different measure types and setting timers.\n
       
   168  *
       
   169  * Function Scope \e Public.\n
       
   170  * \param hMeasurementSrv - handle to the Measurement SRV object.\n
       
   171  * \return always TI_OK.\n
       
   172  */
       
   173 TI_STATUS measurementSRVSM_startMeasureTypes( TI_HANDLE hMeasurementSRV );
       
   174 
       
   175 /**
       
   176  * \author Ronen Kalish\n
       
   177  * \date 08-November-2005\n
       
   178  * \brief Handle an ALL_TYPE_COMPLETE event by sending a stop measure command to the FW.\n
       
   179  *
       
   180  * Function Scope \e Public.\n
       
   181  * \param hMeasurementSrv - handle to the Measurement SRV object.\n
       
   182  * \return always TI_OK.\n
       
   183  */
       
   184 TI_STATUS measurementSRVSM_requestMeasureStop( TI_HANDLE hMeasurementSRV );
       
   185 
       
   186 /**
       
   187  * \author Ronen Kalish\n
       
   188  * \date 08-November-2005\n
       
   189  * \brief Handle a STOP_COMPLETE event by exiting driver mode and calling the complete CB.\n
       
   190  *
       
   191  * Function Scope \e Public.\n
       
   192  * \param hMeasurementSrv - handle to the Measurement SRV object.\n
       
   193  * \return always TI_OK.\n
       
   194  */
       
   195 TI_STATUS measurementSRVSM_completeMeasure( TI_HANDLE hMeasurementSRV );
       
   196 
       
   197 /**
       
   198  * \author Ronen Kalish\n
       
   199  * \date 08-November-2005\n
       
   200  * \brief Handle a STOP_REQUEST event when in WAIT_FOR_DRIVER_MODE state by exiting driver mode.
       
   201  *
       
   202  * Function Scope \e Public.\n
       
   203  * \param hMeasurementSrv - handle to the Measurement SRV object.\n
       
   204  * \return always TI_OK.\n
       
   205  */
       
   206 TI_STATUS measurementSRVSM_stopFromWaitForDriverMode( TI_HANDLE hMeasurementSRV );
       
   207 
       
   208 /**
       
   209  * \author Ronen Kalish\n
       
   210  * \date 27-November-2005\n
       
   211  * \brief handle a STOP_REQUEST event when in WAIT_FOR_DRIVER_MODE by marking negative result status
       
   212  * \brief and callin the ordinary stop function
       
   213  *
       
   214  * Function Scope \e Public.\n
       
   215  * \param hMeasurementSrv - handle to the Measurement SRV object.\n
       
   216  * \return always TI_OK.\n
       
   217  */
       
   218 TI_STATUS measurementSRVSM_stopFromWaitForMeasureStart( TI_HANDLE hMeasurementSRV );
       
   219 
       
   220 /**
       
   221  * \author Ronen Kalish\n
       
   222  * \date 08-November-2005\n
       
   223  * \brief handle a STOP_REQUEST event when in MEASURE_IN_PROGRESS by stopping all measure types and
       
   224  * \brief requesting measure stop from the FW.\n
       
   225  *
       
   226  * Function Scope \e Public.\n
       
   227  * \param hMeasurementSrv - handle to the Measurement SRV object.\n
       
   228  * \return always TI_OK.\n
       
   229  */
       
   230 TI_STATUS measurementSRVSM_stopFromMeasureInProgress( TI_HANDLE hMeasurementSRV );
       
   231 
       
   232 /**
       
   233  * \author Ronen Kalish\n
       
   234  * \date 08-November-2005\n
       
   235  * \brief handle a DRIVER_MODE_FAILURE event by calling the response CB.\n
       
   236  *
       
   237  * Function Scope \e Public.\n
       
   238  * \param hMeasurementSrv - handle to the Measurement SRV object.\n
       
   239  * \return always TI_OK.\n
       
   240  */
       
   241 TI_STATUS measurementSRVSM_DriverModeFailure( TI_HANDLE hMeasurementSRV );
       
   242 
       
   243 /**
       
   244  * \author Ronen Kalish\n
       
   245  * \date 08-November-2005\n
       
   246  * \brief handle a START_FAILURE event by exiting driver mode and calling the complete CB.\n
       
   247  *
       
   248  * Function Scope \e Public.\n
       
   249  * \param hMeasurementSrv - handle to the Measurement SRV object.\n
       
   250  * \return always TI_OK.\n
       
   251  */
       
   252 TI_STATUS measurementSRVSM_measureStartFailure( TI_HANDLE hMeasurementSRV );
       
   253 
       
   254 /**
       
   255  * \author Ronen Kalish\n
       
   256  * \date 23-December-2005\n
       
   257  * \brief Handles a stop request when no stop is needed (SM is either idle or already send stop command to FW.\n
       
   258  *
       
   259  * Function Scope \e Private.\n
       
   260  * \param hMeasurementSrv - handle to the measurement SRV object.\n
       
   261  * \return always TI_OK.\n
       
   262  */
       
   263 TI_STATUS measurementSRVSRVSM_dummyStop( TI_HANDLE hmeasurementSrv );
       
   264 
       
   265 #endif /* __MEASUREMENT_SRV_SM_H__ */
       
   266