|
@@ -725,7 +725,11 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "ClassFlowControll::GetJPGStream: alg.jpg cannot be served");
|
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "ClassFlowControll::GetJPGStream: alg.jpg cannot be served");
|
|
|
- return ESP_FAIL;
|
|
|
|
|
|
|
+ std::string filename = "/sdcard/html/Flowstate_at_work.jpg";
|
|
|
|
|
+ result = send_file(req, filename);
|
|
|
|
|
+ /* Respond with an empty chunk to signal HTTP response completion */
|
|
|
|
|
+ httpd_resp_send_chunk(req, NULL, 0);
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else if (_fn == "alg_roi.jpg") {
|
|
else if (_fn == "alg_roi.jpg") {
|
|
@@ -734,15 +738,24 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
|
|
|
if (status.find("Initialization (delayed)") != -1) {
|
|
if (status.find("Initialization (delayed)") != -1) {
|
|
|
std::string filename = "/sdcard/html/Flowstate_initialization_delayed.jpg";
|
|
std::string filename = "/sdcard/html/Flowstate_initialization_delayed.jpg";
|
|
|
result = send_file(req, filename);
|
|
result = send_file(req, filename);
|
|
|
|
|
+ /* Respond with an empty chunk to signal HTTP response completion */
|
|
|
|
|
+ httpd_resp_send_chunk(req, NULL, 0);
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
else if (status.find("Initialization") != -1) {
|
|
else if (status.find("Initialization") != -1) {
|
|
|
std::string filename = "/sdcard/html/Flowstate_initialization.jpg";
|
|
std::string filename = "/sdcard/html/Flowstate_initialization.jpg";
|
|
|
result = send_file(req, filename);
|
|
result = send_file(req, filename);
|
|
|
|
|
+ /* Respond with an empty chunk to signal HTTP response completion */
|
|
|
|
|
+ httpd_resp_send_chunk(req, NULL, 0);
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
else if (status.find("Take Image") != -1) {
|
|
else if (status.find("Take Image") != -1) {
|
|
|
if (flowalignment != NULL) {
|
|
if (flowalignment != NULL) {
|
|
|
std::string filename = "/sdcard/html/Flowstate_take_image.jpg";
|
|
std::string filename = "/sdcard/html/Flowstate_take_image.jpg";
|
|
|
result = send_file(req, filename);
|
|
result = send_file(req, filename);
|
|
|
|
|
+ /* Respond with an empty chunk to signal HTTP response completion */
|
|
|
|
|
+ httpd_resp_send_chunk(req, NULL, 0);
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "ClassFlowControll::GetJPGStream: alg_roi.jpg cannot be served -> alg.jpg is going to be served!");
|
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "ClassFlowControll::GetJPGStream: alg_roi.jpg cannot be served -> alg.jpg is going to be served!");
|
|
@@ -752,6 +765,9 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
|
|
|
else {
|
|
else {
|
|
|
std::string filename = "/sdcard/html/Flowstate_at_work.jpg";
|
|
std::string filename = "/sdcard/html/Flowstate_at_work.jpg";
|
|
|
result = send_file(req, filename);
|
|
result = send_file(req, filename);
|
|
|
|
|
+ /* Respond with an empty chunk to signal HTTP response completion */
|
|
|
|
|
+ httpd_resp_send_chunk(req, NULL, 0);
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -763,23 +779,28 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // A missing preview must not fall back to ImageBasis: that would
|
|
|
|
|
- // make the single HTTP server task wait on the global image lock.
|
|
|
|
|
- LogFile.WriteToFile(ESP_LOG_WARN, TAG, "ClassFlowControll::GetJPGStream: ROI preview is not ready");
|
|
|
|
|
- httpd_resp_set_status(req, "503 Service Unavailable");
|
|
|
|
|
- httpd_resp_set_type(req, "text/plain");
|
|
|
|
|
- return httpd_resp_send(req, "ROI preview not ready", HTTPD_RESP_USE_STRLEN);
|
|
|
|
|
|
|
+ std::string filename = "/sdcard/html/Flowstate_at_work.jpg";
|
|
|
|
|
+ result = send_file(req, filename);
|
|
|
|
|
+ /* Respond with an empty chunk to signal HTTP response completion */
|
|
|
|
|
+ httpd_resp_send_chunk(req, NULL, 0);
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
#else
|
|
#else
|
|
|
if (!flowalignment) {
|
|
if (!flowalignment) {
|
|
|
ESP_LOGD(TAG, "ClassFloDControll::GetJPGStream: FlowAlignment is not (yet) initialized. Interrupt serving!");
|
|
ESP_LOGD(TAG, "ClassFloDControll::GetJPGStream: FlowAlignment is not (yet) initialized. Interrupt serving!");
|
|
|
- httpd_resp_send(req, NULL, 0);
|
|
|
|
|
- return ESP_FAIL;
|
|
|
|
|
|
|
+ std::string filename = "/sdcard/html/Flowstate_at_work.jpg";
|
|
|
|
|
+ result = send_file(req, filename);
|
|
|
|
|
+ /* Respond with an empty chunk to signal HTTP response completion */
|
|
|
|
|
+ httpd_resp_send_chunk(req, NULL, 0);
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (flowalignment->ImageBasis == NULL || !flowalignment->ImageBasis->ImageOkay()) {
|
|
if (flowalignment->ImageBasis == NULL || !flowalignment->ImageBasis->ImageOkay()) {
|
|
|
- httpd_resp_send(req, NULL, 0);
|
|
|
|
|
- return ESP_FAIL;
|
|
|
|
|
|
|
+ std::string filename = "/sdcard/html/Flowstate_at_work.jpg";
|
|
|
|
|
+ result = send_file(req, filename);
|
|
|
|
|
+ /* Respond with an empty chunk to signal HTTP response completion */
|
|
|
|
|
+ httpd_resp_send_chunk(req, NULL, 0);
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
_send = new (std::nothrow) CImageBasis("alg_roi", flowalignment->ImageBasis);
|
|
_send = new (std::nothrow) CImageBasis("alg_roi", flowalignment->ImageBasis);
|
|
|
|
|
|
|
@@ -788,7 +809,8 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
|
|
|
if (flowdigit) flowdigit->DrawROI(_send);
|
|
if (flowdigit) flowdigit->DrawROI(_send);
|
|
|
if (flowanalog) flowanalog->DrawROI(_send);
|
|
if (flowanalog) flowanalog->DrawROI(_send);
|
|
|
_sendDelete = true;
|
|
_sendDelete = true;
|
|
|
- } else {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "ClassFlowControll::GetJPGStream: Not enough memory to create alg_roi.jpg -> alg.jpg is going to be served!");
|
|
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "ClassFlowControll::GetJPGStream: Not enough memory to create alg_roi.jpg -> alg.jpg is going to be served!");
|
|
|
delete _send;
|
|
delete _send;
|
|
|
_send = flowalignment->ImageBasis;
|
|
_send = flowalignment->ImageBasis;
|