diff --git a/src/libCom/CharDeviceCom.h b/src/libCom/CharDeviceCom.h index 5632c370f0d51faaf7e3174e2f44ebf1900348bd..5ddf9077b9e5d9f73304c86aab6c060902ed1d3d 100644 --- a/src/libCom/CharDeviceCom.h +++ b/src/libCom/CharDeviceCom.h @@ -40,6 +40,7 @@ class CharDeviceCom : public ICom { * * \param buf Data to be sent * \param length Number of characters in `buf` that should be sent + * \param critical Interlock flag, true if interlock is monitoring the command */ virtual void send(char* buf, size_t length, bool critical = false); @@ -48,6 +49,7 @@ class CharDeviceCom : public ICom { * Throw `std::runtime_error` on error. * * \param buf Data to be sent + * \param critical Interlock flag, true if interlock is monitoring the command */ virtual void send(const std::string& buf, bool critical = false); @@ -75,6 +77,7 @@ class CharDeviceCom : public ICom { * Throw `std::runtime_error` on error. * * \param cmd Data to be sent + * \param critical Interlock flag, true if interlock is monitoring the command * * \return Returned data */ @@ -88,6 +91,7 @@ class CharDeviceCom : public ICom { * \param wlength Number of characters in `wbuf` that should be sent * \param rbuf Buffer where to store results * \param rlength Number of characters to receive. + * \param critical Interlock flag, true if interlock is monitoring the command * * \return Number of characters received */ diff --git a/src/libCom/GPIBNICom.h b/src/libCom/GPIBNICom.h index c16e885a02ec00caddea3e679c663d118d0b860b..01b3be4579f4198a9dc58c624466fe520aa46298 100644 --- a/src/libCom/GPIBNICom.h +++ b/src/libCom/GPIBNICom.h @@ -58,6 +58,7 @@ class GPIBNICom : public ICom { * * \param buf Data to be sent * \param length Number of characters in `buf` that should be sent + * \param critical Interlock flag, true if interlock is monitoring the command */ void send(char *buf, size_t length, bool critical); @@ -66,6 +67,7 @@ class GPIBNICom : public ICom { * Throw `std::runtime_error` on error. * * \param buf Data to be sent + * \param critical Interlock flag, true if interlock is monitoring the command */ void send(const std::string &buf, bool critical); @@ -93,6 +95,7 @@ class GPIBNICom : public ICom { * Throw `std::runtime_error` on error. * * \param cmd Data to be sent + * \param critical Interlock flag, true if interlock is monitoring the command * * \return Returned data */ @@ -106,6 +109,7 @@ class GPIBNICom : public ICom { * \param wlength Number of characters in `wbuf` that should be sent * \param rbuf Buffer where to store results * \param rlength Number of characters to receive. + * \param critical Interlock flag, true if interlock is monitoring the command * * \return Number of characters received */ diff --git a/src/libCom/GPIBSerialCom.h b/src/libCom/GPIBSerialCom.h index 967f1dbcd8bdf894e8667eb9c839246690c9e5b4..210a33117a49430f7c3608ea073bcc1a8ebfde9e 100644 --- a/src/libCom/GPIBSerialCom.h +++ b/src/libCom/GPIBSerialCom.h @@ -59,6 +59,7 @@ class GPIBSerialCom : public TextSerialCom { * * \param buf Data to be sent * \param length Number of characters in `buf` that should be sent + * \param critical Interlock flag, true if interlock is monitoring the command */ virtual void send(char* buf, size_t length, bool critical = false); @@ -69,6 +70,7 @@ class GPIBSerialCom : public TextSerialCom { * Throw `std::runtime_error` on error. * * \param buf Data to be sent + * \param critical Interlock flag, true if interlock is monitoring the command */ virtual void send(const std::string& buf, bool critical = false); diff --git a/src/libCom/LXICom.h b/src/libCom/LXICom.h index 7e4448bef61b003bc950d5bf25ea8d61359e814f..a878f3513d9bf40fd9f05bae5c1bb13ce6911415 100644 --- a/src/libCom/LXICom.h +++ b/src/libCom/LXICom.h @@ -55,6 +55,7 @@ class LXICom : public ICom { * * \param buf Data to be sent * \param length Number of characters in `buf` that should be sent + * \param critical Interlock flag, true if interlock is monitoring the command */ virtual void send(char* buf, size_t length, bool critical); @@ -63,6 +64,7 @@ class LXICom : public ICom { * Throw `std::runtime_error` on error. * * \param buf Data to be sent + * \param critical Interlock flag, true if interlock is monitoring the command */ virtual void send(const std::string& buf, bool critical); @@ -90,6 +92,7 @@ class LXICom : public ICom { * Throw `std::runtime_error` on error. * * \param cmd Data to be sent + * \param critical Interlock flag, true if interlock is monitoring the command * * \return Returned data */ @@ -103,6 +106,7 @@ class LXICom : public ICom { * \param wlength Number of characters in `wbuf` that should be sent * \param rbuf Buffer where to store results * \param rlength Number of characters to receive. + * \param critical Interlock flag, true if interlock is monitoring the command * * \return Number of characters received */ diff --git a/src/libCom/SerialCom.h b/src/libCom/SerialCom.h index 2e1e747eeea5ca04fb4bca0a08a091b983537b2f..8c7780eb97a80be3fb0251af1f6d91990a93c7e1 100644 --- a/src/libCom/SerialCom.h +++ b/src/libCom/SerialCom.h @@ -123,6 +123,7 @@ class SerialCom : public ICom { * * \param buf Data to be sent * \param length Number of characters in `buf` that should be sent + * \param critical Interlock flag, true if interlock is monitoring the command */ virtual void send(char* buf, size_t length, bool critical = false); @@ -131,6 +132,7 @@ class SerialCom : public ICom { * Throw `std::runtime_error` on error. * * \param buf Data to be sent + * \param critical Interlock flag, true if interlock is monitoring the command */ virtual void send(const std::string& buf, bool critical = false); @@ -164,6 +166,7 @@ class SerialCom : public ICom { * Throw `std::runtime_error` on error. * * \param cmd Data to be sent + * \param critical Interlock flag, true if interlock is monitoring the command * * \return Returned data */ @@ -177,6 +180,7 @@ class SerialCom : public ICom { * \param wlength Number of characters in `wbuf` that should be sent * \param rbuf Buffer where to store results * \param rlength Number of characters to receive. + * \param critical Interlock flag, true if interlock is monitoring the command * * \return Number of characters received */ diff --git a/src/libCom/TextSerialCom.h b/src/libCom/TextSerialCom.h index b4be1ede6346042ba29d0efb76581c9a62ab57aa..958d4842ddf82e9adc56bd798f4af5bb92f27023 100644 --- a/src/libCom/TextSerialCom.h +++ b/src/libCom/TextSerialCom.h @@ -77,6 +77,7 @@ class TextSerialCom : public SerialCom { * * \param buf Data to be sent * \param length Number of characters in `buf` that should be sent + * \param critical Interlock flag, true if interlock is monitoring the command */ virtual void send(char* buf, size_t length, bool critical = false); @@ -85,6 +86,7 @@ class TextSerialCom : public SerialCom { * Throw `std::runtime_error` on error. * * \param buf Data to be sent + * \param critical Interlock flag, true if interlock is monitoring the command */ virtual void send(const std::string& buf, bool critical = false); diff --git a/src/libEquipConf/EquipConf.cpp b/src/libEquipConf/EquipConf.cpp index f231fe3af9edaf52d4d0781dca7494c4159f21a2..214ca0cb972ddcf458706510530207ec0f630564 100644 --- a/src/libEquipConf/EquipConf.cpp +++ b/src/libEquipConf/EquipConf.cpp @@ -341,16 +341,19 @@ std::shared_ptr<ICom> EquipConf::createCommunication(const json& config) const { std::ifstream filestr; filestr.open(file); // Checks if the parameter sent is an absolute file path and can be opened - if (file.at(0) == '/') - if (filestr) + if (file.at(0) == '/') { + if (filestr) { com->setInterlock(config["interlock-file"]); - else + } else { throw std::runtime_error("Interlock-file parameter is set to \"" + file + "\", but the file does not exist. Please start the interlock application."); - else + } + } else { throw std::runtime_error("Interlock-file parameter is not an absolute path \"" + file + "\". Please update it in the labRemote json configuration file"); + } filestr.close(); - } else + } else { com->setInterlock(""); + } com->init(); return com; diff --git a/src/libPS/SCPIPs.cpp b/src/libPS/SCPIPs.cpp index 5c77b63f3f50a7d863a2aa24acaa4ed12eb60fec..49d853458aef1536817b09ca655afa02127d0b35 100644 --- a/src/libPS/SCPIPs.cpp +++ b/src/libPS/SCPIPs.cpp @@ -2,10 +2,11 @@ #include <algorithm> #include <thread> + #include "Logger.h" #include "ScopeLock.h" #include "StringUtils.h" -#include <stdio.h> + #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> @@ -38,7 +39,7 @@ std::string SCPIPs::identify() { return idn; } -void SCPIPs::turnOn(unsigned channel) { send("OUTPUT ON", channel); } +void SCPIPs::turnOn(unsigned channel) { send("OUTPUT ON", channel, true); } void SCPIPs::turnOff(unsigned channel) { send("OUTPUT OFF", channel); } @@ -62,11 +63,11 @@ void SCPIPs::setChannel(unsigned channel) { } void SCPIPs::setCurrentLevel(double cur, unsigned channel) { - send("CURRENT " + std::to_string(cur), channel); + send("CURRENT " + std::to_string(cur), channel, true); } double SCPIPs::getCurrentLevel(unsigned channel) { - return std::stod(sendreceive("CURRENT?", channel)); + return std::stod(sendreceive("CURRENT?", channel, true)); } void SCPIPs::setCurrentProtect(double maxcur, unsigned channel) {