mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +02:00

- removed getClientServerAPIVersion in server (not used) - removed rxr side (clientversion compatibility check), removed enum as well as it is now done on the client side. - versionAPI.h - GITBRANCH changed to RELEASE - dates for all API changed to "sem_version date". Scripts to compile servers modified for this. Empty "branch" name will end up with developer for sem_version. - Version class with constructor taking in the long version (APILIB date). Other member functions including concise(to get sem_version for new releases and date for old releases), - bypassing initial tests, also now bypasses the client-rxr compatibility check (at rx_hostname command) - previously, compatibility between client-det was ensuring both had the same detector API (eg. same APIJUNGFRAU) - Now, compatibility only checks APILIB (client side) and detector API(eg. APIJUNGFRAU) (detector side) have same major version. It only does backward compatibility test. Rest is upto user to ensure. - If server is from an older release, it will compare dates like previous implementation (APIJUNGFRAU from both client and det) - - previously, compatibility between client-rxr was ensuring both had the same APIRECEIVER - Now, compatibility only checks APILIB (client side) and APIRECEIVER (rxr side) have same major version. It only does backward compatibility test. Rest is upto user to ensure. - If rxr is from an older release, it will compare dates like previous implementation (APIRECEIVER from both client and rxr) - removed APIGUI, evalVersionVariables.sh, genVersionHeader.sh (not needed or not used) - clientVersion, rxrversion and detectorserverversion all return strings and not integers (in hex) anymore. Depending if it has semantic versioning, it will print that or the date if it is too old. - fixed in python (strings for versions) - check_version function in detector server changed to "initial checks" as it only checks server-firmware compatibility and initial server checks. Client compatibilities are moved to client side. - --version gives sem_version and date? Is date needed as well. The clientversion, detserverversion and rxrversion API gives only sem_version (no date) - - formatting
86 lines
2.4 KiB
C++
86 lines
2.4 KiB
C++
// SPDX-License-Identifier: LGPL-3.0-or-other
|
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
|
|
/*
|
|
This file is used to generate the command line binaries
|
|
(sls_detector_get/put/acquire/help). By defines in CMake
|
|
we get the different files.
|
|
|
|
*/
|
|
#include "sls/Detector.h"
|
|
|
|
#include "CmdParser.h"
|
|
#include "CmdProxy.h"
|
|
#include "sls/sls_detector_defs.h"
|
|
#include "sls/versionAPI.h"
|
|
#include <cstring> //strcmp
|
|
#include <iostream>
|
|
int main(int argc, char *argv[]) {
|
|
|
|
// To genereate sepereate binaries for put, get, acquire and help
|
|
#ifdef PUT
|
|
int action = slsDetectorDefs::PUT_ACTION;
|
|
#endif
|
|
|
|
#ifdef GET
|
|
int action = slsDetectorDefs::GET_ACTION;
|
|
#endif
|
|
|
|
#ifdef READOUT
|
|
int action = slsDetectorDefs::READOUT_ACTION;
|
|
#endif
|
|
|
|
#ifdef HELP
|
|
int action = slsDetectorDefs::HELP_ACTION;
|
|
#endif
|
|
|
|
// Check for --version in the arguments
|
|
for (int i = 1; i < argc; ++i) {
|
|
if (!(strcmp(argv[i], "--version")) || !(strcmp(argv[i], "-v"))) {
|
|
std::cout << argv[0] << " " << APILIB << std::endl;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
sls::CmdParser parser;
|
|
parser.Parse(argc, argv);
|
|
|
|
// If we called sls_detector_acquire, add the acquire command
|
|
if (action == slsDetectorDefs::READOUT_ACTION)
|
|
parser.setCommand("acquire");
|
|
|
|
if (parser.isHelp())
|
|
action = slsDetectorDefs::HELP_ACTION;
|
|
else {
|
|
|
|
// Free shared memory should work also without a detector
|
|
// if we have an option for verify in the detector constructor
|
|
// we could avoid this but clutter the code
|
|
if (parser.command() == "free") {
|
|
if (parser.detector_id() != -1)
|
|
std::cout << "Cannot free shared memory of sub-detector\n";
|
|
else
|
|
sls::freeSharedMemory(parser.multi_id());
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
// prevent mem size check
|
|
if (parser.command() == "config" && action == slsDetectorDefs::PUT_ACTION) {
|
|
sls::freeSharedMemory(parser.multi_id());
|
|
}
|
|
|
|
try {
|
|
std::unique_ptr<sls::Detector> det{nullptr};
|
|
if (action != slsDetectorDefs::HELP_ACTION) {
|
|
det = sls::make_unique<sls::Detector>(parser.multi_id());
|
|
}
|
|
sls::CmdProxy proxy(det.get());
|
|
proxy.Call(parser.command(), parser.arguments(), parser.detector_id(),
|
|
action, std::cout, parser.receiver_id());
|
|
} catch (const sls::RuntimeError &e) {
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
exit(EXIT_SUCCESS);
|
|
} |