Loading Common/Libraries/IRALibrary/include/ReceiverControl.h +1 −0 Original line number Diff line number Diff line Loading @@ -1010,6 +1010,7 @@ private: pthread_mutex_t m_lna_mutex; pthread_mutex_t m_dewar_mutex; pthread_mutex_t m_switch_mutex; pthread_mutex_t m_request_mutex; }; } Loading Common/Libraries/IRALibrary/src/ReceiverControl.cpp +23 −10 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ ReceiverControl::ReceiverControl( m_lna_board_ptr(NULL), m_switch_board_ptr(NULL) { pthread_mutex_init(&m_request_mutex, NULL); openConnection(); } Loading @@ -63,6 +64,10 @@ ReceiverControl::~ReceiverControl() if(m_switch_board_ptr != NULL) delete m_switch_board_ptr; pthread_mutex_destroy(&m_request_mutex); pthread_mutex_destroy(&m_lna_mutex); pthread_mutex_destroy(&m_dewar_mutex); pthread_mutex_destroy(&m_switch_mutex); } Loading Loading @@ -1097,15 +1102,16 @@ void ReceiverControl::openConnection(void) throw (ReceiverControlEx) void ReceiverControl::closeConnection(void) { if(m_dewar_board_ptr != NULL) { m_dewar_board_ptr->closeConnection(); pthread_mutex_destroy(&m_dewar_mutex); } if(m_lna_board_ptr != NULL) { m_lna_board_ptr->closeConnection(); pthread_mutex_destroy(&m_lna_mutex); } if(m_switch_board_ptr != NULL) { m_switch_board_ptr->closeConnection(); pthread_mutex_destroy(&m_switch_mutex); } } Loading Loading @@ -1799,6 +1805,7 @@ void ReceiverControl::setSkyPath( std::vector<BYTE> ReceiverControl::makeRequest(MicroControllerBoard *board_ptr, BYTE command, size_t len, ...) throw (MicroControllerBoardEx) { pthread_mutex_lock(&m_request_mutex); va_list parameters; // A place to store the list of arguments va_start(parameters, static_cast<BYTE>(len)); // Initializing arguments to store all values after len std::vector<BYTE> vparams; Loading @@ -1807,11 +1814,17 @@ std::vector<BYTE> ReceiverControl::makeRequest(MicroControllerBoard *board_ptr, vparams.push_back(static_cast<BYTE>(va_arg(parameters, int))); va_end(parameters); // Clean up the list try { m_reliable_comm ? board_ptr->send(command, vparams) \ : board_ptr->send(command | MCB_CMD_TYPE_NOCHECKSUM, vparams); vparams.clear(); vparams = board_ptr->receive(); } catch(MicroControllerBoardEx& ex) { pthread_mutex_unlock(&m_request_mutex); throw; } pthread_mutex_unlock(&m_request_mutex); return vparams; // Return the vector of parameters } Loading Loading
Common/Libraries/IRALibrary/include/ReceiverControl.h +1 −0 Original line number Diff line number Diff line Loading @@ -1010,6 +1010,7 @@ private: pthread_mutex_t m_lna_mutex; pthread_mutex_t m_dewar_mutex; pthread_mutex_t m_switch_mutex; pthread_mutex_t m_request_mutex; }; } Loading
Common/Libraries/IRALibrary/src/ReceiverControl.cpp +23 −10 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ ReceiverControl::ReceiverControl( m_lna_board_ptr(NULL), m_switch_board_ptr(NULL) { pthread_mutex_init(&m_request_mutex, NULL); openConnection(); } Loading @@ -63,6 +64,10 @@ ReceiverControl::~ReceiverControl() if(m_switch_board_ptr != NULL) delete m_switch_board_ptr; pthread_mutex_destroy(&m_request_mutex); pthread_mutex_destroy(&m_lna_mutex); pthread_mutex_destroy(&m_dewar_mutex); pthread_mutex_destroy(&m_switch_mutex); } Loading Loading @@ -1097,15 +1102,16 @@ void ReceiverControl::openConnection(void) throw (ReceiverControlEx) void ReceiverControl::closeConnection(void) { if(m_dewar_board_ptr != NULL) { m_dewar_board_ptr->closeConnection(); pthread_mutex_destroy(&m_dewar_mutex); } if(m_lna_board_ptr != NULL) { m_lna_board_ptr->closeConnection(); pthread_mutex_destroy(&m_lna_mutex); } if(m_switch_board_ptr != NULL) { m_switch_board_ptr->closeConnection(); pthread_mutex_destroy(&m_switch_mutex); } } Loading Loading @@ -1799,6 +1805,7 @@ void ReceiverControl::setSkyPath( std::vector<BYTE> ReceiverControl::makeRequest(MicroControllerBoard *board_ptr, BYTE command, size_t len, ...) throw (MicroControllerBoardEx) { pthread_mutex_lock(&m_request_mutex); va_list parameters; // A place to store the list of arguments va_start(parameters, static_cast<BYTE>(len)); // Initializing arguments to store all values after len std::vector<BYTE> vparams; Loading @@ -1807,11 +1814,17 @@ std::vector<BYTE> ReceiverControl::makeRequest(MicroControllerBoard *board_ptr, vparams.push_back(static_cast<BYTE>(va_arg(parameters, int))); va_end(parameters); // Clean up the list try { m_reliable_comm ? board_ptr->send(command, vparams) \ : board_ptr->send(command | MCB_CMD_TYPE_NOCHECKSUM, vparams); vparams.clear(); vparams = board_ptr->receive(); } catch(MicroControllerBoardEx& ex) { pthread_mutex_unlock(&m_request_mutex); throw; } pthread_mutex_unlock(&m_request_mutex); return vparams; // Return the vector of parameters } Loading