Managing Filters
189
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
Rx Filters
11.4.6.5 Counter Action
Two sets of filter counters can be used. Each counter is associated with a filter type groups (see rule
types layers).
The counter ID that can be used for each rule layer follows:
•
RX_FILTER_COUNTER1-4: can be used with filters from groups C-D
•
RX_FILTER_COUNTER5-8: can be used with filters from groups A-B
11.5 Managing Filters
Manage the filters performed by calling the regular sl_WlanSet and sl_WlanGet APIs. The available
operations contain:
•
Enable and disable
•
Remove
•
Save
•
Update
To manage several filters simultaneously, the SimpleLink Wi-Fi device receives a bit field of the filters that
the operation should take on. This bit field contains up to 128 bits. The following macro can be used to
define a correct bit for a filter ID:
SL_WLAN_SETBIT8 (BitField.FilterIdMask, FilterId);
For example, to set the operation on filter 1 and filter 35, the macro should be called twice:
SL_WLAN_SETBIT8 (FilterIdMask, 1);
SL_WLAN_SETBIT8 (FilterIdMask, 35);
If the filter is not defined or created, the SimpleLink Wi-Fi device ignores its bit on the bit field mask.
Therefore, operations can be performed with a bit field of all 1s.
NOTE:
TI highly recommends updating the Rx filters while the sockets are closed.
11.5.1 Enable and Disable Filters
TI recommends creating a filter as a disable, and then enable all the relevant filters at once. A filter with its
corresponding bit is set to 1 is enabled, and a filter in which its corresponding bit is set to 0 is disabled;
filters which are not defined are ignored.
To enable or disable filters, call the sl_WlanSet API with the following arguments:
•
ConfigId: SL_WLAN_RX_FILTERS_ID
•
ConfigOpt: SL_WLAN_RX_FILTER_STATE
Example:
_u16
Size =
sizeof
(SlWlanRxFilterRetrieveStateBuff_t);
_u16 opt = SL_WLAN_RX_FILTER_STATE;
RetVal = sl_WlanGet( SL_WLAN_RX_FILTERS_ID, &opt , &Size ,
(
unsigned char
*)&RxFilterIdBitField);
SL_WLAN_CLEARBIT8(OutputBuff.FilterIdMask,selectedfilter);
RetVal = sl_WlanSet( SL_WLAN_RX_FILTERS_ID, SL_WLAN_RX_FILTER_STATE,
sizeof
(SlWlanRxFilterOperationCommandBuff_t),
(
unsigned char
*)&RxFilterIdBitField);
11.5.2 Get Filter Status
To get the enable status of filters, call the sl_WlanGet API with the following arguments:
•
ConfigId: SL_WLAN_RX_FILTERS_ID
•
ConfigOpt: SL_WLAN_RX_FILTER_STATE
Example: