MagAO-X Uniblitz DSS Shutter interface. More...
#include <dssShutter.hpp>
Public Member Functions | |
dssShutter () | |
Default c'tor. More... | |
void | setupConfig (mx::app::appConfigurator &config) |
Setup the configuration system. More... | |
void | loadConfig (mx::app::appConfigurator &config) |
load the configuration system results More... | |
int | appStartup () |
Startup function. More... | |
int | appLogic () |
application logic More... | |
int | appShutdown () |
applogic shutdown More... | |
int | onPowerOff () |
Actions on power off. More... | |
int | whilePowerOff () |
Actions while powered off. More... | |
int | setShutterState (int sh) |
Change shutter state. More... | |
int | open () |
Open the shutter. More... | |
int | shut () |
Shut the shutter. More... | |
Protected Attributes | |
int | m_powerState {-1} |
The current power state, -1 is unknown, 0 is off, 1 is on. More... | |
int | m_sensorState {-1} |
The current sensor state, -1 is unknown, 0 is shut, 1 is open. More... | |
int | m_triggerState {-1} |
The current trigger state. -1 is unknown, 0 is low, 1 is high. More... | |
Configurable Parameters | |
std::string | m_powerDevice |
The device controlling this shutter's power. More... | |
std::string | m_powerChannel |
The channel controlling this shutter's power. More... | |
std::string | m_dioDevice |
The device controlling this shutter's digital I/O. More... | |
std::string | m_sensorChannel |
The channel reading this shutter's sensor. More... | |
std::string | m_triggerChannel |
The channel sending this shutter's trigger. More... | |
unsigned | m_shutterWait {100} |
The time to pause between checks of the sensor state during open/shut [msec]. Default is 100. More... | |
unsigned | m_shutterTimeout {2000} |
Total time to wait for sensor to change state before timing out [msec]. Default is 2000. More... | |
Private Member Functions | |
derivedT & | derived () |
Access the derived class. More... | |
Open/Shut Threads | |
Separate threads are used since we need INDI updates while trying to open/shut. These threads sleep(1), unless interrupted by a signal. When signaled, they check for the m_doOpen or m_doShut flag, and if true the appropriate open() or shut() function is called. If not, they go back to sleep unless m_shutdown is true. | |
bool | m_doOpen {false} |
Flag telling the open thread that it should actually open the shutter, not just go back to sleep. More... | |
bool | m_openThreadInit {true} |
Initialization flag for the open thread. More... | |
pid_t | m_openThreadID {0} |
Open thread PID. More... | |
pcf::IndiProperty | m_openThreadProp |
The property to hold the open thread details. More... | |
std::thread | m_openThread |
The opening thread. More... | |
bool | m_doShut {false} |
Flag telling the shut thread that it should actually shut the shutter, not just go back to sleep. More... | |
bool | m_shutThreadInit {true} |
Initialization flag for the shut thread. More... | |
pid_t | m_shutThreadID {0} |
Shut thread PID. More... | |
pcf::IndiProperty | m_shutThreadProp |
The property to hold the shut thread details. More... | |
std::thread | m_shutThread |
The shutting thread. More... | |
static void | openThreadStart (dssShutter *d) |
Open thread starter function. More... | |
static void | shutThreadStart (dssShutter *d) |
Shut thread starter function. More... | |
void | openThreadExec () |
Open thread function. More... | |
void | shutThreadExec () |
Shut thread function. More... | |
INDI | |
pcf::IndiProperty | m_indiP_powerChannel |
Property used to monitor the shutter's power state. More... | |
pcf::IndiProperty | m_indiP_sensorChannel |
Property used to monitor the shutter's hall sensor. More... | |
pcf::IndiProperty | m_indiP_triggerChannel |
Property used to monitor and set the shutter's trigger. More... | |
int | setCallBack_powerChannel (const pcf::IndiProperty &ipRecv) |
The callback called by the static version, to actually process the new request. More... | |
int | setCallBack_sensorChannel (const pcf::IndiProperty &ipRecv) |
The callback called by the static version, to actually process the new request. More... | |
int | setCallBack_triggerChannel (const pcf::IndiProperty &ipRecv) |
The callback called by the static version, to actually process the new request. More... | |
static int | st_setCallBack_powerChannel (void *app, const pcf::IndiProperty &ipRecv) |
The static callback function to be registered for shutter power channel changes. More... | |
static int | st_setCallBack_sensorChannel (void *app, const pcf::IndiProperty &ipRecv) |
The static callback function to be registered for shutter sensor channel changes. More... | |
static int | st_setCallBack_triggerChannel (void *app, const pcf::IndiProperty &ipRecv) |
The static callback function to be registered for shutter trigger channel changes. More... | |
MagAO-X Uniblitz DSS Shutter interface.
This is actually an interface to the digital I/O system, which controls the shutter.
The derived class derivedT
must be a MagAOXApp<true>, and should declare this class a friend like so:
Calls to this class's setupConfig
, loadConfig
, appStartup
, appLogic
, appShutdown
onPowerOff
, whilePowerOff
, functions must be placed in the derived class's functions of the same name.
Definition at line 36 of file dssShutter.hpp.
MagAOX::app::dev::dssShutter< derivedT >::dssShutter |
int MagAOX::app::dev::dssShutter< derivedT >::appLogic |
application logic
This should be called in derivedT::appLogic
as
with appropriate error checking.
Definition at line 403 of file dssShutter.hpp.
int MagAOX::app::dev::dssShutter< derivedT >::appShutdown |
applogic shutdown
This should be called in derivedT::appShutdown
as
with appropriate error checking.
Definition at line 437 of file dssShutter.hpp.
Referenced by MagAOX::app::ocam2KCtrl::appShutdown(), and MagAOX::app::picamCtrl::appShutdown().
int MagAOX::app::dev::dssShutter< derivedT >::appStartup |
Startup function.
This should be called in derivedT::appStartup
as
with appropriate error checking.
Definition at line 335 of file dssShutter.hpp.
|
inlineprivate |
Access the derived class.
Definition at line 292 of file dssShutter.hpp.
void MagAOX::app::dev::dssShutter< derivedT >::loadConfig | ( | mx::app::appConfigurator & | config | ) |
load the configuration system results
This should be called in derivedT::loadConfig
as
with appropriate error checking.
[in] | config | the derived classes configurator |
Definition at line 322 of file dssShutter.hpp.
Referenced by MagAOX::app::ocam2KCtrl::loadConfig(), and MagAOX::app::picamCtrl::loadConfig().
int MagAOX::app::dev::dssShutter< derivedT >::onPowerOff |
Actions on power off.
This should be called in derivedT::appPowerOff
as
with appropriate error checking.
Definition at line 474 of file dssShutter.hpp.
int MagAOX::app::dev::dssShutter< derivedT >::open |
Open the shutter.
Do not lock the mutex before calling this.
Definition at line 513 of file dssShutter.hpp.
|
protected |
Open thread function.
Runs until m_shutdown is true.
Definition at line 646 of file dssShutter.hpp.
Referenced by MagAOX::app::dev::dssShutter< derivedT >::openThreadStart().
|
staticprotected |
Open thread starter function.
[in] | d | pointer to this |
Definition at line 640 of file dssShutter.hpp.
int MagAOX::app::dev::dssShutter< derivedT >::setCallBack_powerChannel | ( | const pcf::IndiProperty & | ipRecv | ) |
The callback called by the static version, to actually process the new request.
[in] | ipRecv | the INDI property sent with the the new property request. |
Definition at line 715 of file dssShutter.hpp.
int MagAOX::app::dev::dssShutter< derivedT >::setCallBack_sensorChannel | ( | const pcf::IndiProperty & | ipRecv | ) |
The callback called by the static version, to actually process the new request.
[in] | ipRecv | the INDI property sent with the the new property request. |
Definition at line 752 of file dssShutter.hpp.
int MagAOX::app::dev::dssShutter< derivedT >::setCallBack_triggerChannel | ( | const pcf::IndiProperty & | ipRecv | ) |
The callback called by the static version, to actually process the new request.
[in] | ipRecv | the INDI property sent with the the new property request. |
Definition at line 789 of file dssShutter.hpp.
int MagAOX::app::dev::dssShutter< derivedT >::setShutterState | ( | int | sh | ) |
Change shutter state.
Sets m_doOpen or m_doShut and signals the appropriate thread.
sh | Desired shutter state. 0 for shut,1 for open |
Definition at line 486 of file dssShutter.hpp.
void MagAOX::app::dev::dssShutter< derivedT >::setupConfig | ( | mx::app::appConfigurator & | config | ) |
Setup the configuration system.
This should be called in derivedT::setupConfig
as
with appropriate error checking.
[out] | config | the derived classes configurator |
Definition at line 304 of file dssShutter.hpp.
Referenced by MagAOX::app::ocam2KCtrl::setupConfig(), and MagAOX::app::picamCtrl::setupConfig().
int MagAOX::app::dev::dssShutter< derivedT >::shut |
Shut the shutter.
Do not lock the mutex before calling this.
Definition at line 575 of file dssShutter.hpp.
|
protected |
Shut thread function.
Runs until m_shutdown is true.
Definition at line 680 of file dssShutter.hpp.
Referenced by MagAOX::app::dev::dssShutter< derivedT >::shutThreadStart().
|
staticprotected |
Shut thread starter function.
[in] | d | pointer to this |
Definition at line 674 of file dssShutter.hpp.
|
static |
The static callback function to be registered for shutter power channel changes.
[in] | app | a pointer to this, will be static_cast-ed to derivedT. |
[in] | ipRecv | the INDI property sent with the the new property request. |
Definition at line 707 of file dssShutter.hpp.
|
static |
The static callback function to be registered for shutter sensor channel changes.
[in] | app | a pointer to this, will be static_cast-ed to derivedT. |
[in] | ipRecv | the INDI property sent with the the new property request. |
Definition at line 744 of file dssShutter.hpp.
|
static |
The static callback function to be registered for shutter trigger channel changes.
[in] | app | a pointer to this, will be static_cast-ed to derivedT. |
[in] | ipRecv | the INDI property sent with the the new property request. |
Definition at line 781 of file dssShutter.hpp.
int MagAOX::app::dev::dssShutter< derivedT >::whilePowerOff |
Actions while powered off.
This should be called in derivedT::whilePowerOff
as
with appropriate error checking.
Definition at line 480 of file dssShutter.hpp.
|
protected |
The device controlling this shutter's digital I/O.
Definition at line 47 of file dssShutter.hpp.
|
protected |
Flag telling the open thread that it should actually open the shutter, not just go back to sleep.
Definition at line 186 of file dssShutter.hpp.
|
protected |
Flag telling the shut thread that it should actually shut the shutter, not just go back to sleep.
Definition at line 204 of file dssShutter.hpp.
|
protected |
Property used to monitor the shutter's power state.
Definition at line 231 of file dssShutter.hpp.
|
protected |
Property used to monitor the shutter's hall sensor.
Definition at line 232 of file dssShutter.hpp.
|
protected |
Property used to monitor and set the shutter's trigger.
Definition at line 233 of file dssShutter.hpp.
|
protected |
The opening thread.
Definition at line 194 of file dssShutter.hpp.
|
protected |
Open thread PID.
Definition at line 190 of file dssShutter.hpp.
|
protected |
Initialization flag for the open thread.
Definition at line 188 of file dssShutter.hpp.
|
protected |
The property to hold the open thread details.
Definition at line 192 of file dssShutter.hpp.
|
protected |
The channel controlling this shutter's power.
Definition at line 45 of file dssShutter.hpp.
|
protected |
The device controlling this shutter's power.
Definition at line 44 of file dssShutter.hpp.
|
protected |
The current power state, -1 is unknown, 0 is off, 1 is on.
Definition at line 56 of file dssShutter.hpp.
|
protected |
The channel reading this shutter's sensor.
Definition at line 48 of file dssShutter.hpp.
|
protected |
The current sensor state, -1 is unknown, 0 is shut, 1 is open.
Definition at line 58 of file dssShutter.hpp.
|
protected |
Total time to wait for sensor to change state before timing out [msec]. Default is 2000.
Definition at line 53 of file dssShutter.hpp.
|
protected |
The time to pause between checks of the sensor state during open/shut [msec]. Default is 100.
Definition at line 51 of file dssShutter.hpp.
|
protected |
The shutting thread.
Definition at line 212 of file dssShutter.hpp.
|
protected |
Shut thread PID.
Definition at line 208 of file dssShutter.hpp.
|
protected |
Initialization flag for the shut thread.
Definition at line 206 of file dssShutter.hpp.
|
protected |
The property to hold the shut thread details.
Definition at line 210 of file dssShutter.hpp.
|
protected |
The channel sending this shutter's trigger.
Definition at line 49 of file dssShutter.hpp.
|
protected |
The current trigger state. -1 is unknown, 0 is low, 1 is high.
Definition at line 60 of file dssShutter.hpp.