ESP8266_RTOS_SDK  v1.4.0
Macros | Enumerations | Functions
Rate Control APIs

WiFi Rate Control APIs. More...

Macros

#define FIXED_RATE_MASK_NONE   0x00
 
#define FIXED_RATE_MASK_STA   0x01
 
#define FIXED_RATE_MASK_AP   0x02
 
#define FIXED_RATE_MASK_ALL   0x03
 
#define RC_LIMIT_11B   0
 
#define RC_LIMIT_11G   1
 
#define RC_LIMIT_11N   2
 
#define RC_LIMIT_P2P_11G   3
 
#define RC_LIMIT_P2P_11N   4
 
#define RC_LIMIT_NUM   5
 
#define LIMIT_RATE_MASK_NONE   0x00
 
#define LIMIT_RATE_MASK_STA   0x01
 
#define LIMIT_RATE_MASK_AP   0x02
 
#define LIMIT_RATE_MASK_ALL   0x03
 

Enumerations

enum  FIXED_RATE {
  PHY_RATE_48 = 0x8, PHY_RATE_24 = 0x9, PHY_RATE_12 = 0xA, PHY_RATE_6 = 0xB,
  PHY_RATE_54 = 0xC, PHY_RATE_36 = 0xD, PHY_RATE_18 = 0xE, PHY_RATE_9 = 0xF
}
 
enum  support_rate {
  RATE_11B5M = 0, RATE_11B11M = 1, RATE_11B1M = 2, RATE_11B2M = 3,
  RATE_11G6M = 4, RATE_11G12M = 5, RATE_11G24M = 6, RATE_11G48M = 7,
  RATE_11G54M = 8, RATE_11G9M = 9, RATE_11G18M = 10, RATE_11G36M = 11
}
 
enum  RATE_11B_ID { RATE_11B_B11M = 0, RATE_11B_B5M = 1, RATE_11B_B2M = 2, RATE_11B_B1M = 3 }
 
enum  RATE_11G_ID {
  RATE_11G_G54M = 0, RATE_11G_G48M = 1, RATE_11G_G36M = 2, RATE_11G_G24M = 3,
  RATE_11G_G18M = 4, RATE_11G_G12M = 5, RATE_11G_G9M = 6, RATE_11G_G6M = 7,
  RATE_11G_B5M = 8, RATE_11G_B2M = 9, RATE_11G_B1M = 10
}
 
enum  RATE_11N_ID {
  RATE_11N_MCS7S = 0, RATE_11N_MCS7 = 1, RATE_11N_MCS6 = 2, RATE_11N_MCS5 = 3,
  RATE_11N_MCS4 = 4, RATE_11N_MCS3 = 5, RATE_11N_MCS2 = 6, RATE_11N_MCS1 = 7,
  RATE_11N_MCS0 = 8, RATE_11N_B5M = 9, RATE_11N_B2M = 10, RATE_11N_B1M = 11
}
 

Functions

sint32 wifi_set_user_fixed_rate (uint8 enable_mask, uint8 rate)
 Set the fixed rate and mask of sending data from ESP8266. More...
 
int wifi_get_user_fixed_rate (uint8 *enable_mask, uint8 *rate)
 Get the fixed rate and mask of ESP8266. More...
 
sint32 wifi_set_user_sup_rate (uint8 min, uint8 max)
 Set the support rate of ESP8266. More...
 
bool wifi_set_user_rate_limit (uint8 mode, uint8 ifidx, uint8 max, uint8 min)
 Limit the initial rate of sending data from ESP8266. More...
 
uint8 wifi_get_user_limit_rate_mask (void)
 Get the interfaces of ESP8266 whose rate of sending data is limited by wifi_set_user_rate_limit. More...
 
bool wifi_set_user_limit_rate_mask (uint8 enable_mask)
 Set the interfaces of ESP8266 whose rate of sending packets is limited by wifi_set_user_rate_limit. More...
 

Detailed Description

WiFi Rate Control APIs.

Function Documentation

int wifi_get_user_fixed_rate ( uint8 *  enable_mask,
uint8 *  rate 
)

Get the fixed rate and mask of ESP8266.

Parameters
uint8*enable_mask : pointer of the enable_mask
uint8*rate : pointer of the fixed rate
Returns
0 : succeed
otherwise : fail
uint8 wifi_get_user_limit_rate_mask ( void  )

Get the interfaces of ESP8266 whose rate of sending data is limited by wifi_set_user_rate_limit.

Parameters
null
Returns
LIMIT_RATE_MASK_NONE - disable the limitation on both ESP8266 station and soft-AP
LIMIT_RATE_MASK_STA - enable the limitation on ESP8266 station
LIMIT_RATE_MASK_AP - enable the limitation on ESP8266 soft-AP
LIMIT_RATE_MASK_ALL - enable the limitation on both ESP8266 station and soft-AP
sint32 wifi_set_user_fixed_rate ( uint8  enable_mask,
uint8  rate 
)

Set the fixed rate and mask of sending data from ESP8266.

Attention
1. Only if the corresponding bit in enable_mask is 1, ESP8266 station or soft-AP will send data in the fixed rate.
2. If the enable_mask is 0, both ESP8266 station and soft-AP will not send data in the fixed rate.
3. ESP8266 station and soft-AP share the same rate, they can not be set into the different rate.
Parameters
uint8enable_mask : 0x00 - disable the fixed rate
  • 0x01 - use the fixed rate on ESP8266 station
  • 0x02 - use the fixed rate on ESP8266 soft-AP
  • 0x03 - use the fixed rate on ESP8266 station and soft-AP
uint8rate : value of the fixed rate
Returns
0 : succeed
otherwise : fail
bool wifi_set_user_limit_rate_mask ( uint8  enable_mask)

Set the interfaces of ESP8266 whose rate of sending packets is limited by wifi_set_user_rate_limit.

Parameters
uint8enable_mask :
  • LIMIT_RATE_MASK_NONE - disable the limitation on both ESP8266 station and soft-AP
  • LIMIT_RATE_MASK_STA - enable the limitation on ESP8266 station
  • LIMIT_RATE_MASK_AP - enable the limitation on ESP8266 soft-AP
  • LIMIT_RATE_MASK_ALL - enable the limitation on both ESP8266 station and soft-AP
Returns
true : succeed
false : fail
bool wifi_set_user_rate_limit ( uint8  mode,
uint8  ifidx,
uint8  max,
uint8  min 
)

Limit the initial rate of sending data from ESP8266.

Example: wifi_set_user_rate_limit(RC_LIMIT_11G, 0, RATE_11G_G18M, RATE_11G_G6M);

Attention
The rate of retransmission is not limited by this API.
Parameters
uint8mode : WiFi mode
  • #define RC_LIMIT_11B 0
  • #define RC_LIMIT_11G 1
  • #define RC_LIMIT_11N 2
uint8ifidx : interface of ESP8266
  • 0x00 - ESP8266 station
  • 0x01 - ESP8266 soft-AP
uint8max : the maximum value of the rate, according to the enum rate corresponding to the first parameter mode.
uint8min : the minimum value of the rate, according to the enum rate corresponding to the first parameter mode.
Returns
0 : succeed
otherwise : fail
sint32 wifi_set_user_sup_rate ( uint8  min,
uint8  max 
)

Set the support rate of ESP8266.

Set the rate range in the IE of support rate in ESP8266's beacon, probe req/resp and other packets. Tell other devices about the rate range supported by ESP8266 to limit the rate of sending packets from other devices. Example : wifi_set_user_sup_rate(RATE_11G6M, RATE_11G24M);

Attention
This API can only support 802.11g now, but it will support 802.11b in next version.
Parameters
uint8min : the minimum value of the support rate, according to enum support_rate.
uint8max : the maximum value of the support rate, according to enum support_rate.
Returns
0 : succeed
otherwise : fail