13#include <unordered_map>
15#include <mx/app/application.hpp>
17#include "../MagAOXApp.hpp"
26#define CAMCTRL_E_NOCONFIGS ( -10 )
52 mx::app::appConfigurator &config
289template <
class derivedT>
374 float m_maxFPS{ std::numeric_limits<float>::max() };
644 const pcf::IndiProperty &
ipRecv
654 const pcf::IndiProperty &
ipRecv );
674 const pcf::IndiProperty &
ipRecv );
694 const pcf::IndiProperty &
ipRecv );
714 const pcf::IndiProperty &
ipRecv );
734 const pcf::IndiProperty &
ipRecv );
754 const pcf::IndiProperty &
ipRecv );
774 const pcf::IndiProperty &
ipRecv );
780 int setFPS( const mx::meta::trueFalseT<true> &t );
786 int setFPS( const mx::meta::trueFalseT<false> &f );
794 const pcf::IndiProperty &
ipRecv );
814 const pcf::IndiProperty &
ipRecv );
822 const pcf::IndiProperty &
ipRecv );
830 const pcf::IndiProperty &
ipRecv );
850 const pcf::IndiProperty &
ipRecv );
858 const pcf::IndiProperty &
ipRecv );
866 const pcf::IndiProperty &
ipRecv );
874 const pcf::IndiProperty &
ipRecv );
882 const pcf::IndiProperty &
ipRecv );
890 const pcf::IndiProperty &
ipRecv );
898 const pcf::IndiProperty &
ipRecv );
918 const pcf::IndiProperty &
ipRecv );
938 const pcf::IndiProperty &
ipRecv );
946 const pcf::IndiProperty &
ipRecv );
954 const pcf::IndiProperty &
ipRecv );
962 const pcf::IndiProperty &
ipRecv );
970 const pcf::IndiProperty &
ipRecv );
978 const pcf::IndiProperty &
ipRecv );
984 int setShutter(
int ss, const mx::meta::trueFalseT<true> &t );
990 int setShutter(
int ss, const mx::meta::trueFalseT<false> &f );
998 const pcf::IndiProperty &
ipRecv );
1046 return *
static_cast<derivedT *
>( this );
1050template <
class derivedT>
1056template <
class derivedT>
1059 if( derivedT::c_stdCamera_tempControl )
1061 config.add(
"camera.startupTemp",
1063 "camera.startupTemp",
1069 "The temperature setpoint to set after a power-on [C]. Default is 20 C." );
1072 if( derivedT::c_stdCamera_readoutSpeed )
1074 config.add(
"camera.defaultReadoutSpeed",
1076 "camera.defaultReadoutSpeed",
1079 "defaultReadoutSpeed",
1082 "The default amplifier and readout speed." );
1085 if( derivedT::c_stdCamera_vShiftSpeed )
1087 config.add(
"camera.defaultVShiftSpeed",
1089 "camera.defaultVShiftSpeed",
1092 "defaultVShiftSpeed",
1095 "The default vertical shift speed." );
1098 if( derivedT::c_stdCamera_emGain )
1100 config.add(
"camera.maxEMGain",
1108 "The maximum EM gain which can be set by the user." );
1111 if( derivedT::c_stdCamera_usesModes )
1113 config.add(
"camera.startupMode",
1115 "camera.startupMode",
1121 "The mode to set upon power on or application startup." );
1124 if( derivedT::c_stdCamera_usesROI )
1126 config.add(
"camera.default_x",
1134 "The default ROI x position." );
1136 config.add(
"camera.default_y",
1144 "The default ROI y position." );
1146 config.add(
"camera.default_w",
1154 "The default ROI width." );
1156 config.add(
"camera.default_h",
1164 "The default ROI height." );
1166 config.add(
"camera.default_bin_x",
1168 "camera.default_bin_x",
1174 "The default ROI x binning." );
1176 config.add(
"camera.default_bin_y",
1178 "camera.default_bin_y",
1184 "The default ROI y binning." );
1190template <
class derivedT>
1193 if( derivedT::c_stdCamera_tempControl )
1195 config( m_startupTemp,
"camera.startupTemp" );
1198 if( derivedT::c_stdCamera_readoutSpeed )
1200 config( m_defaultReadoutSpeed,
"camera.defaultReadoutSpeed" );
1203 if( derivedT::c_stdCamera_vShiftSpeed )
1205 config( m_defaultVShiftSpeed,
"camera.defaultVShiftSpeed" );
1208 if( derivedT::c_stdCamera_emGain )
1210 config( m_maxEMGain,
"camera.maxEMGain" );
1213 if( derivedT::c_stdCamera_usesModes )
1225 config( m_startupMode,
"camera.startupMode" );
1228 if( derivedT::c_stdCamera_usesROI )
1230 config( m_full_x,
"camera.full_x" );
1231 config( m_full_y,
"camera.full_y" );
1232 config( m_full_w,
"camera.full_w" );
1233 config( m_full_h,
"camera.full_h" );
1234 config( m_full_bin_x,
"camera.full_bin_x" );
1235 config( m_full_bin_y,
"camera.full_bin_y" );
1240 { __FILE__, __LINE__,
"full ROI x (camera.full_x) not set" } );
1246 { __FILE__, __LINE__,
"full ROI y (camera.full_y) not set" } );
1252 { __FILE__, __LINE__,
"full ROI w (camera.full_w) not set" } );
1258 { __FILE__, __LINE__,
"full ROI h (camera.full_h) not set" } );
1261 if( m_full_bin_x < 1 )
1264 { __FILE__, __LINE__,
"full ROI bin-x (camera.full_bin_x) not set" } );
1267 if( m_full_bin_y < 1 )
1270 { __FILE__, __LINE__,
"full ROI bin-y (camera.full_bin_y) not set" } );
1273 config( m_default_x,
"camera.default_x" );
1274 config( m_default_y,
"camera.default_y" );
1275 config( m_default_w,
"camera.default_w" );
1276 config( m_default_h,
"camera.default_h" );
1277 config( m_default_bin_x,
"camera.default_bin_x" );
1278 config( m_default_bin_y,
"camera.default_bin_y" );
1281 if( m_default_x == 0 || m_default_y == 0 || m_default_w == 0 || m_default_h == 0 || m_default_bin_x < 1 ||
1282 m_default_bin_y < 1 )
1284 m_default_x = m_full_x;
1285 m_default_y = m_full_y;
1286 m_default_w = m_full_w;
1287 m_default_h = m_full_h;
1288 m_default_bin_x = m_default_bin_x;
1289 m_default_bin_y = m_default_bin_y;
1294 m_currentROI.x = m_default_x;
1295 m_currentROI.y = m_default_y;
1296 m_currentROI.w = m_default_w;
1297 m_currentROI.h = m_default_h;
1298 m_currentROI.bin_x = m_default_bin_x;
1299 m_currentROI.bin_y = m_default_bin_y;
1301 m_nextROI.x = m_default_x;
1302 m_nextROI.y = m_default_y;
1303 m_nextROI.w = m_default_w;
1304 m_nextROI.h = m_default_h;
1305 m_nextROI.bin_x = m_default_bin_x;
1306 m_nextROI.bin_y = m_default_bin_y;
1312template <
class derivedT>
1315 static_cast<void>( t );
1317 derived().createStandardIndiSelectionSw(
1318 m_indiP_readoutSpeed,
"readout_speed", m_readoutSpeedNames,
"Readout Speed" );
1321 if( m_readoutSpeedNameLabels.size() == m_readoutSpeedNames.size() )
1323 for(
size_t n = 0; n < m_readoutSpeedNames.size(); ++n )
1324 m_indiP_readoutSpeed[m_readoutSpeedNames[n]].setLabel( m_readoutSpeedNameLabels[n] );
1327 derived().registerIndiPropertyNew( m_indiP_readoutSpeed, st_newCallBack_stdCamera );
1332template <
class derivedT>
1335 static_cast<void>( f );
1340template <
class derivedT>
1343 static_cast<void>( t );
1345 derived().createStandardIndiSelectionSw(
1346 m_indiP_vShiftSpeed,
"vshift_speed", m_vShiftSpeedNames,
"Vert. Shift Speed" );
1348 if( m_vShiftSpeedNameLabels.size() == m_vShiftSpeedNames.size() )
1350 for(
size_t n = 0; n < m_vShiftSpeedNames.size(); ++n )
1351 m_indiP_vShiftSpeed[m_vShiftSpeedNames[n]].setLabel( m_vShiftSpeedNameLabels[n] );
1354 derived().registerIndiPropertyNew( m_indiP_vShiftSpeed, st_newCallBack_stdCamera );
1359template <
class derivedT>
1362 static_cast<void>( f );
1367template <
class derivedT>
1371 if( derivedT::c_stdCamera_tempControl )
1374 derived().createStandardIndiNumber(
1375 m_indiP_temp,
"temp_ccd", m_minTemp, m_maxTemp, m_stepTemp,
"%0.1f",
"CCD Temperature",
"CCD Temperature" );
1376 m_indiP_temp[
"current"].set( m_ccdTemp );
1377 m_indiP_temp[
"target"].set( m_ccdTempSetpt );
1378 if( derived().registerIndiPropertyNew( m_indiP_temp, st_newCallBack_stdCamera ) < 0 )
1380#ifndef STDCAMERA_TEST_NOLOG
1381 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1386 derived().createStandardIndiToggleSw(
1387 m_indiP_tempcont,
"temp_controller",
"CCD Temperature",
"Control On/Off" );
1388 m_indiP_tempcont[
"toggle"].set( pcf::IndiElement::Off );
1389 if( derived().registerIndiPropertyNew( m_indiP_tempcont, st_newCallBack_stdCamera ) < 0 )
1391#ifndef STDCAMERA_TEST_NOLOG
1392 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1397 derived().createROIndiText(
1398 m_indiP_tempstat,
"temp_control",
"status",
"CCD Temperature",
"",
"CCD Temperature" );
1399 if( derived().registerIndiPropertyReadOnly( m_indiP_tempstat ) < 0 )
1401#ifndef STDCAMERA_TEST_NOLOG
1402 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1407 else if( derivedT::c_stdCamera_temp )
1409 derived().createROIndiNumber( m_indiP_temp,
"temp_ccd",
"CCD Temperature",
"CCD Temperature" );
1410 m_indiP_temp.add( pcf::IndiElement(
"current" ) );
1411 m_indiP_temp[
"current"].set( m_ccdTemp );
1412 if( derived().registerIndiPropertyReadOnly( m_indiP_temp ) < 0 )
1414#ifndef STDCAMERA_TEST_NOLOG
1415 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1421 if( derivedT::c_stdCamera_readoutSpeed )
1423 mx::meta::trueFalseT<derivedT::c_stdCamera_readoutSpeed> tf;
1424 if( createReadoutSpeed( tf ) < 0 )
1426#ifndef STDCAMERA_TEST_NOLOG
1427 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1433 if( derivedT::c_stdCamera_vShiftSpeed )
1435 mx::meta::trueFalseT<derivedT::c_stdCamera_vShiftSpeed> tf;
1436 if( createVShiftSpeed( tf ) < 0 )
1438#ifndef STDCAMERA_TEST_NOLOG
1439 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1445 if( derivedT::c_stdCamera_emGain )
1447 derived().createStandardIndiNumber( m_indiP_emGain,
"emgain", 0, 1000, 1,
"%0.3f" );
1448 if( derived().registerIndiPropertyNew( m_indiP_emGain, st_newCallBack_stdCamera ) < 0 )
1450#ifndef STDCAMERA_TEST_NOLOG
1451 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1457 if( derivedT::c_stdCamera_exptimeCtrl )
1459 derived().createStandardIndiNumber(
1460 m_indiP_exptime,
"exptime", m_minExpTime, m_maxExpTime, m_stepExpTime,
"%0.3f" );
1461 if( derived().registerIndiPropertyNew( m_indiP_exptime, st_newCallBack_stdCamera ) < 0 )
1463#ifndef STDCAMERA_TEST_NOLOG
1464 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1470 if( derivedT::c_stdCamera_fpsCtrl )
1472 derived().createStandardIndiNumber( m_indiP_fps,
"fps", m_minFPS, m_maxFPS, m_stepFPS,
"%0.2f" );
1473 if( derived().registerIndiPropertyNew( m_indiP_fps, st_newCallBack_stdCamera ) < 0 )
1475#ifndef STDCAMERA_TEST_NOLOG
1476 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1481 else if( derivedT::c_stdCamera_fps )
1483 derived().createROIndiNumber( m_indiP_fps,
"fps" );
1484 m_indiP_fps.add( pcf::IndiElement(
"current" ) );
1485 m_indiP_fps[
"current"].setMin( m_minFPS );
1486 m_indiP_fps[
"current"].setMax( m_maxFPS );
1487 m_indiP_fps[
"current"].setStep( m_stepFPS );
1488 m_indiP_fps[
"current"].setFormat(
"%0.2f" );
1490 if( derived().registerIndiPropertyReadOnly( m_indiP_fps ) < 0 )
1492#ifndef STDCAMERA_TEST_NOLOG
1493 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1499 if( derivedT::c_stdCamera_synchro )
1501 derived().createStandardIndiToggleSw( m_indiP_synchro,
"synchro",
"Synchronization",
"Synchronization" );
1502 if( derived().registerIndiPropertyNew( m_indiP_synchro, st_newCallBack_stdCamera ) < 0 )
1504#ifndef STDCAMERA_TEST_NOLOG
1505 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1511 if( derivedT::c_stdCamera_usesModes )
1513 std::vector<std::string> modeNames;
1514 for(
auto it = m_cameraModes.begin();
it != m_cameraModes.end(); ++
it )
1516 modeNames.push_back(
it->first );
1519 if( derived().createStandardIndiSelectionSw( m_indiP_mode,
"mode", modeNames ) < 0 )
1521 derivedT::template log<software_critical>( { __FILE__, __LINE__ } );
1524 if( derived().registerIndiPropertyNew( m_indiP_mode, st_newCallBack_stdCamera ) < 0 )
1526#ifndef STDCAMERA_TEST_NOLOG
1527 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1533 derived().createStandardIndiRequestSw( m_indiP_reconfig,
"reconfigure" );
1534 if( derived().registerIndiPropertyNew( m_indiP_reconfig, st_newCallBack_stdCamera ) < 0 )
1536#ifndef STDCAMERA_TEST_NOLOG
1537 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1542 if( derivedT::c_stdCamera_usesROI )
1545 derived().createStandardIndiNumber( m_indiP_roi_x,
"roi_region_x", m_minROIx, m_maxROIx, m_stepROIx,
"%0.1f" );
1546 if( derived().registerIndiPropertyNew( m_indiP_roi_x, st_newCallBack_stdCamera ) < 0 )
1548#ifndef STDCAMERA_TEST_NOLOG
1549 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1554 derived().createStandardIndiNumber( m_indiP_roi_y,
"roi_region_y", m_minROIy, m_maxROIy, m_stepROIy,
"%0.1f" );
1555 if( derived().registerIndiPropertyNew( m_indiP_roi_y, st_newCallBack_stdCamera ) < 0 )
1557#ifndef STDCAMERA_TEST_NOLOG
1558 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1563 derived().createStandardIndiNumber(
1564 m_indiP_roi_w,
"roi_region_w", m_minROIWidth, m_maxROIWidth, m_stepROIWidth,
"%d" );
1565 if( derived().registerIndiPropertyNew( m_indiP_roi_w, st_newCallBack_stdCamera ) < 0 )
1567#ifndef STDCAMERA_TEST_NOLOG
1568 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1573 derived().createStandardIndiNumber(
1574 m_indiP_roi_h,
"roi_region_h", m_minROIHeight, m_maxROIHeight, m_stepROIHeight,
"%d" );
1575 if( derived().registerIndiPropertyNew( m_indiP_roi_h, st_newCallBack_stdCamera ) < 0 )
1577#ifndef STDCAMERA_TEST_NOLOG
1578 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1583 derived().createStandardIndiNumber(
1584 m_indiP_roi_bin_x,
"roi_region_bin_x", m_minROIBinning_x, m_maxROIBinning_x, m_stepROIBinning_x,
"%f" );
1585 if( derived().registerIndiPropertyNew( m_indiP_roi_bin_x, st_newCallBack_stdCamera ) < 0 )
1587#ifndef STDCAMERA_TEST_NOLOG
1588 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1593 derived().createStandardIndiNumber(
1594 m_indiP_roi_bin_y,
"roi_region_bin_y", m_minROIBinning_y, m_maxROIBinning_y, m_stepROIBinning_y,
"%f" );
1595 if( derived().registerIndiPropertyNew( m_indiP_roi_bin_y, st_newCallBack_stdCamera ) < 0 )
1597#ifndef STDCAMERA_TEST_NOLOG
1598 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1603 derived().createROIndiNumber( m_indiP_fullROI,
"roi_full_region" );
1604 m_indiP_fullROI.add( pcf::IndiElement(
"x" ) );
1605 m_indiP_fullROI[
"x"] = 0;
1606 m_indiP_fullROI.add( pcf::IndiElement(
"y" ) );
1607 m_indiP_fullROI[
"y"] = 0;
1608 m_indiP_fullROI.add( pcf::IndiElement(
"w" ) );
1609 m_indiP_fullROI[
"w"] = 0;
1610 m_indiP_fullROI.add( pcf::IndiElement(
"h" ) );
1611 m_indiP_fullROI[
"h"] = 0;
1612 if( derived().registerIndiPropertyReadOnly( m_indiP_fullROI ) < 0 )
1614#ifndef STDCAMERA_TEST_NOLOG
1615 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1620 derived().createStandardIndiRequestSw( m_indiP_roi_check,
"roi_region_check" );
1621 if( derived().registerIndiPropertyNew( m_indiP_roi_check, st_newCallBack_stdCamera ) < 0 )
1623#ifndef STDCAMERA_TEST_NOLOG
1624 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1629 derived().createStandardIndiRequestSw( m_indiP_roi_set,
"roi_set" );
1630 if( derived().registerIndiPropertyNew( m_indiP_roi_set, st_newCallBack_stdCamera ) < 0 )
1632#ifndef STDCAMERA_TEST_NOLOG
1633 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1638 derived().createStandardIndiRequestSw( m_indiP_roi_full,
"roi_set_full" );
1639 if( derived().registerIndiPropertyNew( m_indiP_roi_full, st_newCallBack_stdCamera ) < 0 )
1641#ifndef STDCAMERA_TEST_NOLOG
1642 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1647 derived().createStandardIndiRequestSw( m_indiP_roi_fullbin,
"roi_set_full_bin" );
1648 if( derived().registerIndiPropertyNew( m_indiP_roi_fullbin, st_newCallBack_stdCamera ) < 0 )
1650#ifndef STDCAMERA_TEST_NOLOG
1651 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1656 derived().createStandardIndiRequestSw( m_indiP_roi_loadlast,
"roi_load_last" );
1657 if( derived().registerIndiPropertyNew( m_indiP_roi_loadlast, st_newCallBack_stdCamera ) < 0 )
1659#ifndef STDCAMERA_TEST_NOLOG
1660 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1665 derived().createStandardIndiRequestSw( m_indiP_roi_last,
"roi_set_last" );
1666 if( derived().registerIndiPropertyNew( m_indiP_roi_last, st_newCallBack_stdCamera ) < 0 )
1668#ifndef STDCAMERA_TEST_NOLOG
1669 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1674 derived().createStandardIndiRequestSw( m_indiP_roi_default,
"roi_set_default" );
1675 if( derived().registerIndiPropertyNew( m_indiP_roi_default, st_newCallBack_stdCamera ) < 0 )
1677#ifndef STDCAMERA_TEST_NOLOG
1678 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1684 if( derivedT::c_stdCamera_cropMode )
1686 derived().createStandardIndiToggleSw( m_indiP_cropMode,
"roi_crop_mode",
"Crop Mode",
"Crop Mode" );
1687 if( derived().registerIndiPropertyNew( m_indiP_cropMode, st_newCallBack_stdCamera ) < 0 )
1689#ifndef STDCAMERA_TEST_NOLOG
1690 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1697 if( derivedT::c_stdCamera_hasShutter )
1699 derived().createROIndiText(
1700 m_indiP_shutterStatus,
"shutter_status",
"status",
"Shutter Status",
"Shutter",
"Status" );
1701 m_indiP_shutterStatus[
"status"] = m_shutterStatus;
1702 if( derived().registerIndiPropertyReadOnly( m_indiP_shutterStatus ) < 0 )
1704#ifndef STDCAMERA_TEST_NOLOG
1705 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1710 derived().createStandardIndiToggleSw( m_indiP_shutter,
"shutter",
"Shutter",
"Shutter" );
1711 if( derived().registerIndiPropertyNew( m_indiP_shutter, st_newCallBack_stdCamera ) < 0 )
1713#ifndef STDCAMERA_TEST_NOLOG
1714 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1720 if( derivedT::c_stdCamera_usesStateString )
1722 derived().createROIndiText( m_indiP_stateString,
"state_string",
"current",
"State String",
"State",
"String" );
1723 m_indiP_stateString.add( pcf::IndiElement(
"valid" ) );
1724 m_indiP_stateString[
"valid"] =
"no";
1725 if( derived().registerIndiPropertyReadOnly( m_indiP_stateString ) < 0 )
1727#ifndef STDCAMERA_TEST_NOLOG
1728 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
1737template <
class derivedT>
1745 if( derived().powerOnWaitElapsed() )
1749 m_currentROI.x = m_default_x;
1750 m_currentROI.y = m_default_y;
1751 m_currentROI.w = m_default_w;
1752 m_currentROI.h = m_default_h;
1753 m_currentROI.bin_x = m_default_bin_x;
1754 m_currentROI.bin_y = m_default_bin_y;
1756 m_nextROI.x = m_default_x;
1757 m_nextROI.y = m_default_y;
1758 m_nextROI.w = m_default_w;
1759 m_nextROI.h = m_default_h;
1760 m_nextROI.bin_x = m_default_bin_x;
1761 m_nextROI.bin_y = m_default_bin_y;
1764 derived().powerOnDefaults();
1766 if( derivedT::c_stdCamera_tempControl )
1769 if( m_startupTemp > -999 )
1770 m_ccdTempSetpt = m_startupTemp;
1771 derived().updateIfChanged( m_indiP_temp,
"target", m_ccdTempSetpt,
INDI_IDLE );
1774 if( derivedT::c_stdCamera_usesROI )
1777 m_nextROI.x = m_currentROI.x;
1778 m_nextROI.y = m_currentROI.y;
1779 m_nextROI.w = m_currentROI.w;
1780 m_nextROI.h = m_currentROI.h;
1781 m_nextROI.bin_x = m_currentROI.bin_x;
1782 m_nextROI.bin_y = m_currentROI.bin_y;
1784 derived().updateIfChanged( m_indiP_roi_x,
"current", m_currentROI.x,
INDI_IDLE );
1785 derived().updateIfChanged( m_indiP_roi_x,
"target", m_nextROI.x,
INDI_IDLE );
1787 derived().updateIfChanged( m_indiP_roi_y,
"current", m_currentROI.y,
INDI_IDLE );
1788 derived().updateIfChanged( m_indiP_roi_y,
"target", m_nextROI.y,
INDI_IDLE );
1790 derived().updateIfChanged( m_indiP_roi_w,
"current", m_currentROI.w,
INDI_IDLE );
1791 derived().updateIfChanged( m_indiP_roi_w,
"target", m_nextROI.w,
INDI_IDLE );
1793 derived().updateIfChanged( m_indiP_roi_h,
"current", m_currentROI.h,
INDI_IDLE );
1794 derived().updateIfChanged( m_indiP_roi_h,
"target", m_nextROI.h,
INDI_IDLE );
1796 derived().updateIfChanged( m_indiP_roi_bin_x,
"current", m_currentROI.bin_x,
INDI_IDLE );
1797 derived().updateIfChanged( m_indiP_roi_bin_x,
"target", m_nextROI.bin_x,
INDI_IDLE );
1799 derived().updateIfChanged( m_indiP_roi_bin_y,
"current", m_currentROI.bin_y,
INDI_IDLE );
1800 derived().updateIfChanged( m_indiP_roi_bin_y,
"target", m_nextROI.bin_y,
INDI_IDLE );
1803 if( derivedT::c_stdCamera_hasShutter )
1805 if( m_shutterStatus ==
"OPERATING" )
1807 derived().updateIfChanged( m_indiP_shutterStatus,
"status", m_shutterStatus,
INDI_BUSY );
1809 if( m_shutterStatus ==
"POWERON" || m_shutterStatus ==
"READY" )
1811 derived().updateIfChanged( m_indiP_shutterStatus,
"status", m_shutterStatus,
INDI_OK );
1815 derived().updateIfChanged( m_indiP_shutterStatus,
"status", m_shutterStatus,
INDI_IDLE );
1818 if( m_shutterState == 1 )
1820 derived().updateSwitchIfChanged( m_indiP_shutter,
"toggle", pcf::IndiElement::On,
INDI_OK );
1824 derived().updateSwitchIfChanged( m_indiP_shutter,
"toggle", pcf::IndiElement::Off,
INDI_IDLE );
1837 if( derivedT::c_stdCamera_usesROI )
1839 derived().updateIfChanged( m_indiP_roi_x,
"current", m_currentROI.x,
INDI_IDLE );
1840 derived().updateIfChanged( m_indiP_roi_x,
"target", m_nextROI.x,
INDI_IDLE );
1842 derived().updateIfChanged( m_indiP_roi_y,
"current", m_currentROI.y,
INDI_IDLE );
1843 derived().updateIfChanged( m_indiP_roi_y,
"target", m_nextROI.y,
INDI_IDLE );
1845 derived().updateIfChanged( m_indiP_roi_w,
"current", m_currentROI.w,
INDI_IDLE );
1846 derived().updateIfChanged( m_indiP_roi_w,
"target", m_nextROI.w,
INDI_IDLE );
1848 derived().updateIfChanged( m_indiP_roi_h,
"current", m_currentROI.h,
INDI_IDLE );
1849 derived().updateIfChanged( m_indiP_roi_h,
"target", m_nextROI.h,
INDI_IDLE );
1851 derived().updateIfChanged( m_indiP_roi_bin_x,
"current", m_currentROI.bin_x,
INDI_IDLE );
1852 derived().updateIfChanged( m_indiP_roi_bin_x,
"target", m_nextROI.bin_x,
INDI_IDLE );
1854 derived().updateIfChanged( m_indiP_roi_bin_y,
"current", m_currentROI.bin_y,
INDI_IDLE );
1855 derived().updateIfChanged( m_indiP_roi_bin_y,
"target", m_nextROI.bin_y,
INDI_IDLE );
1861 catch(
const std::exception &e )
1864 { __FILE__, __LINE__, std::string(
"Exception caught: " ) + e.what() } );
1868template <
class derivedT>
1871 if( !derived().m_indiDriver )
1874 if( derivedT::c_stdCamera_usesModes )
1876 for(
auto it = m_cameraModes.begin();
it != m_cameraModes.end(); ++
it )
1878 derived().updateSwitchIfChanged( m_indiP_mode,
it->first, pcf::IndiElement::Off,
INDI_IDLE );
1882 if( derivedT::c_stdCamera_usesROI )
1904 m_currentROI.x = m_default_x;
1905 m_currentROI.y = m_default_y;
1906 m_currentROI.w = m_default_w;
1907 m_currentROI.h = m_default_h;
1908 m_currentROI.bin_x = m_default_bin_x;
1909 m_currentROI.bin_y = m_default_bin_y;
1911 m_nextROI.x = m_default_x;
1912 m_nextROI.y = m_default_y;
1913 m_nextROI.w = m_default_w;
1914 m_nextROI.h = m_default_h;
1915 m_nextROI.bin_x = m_default_bin_x;
1916 m_nextROI.bin_y = m_default_bin_y;
1920 if( derivedT::c_stdCamera_hasShutter )
1922 if( m_shutterStatus ==
"OPERATING" )
1924 derived().updateIfChanged( m_indiP_shutterStatus,
"status", m_shutterStatus,
INDI_BUSY );
1926 if( m_shutterStatus ==
"POWERON" || m_shutterStatus ==
"READY" )
1928 derived().updateIfChanged( m_indiP_shutterStatus,
"status", m_shutterStatus,
INDI_OK );
1932 derived().updateIfChanged( m_indiP_shutterStatus,
"status", m_shutterStatus,
INDI_IDLE );
1935 if( m_shutterState == 0 )
1937 derived().updateSwitchIfChanged( m_indiP_shutter,
"toggle", pcf::IndiElement::On,
INDI_OK );
1941 derived().updateSwitchIfChanged( m_indiP_shutter,
"toggle", pcf::IndiElement::Off,
INDI_IDLE );
1948template <
class derivedT>
1952 if( derivedT::c_stdCamera_hasShutter )
1954 if( m_shutterStatus ==
"OPERATING" )
1956 derived().updateIfChanged( m_indiP_shutterStatus,
"status", m_shutterStatus,
INDI_BUSY );
1958 if( m_shutterStatus ==
"POWERON" || m_shutterStatus ==
"READY" )
1960 derived().updateIfChanged( m_indiP_shutterStatus,
"status", m_shutterStatus,
INDI_OK );
1964 derived().updateIfChanged( m_indiP_shutterStatus,
"status", m_shutterStatus,
INDI_IDLE );
1967 if( m_shutterState == 0 )
1969 derived().updateSwitchIfChanged( m_indiP_shutter,
"toggle", pcf::IndiElement::On,
INDI_OK );
1973 derived().updateSwitchIfChanged( m_indiP_shutter,
"toggle", pcf::IndiElement::Off,
INDI_IDLE );
1980template <
class derivedT>
1986template <
class derivedT>
1989 derivedT *_app =
static_cast<derivedT *
>( app );
1990 return _app->newCallBack_stdCamera(
ipRecv );
1993template <
class derivedT>
1997 if(
ipRecv.getDevice() != derived().configName() )
1999#ifndef XWCTEST_INDI_CALLBACK_VALIDATION
2000 derivedT::template log<software_error>( { __FILE__, __LINE__,
"unknown INDI property" } );
2006 std::string name =
ipRecv.getName();
2008 if( name ==
"reconfigure" )
2009 return newCallBack_reconfigure(
ipRecv );
2010 else if( derivedT::c_stdCamera_temp && name ==
"temp_ccd" )
2011 return newCallBack_temp(
ipRecv );
2012 else if( derivedT::c_stdCamera_tempControl && name ==
"temp_ccd" )
2013 return newCallBack_temp(
ipRecv );
2014 else if( derivedT::c_stdCamera_tempControl && name ==
"temp_controller" )
2015 return newCallBack_temp_controller(
ipRecv );
2016 else if( derivedT::c_stdCamera_readoutSpeed && name ==
"readout_speed" )
2017 return newCallBack_readoutSpeed(
ipRecv );
2018 else if( derivedT::c_stdCamera_vShiftSpeed && name ==
"vshift_speed" )
2019 return newCallBack_vShiftSpeed(
ipRecv );
2020 else if( derivedT::c_stdCamera_emGain && name ==
"emgain" )
2021 return newCallBack_emgain(
ipRecv );
2022 else if( derivedT::c_stdCamera_exptimeCtrl && name ==
"exptime" )
2023 return newCallBack_exptime(
ipRecv );
2024 else if( derivedT::c_stdCamera_fpsCtrl && name ==
"fps" )
2025 return newCallBack_fps(
ipRecv );
2026 else if( derivedT::c_stdCamera_synchro && name ==
"synchro" )
2027 return newCallBack_synchro(
ipRecv );
2028 else if( derivedT::c_stdCamera_usesModes && name ==
"mode" )
2029 return newCallBack_mode(
ipRecv );
2030 else if( derivedT::c_stdCamera_cropMode && name ==
"roi_crop_mode" )
2031 return newCallBack_cropMode(
ipRecv );
2032 else if( derivedT::c_stdCamera_usesROI && name ==
"roi_region_x" )
2033 return newCallBack_roi_x(
ipRecv );
2034 else if( derivedT::c_stdCamera_usesROI && name ==
"roi_region_y" )
2035 return newCallBack_roi_y(
ipRecv );
2036 else if( derivedT::c_stdCamera_usesROI && name ==
"roi_region_w" )
2037 return newCallBack_roi_w(
ipRecv );
2038 else if( derivedT::c_stdCamera_usesROI && name ==
"roi_region_h" )
2039 return newCallBack_roi_h(
ipRecv );
2040 else if( derivedT::c_stdCamera_usesROI && name ==
"roi_region_bin_x" )
2041 return newCallBack_roi_bin_x(
ipRecv );
2042 else if( derivedT::c_stdCamera_usesROI && name ==
"roi_region_bin_y" )
2043 return newCallBack_roi_bin_y(
ipRecv );
2044 else if( derivedT::c_stdCamera_usesROI && name ==
"roi_region_check" )
2045 return newCallBack_roi_check(
ipRecv );
2046 else if( derivedT::c_stdCamera_usesROI && name ==
"roi_set" )
2047 return newCallBack_roi_set(
ipRecv );
2048 else if( derivedT::c_stdCamera_usesROI && name ==
"roi_set_full" )
2049 return newCallBack_roi_full(
ipRecv );
2050 else if( derivedT::c_stdCamera_usesROI && name ==
"roi_set_full_bin" )
2051 return newCallBack_roi_fullbin(
ipRecv );
2052 else if( derivedT::c_stdCamera_usesROI && name ==
"roi_load_last" )
2053 return newCallBack_roi_loadlast(
ipRecv );
2054 else if( derivedT::c_stdCamera_usesROI && name ==
"roi_set_last" )
2055 return newCallBack_roi_last(
ipRecv );
2056 else if( derivedT::c_stdCamera_usesROI && name ==
"roi_set_default" )
2057 return newCallBack_roi_default(
ipRecv );
2058 else if( derivedT::c_stdCamera_hasShutter && name ==
"shutter" )
2059 return newCallBack_shutter(
ipRecv );
2061#ifndef XWCTEST_INDI_CALLBACK_VALIDATION
2062 derivedT::template log<software_error>( { __FILE__, __LINE__,
"unknown INDI property" } );
2068template <
class derivedT>
2071 static_cast<void>( t );
2072 return derived().setTempSetPt();
2075template <
class derivedT>
2078 static_cast<void>( f );
2082template <
class derivedT>
2085 if( derivedT::c_stdCamera_tempControl )
2087#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2093 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2095 if( derived().indiTargetUpdate( m_indiP_temp, target,
ipRecv,
true ) < 0 )
2097 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
2101 m_ccdTempSetpt = target;
2103 mx::meta::trueFalseT<derivedT::c_stdCamera_tempControl> tf;
2104 return setTempSetPt( tf );
2112template <
class derivedT>
2115 static_cast<void>( t );
2116 return derived().setTempControl();
2119template <
class derivedT>
2122 static_cast<void>( f );
2126template <
class derivedT>
2129 if( derivedT::c_stdCamera_tempControl )
2131#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2135 if( !
ipRecv.find(
"toggle" ) )
2138 m_tempControlStatusSet =
false;
2140 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2142 if(
ipRecv[
"toggle"].getSwitchState() == pcf::IndiElement::On )
2144 m_tempControlStatusSet =
true;
2145 derived().updateSwitchIfChanged( m_indiP_tempcont,
"toggle", pcf::IndiElement::On,
INDI_BUSY );
2147 else if(
ipRecv[
"toggle"].getSwitchState() == pcf::IndiElement::Off )
2149 m_tempControlStatusSet =
false;
2150 derived().updateSwitchIfChanged( m_indiP_tempcont,
"toggle", pcf::IndiElement::Off,
INDI_BUSY );
2153 mx::meta::trueFalseT<derivedT::c_stdCamera_emGain> tf;
2154 return setTempControl( tf );
2162template <
class derivedT>
2165 static_cast<void>( t );
2166 return derived().setReadoutSpeed();
2169template <
class derivedT>
2172 static_cast<void>( f );
2176template <
class derivedT>
2179 if( derivedT::c_stdCamera_readoutSpeed )
2181#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2185 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2187 std::string newspeed;
2189 for(
size_t i = 0; i < m_readoutSpeedNames.size(); ++i )
2191 if( !
ipRecv.find( m_readoutSpeedNames[i] ) )
2194 if(
ipRecv[m_readoutSpeedNames[i]].getSwitchState() == pcf::IndiElement::On )
2196 if( newspeed !=
"" )
2198 derivedT::template log<text_log>(
"More than one readout speed selected",
logPrio::LOG_ERROR );
2202 newspeed = m_readoutSpeedNames[i];
2206 if( newspeed ==
"" )
2209 m_readoutSpeedNameSet = m_readoutSpeedName;
2213 m_readoutSpeedNameSet = newspeed;
2216 mx::meta::trueFalseT<derivedT::c_stdCamera_readoutSpeed> tf;
2217 return setReadoutSpeed( tf );
2223template <
class derivedT>
2226 static_cast<void>( t );
2227 return derived().setVShiftSpeed();
2230template <
class derivedT>
2233 static_cast<void>( f );
2237template <
class derivedT>
2240 if( derivedT::c_stdCamera_vShiftSpeed )
2242#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2246 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2248 std::string newspeed;
2250 for(
size_t i = 0; i < m_vShiftSpeedNames.size(); ++i )
2252 if( !
ipRecv.find( m_vShiftSpeedNames[i] ) )
2255 if(
ipRecv[m_vShiftSpeedNames[i]].getSwitchState() == pcf::IndiElement::On )
2257 if( newspeed !=
"" )
2259 derivedT::template log<text_log>(
"More than one vShift speed selected",
logPrio::LOG_ERROR );
2263 newspeed = m_vShiftSpeedNames[i];
2267 if( newspeed ==
"" )
2270 m_vShiftSpeedNameSet = m_vShiftSpeedName;
2274 m_vShiftSpeedNameSet = newspeed;
2277 mx::meta::trueFalseT<derivedT::c_stdCamera_vShiftSpeed> tf;
2278 return setVShiftSpeed( tf );
2284template <
class derivedT>
2287 static_cast<void>( t );
2288 return derived().setEMGain();
2291template <
class derivedT>
2294 static_cast<void>( f );
2298template <
class derivedT>
2301 if( derivedT::c_stdCamera_emGain )
2303#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2309 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2311 if( derived().indiTargetUpdate( m_indiP_emGain, target,
ipRecv,
true ) < 0 )
2313 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
2317 m_emGainSet = target;
2319 mx::meta::trueFalseT<derivedT::c_stdCamera_emGain> tf;
2320 return setEMGain( tf );
2326template <
class derivedT>
2329 static_cast<void>( t );
2330 return derived().setExpTime();
2333template <
class derivedT>
2336 static_cast<void>( f );
2340template <
class derivedT>
2343 if( derivedT::c_stdCamera_exptimeCtrl )
2345#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2351 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2353 if( derived().indiTargetUpdate( m_indiP_exptime, target,
ipRecv,
true ) < 0 )
2355 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
2359 m_expTimeSet = target;
2361 mx::meta::trueFalseT<derivedT::c_stdCamera_exptimeCtrl> tf;
2362 return setExpTime( tf );
2368template <
class derivedT>
2371 static_cast<void>( t );
2372 return derived().setFPS();
2375template <
class derivedT>
2378 static_cast<void>( f );
2382template <
class derivedT>
2385 if( derivedT::c_stdCamera_fpsCtrl )
2387#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2393 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2395 if( derived().indiTargetUpdate( m_indiP_fps, target,
ipRecv,
true ) < 0 )
2397 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
2403 mx::meta::trueFalseT<derivedT::c_stdCamera_fpsCtrl> tf;
2404 return setFPS( tf );
2410template <
class derivedT>
2413 static_cast<void>( t );
2414 return derived().setSynchro();
2417template <
class derivedT>
2420 static_cast<void>( f );
2424template <
class derivedT>
2427 if( derivedT::c_stdCamera_synchro )
2429#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2433 if( !
ipRecv.find(
"toggle" ) )
2436 if(
ipRecv[
"toggle"].getSwitchState() == pcf::IndiElement::Off )
2438 m_synchroSet =
false;
2441 if(
ipRecv[
"toggle"].getSwitchState() == pcf::IndiElement::On )
2443 m_synchroSet =
true;
2446 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2448 mx::meta::trueFalseT<derivedT::c_stdCamera_synchro> tf;
2449 return setSynchro( tf );
2455template <
class derivedT>
2458 if( derivedT::c_stdCamera_usesModes )
2460#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2464 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2466 if(
ipRecv.getName() != m_indiP_mode.getName() )
2468 derivedT::template log<software_error>( { __FILE__, __LINE__,
"invalid indi property received" } );
2473 std::string newName =
"";
2474 for(
auto it = m_cameraModes.begin();
it != m_cameraModes.end(); ++
it )
2479 if(
ipRecv[
it->first].getSwitchState() == pcf::IndiElement::On )
2483 derivedT::template log<text_log>(
"More than one camera mode selected",
logPrio::LOG_ERROR );
2487 newName =
it->first;
2497 m_nextMode = newName;
2498 derived().m_reconfig =
true;
2508template <
class derivedT>
2511#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2515 if( !
ipRecv.find(
"request" ) )
2518 if(
ipRecv[
"request"].getSwitchState() == pcf::IndiElement::On )
2520 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2523 m_indiP_reconfig,
"request", pcf::IndiElement::Off, derived().m_indiDriver,
INDI_IDLE );
2525 m_nextMode = m_modeName;
2526 derived().m_reconfig =
true;
2533template <
class derivedT>
2536 static_cast<void>( t );
2537 return derived().setCropMode();
2540template <
class derivedT>
2543 static_cast<void>( f );
2547template <
class derivedT>
2550 if( derivedT::c_stdCamera_cropMode )
2552#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2556 if( !
ipRecv.find(
"toggle" ) )
2559 if(
ipRecv[
"toggle"].getSwitchState() == pcf::IndiElement::Off )
2561 m_cropModeSet =
false;
2564 if(
ipRecv[
"toggle"].getSwitchState() == pcf::IndiElement::On )
2566 m_cropModeSet =
true;
2569 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2571 mx::meta::trueFalseT<derivedT::c_stdCamera_cropMode> tf;
2572 return setCropMode( tf );
2579template <
class derivedT>
2582#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2588 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2590 if( derived().indiTargetUpdate( m_indiP_roi_x, target,
ipRecv,
false ) < 0 )
2592 m_nextROI.x = m_currentROI.x;
2593 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
2597 m_nextROI.x = target;
2602template <
class derivedT>
2605#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2611 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2613 if( derived().indiTargetUpdate( m_indiP_roi_y, target,
ipRecv,
false ) < 0 )
2615 m_nextROI.y = m_currentROI.y;
2616 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
2620 m_nextROI.y = target;
2625template <
class derivedT>
2628#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2634 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2636 if( derived().indiTargetUpdate( m_indiP_roi_w, target,
ipRecv,
false ) < 0 )
2638 m_nextROI.w = m_currentROI.w;
2639 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
2643 m_nextROI.w = target;
2648template <
class derivedT>
2651#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2657 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2659 if( derived().indiTargetUpdate( m_indiP_roi_h, target,
ipRecv,
false ) < 0 )
2661 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
2662 m_nextROI.h = m_currentROI.h;
2666 m_nextROI.h = target;
2671template <
class derivedT>
2674#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2680 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2682 if( derived().indiTargetUpdate( m_indiP_roi_bin_x, target,
ipRecv,
false ) < 0 )
2684 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
2685 m_nextROI.bin_x = m_currentROI.bin_x;
2689 m_nextROI.bin_x = target;
2694template <
class derivedT>
2697#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2703 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2705 if( derived().indiTargetUpdate( m_indiP_roi_bin_y, target,
ipRecv,
false ) < 0 )
2707 derivedT::template log<software_error>( { __FILE__, __LINE__ } );
2708 m_nextROI.bin_y = m_currentROI.bin_y;
2712 m_nextROI.bin_y = target;
2717template <
class derivedT>
2720 static_cast<void>( t );
2721 return derived().checkNextROI();
2724template <
class derivedT>
2727 static_cast<void>( f );
2731template <
class derivedT>
2734 if( derivedT::c_stdCamera_usesROI )
2736#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2740 if( !
ipRecv.find(
"request" ) )
2743 if(
ipRecv[
"request"].getSwitchState() == pcf::IndiElement::On )
2745 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2748 m_indiP_roi_check,
"request", pcf::IndiElement::Off, derived().m_indiDriver,
INDI_IDLE );
2750 mx::meta::trueFalseT<derivedT::c_stdCamera_usesROI> tf;
2751 return checkNextROI( tf );
2760template <
class derivedT>
2763 static_cast<void>( t );
2764 return derived().setNextROI();
2767template <
class derivedT>
2770 static_cast<void>( f );
2774template <
class derivedT>
2777 if( derivedT::c_stdCamera_usesROI )
2779#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2783 if( !
ipRecv.find(
"request" ) )
2786 if(
ipRecv[
"request"].getSwitchState() == pcf::IndiElement::On )
2788 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2791 m_indiP_roi_set,
"request", pcf::IndiElement::Off, derived().m_indiDriver,
INDI_IDLE );
2793 m_lastROI = m_currentROI;
2795 mx::meta::trueFalseT<derivedT::c_stdCamera_usesROI> tf;
2796 return setNextROI( tf );
2805template <
class derivedT>
2808 if( derivedT::c_stdCamera_usesROI )
2810#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2814 if( !
ipRecv.find(
"request" ) )
2817 if(
ipRecv[
"request"].getSwitchState() == pcf::IndiElement::On )
2819 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2822 m_indiP_roi_full,
"request", pcf::IndiElement::Off, derived().m_indiDriver,
INDI_IDLE );
2824 m_nextROI.x = m_full_x;
2825 m_nextROI.y = m_full_y;
2826 m_nextROI.w = m_full_w;
2827 m_nextROI.h = m_full_h;
2828 m_nextROI.bin_x = m_full_bin_x;
2829 m_nextROI.bin_y = m_full_bin_y;
2830 m_lastROI = m_currentROI;
2831 mx::meta::trueFalseT<derivedT::c_stdCamera_usesROI> tf;
2832 return setNextROI( tf );
2841template <
class derivedT>
2844 if( derivedT::c_stdCamera_usesROI )
2846#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2850 if( !
ipRecv.find(
"request" ) )
2853 if(
ipRecv[
"request"].getSwitchState() == pcf::IndiElement::On )
2855 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2858 m_indiP_roi_fullbin,
"request", pcf::IndiElement::Off, derived().m_indiDriver,
INDI_IDLE );
2862 if( m_full_currbin_x == 0 )
2864 derivedT::template log<text_log>(
"current-binning full ROI not implemented for this camera",
2866 m_full_currbin_x = m_full_x;
2867 m_full_currbin_y = m_full_y;
2868 m_full_currbin_w = m_full_w;
2869 m_full_currbin_h = m_full_h;
2873 m_nextROI.x = m_full_currbin_x;
2874 m_nextROI.y = m_full_currbin_y;
2875 m_nextROI.w = m_full_currbin_w;
2876 m_nextROI.h = m_full_currbin_h;
2880 m_nextROI.bin_x = m_full_bin_x;
2881 m_nextROI.bin_y = m_full_bin_y;
2884 m_full_currbin_x = 0;
2885 m_full_currbin_y = 0;
2886 m_full_currbin_w = 0;
2887 m_full_currbin_h = 0;
2891 m_nextROI.bin_x = m_currentROI.bin_x;
2892 m_nextROI.bin_y = m_currentROI.bin_y;
2895 m_lastROI = m_currentROI;
2896 mx::meta::trueFalseT<derivedT::c_stdCamera_usesROI> tf;
2897 return setNextROI( tf );
2906template <
class derivedT>
2909 if( derivedT::c_stdCamera_usesROI )
2911#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2915 if( !
ipRecv.find(
"request" ) )
2918 if(
ipRecv[
"request"].getSwitchState() == pcf::IndiElement::On )
2920 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2923 m_indiP_roi_loadlast,
"request", pcf::IndiElement::Off, derived().m_indiDriver,
INDI_IDLE );
2925 m_nextROI = m_lastROI;
2935template <
class derivedT>
2938 if( derivedT::c_stdCamera_usesROI )
2940#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2943 if( !
ipRecv.find(
"request" ) )
2946 if(
ipRecv[
"request"].getSwitchState() == pcf::IndiElement::On )
2948 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2951 m_indiP_roi_last,
"request", pcf::IndiElement::Off, derived().m_indiDriver,
INDI_IDLE );
2953 m_nextROI = m_lastROI;
2954 m_lastROI = m_currentROI;
2955 mx::meta::trueFalseT<derivedT::c_stdCamera_usesROI> tf;
2956 return setNextROI( tf );
2965template <
class derivedT>
2968 if( derivedT::c_stdCamera_usesROI )
2970#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
2974 if( !
ipRecv.find(
"request" ) )
2977 if(
ipRecv[
"request"].getSwitchState() == pcf::IndiElement::On )
2979 std::unique_lock<std::mutex>
lock( derived().m_indiMutex );
2982 m_indiP_roi_default,
"request", pcf::IndiElement::Off, derived().m_indiDriver,
INDI_IDLE );
2984 m_nextROI.x = m_default_x;
2985 m_nextROI.y = m_default_y;
2986 m_nextROI.w = m_default_w;
2987 m_nextROI.h = m_default_h;
2988 m_nextROI.bin_x = m_default_bin_x;
2989 m_nextROI.bin_y = m_default_bin_y;
2990 m_lastROI = m_currentROI;
2991 mx::meta::trueFalseT<derivedT::c_stdCamera_usesROI> tf;
2992 return setNextROI( tf );
3001template <
class derivedT>
3004 static_cast<void>( t );
3005 return derived().setShutter( ss );
3008template <
class derivedT>
3011 static_cast<void>( ss );
3012 static_cast<void>( f );
3016template <
class derivedT>
3019 if( derivedT::c_stdCamera_hasShutter )
3021#ifdef XWCTEST_INDI_CALLBACK_VALIDATION
3025 if( !
ipRecv.find(
"toggle" ) )
3028 mx::meta::trueFalseT<derivedT::c_stdCamera_hasShutter> tf;
3030 if(
ipRecv[
"toggle"].getSwitchState() == pcf::IndiElement::Off )
3032 setShutter( 1, tf );
3035 if(
ipRecv[
"toggle"].getSwitchState() == pcf::IndiElement::On )
3037 setShutter( 0, tf );
3045template <
class derivedT>
3048 static_cast<void>( t );
3049 return derived().stateString();
3052template <
class derivedT>
3055 static_cast<void>( f );
3059template <
class derivedT>
3062 static_cast<void>( t );
3063 return derived().stateStringValid();
3066template <
class derivedT>
3069 static_cast<void>( f );
3073template <
class derivedT>
3078 if( !derived().m_indiDriver )
3081 if( derivedT::c_stdCamera_readoutSpeed )
3084 m_indiP_readoutSpeed, m_readoutSpeedName, derived().m_indiDriver,
INDI_OK );
3087 if( derivedT::c_stdCamera_vShiftSpeed )
3090 m_indiP_vShiftSpeed, m_vShiftSpeedName, derived().m_indiDriver,
INDI_OK );
3093 if( derivedT::c_stdCamera_emGain )
3095 derived().updateIfChanged( m_indiP_emGain,
"current", m_emGain,
INDI_IDLE );
3096 derived().updateIfChanged( m_indiP_emGain,
"target", m_emGainSet,
INDI_IDLE );
3099 if( derivedT::c_stdCamera_exptimeCtrl )
3101 derived().updateIfChanged( m_indiP_exptime,
"current", m_expTime,
INDI_IDLE );
3102 derived().updateIfChanged( m_indiP_exptime,
"target", m_expTimeSet,
INDI_IDLE );
3105 if( derivedT::c_stdCamera_fpsCtrl )
3107 derived().updateIfChanged( m_indiP_fps,
"current", m_fps,
INDI_IDLE );
3108 derived().updateIfChanged( m_indiP_fps,
"target", m_fpsSet,
INDI_IDLE );
3110 else if( derivedT::c_stdCamera_fps )
3112 derived().updateIfChanged( m_indiP_fps,
"current", m_fps,
INDI_IDLE );
3115 if( derivedT::c_stdCamera_synchro )
3117 if( m_synchro ==
false )
3119 derived().updateSwitchIfChanged( m_indiP_synchro,
"toggle", pcf::IndiElement::Off,
INDI_IDLE );
3123 derived().updateSwitchIfChanged( m_indiP_synchro,
"toggle", pcf::IndiElement::On,
INDI_OK );
3127 if( derivedT::c_stdCamera_usesModes )
3129 auto st = pcf::IndiProperty::Ok;
3130 if( m_nextMode !=
"" )
3131 st = pcf::IndiProperty::Busy;
3133 for(
auto it = m_cameraModes.begin();
it != m_cameraModes.end(); ++
it )
3135 if(
it->first == m_modeName )
3136 derived().updateSwitchIfChanged( m_indiP_mode,
it->first, pcf::IndiElement::On, st );
3138 derived().updateSwitchIfChanged( m_indiP_mode,
it->first, pcf::IndiElement::Off, st );
3142 if( derivedT::c_stdCamera_cropMode )
3144 if( m_cropMode ==
false )
3146 derived().updateSwitchIfChanged( m_indiP_cropMode,
"toggle", pcf::IndiElement::Off,
INDI_IDLE );
3150 derived().updateSwitchIfChanged( m_indiP_cropMode,
"toggle", pcf::IndiElement::On,
INDI_OK );
3154 if( derivedT::c_stdCamera_usesROI )
3158 derived().updateIfChanged( m_indiP_fullROI,
"x", m_full_x,
INDI_IDLE );
3159 derived().updateIfChanged( m_indiP_fullROI,
"y", m_full_y,
INDI_IDLE );
3160 derived().updateIfChanged( m_indiP_fullROI,
"w", m_full_w,
INDI_IDLE );
3161 derived().updateIfChanged( m_indiP_fullROI,
"h", m_full_h,
INDI_IDLE );
3164 if( derivedT::c_stdCamera_tempControl )
3166 if( m_tempControlStatus ==
false )
3168 derived().updateSwitchIfChanged( m_indiP_tempcont,
"toggle", pcf::IndiElement::Off,
INDI_IDLE );
3169 derived().updateIfChanged( m_indiP_temp,
"current", m_ccdTemp,
INDI_IDLE );
3170 derived().updateIfChanged( m_indiP_temp,
"target", m_ccdTempSetpt,
INDI_IDLE );
3171 derived().updateIfChanged( m_indiP_tempstat,
"status", m_tempControlStatusStr,
INDI_IDLE );
3175 if( m_tempControlOnTarget )
3177 derived().updateSwitchIfChanged( m_indiP_tempcont,
"toggle", pcf::IndiElement::On,
INDI_OK );
3178 derived().updateIfChanged( m_indiP_temp,
"current", m_ccdTemp,
INDI_OK );
3179 derived().updateIfChanged( m_indiP_temp,
"target", m_ccdTempSetpt,
INDI_OK );
3180 derived().updateIfChanged( m_indiP_tempstat,
"status", m_tempControlStatusStr,
INDI_OK );
3184 derived().updateSwitchIfChanged( m_indiP_tempcont,
"toggle", pcf::IndiElement::On,
INDI_BUSY );
3185 derived().updateIfChanged( m_indiP_temp,
"current", m_ccdTemp,
INDI_BUSY );
3186 derived().updateIfChanged( m_indiP_temp,
"target", m_ccdTempSetpt,
INDI_BUSY );
3187 derived().updateIfChanged( m_indiP_tempstat,
"status", m_tempControlStatusStr,
INDI_BUSY );
3191 else if( derivedT::c_stdCamera_temp )
3193 derived().updateIfChanged( m_indiP_temp,
"current", m_ccdTemp,
INDI_IDLE );
3196 if( derivedT::c_stdCamera_hasShutter )
3198 if( m_shutterStatus ==
"OPERATING" )
3200 derived().updateIfChanged( m_indiP_shutterStatus,
"status", m_shutterStatus,
INDI_BUSY );
3202 if( m_shutterStatus ==
"POWERON" || m_shutterStatus ==
"READY" )
3204 derived().updateIfChanged( m_indiP_shutterStatus,
"status", m_shutterStatus,
INDI_IDLE );
3208 derived().updateIfChanged( m_indiP_shutterStatus,
"status", m_shutterStatus,
INDI_IDLE );
3211 if( m_shutterState == 0 )
3213 derived().updateSwitchIfChanged( m_indiP_shutter,
"toggle", pcf::IndiElement::On,
INDI_OK );
3217 derived().updateSwitchIfChanged( m_indiP_shutter,
"toggle", pcf::IndiElement::Off,
INDI_IDLE );
3221 if( derivedT::c_stdCamera_usesStateString )
3223 mx::meta::trueFalseT<derivedT::c_stdCamera_usesStateString> tf;
3224 derived().updateIfChanged( m_indiP_stateString,
"current", stateString( tf ),
INDI_IDLE );
3225 if( stateStringValid( tf ) )
3227 derived().updateIfChanged( m_indiP_stateString,
"valid",
"yes",
INDI_IDLE );
3231 derived().updateIfChanged( m_indiP_stateString,
"valid",
"no",
INDI_IDLE );
3236 catch(
const std::exception &e )
3239 { __FILE__, __LINE__, std::string(
"Exception caught: " ) + e.what() } );
3243template <
class derivedT>
3246 static std::string last_mode;
3247 static roi last_roi;
3248 static float last_expTime = -1e30;
3249 static float last_fps = 0;
3250 static float last_adcSpeed = -1;
3251 static float last_emGain = -1;
3252 static float last_ccdTemp = 0;
3253 static float last_ccdTempSetpt = 0;
3254 static bool last_tempControlStatus = 0;
3255 static bool last_tempControlOnTarget = 0;
3256 static std::string last_tempControlStatusStr;
3257 static std::string last_shutterStatus;
3258 static int last_shutterState =
false;
3259 static bool last_synchro =
false;
3260 static float last_vshiftSpeed = -1;
3261 static bool last_cropMode =
false;
3262 static std::string last_readoutSpeed;
3264 if( force || m_modeName != last_mode || m_currentROI.x != last_roi.
x || m_currentROI.y != last_roi.
y ||
3265 m_currentROI.w != last_roi.
w || m_currentROI.h != last_roi.
h || m_currentROI.bin_x != last_roi.
bin_x ||
3266 m_currentROI.bin_y != last_roi.
bin_y || m_expTime != last_expTime || m_fps != last_fps ||
3267 m_emGain != last_emGain || m_adcSpeed != last_adcSpeed || m_ccdTemp != last_ccdTemp ||
3268 m_ccdTempSetpt != last_ccdTempSetpt || m_tempControlStatus != last_tempControlStatus ||
3269 m_tempControlOnTarget != last_tempControlOnTarget || m_tempControlStatusStr != last_tempControlStatusStr ||
3270 m_shutterStatus != last_shutterStatus || m_shutterState != last_shutterState || m_synchro != last_synchro ||
3271 m_vshiftSpeed != last_vshiftSpeed || m_cropMode != last_cropMode || m_readoutSpeedName != last_readoutSpeed)
3273 derived().template telem<telem_stdcam>( { m_modeName,
3286 (uint8_t)m_tempControlStatus,
3287 (uint8_t)m_tempControlOnTarget,
3288 m_tempControlStatusStr,
3290 (int8_t)m_shutterState,
3293 (uint8_t)m_cropMode,
3294 m_readoutSpeedName } );
3296 last_mode = m_modeName;
3297 last_roi = m_currentROI;
3298 last_expTime = m_expTime;
3300 last_emGain = m_emGain;
3301 last_adcSpeed = m_adcSpeed;
3302 last_ccdTemp = m_ccdTemp;
3303 last_ccdTempSetpt = m_ccdTempSetpt;
3304 last_tempControlStatus = m_tempControlStatus;
3305 last_tempControlOnTarget = m_tempControlOnTarget;
3306 last_tempControlStatusStr = m_tempControlStatusStr;
3307 last_shutterStatus = m_shutterStatus;
3308 last_shutterState = m_shutterState;
3309 last_synchro = m_synchro;
3310 last_vshiftSpeed = m_vshiftSpeed;
3311 last_cropMode = m_cropMode;
3312 last_readoutSpeed = m_readoutSpeedName;
3322#define STDCAMERA_SETUP_CONFIG( cfig ) \
3323 if( stdCameraT::setupConfig( cfig ) < 0 ) \
3325 log<software_error>( { __FILE__, __LINE__, "Error from stdCameraT::setupConfig" } ); \
3326 m_shutdown = true; \
3334#define STDCAMERA_LOAD_CONFIG( cfig ) \
3335 if( stdCameraT::loadConfig( cfig ) < 0 ) \
3337 return log<software_error, -1>( { __FILE__, __LINE__, "Error from stdCameraT::loadConfig" } ); \
3341#define STDCAMERA_APP_STARTUP \
3342 if( stdCameraT::appStartup() < 0 ) \
3344 return log<software_error, -1>( { __FILE__, __LINE__, "Error from stdCameraT::appStartup" } ); \
3348#define STDCAMERA_APP_LOGIC \
3349 if( stdCameraT::appLogic() < 0 ) \
3351 return log<software_error, -1>( { __FILE__, __LINE__, "Error from stdCameraT::appLogic" } ); \
3355#define STDCAMERA_UPDATE_INDI \
3356 if( stdCameraT::updateINDI() < 0 ) \
3358 return log<software_error, -1>( { __FILE__, __LINE__, "Error from stdCameraT::updateINDI" } ); \
3362#define STDCAMERA_APP_SHUTDOWN \
3363 if( stdCameraT::appShutdown() < 0 ) \
3365 return log<software_error, -1>( { __FILE__, __LINE__, "Error from stdCameraT::appShutdown" } ); \
MagAO-X standard camera interface.
float m_maxEMGain
The configurable maximum EM gain. To be enforced in derivedT.
std::vector< std::string > m_readoutSpeedNames
float m_minExpTime
The minimum exposure time, used for INDI attributes.
pcf::IndiProperty m_indiP_roi_fullbin
Property used to trigger setting the full in current binning ROI.
float m_fpsSet
The commanded fps, as set by user.
int newCallBack_temp(const pcf::IndiProperty &ipRecv)
Callback to process a NEW CCD temp request.
int newCallBack_cropMode(const pcf::IndiProperty &ipRecv)
Callback to process a NEW cropMode request.
bool m_synchroSet
Target status of m_synchro.
pcf::IndiProperty m_indiP_roi_y
Property used to set the ROI x center coordinate.
int createReadoutSpeed(const mx::meta::trueFalseT< true > &t)
int m_full_currbin_w
The current-binning full ROI width.
int setShutter(int ss, const mx::meta::trueFalseT< true > &t)
Interface to setShutter when the derivedT has a shutter.
float m_default_x
Power-on ROI center x coordinate.
std::string m_tempControlStatusStr
Camera specific description of temperature control status.
float m_emGain
The camera's current EM gain (if available).
int m_full_bin_x
The x-binning in the full ROI.
int newCallBack_readoutSpeed(const pcf::IndiProperty &ipRecv)
Callback to process a NEW readout speed request.
std::vector< std::string > m_readoutSpeedNameLabels
float m_full_currbin_x
The current-binning full ROI center x coordinate.
int m_full_w
The full ROI width.
float m_emGainSet
The camera's EM gain, as set by the user.
std::string m_vShiftSpeedNameSet
The user requested vshift speed name, to be set by derived()
bool m_cropModeSet
Desired status of crop mode ROIs, if enabled for this camera.
int newCallBack_roi_bin_y(const pcf::IndiProperty &ipRecv)
Callback to process a NEW bin_y request.
std::string m_defaultReadoutSpeed
The default readout speed of the camera.
pcf::IndiProperty m_indiP_shutterStatus
State of the shutter. 0 = shut, 1 = open, -1 = unknown.
float m_expTime
The current exposure time, in seconds.
int setExpTime(const mx::meta::trueFalseT< true > &t)
Interface to setExpTime when the derivedT uses exposure time controls.
std::string m_nextMode
The mode to be set by the next reconfiguration.
pcf::IndiProperty m_indiP_tempstat
int m_default_bin_x
Power-on ROI x binning.
int m_default_w
Power-on ROI width.
int setTempControl(const mx::meta::trueFalseT< true > &t)
Interface to setTempControl when the derivedT has temperature control.
int newCallBack_roi_h(const pcf::IndiProperty &ipRecv)
Callback to process a NEW roi_h request.
int recordCamera(bool force=false)
bool m_cropMode
Status of crop mode ROIs, if enabled for this camera.
float m_maxExpTime
The maximum exposure time, used for INDI attributes.
float m_stepFPS
The FPS step size, used for INDI attributes.
int newCallBack_mode(const pcf::IndiProperty &ipRecv)
Callback to process a NEW mode request.
int m_default_h
Power-on ROI height.
pcf::IndiProperty m_indiP_roi_last
Property used to trigger setting the last ROI.
pcf::IndiProperty m_indiP_temp
float m_expTimeSet
The exposure time, in seconds, as set by user.
pcf::IndiProperty m_indiP_roi_h
Property used to set the ROI height.
int m_full_h
The full ROI height.
pcf::IndiProperty m_indiP_synchro
int m_full_bin_y
The y-binning in the full ROI.
int checkNextROI(const mx::meta::trueFalseT< true > &t)
Interface to checkNextROI when the derivedT uses ROIs.
int setVShiftSpeed(const mx::meta::trueFalseT< true > &t)
Interface to setVShiftSpeed when the derivedT has vshift speed control.
float m_full_y
The full ROI center y coordinate.
static int st_newCallBack_stdCamera(void *app, const pcf::IndiProperty &ipRecv)
The static callback function to be registered for stdCamera properties.
float m_maxFPS
The maximum FPS, used for INDI attributes.
std::string m_readoutSpeedName
The current readout speed name.
float m_ccdTempSetpt
The desired temperature, in C.
bool m_tempControlStatus
Whether or not temperature control is active.
pcf::IndiProperty m_indiP_fps
int newCallBack_roi_last(const pcf::IndiProperty &ipRecv)
Callback to process a NEW roi_last request.
int setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
pcf::IndiProperty m_indiP_roi_loadlast
Property used to trigger loading the last ROI as the target.
pcf::IndiProperty m_indiP_roi_w
Property used to set the ROI width.
int newCallBack_roi_set(const pcf::IndiProperty &ipRecv)
Callback to process a NEW roi_set request.
pcf::IndiProperty m_indiP_roi_default
Property used to trigger setting the default and startup ROI.
int newCallBack_stdCamera(const pcf::IndiProperty &ipRecv)
The callback function for stdCamera properties.
std::string m_modeName
The current mode name.
pcf::IndiProperty m_indiP_reconfig
Request switch which forces the framegrabber to go through the reconfigure process.
int setSynchro(const mx::meta::trueFalseT< true > &t)
Interface to setSynchro when the derivedT has synchronization.
pcf::IndiProperty m_indiP_roi_bin_x
Property used to set the ROI x binning.
int newCallBack_roi_loadlast(const pcf::IndiProperty &ipRecv)
Callback to process a NEW roi_loadlast request.
pcf::IndiProperty m_indiP_readoutSpeed
int setEMGain(const mx::meta::trueFalseT< true > &t)
Interface to setEMGain when the derivedT has EM Gain.
int newCallBack_vShiftSpeed(const pcf::IndiProperty &ipRecv)
Callback to process a NEW vshift speed request.
std::string m_startupMode
The camera mode to load during first init after a power-on.
pcf::IndiProperty m_indiP_roi_check
Property used to trigger checking the target ROI.
pcf::IndiProperty m_indiP_vShiftSpeed
int newCallBack_roi_check(const pcf::IndiProperty &ipRecv)
Callback to process a NEW roi_check request.
int newCallBack_roi_x(const pcf::IndiProperty &ipRecv)
Callback to process a NEW roi_x request.
float m_full_x
The full ROI center x coordinate.
float m_startupTemp
The temperature to set after a power-on. Set to <= -999 to not use [default].
int appLogic()
Application logic.
int m_full_currbin_h
The current-binning full ROI height.
int loadConfig(mx::app::appConfigurator &config)
load the configuration system results
std::string m_shutterStatus
pcf::IndiProperty m_indiP_exptime
int newCallBack_shutter(const pcf::IndiProperty &ipRecv)
Callback to process a NEW shutter request.
bool m_synchro
Status of synchronization, true is on, false is off.
std::string m_vShiftSpeedName
The current vshift speed name.
int newCallBack_roi_full(const pcf::IndiProperty &ipRecv)
Callback to process a NEW roi_full request.
int setCropMode(const mx::meta::trueFalseT< true > &t)
Interface to setCropMode when the derivedT has crop mode.
pcf::IndiProperty m_indiP_emGain
float m_ccdTemp
The current temperature, in C.
int updateINDI()
Update the INDI properties for this device controller.
std::vector< std::string > m_vShiftSpeedNames
int newCallBack_fps(const pcf::IndiProperty &ipRecv)
Callback to process a NEW fps request.
std::string m_defaultVShiftSpeed
The default readout speed of the camera.
int newCallBack_roi_y(const pcf::IndiProperty &ipRecv)
Callback to process a NEW roi_y request.
pcf::IndiProperty m_indiP_tempcont
bool m_tempControlOnTarget
Whether or not the temperature control system is on its target temperature.
int createVShiftSpeed(const mx::meta::trueFalseT< true > &t)
cameraConfigMap m_cameraModes
Map holding the possible camera mode configurations.
float m_stepExpTime
The maximum exposure time stepsize, used for INDI attributes.
int whilePowerOff()
Actions while powered off.
int setFPS(const mx::meta::trueFalseT< true > &t)
Interface to setFPS when the derivedT uses FPS controls.
int newCallBack_reconfigure(const pcf::IndiProperty &ipRecv)
Callback to process a NEW reconfigure request.
int newCallBack_emgain(const pcf::IndiProperty &ipRecv)
Callback to process a NEW EM gain request.
float m_full_currbin_y
The current-binning full ROI center y coordinate.
int appStartup()
Startup function.
int newCallBack_roi_bin_x(const pcf::IndiProperty &ipRecv)
Callback to process a NEW bin_x request.
std::vector< std::string > m_vShiftSpeedNameLabels
int setTempSetPt(const mx::meta::trueFalseT< true > &t)
Interface to setTempSetPt when the derivedT has temperature control.
pcf::IndiProperty m_indiP_roi_full
Property used to trigger setting the full ROI.
int newCallBack_synchro(const pcf::IndiProperty &ipRecv)
Callback to process a NEW synchro request.
int newCallBack_roi_default(const pcf::IndiProperty &ipRecv)
Callback to process a NEW roi_default request.
pcf::IndiProperty m_indiP_roi_set
Property used to trigger setting the ROI.
int appShutdown()
Application shutdown.
pcf::IndiProperty m_indiP_shutter
Property used to control the shutter, a switch.
int newCallBack_roi_w(const pcf::IndiProperty &ipRecv)
Callback to process a NEW roi_w request.
pcf::IndiProperty m_indiP_stateString
pcf::IndiProperty m_indiP_mode
Property used to report the current mode.
pcf::IndiProperty m_indiP_cropMode
Property used to toggle crop mode on and off.
float m_default_y
Power-on ROI center y coordinate.
int setNextROI(const mx::meta::trueFalseT< true > &t)
Interface to setNextROI when the derivedT uses ROIs.
pcf::IndiProperty m_indiP_fullROI
Property used to preset the full ROI dimensions.
bool stateStringValid(const mx::meta::trueFalseT< true > &t)
Interface to stateStringValid when the derivedT provides it.
float m_fps
The current FPS.
std::string stateString(const mx::meta::trueFalseT< true > &t)
Interface to stateString when the derivedT provides it.
pcf::IndiProperty m_indiP_roi_bin_y
Property used to set the ROI y binning.
pcf::IndiProperty m_indiP_roi_x
Property used to set the ROI x center coordinate.
int newCallBack_roi_fullbin(const pcf::IndiProperty &ipRecv)
Callback to process a NEW roi_fullbin request.
int newCallBack_temp_controller(const pcf::IndiProperty &ipRecv)
Callback to process a NEW CCD temp control request.
int newCallBack_exptime(const pcf::IndiProperty &ipRecv)
Callback to process a NEW exposure time request.
int setReadoutSpeed(const mx::meta::trueFalseT< true > &t)
Interface to setReadoutSpeed when the derivedT has readout speed control.
int m_default_bin_y
Power-on ROI y binning.
bool m_tempControlStatusSet
Desired state of temperature control.
float m_minFPS
The minimum FPS, used for INDI attributes.
int onPowerOff()
Actions on power off.
std::string m_readoutSpeedNameSet
The user requested readout speed name, to be set by derived()
~stdCamera() noexcept
Destructor.
@ OPERATING
The device is operating, other than homing.
@ READY
The device is ready for operation, but is not operating.
@ NOTCONNECTED
The application is not connected to the device or service.
@ POWERON
The device power is on.
std::unordered_map< std::string, cameraConfig > cameraConfigMap
int loadCameraConfig(cameraConfigMap &ccmap, mx::app::appConfigurator &config)
Load the camera configurations contained in the app configuration into a map.
std::string m_serialCommand
The command to send to the camera to place it in this mode.
std::string m_configFile
The file to use for this mode, e.g. an EDT configuration file.
void updateIfChanged(pcf::IndiProperty &p, const std::string &el, const T &newVal, indiDriverT *indiDriver, pcf::IndiProperty::PropertyStateType newState=pcf::IndiProperty::Ok)
Update the value of the INDI element, but only if it has changed.
void updateSelectionSwitchIfChanged(pcf::IndiProperty &p, const std::string &el, indiDriverT *indiDriver, pcf::IndiProperty::PropertyStateType newState=pcf::IndiProperty::Ok)
Update the values of a one-of-many INDI switch vector, but only if it has changed.
void updateSwitchIfChanged(pcf::IndiProperty &p, const std::string &el, const pcf::IndiElement::SwitchStateType &newVal, indiDriverT *indiDriver, pcf::IndiProperty::PropertyStateType newState=pcf::IndiProperty::Ok)
Update the value of the INDI element, but only if it has changed.
const pcf::IndiProperty & ipRecv
std::unique_lock< std::mutex > lock(m_indiMutex)
static constexpr logPrioT LOG_CRITICAL
The process can not continue and will shut down (fatal)
static constexpr logPrioT LOG_WARNING
A condition has occurred which may become an error, but the process continues.
static constexpr logPrioT LOG_ERROR
An error has occured which the software will attempt to correct.
#define CAMCTRL_E_NOCONFIGS
Software CRITICAL log entry.