mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
bt: Fixed SPP VFS mode not being able to send data
This commit is contained in:
parent
a2086ca355
commit
45d4780760
@ -192,8 +192,6 @@ esp_err_t esp_spp_stop_srv_scn(uint8_t scn)
|
|||||||
|
|
||||||
esp_err_t esp_spp_write(uint32_t handle, int len, uint8_t *p_data)
|
esp_err_t esp_spp_write(uint32_t handle, int len, uint8_t *p_data)
|
||||||
{
|
{
|
||||||
btc_msg_t msg;
|
|
||||||
btc_spp_args_t arg;
|
|
||||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||||
|
|
||||||
if (len <= 0 || p_data == NULL) {
|
if (len <= 0 || p_data == NULL) {
|
||||||
@ -201,15 +199,7 @@ esp_err_t esp_spp_write(uint32_t handle, int len, uint8_t *p_data)
|
|||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.sig = BTC_SIG_API_CALL;
|
return spp_send_data_to_btc(handle, len, p_data, ESP_SPP_MODE_CB);
|
||||||
msg.pid = BTC_PID_SPP;
|
|
||||||
msg.act = BTC_SPP_ACT_WRITE;
|
|
||||||
|
|
||||||
arg.write.handle = handle;
|
|
||||||
arg.write.len = len;
|
|
||||||
arg.write.p_data = p_data;
|
|
||||||
|
|
||||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), btc_spp_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t esp_spp_vfs_register(void)
|
esp_err_t esp_spp_vfs_register(void)
|
||||||
|
@ -94,6 +94,7 @@ void btc_spp_call_handler(btc_msg_t *msg);
|
|||||||
void btc_spp_cb_handler(btc_msg_t *msg);
|
void btc_spp_cb_handler(btc_msg_t *msg);
|
||||||
void btc_spp_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
void btc_spp_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||||
|
|
||||||
|
esp_err_t spp_send_data_to_btc(uint32_t handle, int len, uint8_t *p_data, esp_spp_mode_t spp_mode);
|
||||||
esp_err_t btc_spp_vfs_register(void);
|
esp_err_t btc_spp_vfs_register(void);
|
||||||
#endif ///defined BTC_SPP_INCLUDED && BTC_SPP_INCLUDED == TRUE
|
#endif ///defined BTC_SPP_INCLUDED && BTC_SPP_INCLUDED == TRUE
|
||||||
#endif ///__BTC_SPP_H__
|
#endif ///__BTC_SPP_H__
|
||||||
|
@ -1326,6 +1326,28 @@ int bta_co_rfc_data_outgoing(void *user_data, uint8_t *buf, uint16_t size)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t spp_send_data_to_btc(uint32_t handle, int len, uint8_t *p_data, esp_spp_mode_t spp_mode)
|
||||||
|
{
|
||||||
|
btc_msg_t msg;
|
||||||
|
btc_spp_args_t arg;
|
||||||
|
|
||||||
|
if (spp_local_param.spp_mode != spp_mode) {
|
||||||
|
BTC_TRACE_WARNING("The current mode used is %d\n", spp_local_param.spp_mode);
|
||||||
|
return ESP_ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.sig = BTC_SIG_API_CALL;
|
||||||
|
msg.pid = BTC_PID_SPP;
|
||||||
|
msg.act = BTC_SPP_ACT_WRITE;
|
||||||
|
|
||||||
|
arg.write.handle = handle;
|
||||||
|
arg.write.len = len;
|
||||||
|
arg.write.p_data = p_data;
|
||||||
|
|
||||||
|
return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), btc_spp_arg_deep_copy)
|
||||||
|
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t spp_vfs_write(int fd, const void * data, size_t size)
|
static ssize_t spp_vfs_write(int fd, const void * data, size_t size)
|
||||||
{
|
{
|
||||||
@ -1405,7 +1427,7 @@ static ssize_t spp_vfs_write(int fd, const void * data, size_t size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tx_len == 0) {
|
if (tx_len == 0) {
|
||||||
esp_spp_write(slot->rfc_handle, 0, NULL);
|
spp_send_data_to_btc(slot->rfc_handle, 0, NULL, ESP_SPP_MODE_VFS);
|
||||||
}
|
}
|
||||||
sent += write_size;
|
sent += write_size;
|
||||||
size -= write_size;
|
size -= write_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user