mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
get type from detector
This commit is contained in:
parent
0cb38a9c51
commit
40d0430f2e
@ -106,14 +106,11 @@ int64_t Module::getReceiverSoftwareVersion() const {
|
|||||||
// static function
|
// static function
|
||||||
slsDetectorDefs::detectorType
|
slsDetectorDefs::detectorType
|
||||||
Module::getTypeFromDetector(const std::string &hostname, int cport) {
|
Module::getTypeFromDetector(const std::string &hostname, int cport) {
|
||||||
int fnum = F_GET_DETECTOR_TYPE;
|
|
||||||
int ret = FAIL;
|
|
||||||
detectorType retval = GENERIC;
|
|
||||||
LOG(logDEBUG1) << "Getting detector type ";
|
LOG(logDEBUG1) << "Getting detector type ";
|
||||||
sls::ClientSocket cs("Detector", hostname, cport);
|
sls::ClientSocket socket("Detector", hostname, cport);
|
||||||
cs.Send(reinterpret_cast<char *>(&fnum), sizeof(fnum));
|
socket.Send(F_GET_DETECTOR_TYPE);
|
||||||
cs.Receive(reinterpret_cast<char *>(&ret), sizeof(ret));
|
socket.Receive<int>(); // TODO! Should we look at this OK/FAIL?
|
||||||
cs.Receive(reinterpret_cast<char *>(&retval), sizeof(retval));
|
auto retval = socket.Receive<detectorType>();
|
||||||
LOG(logDEBUG1) << "Detector type is " << retval;
|
LOG(logDEBUG1) << "Detector type is " << retval;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -447,22 +444,17 @@ std::vector<uint64_t> Module::getNumMissingPackets() const {
|
|||||||
// TODO!(Erik) Refactor
|
// TODO!(Erik) Refactor
|
||||||
LOG(logDEBUG1) << "Getting num missing packets";
|
LOG(logDEBUG1) << "Getting num missing packets";
|
||||||
if (shm()->useReceiverFlag) {
|
if (shm()->useReceiverFlag) {
|
||||||
int fnum = F_GET_NUM_MISSING_PACKETS;
|
|
||||||
int ret = FAIL;
|
|
||||||
auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
|
auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
|
||||||
client.Send(&fnum, sizeof(fnum));
|
client.Send(F_GET_NUM_MISSING_PACKETS);
|
||||||
client.Receive(&ret, sizeof(ret));
|
if (client.Receive<int>() == FAIL) {
|
||||||
if (ret == FAIL) {
|
|
||||||
char mess[MAX_STR_LENGTH]{};
|
char mess[MAX_STR_LENGTH]{};
|
||||||
client.Receive(mess, MAX_STR_LENGTH);
|
client.Receive(mess, MAX_STR_LENGTH);
|
||||||
throw RuntimeError("Receiver " + std::to_string(moduleId) +
|
throw RuntimeError("Receiver " + std::to_string(moduleId) +
|
||||||
" returned error: " + std::string(mess));
|
" returned error: " + std::string(mess));
|
||||||
} else {
|
} else {
|
||||||
int nports = 0;
|
auto nports = client.Receive<int>();
|
||||||
client.Receive(&nports, sizeof(nports));
|
|
||||||
std::vector<uint64_t> retval(nports);
|
std::vector<uint64_t> retval(nports);
|
||||||
client.Receive(retval.data(),
|
client.Receive(retval);
|
||||||
sizeof(retval[0]) * retval.size());
|
|
||||||
LOG(logDEBUG1) << "Missing packets of Receiver" << moduleId << ": "
|
LOG(logDEBUG1) << "Missing packets of Receiver" << moduleId << ": "
|
||||||
<< sls::ToString(retval);
|
<< sls::ToString(retval);
|
||||||
return retval;
|
return retval;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user