From 615835f03dbe6f8893702106f8e92461219377b9 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Wed, 7 Aug 2019 12:32:59 +0200 Subject: [PATCH] WIP --- slsDetectorSoftware/include/Detector.h | 56 ++++++++++++++++--- .../include/multiSlsDetector.h | 12 ++-- slsDetectorSoftware/src/Detector.cpp | 37 ++++++++---- 3 files changed, 79 insertions(+), 26 deletions(-) diff --git a/slsDetectorSoftware/include/Detector.h b/slsDetectorSoftware/include/Detector.h index 6640a474b..60a19cc1c 100644 --- a/slsDetectorSoftware/include/Detector.h +++ b/slsDetectorSoftware/include/Detector.h @@ -36,13 +36,13 @@ class Detector { /** * Get the acquiring flag. When true the detector blocks - * any attempt to start a new acquisition. + * any attempt to start a new acquisition. */ bool getAcquiringFlag() const; /** - * Set the acquiring flag. This might have to done manually - * after an acquisition was aborted. + * Set the acquiring flag. This might have to done manually + * after an acquisition was aborted. */ void setAcquiringFlag(bool value); @@ -66,7 +66,7 @@ class Detector { // Bits and registers /** - * Clears (sets to 0) bit number bitnr in register at addr. + * Clears (sets to 0) bit number bitnr in register at addr. * @param addr address of the register * @param bitnr bit number to clear * @param pos detector position @@ -124,14 +124,52 @@ class Detector { void setPeriod(ns t, Positions pos = {}); // dhanya + /** * Check version compatibility with detector software - * (if hostname/rx_hostname has been set/ sockets created) - * @param p port type control port or receiver port - * @param detPos -1 for all detectors in list or specific detector position + * @param pos detector position */ - void checkDetectorVersionCompatibility(Positions pos = {}); - + void checkDetectorVersionCompatibility(Positions pos = {}) const; + + /** + * Check version compatibility with receiver software + * @param pos detector position + */ + void checkReceiverVersionCompatibility(Positions pos = {}) const; + + /** + * Get detector firmware version + * @param pos detector position + * @returns detector firmware version + */ + int64_t getDetectorFirmwareVersion(Positions pos = {}) const; + + /** + * Get detector server version + * @param pos detector position + * @returns detector server version + */ + int64_t getDetectorServerVersion(Positions pos = {}) const; + + /** + * Get detector serial number + * @param pos detector position + * @returns detector serial number + */ + int64_t getDetectorSerialNumber(Positions pos = {}) const; + + /** + * Get Client Software version + * @returns client software version + */ + int64_t getClientSoftwareVersion() const; + + /** + * Get Receiver software version + * @param pos detector position + * @return receiver software version + */ + int64_t getReceiverSoftwareVersion(Positions pos = {}) const; }; } // namespace sls \ No newline at end of file diff --git a/slsDetectorSoftware/include/multiSlsDetector.h b/slsDetectorSoftware/include/multiSlsDetector.h index d05465887..433612f9d 100755 --- a/slsDetectorSoftware/include/multiSlsDetector.h +++ b/slsDetectorSoftware/include/multiSlsDetector.h @@ -294,7 +294,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param p port type control port or receiver port * @param detPos -1 for all detectors in list or specific detector position */ - void checkReceiverVersionCompatibility(int detPos = -1); + void checkReceiverVersionCompatibility(int detPos = -1);// /** * Get ID or version numbers @@ -302,27 +302,27 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns Id or version number of that type */ - int64_t getId(idMode mode, int detPos = -1); + int64_t getId(idMode mode, int detPos = -1);//not needed anymore (later remove this_software_version from enum) - int getMultiId()const{return multiId;} + int getMultiId()const{return multiId;} //public but part of multi /** * Get Client Software version * @returns client software version */ - int64_t getClientSoftwareVersion() const; + int64_t getClientSoftwareVersion() const;// /** * Get Receiver software version * @return receiver software version */ - int64_t getReceiverSoftwareVersion(int detPos = -1); + int64_t getReceiverSoftwareVersion(int detPos = -1);// /** * Get Detector Number * @returns vector of detector number */ - std::vector getDetectorNumber(); + std::vector getDetectorNumber(); // renamed to getDetectorSerialNumber /** * Free shared memory from the command line * avoiding creating the constructor classes and mapping diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index eaf1d7ce9..5206f2368 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -11,7 +11,6 @@ Detector::Detector(int multi_id) : pimpl(sls::make_unique(multi_id)) {} Detector::~Detector() = default; - // Acquisition void Detector::acquire() { pimpl->acquire(); } @@ -26,13 +25,9 @@ Result Detector::getReceiverStatus(Positions pos) { return pimpl->Parallel(&slsDetector::getReceiverStatus, pos); } -bool Detector::getAcquiringFlag() const{ - return pimpl->getAcquiringFlag(); -} +bool Detector::getAcquiringFlag() const { return pimpl->getAcquiringFlag(); } -void Detector::setAcquiringFlag(bool value){ - pimpl->setAcquiringFlag(value); -} +void Detector::setAcquiringFlag(bool value) { pimpl->setAcquiringFlag(value); } // Configuration Result Detector::getHostname(Positions pos) const { @@ -41,7 +36,6 @@ Result Detector::getHostname(Positions pos) const { void Detector::freeSharedMemory() { pimpl->freeSharedMemory(); } - void Detector::setConfig(const std::string &fname) { pimpl->readConfigurationFile(fname); } @@ -126,12 +120,33 @@ Result Detector::getFileOverWrite(Positions pos) const { return pimpl->Parallel(&slsDetector::getFileOverWrite, pos); } - // dhanya -Result Detector::checkDetectorVersionCompatibility(Positions pos) const { - return pimpl->Parallel(&slsDetector::checkDetectorVersionCompatibility, pos); +Result Detector::checkDetectorVersionCompatibility(Positions pos) const { + pimpl->Parallel(&slsDetector::checkDetectorVersionCompatibility, pos); } +Result Detector::checkReceiverVersionCompatibility(Positions pos) const { + pimpl->Parallel(&slsDetector::checkReceiverVersionCompatibility, pos); +} +Result Detector::getDetectorFirmwareVersion(Positions pos) const { + return pimpl->Parallel(&slsDetector::getId, DETECTOR_FIRMWARE_VERSION, pos); +} + +Result Detector::getDetectorServerVersion(Positions pos) const { + return pimpl->Parallel(&slsDetector::getId, DETECTOR_SOFTWARE_VERSION, pos); +} + +Result Detector::getDetectorSerialNumber(Positions pos) const { + return pimpl->Parallel(&slsDetector::getId, DETECTOR_SERIAL_NUMBER, pos); +} + +Result Detector::getClientSoftwareVersion() const { + return APILIB; +} + +Result Detector::getReceiverSoftwareVersion(Positions pos) const { + return pimpl->Parallel(&slsDetector::getReceiverSoftwareVersion, pos); +} } // namespace sls \ No newline at end of file