From 7af26220125905e140f7df48dbb20c8f05ad6078 Mon Sep 17 00:00:00 2001 From: uvos Date: Fri, 2 Jul 2021 19:01:41 +0200 Subject: [PATCH] Add getTemperature method --- uvoscam.cpp | 17 +++++++++++++++++ uvoscam.h | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/uvoscam.cpp b/uvoscam.cpp index 4b4ae64..079af93 100644 --- a/uvoscam.cpp +++ b/uvoscam.cpp @@ -397,6 +397,23 @@ bool Camera::setExposureTime(uint64_t us) return !error; } +bool Camera::getTemperature(double& temperature) +{ + GError* error = nullptr; + bool temperatureAvailable = arv_camera_is_feature_available(aCamera_, "DeviceTemperature", &error); + if(error || !temperatureAvailable ) + return false; + + temperature = arv_device_get_float_feature_value(arv_camera_get_device(aCamera_), "DeviceTemperature", &error); + + if(error) + { + Log(Log::WARN)<message; + return false; + } + return true; +} + uint64_t Camera::getExposureTime() { GError* error = nullptr; diff --git a/uvoscam.h b/uvoscam.h index 0b4bfca..15f244f 100644 --- a/uvoscam.h +++ b/uvoscam.h @@ -40,7 +40,7 @@ public: class Description { private: - size_t hash = 0; + uint64_t hash = 0; std::string vendor_; std::string serial_; std::string model_; @@ -53,7 +53,7 @@ public: hash = std::hash{}(vendor_ + serial_ + model_); } - size_t getId() const + uint64_t getId() const { return hash; } @@ -172,6 +172,7 @@ public: bool startAcquisition(); bool stopAcquisition(); bool setMtu(int mtu); + bool getTemperature(double& temperature); void getSize(unsigned int* x, unsigned int* y); void setBayerMode(Camera::BayerMode mode); Camera::BayerMode getBayerMode();