OLD | NEW |
(Empty) | |
| 1 //------------------------------------------------------------------------------ |
| 2 // <copyright file="athbtfilter.h" company="Atheros"> |
| 3 // Copyright (c) 2007-2008 Atheros Corporation. All rights reserved. |
| 4 // |
| 5 // This program is free software; you can redistribute it and/or modify |
| 6 // it under the terms of the GNU General Public License version 2 as |
| 7 // published by the Free Software Foundation; |
| 8 // |
| 9 // Software distributed under the License is distributed on an "AS |
| 10 // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
| 11 // implied. See the License for the specific language governing |
| 12 // rights and limitations under the License. |
| 13 // |
| 14 // |
| 15 //------------------------------------------------------------------------------ |
| 16 //============================================================================== |
| 17 // Public Bluetooth filter APIs |
| 18 // Author(s): ="Atheros" |
| 19 //============================================================================== |
| 20 #ifndef ATHBTFILTER_H_ |
| 21 #define ATHBTFILTER_H_ |
| 22 |
| 23 |
| 24 typedef enum _ATHBT_HCI_CTRL_TYPE { |
| 25 ATHBT_HCI_COMMAND = 0, |
| 26 ATHBT_HCI_EVENT = 1, |
| 27 } ATHBT_HCI_CTRL_TYPE; |
| 28 |
| 29 typedef enum _ATHBT_STATE_INDICATION { |
| 30 ATH_BT_NOOP = 0, |
| 31 ATH_BT_INQUIRY = 1, |
| 32 ATH_BT_CONNECT = 2, |
| 33 ATH_BT_SCO = 3, |
| 34 ATH_BT_ACL = 4, |
| 35 ATH_BT_A2DP = 5, |
| 36 ATH_BT_ESCO = 6, |
| 37 /* new states go here.. */ |
| 38 |
| 39 ATH_BT_MAX_STATE_INDICATION |
| 40 } ATHBT_STATE_INDICATION; |
| 41 |
| 42 /* filter function for OUTGOING commands and INCOMMING events */ |
| 43 typedef void (*ATHBT_FILTER_CMD_EVENTS_FN)(void *pContext, ATHBT_HCI_CTRL_TYPE
Type, unsigned char *pBuffer, int Length); |
| 44 |
| 45 /* filter function for OUTGOING data HCI packets */ |
| 46 typedef void (*ATHBT_FILTER_DATA_FN)(void *pContext, unsigned char *pBuffer, i
nt Length); |
| 47 |
| 48 typedef enum _ATHBT_STATE { |
| 49 STATE_OFF = 0, |
| 50 STATE_ON = 1, |
| 51 STATE_MAX |
| 52 } ATHBT_STATE; |
| 53 |
| 54 /* BT state indication (when filter functions are not used) */ |
| 55 |
| 56 typedef void (*ATHBT_INDICATE_STATE_FN)(void *pContext, ATHBT_STATE_INDICATION
Indication, ATHBT_STATE State, unsigned char LMPVersion); |
| 57 |
| 58 typedef struct _ATHBT_FILTER_INSTANCE { |
| 59 #ifdef UNDER_CE |
| 60 WCHAR *pWlanAdapterName; /* filled in by user */ |
| 61 #endif |
| 62 int FilterEnabled; /* filtering is enabled */ |
| 63 int Attached; /* filter library is attache
d */ |
| 64 void *pContext; /* private context for filte
r library */ |
| 65 ATHBT_FILTER_CMD_EVENTS_FN pFilterCmdEvents; /* function ptr to filter a
command or event */ |
| 66 ATHBT_FILTER_DATA_FN pFilterAclDataOut; /* function ptr to filter AC
L data out (to radio) */ |
| 67 ATHBT_FILTER_DATA_FN pFilterAclDataIn; /* function ptr to filter AC
L data in (from radio) */ |
| 68 ATHBT_INDICATE_STATE_FN pIndicateState; /* function ptr to indicate
a state */ |
| 69 } ATH_BT_FILTER_INSTANCE; |
| 70 |
| 71 |
| 72 /* API MACROS */ |
| 73 |
| 74 #define AthBtFilterHciCommand(instance,packet,length) \ |
| 75 if ((instance)->FilterEnabled) { \ |
| 76 (instance)->pFilterCmdEvents((instance)->pContext, \ |
| 77 ATHBT_HCI_COMMAND, \ |
| 78 (unsigned char *)(packet), \ |
| 79 (length)); \ |
| 80 } |
| 81 |
| 82 #define AthBtFilterHciEvent(instance,packet,length) \ |
| 83 if ((instance)->FilterEnabled) { \ |
| 84 (instance)->pFilterCmdEvents((instance)->pContext, \ |
| 85 ATHBT_HCI_EVENT, \ |
| 86 (unsigned char *)(packet), \ |
| 87 (length)); \ |
| 88 } |
| 89 |
| 90 #define AthBtFilterHciAclDataOut(instance,packet,length) \ |
| 91 if ((instance)->FilterEnabled) { \ |
| 92 (instance)->pFilterAclDataOut((instance)->pContext, \ |
| 93 (unsigned char *)(packet), \ |
| 94 (length)); \ |
| 95 } |
| 96 |
| 97 #define AthBtFilterHciAclDataIn(instance,packet,length) \ |
| 98 if ((instance)->FilterEnabled) { \ |
| 99 (instance)->pFilterAclDataIn((instance)->pContext, \ |
| 100 (unsigned char *)(packet), \ |
| 101 (length)); \ |
| 102 } |
| 103 |
| 104 /* if filtering is not desired, the application can indicate the state directly
using this |
| 105 * macro: |
| 106 */ |
| 107 #define AthBtIndicateState(instance,indication,state) \ |
| 108 if ((instance)->FilterEnabled) { \ |
| 109 (instance)->pIndicateState((instance)->pContext, \ |
| 110 (indication), \ |
| 111 (state), \ |
| 112 0); \ |
| 113 } |
| 114 |
| 115 #ifdef __cplusplus |
| 116 extern "C" { |
| 117 #endif |
| 118 |
| 119 /* API prototypes */ |
| 120 int AthBtFilter_Attach(ATH_BT_FILTER_INSTANCE *pInstance, A_UINT32 flags); |
| 121 void AthBtFilter_Detach(ATH_BT_FILTER_INSTANCE *pInstance); |
| 122 |
| 123 #ifdef __cplusplus |
| 124 } |
| 125 #endif |
| 126 |
| 127 #endif /*ATHBTFILTER_H_*/ |
OLD | NEW |