#pragma once #include #include "constants.h" #include "image.h" class ICamera { public: virtual bool setExposureTimeMs(int value) = 0; virtual bool setGain(int value) = 0; }; class InnoMakerOV9281 : public ICamera { public: using buffer_t = std::array; public: InnoMakerOV9281(); ~InnoMakerOV9281(); public: bool init(); bool setExposureTimeMs(int value) override; bool setGain(int value) override; bool getImage(Image &image); 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; };