13 #include "../MetaInstruments/Camera.h"
18 #include "../include/PVCam/master.h"
19 #include "../include/PVCam/pvcam.h"
30 const std::source_location Location = std::source_location::current()) noexcept
41 virtual const char*
GetParamClassTag() const noexcept
override {
return "PVCamHardwareAdapterParams"; }
44 "Name of the PVCam camera to connect with" };
84 static [[nodiscard]]
LockType Lock(
const std::chrono::milliseconds
Timeout = std::chrono::milliseconds(100));
99 constexpr
static auto Name() noexcept {
return "PVCam"; }
100 constexpr
static auto Category() noexcept {
return "Image Capturing"; }
161 static void PV_DECL
NewFrameCallback(PVCamSyms::FRAME_INFO* FrameInfo,
void* PVCamHardwareAdapterPtr);
173 void CheckError(const PVCamSyms::rs_bool Result,
bool OnlyLog = false, const std::source_location Location = std::source_location::current()) const;
178 void ReserveMemory(const PVCamSyms::uns32 BytesRequired) const;
186 void NewFrame(PVCamSyms::FRAME_INFO* FrameInfo) noexcept;
Implementation of DynExp hardware adapter objects.
PVCamException(std::string Description, const int ErrorCode, const Util::ErrorType Type=Util::ErrorType::Error, const std::source_location Location=std::source_location::current()) noexcept
PVCamHardwareAdapterConfigurator()=default
virtual ~PVCamHardwareAdapterConfigurator()=default
virtual DynExp::ParamsBasePtrType MakeParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core) const override
Override to make derived classes call DynExp::MakeParams with the correct configurator type derived f...
virtual const char * GetParamClassTag() const noexcept override
This function is intended to be overridden once in each derived class returning the name of the respe...
void ConfigureParamsImpl(dispatch_tag< HardwareAdapterParamsBase >) override final
virtual ~PVCamHardwareAdapterParams()=default
Param< TextList > CameraName
virtual void ConfigureParamsImpl(dispatch_tag< PVCamHardwareAdapterParams >)
PVCamHardwareAdapterParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core)
Only one instance of this class is allowed for synchronizing calls to the PVCam library from any PVCa...
static auto GetIsInitialized() noexcept
std::atomic< bool > IsInitialized
static LockType Lock(const std::chrono::milliseconds Timeout=std::chrono::milliseconds(100))
static PVCamInitializer & GetInstance(bool MayInit=false)
PVCamInitializer()=default
auto GetBitDepth() const noexcept
constexpr static auto BytesPerPixel() noexcept
void StartCapturing() const
static constexpr unsigned int NumFramesInBuffer
std::atomic< bool > PVCamHandleValid
void StopCapturing() const
auto GetColorMode() const noexcept
virtual std::string GetName() const override
Returns the name of this Object type.
void StopCapturingUnsafe() const
virtual void ResetImpl(dispatch_tag< PVCamHardwareAdapter >)
auto GetCameraState() const noexcept
void ReserveMemory(const PVCamSyms::uns32 BytesRequired) const
virtual std::string GetCategory() const override
Returns the category of this Object type.
PVCamHardwareAdapter(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
bool IsConnectedChild() const noexcept override final
Determines the connection status of the hardware interface.
decltype(PVCamSyms::rgn_type::p2) GetImageHeight() const
TimeType GetMaxExposureTime() const
Util::BlobDataType GetCurrentImage() const
std::vector< PVCamReadoutOptionType > CameraSpeedTable
PVCamEnumVectorType ReadPVCamEnumUnsafe(PVCamSyms::uns32 ParamID, std::string ParamName)
void CaptureSingle() const
decltype(PVCamSyms::rgn_type::s2) GetImageWidth() const
void ResetImpl(dispatch_tag< HardwareAdapterBase >) override final
virtual ~PVCamHardwareAdapter()
constexpr static auto Category() noexcept
std::chrono::milliseconds TimeType
PVCamSyms::rgn_type Region
void SetCameraModeUnsafe(size_t ID) const
static void PV_DECL NewFrameCallback(PVCamSyms::FRAME_INFO *FrameInfo, void *PVCamHardwareAdapterPtr)
Util::BlobDataType GetCurrentImageCopy() const
void ReadExposureTimeUnsafe() const
TimeType GetExposureTime() const
void StartCapturingUnsafe() const
std::vector< PVCamEnumType > PVCamEnumVectorType
PVCamSyms::int16 PVCamHandle
void NewFrame(PVCamSyms::FRAME_INFO *FrameInfo) noexcept
bool IsReadyChild() const override final
Returns wheter this Object instance is ready (e.g. it is running or connected to a hardware device) a...
std::atomic< PVCamSyms::PL_COLOR_MODES > ColorMode
void EnsureReadyStateChild() override final
Ensures that this Object instance is ready by possibly starting its worker thread or by opening conne...
void CheckError(const PVCamSyms::rs_bool Result, bool OnlyLog=false, const std::source_location Location=std::source_location::current()) const
void ReadMinMaxExposureTimeUnsafe() const
constexpr static auto Name() noexcept
Util::BlobDataType CopiedImageData
bool IsOpened() const noexcept
std::atomic< CameraStateType > CameraState
Util::BlobDataType ImageData
TimeType GetMinExposureTime() const
void SetExposureTime(TimeType Time) const
void SetCameraMode(size_t ID) const
DynExpInstr::CameraData::CameraModesType GetCameraModes() const
std::atomic< PVCamSyms::int16 > BitDepth
std::pair< PVCamSyms::int32, std::string > PVCamEnumType
void SetupSpeedTableUnsafe()
CapturingStateType
Type indicating whether the camera is currently capturing images.
std::vector< std::string > CameraModesType
List type containing strings of modes the camera can operate in.
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
Defines the base class for a hardware adapter object. Hardware adapters describe interfaces/connectio...
Configurator class for HardwareAdapterBase.
Parameter class for HardwareAdapterBase.
HardwareAdapterParamsBase(ItemIDType ID, const DynExpCore &Core)
Constructs the parameters for a HardwareAdapterBase instance.
const std::thread::id OwnerThreadID
Thread id of the thread which has constructed (and owns) this Object instance.
const ParamsBasePtrType Params
Pointer to the parameter class instance belonging to this Object instance.
Refer to ParamsBase::dispatch_tag.
const ItemIDType ID
ID of the Object this parameter class instance belongs to.
const DynExpCore & Core
Reference to DynExp's core.
Tag for function dispatching mechanism within this class used when derived classes are not intended t...
Data type which manages a binary large object. The reserved memory is freed upon destruction.
DynExp exceptions are derived from this class. It contains basic information about the cause of the e...
Exception(std::string Description, const ErrorType Type=ErrorType::Error, const int ErrorCode=-1, const std::source_location Location=std::source_location::current()) noexcept
Constructs an exception. Constructor is noexcept, although std::runtime_error() might throw std::bad_...
const ErrorType Type
DynExp error type from Util::ErrorType
const int ErrorCode
DynExp error code from DynExpErrorCodes::DynExpErrorCodes
Interface to allow synchronizing the access to derived classes between different threads by providing...
std::unique_lock< MutexType > LockType
DynExp's hardware namespace contains the implementation of DynExp hardware adapters which extend DynE...
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
size_t ItemIDType
ID type of objects/items managed by DynExp.
DynExp's Util namespace contains commonly used functions and templates as well as extensions to Qt an...
ErrorType
DynExp's error types
Accumulates include statements to provide a precompiled header.
PVCamSyms::int16 GainIndex
GainOptionType(PVCamSyms::int16 GainIndex, PVCamSyms::int16 BitDepth)
PVCamSyms::int16 BitDepth
float ReadoutFrequency
in MHz
std::vector< GainOptionType > Gains
PVCamSyms::int16 SpeedIndex
PVCamReadoutOptionType(PVCamEnumType Port, PVCamSyms::int16 SpeedIndex, float ReadoutFrequency)