mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 10:30:41 +02:00
error message 'unrecognized function enum' from detector or receiver prepended with Software version mismatch to handle enum start change between v6 and v7 (#680)
This commit is contained in:
parent
8501e1fb1f
commit
f7618fbb93
@ -547,8 +547,8 @@ int M_nofunc(int file_des) {
|
|||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
|
|
||||||
sprintf(mess, "Unrecognized Function enum %d. Please do not proceed.\n",
|
sprintf(mess, "%s Function enum %d. Please do not proceed.\n",
|
||||||
fnum);
|
UNRECOGNIZED_FNUM_ENUM, fnum);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return Server_SendResult(file_des, OTHER, NULL, 0);
|
return Server_SendResult(file_des, OTHER, NULL, 0);
|
||||||
}
|
}
|
||||||
@ -1920,7 +1920,8 @@ int acquire(int blocking, int file_des) {
|
|||||||
uint64_t sourcemac = getDetectorMAC();
|
uint64_t sourcemac = getDetectorMAC();
|
||||||
char src_mac[MAC_ADDRESS_SIZE];
|
char src_mac[MAC_ADDRESS_SIZE];
|
||||||
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
|
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
|
||||||
sprintf(mess,
|
sprintf(
|
||||||
|
mess,
|
||||||
"Invalid udp source mac address for this detector. Must be "
|
"Invalid udp source mac address for this detector. Must be "
|
||||||
"same as hardware detector mac address %s\n",
|
"same as hardware detector mac address %s\n",
|
||||||
src_mac);
|
src_mac);
|
||||||
@ -1931,7 +1932,8 @@ int acquire(int blocking, int file_des) {
|
|||||||
uint32_t sourceip = getDetectorIP();
|
uint32_t sourceip = getDetectorIP();
|
||||||
char src_ip[INET_ADDRSTRLEN];
|
char src_ip[INET_ADDRSTRLEN];
|
||||||
getIpAddressinString(src_ip, sourceip);
|
getIpAddressinString(src_ip, sourceip);
|
||||||
sprintf(mess,
|
sprintf(
|
||||||
|
mess,
|
||||||
"Invalid udp source ip address for this detector. Must be "
|
"Invalid udp source ip address for this detector. Must be "
|
||||||
"same as hardware detector ip address %s in 1G readout "
|
"same as hardware detector ip address %s in 1G readout "
|
||||||
"mode \n",
|
"mode \n",
|
||||||
|
@ -234,8 +234,7 @@ int ClientInterface::decodeFunction(Interface &socket) {
|
|||||||
socket.Receive(fnum);
|
socket.Receive(fnum);
|
||||||
socket.setFnum(fnum);
|
socket.setFnum(fnum);
|
||||||
if (fnum <= NUM_DET_FUNCTIONS || fnum >= NUM_REC_FUNCTIONS) {
|
if (fnum <= NUM_DET_FUNCTIONS || fnum >= NUM_REC_FUNCTIONS) {
|
||||||
throw RuntimeError("Unrecognized Function enum " +
|
throw RuntimeError(UNRECOGNIZED_FNUM_ENUM + std::to_string(fnum));
|
||||||
std::to_string(fnum) + "\n");
|
|
||||||
} else {
|
} else {
|
||||||
LOG(logDEBUG1) << "calling function fnum: " << fnum << " ("
|
LOG(logDEBUG1) << "calling function fnum: " << fnum << " ("
|
||||||
<< getFunctionNameFromEnum((enum detFuncs)fnum) << ")";
|
<< getFunctionNameFromEnum((enum detFuncs)fnum) << ")";
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
*@short functions indices to call on server (detector/receiver)
|
*@short functions indices to call on server (detector/receiver)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define UNRECOGNIZED_FNUM_ENUM "Unrecognized Function enum"
|
||||||
|
|
||||||
enum detFuncs {
|
enum detFuncs {
|
||||||
F_EXEC_COMMAND = 0,
|
F_EXEC_COMMAND = 0,
|
||||||
F_GET_DETECTOR_TYPE,
|
F_GET_DETECTOR_TYPE,
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "sls/logger.h"
|
#include "sls/logger.h"
|
||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/sls_detector_defs.h"
|
||||||
#include "sls/sls_detector_exceptions.h"
|
#include "sls/sls_detector_exceptions.h"
|
||||||
|
#include "sls/sls_detector_funcs.h"
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -76,9 +77,7 @@ void ClientSocket::readReply(int &ret, void *retval, size_t retval_size) {
|
|||||||
try {
|
try {
|
||||||
Receive(&ret, sizeof(ret));
|
Receive(&ret, sizeof(ret));
|
||||||
if (ret == slsDetectorDefs::FAIL) {
|
if (ret == slsDetectorDefs::FAIL) {
|
||||||
char mess[MAX_STR_LENGTH]{};
|
std::string mess = readErrorMessage();
|
||||||
// get error message
|
|
||||||
Receive(mess, sizeof(mess));
|
|
||||||
// Do we need to know hostname here?
|
// Do we need to know hostname here?
|
||||||
// In that case save it???
|
// In that case save it???
|
||||||
if (socketType == "Receiver") {
|
if (socketType == "Receiver") {
|
||||||
@ -107,6 +106,9 @@ 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');
|
std::string error_msg(MAX_STR_LENGTH, '\0');
|
||||||
Receive(&error_msg[0], error_msg.size());
|
Receive(&error_msg[0], error_msg.size());
|
||||||
|
if (error_msg.find(UNRECOGNIZED_FNUM_ENUM) != std::string::npos) {
|
||||||
|
error_msg.insert(0, "Software version mismatch. ");
|
||||||
|
}
|
||||||
return error_msg;
|
return error_msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user