10 #define mzmqClient_hpp
16 #include <milkzmqClient.hpp>
18 #include "../../libMagAOX/libMagAOX.hpp"
19 #include "../../magaox_git_version.h"
129 const std::string & file,
155 config.add(
"server.address",
"",
"server.address", argType::Required,
"server",
"address",
false,
"string",
"The server's remote address. Usually localhost if using a tunnel.");
156 config.add(
"server.imagePort",
"",
"server.imagePort", argType::Required,
"server",
"imagePort",
false,
"int",
"The server's port. Usually the port on localhost forwarded to the host.");
158 config.add(
"server.shmimNames",
"",
"server.shmimNames", argType::Required,
"server",
"shmimNames",
false,
"string",
"List of names of the remote shmim streams to get.");
171 config(m_address,
"server.address");
172 config(m_imagePort,
"server.imagePort");
176 std::cerr <<
"m_imagePort = " << m_imagePort <<
"\n";
181 #include <sys/syscall.h>
188 log<software_error>({__FILE__, __LINE__});
197 for(
size_t n=0; n < m_imageThreads.size(); ++n)
199 if( imageThreadStart(n) > 0)
201 log<software_critical>({__FILE__, __LINE__,
"Starting image thread " + m_imageThreads[n].m_imageName});
217 for(
size_t n=0; n < m_imageThreads.size(); ++n)
219 if(pthread_tryjoin_np(m_imageThreads[n].m_thread->native_handle(),0) == 0)
221 log<software_error>({__FILE__, __LINE__,
"image thread " + m_imageThreads[n].m_imageName +
" has exited"});
237 for(
size_t n=0; n < m_imageThreads.size(); ++n)
242 for(
size_t n=0; n < m_imageThreads.size(); ++n)
244 if( m_imageThreads[n].m_thread->joinable())
246 m_imageThreads[n].m_thread->join();
256 struct sigaction act;
260 act.sa_flags = SA_SIGINFO;
265 if( sigaction(SIGSEGV, &act, 0) < 0 )
267 std::string logss =
"Setting handler for SIGSEGV failed. Errno says: ";
268 logss += strerror(errno);
270 log<software_error>({__FILE__, __LINE__, errno, 0, logss});
276 if( sigaction(SIGBUS, &act, 0) < 0 )
278 std::string logss =
"Setting handler for SIGBUS failed. Errno says: ";
279 logss += strerror(errno);
281 log<software_error>({__FILE__, __LINE__, errno, 0,logss});
306 static_cast<void>(signum);
307 static_cast<void>(siginf);
308 static_cast<void>(ucont);
335 const std::string & file,
339 log<software_error>({file.c_str(), (uint32_t) line,
msg});
The base-class for MagAO-X applications.
std::string m_configName
The name of the configuration file (minus .conf).
MagAO-X application to control reading ImageStreamIO streams from a zeroMQ channel.
virtual int appLogic()
Implementation of the FSM for the Siglent SDG.
static mzmqClient * m_selfClient
Static pointer to this (set in constructor). Used for getting out of the static SIGSEGV handler.
virtual void reportNotice(const std::string &msg)
Log status (with LOG_NOTICE level of priority).
virtual int appShutdown()
Do any needed shutdown tasks. Currently nothing in this app.
mzmqClient()
Default c'tor.
virtual void reportWarning(const std::string &msg)
Log a warning.
void handlerSigSegv(int signum, siginfo_t *siginf, void *ucont)
Handles SIGSEGV and SIGBUS. Sets m_restart to true.
virtual void reportInfo(const std::string &msg)
Log status (with LOG_INFO level of priority).
int setSigSegvHandler()
Sets the handler for SIGSEGV and SIGBUS.
~mzmqClient() noexcept
Destructor.
virtual void setupConfig()
Setup the configuration system (called by MagAOXApp::setup())
static void _handlerSigSegv(int signum, siginfo_t *siginf, void *ucont)
The handler called when SIGSEGV or SIGBUS is received, which will be due to ImageStreamIO server rese...
virtual int appStartup()
Startup functions.
virtual void loadConfig()
load the configuration system results (called by MagAOXApp::setup())
std::vector< std::string > m_shMemImNames
virtual void reportError(const std::string &msg, const std::string &file, int line)
Log an error.
constexpr static logPrioT LOG_DEBUG
Used for debugging.
constexpr static logPrioT LOG_INFO
Informational. The info log level is the lowest level recorded during normal operations.
constexpr static logPrioT LOG_WARNING
A condition has occurred which may become an error, but the process continues.
constexpr static logPrioT LOG_NOTICE
A normal but significant condition.