res=httpd_resp_send_chunk(req, (const char*)part_buf, hlen); } if(res==ESP_OK){ res=httpd_resp_send_chunk(req, (const char*)_jpg_buf, _jpg_buf_len); } if(res==ESP_OK){ res=httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY)); } if(fb){ esp_camera_f...
httpd_resp_set_hdr(req, "Custom-Header-11", "Custom-Value-1"); httpd_resp_set_hdr(req, "Custom-Header-22", "Custom-Value-2"); /* Send response with custom headers and body set as the * string passed in user context*/ const char* resp_str = (const char*) req->user_ctx; htt...
httpd_resp_set_hdr(req, "Custom-Header-2", "Custom-Value-2"); /* Send response with custom headers and body set as the * string passed in user context*/ const char* resp_str = (const char*) req->user_ctx; httpd_resp_send(req, resp_str, HTTPD_RESP_USE_STRLEN); /* After send...
{//...}//--- data_cmd='SHOW_'elseif(strstr(data_cmd,"SHOW")) {//...}//--- 其他情况不处理else{//...}//--- step2 response Clientconstcharresp[] ="POST Response!"; httpd_resp_set_status(req,"200 OK"); httpd_resp_sendstr(req, resp);returnESP_OK; } 2.2.2 如何将.html...
, -1); httpd_resp_send_chunk(req, buf, req->content_len); httpd_resp_send_chunk(req, NULL, 0); return ESP_OK;}5. 处理web socket连接 除了支持HTTP请求外,ESP-IDF的Web服务器还支持WebSocket连接。WebSocket是一种基于TCP的协议,可以提供双向通信功能。在ESP-IDF中,我们可以使用httpd...
{ /* 如果发生超时,重试接收 */ continue; } return ESP_FAIL; } /* 发回相同的数据 */ httpd_resp_send_chunk(req, buf, ret); remaining -= ret; esp_err_t ret = httpd_query_key_value(buf, "ssid", wifi_name, sizeof(wifi_name)); if (ret == ESP_OK) { char str[32]; memcpy(...
res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len); } if(res == ESP_OK){ res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY)); } if(fb){ esp_camera_fb_return(fb); fb = NULL; ...
res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen); } if(res == ESP_OK){ res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len); } if(res == ESP_OK){ res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY)); ...
}if(httpd_resp_send_chunk(j->req, (constchar*)data, len) != ESP_OK){return0; } j->len += len;returnlen; }esp_err_tjpg_httpd_handler(httpd_req_t*req){camera_fb_t* fb =NULL;esp_err_tres = ESP_OK;size_tfb_len =0;int64_tfr_start = esp_timer_get_time(); ...
ESP_OK:ESP_FAIL; httpd_resp_send_chunk(req, NULL, 0); fb_len = jchunk.len; } } esp_camera_fb_return(fb); int64_t fr_end = esp_timer_get_time(); ESP_LOGI(TAG, "JPG: %uKB %ums", (uint32_t)(fb_len/1024), (uint32_t)((fr_end - fr_start)/1000)); return res; }...