Compare commits

...

13 Commits

19 changed files with 153 additions and 161 deletions

View File

@ -5,40 +5,22 @@ title: New Bug Report
labels: action - Bug, priority - Unclassified, status - Pending
template: bug_report.md
---
<!-- Check an option by - [x], Uncheck an option by - [ ] -->
<!-- Please preview to see your option has been selected -->
<!-- Preview changes before submitting -->
<!-- Please fill out everything with an *, as this report will be discarded otherwise -->
<!-- This is a comment, the syntax is a bit different from c++ or bash -->
##### *Distribution:
- [x] RHEL7
- [ ] RHEL6
- [ ] Fedora
- [ ] Other
<!-- RHEL7, RHEL6, Fedora, etc -->
##### *Detector type:
- [x] Not applicable
- [ ] Eiger
- [ ] Jungfrau
- [ ] Mythen3
- [ ] Gotthard2
- [ ] Gotthard
- [ ] Moench
- [ ] ChipTestBoard
<!-- If applicable, Eiger, Jungfrau, Mythen3, Gotthard2, Gotthard, Moench, ChipTestBoard -->
##### *Software Package Version:
- [ ] developer
- [ ] 4.2.0
- [ ] 4.1.1
<!-- If others, please describe -->
<!-- developer, 4.2.0, 4.1.1, etc -->
##### Priority:
- [ ] Super Low
- [ ] Low
- [ ] Medium
- [ ] High
- [ ] Super High
<!-- Super Low, Low, Medium, High, Super High -->
##### *Describe the bug
<!-- A clear and concise description of what the bug is -->

View File

@ -5,34 +5,18 @@ title: New Change Request
labels: action - Change, priority - Unclassified, status - Pending
template: change_request.md
---
<!-- Check an option by - [x], Uncheck an option by - [ ] -->
<!-- Please preview to see your option has been selected -->
<!-- Preview changes before submitting -->
<!-- Please fill out everything with an *, as this report will be discarded otherwise -->
<!-- This is a comment, the syntax is a bit different from c++ or bash -->
##### *Detector type:
- [x] Not applicable
- [ ] Eiger
- [ ] Jungfrau
- [ ] Mythen3
- [ ] Gotthard2
- [ ] Gotthard
- [ ] Moench
- [ ] ChipTestBoard
<!-- If applicable, Eiger, Jungfrau, Mythen3, Gotthard2, Gotthard, Moench, ChipTestBoard -->
##### *Software Package Version:
- [ ] developer
- [ ] 4.2.0
- [ ] 4.1.1
<!-- If others, please describe -->
<!-- developer, 4.2.0, 4.1.1, etc -->
##### Priority:
- [ ] Super Low
- [ ] Low
- [ ] Medium
- [ ] High
- [ ] Super High
<!-- Super Low, Low, Medium, High, Super High -->
##### *State the change request:
<!-- A clear and concise description of what the change is to an existing feature -->

View File

@ -1,38 +1,22 @@
---
name: Feature Request
about: Suggest a feature
about: Suggest a feature, documentation or submit a question
title: New Feature Request
labels: action - Enhancement, priority - Unclassified, status - Pending
template: feature_request.md
---
<!-- Check an option by - [x], Uncheck an option by - [ ] -->
<!-- Please preview to see your option has been selected -->
<!-- Preview changes before submitting -->
<!-- Please fill out everything with an *, as this report will be discarded otherwise -->
<!-- This is a comment, the syntax is a bit different from c++ or bash -->
##### *Detector type:
- [x] Not applicable
- [ ] Eiger
- [ ] Jungfrau
- [ ] Mythen3
- [ ] Gotthard2
- [ ] Gotthard
- [ ] Moench
- [ ] ChipTestBoard
<!-- If applicable, Eiger, Jungfrau, Mythen3, Gotthard2, Gotthard, Moench, ChipTestBoard -->
##### *Software Package Version:
- [ ] developer
- [ ] 4.2.0
- [ ] 4.1.1
<!-- If others, please describe -->
<!-- developer, 4.2.0, 4.1.1, etc -->
##### Priority:
- [ ] Super Low
- [ ] Low
- [ ] Medium
- [ ] High
- [ ] Super High
<!-- Super Low, Low, Medium, High, Super High -->
##### *State the feature:
<!-- A clear and concise description of what the feature is -->

43
cmk.sh
View File

@ -12,6 +12,7 @@ TESTS=0
SIMULATOR=0
CTBGUI=0
MANUALS=0
MANUALS_ONLY_RST=0
MOENCHZMQ=0
@ -21,7 +22,7 @@ CMAKE_PRE=""
CMAKE_POST=""
usage() { echo -e "
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [-h] [z] [-d <HDF5 directory>] [-j] <Number of threads>
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [n] [-h] [z] [-d <HDF5 directory>] [-j] <Number of threads>
-[no option]: only make
-c: Clean
-b: Builds/Rebuilds CMake files normal mode
@ -37,6 +38,7 @@ Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [-h] [z] [-d <HDF5 dire
-e: Debug mode
-i: Builds tests
-m: Manuals
-n: Manuals without compiling doxygen (only rst)
-z: Moench zmq processor
Rebuild when you switch to a new build and compile in parallel:
@ -73,7 +75,7 @@ For rebuilding only certain sections
" ; exit 1; }
while getopts ":bpchd:j:trgeisumz" opt ; do
while getopts ":bpchd:j:trgeisumnz" opt ; do
case $opt in
b)
echo "Building of CMake files Required"
@ -132,6 +134,10 @@ while getopts ":bpchd:j:trgeisumz" opt ; do
echo "Compiling Manuals"
MANUALS=1
;;
n)
echo "Compiling Manuals (Only RST)"
MANUALS_ONLY_RST=1
;;
z)
echo "Compiling Moench Zmq Processor"
MOENCHZMQ=1
@ -268,20 +274,33 @@ fi
#make
if [ $COMPILERTHREADS -gt 0 ]; then
BUILDCOMMAND="make -j$COMPILERTHREADS"
echo $BUILDCOMMAND
eval $BUILDCOMMAND
if [ $MANUALS -eq 1 ]; then
BUILDCOMMAND="make docs -j$COMPILERTHREADS"
if [ $MANUALS -eq 0 ] && [ $MANUALS_ONLY_RST -eq 0 ]; then
BUILDCOMMAND="make -j$COMPILERTHREADS"
echo $BUILDCOMMAND
eval $BUILDCOMMAND
else
if [ $MANUALS -eq 1 ]; then
BUILDCOMMAND="make docs -j$COMPILERTHREADS"
echo $BUILDCOMMAND
eval $BUILDCOMMAND
else
BUILDCOMMAND="make rst -j$COMPILERTHREADS"
echo $BUILDCOMMAND
eval $BUILDCOMMAND
fi
fi
else
echo "make"
make
if [ $MANUALS -eq 1 ]; then
echo "make docs"
make docs
if [ $MANUALS -eq 0 ] && [ $MANUALS_ONLY_RST -eq 0 ]; then
echo "make"
make
else
if [ $MANUALS -eq 1 ]; then
echo "make docs"
make docs
else
echo "make rst"
make rst
fi
fi
fi

View File

@ -154,21 +154,39 @@ threaded 1
\end{verbatim}
In the config file, if client, receiver and detector commands are on 1Gb, but detector data to receiver are sent using \textbf{10GbE} the following lines are mandatory (see slsDetectorsPackage/examples/eiger\_10Gb.config):
It has been adapted to the the new 5.0 major release change:
\begin{verbatim}
detsize 1024 512
hostname beb059+beb058+
rx_hostname pc1875:1955+pc1875:1956+
0:udp_dstport 50011
0:udp_dstport2 50012
0:udp_dstip 10.0.30.210
0:udp_srcip 10.0.30.100
1:flippeddatax 1
1:udp_dstport 50013
1:udp_dstport2 50014
1:udp_dstip 0.0.40.210
1:udp_srcip 10.0.40.101
fpath /sls/X12SA/data/x12saop/Data10/Eiger0.5M
\end{verbatim}
In the old 3.x and 4.x release it was:
\begin{verbatim}
detsizechan 1024 512 #detector geometry, long side of the module first
hostname beb059+beb058+ #1Gb detector hostname for controls
0:rx_tcpport 1991 #tcpport for the first halfmodule
0:rx_tcpport 1955 #tcpport for the first halfmodule
0:rx_udpport 50011 #udp port first quadrant, first halfmodule
0:rx_udpport2 50012 #udp port second quadrant, first halfmodule
0:rx_udpip 10.0.30.210 #udp IP of the receiver over 10Gb
0:detectorip 10.0.30.100 #first half module 10 Gb IP
1:rx_tcpport 1992 #tcpport for the second halfmodule
1:flippeddatax 1
1:rx_tcpport 1956 #tcpport for the second halfmodule
1:rx_udpport 50013 #udp port first quadrant, second halfmodule
1:rx_udpport2 50014 #udp port second quadrant, second halfmodule
1:rx_udpip 10.0.40.210 #udp IP of the receiver over 10Gb,
can be the same or different from 0:rx_udpip
1:detectorip 10.0.40.101 #second half module 10 Gb IP
rx_hostname x12sa-vcons #1Gb receiver pc hostname
rx_hostname pc1875 #1Gb receiver pc hostname
outdir /sls/X12SA/data/x12saop/Data10/Eiger0.5M
threaded 1
\end{verbatim}
@ -269,11 +287,11 @@ In this acquisition 10 consecutive 1~s frames will be acquired. Note that {\tt{p
You need to setup where the files will be written to
\begin{verbatim}
sls_detector_put 0-outdir /scratch
sls_detector_put 0-outdir /scratch (\textcolor{red}{0-fpath})
sls_detector_put 0-fname run
sls_detector_put 0-index 0
sls_detector_put 0-index 0 (\textcolor{red}{0-findex})
\end{verbatim}
this way your files will all be named /scratch/run\_dj\_i.raw where $j$ is relative to each specific half module, $i$ in the {\tt{index}} starts from 0 when starting the detector the first time and is automatically incremented. The next acquisition {\tt{index}} will be 1. One can reset the {\tt{index}} to what wished.
this way your files will all be named /scratch/run\_dj\_i.raw where $j$ is relative to each specific half module, $i$ in the {\tt{index}} starts from 0 when starting the detector the first time and is automatically incremented. The next acquisition {\tt{index}} will be 1. One can reset the {\tt{index}} (\tt{\textcolor{red}{findex}}) to what wished.
To acquire simply type:
\begin{verbatim}
@ -792,7 +810,7 @@ Extremely advanced options allow to:
\begin{itemize}
\item Activate the flow control for 10~Gb/s~E (by default the 1~Gb/s~E is always active and cannot be switched off:
\begin{verbatim}
./sls_detector_put flowcontrol_10g 1
./sls_detector_put flowcontrol_10g 1 (\textcolor{red}{flowcontrol10g})
\end{verbatim}
\item Delay the transmission of the left port. This delay option is useful in the case of many simultaneous receivers running, such that it reduces the throughput to the receivers all at the same time. To be used board by board (i.e {\tt{X:, Y:,etc..}} with different units:
\begin{verbatim}
@ -885,7 +903,7 @@ NOTE THAT THIS SETTINGS WILL BE LOST IF YOU REBOOT THE COMPUTER.
Very important is to activate the flow control in 10Gb (in 1Gb it is on by default and not configurable)
\begin{verbatim}
./sls_detector_put flowcontrol_10g 1
./sls_detector_put flowcontrol_10g 1 (\textcolor{red}{flowcontrol10g 1})
\end{verbatim}
You ned to check that flow control is setup on the reeceiving interfaces. Check with:
\begin{verbatim}
@ -1174,10 +1192,10 @@ In 500k--2M pixel systems there is a hardware temperature safety switch, which w
The HV can also be set and read through the software:
\begin{verbatim}
./sls_detector_put highvoltage 150
./sls_detector_get highvoltage
./sls_detector_put vhighvoltage 150 (\textcolor{red}{highvoltage})
./sls_detector_get vhighvoltage (\textcolor{red}{highvoltage})
\end{verbatim}
Note that the get {\tt{highvoltage}} would return the measured HV from the master module only. If getting the highvoltage for individual halfmodules, only the master will have a value different from -999.
Note that the get {\tt{vhighvoltage}}(\tt{\textcolor{red}{highvoltage}}) would return the measured HV from the master module only. If getting the highvoltage for individual halfmodules, only the master will have a value different from -999.
\appendix
@ -1333,10 +1351,10 @@ We have also been requested if we could speed up the threshold scan. At the mome
\begin{verbatim}
./sls_detector_put exptime 0.01
./sls_detector_put timing trigger
./sls_detector_put enablefwrite 0
./sls_detector_put resetframescaught 0
./sls_detector_put index 0
./sls_detector_put cycles 21 (\textcolor{red}{triggers})
./sls_detector_put enablefwrite 0 (\textcolor{red}{fwrite} 0)
./sls_detector_put resetframescaught 0 (\textcolor{red}{not needed anymore})
./sls_detector_put index 0 (\textcolor{red}{findex} 0)
./sls_detector_put cycles 21 (\textcolor{red}{triggers} 21)
./sls_detector_put receiver start
./sls_detector_put status start
for i in $(seq 0 20);

View File

@ -2048,11 +2048,12 @@ void *start_timer(void *arg) {
int colRight = top ? eiger_virtual_detPos[1] + 1 : eiger_virtual_detPos[1];
int ntotpixels = 256 * 256 * 4;
LOG(logDEBUG1, (" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n "
"packetsize:%d\n numpackes:%d\n npixelsx:%d\n databytes:%d\n "
"ntotpixels:%d\n",
dr, bytesPerPixel, tgEnable, datasize, packetsize,
numPacketsPerFrame, npixelsx, databytes, ntotpixels));
LOG(logDEBUG1,
(" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n "
"packetsize:%d\n numpackes:%d\n npixelsx:%d\n databytes:%d\n "
"ntotpixels:%d\n",
dr, bytesPerPixel, tgEnable, datasize, packetsize, numPacketsPerFrame,
npixelsx, databytes, ntotpixels));
// Generate data
char imageData[databytes * 2];
@ -2181,7 +2182,8 @@ void *start_timer(void *arg) {
usleep(eiger_virtual_transmission_delay_right);
sendUDPPacket(1, packetData2, packetsize);
}
LOG(logINFO, ("Sent frame: %d[%lld]\n", iframes, (long long unsigned int)(frameNr + iframes)));
LOG(logINFO, ("Sent frame: %d[%lld]\n", iframes,
(long long unsigned int)(frameNr + iframes)));
clock_gettime(CLOCK_REALTIME, &end);
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
(end.tv_nsec - begin.tv_nsec));

View File

@ -1818,7 +1818,8 @@ int configureASICVetoReference(int chipIndex, int *gainIndices, int *values) {
("Unknown gain index %d for channel %d\n", gainIndices[i], i));
return FAIL;
}
revValues[NCHAN - 1 - i] |= gainValue; // reversed list, so NCHAN - 1 - i
revValues[NCHAN - 1 - i] |=
gainValue; // reversed list, so NCHAN - 1 - i
LOG(logDEBUG2, ("Values[%d]: 0x%x\n", i, revValues[i]));
}

View File

@ -137,17 +137,17 @@ enum PLLINDEX { READOUT_PLL, SYSTEM_PLL };
#define ASIC_ADC_MAX_VAL (0x7F)
#define ASIC_GLOBAL_SETT_MAX_BITS (6)
#define ASIC_EXT_MEMCTRL_OFST (0)
#define ASIC_EXT_MEMCTRL_MSK (0x1 << ASIC_EXT_MEMCTRL_OFST)
#define ASIC_EXT_TIMING_OFST (1)
#define ASIC_EXT_TIMING_MSK (0x1 << ASIC_EXT_TIMING_OFST)
#define ASIC_CONT_MODE_OFST (2)
#define ASIC_CONT_MODE_MSK (0x1 << ASIC_CONT_MODE_OFST)
#define ASIC_FILTER_OFST (3)
#define ASIC_FILTER_MSK (0x3 << ASIC_FILTER_OFST)
#define ASIC_FILTER_MAX_VALUE (3)
#define ASIC_CDS_GAIN_OFST (5)
#define ASIC_CDS_GAIN_MSK (0x1 << ASIC_CDS_GAIN_OFST)
#define ASIC_EXT_MEMCTRL_OFST (0)
#define ASIC_EXT_MEMCTRL_MSK (0x1 << ASIC_EXT_MEMCTRL_OFST)
#define ASIC_EXT_TIMING_OFST (1)
#define ASIC_EXT_TIMING_MSK (0x1 << ASIC_EXT_TIMING_OFST)
#define ASIC_CONT_MODE_OFST (2)
#define ASIC_CONT_MODE_MSK (0x1 << ASIC_CONT_MODE_OFST)
#define ASIC_FILTER_OFST (3)
#define ASIC_FILTER_MSK (0x3 << ASIC_FILTER_OFST)
#define ASIC_FILTER_MAX_VALUE (3)
#define ASIC_CDS_GAIN_OFST (5)
#define ASIC_CDS_GAIN_MSK (0x1 << ASIC_CDS_GAIN_OFST)
/* Struct Definitions */
typedef struct udp_header_struct {

View File

@ -1,7 +1,7 @@
#include "CmdProxy.h"
#include "bit_utils.h"
#include "TimeHelper.h"
#include "ToString.h"
#include "bit_utils.h"
#include "container_utils.h"
#include "logger.h"
#include "sls_detector_defs.h"
@ -205,7 +205,7 @@ std::string CmdProxy::Acquire(int action) {
std::string CmdProxy::free(int action) {
// This function is purely for help, actual functionality is in the caller
return "\n\tFree detector shared memory\n";
return "free\n\tFree detector shared memory\n";
}
std::string CmdProxy::FirmwareVersion(int action) {
@ -962,12 +962,12 @@ std::string CmdProxy::DacValues(int action) {
auto t = det->getDacList();
os << '[';
auto it = t.cbegin();
os << ToString(*it) << ' '
<< OutString(det->getDAC(*it++, mv, {det_id}))
os << ToString(*it) << ' ';
os << OutString(det->getDAC(*it++, mv, {det_id}))
<< (!args.empty() ? " mv" : "");
while (it != t.cend()) {
os << ", " << ToString(*it) << ' '
<< OutString(det->getDAC(*it++, mv, {det_id}))
os << ", " << ToString(*it) << ' ';
os << OutString(det->getDAC(*it++, mv, {det_id}))
<< (!args.empty() ? " mv" : "");
}
os << "]\n";
@ -2711,4 +2711,4 @@ std::string CmdProxy::UserDetails(int action) {
return os.str();
}
} // namespace sls
} // namespace sls

View File

@ -385,7 +385,7 @@
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
det->SETFCN(args[0]); \
det->SETFCN(args[0], {det_id}); \
os << args.front() << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \

View File

@ -36,7 +36,7 @@ TEST_CASE("rx_version", "[.cmd][.rx][.new]") {
TEST_CASE("rx_start", "[.cmd][.rx][.new]") {
Detector det;
CmdProxy proxy(&det);
det.setFileWrite(false); //avoid writing or error on file creation
det.setFileWrite(false); // avoid writing or error on file creation
// PUT only command
REQUIRE_THROWS(proxy.Call("rx_start", {}, -1, GET));
{
@ -70,7 +70,7 @@ TEST_CASE("rx_stop", "[.cmd][.rx][.new]") {
TEST_CASE("rx_status", "[.cmd][.rx][.new]") {
Detector det;
det.setFileWrite(false); //avoid writing or error on file creation
det.setFileWrite(false); // avoid writing or error on file creation
CmdProxy proxy(&det);
det.startReceiver();
{
@ -91,7 +91,7 @@ TEST_CASE("rx_framescaught", "[.cmd][.rx][.new]") {
CmdProxy proxy(&det);
// This ensures 0 caught frames
det.setFileWrite(false); //avoid writing or error on file creation
det.setFileWrite(false); // avoid writing or error on file creation
det.startReceiver();
det.stopReceiver();
{
@ -113,7 +113,7 @@ TEST_CASE("rx_framescaught", "[.cmd][.rx][.new]") {
TEST_CASE("rx_missingpackets", "[.cmd][.rx][.new]") {
Detector det;
det.setFileWrite(false); //avoid writing or error on file creation
det.setFileWrite(false); // avoid writing or error on file creation
CmdProxy proxy(&det);
{
// some missing packets

View File

@ -22,9 +22,7 @@
/** cosntructor & destructor */
Implementation::Implementation(const detectorType d) {
setDetectorType(d);
}
Implementation::Implementation(const detectorType d) { setDetectorType(d); }
Implementation::~Implementation() {
delete generalData;

View File

@ -295,8 +295,9 @@ class Implementation : private virtual slsDetectorDefs {
// network configuration (UDP)
int numUDPInterfaces{1};
std::array<std::string,MAX_NUMBER_OF_LISTENING_THREADS>eth;
std::array<uint32_t,MAX_NUMBER_OF_LISTENING_THREADS> udpPortNum{{DEFAULT_UDP_PORTNO, DEFAULT_UDP_PORTNO+1}};
std::array<std::string, MAX_NUMBER_OF_LISTENING_THREADS> eth;
std::array<uint32_t, MAX_NUMBER_OF_LISTENING_THREADS> udpPortNum{
{DEFAULT_UDP_PORTNO, DEFAULT_UDP_PORTNO + 1}};
int64_t udpSocketBufferSize{0};
int64_t actualUDPSocketBufferSize{0};
@ -350,12 +351,13 @@ class Implementation : private virtual slsDetectorDefs {
// callbacks
int (*startAcquisitionCallBack)(std::string, std::string, uint64_t,
uint32_t, void *){nullptr};
void *pStartAcquisition;
void (*acquisitionFinishedCallBack)(uint64_t, void *);
void *pAcquisitionFinished;
void (*rawDataReadyCallBack)(char *, char *, uint32_t, void *);
void (*rawDataModifyReadyCallBack)(char *, char *, uint32_t &, void *);
void *pRawDataReady;
void *pStartAcquisition{nullptr};
void (*acquisitionFinishedCallBack)(uint64_t, void *){nullptr};
void *pAcquisitionFinished{nullptr};
void (*rawDataReadyCallBack)(char *, char *, uint32_t, void *){nullptr};
void (*rawDataModifyReadyCallBack)(char *, char *, uint32_t &,
void *){nullptr};
void *pRawDataReady{nullptr};
// class objects
GeneralData *generalData;

1
slsSupportLib/include/ClientSocket.h Executable file → Normal file
View File

@ -16,6 +16,7 @@ class ClientSocket : public DataSocket {
void *retval, size_t retval_size);
std::string readErrorMessage();
private:
void readReply(int &ret, void *retval, size_t retval_size);
struct sockaddr_in serverAddr {};

View File

@ -1,11 +1,11 @@
#pragma once
#include <vector>
#include <bitset>
#include <vector>
namespace sls {
template <typename T> std::vector<int> getSetBits(T val) {
constexpr size_t bitsPerByte = 8;
constexpr size_t numBits = sizeof(T)*bitsPerByte;
constexpr size_t numBits = sizeof(T) * bitsPerByte;
std::bitset<numBits> bs(val);
std::vector<int> set_bits;
set_bits.reserve(bs.count());

View File

@ -135,8 +135,9 @@ class slsDetectorDefs {
} sls_detector_header;
#ifdef __cplusplus
//For sending and receiving data
static_assert(sizeof(detectorType) == sizeof(int), "enum and int differ in size");
// For sending and receiving data
static_assert(sizeof(detectorType) == sizeof(int),
"enum and int differ in size");
#define MAX_NUM_PACKETS 512
using sls_bitset = std::bitset<MAX_NUM_PACKETS>;
using bitset_storage = uint8_t[MAX_NUM_PACKETS / 8];

View File

@ -1,12 +1,12 @@
/** API versions */
#define GITBRANCH "developer"
#define APILIB 0x200810
#define APIRECEIVER 0x200810
#define APIGUI 0x200804
#define APICTB 0x200810
#define APIGOTTHARD 0x200810
#define GITBRANCH "developer"
#define APILIB 0x200810
#define APIRECEIVER 0x200810
#define APIGUI 0x200804
#define APICTB 0x200810
#define APIGOTTHARD 0x200810
#define APIGOTTHARD2 0x200810
#define APIJUNGFRAU 0x200810
#define APIMYTHEN3 0x200810
#define APIMOENCH 0x200810
#define APIEIGER 0x200810
#define APIJUNGFRAU 0x200810
#define APIMYTHEN3 0x200810
#define APIMOENCH 0x200810
#define APIEIGER 0x200810

View File

@ -101,7 +101,7 @@ void ClientSocket::readReply(int &ret, void *retval, size_t retval_size) {
}
}
std::string ClientSocket::readErrorMessage(){
std::string ClientSocket::readErrorMessage() {
std::string error_msg(MAX_STR_LENGTH, '\0');
Receive(&error_msg[0], error_msg.size());
return error_msg;

View File

@ -1,39 +1,39 @@
#include "bit_utils.h"
#include "catch.hpp"
#include <vector>
#include "bit_utils.h"
TEST_CASE("Get set bits from 0"){
TEST_CASE("Get set bits from 0") {
auto vec = sls::getSetBits(0);
REQUIRE(vec.empty());
}
TEST_CASE("Get set bits from 1"){
TEST_CASE("Get set bits from 1") {
auto vec = sls::getSetBits(1);
REQUIRE(vec.size() == 1);
REQUIRE(vec[0] == 0);
}
TEST_CASE("Get set bits from 2"){
TEST_CASE("Get set bits from 2") {
auto vec = sls::getSetBits(2ul);
REQUIRE(vec.size() == 1);
REQUIRE(vec[0] == 1);
}
TEST_CASE("Get set bits from 3"){
TEST_CASE("Get set bits from 3") {
auto vec = sls::getSetBits(3u);
REQUIRE(vec.size() == 2);
REQUIRE(vec[0] == 0);
REQUIRE(vec[1] == 1);
}
TEST_CASE("All bits set"){
TEST_CASE("All bits set") {
uint8_t val = -1;
auto vec = sls::getSetBits(val);
REQUIRE(vec == std::vector<int>{0,1,2,3,4,5,6,7});
REQUIRE(vec == std::vector<int>{0, 1, 2, 3, 4, 5, 6, 7});
}
TEST_CASE("Get set bits from 523"){
//0b1000001011 == 523
TEST_CASE("Get set bits from 523") {
// 0b1000001011 == 523
auto vec = sls::getSetBits(523);
REQUIRE(vec == std::vector<int>{0,1,3,9});
REQUIRE(vec == std::vector<int>{0, 1, 3, 9});
}