mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-14 06:23:07 +01:00
call requestHandler in user code outside of the API lock
This commit is contained in:
@@ -340,17 +340,23 @@ public:
|
|||||||
virtual void setCalibrationValue(const String &name, double value){
|
virtual void setCalibrationValue(const String &name, double value){
|
||||||
api->setCalibrationValue(name,value);
|
api->setCalibrationValue(name,value);
|
||||||
}
|
}
|
||||||
virtual bool handleWebRequest(const String &url,AsyncWebServerRequest *req){
|
virtual bool handleWebRequest(const String &url, AsyncWebServerRequest *req)
|
||||||
|
{
|
||||||
|
GwApi::HandlerFunction handler;
|
||||||
|
{
|
||||||
GWSYNCHRONIZED(&localLock);
|
GWSYNCHRONIZED(&localLock);
|
||||||
auto it = webHandlers.find(url);
|
auto it = webHandlers.find(url);
|
||||||
if (it == webHandlers.end()){
|
if (it == webHandlers.end())
|
||||||
|
{
|
||||||
api->getLogger()->logDebug(GwLog::LOG, "no web handler task=%s url=%s", name.c_str(), url.c_str());
|
api->getLogger()->logDebug(GwLog::LOG, "no web handler task=%s url=%s", name.c_str(), url.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
it->second(req);
|
handler = it->second;
|
||||||
|
}
|
||||||
|
if (handler)
|
||||||
|
handler(req);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GwUserCode::GwUserCode(GwApiInternal *api,SemaphoreHandle_t *mainLock){
|
GwUserCode::GwUserCode(GwApiInternal *api,SemaphoreHandle_t *mainLock){
|
||||||
|
|||||||
Reference in New Issue
Block a user