1 /* 2 * ScanCncnSm.h 3 * 4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * * Neither the name Texas Instruments nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 /** \file ScanCncnSm.h 35 * \brief Scan concentrator state machine declarations 36 * 37 * \see ScanCncnSm.c 38 */ 39 40 41 #ifndef __SCAN_CNCN_SM_H__ 42 #define __SCAN_CNCN_SM_H__ 43 44 #include "osTIType.h" 45 #include "TWDriver.h" 46 #include "ScanCncn.h" 47 48 typedef void (*TScanPrivateSMFunction)(TI_HANDLE hScanCncn); 49 50 typedef union 51 { 52 TPeriodicScanParams tPeriodicScanParams; 53 TScanParams tOneShotScanParams; 54 }UScanParams; 55 56 typedef struct 57 { 58 TI_HANDLE hOS; 59 TI_HANDLE hReport; 60 TI_HANDLE hSCR; 61 TI_HANDLE hTWD; 62 TI_HANDLE hApConn; 63 TI_HANDLE hMlme; 64 TI_HANDLE hGenSM; 65 TI_HANDLE hScanCncn; 66 TI_BOOL bScanCompletePending; /* TRUE if scan complete event is received 67 before all results, for periodic scan */ 68 TI_BOOL bInRequest; 69 TI_BOOL bSendNullDataOnStop; /* indicates whether NULL data frame is to be sent wehn 70 stopping scan to return to previous PS mode */ 71 TScanPrivateSMFunction fScrRequest; 72 TScanPrivateSMFunction fScrRelease; 73 TScanPrivateSMFunction fStartScan; 74 TScanPrivateSMFunction fStopScan; 75 TScanPrivateSMFunction fRecovery; 76 77 /* Scan complete callbacks */ 78 TScanResultCB tScanResultCB; 79 TI_HANDLE hScanResultCBObj; 80 81 UScanParams uScanParams; 82 EScanCncnResultStatus eScanResult; 83 TI_INT8 *pScanSmName; 84 TI_UINT16 uSPSScanResult; 85 TI_UINT32 uResultCounter; 86 TI_UINT32 uResultExpectedNumber; 87 TI_BOOL bScanRejectedOn2_4; 88 } TScanCncnClient; 89 90 typedef enum 91 { 92 SCAN_CNCN_SM_STATE_IDLE = 0, 93 SCAN_CNCN_SM_STATE_SCR_WAIT, 94 SCAN_CNCN_SM_STATE_SCANNING, 95 SCAN_CNCN_SM_STATE_STOPPING, 96 SCAN_CNCN_SM_NUMBER_OF_STATES 97 } EScanCncnSmStates; 98 99 typedef enum 100 { 101 SCAN_CNCN_SM_EVENT_START = 0, 102 SCAN_CNCN_SM_EVENT_RUN, 103 SCAN_CNCN_SM_EVENT_SCAN_COMPLETE, 104 SCAN_CNCN_SM_EVENT_STOP, 105 SCAN_CNCN_SM_EVENT_ABORT, 106 SCAN_CNCN_SM_EVENT_RECOVERY, 107 SCAN_CNCN_SM_EVENT_REJECT, 108 SCAN_CNCN_SM_NUMBER_OF_EVENTS 109 } EScanCncnSmEvents; 110 111 TI_HANDLE scanCncnSm_Create (TI_HANDLE hOS); 112 void scanCncnSm_Init (TI_HANDLE hScanCncnClient, TI_HANDLE hReport, TI_HANDLE hTWD, 113 TI_HANDLE hSCR, TI_HANDLE hApConn, TI_HANDLE hMlme, 114 TI_HANDLE hScanCncn, TScanPrivateSMFunction fScrRequest, 115 TScanPrivateSMFunction fScrRelease, TScanPrivateSMFunction fStartScan, 116 TScanPrivateSMFunction fStopScan, TScanPrivateSMFunction fRecovery, 117 TI_INT8* pScanSmName); 118 void scanCncnSm_Destroy (TI_HANDLE hScanCncnClient); 119 void scanCncnSmApp1Shot_ScrRequest (TI_HANDLE hScanCncnClient); 120 void scanCncnSmApp1Shot_ScrRelease (TI_HANDLE hScanCncnClient); 121 void scanCncnSmApp1Shot_StartScan (TI_HANDLE hScanCncnClient); 122 void scanCncnSmApp1Shot_StopScan (TI_HANDLE hScanCncnClient); 123 void scanCncnSmApp1Shot_Recovery (TI_HANDLE hScanCncnClient); 124 void scanCncnSmAppP_ScrRequest (TI_HANDLE hScanCncnClient); 125 void scanCncnSmAppP_ScrRelease (TI_HANDLE hScanCncnClient); 126 void scanCncnSmAppP_StartScan (TI_HANDLE hScanCncnClient); 127 void scanCncnSmAppP_StopScan (TI_HANDLE hScanCncnClient); 128 void scanCncnSmAppP_Recovery (TI_HANDLE hScanCncnClient); 129 void scanCncnSmDrvP_ScrRequest (TI_HANDLE hScanCncnClient); 130 void scanCncnSmDrvP_ScrRelease (TI_HANDLE hScanCncnClient); 131 void scanCncnSmDrvP_StartScan (TI_HANDLE hScanCncnClient); 132 void scanCncnSmDrvP_StopScan (TI_HANDLE hScanCncnClient); 133 void scanCncnSmDrvP_Recovery (TI_HANDLE hScanCncnClient); 134 void scanCncnSmCont1Shot_ScrRequest (TI_HANDLE hScanCncnClient); 135 void scanCncnSmCont1Shot_ScrRelease (TI_HANDLE hScanCncnClient); 136 void scanCncnSmCont1Shot_StartScan (TI_HANDLE hScanCncnClient); 137 void scanCncnSmCont1Shot_StopScan (TI_HANDLE hScanCncnClient); 138 void scanCncnSmCont1Shot_Recovery (TI_HANDLE hScanCncnClient); 139 void scanCncnSmImmed1Shot_ScrRequest (TI_HANDLE hScanCncnClient); 140 void scanCncnSmImmed1Shot_ScrRelease (TI_HANDLE hScanCncnClient); 141 void scanCncnSmImmed1Shot_StartScan (TI_HANDLE hScanCncnClient); 142 void scanCncnSmImmed1Shot_StopScan (TI_HANDLE hScanCncnClient); 143 void scanCncnSmImmed1Shot_Recovery (TI_HANDLE hScanCncnClient); 144 145 #endif /* __SCAN_CNCN_SM_H__ */ 146 147