mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 23:37:14 +02:00
WIP
This commit is contained in:
@ -757,16 +757,18 @@ class CmdProxy {
|
|||||||
{"bustest", &CmdProxy::bustest},
|
{"bustest", &CmdProxy::bustest},
|
||||||
|
|
||||||
/* Insignificant */
|
/* Insignificant */
|
||||||
|
{"port", &CmdProxy::port},
|
||||||
|
{"stopport", &CmdProxy::stopport},
|
||||||
|
{"lock", &CmdProxy::lock},
|
||||||
|
{"lastclient", &CmdProxy::lastclient},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{"adcvpp", &CmdProxy::adcvpp}//dac
|
||||||
|
|
||||||
{"adcvpp", &CmdProxy::adcvpp},//dac
|
|
||||||
{"lastclient", &CmdProxy::lastclient},
|
|
||||||
{"lock", &CmdProxy::lock}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1333,17 +1335,27 @@ class CmdProxy {
|
|||||||
|
|
||||||
/* Insignificant */
|
/* Insignificant */
|
||||||
|
|
||||||
|
INTEGER_COMMAND(port, getControlPort, setControlPort, std::stoi,
|
||||||
|
"[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,
|
||||||
|
"[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,
|
||||||
|
"[0, 1]\n\tLock detector to one IP, 1: locks");
|
||||||
|
|
||||||
|
GET_COMMAND(lastclient, getLastClientIP,
|
||||||
|
"\n\tClient IP Address that last communicated with the detector.");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DAC_COMMAND(adcvpp, getDAC, setDAC, defs::ADC_VPP,
|
DAC_COMMAND(adcvpp, getDAC, setDAC, defs::ADC_VPP,
|
||||||
"[dac or mv value][(optional unit) mv] \n\t[Ctb] Vpp of ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V.");
|
"[dac or mv value][(optional unit) mv] \n\t[Ctb] Vpp of ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V.");
|
||||||
|
|
||||||
GET_COMMAND(lastclient, getLastClientIP,
|
|
||||||
"\n\tClient IP Address that last communicated with the detector.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND(lock, getDetectorLock, setDetectorLock, std::stoi,
|
|
||||||
"[0, 1]\n\tLock detector to one IP, 1: locks");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
static std::string helpUser(int action);
|
static std::string helpUser(int action);
|
||||||
static std::string helpExitServer(int action);
|
static std::string helpExitServer(int action);
|
||||||
static std::string helpThreaded(int action);
|
static std::string helpThreaded(int action);
|
||||||
static std::string helpPort(int action);
|
|
||||||
static std::string helpSettings(int action);
|
static std::string helpSettings(int action);
|
||||||
static std::string helpSN(int action);
|
static std::string helpSN(int action);
|
||||||
static std::string helpDigiTest(int action);
|
static std::string helpDigiTest(int action);
|
||||||
@ -68,7 +67,6 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
std::string cmdUser(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdUser(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdHelp(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdHelp(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdExitServer(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdExitServer(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdPort(int narg, const char * const args[], int action, int detPos = -1);
|
|
||||||
std::string cmdSettings(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdSettings(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdSN(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdSN(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdDigiTest(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdDigiTest(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
|
@ -810,21 +810,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
|
|
||||||
/* communication configuration */
|
/* communication configuration */
|
||||||
|
|
||||||
/*! \page network
|
|
||||||
- <b>port [port]</b> sets/gets the port of the client-detector control server TCP interface. Use single-detector command. Default value is 1952 for all detectors. Normally not changed. \c Returns \c (int)
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "port";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPort;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page network
|
|
||||||
- <b>stopport [port]</b> sets/gets the port of the client-detector stop server TCP interface. Use single-detector command. Default value is 1953 for all detectors. Normally not changed. \c Returns \c (int)
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "stopport";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPort;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
|
|
||||||
/* receiver functions */
|
/* receiver functions */
|
||||||
|
|
||||||
/*! \page receiver Receiver commands
|
/*! \page receiver Receiver commands
|
||||||
@ -1167,48 +1152,6 @@ std::string slsDetectorCommand::helpThreaded(int action) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdPort(int narg, const char * const args[], int action, int detPos) {
|
|
||||||
|
|
||||||
if (action == HELP_ACTION)
|
|
||||||
return helpPort(action);
|
|
||||||
int val; //ret,
|
|
||||||
char ans[MAX_STR_LENGTH];
|
|
||||||
if (action == PUT_ACTION) {
|
|
||||||
if (sscanf(args[1], "%d", &val))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("could not scan port number") + std::string(args[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmd == "port") {
|
|
||||||
if (action == PUT_ACTION)
|
|
||||||
myDet->setControlPort(val, detPos);
|
|
||||||
sprintf(ans, "%d", myDet->setControlPort(-1, detPos));
|
|
||||||
} else if (cmd == "stopport") {
|
|
||||||
if (action == PUT_ACTION)
|
|
||||||
myDet->setStopPort(val, detPos);
|
|
||||||
sprintf(ans, "%d", myDet->setStopPort(-1, detPos));
|
|
||||||
} else
|
|
||||||
return std::string("unknown port type ") + cmd;
|
|
||||||
|
|
||||||
return std::string(ans);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string slsDetectorCommand::helpPort(int action) {
|
|
||||||
|
|
||||||
std::ostringstream os;
|
|
||||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
|
||||||
os << "port i \n sets the communication control port" << std::endl;
|
|
||||||
os << "stopport i \n sets the communication stop port " << std::endl;
|
|
||||||
}
|
|
||||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
|
||||||
os << "port \n gets the communication control port" << std::endl;
|
|
||||||
os << "stopport \n gets the communication stop port " << std::endl;
|
|
||||||
}
|
|
||||||
return os.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdSettings(int narg, const char * const args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdSettings(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
|
@ -9,6 +9,34 @@
|
|||||||
auto GET = slsDetectorDefs::GET_ACTION;
|
auto GET = slsDetectorDefs::GET_ACTION;
|
||||||
auto PUT = slsDetectorDefs::PUT_ACTION;
|
auto PUT = slsDetectorDefs::PUT_ACTION;
|
||||||
|
|
||||||
|
TEST_CASE("port", "[.cmd]") {
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("port 1942", PUT, nullptr, oss));
|
||||||
|
REQUIRE(oss.str() == "port 1942\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("port", GET, nullptr, oss));
|
||||||
|
REQUIRE(oss.str() == "port 1942\n");
|
||||||
|
}
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("port 1952", PUT));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("stopport", "[.cmd]") {
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("stopport 1942", PUT, nullptr, oss));
|
||||||
|
REQUIRE(oss.str() == "stopport 1942\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("stopport", GET, nullptr, oss));
|
||||||
|
REQUIRE(oss.str() == "stopport 1942\n");
|
||||||
|
}
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("stopport 1953", PUT));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("adcreg", "[.cmd]") {
|
TEST_CASE("adcreg", "[.cmd]") {
|
||||||
if (test::type == slsDetectorDefs::JUNGFRAU || test::type == slsDetectorDefs::CHIPTESTBOARD || test::type == slsDetectorDefs::GOTTHARD) {
|
if (test::type == slsDetectorDefs::JUNGFRAU || test::type == slsDetectorDefs::CHIPTESTBOARD || test::type == slsDetectorDefs::GOTTHARD) {
|
||||||
REQUIRE_THROWS(multiSlsDetectorClient("adcreg 0x34", PUT));
|
REQUIRE_THROWS(multiSlsDetectorClient("adcreg 0x34", PUT));
|
||||||
|
Reference in New Issue
Block a user