[esp32_camera] Replace std::function callbacks with CameraListener interface (#12165)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
deda7a1bf3
commit
f9ad832e7b
7 files changed
+78
-56
No files matched your search
@@ -67,12 +67,14 @@ void CameraWebServer::setup() {
|
||||
|
||||
httpd_register_uri_handler(this->httpd_, &uri);
|
||||
|
||||
camera::Camera::instance()->add_image_callback([this](std::shared_ptr<camera::CameraImage> image) {
|
||||
if (this->running_ && image->was_requested_by(camera::WEB_REQUESTER)) {
|
||||
this->image_ = std::move(image);
|
||||
xSemaphoreGive(this->semaphore_);
|
||||
}
|
||||
});
|
||||
camera::Camera::instance()->add_listener(this);
|
||||
}
|
||||
|
||||
void CameraWebServer::on_camera_image(const std::shared_ptr<camera::CameraImage> &image) {
|
||||
if (this->running_ && image->was_requested_by(camera::WEB_REQUESTER)) {
|
||||
this->image_ = image;
|
||||
xSemaphoreGive(this->semaphore_);
|
||||
}
|
||||
}
|
||||
|
||||
void CameraWebServer::on_shutdown() {
|
||||
|
||||
Reference in new issue
Block a user