ClassControllCamera.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. void SetQualitySize(int qual, framesize_t resol);
  35. bool SetBrightnessContrastSaturation(int _brightness, int _contrast, int _saturation);
  36. void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol);
  37. void SetLEDIntensity(float _intrel);
  38. bool testCamera(void);
  39. void EnableAutoExposure(int flash_duration);
  40. bool getCameraInitSuccessful();
  41. void useDemoMode(void);
  42. framesize_t TextToFramesize(const char * text);
  43. esp_err_t CaptureToFile(std::string nm, int delay = 0);
  44. esp_err_t CaptureToBasisImage(CImageBasis *_Image, int delay = 0);
  45. };
  46. extern CCamera Camera;
  47. #endif