mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 18:10:40 +02:00
WIP
This commit is contained in:
parent
738f341265
commit
55f8497eac
@ -52,12 +52,11 @@ int Server_VerifyLock();
|
||||
* Server sends result to client (also set ret to force_update if different clients)
|
||||
* @param fileDes file descriptor for the socket
|
||||
* @param itype 32 or 64 or others to determine to swap data from big endian to little endian
|
||||
* @param update 1 if one must update if different clients, else 0
|
||||
* @param retval pointer to result
|
||||
* @param retvalSize size of result
|
||||
* @returns result of operation
|
||||
*/
|
||||
int Server_SendResult(int fileDes, intType itype, int update, void* retval, int retvalSize);
|
||||
int Server_SendResult(int fileDes, intType itype, void* retval, int retvalSize);
|
||||
|
||||
/**
|
||||
* Convert mac address from integer to char array
|
||||
|
@ -216,4 +216,5 @@ int get_timing_source(int);
|
||||
int set_timing_source(int);
|
||||
int get_num_channels(int);
|
||||
int update_rate_correction(int);
|
||||
int get_receiver_parameters(int);
|
||||
|
||||
|
@ -577,7 +577,7 @@ int Server_VerifyLock() {
|
||||
}
|
||||
|
||||
|
||||
int Server_SendResult(int fileDes, intType itype, int update, void* retval, int retvalSize) {
|
||||
int Server_SendResult(int fileDes, intType itype, void* retval, int retvalSize) {
|
||||
|
||||
// send success of operation
|
||||
int ret1 = ret;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -541,7 +541,7 @@ int Module::setDetectorType(detectorType const type) {
|
||||
auto arg = static_cast<int>(shm()->myDetectorType);
|
||||
retval = GENERIC;
|
||||
LOG(logDEBUG1) << "Sending detector type to Receiver: " << arg;
|
||||
sendToReceiver(F_GET_RECEIVER_TYPE, arg, retval);
|
||||
sendToReceiver(F_SET_RECEIVER_TYPE, arg, retval);
|
||||
LOG(logDEBUG1) << "Receiver Type: " << retval;
|
||||
}
|
||||
return retval;
|
||||
@ -1609,11 +1609,47 @@ std::string Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
|
||||
// to use rx_hostname if empty and also update client zmqip
|
||||
updateReceiverStreamingIP();
|
||||
|
||||
test();
|
||||
}
|
||||
|
||||
return std::string(shm()->rxHostname);
|
||||
}
|
||||
|
||||
void Module::test() {
|
||||
int n = 0;
|
||||
rxParameters retval;
|
||||
|
||||
retval.detType = shm()->myDetectorType;
|
||||
n += sizeof(retval.detType);
|
||||
|
||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||
client.sendCommandThenRead(F_GET_RECEIVER_PARAMETERS, nullptr, 0, nullptr, 0);
|
||||
|
||||
// frames
|
||||
n += client.Receive(&retval.nFrames, sizeof(retval.nFrames));
|
||||
// triggers
|
||||
n += client.Receive(&retval.nTriggers, sizeof(retval.nTriggers));
|
||||
// timing mode
|
||||
n += client.Receive(&retval.timMode, sizeof(retval.timMode));
|
||||
// exptime
|
||||
n += client.Receive(&retval.expTimeNs, sizeof(retval.expTimeNs));
|
||||
// period
|
||||
n += client.Receive(&retval.periodNs, sizeof(retval.periodNs));
|
||||
|
||||
LOG(logINFO) << "n:" << n << " retvalsize:" << sizeof(retval);
|
||||
if (n != sizeof(retval)) {
|
||||
throw RuntimeError("Could not get parameters from detector to configure receiver");
|
||||
}
|
||||
|
||||
LOG(logINFO) << "detType:" << retval.detType;
|
||||
LOG(logINFO) << "nFrames:" << retval.nFrames;
|
||||
LOG(logINFO) << "nTriggers:" << retval.nTriggers;
|
||||
LOG(logINFO) << "timMode:" << retval.timMode;
|
||||
LOG(logINFO) << "expTimeNs:" << retval.expTimeNs;
|
||||
LOG(logINFO) << "periodNs:" << retval.periodNs;
|
||||
}
|
||||
|
||||
std::string Module::getReceiverHostname() const {
|
||||
return std::string(shm()->rxHostname);
|
||||
}
|
||||
|
@ -651,6 +651,7 @@ class Module : public virtual slsDetectorDefs {
|
||||
*/
|
||||
std::string setReceiverHostname(const std::string &receiver);
|
||||
|
||||
void test();
|
||||
/**
|
||||
* Returns the receiver IP address\sa sharedSlsDetector
|
||||
* @returns the receiver IP address
|
||||
|
@ -115,7 +115,7 @@ int ClientInterface::functionTable(){
|
||||
flist[F_GET_LAST_RECEIVER_CLIENT_IP] = &ClientInterface::get_last_client_ip;
|
||||
flist[F_SET_RECEIVER_PORT] = &ClientInterface::set_port;
|
||||
flist[F_GET_RECEIVER_VERSION] = &ClientInterface::get_version;
|
||||
flist[F_GET_RECEIVER_TYPE] = &ClientInterface::set_detector_type;
|
||||
flist[F_SET_RECEIVER_TYPE] = &ClientInterface::set_detector_type;
|
||||
flist[F_SEND_RECEIVER_DETHOSTNAME] = &ClientInterface::set_detector_hostname;
|
||||
flist[F_RECEIVER_SET_ROI] = &ClientInterface::set_roi;
|
||||
flist[F_RECEIVER_SET_NUM_FRAMES] = &ClientInterface::set_num_frames;
|
||||
|
@ -460,6 +460,19 @@ class slsDetectorDefs {
|
||||
TIMING_EXTERNAL
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
/**
|
||||
* structure to udpate receiver
|
||||
*/
|
||||
struct rxParameters {
|
||||
enum detectorType detType{GENERIC};
|
||||
uint64_t nFrames{0};
|
||||
uint64_t nTriggers{0};
|
||||
enum timingMode timMode{AUTO_TIMING};
|
||||
uint64_t expTimeNs{0};
|
||||
uint64_t periodNs{0};
|
||||
}__attribute__((packed));
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
protected:
|
||||
|
@ -197,6 +197,7 @@ enum detFuncs{
|
||||
F_SET_TIMING_SOURCE,
|
||||
F_GET_NUM_CHANNELS,
|
||||
F_UPDATE_RATE_CORRECTION,
|
||||
F_GET_RECEIVER_PARAMETERS,
|
||||
|
||||
NUM_DET_FUNCTIONS,
|
||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this (detector server should not compile anyway) */
|
||||
@ -207,7 +208,7 @@ enum detFuncs{
|
||||
F_GET_LAST_RECEIVER_CLIENT_IP,
|
||||
F_SET_RECEIVER_PORT,
|
||||
F_GET_RECEIVER_VERSION,
|
||||
F_GET_RECEIVER_TYPE,
|
||||
F_SET_RECEIVER_TYPE,
|
||||
F_SEND_RECEIVER_DETHOSTNAME,
|
||||
F_RECEIVER_SET_ROI,
|
||||
F_RECEIVER_SET_NUM_FRAMES,
|
||||
@ -293,6 +294,7 @@ enum detFuncs{
|
||||
F_SET_ADDITIONAL_JSON_PARAMETER,
|
||||
F_GET_ADDITIONAL_JSON_PARAMETER,
|
||||
F_GET_RECEIVER_PROGRESS,
|
||||
F_SETUP_RECEIVER,
|
||||
|
||||
NUM_REC_FUNCTIONS
|
||||
};
|
||||
@ -487,6 +489,7 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_SET_TIMING_SOURCE: return "F_SET_TIMING_SOURCE";
|
||||
case F_GET_NUM_CHANNELS: return "F_GET_NUM_CHANNELS";
|
||||
case F_UPDATE_RATE_CORRECTION: return "F_UPDATE_RATE_CORRECTION";
|
||||
case F_GET_RECEIVER_PARAMETERS: return "F_GET_RECEIVER_PARAMETERS";
|
||||
|
||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||
@ -497,7 +500,8 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_GET_LAST_RECEIVER_CLIENT_IP: return "F_GET_LAST_RECEIVER_CLIENT_IP";
|
||||
case F_SET_RECEIVER_PORT: return "F_SET_RECEIVER_PORT";
|
||||
case F_GET_RECEIVER_VERSION: return "F_GET_RECEIVER_VERSION";
|
||||
case F_GET_RECEIVER_TYPE: return "F_GET_RECEIVER_TYPE";
|
||||
case F_SETUP_RECEIVER: return "F_SETUP_RECEIVER";
|
||||
case F_SET_RECEIVER_TYPE: return "F_SET_RECEIVER_TYPE";
|
||||
case F_SEND_RECEIVER_DETHOSTNAME: return "F_SEND_RECEIVER_DETHOSTNAME";
|
||||
case F_RECEIVER_SET_ROI: return "F_RECEIVER_SET_ROI";
|
||||
case F_RECEIVER_SET_NUM_FRAMES: return "F_RECEIVER_SET_NUM_FRAMES";
|
||||
|
Loading…
x
Reference in New Issue
Block a user