diff --git a/slsDetectorSoftware/include/Detector.h b/slsDetectorSoftware/include/Detector.h index 1a47dd611..66ef0564f 100644 --- a/slsDetectorSoftware/include/Detector.h +++ b/slsDetectorSoftware/include/Detector.h @@ -254,38 +254,151 @@ class Detector { // Erik - /** CTB only.Sets the mask applied to every pattern. */ + + Result getFramesCaughtByReceiver(Positions pos = {}) const; + + Result getReceiverCurrentFrameIndex(Positions pos = {}) const; + + void resetFramesCaught(Positions pos = {}); + + //TODO! + // int createReceivingDataSockets(const bool destroy = false); + // void readFrameFromReceiver(); + + void setMasterFileWrite(bool value, Positions pos = {}); + + Result getMasterFileWrite(Positions pos = {}) const; + + void setReceiverStreamingFrequency(int freq = -1, int detPos = -1); + /** + * [All] If receiver streaming frequency is 0, then this timer between each + * data stream is set. Default is 500 ms. + */ + void setReceiverStreamingTimer(int time_in_ms = 500, Positions pos = {}); + + /** [All] */ + Result getReceiverStreamingTimer(Positions pos = {}) const; + + // TODO! + // int enableDataStreamingToClient(int enable = -1); + // int enableDataStreamingFromReceiver(int enable = -1, int detPos = -1) + + /** [TODO! All?] */ + void setTenGigaEnabled(bool value, Positions pos = {}); + + /** [TODO! All?] */ + Result getTenGigaEnabled(Positions pos = {}) const; + + /** [All] */ + void setReceiverFifoDepth(int nframes, Positions pos = {}); + + /** [All] */ + Result getReceiverFifoDepth(Positions pos = {}) const; + + /** [All] */ + void setReceiverSilentMode(bool value, Positions pos = {}); + + /** [All] */ + Result getReceiverSilentMode(Positions pos = {}) const; + + /** [CTB] */ + void setPattern(const std::string &fname, Positions pos = {}); + + /** [CTB] */ + void setPatternIOControl(uint64_t word, Positions pos = {}); + + /** [CTB] */ + Result getPatternIOControl(Positions pos = {}) const; + + /** [CTB] */ + void setPatternClockControl(uint64_t word, Positions pos = {}); + + /** [CTB] */ + Result getPatternClockControl(Positions pos = {}) const; + + /** + * [CTB] Writes a pattern word + * @param addr address of the word + * @param word word to be written, -1 reads the addr (same as + * executing the pattern) + * @param pos detector position + * @returns actual value + */ + void setPatternWord(int addr, uint64_t word, Positions pos = {}); + + // TODO! Does this have side effects? + // uint64_t getPatternWord()... + + /** + * [CTB] Sets the pattern or loop limits. + * @param level -1 complete pattern, 0,1,2, loop level + * @param start start address for level 0-2 + * @param stop stop address for level 0-2 + * @param n number of loops for level 0-2 + * @param detPos -1 for all detectors in list or specific detector position + */ + void setPatternLoops(int level, int start, int stop, int n, + Positions pos = {}); + + /** + * [CTB] Gets the pattern loop limits + * @param level -1 complete pattern, 0,1,2, loop level + * @param pos detector positions + * @returns array of start address, stop address and number of loops + */ + Result> getPatternLoops(int level, + Positions pos = {}) const; + + /** + * [CTB] Sets the wait address + * @param level 0,1,2, wait level + * @param addr wait address + * @param pos detector position + * @returns actual value + */ + void setPatternWaitAddr(int level, int addr, Positions pos = {}); + + /* [CTB] */ + Result getPatternWaitAddr(int level, Positions pos = {}) const; + + /** + * [CTB] Sets the wait time + * @param level 0,1,2, wait level + * @param t wait time + * @param pos detector position + */ + void setPatternWaitTime(int level, uint64_t t, Positions pos = {}); + + /** [CTB] */ + Result getPatternWaitTime(int level, Positions pos = {}) const; + + /** [CTB] Sets the mask applied to every pattern. */ void setPatternMask(uint64_t mask, Positions pos = {}); - /** CTB only. Gets the mask applied to every pattern. */ + /** [CTB] Gets the mask applied to every pattern. */ Result getPatternMask(Positions pos = {}); /** - * CTB only. Sets the bitmask that the mask will be applied to for every + * [CTB] Sets the bitmask that the mask will be applied to for every * pattern. * @param mask mask to select bits */ void setPatternBitMask(uint64_t mask, Positions pos = {}); /** - * CTB only. Gets the bits that the mask will be applied to for every + * [CTB] Gets the bits that the mask will be applied to for every * pattern */ Result getPatternBitMask(Positions pos = {}) const; - /** - * CTB only. Enable or disable the LED - * @param enable true to switch on, false to switch off - */ + /** [CTB] Enable or disable the LED */ void setLEDEnable(bool enable, Positions pos = {}); - /** - * CTB only. Get LED enable. - */ + /** [CTB] Get LED enable. */ Result getLEDEnable(Positions pos = {}) const; /** - * CTB only. Set Digital IO Delay + * [CTB] Set Digital IO Delay * @param digital IO mask to select the pins * @param delay delay in ps(1 bit=25ps, max of 775 ps) */ diff --git a/slsDetectorSoftware/include/multiSlsDetector.h b/slsDetectorSoftware/include/multiSlsDetector.h index 7c1d065aa..f35a258b2 100755 --- a/slsDetectorSoftware/include/multiSlsDetector.h +++ b/slsDetectorSoftware/include/multiSlsDetector.h @@ -20,7 +20,6 @@ class detectorData; #define SHORT_STRING_LENGTH 50 #define DATE_LENGTH 30 - #include #include /** @@ -49,10 +48,10 @@ struct sharedMultiSlsDetector { /** multi detector type */ slsDetectorDefs::detectorType multiDetectorType; - + /** END OF FIXED PATTERN * -----------------------------------------------*/ - + /** Number of detectors operated at once */ int numberOfDetector[2]; @@ -118,7 +117,8 @@ class multiSlsDetector : public virtual slsDetectorDefs { std::vector positions, typename NonDeduced::type... Args) { - if (positions.empty() || (positions.size() == 1 && positions[0] == -1 )) { + if (positions.empty() || + (positions.size() == 1 && positions[0] == -1)) { positions.resize(detectors.size()); std::iota(begin(positions), end(positions), 0); } @@ -141,9 +141,10 @@ class multiSlsDetector : public virtual slsDetectorDefs { template std::vector Parallel(RT (slsDetector::*somefunc)(CT...) const, std::vector positions, - typename NonDeduced::type... Args) const{ + typename NonDeduced::type... Args) const { - if (positions.empty() || (positions.size() == 1 && positions[0] == -1 )) { + if (positions.empty() || + (positions.size() == 1 && positions[0] == -1)) { positions.resize(detectors.size()); std::iota(begin(positions), end(positions), 0); } @@ -165,10 +166,11 @@ class multiSlsDetector : public virtual slsDetectorDefs { template void Parallel(void (slsDetector::*somefunc)(CT...), - std::vector positions, - typename NonDeduced::type... Args) { + std::vector positions, + typename NonDeduced::type... Args) { - if (positions.empty() || (positions.size() == 1 && positions[0] == -1 )) { + if (positions.empty() || + (positions.size() == 1 && positions[0] == -1)) { positions.resize(detectors.size()); std::iota(begin(positions), end(positions), 0); } @@ -187,10 +189,11 @@ class multiSlsDetector : public virtual slsDetectorDefs { template void Parallel(void (slsDetector::*somefunc)(CT...) const, - std::vector positions, - typename NonDeduced::type... Args) const{ + std::vector positions, + typename NonDeduced::type... Args) const { - if (positions.empty() || (positions.size() == 1 && positions[0] == -1 )) { + if (positions.empty() || + (positions.size() == 1 && positions[0] == -1)) { positions.resize(detectors.size()); std::iota(begin(positions), end(positions), 0); } @@ -210,7 +213,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { /** * Loop through the detectors serially and return the result as a vector */ - + template std::vector serialCall(RT (slsDetector::*somefunc)(CT...), typename NonDeduced::type... Args); @@ -250,13 +253,13 @@ class multiSlsDetector : public virtual slsDetectorDefs { * Set acquiring flag in shared memory * @param b acquiring flag */ - void setAcquiringFlag(bool flag);// + void setAcquiringFlag(bool flag); // /** * Get acquiring flag from shared memory * @returns acquiring flag */ - bool getAcquiringFlag() const;// + bool getAcquiringFlag() const; // /** * Check version compatibility with detector software @@ -264,7 +267,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 checkDetectorVersionCompatibility(int detPos = -1);// + void checkDetectorVersionCompatibility(int detPos = -1); // /** * Check version compatibility with receiver software @@ -272,7 +275,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 @@ -280,34 +283,38 @@ 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);//not needed anymore (later remove this_software_version from enum) + int64_t getId(idMode mode, + int detPos = -1); // not needed anymore (later remove + // this_software_version from enum) - int getMultiId()const{return multiId;} //part of multi also + int getMultiId() const { return multiId; } // part of multi also /** * 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(); // renamed to getDetectorSerialNumber + std::vector + getDetectorNumber(); // renamed to getDetectorSerialNumber /** * Free shared memory from the command line * avoiding creating the constructor classes and mapping * @param multiId multi detector Id * @param detPos -1 for all detectors in list or specific detector position */ - static void freeSharedMemory(int multiId, int detPos = -1);// private or not needed + static void freeSharedMemory(int multiId, + int detPos = -1); // private or not needed /** * Free shared memory and delete shared memory structure @@ -316,27 +323,29 @@ class multiSlsDetector : public virtual slsDetectorDefs { * object back to state before object creation amap * @param detPos -1 for all detectors in list or specific detector position */ - void freeSharedMemory(int detPos = -1);// + void freeSharedMemory(int detPos = -1); // /** * Get user details of shared memory * @returns string with user details */ - std::string getUserDetails();// part of multi + std::string getUserDetails(); // part of multi /** - * Sets the hostname of all sls detectors in shared memory and updates local cache + * Sets the hostname of all sls detectors in shared memory and updates local + * cache * @param name hostname of all the sls detectors */ - void setHostname(const std::vector &name);//cannot set individually - + void setHostname( + const std::vector &name); // cannot set individually + /** * Sets the hostname of all sls detectors in shared memory * Connects to them * @param name concatenated hostname of all the sls detectors * @param detPos -1 for all detectors in list or specific detector position */ - void setHostname(const char *name, int detPos = -1);// not needed + void setHostname(const char *name, int detPos = -1); // not needed /** * Gets the hostname of detector at particular position @@ -345,7 +354,15 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @returns concatenated hostnames of all detectors or hostname of specific * one */ - std::string getHostname(int detPos = -1) const;// + std::string getHostname(int detPos = -1) const; // + + /** + * Appends detectors to the end of the list in shared memory + * Connects to them + * @param name concatenated hostname of the sls detectors to be appended to + * the list + */ + void addMultipleDetectors(const char *name); // ???? /** * Get Detector type as an enum @@ -473,12 +490,12 @@ class multiSlsDetector : public virtual slsDetectorDefs { */ int getQuad(int detPos = -1); - /** - * Set Quad Type (Only for Eiger Quad detector hardware) - * @param enable true if quad type set, else false - * @param detPos -1 for all detectors in list or specific detector position - */ - void setQuad(const bool enable, int detPos = -1); + /** + * Set Quad Type (Only for Eiger Quad detector hardware) + * @param enable true if quad type set, else false + * @param detPos -1 for all detectors in list or specific detector position + */ + void setQuad(const bool enable, int detPos = -1); /** * Set number of rows to read out (Only for Eiger) @@ -549,11 +566,11 @@ class multiSlsDetector : public virtual slsDetectorDefs { */ int setReceiverPort(int port_number = -1, int detPos = -1); - /** - * Get Receiver port - * @param detPos -1 for all detectors in list or specific detector position - * @returns vector of receiver port - */ + /** + * Get Receiver port + * @param detPos -1 for all detectors in list or specific detector position + * @returns vector of receiver port + */ int getReceiverPort(int detPos = -1) const; /** @@ -588,7 +605,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * Load configuration from a configuration File * @param fname configuration file name */ - void readConfigurationFile(const std::string &fname);// + void readConfigurationFile(const std::string &fname); // /** * Write current configuration to a file @@ -719,20 +736,20 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position */ void configureMAC(int detPos = -1); - - /** + + /** * Set starting frame number for the next acquisition * @param val starting frame number * @param detPos -1 for all detectors in list or specific detector position */ - void setStartingFrameNumber(const uint64_t value, int detPos = -1);// + void setStartingFrameNumber(const uint64_t value, int detPos = -1); // /** * Get starting frame number for the next acquisition * @param detPos -1 for all detectors in list or specific detector position * @returns starting frame number */ - uint64_t getStartingFrameNumber(int detPos = -1);// + uint64_t getStartingFrameNumber(int detPos = -1); // /** * Set/get timer value (not all implemented for all detectors) @@ -752,7 +769,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @returns exposure time in ns, or s if specified */ double setExposureTime(double t = -1, bool inseconds = false, - int detPos = -1);// + int detPos = -1); // /** * Set/get exposure period @@ -762,7 +779,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @returns exposure period in ns, or s if specified */ double setExposurePeriod(double t = -1, bool inseconds = false, - int detPos = -1);// + int detPos = -1); // /** * Set/get delay after trigger (Gotthard, Jungfrau(not for this release)) @@ -783,7 +800,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @returns sub frame exposure time in ns, or s if specified */ double setSubFrameExposureTime(double t = -1, bool inseconds = false, - int detPos = -1);// + int detPos = -1); // /** * (Advanced users) @@ -863,7 +880,8 @@ class multiSlsDetector : public virtual slsDetectorDefs { * adcphase for Gotthard, others for CTB & Moench) * @param value (clkdivider 0,1,2 for full, half and quarter speed). Other * values check manual - * @param mode 0 for shift, 1 for degrees. relevant only for speed type adcphase and dbit phase + * @param mode 0 for shift, 1 for degrees. relevant only for speed type + * adcphase and dbit phase * @param detPos -1 for all detectors in list or specific detector position * @returns value of speed set */ @@ -969,7 +987,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns value read from register */ - uint32_t readRegister(uint32_t addr, int detPos = -1);// + uint32_t readRegister(uint32_t addr, int detPos = -1); // /** * Set bit in a register. For Advanced users @@ -978,7 +996,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns value read from register */ - uint32_t setBit(uint32_t addr, int n, int detPos = -1);// + uint32_t setBit(uint32_t addr, int n, int detPos = -1); // /** * Clear bit in a register. For Advanced users @@ -987,7 +1005,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns value read from register */ - uint32_t clearBit(uint32_t addr, int n, int detPos = -1);// + uint32_t clearBit(uint32_t addr, int n, int detPos = -1); // /** * Validates the format of the detector MAC address and sets it @@ -1400,7 +1418,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position */ void loadImageToDetector(imageType index, const std::string &fname, - int detPos = -1); + int detPos = -1); /** * Writes the counter memory block from the detector (Gotthard) @@ -1409,7 +1427,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position */ void writeCounterBlockFile(const std::string &fname, int startACQ = 0, - int detPos = -1); + int detPos = -1); /** * Resets counter in detector (Gotthard) @@ -1691,7 +1709,8 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param hostname name of pc to tftp from * @param detPos -1 for all detectors in list or specific detector position */ - void copyDetectorServer(const std::string &fname, const std::string &hostname, int detPos = -1); + void copyDetectorServer(const std::string &fname, + const std::string &hostname, int detPos = -1); /** * Reboot detector controller (Not Eiger) @@ -1707,7 +1726,8 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param fname programming file name * @param detPos -1 for all detectors in list or specific detector position */ - void update(const std::string &sname, const std::string &hostname, const std::string &fname, int detPos = -1); + void update(const std::string &sname, const std::string &hostname, + const std::string &fname, int detPos = -1); /** * Power on/off Chip (Jungfrau) @@ -1726,12 +1746,12 @@ class multiSlsDetector : public virtual slsDetectorDefs { int setAutoComparatorDisableMode(int ival = -1, int detPos = -1); /** - * Set Rate correction ( Eiger) - * @param t dead time in ns - if 0 disable correction, - * if >0 set dead time to t, if < 0 set deadtime to default dead time - * for current settings - * @param detPos -1 for all detectors in list or specific detector position - */ + * Set Rate correction ( Eiger) + * @param t dead time in ns - if 0 disable correction, + * if >0 set dead time to t, if < 0 set deadtime to default dead time + * for current settings + * @param detPos -1 for all detectors in list or specific detector position + */ void setRateCorrection(int64_t t = 0, int detPos = -1); /** @@ -1797,7 +1817,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns output file directory */ - std::string getFilePath(int detPos = -1);// + std::string getFilePath(int detPos = -1); // /** * Sets up the file directory @@ -1805,14 +1825,14 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param s file directory * @returns file dir */ - std::string setFilePath(const std::string &path, int detPos = -1);// + std::string setFilePath(const std::string &path, int detPos = -1); // /** * Returns file name prefix * @param detPos -1 for all detectors in list or specific detector position * @returns file name prefix */ - std::string getFileName(int detPos = -1);// + std::string getFileName(int detPos = -1); // /** * Sets up the file name prefix @@ -1820,7 +1840,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param s file name prefix * @returns file name prefix */ - std::string setFileName(const std::string &fname, int detPos = -1);// + std::string setFileName(const std::string &fname, int detPos = -1); // /** * Sets the max frames per file in receiver @@ -1881,57 +1901,51 @@ class multiSlsDetector : public virtual slsDetectorDefs { /** * Get File index - * @param detPos -1 for all detectors in list or specific detector position + * @param detPos -1 for all detectors in list or specific detector + * position * @returns file index */ int getFileIndex(int detPos = -1) const; - /** - * increments file index - * @param detPos -1 for all detectors in list or specific detector position - * @returns the file index - */ - int incrementFileIndex(int detPos = -1); - /** * Receiver starts listening to packets * @param detPos -1 for all detectors in list or specific detector position */ - void startReceiver(int detPos = -1);// + void startReceiver(int detPos = -1); // /** * Stops the listening mode of receiver * @param detPos -1 for all detectors in list or specific detector position */ - void stopReceiver(int detPos = -1);// + void stopReceiver(int detPos = -1); // /** * Gets the status of the listening mode of receiver * @param detPos -1 for all detectors in list or specific detector position * @returns status */ - runStatus getReceiverStatus(int detPos = -1);// + runStatus getReceiverStatus(int detPos = -1); // /** * Gets the number of frames caught by receiver * @param detPos -1 for all detectors in list or specific detector position * @returns number of frames caught by receiver */ - int getFramesCaughtByReceiver(int detPos = -1); + int getFramesCaughtByReceiver(int detPos = -1); // /** * Gets the current frame index of receiver * @param detPos -1 for all detectors in list or specific detector position * @returns average of all current frame index of receiver */ - uint64_t getReceiverCurrentFrameIndex(int detPos = -1); + uint64_t getReceiverCurrentFrameIndex(int detPos = -1); // /** * Resets framescaught in receiver * Use this when using startAcquisition instead of acquire * @param detPos -1 for all detectors in list or specific detector position */ - void resetFramesCaught(int detPos = -1); + void resetFramesCaught(int detPos = -1); // /** * Create Receiving Data Sockets @@ -1952,13 +1966,13 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns file write enable */ - int setFileWrite(bool value, int detPos = -1);// + int setFileWrite(bool value, int detPos = -1); // /** * Gets file write enable * @returns file write enable */ - int getFileWrite(int detPos = -1) const;// + int getFileWrite(int detPos = -1) const; // /** * Sets/Gets receiver master file write enable @@ -1966,14 +1980,14 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns master file write enable */ - int setMasterFileWrite(bool value, int detPos = -1); + int setMasterFileWrite(bool value, int detPos = -1); // /** * Gets master file write enable * @param detPos -1 for all detectors in list or specific detector position * @returns master file write enable */ - int getMasterFileWrite(int detPos = -1) const; + int getMasterFileWrite(int detPos = -1) const; // /** * Sets/Gets file overwrite enable @@ -1981,14 +1995,14 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns file overwrite enable */ - int setFileOverWrite(bool enable, int detPos = -1);// + int setFileOverWrite(bool enable, int detPos = -1); // /** * Gets file over write enable * @param detPos -1 for all detectors in list or specific detector position * @returns file over write enable */ - int getFileOverWrite(int detPos = -1) const;// + int getFileOverWrite(int detPos = -1) const; // /** * (previously setReadReceiverFrequency) @@ -2009,7 +2023,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns receiver streaming timer in ms */ - int setReceiverStreamingTimer(int time_in_ms = 500, int detPos = -1); + int setReceiverStreamingTimer(int time_in_ms = 500, int detPos = -1); // /** * Enable data streaming to client @@ -2032,7 +2046,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns if 10Gbe is enabled */ - int enableTenGigabitEthernet(int i = -1, int detPos = -1); + int enableTenGigabitEthernet(int i = -1, int detPos = -1); // /** * Set/get receiver fifo depth @@ -2040,7 +2054,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns the receiver fifo depth */ - int setReceiverFifoDepth(int i = -1, int detPos = -1); + int setReceiverFifoDepth(int i = -1, int detPos = -1); // /** * Set/get receiver silent mode @@ -2048,7 +2062,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns the receiver silent mode enable */ - int setReceiverSilentMode(int i = -1, int detPos = -1); + int setReceiverSilentMode(int i = -1, int detPos = -1); // /** * Opens pattern file and sends pattern (CTB/ Moench) @@ -2056,7 +2070,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns OK/FAIL */ - int setPattern(const std::string &fname, int detPos = -1); + int setPattern(const std::string &fname, int detPos = -1); // /** * Sets pattern IO control (CTB/ Moench) @@ -2064,7 +2078,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns actual value */ - uint64_t setPatternIOControl(uint64_t word = -1, int detPos = -1); + uint64_t setPatternIOControl(uint64_t word = -1, int detPos = -1); // /** * Sets pattern clock control (CTB/ Moench) @@ -2072,7 +2086,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns actual value */ - uint64_t setPatternClockControl(uint64_t word = -1, int detPos = -1); + uint64_t setPatternClockControl(uint64_t word = -1, int detPos = -1); // /** * Writes a pattern word (CTB/ Moench) @@ -2082,7 +2096,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns actual value */ - uint64_t setPatternWord(int addr, uint64_t word, int detPos = -1); + uint64_t setPatternWord(int addr, uint64_t word, int detPos = -1); // /** * Sets the pattern or loop limits (CTB/ Moench) @@ -2093,7 +2107,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position */ void setPatternLoops(int level, int start = -1, int stop = -1, int n = -1, - int detPos = -1); + int detPos = -1); // /** * Gets the pattern loop limits (CTB/ Moench) @@ -2101,7 +2115,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns array of start address, stop address and number of loops */ - std::array getPatternLoops(int level, int detPos = -1); + std::array getPatternLoops(int level, int detPos = -1); // /** * Sets the wait address (CTB/ Moench) @@ -2110,7 +2124,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns actual value */ - int setPatternWaitAddr(int level, int addr = -1, int detPos = -1); + int setPatternWaitAddr(int level, int addr = -1, int detPos = -1); // /** * Sets the wait time (CTB/ Moench) @@ -2119,7 +2133,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns actual value */ - uint64_t setPatternWaitTime(int level, uint64_t t = -1, int detPos = -1); + uint64_t setPatternWaitTime(int level, uint64_t t = -1, int detPos = -1); // /** * Sets the mask applied to every pattern (CTB/ Moench) @@ -2141,7 +2155,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param mask mask to select bits * @param detPos -1 for all detectors in list or specific detector position */ - void setPatternBitMask(uint64_t mask, int detPos = -1);// + void setPatternBitMask(uint64_t mask, int detPos = -1); // /** * Gets the bits that the mask will be applied to for every pattern (CTB/ @@ -2149,7 +2163,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns mask of bits selected */ - uint64_t getPatternBitMask(int detPos = -1);// + uint64_t getPatternBitMask(int detPos = -1); // /** * Set LED Enable (Moench, CTB only) @@ -2211,8 +2225,8 @@ class multiSlsDetector : public virtual slsDetectorDefs { * s is for subframe number for eiger for 32 bit mode * @param pArg argument */ - void registerDataCallback(void (*userCallback)(detectorData *, uint64_t, uint32_t, - void *), + void registerDataCallback(void (*userCallback)(detectorData *, uint64_t, + uint32_t, void *), void *pArg); /** @@ -2222,16 +2236,21 @@ class multiSlsDetector : public virtual slsDetectorDefs { * index, loops for measurements, calls required call backs. * @returns OK or FAIL depending on if it already started */ - int acquire();// + int acquire(); // /** * Combines data from all readouts and gives it to the gui * or just gives progress of acquisition by polling receivers */ void processData(); - private: + /** + * increments file index + * @param detPos -1 for all detectors in list or specific detector position + * @returns the file index + */ + int incrementFileIndex(int detPos = -1); /** * Creates/open shared memory, initializes detector structure and members * Called by constructor/ set hostname / read config file @@ -2239,8 +2258,8 @@ class multiSlsDetector : public virtual slsDetectorDefs { * one * @param update true to update last user pid, date etc */ - void setupMultiDetector(bool verify = true, bool update = true); - + void setupMultiDetector(bool verify = true, bool update = true); + /** * Initialize (open/create) shared memory for the sharedMultiDetector * structure diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 8cba007d9..4a0b30428 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -203,6 +203,110 @@ void Detector::setMaxNumberOfChannels(const defs::coordinates value) { pimpl->setMaxNumberOfChannels(value); } // Erik +Result Detector::getFramesCaughtByReceiver(Positions pos) const{ + return pimpl->Parallel(&slsDetector::getFramesCaughtByReceiver, pos); +} + +Result Detector::getReceiverCurrentFrameIndex(Positions pos) const { + return pimpl->Parallel(&slsDetector::getReceiverCurrentFrameIndex, pos); +} + +void Detector::resetFramesCaught(Positions pos) { + pimpl->Parallel(&slsDetector::resetFramesCaught, pos); +} + +void Detector::setMasterFileWrite(bool value, Positions pos) { + pimpl->Parallel(&slsDetector::setMasterFileWrite, pos, value); +} + +Result Detector::getMasterFileWrite(Positions pos) const { + return pimpl->Parallel(&slsDetector::getMasterFileWrite, pos); +} + +void Detector::setReceiverStreamingTimer(int time_in_ms, Positions pos) { + pimpl->Parallel(&slsDetector::setReceiverStreamingTimer, pos, time_in_ms); +} + +Result Detector::getReceiverStreamingTimer(Positions pos) const { + return pimpl->Parallel(&slsDetector::setReceiverStreamingTimer, pos, -1); +} + +void Detector::setTenGigaEnabled(bool value, Positions pos) { + pimpl->Parallel(&slsDetector::enableTenGigabitEthernet, pos, + static_cast(value)); +} + +Result Detector::getTenGigaEnabled(Positions pos) const { + return pimpl->Parallel(&slsDetector::enableTenGigabitEthernet, pos, -1); +} + +Result Detector::getReceiverFifoDepth(Positions pos) const { + return pimpl->Parallel(&slsDetector::setReceiverFifoDepth, pos, -1); +} + +void Detector::setReceiverFifoDepth(int nframes, Positions pos) { + pimpl->Parallel(&slsDetector::setReceiverFifoDepth, pos, nframes); +} + +Result Detector::getReceiverSilentMode(Positions pos) const { + return pimpl->Parallel(&slsDetector::setReceiverSilentMode, pos, -1); +} + +void Detector::setReceiverSilentMode(bool value, Positions pos) { + pimpl->Parallel(&slsDetector::setReceiverSilentMode, pos, + static_cast(value)); +} + +void Detector::setPattern(const std::string &fname, Positions pos) { + pimpl->Parallel(&slsDetector::setPattern, pos, fname); +} + +void Detector::setPatternIOControl(uint64_t word, Positions pos) { + pimpl->Parallel(&slsDetector::setPatternIOControl, pos, word); +} + +Result Detector::getPatternIOControl(Positions pos) const { + return pimpl->Parallel(&slsDetector::setPatternIOControl, pos, -1); +} + +void Detector::setPatternClockControl(uint64_t word, Positions pos) { + pimpl->Parallel(&slsDetector::setPatternClockControl, pos, word); +} + +Result Detector::getPatternClockControl(Positions pos) const { + return pimpl->Parallel(&slsDetector::setPatternClockControl, pos, -1); +} + +void Detector::setPatternWord(int addr, uint64_t word, Positions pos) { + pimpl->Parallel(&slsDetector::setPatternWord, pos, addr, word); +} + +void Detector::setPatternLoops(int level, int start, int stop, int n, + Positions pos) { + pimpl->Parallel(&slsDetector::setPatternLoops, pos, level, start, stop, n); +} + +Result> Detector::getPatternLoops(int level, + Positions pos) const { + return pimpl->Parallel(&slsDetector::setPatternLoops, pos, level, -1, -1, + -1); +} + +void Detector::setPatternWaitAddr(int level, int addr, Positions pos) { + pimpl->Parallel(&slsDetector::setPatternWaitAddr, pos, level, addr); +} + +Result Detector::getPatternWaitAddr(int level, Positions pos) const { + return pimpl->Parallel(&slsDetector::setPatternWaitAddr, pos, level, -1); +} + +void Detector::setPatternWaitTime(int level, uint64_t t, Positions pos) { + pimpl->Parallel(&slsDetector::setPatternWaitTime, pos, level, t); +} + +Result Detector::getPatternWaitTime(int level, Positions pos) const { + return pimpl->Parallel(&slsDetector::setPatternWaitTime, pos, level, -1); +} Result Detector::getPatternMask(Positions pos) { return pimpl->Parallel(&slsDetector::getPatternMask, pos);