Packet filtering configuration
Packet filtering is disabled by default but can be enabled and re-configured as described below.
Basic configuration
The function zps_vAplAfEnableMcpsFilter() allows the stack’s packet filtering to be enabled and the link cost threshold to be adjusted (from the default value of 5). This function is detailed in Section 8.1.1. If required, it can be called at any time after zps_eAplAfInit().
Parent topic:Packet filtering configuration
Link cost configuration
The mappings between LQI values and link costs can be modified from the default mappings detailed in Section 6.10.3.1. To modify the mappings, the following function must be user-defined, which translates an LQI value (input) into a link cost (output):
uint8 APP\_u8LinkCost\(uint8 u8Lqi\);
An example function that implements the default mapping is shown below:
PRIVATE uint8 APP_u8LinkCost ( uint8 u8Lqi )
{
uint8 u8Lc;
if (u8Lqi > 50)
{
u8Lc = 1;
}
else if ((u8Lqi <= 50) && (u8Lqi > 45))
{
u8Lc = 2;
}
else if ((u8Lqi <= 45) && (u8Lqi > 40))
{
u8Lc = 3;
}
else if ((u8Lqi <= 40) && (u8Lqi > 38))
{
u8Lc = 4;
}
else if ((u8Lqi <= 38) && (u8Lqi > 35))
{
u8Lc = 5;
}
else if ((u8Lqi <= 35) && (u8Lqi > 24))
{
u8Lc = 6;
}
else
{
u8Lc = 7;
}
return u8Lc;
}
The above function must be registered as a callback function using the following callback registration function zps_vNwkLinkCostCallbackRegister(), which is detailed in Section 8.1.1. This function takes a pointer to the APP_u8LinkCost() function to be registered. If required, the registration function must be called before zps_eAplAfInit(), and on both cold and warm starts.
Parent topic:Packet filtering configuration
Parent topic:Filtering packets on LQI Value/Link cost