how to implement Transfer complete callback in esp_idf_webserver
Posted: Sat Jun 08, 2024 12:19 am
Getting this error when trying to use "transfer complete" callback in my code:
In function 'esp_err_t echo_handler(httpd_req_t*)':
src/main.cpp:245:44: error: expression list treated as compound expression in functional cast [-fpermissive]
transfer_complete_cb(ret, socketID, msg);
in the esp_htp_sever.h there is a callback prototype
in my code i am calling it by:
I am implementing the callback function like this:
I have looked at other invocations of callbacks in the example code of different componants and
sometimes the callback is registered like in events but mostly nothing special is done just drop the typedef and the * and change
the name of the function and it works but not in this case.
In function 'esp_err_t echo_handler(httpd_req_t*)':
src/main.cpp:245:44: error: expression list treated as compound expression in functional cast [-fpermissive]
transfer_complete_cb(ret, socketID, msg);
in the esp_htp_sever.h there is a callback prototype
Code: Select all
typedef void (*transfer_complete_cb)(esp_err_t err, int socket, void *arg);
Code: Select all
char msg[20] = "transfer complete";
transfer_complete(ret, socketID, msg);
Code: Select all
void transfer_complete(esp_err_t err, int socket, void *arg)
{
char *myMsg = (char *)arg;
log_i("transfer complete skt %d, arg %s with error %d", socket, myMsg, err);
return;
}
sometimes the callback is registered like in events but mostly nothing special is done just drop the typedef and the * and change
the name of the function and it works but not in this case.