Home | History | Annotate | Download | only in scanCncn
      1 /** \file ScanCncnAppSM.h
      2  *  \brief This file include definitions for the scan concentrator Application SM module.
      3  *  \author Ronen Kalish
      4  *  \date 02-Jan-2005
      5  */
      6  /****************************************************************************
      7 **+-----------------------------------------------------------------------+**
      8 **|                                                                       |**
      9 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
     10 **| All rights reserved.                                                  |**
     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 ****************************************************************************/
     40 
     41 #ifndef __SCANCNCNAPPSM_H__
     42 #define __SCANCNCNAPPSM_H__
     43 
     44 #include "osApi.h"
     45 #include "ScanCncn.h"
     46 #include "fsm.h"
     47 
     48 /*
     49  ***********************************************************************
     50  *	Constant definitions.
     51  ***********************************************************************
     52  */
     53 
     54 /*
     55  ***********************************************************************
     56  *	Enums.
     57  ***********************************************************************
     58  */
     59 
     60 /** \enum scan_appSMEvents_e
     61  * \brief enumerates the different application scan SM events
     62  */
     63 typedef enum
     64 {
     65     APP_SCAN_EVENT_START_SCAN = 0,
     66     APP_SCAN_EVENT_SCR_RUN,
     67     APP_SCAN_EVENT_SCR_PEND,
     68     APP_SCAN_EVENT_STOP_SCAN,
     69     APP_SCAN_EVENT_ABORT_SCAN,
     70     APP_SCAN_EVENT_FW_RESET,
     71     APP_SCAN_EVENT_SCAN_COMPLETE,
     72     APP_SCAN_NUM_OF_EVENTS
     73 } scan_appSMEvents_e;
     74 
     75 /** \enum scan_appSMStates_e
     76  * \brief enumerates the different application scan SM states
     77  */
     78 typedef enum
     79 {
     80 	APP_SCAN_STATE_IDLE = 0,
     81 	APP_SCAN_STATE_SCR_REQUEST,
     82 	APP_SCAN_STATE_SCANNING,
     83 	APP_SCAN_STATE_STOPPING,
     84 	APP_SCAN_NUM_OF_STATES
     85 } scan_appSMStates_e;
     86 
     87 /*
     88  ***********************************************************************
     89  *	Typedefs.
     90  ***********************************************************************
     91  */
     92 
     93 /*
     94  ***********************************************************************
     95  *	Structure definitions.
     96  ***********************************************************************
     97  */
     98 
     99 /*
    100  ***********************************************************************
    101  *	External data definitions.
    102  ***********************************************************************
    103  */
    104 
    105 /*
    106  ***********************************************************************
    107  *	External functions definitions
    108  ***********************************************************************
    109  */
    110 
    111 /**
    112  * \author Ronen Kalish\n
    113  * \date 02-Jan-2005\n
    114  * \brief Initialize the scan concentrator application SM.
    115  *
    116  * Function Scope \e Public.\n
    117  * \param hScanCncn - handle to the scan concentrator object.\n
    118  * \return OK if successful, NOK otherwise.\n
    119  */
    120 TI_STATUS scanConcentratorAppSM_init( TI_HANDLE hScanCncn );
    121 
    122 /**
    123  * \author Ronen Kalish\n
    124  * \date 02-Jan-2005\n
    125  * \brief Processes an event.
    126  *
    127  * Function Scope \e Public.\n
    128  * \param hScanCncn - handle to the scan concentrator object.\n
    129  * \param currentState - the current App SM state.\n
    130  * \param event - the event to handle.\n
    131  * \return OK if successful, NOK otherwise.\n
    132  */
    133 TI_STATUS scanConcentratorAppSM_SMEvent( TI_HANDLE hScanCncn, scan_appSMStates_e* currentState,
    134                                          scan_appSMEvents_e event );
    135 
    136 /**
    137  * \author Ronen Kalish\n
    138  * \date 02-Jan-2005\n
    139  * \brief SM action - handles a start scan event (by requesting the SCR)
    140  *
    141  * Function Scope \e Public.\n
    142  * \param hScanCncn - handle to the scan concentrator object.\n
    143  * \return OK if successful, NOK otherwise.\n
    144  */
    145 TI_STATUS scanConcentratorAppSM_requestSCR( TI_HANDLE hScanCncn );
    146 
    147 /**
    148  * \author Ronen Kalish\n
    149  * \date 02-Jan-2005\n
    150  * \brief SM action - handles a SCR run event (starts the actual scan)
    151  *
    152  * Function Scope \e Public.\n
    153  * \param hScanCncn - handle to the scan concentrator object.\n
    154  * \return OK if successful, NOK otherwise.\n
    155  */
    156 TI_STATUS scanConcentratorAppSM_startScan( TI_HANDLE hScanCncn );
    157 
    158 /**
    159  * \author Ronen Kalish\n
    160  * \date 02-Jan-2005\n
    161  * \brief SM action - handles an abort scan event (call the scan SRV stop)
    162  *
    163  * Function Scope \e Public.\n
    164  * \param hScanCncn - handle to the scan concentrator object.\n
    165  * \return OK if successful, NOK otherwise.\n
    166  */
    167 TI_STATUS scanConcentratorAppSM_abortScan( TI_HANDLE hScanCncn );
    168 
    169 /**
    170  * \author Ronen Kalish\n
    171  * \date 02-Jan-2005\n
    172  * \brief SM action - handles a scan complete event (releases the SCR and call the scan complete CB)
    173  *
    174  * Function Scope \e Public.\n
    175  * \param hScanCncn - handle to the scan concentrator object.\n
    176  * \return OK if successful, NOK otherwise.\n
    177  */
    178 TI_STATUS scanConcentratorAppSM_scanComplete( TI_HANDLE hScanCncn );
    179 
    180 /**
    181  * \author Ronen Kalish\n
    182  * \date 10-July-2005\n
    183  * \brief SM action - handles a recovery event (calls the scan SRV abort on FW reset and than finishes scan)
    184  *
    185  * Function Scope \e Public.\n
    186  * \param hScanCncn - handle to the scan concentrator object.\n
    187  * \return OK if successful, NOK otherwise.\n
    188  */
    189 TI_STATUS scanConcentratorAppSM_recoveryDuringScan( TI_HANDLE hScanCncn );
    190 
    191 /**
    192  * \author Ronen Kalish\n
    193  * \date 02-Jan-2005\n
    194  * \brief SM action - handles a scan reject event (abort scan before scan acrually started)\n
    195  *
    196  * Function Scope \e Public.\n
    197  * \param hScanCncn - handle to the scan concentrator object.\n
    198  * \return OK if successful, NOK otherwise.\n
    199  */
    200 TI_STATUS scanConcentratorAppSM_scanRejected( TI_HANDLE hScanCncn );
    201 
    202 #endif /* __SCANCNCNAPPSM_H__ */
    203 
    204