bt: Remove SPP default send buffer size option and add parameters to configure send buffer size in esp_spp_enhance_init()

This commit is contained in:
xiongweichao
2022-11-17 10:46:52 +08:00
parent ecf2eea1d6
commit c497d7d6c1
9 changed files with 22 additions and 24 deletions

View File

@@ -38,6 +38,7 @@ esp_err_t esp_spp_init(esp_spp_mode_t mode)
esp_spp_cfg_t bt_spp_cfg = {
.mode = mode,
.enable_l2cap_ertm = true,
.tx_buffer_size = ESP_SPP_MAX_TX_BUFFER_SIZE,
};
return esp_spp_enhanced_init(&bt_spp_cfg);
@@ -49,12 +50,19 @@ esp_err_t esp_spp_enhanced_init(const esp_spp_cfg_t *cfg)
btc_spp_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (cfg->mode == ESP_SPP_MODE_VFS && (cfg->tx_buffer_size < ESP_SPP_MIN_TX_BUFFER_SIZE ||
cfg->tx_buffer_size > ESP_SPP_MAX_TX_BUFFER_SIZE)) {
LOG_WARN("Invalid tx buffer size");
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_SPP;
msg.act = BTC_SPP_ACT_INIT;
arg.init.mode = cfg->mode;
arg.init.enable_l2cap_ertm = cfg->enable_l2cap_ertm;
arg.init.tx_buffer_size = cfg->tx_buffer_size;
return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}