MagAO-X Uniblitz DSS Shutter interface. More...
#include <dssShutter.hpp>

Public Member Functions | |
| dssShutter () | |
| Default c'tor. | |
| void | setupConfig (mx::app::appConfigurator &config) |
| Setup the configuration system. | |
| void | loadConfig (mx::app::appConfigurator &config) |
| load the configuration system results | |
| int | appStartup () |
| Startup function. | |
| int | appLogic () |
| application logic | |
| int | appShutdown () |
| applogic shutdown | |
| int | onPowerOff () |
| Actions on power off. | |
| int | whilePowerOff () |
| Actions while powered off. | |
| int | setShutterState (int sh) |
| Change shutter state. | |
| int | open () |
| Open the shutter. | |
| int | shut () |
| Shut the shutter. | |
Protected Attributes | |
| int | m_powerState {-1} |
| The current power state, -1 is unknown, 0 is off, 1 is on. | |
| int | m_sensorState {-1} |
| The current sensor state, -1 is unknown, 0 is shut, 1 is open. | |
| int | m_triggerState {-1} |
| The current trigger state. -1 is unknown, 0 is low, 1 is high. | |
Configurable Parameters | |
| std::string | m_powerDevice |
| The device controlling this shutter's power. | |
| std::string | m_powerChannel |
| The channel controlling this shutter's power. | |
| std::string | m_dioDevice |
| The device controlling this shutter's digital I/O. | |
| std::string | m_sensorChannel |
| The channel reading this shutter's sensor. | |
| std::string | m_triggerChannel |
| The channel sending this shutter's trigger. | |
| unsigned | m_shutterWait {100} |
| The time to pause between checks of the sensor state during open/shut [msec]. Default is 100. | |
| unsigned | m_shutterTimeout {2000} |
| Total time to wait for sensor to change state before timing out [msec]. Default is 2000. | |
Private Member Functions | |
| derivedT & | derived () |
| Access the derived class. | |
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. | |
| bool | m_openThreadInit {true} |
| Initialization flag for the open thread. | |
| pid_t | m_openThreadID {0} |
| Open thread PID. | |
| pcf::IndiProperty | m_openThreadProp |
| The property to hold the open thread details. | |
| std::thread | m_openThread |
| The opening thread. | |
| bool | m_doShut {false} |
| Flag telling the shut thread that it should actually shut the shutter, not just go back to sleep. | |
| bool | m_shutThreadInit {true} |
| Initialization flag for the shut thread. | |
| pid_t | m_shutThreadID {0} |
| Shut thread PID. | |
| pcf::IndiProperty | m_shutThreadProp |
| The property to hold the shut thread details. | |
| std::thread | m_shutThread |
| The shutting thread. | |
| static void | openThreadStart (dssShutter *d) |
| Open thread starter function. | |
| static void | shutThreadStart (dssShutter *d) |
| Shut thread starter function. | |
| void | openThreadExec () |
| Open thread function. | |
| void | shutThreadExec () |
| Shut thread function. | |
INDI | |
| pcf::IndiProperty | m_indiP_powerChannel |
| Property used to monitor the shutter's power state. | |
| pcf::IndiProperty | m_indiP_sensorChannel |
| Property used to monitor the shutter's hall sensor. | |
| pcf::IndiProperty | m_indiP_triggerChannel |
| Property used to monitor and set the shutter's trigger. | |
| int | setCallBack_powerChannel (const pcf::IndiProperty &ipRecv) |
| The callback called by the static version, to actually process the new request. | |
| int | setCallBack_sensorChannel (const pcf::IndiProperty &ipRecv) |
| The callback called by the static version, to actually process the new request. | |
| int | setCallBack_triggerChannel (const pcf::IndiProperty &ipRecv) |
| The callback called by the static version, to actually process the new request. | |
| static int | st_setCallBack_powerChannel (void *app, const pcf::IndiProperty &ipRecv) |
| The static callback function to be registered for shutter power channel changes. | |
| static int | st_setCallBack_sensorChannel (void *app, const pcf::IndiProperty &ipRecv) |
| The static callback function to be registered for shutter sensor channel changes. | |
| static int | st_setCallBack_triggerChannel (void *app, const pcf::IndiProperty &ipRecv) |
| The static callback function to be registered for shutter trigger channel changes. | |
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.
References MagAOX::app::sigUsr1Handler().
|
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.
References MagAOX::app::dev::dssShutter< derivedT >::openThreadExec().
| 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.
References MagAOX::app::ipRecv.
| 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.
References MagAOX::app::ipRecv.
| 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.
References MagAOX::app::ipRecv.
| 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.
References MagAOX::app::dev::dssShutter< derivedT >::shutThreadExec().
|
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.
References MagAOX::app::ipRecv.
|
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.
References MagAOX::app::ipRecv.
|
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.
References MagAOX::app::ipRecv.
| 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.