mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-08-10 13:30:30 +02:00
implement initial checks
This commit is contained in:
@@ -479,10 +479,17 @@ ProcessedResult DetectorServer<DerivedDetectorServer>::get_run_status(
|
||||
template <typename DerivedDetectorServer>
|
||||
ProcessedResult DetectorServer<DerivedDetectorServer>::initial_checks(
|
||||
ServerInterface &socket) const {
|
||||
bool initial_checks_passed = getDerivedImpl()->initial_checks();
|
||||
auto detectorsetupstatus = getDerivedImpl()->initial_checks();
|
||||
|
||||
return ProcessedResult{
|
||||
static_cast<ReturnCode>(socket.sendResult(initial_checks_passed))};
|
||||
const bool setup_successful = detectorsetupstatus.successful_setup;
|
||||
|
||||
if (!setup_successful) {
|
||||
return return_fail("Initial checks failed: " +
|
||||
detectorsetupstatus.error_message);
|
||||
} else {
|
||||
return ProcessedResult{
|
||||
static_cast<ReturnCode>(socket.sendResult(setup_successful))};
|
||||
}
|
||||
}
|
||||
|
||||
template <typename DerivedDetectorServer>
|
||||
|
||||
@@ -16,6 +16,14 @@ struct UDPInfo {
|
||||
uint32_t dstip{};
|
||||
};
|
||||
|
||||
/// @brief struct to store detector setup status
|
||||
struct detector_setup_status {
|
||||
/// @brief true if setupDetector() was successful, false otherwise
|
||||
bool successful_setup{false};
|
||||
/// @brief error message if setupDetector() failed, empty otherwise
|
||||
std::string error_message{};
|
||||
};
|
||||
|
||||
/// @brief Shared memory structure for stop server to store run status
|
||||
struct acquisitionStatus {
|
||||
|
||||
@@ -61,6 +69,8 @@ class DetectorServerImpl {
|
||||
|
||||
uint16_t get_destination_udp_port() const;
|
||||
|
||||
detector_setup_status initial_checks() const;
|
||||
|
||||
protected:
|
||||
std::array<UDPInfo, 1>
|
||||
udpDetails{}; // TODO: for now only one receiver per module
|
||||
@@ -78,6 +88,9 @@ class DetectorServerImpl {
|
||||
/// @param srcmac
|
||||
void updateSrcMacAddress(const uint64_t srcmac);
|
||||
|
||||
/// @brief true if setupDetector() was successful, false otherwise
|
||||
detector_setup_status detectorSetupStatus{};
|
||||
|
||||
private:
|
||||
/// @brief creates and maps shared memory
|
||||
void createSharedMemory();
|
||||
|
||||
Reference in New Issue
Block a user