#pragma once #include #include #include "constants.h" #include "image.h" #include "icamera.h" class InnoMakerOV9281 : public ICamera { constexpr static char videoDevice[] = "/dev/video0"; public: using buffer_t = std::array; public: InnoMakerOV9281(); ~InnoMakerOV9281(); public: static std::vector> search(); public: bool startStream() override; bool init(); bool setExposureTimeUs(int value) override; bool setGain(int value) override; bool getImage(Image &image); public: libcamera::Signal> newPixels; libcamera::Signal> newImage; private: bool setCamParam(unsigned int v4l2controlId, int value); bool openCam(); bool selectCam(int camIdx = 0); bool initCam(); private: int m_cam_fd{-1}; static constexpr uint8_t BUFFER_COUNT{3}; uint8_t *video_buffer_ptr[BUFFER_COUNT]; // buffer_t m_buf; std::jthread m_streamThread; };