ClassControllCamera.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #ifndef CLASSCONTROLLCAMERA_H
  3. #define CLASSCONTROLLCAMERA_H
  4. #include <string>
  5. #include "freertos/FreeRTOS.h"
  6. #include "freertos/task.h"
  7. #include "freertos/queue.h"
  8. #include "freertos/event_groups.h"
  9. #include "esp_camera.h"
  10. #include <string>
  11. #include <esp_http_server.h>
  12. #include "CImageBasis.h"
  13. #include "../../include/defines.h"
  14. class CCamera {
  15. protected:
  16. int ActualQuality;
  17. framesize_t ActualResolution;
  18. int brightness, contrast, saturation;
  19. bool isFixedExposure;
  20. int waitbeforepicture_org;
  21. int led_intensity = 4095;
  22. void ledc_init(void);
  23. bool CameraInitSuccessful = false;
  24. bool demoMode = false;
  25. bool loadNextDemoImage(camera_fb_t *fb);
  26. long GetFileSize(std::string filename);
  27. public:
  28. int image_height, image_width;
  29. CCamera();
  30. esp_err_t InitCam();
  31. void LightOnOff(bool status);
  32. void LEDOnOff(bool status);
  33. esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
  34. esp_err_t CaptureToStream(httpd_req_t *req, bool FlashlightOn);
  35. void SetQualitySize(int qual, framesize_t resol);
  36. bool SetBrightnessContrastSaturation(int _brightness, int _contrast, int _saturation);
  37. void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol);
  38. void SetLEDIntensity(float _intrel);
  39. bool testCamera(void);
  40. void EnableAutoExposure(int flash_duration);
  41. bool getCameraInitSuccessful();
  42. void useDemoMode(void);
  43. framesize_t TextToFramesize(const char * text);
  44. esp_err_t CaptureToFile(std::string nm, int delay = 0);
  45. esp_err_t CaptureToBasisImage(CImageBasis *_Image, int delay = 0);
  46. };
  47. extern CCamera Camera;
  48. #endif