chegewara wrote: ↑Mon Nov 18, 2019 10:08 am
If you are flashing this code, i am guessing it is just echoing received data:
Code: Select all
case ESP_SPP_DATA_IND_EVT:
#if (SPP_SHOW_MODE == SPP_SHOW_DATA)
ESP_LOGI(SPP_TAG, "ESP_SPP_DATA_IND_EVT len=%d handle=%d",
param->data_ind.len, param->data_ind.handle);
if (param->data_ind.len < 1023) {
snprintf(buf, (size_t)param->data_ind.len, (char *)param->data_ind.data);
printf("%s\n", buf);
sprintf(spp_data, "Receined characters: %d\n", param->data_ind.len);
esp_spp_write(param->write.handle, strlen(spp_data), (uint8_t *)spp_data);
}
https://docs.espressif.com/projects/esp ... TA_IND_EVT
Yes it it is echoing.
But I would expect on calling "esp_spp_write()" that it does not fire the "ESP_SPP_DATA_IND_EVT" event next to the ESP_SPP_WRITE_EVT" event (it does get called once). But only the "ESP_SPP_WRITE_EVT" event.
Do it echos to itself as well.
When I call:
Code: Select all
char *spp_data = "Hello!";
esp_spp_write(myHandle, strlen(spp_data), (uint8_t *)spp_data);
It fires the "ESP_SPP_DATA_IND_EVT" event like so:
Code: Select all
I (278949) SPP_ACCEPTOR_DEMO: ESP_SPP_DATA_IND_EVT len=1 handle=129
H
I (278949) SPP_ACCEPTOR_DEMO: ESP_SPP_DATA_IND_EVT len=1 handle=129
a
I (278959) SPP_ACCEPTOR_DEMO: ESP_SPP_DATA_IND_EVT len=1 handle=129
l
I (278959) SPP_ACCEPTOR_DEMO: ESP_SPP_DATA_IND_EVT len=1 handle=129
l
I (278969) SPP_ACCEPTOR_DEMO: ESP_SPP_DATA_IND_EVT len=1 handle=129
o
I (278979) SPP_ACCEPTOR_DEMO: ESP_SPP_DATA_IND_EVT len=1 handle=129
!
I did not expect that, nor do I understand why.