mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 22:40:02 +02:00
conflict fix
This commit is contained in:
commit
8f7adb130f
@ -169,7 +169,7 @@ std::string CmdProxy::VirtualServer(int action) {
|
||||
if (det_id != -1) {
|
||||
throw sls::RuntimeError("Cannot execute this at module level");
|
||||
}
|
||||
det->setVirtualDetectorServers(std::stoi(args[0]), std::stoi(args[1]));
|
||||
det->setVirtualDetectorServers(StringTo<int>(args[0]), StringTo<int>(args[1]));
|
||||
os << sls::ToString(args);
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -320,8 +320,8 @@ std::string CmdProxy::DetectorSize(int action) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
defs::xy t;
|
||||
t.x = std::stoi(args[0]);
|
||||
t.y = std::stoi(args[1]);
|
||||
t.x = StringTo<int>(args[0]);
|
||||
t.y = StringTo<int>(args[1]);
|
||||
det->setDetectorSize(t);
|
||||
os << ToString(args) << '\n';
|
||||
} else {
|
||||
@ -364,7 +364,7 @@ std::string CmdProxy::Speed(int action) {
|
||||
}
|
||||
defs::speedLevel t;
|
||||
try {
|
||||
int ival = std::stoi(args[0]);
|
||||
int ival = StringTo<int>(args[0]);
|
||||
switch (ival) {
|
||||
case 0:
|
||||
t = defs::FULL_SPEED;
|
||||
@ -419,14 +419,14 @@ std::string CmdProxy::Adcphase(int action) {
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setADCPhase(std::stoi(args[0]), {det_id});
|
||||
det->setADCPhase(StringTo<int>(args[0]), {det_id});
|
||||
os << args.front() << '\n';
|
||||
} else if (args.size() == 2) {
|
||||
if (args[1] != "deg") {
|
||||
throw sls::RuntimeError("Unknown adcphase 2nd argument " +
|
||||
args[1] + ". Did you mean deg?");
|
||||
}
|
||||
det->setADCPhaseInDegrees(std::stoi(args[0]), {det_id});
|
||||
det->setADCPhaseInDegrees(StringTo<int>(args[0]), {det_id});
|
||||
os << args[0] << args[1] << '\n';
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
@ -463,14 +463,14 @@ std::string CmdProxy::Dbitphase(int action) {
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setDBITPhase(std::stoi(args[0]), {det_id});
|
||||
det->setDBITPhase(StringTo<int>(args[0]), {det_id});
|
||||
os << args.front() << '\n';
|
||||
} else if (args.size() == 2) {
|
||||
if (args[1] != "deg") {
|
||||
throw sls::RuntimeError("Unknown dbitphase 2nd argument " +
|
||||
args[1] + ". Did you mean deg?");
|
||||
}
|
||||
det->setDBITPhaseInDegrees(std::stoi(args[0]), {det_id});
|
||||
det->setDBITPhaseInDegrees(StringTo<int>(args[0]), {det_id});
|
||||
os << args[0] << args[1] << '\n';
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
@ -497,15 +497,15 @@ std::string CmdProxy::ClockFrequency(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
auto t = det->getClockFrequency(std::stoi(args[0]), {det_id});
|
||||
auto t = det->getClockFrequency(StringTo<int>(args[0]), {det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setClockFrequency(std::stoi(args[0]), std::stoi(args[1]),
|
||||
det->setClockFrequency(StringTo<int>(args[0]), StringTo<int>(args[1]),
|
||||
{det_id});
|
||||
os << std::stoi(args[1]) << '\n';
|
||||
os << StringTo<int>(args[1]) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
@ -529,7 +529,7 @@ std::string CmdProxy::ClockPhase(int action) {
|
||||
}
|
||||
if (action == defs::GET_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
auto t = det->getClockPhase(std::stoi(args[0]), {det_id});
|
||||
auto t = det->getClockPhase(StringTo<int>(args[0]), {det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 2) {
|
||||
if (args[1] != "deg") {
|
||||
@ -537,14 +537,14 @@ std::string CmdProxy::ClockPhase(int action) {
|
||||
". Did you mean deg?");
|
||||
}
|
||||
auto t =
|
||||
det->getClockPhaseinDegrees(std::stoi(args[0]), {det_id});
|
||||
det->getClockPhaseinDegrees(StringTo<int>(args[0]), {det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 2) {
|
||||
det->setClockPhase(std::stoi(args[0]), std::stoi(args[1]),
|
||||
det->setClockPhase(StringTo<int>(args[0]), StringTo<int>(args[1]),
|
||||
{det_id});
|
||||
os << args[1] << '\n';
|
||||
} else if (args.size() == 3) {
|
||||
@ -552,9 +552,9 @@ std::string CmdProxy::ClockPhase(int action) {
|
||||
throw sls::RuntimeError("Cannot scan argument" + args[2] +
|
||||
". Did you mean deg?");
|
||||
}
|
||||
det->setClockPhaseinDegrees(std::stoi(args[0]),
|
||||
std::stoi(args[1]), {det_id});
|
||||
os << std::stoi(args[1]) << '\n';
|
||||
det->setClockPhaseinDegrees(StringTo<int>(args[0]),
|
||||
StringTo<int>(args[1]), {det_id});
|
||||
os << args[1] << '\n';
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
@ -581,7 +581,7 @@ std::string CmdProxy::MaxClockPhaseShift(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
auto t = det->getMaxClockPhaseShift(std::stoi(args[0]), {det_id});
|
||||
auto t = det->getMaxClockPhaseShift(StringTo<int>(args[0]), {det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
throw sls::RuntimeError("Cannot put");
|
||||
@ -608,15 +608,15 @@ std::string CmdProxy::ClockDivider(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
auto t = det->getClockDivider(std::stoi(args[0]), {det_id});
|
||||
auto t = det->getClockDivider(StringTo<int>(args[0]), {det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setClockDivider(std::stoi(args[0]), std::stoi(args[1]),
|
||||
det->setClockDivider(StringTo<int>(args[0]), StringTo<int>(args[1]),
|
||||
{det_id});
|
||||
os << std::stoi(args[1]) << '\n';
|
||||
os << args[1] << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
@ -646,7 +646,7 @@ std::string CmdProxy::Dac(int action) {
|
||||
} else if (args.size() > 2) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
auto t = det->getDAC(static_cast<defs::dacIndex>(std::stoi(args[0])),
|
||||
auto t = det->getDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])),
|
||||
mv, {det_id});
|
||||
os << args[0] << ' ' << OutString(t)
|
||||
<< (args.size() > 1 ? " mv\n" : "\n");
|
||||
@ -661,8 +661,8 @@ std::string CmdProxy::Dac(int action) {
|
||||
} else if (args.size() > 3 || args.size() < 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setDAC(static_cast<defs::dacIndex>(std::stoi(args[0])),
|
||||
std::stoi(args[1]), mv, {det_id});
|
||||
det->setDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])),
|
||||
StringTo<int>(args[1]), mv, {det_id});
|
||||
os << args[0] << ' ' << args[1] << (args.size() > 2 ? " mv\n" : "\n");
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -928,7 +928,7 @@ std::string CmdProxy::DynamicRange(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setDynamicRange(std::stoi(args[0]));
|
||||
det->setDynamicRange(StringTo<int>(args[0]));
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -950,12 +950,12 @@ std::string CmdProxy::Threshold(int action) {
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setThresholdEnergy(std::stoi(args[0]),
|
||||
det->setThresholdEnergy(StringTo<int>(args[0]),
|
||||
slsDetectorDefs::GET_SETTINGS, true,
|
||||
{det_id});
|
||||
} else if (args.size() == 2) {
|
||||
det->setThresholdEnergy(
|
||||
std::stoi(args[0]),
|
||||
StringTo<int>(args[0]),
|
||||
sls::StringTo<slsDetectorDefs::detectorSettings>(args[1]), true,
|
||||
{det_id});
|
||||
} else {
|
||||
@ -979,12 +979,12 @@ std::string CmdProxy::ThresholdNoTb(int action) {
|
||||
throw sls::RuntimeError("cannot get");
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setThresholdEnergy(std::stoi(args[0]),
|
||||
det->setThresholdEnergy(StringTo<int>(args[0]),
|
||||
slsDetectorDefs::GET_SETTINGS, false,
|
||||
{det_id});
|
||||
} else if (args.size() == 2) {
|
||||
det->setThresholdEnergy(
|
||||
std::stoi(args[0]),
|
||||
StringTo<int>(args[0]),
|
||||
sls::StringTo<slsDetectorDefs::detectorSettings>(args[1]),
|
||||
false, {det_id});
|
||||
} else {
|
||||
@ -1018,7 +1018,7 @@ std::string CmdProxy::GapPixels(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setRxAddGapPixels(std::stoi(args[0]));
|
||||
det->setRxAddGapPixels(StringTo<int>(args[0]));
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -1045,10 +1045,10 @@ std::string CmdProxy::TrimEnergies(int action) {
|
||||
if (args.empty()) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
unsigned int ntrim = args.size();
|
||||
std::vector<int> t(ntrim);
|
||||
for (unsigned int i = 0; i < ntrim; ++i) {
|
||||
t[i] = std::stoi(args[i]);
|
||||
|
||||
std::vector<int> t(args.size());
|
||||
for (size_t i = 0; i < t.size(); ++i) {
|
||||
t[i] = StringTo<int>(args[i]);
|
||||
}
|
||||
det->setTrimEnergies(t, {det_id});
|
||||
os << sls::ToString(args) << '\n';
|
||||
@ -1076,7 +1076,7 @@ std::string CmdProxy::RateCorrection(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
int tau = std::stoi(args[0]);
|
||||
int tau = StringTo<int>(args[0]);
|
||||
if (tau == -1) {
|
||||
det->setDefaultRateCorrection({det_id});
|
||||
auto t = det->getRateCorrection({det_id});
|
||||
@ -1115,7 +1115,7 @@ std::string CmdProxy::Activate(int action) {
|
||||
if (args.empty() || args.size() > 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
int t = std::stoi(args[0]);
|
||||
int t = StringTo<int>(args[0]);
|
||||
det->setActive(t, {det_id});
|
||||
os << args[0];
|
||||
if (args.size() == 2) {
|
||||
@ -1149,10 +1149,10 @@ std::string CmdProxy::PulsePixel(int action) {
|
||||
if (args.size() != 3) {
|
||||
WrongNumberOfParameters(3);
|
||||
}
|
||||
int n = std::stoi(args[0]);
|
||||
int n = StringTo<int>(args[0]);
|
||||
defs::xy c;
|
||||
c.x = std::stoi(args[1]);
|
||||
c.y = std::stoi(args[2]);
|
||||
c.x = StringTo<int>(args[1]);
|
||||
c.y = StringTo<int>(args[2]);
|
||||
det->pulsePixel(n, c, {det_id});
|
||||
os << sls::ToString(args) << '\n';
|
||||
} else {
|
||||
@ -1174,10 +1174,10 @@ std::string CmdProxy::PulsePixelAndMove(int action) {
|
||||
if (args.size() != 3) {
|
||||
WrongNumberOfParameters(3);
|
||||
}
|
||||
int n = std::stoi(args[0]);
|
||||
int n = StringTo<int>(args[0]);
|
||||
defs::xy c;
|
||||
c.x = std::stoi(args[1]);
|
||||
c.y = std::stoi(args[2]);
|
||||
c.x = StringTo<int>(args[1]);
|
||||
c.y = StringTo<int>(args[2]);
|
||||
det->pulsePixelNMove(n, c, {det_id});
|
||||
os << sls::ToString(args) << '\n';
|
||||
} else {
|
||||
@ -1200,7 +1200,7 @@ std::string CmdProxy::PulseChip(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->pulseChip(std::stoi(args[0]), {det_id});
|
||||
det->pulseChip(StringTo<int>(args[0]), {det_id});
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -1229,7 +1229,7 @@ std::string CmdProxy::Quad(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setQuad(std::stoi(args[0]));
|
||||
det->setQuad(StringTo<int>(args[0]));
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -1260,7 +1260,7 @@ std::string CmdProxy::TemperatureEvent(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
if (std::stoi(args[0]) != 0) {
|
||||
if (StringTo<int>(args[0]) != 0) {
|
||||
throw sls::RuntimeError("Unknown argument for temp event. Did you "
|
||||
"mean 0 to reset event?");
|
||||
}
|
||||
@ -1298,8 +1298,8 @@ std::string CmdProxy::ROI(int action) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
defs::ROI t;
|
||||
t.xmin = std::stoi(args[0]);
|
||||
t.xmax = std::stoi(args[1]);
|
||||
t.xmin = StringTo<int>(args[0]);
|
||||
t.xmax = StringTo<int>(args[1]);
|
||||
det->setROI(t, det_id);
|
||||
os << '[' << t.xmin << ", " << t.xmax << "] \n";
|
||||
} else {
|
||||
@ -1350,7 +1350,7 @@ std::string CmdProxy::InjectChannel(int action) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setInjectChannel(std::stoi(args[0]), std::stoi(args[1]), {det_id});
|
||||
det->setInjectChannel(StringTo<int>(args[0]), StringTo<int>(args[1]), {det_id});
|
||||
os << sls::ToString(args) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -1371,14 +1371,14 @@ std::string CmdProxy::VetoPhoton(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
auto t = det->getVetoPhoton(std::stoi(args[0]), {det_id});
|
||||
auto t = det->getVetoPhoton(StringTo<int>(args[0]), {det_id});
|
||||
os << args[0] << ' ' << OutStringHex(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 4) {
|
||||
WrongNumberOfParameters(4);
|
||||
}
|
||||
det->setVetoPhoton(std::stoi(args[0]), std::stoi(args[1]),
|
||||
std::stoi(args[2]), args[3], {det_id});
|
||||
det->setVetoPhoton(StringTo<int>(args[0]), StringTo<int>(args[1]),
|
||||
StringTo<int>(args[2]), args[3], {det_id});
|
||||
os << sls::ToString(args) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -1426,7 +1426,7 @@ std::string CmdProxy::BurstMode(int action) {
|
||||
}
|
||||
defs::burstMode t;
|
||||
try {
|
||||
int ival = std::stoi(args[0]);
|
||||
int ival = StringTo<int>(args[0]);
|
||||
switch (ival) {
|
||||
case 0:
|
||||
t = defs::BURST_OFF;
|
||||
@ -1481,7 +1481,7 @@ std::string CmdProxy::Counters(int action) {
|
||||
// convert vector to counter enable mask
|
||||
uint32_t mask = 0;
|
||||
for (size_t i = 0; i < args.size(); ++i) {
|
||||
int val = std::stoi(args[i]);
|
||||
int val = StringTo<int>(args[i]);
|
||||
// already enabled earlier
|
||||
if (mask & (1 << val)) {
|
||||
std::ostringstream oss;
|
||||
@ -1527,10 +1527,10 @@ std::string CmdProxy::Samples(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setNumberOfAnalogSamples(std::stoi(args[0]), {det_id});
|
||||
det->setNumberOfAnalogSamples(StringTo<int>(args[0]), {det_id});
|
||||
// set also digital samples for ctb
|
||||
if (det->getDetectorType().squash() == defs::CHIPTESTBOARD) {
|
||||
det->setNumberOfDigitalSamples(std::stoi(args[0]), {det_id});
|
||||
det->setNumberOfDigitalSamples(StringTo<int>(args[0]), {det_id});
|
||||
}
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
@ -1552,7 +1552,7 @@ std::string CmdProxy::SlowAdc(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
int nchan = std::stoi(args[0]);
|
||||
int nchan = StringTo<int>(args[0]);
|
||||
if (nchan < 0 || nchan > defs::SLOW_ADC_TEMP - defs::SLOW_ADC0) {
|
||||
throw sls::RuntimeError("Unknown adc argument " + args[0]);
|
||||
}
|
||||
@ -1606,7 +1606,7 @@ std::string CmdProxy::ReceiverDbitList(int action) {
|
||||
unsigned int ntrim = args.size();
|
||||
t.resize(ntrim);
|
||||
for (unsigned int i = 0; i < ntrim; ++i) {
|
||||
t[i] = std::stoi(args[i]);
|
||||
t[i] = StringTo<int>(args[i]);
|
||||
}
|
||||
}
|
||||
det->setRxDbitList(t, {det_id});
|
||||
@ -1778,7 +1778,7 @@ std::string CmdProxy::PatternLoopCycles(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setPatternLoopCycles(level, std::stoi(args[0]), {det_id});
|
||||
det->setPatternLoopCycles(level, StringTo<int>(args[0]), {det_id});
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -1868,7 +1868,7 @@ std::string CmdProxy::PatternWaitTime(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setPatternWaitTime(level, std::stoul(args[0]), {det_id});
|
||||
det->setPatternWaitTime(level, StringTo<uint64_t>(args[0]), {det_id});
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -1941,7 +1941,7 @@ std::string CmdProxy::MinMaxEnergyThreshold(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setDetectorMinMaxEnergyThreshold(emax, std::stoi(args[0]),
|
||||
det->setDetectorMinMaxEnergyThreshold(emax, StringTo<int>(args[0]),
|
||||
{det_id});
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
@ -2152,7 +2152,7 @@ std::string CmdProxy::InitialChecks(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setInitialChecks(std::stoi(args[0]));
|
||||
det->setInitialChecks(StringTo<int>(args[0]));
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
|
@ -225,14 +225,14 @@
|
||||
if (args.size() != 1) { \
|
||||
WrongNumberOfParameters(1); \
|
||||
} \
|
||||
auto t = det->GETFCN(INDEX, std::stoi(args[0]), {det_id}); \
|
||||
auto t = det->GETFCN(INDEX, StringTo<int>(args[0]), {det_id}); \
|
||||
os << args [0] << ' ' << OutStringHex(t) << '\n'; \
|
||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||
if (args.size() != 2) { \
|
||||
WrongNumberOfParameters(2); \
|
||||
} \
|
||||
auto val = CONV(args[1]); \
|
||||
det->SETFCN(INDEX, std::stoi(args[0]), val, {det_id}); \
|
||||
det->SETFCN(INDEX, StringTo<int>(args[0]), val, {det_id}); \
|
||||
os << args[0] << ' ' << args[1] << '\n'; \
|
||||
} else { \
|
||||
throw sls::RuntimeError("Unknown action"); \
|
||||
@ -270,7 +270,7 @@
|
||||
} else if (args.size() > 2 || args.size() < 1) { \
|
||||
WrongNumberOfParameters(1); \
|
||||
} \
|
||||
det->SETFCN(DAC_INDEX, std::stoi(args[0]), mv, {det_id}); \
|
||||
det->SETFCN(DAC_INDEX, StringTo<int>(args[0]), mv, {det_id}); \
|
||||
os << args.front() << (args.size() > 1 ? " mv\n" : "\n"); \
|
||||
} else { \
|
||||
throw sls::RuntimeError("Unknown action"); \
|
||||
@ -1028,16 +1028,16 @@ class CmdProxy {
|
||||
/* acquisition parameters */
|
||||
|
||||
INTEGER_COMMAND_NOID(frames, getNumberOfFrames, setNumberOfFrames,
|
||||
std::stol,
|
||||
StringTo<int64_t>,
|
||||
"[n_frames]\n\tNumber of frames per aquire. In trigger mode, number of frames per trigger."
|
||||
"\n\t[Gotthard2] Burst mode has a maximum of 2720 frames.");
|
||||
|
||||
INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers,
|
||||
std::stol,
|
||||
StringTo<int64_t>,
|
||||
"[n_triggers]\n\tNumber of triggers per aquire. Use timing command to set timing mode.");
|
||||
|
||||
INTEGER_COMMAND_NOID(bursts, getNumberOfBursts, setNumberOfBursts,
|
||||
std::stol,
|
||||
StringTo<int64_t>,
|
||||
"[n_bursts]\n\t[Gotthard2] Number of bursts per aquire. Only in auto timing mode and burst mode. Use timing command to set timing mode and burstmode command to set burst mode.");
|
||||
|
||||
TIME_COMMAND(exptime, getExptime, setExptime,
|
||||
@ -1079,13 +1079,13 @@ class CmdProxy {
|
||||
GET_COMMAND(maxdbitphaseshift, getMaxDBITPhaseShift,
|
||||
"\n\t[CTB][Jungfrau] Absolute maximum Phase shift of of the clock to latch digital bits.");
|
||||
|
||||
INTEGER_COMMAND(vhighvoltage, getHighVoltage, setHighVoltage, std::stoi,
|
||||
INTEGER_COMMAND(vhighvoltage, getHighVoltage, setHighVoltage, StringTo<int>,
|
||||
"[n_value]\n\tHigh voltage to the sensor in Voltage."
|
||||
"\n\t[Gotthard] [0|90|110|120|150|180|200]"
|
||||
"\n\t[Eiger][Mythen3][Gotthard2] 0-200"
|
||||
"\n\t[Jungfrau][Ctb][Moench] [0|60-200]");
|
||||
|
||||
INTEGER_COMMAND(powerchip, getPowerChip, setPowerChip, std::stoi,
|
||||
INTEGER_COMMAND(powerchip, getPowerChip, setPowerChip, StringTo<int>,
|
||||
"[0, 1]\n\t[Jungfrau][Mythen3][Gotthard2][Moench] Power the chip. Default 0."
|
||||
"\n\t[Jungfrau] Get will return power status."
|
||||
"Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled."
|
||||
@ -1375,7 +1375,7 @@ class CmdProxy {
|
||||
GET_COMMAND(rx_missingpackets, getNumMissingPackets,
|
||||
"\n\tNumber of missing packets for each port in receiver.");
|
||||
|
||||
INTEGER_COMMAND(startingfnum, getStartingFrameNumber, setStartingFrameNumber, std::stoull,
|
||||
INTEGER_COMMAND(startingfnum, getStartingFrameNumber, setStartingFrameNumber, StringTo<uint64_t>,
|
||||
"[n_value]\n\t[Eiger[Jungfrau] Starting frame number for next acquisition.");
|
||||
|
||||
EXECUTE_SET_COMMAND(trigger, sendSoftwareTrigger,
|
||||
@ -1384,10 +1384,10 @@ class CmdProxy {
|
||||
|
||||
/* Network Configuration (Detector<->Receiver) */
|
||||
|
||||
INTEGER_COMMAND(numinterfaces, getNumberofUDPInterfaces, setNumberofUDPInterfaces, std::stoi,
|
||||
INTEGER_COMMAND(numinterfaces, getNumberofUDPInterfaces, setNumberofUDPInterfaces, StringTo<int>,
|
||||
"[1, 2]\n\t[Jungfrau] Number of udp interfaces to stream data from detector. Default: 1.");
|
||||
|
||||
INTEGER_COMMAND(selinterface, getSelectedUDPInterface, selectUDPInterface, std::stoi,
|
||||
INTEGER_COMMAND(selinterface, getSelectedUDPInterface, selectUDPInterface, StringTo<int>,
|
||||
"[0, 1]\n\t[Jungfrau] The udp interface to stream data from detector. Effective only when number of interfaces is 1. Default: 0 (outer)");
|
||||
|
||||
INTEGER_COMMAND(udp_srcip, getSourceUDPIP, setSourceUDPIP, IpAddr,
|
||||
@ -1408,57 +1408,57 @@ class CmdProxy {
|
||||
INTEGER_COMMAND(udp_dstmac2, getDestinationUDPMAC2, setDestinationUDPMAC2, MacAddr,
|
||||
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the receiver (destination) udp interface where the second half of detector data is sent to. Can be unused as udp_dstip2 retrieves it.");
|
||||
|
||||
INTEGER_COMMAND(udp_dstport, getDestinationUDPPort, setDestinationUDPPort, std::stoi,
|
||||
INTEGER_COMMAND(udp_dstport, getDestinationUDPPort, setDestinationUDPPort, StringTo<int>,
|
||||
"[n]\n\tPort number of the receiver (destination) udp interface. Default is 50001.");
|
||||
|
||||
INTEGER_COMMAND(udp_dstport2, getDestinationUDPPort2, setDestinationUDPPort2, std::stoi,
|
||||
INTEGER_COMMAND(udp_dstport2, getDestinationUDPPort2, setDestinationUDPPort2, StringTo<int>,
|
||||
"[n]\n\tDefault is 50002.\n\t[Jungfrau] Port number of the receiver (destination) udp interface where the second half of detector data is sent to. \n[Eiger] Port number of the reciever (desintation) udp interface where the right half of the detector data is sent to.");
|
||||
|
||||
GET_COMMAND(rx_printconfig, printRxConfiguration,
|
||||
"\n\tPrints the receiver configuration.");
|
||||
|
||||
INTEGER_COMMAND(tengiga, getTenGiga, setTenGiga, std::stoi,
|
||||
INTEGER_COMMAND(tengiga, getTenGiga, setTenGiga, StringTo<int>,
|
||||
"[0, 1]\n\t[Eiger][Ctb][Moench] 10GbE Enable.");
|
||||
|
||||
INTEGER_COMMAND(flowcontrol10g, getTenGigaFlowControl, setTenGigaFlowControl, std::stoi,
|
||||
INTEGER_COMMAND(flowcontrol10g, getTenGigaFlowControl, setTenGigaFlowControl, StringTo<int>,
|
||||
"[0, 1]\n\t[Eiger][Jungfrau] 10GbE Flow Control.");
|
||||
|
||||
INTEGER_COMMAND(txndelay_frame, getTransmissionDelayFrame, setTransmissionDelayFrame, std::stoi,
|
||||
INTEGER_COMMAND(txndelay_frame, getTransmissionDelayFrame, setTransmissionDelayFrame, StringTo<int>,
|
||||
"[n_delay]\n\t[Eiger][Jungfrau] Transmission delay of each image being streamed out of the module.\n\t[Jungfrau] [0-31] Each value represents 1 ms\n\t[Eiger] Additional delay to txndelay_left and txndelay_right. Each value represents 10ns. Typical value is 50000.");
|
||||
|
||||
INTEGER_COMMAND(txndelay_left, getTransmissionDelayLeft, setTransmissionDelayLeft, std::stoi,
|
||||
INTEGER_COMMAND(txndelay_left, getTransmissionDelayLeft, setTransmissionDelayLeft, StringTo<int>,
|
||||
"[n_delay]\n\t[Eiger] Transmission delay of first packet in an image being streamed out of the module's left UDP port. Each value represents 10ns. Typical value is 50000.");
|
||||
|
||||
INTEGER_COMMAND(txndelay_right, getTransmissionDelayRight, setTransmissionDelayRight, std::stoi,
|
||||
INTEGER_COMMAND(txndelay_right, getTransmissionDelayRight, setTransmissionDelayRight, StringTo<int>,
|
||||
"[n_delay]\n\t[Eiger] Transmission delay of first packet in an image being streamed out of the module's right UDP port. Each value represents 10ns. Typical value is 50000.");
|
||||
|
||||
|
||||
/* Receiver Config */
|
||||
|
||||
INTEGER_COMMAND(rx_tcpport, getRxPort, setRxPort, std::stoi,
|
||||
INTEGER_COMMAND(rx_tcpport, getRxPort, setRxPort, StringTo<int>,
|
||||
"[port]\n\tTCP port for client-receiver communication. Default is 1954. Must be different if multiple receivers on same pc. Must be first command to set a receiver parameter. Multi command will automatically increment for individual modules.");
|
||||
|
||||
INTEGER_COMMAND(rx_fifodepth, getRxFifoDepth, setRxFifoDepth, std::stoi,
|
||||
INTEGER_COMMAND(rx_fifodepth, getRxFifoDepth, setRxFifoDepth, StringTo<int>,
|
||||
"[n_frames]\n\tSet the number of frames in the receiver fifo (buffer between listener and writer threads).");
|
||||
|
||||
INTEGER_COMMAND(rx_silent, getRxSilentMode, setRxSilentMode, std::stoi,
|
||||
INTEGER_COMMAND(rx_silent, getRxSilentMode, setRxSilentMode, StringTo<int>,
|
||||
"[0, 1]\n\tSwitch on or off receiver text output during acquisition.");
|
||||
|
||||
INTEGER_COMMAND(rx_discardpolicy, getRxFrameDiscardPolicy, setRxFrameDiscardPolicy, sls::StringTo<slsDetectorDefs::frameDiscardPolicy>,
|
||||
"[nodiscard (default)|discardempty|discardpartial(fastest)]\n\tFrame discard policy of receiver. nodiscard does not discard frames, discardempty discards empty frames, discardpartial discards partial frames.");
|
||||
|
||||
INTEGER_COMMAND(rx_padding, getPartialFramesPadding, setPartialFramesPadding, std::stoi,
|
||||
INTEGER_COMMAND(rx_padding, getPartialFramesPadding, setPartialFramesPadding, StringTo<int>,
|
||||
"[0, 1]\n\tPartial frames padding enable in the "
|
||||
"receiver. 0 does not pad partial frames(fastest), 1 "
|
||||
"(default) pads partial frames");
|
||||
|
||||
INTEGER_COMMAND(rx_udpsocksize, getRxUDPSocketBufferSize, setRxUDPSocketBufferSize, std::stol,
|
||||
INTEGER_COMMAND(rx_udpsocksize, getRxUDPSocketBufferSize, setRxUDPSocketBufferSize, StringTo<int64_t>,
|
||||
"[n_size]\n\tUDP socket buffer size in receiver. Tune rmem_default and rmem_max accordingly. rx_hostname sets it to defaults.");
|
||||
|
||||
GET_COMMAND(rx_realudpsocksize, getRxRealUDPSocketBufferSize,
|
||||
"\n\tActual udp socket buffer size. Double the size of rx_udpsocksize due to kernel bookkeeping.");
|
||||
|
||||
INTEGER_COMMAND(rx_lock, getRxLock, setRxLock, std::stoi,
|
||||
INTEGER_COMMAND(rx_lock, getRxLock, setRxLock, StringTo<int>,
|
||||
"[0, 1]\n\tLock receiver to one IP, 1: locks");
|
||||
|
||||
GET_COMMAND(rx_lastclient, getRxLastClientIP,
|
||||
@ -1476,35 +1476,35 @@ class CmdProxy {
|
||||
STRING_COMMAND(fname, getFileNamePrefix, setFileNamePrefix,
|
||||
"[path]\n\tFile name prefix for output data file. Default is run. File name: [file name prefix]_d[detector index]_f[sub file index]_[acquisition/file index].raw.");
|
||||
|
||||
INTEGER_COMMAND(findex, getAcquisitionIndex, setAcquisitionIndex, std::stol,
|
||||
INTEGER_COMMAND(findex, getAcquisitionIndex, setAcquisitionIndex, StringTo<int64_t>,
|
||||
"[0, 1]\n\tFile or Acquisition index.");
|
||||
|
||||
INTEGER_COMMAND(fwrite, getFileWrite, setFileWrite, std::stoi,
|
||||
INTEGER_COMMAND(fwrite, getFileWrite, setFileWrite, StringTo<int>,
|
||||
"[0, 1]\n\tEnable or disable receiver file write. Default is 1.");
|
||||
|
||||
INTEGER_COMMAND_NOID(fmaster, getMasterFileWrite, setMasterFileWrite, std::stoi,
|
||||
INTEGER_COMMAND_NOID(fmaster, getMasterFileWrite, setMasterFileWrite, StringTo<int>,
|
||||
"[0, 1]\n\tEnable or disable receiver master file. Default is 1.");
|
||||
|
||||
INTEGER_COMMAND(foverwrite, getFileOverWrite, setFileOverWrite, std::stoi,
|
||||
INTEGER_COMMAND(foverwrite, getFileOverWrite, setFileOverWrite, StringTo<int>,
|
||||
"[0, 1]\n\tEnable or disable file overwriting. Default is 1.");
|
||||
|
||||
INTEGER_COMMAND(rx_framesperfile, getFramesPerFile, setFramesPerFile, std::stoi,
|
||||
INTEGER_COMMAND(rx_framesperfile, getFramesPerFile, setFramesPerFile, StringTo<int>,
|
||||
"[n_frames]\n\tNumber of frames per file in receiver. 0 is infinite or all frames in single file.");
|
||||
|
||||
|
||||
/* ZMQ Streaming Parameters (Receiver<->Client) */
|
||||
|
||||
INTEGER_COMMAND(rx_datastream, getRxZmqDataStream, setRxZmqDataStream, std::stoi,
|
||||
INTEGER_COMMAND(rx_datastream, getRxZmqDataStream, setRxZmqDataStream, StringTo<int>,
|
||||
"[0, 1]\n\tData streaming from receiver enable (eg. to GUI ot another process for further processing). 1 enables zmq data stream (creates zmq streamer threads), 0 disables (destroys streamer threads). Switching to Gui automatically enables data streaming in receiver. Switching back to command line acquire will require disabling data streaming in receiver for fast applications.");
|
||||
|
||||
INTEGER_COMMAND(rx_readfreq, getRxZmqFrequency, setRxZmqFrequency,
|
||||
std::stoi, "[nth frame]\n\tStream out every nth frame. Default is 1. 0 means streaming every 200 ms and discarding frames in this interval.");
|
||||
StringTo<int>, "[nth frame]\n\tStream out every nth frame. Default is 1. 0 means streaming every 200 ms and discarding frames in this interval.");
|
||||
|
||||
INTEGER_COMMAND(rx_zmqport, getRxZmqPort, setRxZmqPort,
|
||||
std::stoi, "[port]\n\tZmq port for data to be streamed out of the receiver. Also restarts receiver zmq streaming if enabled. Default is 30001. Modified only when using an intermediate process between receiver and client(gui). Must be different for every detector (and udp port). Multi command will automatically increment for individual modules.");
|
||||
StringTo<int>, "[port]\n\tZmq port for data to be streamed out of the receiver. Also restarts receiver zmq streaming if enabled. Default is 30001. Modified only when using an intermediate process between receiver and client(gui). Must be different for every detector (and udp port). Multi command will automatically increment for individual modules.");
|
||||
|
||||
INTEGER_COMMAND(zmqport, getClientZmqPort, setClientZmqPort,
|
||||
std::stoi, "[port]\n\tZmq port in client(gui) or intermediate process for data to be streamed to from receiver. efault connects to receiver zmq streaming out port (30001). Modified only when using an intermediate process between receiver and client(gui). Also restarts client zmq streaming if enabled. Must be different for every detector (and udp port). Multi command will automatically increment for individual modules.");
|
||||
StringTo<int>, "[port]\n\tZmq port in client(gui) or intermediate process for data to be streamed to from receiver. efault connects to receiver zmq streaming out port (30001). Modified only when using an intermediate process between receiver and client(gui). Also restarts client zmq streaming if enabled. Must be different for every detector (and udp port). Multi command will automatically increment for individual modules.");
|
||||
|
||||
INTEGER_COMMAND(rx_zmqip, getRxZmqIP, setRxZmqIP, IpAddr,
|
||||
"[x.x.x.x]\n\tZmq Ip Address from which data is to be streamed out of the receiver. Also restarts receiver zmq streaming if enabled. Default is from rx_hostname. Modified only when using an intermediate process between receiver and client(gui).");
|
||||
@ -1527,25 +1527,25 @@ class CmdProxy {
|
||||
EXECUTE_SET_COMMAND_NOID_1ARG(trimbits, loadTrimbits,
|
||||
"[fname]\n\t[Eiger] Loads the trimbit file to detector. If no extension specified, serial number of each module is attached.");
|
||||
|
||||
INTEGER_COMMAND(parallel, getParallelMode, setParallelMode, std::stoi,
|
||||
INTEGER_COMMAND(parallel, getParallelMode, setParallelMode, StringTo<int>,
|
||||
"[0, 1]\n\t[Eiger] Enable or disable parallel mode.");
|
||||
|
||||
INTEGER_COMMAND(overflow, getOverFlowMode, setOverFlowMode, std::stoi,
|
||||
INTEGER_COMMAND(overflow, getOverFlowMode, setOverFlowMode, StringTo<int>,
|
||||
"[0, 1]\n\t[Eiger] Enable or disable show overflow flag in 32 bit mode.");
|
||||
|
||||
INTEGER_COMMAND(storeinram, getStoreInRamMode, setStoreInRamMode, std::stoi,
|
||||
INTEGER_COMMAND(storeinram, getStoreInRamMode, setStoreInRamMode, StringTo<int>,
|
||||
"[0, 1]\n\t[Eiger] Enable or disable store in ram mode.");
|
||||
|
||||
INTEGER_COMMAND(flippeddatax, getBottom, setBottom, std::stoi,
|
||||
INTEGER_COMMAND(flippeddatax, getBottom, setBottom, StringTo<int>,
|
||||
"[0, 1]\n\t[Eiger] Top or Bottom Half of Eiger module. 1 is bottom, 0 is top. Used to let Receivers and Gui know to flip the bottom image over the x axis. Files are not written without the flip however.");
|
||||
|
||||
INTEGER_COMMAND(trimval, getAllTrimbits, setAllTrimbits, std::stoi,
|
||||
INTEGER_COMMAND(trimval, getAllTrimbits, setAllTrimbits, StringTo<int>,
|
||||
"[n_trimval]\n\t[Eiger] All trimbits set to this value. A get returns -1 if all trimbits are different values.");
|
||||
|
||||
INTEGER_COMMAND(readnlines, getPartialReadout, setPartialReadout, std::stoi,
|
||||
INTEGER_COMMAND(readnlines, getPartialReadout, setPartialReadout, StringTo<int>,
|
||||
"[1 - 256]\n\t[Eiger] Number of rows to readout per half module starting from the centre. 256 is default. The permissible values depend on dynamic range and 10Gbe enabled.");
|
||||
|
||||
INTEGER_COMMAND(interruptsubframe, getInterruptSubframe, setInterruptSubframe, std::stoi,
|
||||
INTEGER_COMMAND(interruptsubframe, getInterruptSubframe, setInterruptSubframe, StringTo<int>,
|
||||
"[0, 1]\n\t[Eiger] 1 interrupts last subframe at required exposure time. 0 will wait for last sub frame to finish exposing. 0 is default.");
|
||||
|
||||
TIME_GET_COMMAND(measuredperiod, getMeasuredPeriod,
|
||||
@ -1554,25 +1554,25 @@ class CmdProxy {
|
||||
TIME_GET_COMMAND(measuredsubperiod, getMeasuredSubFramePeriod,
|
||||
"[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured sub frame period between last sub frame and previous one.");
|
||||
|
||||
INTEGER_COMMAND(partialreset, getPartialReset, setPartialReset, std::stoi,
|
||||
INTEGER_COMMAND(partialreset, getPartialReset, setPartialReset, StringTo<int>,
|
||||
"[0, 1]\n\t[Eiger] Sets up detector to do partial or complete reset at start of acquisition. 0 complete reset, 1 partial reset.");
|
||||
|
||||
|
||||
/* Jungfrau Specific */
|
||||
|
||||
INTEGER_COMMAND(temp_threshold, getThresholdTemperature, setThresholdTemperature, std::stoi,
|
||||
INTEGER_COMMAND(temp_threshold, getThresholdTemperature, setThresholdTemperature, StringTo<int>,
|
||||
"[n_temp (in degrees)]\n\t[Jungfrau] Threshold temperature in degrees. If temperature crosses threshold temperature and temperature control is enabled, power to chip will be switched off and temperature event occurs. To power on chip again, temperature has to be less than threshold temperature and temperature event has to be cleared.");
|
||||
|
||||
INTEGER_COMMAND(temp_control, getTemperatureControl, setTemperatureControl, std::stoi,
|
||||
INTEGER_COMMAND(temp_control, getTemperatureControl, setTemperatureControl, StringTo<int>,
|
||||
"[0, 1]\n\t[Jungfrau] Temperature control enable. Default is 0 (disabled). If temperature crosses threshold temperature and temperature control is enabled, power to chip will be switched off and temperature event occurs. To power on chip again, temperature has to be less than threshold temperature and temperature event has to be cleared.");
|
||||
|
||||
INTEGER_COMMAND(auto_comp_disable, getAutoCompDisable, setAutoCompDisable, std::stoi,
|
||||
INTEGER_COMMAND(auto_comp_disable, getAutoCompDisable, setAutoCompDisable, StringTo<int>,
|
||||
"[0, 1]\n\t[Jungfrau] Auto comparator disable mode. Default 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. This mode disables the on-chip gain switching comparator automatically after 93.75% of exposure time (only for longer than 100us).");
|
||||
|
||||
INTEGER_COMMAND_NOID(storagecells, getNumberOfAdditionalStorageCells, setNumberOfAdditionalStorageCells, std::stoi,
|
||||
INTEGER_COMMAND_NOID(storagecells, getNumberOfAdditionalStorageCells, setNumberOfAdditionalStorageCells, StringTo<int>,
|
||||
"[0-15]\n\t[Jungfrau] Number of additional storage cells. Default is 0. For advanced users only. \n\tThe #images = #frames x #triggers x (#storagecells + 1).");
|
||||
|
||||
INTEGER_COMMAND(storagecell_start, getStorageCellStart, setStoragecellStart, std::stoi,
|
||||
INTEGER_COMMAND(storagecell_start, getStorageCellStart, setStoragecellStart, StringTo<int>,
|
||||
"[0-15]\n\t[Jungfrau] Storage cell that stores the first acquisition of the series. Default is 15. For advanced users only.");
|
||||
|
||||
TIME_COMMAND(storagecell_delay, getStorageCellDelay, setStorageCellDelay,
|
||||
@ -1586,11 +1586,11 @@ class CmdProxy {
|
||||
INTEGER_COMMAND(extsig, getExternalSignalFlags, setExternalSignalFlags, sls::StringTo<slsDetectorDefs::externalSignalFlag>,
|
||||
"[trigger_in_rising_edge|trigger_in_falling_edge]\n\t[Gotthard] External signal mode for trigger timing mode.");
|
||||
|
||||
INTEGER_COMMAND(imagetest, getImageTestMode, setImageTestMode, std::stoi,
|
||||
INTEGER_COMMAND(imagetest, getImageTestMode, setImageTestMode, StringTo<int>,
|
||||
"[0, 1]\n\t[Gotthard] 1 adds channel intensity with precalculated values when taking an acquisition. Default is 0.");
|
||||
|
||||
/* Gotthard2 Specific */
|
||||
INTEGER_COMMAND(currentsource, getCurrentSource, setCurrentSource, std::stoi,
|
||||
INTEGER_COMMAND(currentsource, getCurrentSource, setCurrentSource, StringTo<int>,
|
||||
"[0, 1]\n\t[Gotthard2] Enable or disable current source. Default is disabled.");
|
||||
|
||||
INTEGER_COMMAND(timingsource, getTimingSource, setTimingSource, sls::StringTo<slsDetectorDefs::timingSourceType>,
|
||||
@ -1600,22 +1600,22 @@ class CmdProxy {
|
||||
|
||||
/* CTB/ Moench Specific */
|
||||
|
||||
INTEGER_COMMAND(asamples, getNumberOfAnalogSamples, setNumberOfAnalogSamples, std::stoi,
|
||||
INTEGER_COMMAND(asamples, getNumberOfAnalogSamples, setNumberOfAnalogSamples, StringTo<int>,
|
||||
"[0, 1]\n\t[CTB][Moench] Number of analog samples expected.");
|
||||
|
||||
INTEGER_COMMAND(adcclk, getADCClock, setADCClock, std::stoi,
|
||||
INTEGER_COMMAND(adcclk, getADCClock, setADCClock, StringTo<int>,
|
||||
"[n_clk in MHz]\n\t[Ctb][Moench] ADC clock frequency in MHz.");
|
||||
|
||||
INTEGER_COMMAND(runclk, getRUNClock, setRUNClock, std::stoi,
|
||||
INTEGER_COMMAND(runclk, getRUNClock, setRUNClock, StringTo<int>,
|
||||
"[n_clk in MHz]\n\t[Ctb][Moench] Run clock in MHz.");
|
||||
|
||||
GET_COMMAND(syncclk, getSYNCClock,
|
||||
"[n_clk in MHz]\n\t[Ctb][Moench] Sync clock in MHz.");
|
||||
|
||||
INTEGER_COMMAND(adcpipeline, getADCPipeline, setADCPipeline, std::stoi,
|
||||
INTEGER_COMMAND(adcpipeline, getADCPipeline, setADCPipeline, StringTo<int>,
|
||||
"[n_value]\n\t[Ctb][Moench] Pipeline for ADC clock.");
|
||||
|
||||
INTEGER_IND_COMMAND(v_limit, getVoltage, setVoltage, std::stoi, defs::V_LIMIT,
|
||||
INTEGER_IND_COMMAND(v_limit, getVoltage, setVoltage, StringTo<int>, defs::V_LIMIT,
|
||||
"[n_value]\n\t[Ctb][Moench] Soft limit for power supplies(ctb only) and DACS in mV.");
|
||||
|
||||
INTEGER_COMMAND_HEX(adcenable, getADCEnableMask, setADCEnableMask, StringTo<uint32_t>,
|
||||
@ -1627,34 +1627,34 @@ class CmdProxy {
|
||||
/* CTB Specific */
|
||||
|
||||
|
||||
INTEGER_COMMAND(dsamples, getNumberOfDigitalSamples, setNumberOfDigitalSamples, std::stoi,
|
||||
INTEGER_COMMAND(dsamples, getNumberOfDigitalSamples, setNumberOfDigitalSamples, StringTo<int>,
|
||||
"[0, 1]\n\t[CTB] Number of digital samples expected.");
|
||||
|
||||
INTEGER_COMMAND(romode, getReadoutMode, setReadoutMode, sls::StringTo<slsDetectorDefs::readoutMode>,
|
||||
"[analog|digital|analog_digital]\n\t[CTB] Readout mode. Default is analog.");
|
||||
|
||||
INTEGER_COMMAND(dbitclk, getDBITClock, setDBITClock, std::stoi,
|
||||
INTEGER_COMMAND(dbitclk, getDBITClock, setDBITClock, StringTo<int>,
|
||||
"[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz.");
|
||||
|
||||
INTEGER_COMMAND(dbitpipeline, getDBITPipeline, setDBITPipeline, std::stoi,
|
||||
INTEGER_COMMAND(dbitpipeline, getDBITPipeline, setDBITPipeline, StringTo<int>,
|
||||
"[n_value]\n\t[Ctb] Pipeline of the clock for latching digital bits.");
|
||||
|
||||
INTEGER_IND_COMMAND(v_a, getVoltage, setVoltage, std::stoi, defs::V_POWER_A,
|
||||
INTEGER_IND_COMMAND(v_a, getVoltage, setVoltage, StringTo<int>, defs::V_POWER_A,
|
||||
"[n_value]\n\t[Ctb] Voltage supply a in mV.");
|
||||
|
||||
INTEGER_IND_COMMAND(v_b, getVoltage, setVoltage, std::stoi, defs::V_POWER_B,
|
||||
INTEGER_IND_COMMAND(v_b, getVoltage, setVoltage, StringTo<int>, defs::V_POWER_B,
|
||||
"[n_value]\n\t[Ctb] Voltage supply b in mV.");
|
||||
|
||||
INTEGER_IND_COMMAND(v_c, getVoltage, setVoltage, std::stoi, defs::V_POWER_C,
|
||||
INTEGER_IND_COMMAND(v_c, getVoltage, setVoltage, StringTo<int>, defs::V_POWER_C,
|
||||
"[n_value]\n\t[Ctb] Voltage supply c in mV.");
|
||||
|
||||
INTEGER_IND_COMMAND(v_d, getVoltage, setVoltage, std::stoi, defs::V_POWER_D,
|
||||
INTEGER_IND_COMMAND(v_d, getVoltage, setVoltage, StringTo<int>, defs::V_POWER_D,
|
||||
"[n_value]\n\t[Ctb] Voltage supply d in mV.");
|
||||
|
||||
INTEGER_IND_COMMAND(v_io, getVoltage, setVoltage, std::stoi, defs::V_POWER_IO,
|
||||
INTEGER_IND_COMMAND(v_io, getVoltage, setVoltage, StringTo<int>, defs::V_POWER_IO,
|
||||
"[n_value]\n\t[Ctb] Voltage supply io in mV. Minimum 1200 mV. Must be the first power regulator to be set after fpga reset (on-board detector server start up).");
|
||||
|
||||
INTEGER_IND_COMMAND(v_chip, getVoltage, setVoltage, std::stoi, defs::V_POWER_CHIP,
|
||||
INTEGER_IND_COMMAND(v_chip, getVoltage, setVoltage, StringTo<int>, defs::V_POWER_CHIP,
|
||||
"[n_value]\n\t[Ctb] Voltage supply chip in mV. Do not use it unless you are completely sure you will not fry the board.");
|
||||
|
||||
GET_IND_COMMAND(vm_a, getMeasuredVoltage, defs::V_POWER_A, "",
|
||||
@ -1687,16 +1687,16 @@ class CmdProxy {
|
||||
GET_IND_COMMAND(im_io, getMeasuredCurrent, defs::I_POWER_IO, "",
|
||||
"\n\t[Ctb] Measured current of power supply io in mA.");
|
||||
|
||||
INTEGER_COMMAND(extsampling, getExternalSampling, setExternalSampling, std::stoi,
|
||||
INTEGER_COMMAND(extsampling, getExternalSampling, setExternalSampling, StringTo<int>,
|
||||
"[0, 1]\n\t[Ctb] Enable for external sampling signal to extsamplingsrc signal for digital data. For advanced users only.");
|
||||
|
||||
INTEGER_COMMAND(extsamplingsrc, getExternalSamplingSource, setExternalSamplingSource, std::stoi,
|
||||
INTEGER_COMMAND(extsamplingsrc, getExternalSamplingSource, setExternalSamplingSource, StringTo<int>,
|
||||
"[0-63]\n\t[Ctb] Sampling source signal for digital data. For advanced users only.");
|
||||
|
||||
INTEGER_COMMAND(rx_dbitoffset, getRxDbitOffset, setRxDbitOffset, std::stoi,
|
||||
INTEGER_COMMAND(rx_dbitoffset, getRxDbitOffset, setRxDbitOffset, StringTo<int>,
|
||||
"[n_bytes]\n\t[Ctb] Offset in bytes in digital data in receiver.");
|
||||
|
||||
INTEGER_COMMAND(led, getLEDEnable, setLEDEnable, std::stoi,
|
||||
INTEGER_COMMAND(led, getLEDEnable, setLEDEnable, StringTo<int>,
|
||||
"[0, 1]\n\t[Ctb] Switches on/off all LEDs.");
|
||||
|
||||
|
||||
@ -1748,13 +1748,13 @@ class CmdProxy {
|
||||
|
||||
/* Insignificant */
|
||||
|
||||
INTEGER_COMMAND(port, getControlPort, setControlPort, std::stoi,
|
||||
INTEGER_COMMAND(port, getControlPort, setControlPort, StringTo<int>,
|
||||
"[n]\n\tPort number of the control server on detector for detector-client tcp interface. Default is 1952. Normally unchanged.");
|
||||
|
||||
INTEGER_COMMAND(stopport, getStopPort, setStopPort, std::stoi,
|
||||
INTEGER_COMMAND(stopport, getStopPort, setStopPort, StringTo<int>,
|
||||
"[n]\n\tPort number of the stop server on detector for detector-client tcp interface. Default is 1953. Normally unchanged.");
|
||||
|
||||
INTEGER_COMMAND(lock, getDetectorLock, setDetectorLock, std::stoi,
|
||||
INTEGER_COMMAND(lock, getDetectorLock, setDetectorLock, StringTo<int>,
|
||||
"[0, 1]\n\tLock detector to one IP, 1: locks");
|
||||
|
||||
GET_COMMAND(lastclient, getLastClientIP,
|
||||
|
@ -254,7 +254,7 @@ void DetectorImpl::addSlsDetector(const std::string &hostname) {
|
||||
auto res = sls::split(hostname, ':');
|
||||
if (res.size() > 1) {
|
||||
host = res[0];
|
||||
port = std::stoi(res[1]);
|
||||
port = StringTo<int>(res[1]);
|
||||
}
|
||||
|
||||
if (host != "localhost") {
|
||||
|
@ -922,7 +922,7 @@ int Module::getThresholdEnergy() {
|
||||
std::string result = getAdditionalJsonParameter("threshold");
|
||||
// convert to integer
|
||||
try {
|
||||
return stoi(result);
|
||||
return std::stoi(result);
|
||||
}
|
||||
// not found or cannot scan integer
|
||||
catch (...) {
|
||||
@ -2145,7 +2145,7 @@ std::string Module::setAdditionalJsonParameter(const std::string &key,
|
||||
std::string valueLiteral(value);
|
||||
// add quotations to value only if it is a string
|
||||
try {
|
||||
stoi(valueLiteral);
|
||||
std::stoi(valueLiteral);
|
||||
} catch (...) {
|
||||
// add quotations if it failed to convert to integer, otherwise nothing
|
||||
valueLiteral.insert(0, "\"");
|
||||
|
@ -628,6 +628,12 @@ inline int StringTo(const std::string &s) {
|
||||
return std::stoi(s, nullptr, base);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline int64_t StringTo(const std::string &s) {
|
||||
int base = s.find("0x") != std::string::npos ? 16 : 10;
|
||||
return std::stol(s, nullptr, base);
|
||||
}
|
||||
|
||||
/** For types with a .str() method use this for conversion */
|
||||
template <typename T>
|
||||
typename std::enable_if<has_str<T>::value, std::string>::type
|
||||
|
@ -179,3 +179,18 @@ TEST_CASE("int from string"){
|
||||
REQUIRE(StringTo<int>("0xffffff") == 0xffffff);
|
||||
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("int64_t from string"){
|
||||
REQUIRE(StringTo<int64_t>("-1") == -1);
|
||||
REQUIRE(StringTo<int64_t>("-0x1") == -0x1);
|
||||
REQUIRE(StringTo<int64_t>("-0x1") == -1);
|
||||
REQUIRE(StringTo<int64_t>("0") == 0);
|
||||
REQUIRE(StringTo<int64_t>("5") == 5);
|
||||
REQUIRE(StringTo<int64_t>("16") == 16);
|
||||
REQUIRE(StringTo<int64_t>("20") == 20);
|
||||
REQUIRE(StringTo<int64_t>("0x14") == 20);
|
||||
REQUIRE(StringTo<int64_t>("0x15") == 21);
|
||||
REQUIRE(StringTo<int64_t>("0xffffff") == 0xffffff);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user