Hello la commu !
J'ai un petit souci pour passer d'un fichier d'exemple en C vers mon fichier C++ sur mon projet.
Fichier d'origine:
request.onReadyStateChange(requestCB);
void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState)
{
(void) optParm;
if (readyState == readyStateDone)
{
Serial.println("\n**************************************");
Serial.println(request->responseText());
Serial.println("**************************************");
request->setDebug(false);
}
}
Passé dans mon fichier:
en .h: void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState);
this->request.onReadyStateChange(this->requestCB);
void ASYNC_HTTP::requestCB(void* optParm, AsyncHTTPRequest* this->request, int readyState)
{
(void) optParm;
if (readyState == readyStateDone)
{
Serial.println("\n**************************************");
Serial.println(request->responseText());
Serial.println("**************************************");
request->setDebug(false);
}
}
Et le compilateur qui me crache à la tête avec ces paroles insensées :
sketch\asyncHTTP.cpp: In constructor 'ASYNC_HTTP::ASYNC_HTTP()':
asyncHTTP.cpp:7:51: error: no matching function for call to 'ASYNC_HTTP::requestCB()'
this->request.onReadyStateChange(this->requestCB());
^
sketch\asyncHTTP.cpp:7:51: note: candidate is:
In file included from sketch\asyncHTTP.cpp:1:0:
sketch\asyncHTTP.h:42:8: note: void ASYNC_HTTP::requestCB(void*, AsyncHTTPRequest*, int)
void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState);
^
sketch\asyncHTTP.h:42:8: note: candidate expects 3 arguments, 0 provided
sketch\asyncHTTP.cpp: At global scope:
asyncHTTP.cpp:31:61: error: expected ',' or '...' before 'this'
void ASYNC_HTTP::requestCB(void* optParm, AsyncHTTPRequest* this->request, int readyState)
^
asyncHTTP.cpp:31:6: error: prototype for 'void ASYNC_HTTP::requestCB(void*, AsyncHTTPRequest*)' does not match any in class 'ASYNC_HTTP'
void ASYNC_HTTP::requestCB(void* optParm, AsyncHTTPRequest* this->request, int readyState)
^
In file included from sketch\asyncHTTP.cpp:1:0:
asyncHTTP.h:42:8: error: candidate is: void ASYNC_HTTP::requestCB(void*, AsyncHTTPRequest*, int)
void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState);
^
exit status 1
no matching function for call to 'ASYNC_HTTP::requestCB()'
Que dois-je faire ? Corriger le code avec votre aide ou appeler un exorciste ?_?
Vous avez dans ce cas des numéros de tél à me proposer pour pas cher xD ??