diff --git a/slsDetectorSoftware/CMakeLists.txt b/slsDetectorSoftware/CMakeLists.txt index 568c64a14..b892d81ab 100755 --- a/slsDetectorSoftware/CMakeLists.txt +++ b/slsDetectorSoftware/CMakeLists.txt @@ -1,6 +1,5 @@ set(SOURCES src/DetectorImpl.cpp - src/slsDetectorUsers.cpp src/Module.cpp src/Detector.cpp src/CmdProxy.cpp @@ -39,7 +38,6 @@ target_link_libraries(slsDetectorShared set(PUBLICHEADERS - include/slsDetectorUsers.h include/detectorData.h include/Detector.h include/Result.h diff --git a/slsDetectorSoftware/include/slsDetectorUsers.h b/slsDetectorSoftware/include/slsDetectorUsers.h deleted file mode 100644 index aab277ca1..000000000 --- a/slsDetectorSoftware/include/slsDetectorUsers.h +++ /dev/null @@ -1,910 +0,0 @@ -#pragma once - -// class detectorData; -namespace sls { -class Detector; -} -#include - -class slsDetectorUsers { - - public: - /** - * @param shm_id detector shared memory id - * Default value is 0. Can be set to more values for - * multiple detectors.It is important only if you - * are controlling multiple detectors from the same pc. - */ - slsDetectorUsers(int shm_id = 0); - ~slsDetectorUsers(); - - /************************************************** - * * - * CONFIGURATION * - * * - * ************************************************/ - - void readConfigurationFile(const std::string &fname); - - /** Gets the total number of detectors */ - int size() const; - - // /** - // * Returns the size of detector/multi detector - // * @param nx number of channels in horiziontal - // * @param ny number of channels in vertical - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns the total number of channels of all sls detectors - // */ - // int getDetectorSize(int &nx, int &ny, int detPos); - - // /** - // * Gets detector type - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns detector type (EIGER, JUNGFRAU, GOTTHARD) slsDetectorDefs - // */ - // std::string getDetectorType(int detPos = -1); - - // /** - // * Write current configuration to a file (for one time detector setup) - // * @param fname configuration file name - // */ - // void writeConfigurationFile(const std::string& fname); - - // /** - // * Loads the detector setup from file (current measurement setup) - // * @param fname file to read from - // * @returns OK or FAIL - // */ - // int retrieveDetectorSetup(const std::string& fname); - - // /** - // * Saves the detector setup to file (currentmeasurement setup) - // * @param fname file to write to - // * @returns OK or FAIL - // */ - // int dumpDetectorSetup(const std::string& fname); - - // /** - // * Get detector firmware version - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns detector firmware version - // */ - // int64_t getDetectorFirmwareVersion(int detPos = -1); - - // /** - // * Get detector serial number or MAC - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns detector serial number or MAC - // */ - // int64_t getDetectorSerialNumber(int detPos = -1); - - // /** - // * Get on-board detector server software version - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns on-board detector server software version - // */ - // int64_t getDetectorSoftwareVersion(int detPos = -1); - - // /** - // * (previously getThisSoftwareVersion) - // * Get client software version - // * @returns client software version - // */ - // int64_t getClientSoftwareVersion(); - - // /** - // * Get receiver software version - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns receiver software version - // */ - // int64_t getReceiverSoftwareVersion(int detPos = -1); - - // /** - // * Check Detector Version Compatibility - // * @param detPos -1 for all detectors in list or specific detector - // position - // */ - // void isDetectorVersionCompatible(int detPos = -1); - - // /** - // * Check Receiver Version Compatibility - // * @param detPos -1 for all detectors in list or specific detector - // position - // */ - // void isReceiverVersionCompatible(int detPos = -1); - - // /** - // * Performs a complete acquisition - // * resets frames caught in receiver, starts receiver, starts detector, - // * blocks till detector finished acquisition, stop receiver, increments - // file index, - // * loops for measurements, calls required call backs. - // * @returns OK or FAIL depending on if it already started - // */ - // int startMeasurement(); - - // /** - // * Stop detector acquisition - // * @param detPos -1 for all detectors in list or specific detector - // position - // */ - // void stopMeasurement(int detPos = -1); - - // /** - // * Get Detector run status - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns status - // */ - // int getDetectorStatus(int detPos = -1); - - // /** - // * (Advanced user, included in startMeasurement) - // * Start detector acquisition (Non blocking) - // * @param detPos -1 for all detectors in list or specific detector - // position - // */ - // void startAcquisition(int detPos = -1); - - // /** - // * Stop detector acquisition (Same as stopMeasurement) - // * @param detPos -1 for all detectors in list or specific detector - // position - // */ - // void stopAcquisition(int detPos = -1); - - // /** - // * (Only in non blocking acquire mode) - // * Give an internal software trigger to the detector (Eiger) - // * @param detPos -1 for all detectors in list or specific detector - // position - // */ - // void sendSoftwareTrigger(int detPos = -1); - - // /** - // * Set Rate correction ( Eiger) - // * @param t (1) enable rate correction to default dead time, - // * (0) disable rate correction, (-1) gets - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns rate correction tau - // */ - // int enableCountRateCorrection(int i = -1, int detPos = -1); - - // /** - // * Set/get dynamic range - // * @param i dynamic range (-1 get) - // * Options: Eiger(4, 8, 16, 32), Jungfrau(16), Gotthard(16) - // * Background operation: - // * (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider - // to 1) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns current dynamic range - // */ - // int setBitDepth(int i = -1, int detPos = -1); - - // /** - // * Set detector settings - // * (Eiger only stores in shared memory. A get will overwrite this. One - // must use set threshold energy) - // * @param isettings settings (-1 gets) - // * Options: (slsDetectorDefs::detectorSettings) - // * Eiger (STANDARD, HIGHGAIN, LOWGAIN, VERYHIGHGAIN, VERYLOWGAIN) - // * Jungfrau (DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, - // FORCESWITCHG2) - // * Gotthard (DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns current settings (can also return UNDEFINED, UNINITIALIZED) - // */ - // int setSettings(int isettings = -1, int detPos = -1); - - // /** - // * Get threshold energy (Eiger) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns current threshold value - // */ - // int getThresholdEnergy(int detPos = -1); - - // /** - // * Set threshold energy (Eiger) - // * @param e_eV threshold in eV - // * @param tb 1 to load trimbits, 0 to exclude trimbits - // * @param isettings settings (-1 current settings) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns current threshold value - // */ - // int setThresholdEnergy(int e_ev, int tb = 1, int isettings = -1, int - // detPos = -1); - - // /** - // * Set/get exposure time - // * @param t time (-1 gets) - // * @param inseconds true if the value is in s, else ns - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns exposure time in ns, or s if specified - // */ - // double setExposureTime(double t = -1, bool inseconds = false, int detPos - // = -1); - - // /** - // * Set/get exposure period - // * @param t time (-1 gets) - // * @param inseconds true if the value is in s, else ns - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns exposure period in ns, or s if specified - // */ - // double setExposurePeriod(double t = -1, bool inseconds = false, int - // detPos = -1); - - // /** - // * Set/get delay after trigger (Gotthard, Jungfrau(not for this release)) - // * @param t time (-1 gets) - // * @param inseconds true if the value is in s, else ns - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns delay after trigger in ns, or s if specified - // */ - // double setDelayAfterTrigger(double t = -1, bool inseconds = false, int - // detPos = -1); - - // /** - // * (Advanced users) - // * Set/get sub frame exposure time (Eiger in 32 bit mode) - // * @param t time (-1 gets) - // * @param inseconds true if the value is in s, else ns - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns sub frame exposure time in ns, or s if specified - // */ - // double setSubFrameExposureTime(double t = -1, bool inseconds = false, int - // detPos = -1); - - // /** - // * (Advanced users) - // * Set/get sub frame dead time (Eiger in 32 bit mode) - // * @param t time (-1 gets) - // * @param inseconds true if the value is in s, else ns - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns sub frame dead time in ns, or s if specified - // */ - // double setSubFrameExposureDeadTime(double t = -1, bool inseconds = false, - // int detPos = -1); - - // /** - // * Set/get number of frames - // * @param t number of frames (-1 gets) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns number of frames - // */ - // int64_t setNumberOfFrames(int64_t t = -1, int detPos = -1); - - // /** - // * Set/get number of triggers - // * @param t number of triggers (-1 gets) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns number of triggers - // */ - // int64_t setNumberOfTriggers(int64_t t = -1, int detPos = -1); - - // /** - // * Set/get number of additional storage cells (Jungfrau) - // * @param t number of additional storage cells. Default is 0. (-1 gets) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns number of additional storage cells - // */ - // int64_t setNumberOfStorageCells(int64_t t = -1, int detPos = -1); - - // /** - // * Get measured period between previous two frames (EIGER) - // * @param t time (-1 gets) - // * @param inseconds true if the value is in s, else ns - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns sub frame dead time in ns, or s if specified - // */ - // double getMeasuredPeriod(bool inseconds = false, int detPos = -1); - - // /** - // * Get sub period between previous two sub frames in 32 bit mode (EIGER) - // * @param t time (-1 gets) - // * @param inseconds true if the value is in s, else ns - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns sub frame dead time in ns, or s if specified - // */ - // double getMeasuredSubFramePeriod(bool inseconds = false, int detPos = - // -1); - - // /** - // * Set/get timing mode - // * @param pol timing mode (-1 gets) - // * Options (slsDetectorDefs::timingMode) - // * (Eiger: AUTO_TIMING, TRIGGER_EXPOSURE, BURST_TRIGGER, GATED) - // * (Jungfrau: AUTO_TIMING, TRIGGER_EXPOSURE) - // * (Gotthard: AUTO_TIMING, TRIGGER_EXPOSURE) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns current timing mode - // */ - // int setTimingMode(int pol = -1, int detPos = -1); - - // /** - // * Sets clock speed of the detector (Eiger, Jungfrau) - // * (Jungfrau also writes adcphase to recommended default) - // * (Eiger: 0(full speed not for 32 bit mode), 1 (half speed), 2(quarter - // speed)) - // * (Jungfrau: 0(full speed not implemented), 1(half speed), 2(quarter - // speed)) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns clock speed - // */ - // int setClockDivider(int value, int detPos = -1); - - // /** - // * Set parallel readout mode (Eiger) - // * @param value readout mode (-1 gets) - // * false for NonParallel (Default), true for Parallel - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns 1 for parallel, 0 for non parallel, -1 if different - // */ - // int setParallelMode(bool value, int detPos = -1); - - // /** - // * Set overflow readout mode (Eiger in 32 bit) - // * @param value readout mode (-1 gets) - // * Options: true to Show overflow, false to not show overflow - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns 1 for overflow, 0 for no overflow, -1 if different - // */ - // int setOverflowMode(bool value, int detPos = -1); - - // /** - // * (Advanced user) - // * Sets all the trimbits to a particular value (Eiger) - // * @param val trimbit value - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns OK or FAIL - // */ - // int setAllTrimbits(int val, int detPos = -1); - - // /** - // * (Advanced user) - // * Set/get dacs value - // * @param val value (in V) (-1 gets) - // * @param index DAC index - // * Options: slsDetectorDefs::dacIndex - // * (Eiger: SVP up to IO_DELAY, THRESHOLD, HIGH_VOLTAGE) - // * (Jungfrau: 0-7) - // * (Gotthard: VREF_DS up to IB_TESTC, HIGH_VOLTAGE) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns current DAC value - // */ - // int setDAC(int val, int index , int detPos = -1); - - // /** - // * Get adc value - // * @param index adc(DAC) index - // * Options: slsDetectorDefs::dacIndex - // * (Eiger: TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT upto TEMPERATURE_FPGA3) - // * (Jungfrau: TEMPERATURE_FPGA) - // * (Gotthard: TEMPERATURE_ADC, TEMPERATURE_FPGA) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns current adc value (temperature for eiger and jungfrau in - // millidegrees) - // */ - // int getADC(int index, int detPos = -1); - - // /** - // * Enable/disable or 10Gbe (Eiger) - // * @param i is -1 to get, 0 to disable and 1 to enable - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns if 10Gbe is enabled - // */ - // int setTenGigabitEthernet(int i = -1, int detPos = -1); - - // /** - // * Set storage cell that stores first acquisition of the series - // (Jungfrau) - // * @param value storage cell index. Value can be 0 to 15. (-1 gets) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns the storage cell that stores the first acquisition of the - // series - // */ - // int setStoragecellStart(int pos=-1, int detPos = -1); - - // /** - // * set high voltage (Gotthard, Jungfrau, Eiger) - // * @param i > 0 sets, 0 unsets, (-1 gets) - // * (Eiger: ) - // * (Jungfrau: ) - // * (Gotthard: ) - // * @returns high voltage - // */ - // int setHighVoltage(int i = -1, int detPos = -1); - - // /** - // * Set 10GbE Flow Control (Eiger and Jungfrau) - // * @param enable 1 to set, 0 to unset, -1 gets - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns 10GbE flow Control - // */ - // int setFlowControl10G(int enable = -1, int detPos = -1); - - // /** - // * Set ROI (Gotthard) - // * At the moment only one set allowed per module - // * Only allowed to set one ROI per module - // * @param arg roi - // * @param detPos specific detector position - // */ - // void setROI(slsDetectorDefs::ROI arg, int detPos = -1); - - // /** - // * Get ROI (Gotthard) - // * Only allowed to set one ROI per module - // * @param detPos specific detector position - // * @returns roi - // */ - // slsDetectorDefs::ROI getROI(int detPos = -1); - - // /************************************************************************ - - // RECEIVER FUNCTIONS - - // *********************************************************************/ - - // /** - // * (Advanced user, included in startMeasurement) - // * Receiver starts listening to packets - // * @param detPos -1 for all detectors in list or specific detector - // position - // */ - // void startReceiver(int detPos = -1); - - // /** - // * (Advanced user, included in startMeasurement) - // * Stops the listening mode of receiver - // * @param detPos -1 for all detectors in list or specific detector - // position - // */ - // void stopReceiver(int detPos = -1); - - // /** - // * Set/get receiver silent mode - // * @param i is -1 to get, 0 unsets silent mode, 1 sets silent mode - // * @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); - - // /** - // * (Advanced user, included in startMeasurement) - // * 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 resetFramesCaughtInReceiver(int detPos = -1); - - // /** - // * (Advanced user) - // * Set/get receiver fifo depth - // * @param i is -1 to get, any other value to set the fifo deph - // * @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); - - // /** - // * Returns output file directory - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns output file directory - // */ - // std::string getFilePath(int detPos = -1); - - // /** - // * Sets up the file directory - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @param s file directory - // * @returns file dir - // */ - // std::string setFilePath(const std::string& s, 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); - - // /** - // * Sets up the file name prefix - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @param s file name prefix - // * @returns file name prefix - // */ - // std::string setFileName(const std::string& s, int detPos = -1); - - // /** - // * Returns file index - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns file index - // */ - // int getFileIndex(int detPos = -1); - - // /** - // * Sets up the file index - // * @param i file index - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns file index - // */ - // int setFileIndex(int i, int detPos = -1); - - // /** - // * Sets/Gets receiver file write enable - // * @param enable 1 or 0 to set/reset file write enable - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns file write enable - // */ - // int enableWriteToFile(int enable = -1, int detPos = -1); - - // /** - // * Sets/Gets file overwrite enable - // * @param enable 1 or 0 to set/reset file overwrite enable - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns file overwrite enable - // */ - // int enableOverwriteFile(int enable = -1, int detPos = -1); - - // /** - // * (previously setReceiverMode) - // * Sets the receiver streaming frequency - // * @param freq nth frame streamed out, if 0, streamed out at a timer of - // 200 ms - // * frames in between are not streamed - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns receiver streaming frequency - // */ - // int setReceiverStreamingFrequency(int freq = -1, int detPos = -1); - - // /** - // * Sets the receiver streaming timer - // * If receiver streaming frequency is 0, then this timer between each - // * data stream is set. Default is 200 ms. - // * @param time_in_ms timer between frames - // * @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); - - // /** - // * Enable data streaming to client (data call back in client processing - // thread) - // * @param enable 0 to disable, 1 to enable, -1 to get the value - // * @returns data streaming to client enable - // */ - // int enableDataStreamingToClient(int enable=-1); - - // /** - // * Enable or disable streaming data from receiver (starts streaming - // threads) - // * @param enable 0 to disable 1 to enable -1 to only get the value - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns data streaming from receiver enable - // */ - // int enableDataStreamingFromReceiver(int enable=-1, int detPos = -1); - - // /** - // * (advanced users) - // * Set/Get receiver streaming out ZMQ port and restarts receiver sockets - // * @param i sets, -1 gets - // * If detPos is -1(multi module), port calculated (increments) for all - // the individual detectors using i - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns receiver streaming out ZMQ port (if multiple, of first - // receiver socket) - // */ - // int setReceiverDataStreamingOutPort(int i = -1, int detPos = -1); - - // /** - // * (advanced users) - // * Set/Get client streaming in ZMQ port and restarts client sockets - // * @param i sets, -1 gets - // * If detPos is -1(multi module), port calculated (increments) for all - // the individual detectors using i - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns receiver streaming out ZMQ port (if multiple, of first - // receiver socket) - // */ - // int setClientDataStreamingInPort(int i = -1, int detPos = -1); - - // /** - // * (advanced users) - // * Set/Get receiver streaming out ZMQ IP and restarts receiver sockets - // * @param i sets, empty string gets - // * By default, it is the IP of receiver hostname - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns receiver streaming out ZMQ IP - // */ - // std::string setReceiverDataStreamingOutIP(const std::string& ip="", int - // detPos = -1); - - // /** - // * (advanced users) - // * Set/Get client streaming in ZMQ IP and restarts client sockets - // * @param i sets, empty string gets - // * By default, it is the IP of receiver hostname - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns client streaming in ZMQ IP - // */ - // std::string setClientDataStreamingInIP(const std::string& ip = "", int - // detPos = -1); - - // /** - // * Enable gap pixels in receiver (Eiger for 8,16 and 32 bit mode) - // * 4 bit mode gap pixels only in data call back in client - // * @param val 1 sets, 0 unsets, -1 gets - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns gap pixel enable - // */ - // int enableGapPixels(int val=-1, int detPos = -1); - - // /** - // * Sets the frame discard policy in receiver - // * @param f frame discard policy (-1 gets) - // * Options: (slsDetectorDefs::frameDiscardPolicy) - // * (NO_DISCARD (default), DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES - // (fastest)) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns current frame discard policy - // */ - // int setReceiverFramesDiscardPolicy(int f = -1, int detPos = -1); - - // /** - // * Sets the frame padding in receiver - // * @param f 0 does not partial frames, 1 pads partial frames (-1 gets) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns partial frames padding enable - // */ - // int setReceiverPartialFramesPadding(int f = -1, int detPos = -1); - - // /** - // * Sets the frames per file in receiver - // * @param f frames per file, 0 is infinite ie. every frame in same file - // (-1 gets) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns frames per file - // */ - // int setReceiverFramesPerFile(int f = -1, int detPos = -1); - - // /** - // * Sets the detector minimum/maximum energy threshold in processor (for - // Moench only) - // * @param index 0 for emin, antyhing else for emax - // * @param v value to set (-1 gets) - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns detector minimum/maximum energy threshold - // */ - // int setDetectorMinMaxEnergyThreshold(const int index, int v, int detPos = - // -1); - - // /** - // * Sets the frame mode in processor (Moench only) - // * @param value frame mode value (-1 gets) - // * Options (slsDetectorDefs::frameModeType) - // * PEDESTAL, NEW_PEDESTAL, FLATFIELD, NEW_FLATFIELD - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns frame mode (-1 for not found or error in computing json - // parameter value) - // */ - // int setFrameMode(int value, int detPos = -1); - - // /** - // * Sets the detector mode in processor (Moench only) - // * @param value detector mode value (-1 gets) - // * Options (slsDetectorDefs::detectorModeType) - // * COUNTING, INTERPOLATING, ANALOG - // * @param detPos -1 for all detectors in list or specific detector - // position - // * @returns detector mode (-1 for not found or error in computing json - // parameter value) - // */ - // int setDetectorMode(int value, int detPos = -1); - - // /************************************************************************ - - // CALLBACKS & COMMAND LINE PARSING - - // *********************************************************************/ - - // /** - // * register callback for accessing detector final data in client, - // * also enables data streaming in client and receiver - // * @param userCallback function for plotting/analyzing the data. - // * Its arguments are - // * the data structure d and the frame number f, - // * s is for subframe number for eiger for 32 bit mode - // * @param pArg argument - // */ - - // void registerDataCallback(void( *userCallback)(detectorData* d, uint64_t - // f, uint32_t s, void*), void *pArg); - - // /** - // * register callback for accessing acquisition final data in client, - // * @param func function to be called at the end of the acquisition. - // * gets detector status and progress index as arguments - // * @param pArg argument - // */ - // void registerAcquisitionFinishedCallback(void( *func)(double,int, void*), - // void *pArg); - - // /** - // @short [usage strongly discouraged] sets parameters trough command line - // interface - // http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowTo.pdf - // \param command string as it would be written on the command line - // \returns void - // */ - // void putCommand(const std::string& command); - - // /************************************************************************ - - // STATIC FUNCTIONS - - // *********************************************************************/ - - /** @short returns std::string from run status index - \param s run status index - \returns std::string error, waiting, running, data, finished or unknown when - wrong index - */ - /* static std::string runStatusType(int s){ - \ - switch (s) { - \ - case 0: return std::string("idle"); - \ - case 1: return std::string("error"); - \ - case 2: return std::string("waiting"); - \ - case 3: return std::string("finished"); - \ - case 4: return std::string("data"); - \ - case 5: return std::string("running"); - \ - case 6: return std::string("stopped"); \ - default: return std::string("unknown"); - \ - }}; - */ - - /** @short returns detector settings std::string from index - \param s can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, - veryhighgain \returns setting index (-1 unknown std::string) - */ - /* - static int getDetectorSettings(std::string s){ \ - if (s=="standard") return 0; \ - if (s=="fast") return 1; \ - if (s=="highgain") return 2; \ - if (s=="dynamicgain") return 3; \ - if (s=="lowgain") return 4; \ - if (s=="mediumgain") return 5; \ - if (s=="veryhighgain") return 6; \ - return -1; }; */ - - /** @short returns detector settings std::string from index - \param s settings index - \returns standard, fast, highgain, dynamicgain, lowgain, mediumgain, - veryhighgain, undefined when wrong index - */ - /* static std::string getDetectorSettings(int s){\ - switch(s) { \ - case 0: return std::string("standard");\ - case 1: return std::string("fast");\ - case 2: return std::string("highgain");\ - case 3: return std::string("dynamicgain"); \ - case 4: return std::string("lowgain"); \ - case 5: return std::string("mediumgain"); \ - case 6: return std::string("veryhighgain"); - \ - default: return std::string("undefined"); - \ - }}; - */ - - /** - @short returns external communication mode std::string from index - \param f index for communication mode - \returns auto, trigger, ro_trigger, gating, triggered_gating, unknown when - wrong mode - */ - - /* static std::string getTimingMode(int f){ \ - switch(f) { \ - case 0: return std::string( "auto"); \ - case 1: return std::string("trigger"); \ - case 2: return std::string("ro_trigger"); - \ - case 3: return std::string("gating"); \ - case 4: return std::string("triggered_gating"); \ - case 5: return std::string("burst_trigger"); \ - default: return std::string( "unknown"); - \ } }; - */ - /** - @short returns external communication mode std::string from index - \param s index for communication mode - \returns auto, trigger, ro_trigger, gating, triggered_gating, burst_trigger, - unknown when wrong mode - */ - - /* static int getTimingMode(std::string s){ \ - if (s== "auto") return 0; - \ - if (s== "trigger") return 1; - \ - if (s== "ro_trigger") return 2; - \ - if (s== "gating") return 3; - \ - if (s== "triggered_gating") return 4; \ - if (s== "burst_trigger") return 5; \ return -1; - }; - - */ - private: - std::unique_ptr detector; -}; diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 909e92927..a2ae089a7 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -1282,7 +1282,8 @@ int Module::getADC(dacIndex index) { slsDetectorDefs::externalSignalFlag Module::setExternalSignalFlags(externalSignalFlag pol) { LOG(logDEBUG1) << "Setting signal flag to " << pol; - return sendToDetector(F_SET_EXTERNAL_SIGNAL_FLAG, pol); + return sendToDetector( + F_SET_EXTERNAL_SIGNAL_FLAG, pol); } void Module::setParallelMode(const bool enable) { @@ -1835,7 +1836,8 @@ std::string Module::getAdditionalJsonParameter(const std::string &key) { } int64_t Module::setReceiverUDPSocketBufferSize(int64_t udpsockbufsize) { - return sendToReceiver(F_RECEIVER_UDP_SOCK_BUF_SIZE, udpsockbufsize); + return sendToReceiver(F_RECEIVER_UDP_SOCK_BUF_SIZE, + udpsockbufsize); } int64_t Module::getReceiverUDPSocketBufferSize() { @@ -2216,7 +2218,8 @@ bool Module::getDeactivatedRxrPaddingMode() { } void Module::setDeactivatedRxrPaddingMode(bool padding) { - sendToReceiver(F_SET_RECEIVER_DEACTIVATED_PADDING, static_cast(padding), nullptr); + sendToReceiver(F_SET_RECEIVER_DEACTIVATED_PADDING, + static_cast(padding), nullptr); } bool Module::getFlippedDataX() { @@ -2656,7 +2659,7 @@ int64_t Module::getFramesCaughtByReceiver() const { } std::vector Module::getNumMissingPackets() const { - //TODO!(Erik) Refactor + // TODO!(Erik) Refactor LOG(logDEBUG1) << "Getting num missing packets"; if (shm()->useReceiverFlag) { int fnum = F_GET_NUM_MISSING_PACKETS; @@ -2701,7 +2704,8 @@ bool Module::getFileWrite() { } void Module::setMasterFileWrite(bool value) { - sendToReceiver(F_SET_RECEIVER_MASTER_FILE_WRITE, static_cast(value), nullptr); + sendToReceiver(F_SET_RECEIVER_MASTER_FILE_WRITE, static_cast(value), + nullptr); } bool Module::getMasterFileWrite() { diff --git a/slsDetectorSoftware/src/slsDetectorUsers.cpp b/slsDetectorSoftware/src/slsDetectorUsers.cpp deleted file mode 100644 index 767e8ec6b..000000000 --- a/slsDetectorSoftware/src/slsDetectorUsers.cpp +++ /dev/null @@ -1,396 +0,0 @@ -#include "slsDetectorUsers.h" -//#include "detectorData.h" -//#include "multiSlsDetectorClient.h" TODO: do we need this put and get in users -// api -#include "Detector.h" - -slsDetectorUsers::slsDetectorUsers(int shm_id) - : detector(sls::make_unique(shm_id)) {} -slsDetectorUsers::~slsDetectorUsers() = default; - -void slsDetectorUsers::readConfigurationFile(const std::string &fname) { - detector->loadConfig(fname); -} - -int slsDetectorUsers::size() const { return detector->size(); } - -// int slsDetectorUsers::getDetectorSize(int &nx, int &ny, int detPos){ -// slsDetectorDefs::xy res = detector.getNumberOfChannels(); -// nx=res.x; -// ny=res.y; -// return nx*ny; -// } - -// std::string slsDetectorUsers::getDetectorType(int detPos){ -// return detector.getDetectorTypeAsString(detPos); -// } - -// void slsDetectorUsers::writeConfigurationFile(const std::string& fname){ -// detector.writeConfigurationFile(fname); -// } - -// int slsDetectorUsers::retrieveDetectorSetup(const std::string& fname){ -// return detector.retrieveDetectorSetup(fname); -// } - -// int slsDetectorUsers::dumpDetectorSetup(const std::string& fname){ -// return detector.dumpDetectorSetup(fname); -// } - -// int64_t slsDetectorUsers::getDetectorFirmwareVersion(int detPos){ -// return detector.getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION, -// detPos); -// } - -// int64_t slsDetectorUsers::getDetectorSerialNumber(int detPos){ -// return detector.getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER, detPos); -// } - -// int64_t slsDetectorUsers::getDetectorSoftwareVersion(int detPos){ -// return detector.getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION, -// detPos); -// } - -// int64_t slsDetectorUsers::getClientSoftwareVersion(){ -// return detector.getClientSoftwareVersion(); -// } - -// int64_t slsDetectorUsers::getReceiverSoftwareVersion(int detPos){ -// return detector.getId(slsDetectorDefs::RECEIVER_VERSION, detPos); -// } - -// void slsDetectorUsers::isDetectorVersionCompatible(int detPos) { -// detector.checkDetectorVersionCompatibility(detPos); -// } - -// void slsDetectorUsers::isReceiverVersionCompatible(int detPos) { -// detector.checkReceiverVersionCompatibility(detPos); -// } - -// int slsDetectorUsers::startMeasurement(){ -// return detector.acquire(); -// } - -// void slsDetectorUsers::stopMeasurement(int detPos){ -// detector.stopAcquisition(detPos); -// } - -// int slsDetectorUsers::getDetectorStatus(int detPos){ -// return (int)detector.getRunStatus(detPos); -// } - -// void slsDetectorUsers::startAcquisition(int detPos) { -// detector.startAcquisition(detPos); -// } - -// void slsDetectorUsers::stopAcquisition(int detPos) { -// detector.stopAcquisition(detPos); -// } - -// void slsDetectorUsers::sendSoftwareTrigger(int detPos) { -// detector.sendSoftwareTrigger(detPos); -// } - -// int slsDetectorUsers::enableCountRateCorrection(int i, int detPos){ -// if (i == 0) -// detector.setRateCorrection(0, detPos); -// else -// detector.setRateCorrection(-1, detPos); - -// return detector.getRateCorrection(detPos); -// } - -// int slsDetectorUsers::setBitDepth(int i, int detPos){ -// return detector.setDynamicRange(i, detPos); -// } - -// int slsDetectorUsers::setSettings(int isettings, int detPos){ -// return -// detector.setSettings((slsDetectorDefs::detectorSettings)isettings, detPos); -// } - -// int slsDetectorUsers::getThresholdEnergy(int detPos){ -// return detector.getThresholdEnergy(detPos); -// } - -// int slsDetectorUsers::setThresholdEnergy(int e_ev, int tb, int isettings, int -// detPos) { return detector.setThresholdEnergy(e_ev, -// (isettings == -1) ? slsDetectorDefs::GET_SETTINGS : -// (slsDetectorDefs::detectorSettings)isettings, -// tb, detPos); -// } - -// double slsDetectorUsers::setExposureTime(double t, bool inseconds, int -// detPos){ return detector.setExposureTime(t, inseconds, detPos); -// } - -// double slsDetectorUsers::setExposurePeriod(double t, bool inseconds, int -// detPos){ return detector.setExposurePeriod(t, inseconds, detPos); -// } - -// double slsDetectorUsers::setDelayAfterTrigger(double t, bool inseconds, int -// detPos){ return detector.setDelayAfterTrigger(t, inseconds, detPos); -// } - -// double slsDetectorUsers::setSubFrameExposureTime(double t, bool inseconds, -// int detPos){ return detector.setSubFrameExposureTime(t, inseconds, -// detPos); -// } - -// double slsDetectorUsers::setSubFrameExposureDeadTime(double t, bool -// inseconds, int detPos){ return detector.setSubFrameExposureDeadTime(t, -// inseconds, detPos); -// } - -// int64_t slsDetectorUsers::setNumberOfFrames(int64_t t, int detPos){ -// return detector.setNumberOfFrames(t, detPos); -// } - -// int64_t slsDetectorUsers::setNumberOfTriggers(int64_t t, int detPos){ -// return detector.setNumberOfTriggers(t, detPos); -// } - -// int64_t slsDetectorUsers::setNumberOfStorageCells(int64_t t, int detPos) { -// return detector.setNumberOfStorageCells(t, detPos); -// } - -// double slsDetectorUsers::getMeasuredPeriod(bool inseconds, int detPos) { -// return detector.getMeasuredPeriod(inseconds, detPos); -// } - -// double slsDetectorUsers::getMeasuredSubFramePeriod(bool inseconds, int -// detPos) { return detector.getMeasuredSubFramePeriod(inseconds, detPos); -// } - -// int slsDetectorUsers::setTimingMode(int pol, int detPos){ -// return detector.setTimingMode(slsDetectorDefs::timingMode(pol), detPos); -// } - -// int slsDetectorUsers::setClockDivider(int value, int detPos) { -// return detector.setSpeed(slsDetectorDefs::CLOCK_DIVIDER, value, detPos); -// } - -// int slsDetectorUsers::setParallelMode(bool value, int detPos) { -// /* to be uncommented when moving to Detector.h -// detector.setParallelMode(value, {detPos}); -// auto res = detector.getParallelMode({detPos}); -// if (res.equal()) -// return res.front();*/ -// return -1; -// } - -// int slsDetectorUsers::setOverflowMode(bool value, int detPos) { -// /* to be uncommented when moving to Detector.h -// detector.setOverFlowMode(value, {detPos}); -// auto res = detector.getOverFlowMode({detPos}); -// if (res.equal()) -// return res.front();*/ -// return -1; -// } - -// int slsDetectorUsers::setAllTrimbits(int val, int detPos) { -// return detector.setAllTrimbits(val, detPos); -// } - -// int slsDetectorUsers::setDAC(int val, int index , int detPos) { -// return detector.setDAC(val, slsDetectorDefs::dacIndex(index), 0, -// detPos); -// } - -// int slsDetectorUsers::getADC(int index, int detPos) { -// return detector.getADC(slsDetectorDefs::dacIndex(index),detPos); -// } - -// int slsDetectorUsers::setTenGigabitEthernet(int i, int detPos) { -// return detector.enableTenGigabitEthernet(i, detPos); -// } - -// int slsDetectorUsers::setStoragecellStart(int pos, int detPos) { -// return detector.setStoragecellStart(pos, detPos); -// } - -// int slsDetectorUsers::setHighVoltage(int i, int detPos) { -// return detector.setDAC(i, slsDetectorDefs::HIGH_VOLTAGE, 0, detPos); -// } - -// int slsDetectorUsers::setFlowControl10G(int i, int detPos) { -// return detector.setFlowControl10G(i, detPos); -// } - -// void slsDetectorUsers::setROI(slsDetectorDefs::ROI arg, int detPos) { -// detector.setROI(arg, detPos); -// } - -// slsDetectorDefs::ROI slsDetectorUsers::getROI(int detPos) { -// return detector.getROI(detPos); -// } - -// /************************************************************************ - -// RECEIVER FUNCTIONS - -// *********************************************************************/ - -// void slsDetectorUsers::startReceiver(int detPos) { -// detector.startReceiver(detPos); -// } - -// void slsDetectorUsers::stopReceiver(int detPos) { -// detector.stopReceiver(detPos); -// } - -// int slsDetectorUsers::setReceiverSilentMode(int i, int detPos) { -// return detector.setReceiverSilentMode(i, detPos); -// } - -// void slsDetectorUsers::resetFramesCaughtInReceiver(int detPos) { -// detector.resetFramesCaught(detPos); -// } - -// int slsDetectorUsers::setReceiverFifoDepth(int i, int detPos) { -// return detector.setReceiverFifoDepth(i, detPos); -// } - -// std::string slsDetectorUsers::getFilePath(int detPos){ -// return detector.getFilePath(detPos); -// } - -// std::string slsDetectorUsers::setFilePath(const std::string& s, int detPos){ -// return detector.setFilePath(s, detPos); -// } - -// std::string slsDetectorUsers::getFileName(int detPos){ -// return detector.getFileName(detPos); -// } - -// std::string slsDetectorUsers::setFileName(const std::string& s, int detPos){ -// return detector.setFileName(s, detPos); -// } - -// int slsDetectorUsers::getFileIndex(int detPos){ -// return detector.getFileIndex(detPos); -// } - -// int slsDetectorUsers::setFileIndex(int i, int detPos){ -// return detector.setFileIndex(i, detPos); -// } - -// int slsDetectorUsers::enableWriteToFile(int enable, int detPos){ -// if (enable >0) -// return detector.setFileWrite(enable, detPos); -// else -// return detector.getFileWrite(detPos); - -// } - -// int slsDetectorUsers::enableOverwriteFile(int enable, int detPos) { -// if (enable > 0) -// return detector.setFileOverWrite(enable, detPos); -// else -// return detector.getFileOverWrite(detPos); -// } - -// int slsDetectorUsers::setReceiverStreamingFrequency(int freq, int detPos){ -// return detector.setReceiverStreamingFrequency(freq, detPos); -// } - -// int slsDetectorUsers::setReceiverStreamingTimer(int time_in_ms, int detPos){ -// return detector.setReceiverStreamingTimer(time_in_ms, detPos); -// } - -// int slsDetectorUsers::enableDataStreamingToClient(int i){ -// return detector.enableDataStreamingToClient(i); -// } - -// int slsDetectorUsers::enableDataStreamingFromReceiver(int i, int detPos){ -// return detector.enableDataStreamingFromReceiver(i, detPos); -// } - -// int slsDetectorUsers::setReceiverDataStreamingOutPort(int i, int detPos){ -// if (i >= 0) { -// detector.setReceiverDataStreamingOutPort(i, detPos); -// } -// return detector.getReceiverStreamingPort(detPos); -// } - -// int slsDetectorUsers::setClientDataStreamingInPort(int i, int detPos){ -// if (i >= 0) { -// detector.setClientDataStreamingInPort(i, detPos); -// } -// return detector.getClientStreamingPort(detPos); -// } - -// std::string slsDetectorUsers::setReceiverDataStreamingOutIP(const -// std::string& ip, int detPos){ if (ip.length()) { -// detector.setReceiverDataStreamingOutIP(ip, detPos); -// } -// return detector.getReceiverStreamingIP(detPos); -// } - -// std::string slsDetectorUsers::setClientDataStreamingInIP(const std::string& -// ip, int detPos){ if (ip.length()) { -// detector.setClientDataStreamingInIP(ip, detPos); -// } -// return detector.getClientStreamingIP(detPos); -// } - -// int slsDetectorUsers::enableGapPixels(int enable, int detPos) { -// return detector.enableGapPixels(enable, detPos); -// } - -// int slsDetectorUsers::setReceiverFramesDiscardPolicy(int f, int detPos) { -// return -// detector.setReceiverFramesDiscardPolicy(slsDetectorDefs::frameDiscardPolicy(f), -// detPos); -// } - -// int slsDetectorUsers::setReceiverPartialFramesPadding(int f, int detPos) { -// if (f>=0) -// return detector.setPartialFramesPadding(f, detPos); -// else -// return detector.getPartialFramesPadding(detPos); -// } - -// int slsDetectorUsers::setReceiverFramesPerFile(int f, int detPos) { -// if (f > 0) { -// return detector.setFramesPerFile(f, detPos); -// } -// else { -// return detector.getFramesPerFile(detPos); -// } -// } - -// int slsDetectorUsers::setDetectorMinMaxEnergyThreshold(const int index, int -// v, int detPos) { -// return detector.setDetectorMinMaxEnergyThreshold(index, v, detPos); -// } - -// int slsDetectorUsers::setFrameMode(int value, int detPos) { -// return detector.setFrameMode(slsDetectorDefs::frameModeType(value), -// detPos); -// } - -// int slsDetectorUsers::setDetectorMode(int value, int detPos) { -// return detector.setDetectorMode(slsDetectorDefs::detectorModeType(value), -// detPos); -// } - -// /************************************************************************ - -// CALLBACKS & COMMAND LINE PARSING - -// *********************************************************************/ - -// void slsDetectorUsers::registerDataCallback(void( -// *userCallback)(detectorData*, uint64_t, uint32_t, void*), void *pArg) { -// detector.registerDataCallback(userCallback,pArg); -// } - -// void slsDetectorUsers::registerAcquisitionFinishedCallback(void( -// *func)(double,int, void*), void *pArg) { -// detector.registerAcquisitionFinishedCallback(func,pArg); -// } - -// void slsDetectorUsers::putCommand(const std::string& command){ -// multiSlsDetectorClient(command, slsDetectorDefs::PUT_ACTION, &detector); -// } diff --git a/slsDetectorSoftware/tests/test-Module.cpp b/slsDetectorSoftware/tests/test-Module.cpp index c871823df..47d11e395 100644 --- a/slsDetectorSoftware/tests/test-Module.cpp +++ b/slsDetectorSoftware/tests/test-Module.cpp @@ -2,7 +2,7 @@ #include "catch.hpp" using dt = slsDetectorDefs::detectorType; -TEST_CASE("Construction with a defined detector type") { +TEST_CASE("Construction with a defined detector type") { sls::Module m(dt::EIGER); REQUIRE(m.getDetectorType() == dt::EIGER); } \ No newline at end of file diff --git a/slsReceiverSoftware/src/MultiReceiverApp.cpp b/slsReceiverSoftware/src/MultiReceiverApp.cpp index f7a514741..0fa827b22 100644 --- a/slsReceiverSoftware/src/MultiReceiverApp.cpp +++ b/slsReceiverSoftware/src/MultiReceiverApp.cpp @@ -2,6 +2,7 @@ * binary */ #include "Receiver.h" #include "container_utils.h" +#include "logger.h" #include "sls_detector_defs.h" #include //SIGINT diff --git a/slsSupportLib/CMakeLists.txt b/slsSupportLib/CMakeLists.txt index 6e3dee6b4..d75ef8034 100755 --- a/slsSupportLib/CMakeLists.txt +++ b/slsSupportLib/CMakeLists.txt @@ -9,13 +9,13 @@ set(SOURCES src/network_utils.cpp src/ZmqSocket.cpp src/UdpRxSocket.cpp + src/sls_detector_exceptions.cpp ) set(HEADERS ) set(PUBLICHEADERS - include/ansi.h include/sls_detector_defs.h include/sls_detector_funcs.h include/versionAPI.h @@ -23,7 +23,6 @@ set(PUBLICHEADERS include/file_utils.h include/container_utils.h include/string_utils.h - include/logger.h include/ClientSocket.h include/DataSocket.h include/ServerSocket.h diff --git a/slsSupportLib/include/ToString.h b/slsSupportLib/include/ToString.h index 04532e825..fdd0db241 100644 --- a/slsSupportLib/include/ToString.h +++ b/slsSupportLib/include/ToString.h @@ -7,12 +7,12 @@ * */ +#include "FixedCapacityContainer.h" #include "TimeHelper.h" #include "TypeTraits.h" #include "sls_detector_defs.h" #include "sls_detector_exceptions.h" #include "string_utils.h" -#include "FixedCapacityContainer.h" #include #include #include @@ -40,8 +40,9 @@ std::string ToString(const defs::timingSourceType s); std::string ToString(const slsDetectorDefs::ROI &roi); std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::ROI &roi); -template -std::ostream &operator<<(std::ostream &os, const sls::FixedCapacityContainer& c){ +template +std::ostream &operator<<(std::ostream &os, + const sls::FixedCapacityContainer &c) { return os << ToString(c); } diff --git a/slsSupportLib/include/sls_detector_exceptions.h b/slsSupportLib/include/sls_detector_exceptions.h index 75dfe09d4..4f1407c13 100644 --- a/slsSupportLib/include/sls_detector_exceptions.h +++ b/slsSupportLib/include/sls_detector_exceptions.h @@ -1,55 +1,48 @@ #pragma once - -#include "logger.h" -#include #include namespace sls { struct RuntimeError : public std::runtime_error { public: - RuntimeError() : runtime_error("SLS Detector Package Failed") { - LOG(logERROR) << "SLS Detector Package Failed"; - } - RuntimeError(const std::string &msg) : runtime_error(msg) { - LOG(logERROR) << msg; - } - RuntimeError(const char *msg) : runtime_error(msg) { LOG(logERROR) << msg; } + RuntimeError(); + RuntimeError(const std::string &msg); + RuntimeError(const char *msg); }; struct SharedMemoryError : public RuntimeError { public: - SharedMemoryError(const std::string &msg) : RuntimeError(msg) {} + SharedMemoryError(const std::string &msg); }; struct SocketError : public RuntimeError { public: - SocketError(const std::string &msg) : RuntimeError(msg) {} + SocketError(const std::string &msg); }; struct ZmqSocketError : public RuntimeError { public: - ZmqSocketError(const std::string &msg) : RuntimeError(msg) {} + ZmqSocketError(const std::string &msg); }; struct NotImplementedError : public RuntimeError { public: - NotImplementedError(const std::string &msg) : RuntimeError(msg) {} + NotImplementedError(const std::string &msg); }; struct DetectorError : public RuntimeError { public: - DetectorError(const std::string &msg) : RuntimeError(msg) {} + DetectorError(const std::string &msg); }; struct ReceiverError : public RuntimeError { public: - ReceiverError(const std::string &msg) : RuntimeError(msg) {} + ReceiverError(const std::string &msg); }; struct GuiError : public RuntimeError { public: - GuiError(const std::string &msg) : RuntimeError(msg) {} + GuiError(const std::string &msg); }; } // namespace sls diff --git a/slsSupportLib/include/versionAPI.h b/slsSupportLib/include/versionAPI.h index 1ebe754e0..aeb4455c6 100644 --- a/slsSupportLib/include/versionAPI.h +++ b/slsSupportLib/include/versionAPI.h @@ -9,5 +9,5 @@ #define APIJUNGFRAU 0x200508 #define APIMYTHEN3 0x200508 #define APIMOENCH 0x200508 -#define APIEIGER 0x200513 +#define APIEIGER 0x200513 #define APIGOTTHARD2 0x200513 diff --git a/slsSupportLib/src/ServerInterface.cpp b/slsSupportLib/src/ServerInterface.cpp index 75e97fea9..9ea66e473 100644 --- a/slsSupportLib/src/ServerInterface.cpp +++ b/slsSupportLib/src/ServerInterface.cpp @@ -1,4 +1,5 @@ #include "ServerInterface.h" +#include "logger.h" #include #include #include diff --git a/slsSupportLib/src/ToString.cpp b/slsSupportLib/src/ToString.cpp index 2c2a05efc..934ecc944 100644 --- a/slsSupportLib/src/ToString.cpp +++ b/slsSupportLib/src/ToString.cpp @@ -2,13 +2,13 @@ namespace sls { -std::string ToString(const slsDetectorDefs::ROI& roi){ +std::string ToString(const slsDetectorDefs::ROI &roi) { std::ostringstream oss; oss << '[' << roi.xmin << ", " << roi.xmax << ']'; return oss.str(); } -std::ostream&operator<<(std::ostream &os, const slsDetectorDefs::ROI& roi){ +std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::ROI &roi) { return os << ToString(roi); } diff --git a/slsSupportLib/src/UdpRxSocket.cpp b/slsSupportLib/src/UdpRxSocket.cpp index e342d24e3..8f4b0afa5 100644 --- a/slsSupportLib/src/UdpRxSocket.cpp +++ b/slsSupportLib/src/UdpRxSocket.cpp @@ -1,4 +1,5 @@ #include "UdpRxSocket.h" +#include "logger.h" #include "network_utils.h" #include "sls_detector_exceptions.h" #include diff --git a/slsSupportLib/src/ZmqSocket.cpp b/slsSupportLib/src/ZmqSocket.cpp index ffef36bd5..fc58ed1ff 100644 --- a/slsSupportLib/src/ZmqSocket.cpp +++ b/slsSupportLib/src/ZmqSocket.cpp @@ -1,4 +1,5 @@ #include "ZmqSocket.h" +#include "logger.h" #include //inet_ntoa #include #include diff --git a/slsSupportLib/src/sls_detector_exceptions.cpp b/slsSupportLib/src/sls_detector_exceptions.cpp new file mode 100644 index 000000000..23ca4b9fb --- /dev/null +++ b/slsSupportLib/src/sls_detector_exceptions.cpp @@ -0,0 +1,23 @@ +#include "sls_detector_exceptions.h" +#include "logger.h" +namespace sls { +RuntimeError::RuntimeError() : runtime_error("SLS Detector Package Failed") { + LOG(logERROR) << "SLS Detector Package Failed"; +} +RuntimeError::RuntimeError(const std::string &msg) : runtime_error(msg) { + LOG(logERROR) << msg; +} +RuntimeError::RuntimeError(const char *msg) : runtime_error(msg) { + LOG(logERROR) << msg; +} +SharedMemoryError::SharedMemoryError(const std::string &msg) + : RuntimeError(msg) {} +SocketError::SocketError(const std::string &msg) : RuntimeError(msg) {} +ZmqSocketError::ZmqSocketError(const std::string &msg) : RuntimeError(msg) {} +NotImplementedError::NotImplementedError(const std::string &msg) + : RuntimeError(msg) {} +DetectorError::DetectorError(const std::string &msg) : RuntimeError(msg) {} +ReceiverError::ReceiverError(const std::string &msg) : RuntimeError(msg) {} +GuiError::GuiError(const std::string &msg) : RuntimeError(msg) {} + +} // namespace sls diff --git a/slsSupportLib/tests/test-ToString.cpp b/slsSupportLib/tests/test-ToString.cpp index e6716482f..f08216b4d 100644 --- a/slsSupportLib/tests/test-ToString.cpp +++ b/slsSupportLib/tests/test-ToString.cpp @@ -5,8 +5,8 @@ #include "sls_detector_defs.h" #include #include -#include #include +#include // using namespace sls; using sls::defs; @@ -219,28 +219,27 @@ TEST_CASE("Detector type") { REQUIRE(StringTo("Eiger") == dt); } - -TEST_CASE("Formatting slsDetectorDefs::ROI"){ - slsDetectorDefs::ROI roi{5,159}; +TEST_CASE("Formatting slsDetectorDefs::ROI") { + slsDetectorDefs::ROI roi{5, 159}; REQUIRE(ToString(roi) == "[5, 159]"); } -TEST_CASE("Streaming of slsDetectorDefs::ROI"){ +TEST_CASE("Streaming of slsDetectorDefs::ROI") { using namespace sls; - slsDetectorDefs::ROI roi{-10,1}; + slsDetectorDefs::ROI roi{-10, 1}; std::ostringstream oss; oss << roi; REQUIRE(oss.str() == "[-10, 1]"); } -TEST_CASE("sls::FixedCapacityContainer"){ +TEST_CASE("sls::FixedCapacityContainer") { sls::FixedCapacityContainer vec; vec.push_back(3); vec.push_back(8); REQUIRE(ToString(vec) == "[3, 8]"); } -TEST_CASE("sls::FixedCapacityContainer stream"){ +TEST_CASE("sls::FixedCapacityContainer stream") { sls::FixedCapacityContainer vec; vec.push_back(33); vec.push_back(85667); diff --git a/slsSupportLib/tests/test-network_utils.cpp b/slsSupportLib/tests/test-network_utils.cpp index 39afd6cfb..c516c6f92 100644 --- a/slsSupportLib/tests/test-network_utils.cpp +++ b/slsSupportLib/tests/test-network_utils.cpp @@ -2,6 +2,7 @@ #include "catch.hpp" #include "network_utils.h" #include +#include #include #include "sls_detector_exceptions.h"