28#define _FILE_OFFSET_BITS 64
43#include <libnova/julian_day.h>
44#include <libnova/precession.h>
45#include <libnova/airmass.h>
46#include <libnova/transform.h>
47#include <libnova/ln_types.h>
68std::string
join(std::vector<std::string>
const &strings, std::string delim)
71 std::copy(strings.begin(), strings.end(),
72 std::ostream_iterator<std::string>(ss, delim.c_str()));
88 m_ValidCCDRotation =
false;
101 RA = std::numeric_limits<double>::quiet_NaN();
102 Dec = std::numeric_limits<double>::quiet_NaN();
104 J2000RA = std::numeric_limits<double>::quiet_NaN();
105 J2000DE = std::numeric_limits<double>::quiet_NaN();
107 MPSAS = std::numeric_limits<double>::quiet_NaN();
108 RotatorAngle = std::numeric_limits<double>::quiet_NaN();
112 FocuserTemp = std::numeric_limits<double>::quiet_NaN();
114 Airmass = std::numeric_limits<double>::quiet_NaN();
115 Latitude = std::numeric_limits<double>::quiet_NaN();
116 Longitude = std::numeric_limits<double>::quiet_NaN();
117 Azimuth = std::numeric_limits<double>::quiet_NaN();
118 Altitude = std::numeric_limits<double>::quiet_NaN();
163 TemperatureNP[0].fill(
"CCD_TEMPERATURE_VALUE",
"Temperature (C)",
"%5.2f", -50.0, 50.0, 0., 0.);
197 PrimaryCCD.ImageExposureNP[0].fill(
"CCD_EXPOSURE_VALUE",
"Duration (s)",
"%5.2f", 0.01, 3600, 1.0, 1.0);
209 PrimaryCCD.ImageBinNP[CCDChip::HOR_BIN].fill(
"HOR_BIN",
"X",
"%2.0f", 1, 4, 1, 1);
210 PrimaryCCD.ImageBinNP[CCDChip::VER_BIN].fill(
"VER_BIN",
"Y",
"%2.0f", 1, 4, 1, 1);
239 PrimaryCCD.FitsBP[0].fill(
"CCD1",
"Image",
"");
272 IUFillNumber(&
PrimaryCCD.RapidGuideDataN[0],
"GUIDESTAR_X",
"Guide star position X",
"%5.2f", 0, 1024, 0, 0);
273 IUFillNumber(&
PrimaryCCD.RapidGuideDataN[1],
"GUIDESTAR_Y",
"Guide star position Y",
"%5.2f", 0, 1024, 0, 0);
276 "CCD_RAPID_GUIDE_DATA",
"Rapid Guide Data", RAPIDGUIDE_TAB,
IP_RO, 60,
IPS_IDLE);
290 GuideCCD.ImageBinNP[CCDChip::HOR_BIN].fill(
"HOR_BIN",
"X",
"%2.0f", 1, 4, 1, 1);
291 GuideCCD.ImageBinNP[CCDChip::VER_BIN].fill(
"VER_BIN",
"Y",
"%2.0f", 1, 4, 1, 1);
315 GuideCCD.ImageExposureNP[0].fill(
"GUIDER_EXPOSURE_VALUE",
"Duration (s)",
"%5.2f", 0.01, 3600, 1.0, 1.0);
329 GuideCCD.FitsBP[0].fill(
"CCD2",
"Guider Image",
"");
348 "GUIDER_RAPID_GUIDE_SETUP",
"Rapid Guide Setup", RAPIDGUIDE_TAB,
IP_RW,
ISR_NOFMANY, 0,
351 IUFillNumber(&
GuideCCD.RapidGuideDataN[0],
"GUIDESTAR_X",
"Guide star position X",
"%5.2f", 0, 1024, 0, 0);
352 IUFillNumber(&
GuideCCD.RapidGuideDataN[1],
"GUIDESTAR_Y",
"Guide star position Y",
"%5.2f", 0, 1024, 0, 0);
353 IUFillNumber(&
GuideCCD.RapidGuideDataN[2],
"GUIDESTAR_FIT",
"Guide star fit",
"%5.2f", 0, 1024, 0, 0);
355 "GUIDER_RAPID_GUIDE_DATA",
"Rapid Guide Data", RAPIDGUIDE_TAB,
IP_RO, 60,
IPS_IDLE);
373 CCDRotationNP[0].fill(
"CCD_ROTATION_VALUE",
"Angle",
"%.2f", -360, 360, 1, 0);
386 char configName[64] = {0};
388 m_ConfigCaptureFormatName = configName;
475 EqNP[
Ra].fill(
"RA",
"Ra (hh:mm:ss)",
"%010.6m", 0, 24, 0, 0);
476 EqNP[
DEC].fill(
"DEC",
"Dec (dd:mm:ss)",
"%010.6m", -90, 90, 0, 0);
477 EqNP.fill(mount,
"EQUATORIAL_EOD_COORD",
"EQ Coord",
"Main Control",
IP_RW, 60,
IPS_IDLE);
480 J2000EqNP[
Ra].fill(
"RA",
"Ra (hh:mm:ss)",
"%010.6m", 0, 24, 0, 0);
481 J2000EqNP[
DEC].fill(
"DEC",
"Dec (dd:mm:ss)",
"%010.6m", -90, 90, 0, 0);
482 J2000EqNP.fill(mount,
"EQUATORIAL_COORD",
"J2000 EQ Coord",
483 "Main Control",
IP_RW,
534 DSP->ISGetProperties(dev);
612 if (RapidGuideEnabled)
617 if (GuiderRapidGuideEnabled)
657 if (RapidGuideEnabled)
682 if (GuiderRapidGuideEnabled)
721 DSP->updateProperties();
735 if ((
EqNP.snoop(root)))
737 double newra, newdec;
738 newra =
EqNP[
Ra].getValue();
740 if ((newra !=
RA) || (newdec !=
Dec))
769 if (!strcmp(elemName,
"PIER_EAST") && !strcmp(
pcdataXMLEle(ep),
"On"))
771 else if (!strcmp(elemName,
"PIER_WEST") && !strcmp(
pcdataXMLEle(ep),
"On"))
782 if (!strcmp(name,
"TELESCOPE_APERTURE"))
786 else if (!strcmp(name,
"TELESCOPE_FOCAL_LENGTH"))
794 auto newFilterNames = std::vector<std::string>();
806 auto newFilterSlot = -1;
821 if (!strcmp(name,
"SKY_BRIGHTNESS"))
834 if (!strcmp(name,
"ANGLE"))
849 if (!strcmp(name,
"ROTATOR_ABSOLUTE_POSITION"))
863 if (!strcmp(name,
"FOCUS_ABSOLUTE_POSITION"))
876 if (!strcmp(name,
"TEMPERATURE"))
891 if (!strcmp(name,
"LONG"))
897 else if (!strcmp(name,
"LAT"))
910bool CCD::ISNewText(
const char * dev,
const char * name,
char * texts[],
char * names[],
int n)
918 std::vector<std::string> prevValues;
919 prevValues.reserve(
n);
922 for (
int i = 0; i <
n; i++)
926 bool hasChanged =
false;
927 for (
int i = 0; i <
n; i++)
929 if (prevValues[i] != texts[i])
952 EqNP.setDeviceName(newMount);
954 if (strlen(newMount) > 0)
962 else if (!std::isnan(
RA))
964 LOG_DEBUG(
"No mount is set. Clearing all mount watchers.");
966 std::numeric_limits<double>::quiet_NaN();
974 if (strlen(newRotator) > 0)
976 LOGF_DEBUG(
"Snopping on Rotator %s", newRotator);
980 else if (!std::isnan(
MPSAS))
982 LOG_DEBUG(
"No rotator is set. Clearing all rotator watchers.");
983 MPSAS = std::numeric_limits<double>::quiet_NaN();
991 if (strlen(newFocuser) > 0)
993 LOGF_DEBUG(
"Snopping on Focuser %s", newFocuser);
999 LOG_DEBUG(
"No focuser is set. Clearing all focuser watchers.");
1001 FocuserTemp = std::numeric_limits<double>::quiet_NaN();
1009 if (strlen(newFilterWheel) > 0)
1011 LOGF_DEBUG(
"Snopping on Filter Wheel %s", newFilterWheel);
1017 LOG_DEBUG(
"No filter wheel is set. Clearing All filter wheel watchers.");
1024 if (newSkyQuality != prevValues[
ACTIVE_SKYQUALITY] && strlen(newSkyQuality) > 0)
1032 if (
BayerTP.isNameMatch(name))
1046 std::transform(name.begin(), name.end(), name.begin(), [](
unsigned char c)
1048 return std::toupper(c);
1053 if (name.empty() && value.empty() && comment.empty())
1055 LOG_ERROR(
"Cannot add an empty FITS record.");
1062 if (name ==
"INDI_CLEAR")
1064 m_CustomFITSKeywords.clear();
1065 LOG_INFO(
"Custom FITS headers cleared.");
1067 else if (name.empty() ==
false && value.empty() ==
false)
1070 std::regex checkDouble(
"^[-+]?([0-9]*?[.,][0-9]+|[0-9]+)$");
1072 std::regex checkInteger(
"^[-+]?([0-9]*)$");
1077 if (std::regex_match(value, checkInteger))
1079 auto lValue = std::stol(value);
1080 FITSRecord record(name.c_str(), lValue, comment.c_str());
1081 m_CustomFITSKeywords[name] = record;
1084 else if (std::regex_match(value, checkDouble))
1086 auto dValue = std::stod(value);
1087 FITSRecord record(name.c_str(), dValue, 6, comment.c_str());
1088 m_CustomFITSKeywords[name] = record;
1095 std::replace(value.begin(), value.end(),
'/',
'\\');
1096 FITSRecord record(name.c_str(), value.c_str(), comment.c_str());
1097 m_CustomFITSKeywords[name] = record;
1101 catch (std::exception &e)
1104 std::replace(value.begin(), value.end(),
'/',
'\\');
1105 FITSRecord record(name.c_str(), value.c_str(), comment.c_str());
1106 m_CustomFITSKeywords[name] = record;
1109 else if (comment.empty() ==
false)
1112 m_CustomFITSKeywords[comment] = record;
1131 Streamer->ISNewText(dev, name, texts, names,
n);
1135 DSP->ISNewText(dev, name, texts, names,
n);
1153 if (
PrimaryCCD.ImageExposureNP.isNameMatch(name))
1156 (values[0] <
PrimaryCCD.ImageExposureNP[0].getMin() || values[0] >
PrimaryCCD.ImageExposureNP[0].getMax()))
1158 LOGF_ERROR(
"Requested exposure value (%g) seconds out of bounds [%g,%g].",
1173 PrimaryCCD.ImageExposureNP[0].setValue(values[0]);
1196 if (
GuideCCD.ImageExposureNP.isNameMatch(name))
1199 (values[0] <
GuideCCD.ImageExposureNP[0].getMin() || values[0] >
GuideCCD.ImageExposureNP[0].getMax()))
1201 LOGF_ERROR(
"Requested guide exposure value (%g) seconds out of bounds [%g,%g].",
1202 values[0],
GuideCCD.ImageExposureNP[0].getMin(),
GuideCCD.ImageExposureNP[0].getMax());
1211 GuideCCD.ImageExposureNP[0].setValue(
GuideCCD.ImageExposureNP[0].getMin());
1216 GuideCCD.ImageExposureNP[0].setValue(values[0]);
1231 auto np =
PrimaryCCD.ImageBinNP.findWidgetByName(names[0]);
1239 else if (values[0] == 0 || values[1] == 0)
1243 LOGF_ERROR(
"%.fx%.f binning is invalid.", values[0], values[1]);
1248 if (!strcmp(np->name,
"HOR_BIN"))
1272 if (
GuideCCD.ImageBinNP.isNameMatch(name))
1276 auto np =
GuideCCD.ImageBinNP.findWidgetByName(names[0]);
1283 else if (values[0] == 0 || values[1] == 0)
1287 LOGF_ERROR(
"%.fx%.f binning is invalid.", values[0], values[1]);
1292 if (!strcmp(np->name,
"HOR_BIN"))
1305 GuideCCD.ImageBinNP.update(values, names,
n);
1334 if (
PrimaryCCD.ImageFrameNP.isNameMatch(name))
1336 int x = -1, y = -1, w = -1, h = -1;
1337 for (
int i = 0; i <
n; i++)
1339 if (!strcmp(names[i],
"X"))
1341 else if (!strcmp(names[i],
"Y"))
1343 else if (!strcmp(names[i],
"WIDTH"))
1345 else if (!strcmp(names[i],
"HEIGHT"))
1351 if (x < 0 || y < 0 || w <= 0 || h <= 0)
1353 LOGF_ERROR(
"Invalid frame requested (%d,%d) (%d x %d)", x, y, w, h);
1371 if (
GuideCCD.ImageFrameNP.isNameMatch(name))
1374 if (
GuideCCD.ImageFrameNP.update(values, names,
n) ==
false)
1380 values[2], values[4]);
1393 if (!strcmp(name,
"CCD_GUIDESTAR"))
1401 if (!strcmp(name,
"GUIDER_GUIDESTAR"))
1424 LOGF_ERROR(
"Error: Bad temperature value! Range is [%.1f, %.1f] [C].",
1430 double nextTemperature = values[0];
1481 LOG_INFO(
"Temperature ramp is disabled.");
1483 LOGF_INFO(
"Temperature ramp is enabled. Gradual cooling and warming is regulated at %.f Celsius per minute.",
1494 if (
PrimaryCCD.ImagePixelSizeNP.isNameMatch(name))
1496 if (
PrimaryCCD.ImagePixelSizeNP.update(values, names,
n))
1514 if (
GuideCCD.ImagePixelSizeNP.isNameMatch(name))
1516 GuideCCD.ImagePixelSizeNP.update(values, names,
n);
1533 m_ValidCCDRotation =
true;
1543 Streamer->ISNewNumber(dev, name, values, names,
n);
1547 DSP->ISNewNumber(dev, name, values, names,
n);
1562 int prevMode =
UploadSP.findOnSwitchIndex();
1569 LOG_INFO(
"Upload settings set to client only.");
1575 LOG_INFO(
"Upload settings set to local only.");
1580 LOG_INFO(
"Upload settings set to client and local.");
1605 LOG_WARN(
"Experimental Feature: After a frame is downloaded, the next frame capture immediately starts to avoid any delays.");
1629 LOG_INFO(
"World Coordinate System is enabled.");
1634 LOG_INFO(
"World Coordinate System is disabled.");
1638 m_ValidCCDRotation =
false;
1657 if (
PrimaryCCD.AbortExposureSP.isNameMatch(name))
1691 if (
GuideCCD.AbortExposureSP.isNameMatch(name))
1699 GuideCCD.ImageExposureNP[0].setValue(0);
1724 if (
GuideCCD.CompressSP.isNameMatch(name))
1726 GuideCCD.CompressSP.update(states, names,
n);
1734 if (
PrimaryCCD.FrameTypeSP.isNameMatch(name))
1745 "The CCD does not have a shutter. Cover the camera in order to take a bias frame.");
1752 "The CCD does not have a shutter. Cover the camera in order to take a dark frame.");
1766 if (
GuideCCD.FrameTypeSP.isNameMatch(name))
1769 GuideCCD.FrameTypeSP.update(states, names,
n);
1778 "The CCD does not have a shutter. Cover the camera in order to take a bias frame.");
1785 "The CCD does not have a shutter. Cover the camera in order to take a dark frame.");
1808 if (previousIndex >= 0)
1817 if (previousIndex >= 0 && m_ConfigCaptureFormatName !=
CaptureFormatSP.findOnSwitch()->getName())
1819 m_ConfigCaptureFormatName =
CaptureFormatSP.findOnSwitch()->getName();
1833 if (m_ConfigEncodeFormatIndex !=
EncodeFormatSP.findOnSwitchIndex())
1844 if (strcmp(name,
PrimaryCCD.RapidGuideSP.name) == 0)
1850 if (RapidGuideEnabled)
1866 if (strcmp(name,
GuideCCD.RapidGuideSP.name) == 0)
1872 if (GuiderRapidGuideEnabled)
1888 if (strcmp(name,
PrimaryCCD.RapidGuideSetupSP.name) == 0)
1902 if (strcmp(name,
GuideCCD.RapidGuideSetupSP.name) == 0)
1918 Streamer->ISNewSwitch(dev, name, states, names,
n);
1922 DSP->ISNewSwitch(dev, name, states, names,
n);
1930bool CCD::ISNewBLOB(
const char *dev,
const char *name,
int sizes[],
int blobsizes[],
char *blobs[],
1931 char *formats[],
char *names[],
int n)
1935 DSP->ISNewBLOB(dev, name, sizes, blobsizes, blobs, formats, names,
n);
2059 double effectiveFocalLength = std::numeric_limits<double>::quiet_NaN();
2060 double effectiveAperture = std::numeric_limits<double>::quiet_NaN();
2062 AutoCNumeric locale;
2063 fitsKeywords.push_back({
"ROWORDER",
"TOP-DOWN",
"Row Order"});
2064 fitsKeywords.push_back({
"INSTRUME",
getDeviceName(),
"Camera Name"});
2080 if (std::isnan(effectiveFocalLength))
2081 LOG_WARN(
"Telescope focal length is missing.");
2082 if (std::isnan(effectiveAperture))
2083 LOG_WARN(
"Telescope aperture is missing.");
2085 double subPixSize1 =
static_cast<double>(targetChip->
getPixelSizeX());
2086 double subPixSize2 =
static_cast<double>(targetChip->
getPixelSizeY());
2087 uint32_t subW = targetChip->
getSubW();
2088 uint32_t subH = targetChip->
getSubH();
2089 uint32_t subBinX = targetChip->
getBinX();
2090 uint32_t subBinY = targetChip->
getBinY();
2092 snprintf(dev_name,
sizeof(dev_name),
"%s",
getDeviceName());
2094 fitsKeywords.push_back({
"EXPTIME",
exposureDuration, 6,
"Total Exposure Time (s)"});
2097 fitsKeywords.push_back({
"DARKTIME",
exposureDuration, 6,
"Total Dark Exposure Time (s)"});
2101 fitsKeywords.push_back({
"CCD-TEMP",
TemperatureNP[0].getValue(), 3,
"CCD Temperature (Celsius)"});
2103 fitsKeywords.push_back({
"PIXSIZE1", subPixSize1, 6,
"Pixel Size 1 (microns)"});
2104 fitsKeywords.push_back({
"PIXSIZE2", subPixSize2, 6,
"Pixel Size 2 (microns)"});
2105 fitsKeywords.push_back({
"XBINNING", targetChip->
getBinX(),
"Binning factor in width"});
2106 fitsKeywords.push_back({
"YBINNING", targetChip->
getBinY(),
"Binning factor in height"});
2108 double xpixsz = subPixSize1 * subBinX;
2109 double ypixsz = subPixSize2 * subBinY;
2110 fitsKeywords.push_back({
"XPIXSZ", xpixsz, 6,
"X binned pixel size in microns"});
2111 fitsKeywords.push_back({
"YPIXSZ", ypixsz, 6,
"Y binned pixel size in microns"});
2116 fitsKeywords.push_back({
"FRAME",
"Light",
"Frame Type"});
2117 fitsKeywords.push_back({
"IMAGETYP",
"Light Frame",
"Frame Type"});
2120 fitsKeywords.push_back({
"FRAME",
"Bias",
"Frame Type"});
2121 fitsKeywords.push_back({
"IMAGETYP",
"Bias Frame",
"Frame Type"});
2124 fitsKeywords.push_back({
"FRAME",
"Flat",
"Frame Type"});
2125 fitsKeywords.push_back({
"IMAGETYP",
"Flat Frame",
"Frame Type"});
2128 fitsKeywords.push_back({
"FRAME",
"Dark",
"Frame Type"});
2129 fitsKeywords.push_back({
"IMAGETYP",
"Dark Frame",
"Frame Type"});
2141 double min_val, max_val;
2142 getMinMax(&min_val, &max_val, targetChip);
2144 fitsKeywords.push_back({
"DATAMIN", min_val, 6,
"Minimum value"});
2145 fitsKeywords.push_back({
"DATAMAX", max_val, 6,
"Maximum value"});
2153 fitsKeywords.push_back({
"BAYERPAT",
BayerTP[
CFA_TYPE].getText(),
"Bayer color pattern"});
2156 if (!std::isnan(effectiveFocalLength))
2157 fitsKeywords.push_back({
"FOCALLEN", effectiveFocalLength, 3,
"Focal Length (mm)"});
2159 if (!std::isnan(effectiveAperture))
2160 fitsKeywords.push_back({
"APTDIA", effectiveAperture, 3,
"Telescope diameter (mm)"});
2162 if (!std::isnan(
MPSAS))
2164 fitsKeywords.push_back({
"MPSAS",
MPSAS, 6,
"Sky Quality (mag per arcsec^2)"});
2169 fitsKeywords.push_back({
"ROTATANG",
RotatorAngle, 3,
"Rotator angle in degrees"});
2174 fitsKeywords.push_back({
"ROTSTEPS",
RotatorPosition, 0,
"Rotator absolute position in steps"});
2181 fitsKeywords.push_back({
"FOCUSPOS",
FocuserPos,
"Focus position in steps"});
2185 fitsKeywords.push_back({
"FOCUSTEM",
FocuserTemp, 3,
"Focuser temperature in degrees C"});
2189 if (!std::isnan(effectiveFocalLength))
2191 double pixScale = subPixSize1 / effectiveFocalLength * 206.3 * subBinX;
2192 fitsKeywords.push_back({
"SCALE", pixScale, 6,
"arcsecs per pixel"});
2206 J2000RA = J2000Pos.rightascension;
2207 J2000DE = J2000Pos.declination;
2218 J2000Pos.declination =
J2000DE;
2235 char ra_str[32] = {0}, de_str[32] = {0};
2240 char * raPtr = ra_str, *dePtr = de_str;
2241 while (*raPtr !=
'\0')
2247 while (*dePtr !=
'\0')
2256 fitsKeywords.push_back({
"SITELAT",
Latitude, 6,
"Latitude of the imaging site in degrees"});
2257 fitsKeywords.push_back({
"SITELONG",
Longitude, 6,
"Longitude of the imaging site in degrees"});
2262 fitsKeywords.push_back({
"AIRMASS",
Airmass, 6,
"Airmass"});
2263 fitsKeywords.push_back({
"OBJCTAZ",
Azimuth, 6,
"Azimuth of center of image in Degrees"});
2264 fitsKeywords.push_back({
"OBJCTALT",
Altitude, 6,
"Altitude of center of image in Degrees"});
2266 fitsKeywords.push_back({
"OBJCTRA", ra_str,
"Object J2000 RA in Hours"});
2267 fitsKeywords.push_back({
"OBJCTDEC", de_str,
"Object J2000 DEC in Degrees"});
2269 fitsKeywords.push_back({
"RA",
J2000RA * 15, 6,
"Object J2000 RA in Degrees"});
2270 fitsKeywords.push_back({
"DEC",
J2000DE, 6,
"Object J2000 DEC in Degrees"});
2276 fitsKeywords.push_back({
"PIERSIDE",
"WEST",
"West, looking East"});
2279 fitsKeywords.push_back({
"PIERSIDE",
"EAST",
"East, looking West"});
2284 fitsKeywords.push_back({
"EQUINOX", 2000,
"Equinox"});
2289 double J2000RAHours =
J2000RA * 15;
2290 fitsKeywords.push_back({
"CRVAL1", J2000RAHours, 10,
"CRVAL1"});
2291 fitsKeywords.push_back({
"CRVAL2",
J2000DE, 10,
"CRVAL1"});
2293 char radecsys[8] =
"FK5";
2294 char ctype1[16] =
"RA---TAN";
2295 char ctype2[16] =
"DEC--TAN";
2297 fitsKeywords.push_back({
"RADECSYS", radecsys,
"RADECSYS"});
2298 fitsKeywords.push_back({
"CTYPE1", ctype1,
"CTYPE1"});
2299 fitsKeywords.push_back({
"CTYPE2", ctype2,
"CTYPE2"});
2301 double crpix1 = subW / subBinX / 2.0;
2302 double crpix2 = subH / subBinY / 2.0;
2304 fitsKeywords.push_back({
"CRPIX1", crpix1, 10,
"CRPIX1"});
2305 fitsKeywords.push_back({
"CRPIX2", crpix2, 10,
"CRPIX2"});
2307 double secpix1 = subPixSize1 / effectiveFocalLength * 206.3 * subBinX;
2308 double secpix2 = subPixSize2 / effectiveFocalLength * 206.3 * subBinY;
2310 fitsKeywords.push_back({
"SECPIX1", secpix1, 10,
"SECPIX1"});
2311 fitsKeywords.push_back({
"SECPIX2", secpix2, 10,
"SECPIX2"});
2313 double degpix1 = secpix1 / 3600.0;
2314 double degpix2 = secpix2 / 3600.0;
2316 fitsKeywords.push_back({
"CDELT1", degpix1, 10,
"CDELT1"});
2317 fitsKeywords.push_back({
"CDELT2", degpix2, 10,
"CDELT2"});
2324 fitsKeywords.push_back({
"CROTA1", rotation, 10,
"CROTA1"});
2325 fitsKeywords.push_back({
"CROTA2", rotation, 10,
"CROTA2"});
2327 double rotationRad = rotation / 180.0 *
M_PI;
2328 fitsKeywords.push_back({
"CD1_1", std::cos(rotationRad) * degpix1, 10,
"CD1_1"});
2329 fitsKeywords.push_back({
"CD1_2",-std::sin(rotationRad) * degpix2, 10,
"CD1_2"});
2330 fitsKeywords.push_back({
"CD2_1", std::sin(rotationRad) * degpix1, 10,
"CD2_1"});
2331 fitsKeywords.push_back({
"CD2_2", std::cos(rotationRad) * degpix2, 10,
"CD2_2"});
2335 fitsKeywords.push_back({
"DATE-OBS",
exposureStartTime,
"UTC start date of observation"});
2338 for (
auto &record : m_CustomFITSKeywords)
2339 fitsKeywords.push_back(record.second);
2341 fitsKeywords.push_back(
FITSRecord(
"Generated by INDI"));
2351 fits_update_key(fptr,
type, name.c_str(), p,
const_cast<char *
>(explanation.c_str()), status);
2363 std::thread(&CCD::ExposureCompletePrivate,
this, targetChip).detach();
2371bool CCD::ExposureCompletePrivate(
CCDChip * targetChip)
2396 sendImage = saveImage =
false;
2398 if (sendImage || saveImage)
2407 long naxis = targetChip->
getNAxis();
2415 switch (targetChip->
getBPP())
2419 img_type = BYTE_IMG;
2423 byte_type = TUSHORT;
2424 img_type = USHORT_IMG;
2429 img_type = ULONG_IMG;
2437 nelements = naxes[0] * naxes[1];
2450 uint32_t size = 8640 + nelements * (targetChip->
getBPP() / 8);
2454 fits_report_error(stderr, status);
2455 fits_get_errstatus(status, error_status);
2462 fits_create_img(fptr, img_type, naxis, naxes, &status);
2466 fits_report_error(stderr, status);
2467 fits_get_errstatus(status, error_status);
2473 std::vector<FITSRecord> fitsKeywords;
2477 for (
auto &keyword : fitsKeywords)
2480 switch(keyword.type())
2485 fits_write_comment(fptr, keyword.comment().c_str(), &key_status);
2488 fits_update_key_str(fptr, keyword.key().c_str(), keyword.valueString().c_str(), keyword.comment().c_str(), &key_status);
2491 fits_update_key_lng(fptr, keyword.key().c_str(), keyword.valueInt(), keyword.comment().c_str(), &key_status);
2494 fits_update_key_dbl(fptr, keyword.key().c_str(), keyword.valueDouble(), keyword.decimal(), keyword.comment().c_str(),
2500 fits_get_errstatus(key_status, error_status);
2501 LOGF_ERROR(
"FITS key %s Error: %s", keyword.key().c_str(), error_status);
2505 fits_write_img(fptr, byte_type, 1, nelements, targetChip->
getFrameBuffer(), &status);
2509 fits_report_error(stderr, status);
2510 fits_get_errstatus(status, error_status);
2533 std::vector<FITSRecord> fitsKeywords;
2539 AutoCNumeric locale;
2540 LibXISF::Image image;
2541 LibXISF::XISFWriter xisfWriter;
2543 for (
auto &keyword : fitsKeywords)
2545 image.addFITSKeyword({keyword.key().c_str(), keyword.valueString().c_str(), keyword.comment().c_str()});
2546 image.addFITSKeywordAsProperty(keyword.key().c_str(), keyword.valueString());
2551 targetChip->
getNAxis() == 2 ? 1 : 3);
2552 switch(targetChip->
getBPP())
2555 image.setSampleFormat(LibXISF::Image::UInt8);
2558 image.setSampleFormat(LibXISF::Image::UInt16);
2561 image.setSampleFormat(LibXISF::Image::UInt32);
2571 image.setImageType(LibXISF::Image::Light);
2574 image.setImageType(LibXISF::Image::Bias);
2577 image.setImageType(LibXISF::Image::Dark);
2580 image.setImageType(LibXISF::Image::Flat);
2584 if (targetChip->SendCompressed)
2586 if(LibXISF::DataBlock::CompressionCodecSupported(LibXISF::DataBlock::ZSTD))
2587 image.setCompression(LibXISF::DataBlock::ZSTD);
2589 image.setCompression(LibXISF::DataBlock::LZ4);
2590 image.setByteshuffling(targetChip->
getBPP() / 8);
2594 image.setColorFilterArray({2, 2,
BayerTP[2].getText()});
2598 image.setColorSpace(LibXISF::Image::RGB);
2602 std::memcpy(image.imageData(), targetChip->
getFrameBuffer(), image.imageDataSize());
2603#ifdef HAVE_XISF_ASTROMETRIC_SOLUTION
2604 image.convertWCSToAstrometricSolution();
2606 xisfWriter.writeImage(image);
2608 LibXISF::ByteArray xisfFile;
2609 xisfWriter.save(xisfFile);
2610 bool rc = uploadFile(targetChip, xisfFile.data(), xisfFile.size(), sendImage, saveImage);
2617 catch (LibXISF::Error &error)
2652bool CCD::uploadFile(
CCDChip * targetChip,
const void * fitsData,
size_t totalBytes,
bool sendImage,
2655 uint8_t * compressedData =
nullptr;
2658 targetChip->getImageExtension(), totalBytes, sendImage ?
"Yes" :
"No", saveImage ?
"Yes" :
"No");
2662 targetChip->FitsBP[0].setBlob(
const_cast<void *
>(fitsData));
2663 targetChip->FitsBP[0].setBlobLen(totalBytes);
2664 std::string format =
"." + std::string(targetChip->getImageExtension());
2665 targetChip->FitsBP[0].setFormat(format);
2666 FILE * fp =
nullptr;
2674 if (
const char * home = getenv(
"HOME"))
2677 int maxIndex = getFileIndex(directory, prefix,
2678 targetChip->FitsBP[0].getFormat());
2682 LOGF_ERROR(
"Error iterating directory %s. %s", directory.c_str(),
2689 auto now = std::chrono::system_clock::now();
2690 std::time_t time = std::chrono::system_clock::to_time_t(now);
2691 std::tm* now_tm = std::localtime(&time);
2692 long long timestamp = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
2694 std::stringstream stream;
2696 stream << std::setfill(
'0')
2697 << std::put_time(now_tm,
"%FT%H-%M-")
2698 << std::setw(2) << (timestamp / 1000) % 60 <<
'.'
2699 << std::setw(3) << timestamp % 1000;
2701 prefix = std::regex_replace(prefix, std::regex(
"ISO8601"), stream.str());
2703 char indexString[8];
2704 snprintf(indexString, 8,
"%03d", maxIndex);
2705 std::string prefixIndex = indexString;
2707 prefix = std::regex_replace(prefix, std::regex(
"XXX"), prefixIndex);
2710 std::string imageFileName = directory +
"/" + prefix + std::string(
2711 targetChip->FitsBP[0].getFormat());
2713 fp = fopen(imageFileName.c_str(),
"w");
2716 LOGF_ERROR(
"Unable to save image file (%s). %s", imageFileName.c_str(), strerror(
errno));
2721 auto len = targetChip->FitsBP[0].getBlobLen();
2722 auto buffer =
static_cast<char *
>(targetChip->FitsBP[0].getBlob());
2723 for (
int nr = 0; nr < len; nr +=
n)
2724 n = fwrite(buffer + nr, 1, len - nr, fp);
2731 LOGF_INFO(
"Image saved to %s", imageFileName.c_str());
2742 size_t compressedBytes = 0;
2744 if (
fp_pack_data_to_data(
reinterpret_cast<const char *
>(fitsData), totalBytes, &compressedData, &compressedBytes, fpvar,
2747 free(compressedData);
2748 LOG_ERROR(
"Error: Ran out of memory compressing image");
2752 targetChip->FitsBP[0].setBlob(compressedData);
2753 targetChip->FitsBP[0].setBlobLen(compressedBytes);
2754 std::string format =
"." + std::string(targetChip->getImageExtension()) +
".fz";
2755 targetChip->FitsBP[0].setFormat(format);
2759 uLong compressedBytes =
sizeof(char) * totalBytes + totalBytes / 64 + 16 + 3;
2760 compressedData =
new uint8_t[compressedBytes];
2762 if (fitsData ==
nullptr || compressedData ==
nullptr)
2765 delete [] compressedData;
2766 LOG_ERROR(
"Error: Ran out of memory compressing image");
2770 int r = compress2(compressedData, &compressedBytes, (
const Bytef *)fitsData, totalBytes, 9);
2774 LOG_ERROR(
"Error: Failed to compress image");
2775 delete [] compressedData;
2779 targetChip->FitsBP[0].setBlob(compressedData);
2780 targetChip->FitsBP[0].setBlobLen(compressedBytes);
2781 std::string format =
"." + std::string(targetChip->getImageExtension()) +
".z";
2782 targetChip->FitsBP[0].setFormat(format);
2788 targetChip->FitsBP[0].setBlob(
const_cast<void *
>(fitsData));
2789 targetChip->FitsBP[0].setBlobLen(totalBytes);
2790 std::string format =
"." + std::string(targetChip->getImageExtension());
2791 targetChip->FitsBP[0].setFormat(format);
2794 targetChip->FitsBP[0].setSize(totalBytes);
2795 targetChip->FitsBP.setState(
IPS_OK);
2799 auto start = std::chrono::high_resolution_clock::now();
2800 targetChip->FitsBP.apply();
2801 auto end = std::chrono::high_resolution_clock::now();
2802 std::chrono::duration<double> diff =
end - start;
2803 LOGF_DEBUG(
"BLOB transfer took %g seconds", diff.count());
2807 delete [] compressedData;
2836 auto end = std::chrono::system_clock::now();
2861 LOGF_ERROR(
"Rapid exposure not possible since upload time is %.2f seconds while exposure time is %.2f seconds.",
2954 DSP->saveConfigItems(fp);
2967 LOG_ERROR(
"The CCD does not support guiding.");
2977 LOG_ERROR(
"The CCD does not support guiding.");
2987 LOG_ERROR(
"The CCD does not support guiding.");
2997 LOG_ERROR(
"The CCD does not support guiding.");
3004void CCD::getMinMax(
double *
min,
double *
max,
CCDChip * targetChip)
3009 double lmin = 0, lmax = 0;
3011 switch (targetChip->
getBPP())
3016 lmin = lmax = imageBuffer[0];
3018 for (i = 0; i < imageHeight; i++)
3019 for (j = 0; j < imageWidth; j++)
3021 ind = (i * imageWidth) + j;
3022 if (imageBuffer[ind] < lmin)
3023 lmin = imageBuffer[ind];
3024 else if (imageBuffer[ind] > lmax)
3025 lmax = imageBuffer[ind];
3032 uint16_t * imageBuffer =
reinterpret_cast<uint16_t*
>(targetChip->
getFrameBuffer());
3033 lmin = lmax = imageBuffer[0];
3035 for (i = 0; i < imageHeight; i++)
3036 for (j = 0; j < imageWidth; j++)
3038 ind = (i * imageWidth) + j;
3039 if (imageBuffer[ind] < lmin)
3040 lmin = imageBuffer[ind];
3041 else if (imageBuffer[ind] > lmax)
3042 lmax = imageBuffer[ind];
3049 uint32_t * imageBuffer =
reinterpret_cast<uint32_t*
>(targetChip->
getFrameBuffer());
3050 lmin = lmax = imageBuffer[0];
3052 for (i = 0; i < imageHeight; i++)
3053 for (j = 0; j < imageWidth; j++)
3055 ind = (i * imageWidth) + j;
3056 if (imageBuffer[ind] < lmin)
3057 lmin = imageBuffer[ind];
3058 else if (imageBuffer[ind] > lmax)
3059 lmax = imageBuffer[ind];
3073 std::stringstream s;
3074 std::regex_replace(std::ostreambuf_iterator<char>(s), input.begin(), input.end(), std::regex(pattern), replace);
3081int CCD::getFileIndex(
const std::string &dir,
const std::string &prefix,
const std::string &ext)
3088 LOG_ERROR(
"Upload directory is not set. Please configure the upload directory.");
3092 DIR * dpdf =
nullptr;
3093 struct dirent * epdf =
nullptr;
3094 std::vector<std::string> files = std::vector<std::string>();
3096 std::string prefixIndex = prefix;
3103 if (stat(dir.c_str(), &st) == -1)
3105 if (
errno == ENOENT)
3107 LOGF_INFO(
"Creating directory %s...", dir.c_str());
3109 LOGF_ERROR(
"Error creating directory %s (%s)", dir.c_str(), strerror(
errno));
3113 LOGF_ERROR(
"Couldn't stat directory %s: %s", dir.c_str(), strerror(
errno));
3118 dpdf = opendir(dir.c_str());
3119 if (dpdf !=
nullptr)
3121 while ((epdf = readdir(dpdf)))
3124 if (strcmp(epdf->d_name,
".") == 0 || strcmp(epdf->d_name,
"..") == 0)
3127 if (prefixIndex.empty() || strstr(epdf->d_name, prefixIndex.c_str()))
3128 files.push_back(epdf->d_name);
3135 for (uint32_t i = 0; i < files.size(); i++)
3139 std::string file = files.at(i);
3140 std::size_t start = file.find_last_of(
"_");
3141 std::size_t
end = file.find_last_of(
".");
3142 if (start != std::string::npos && end != std::string::npos && end > start)
3144 index = atoi(file.substr(start + 1, end - start - 1).c_str());
3145 if (index > maxIndex)
3151 return (maxIndex + 1);
3167 LOG_ERROR(
"Streaming is not supported.");
3176 LOG_ERROR(
"Streaming is not supported.");
3213 long minTimeToTarget_ms =
static_cast<long>((tempDelta / rampSlope) * 60000);
3225 LOGF_INFO(
"Temperature stabilized at %.2f°C (target %.2f°C not reachable, likely limited by ambient temperature).",
3242 double nextTemperature = 0;
3268 return format.name == oneFormat.name;
3277 const bool isOn = (format.
name == m_ConfigCaptureFormatName) || (m_ConfigCaptureFormatName.empty() && format.
isDefault);
const char * getDeviceName() const
INDI::PropertyText getText(const char *name) const
The CCDChip class provides functionality of a CCD Chip within a CCD.
void setExposureComplete()
setExposureComplete Mark exposure as complete by setting ImageExposure property to IPS_OK
char * getImageExtension()
bool finishFITSFile(int &status)
Finish any pending write to fits file.
float getPixelSizeY() const
getPixelSizeY Get vertical pixel size in microns.
int getSubH() const
getSubH Get the height of the frame
double getExposureDuration() const
getExposureDuration Get requested exposure duration for the CCD chip in seconds.
int getBPP() const
getBPP Get CCD Chip depth (bits per pixel).
const char * getExposureStartTime()
getExposureStartTime
CCD_FRAME getFrameType() const
isInterlaced
int getBinY() const
getBinY Get vertical binning of the CCD chip.
void closeFITSFile()
closeFITSFile Close the in-memory FITS File.
float getPixelSizeX() const
getPixelSizeX Get horizontal pixel size in microns.
int getXRes() const
getXRes Get the horizontal resolution in pixels of the CCD Chip.
int getBinX() const
getBinX Get horizontal binning of the CCD chip.
void setImageExtension(const char *ext)
setImageExtension Set image extension
size_t * fitsMemorySizePointer()
uint8_t * getFrameBuffer()
getFrameBuffer Get raw frame buffer of the CCD chip.
void setExposureFailed()
setExposureFailed Alert the client that the exposure failed.
int getSubW() const
getSubW Get the width of the frame
int getFrameBufferSize() const
getFrameBufferSize Get allocated frame buffer size to hold the CCD image frame.
void ** fitsMemoryBlockPointer()
int getYRes() const
Get the vertical resolution in pixels of the CCD Chip.
fitsfile ** fitsFilePointer()
bool openFITSFile(uint32_t size, int &status)
openFITSFile Allocate memory buffer for internal FITS file structure and open
static constexpr const char * WCS_TAB
double m_InitialRampTemperature
virtual bool StartExposure(float duration)
Start exposing primary CCD chip.
virtual bool processFastExposure(CCDChip *targetChip)
processFastExposure After an exposure is complete, check if fast exposure was enabled....
std::chrono::system_clock::time_point FastExposureToggleStartup
INDI::PropertySwitch UploadSP
INDI::PropertySwitch WorldCoordSP
std::unique_ptr< StreamManager > Streamer
double GuiderExposureTime
void fits_update_key_s(fitsfile *fptr, int type, std::string name, void *p, std::string explanation, int *status)
virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n) override
Process the client newBLOB command.
double m_TemperatureStabilizationValue
INDI::PropertyNumber EqNP
Properties.
INDI::Timer m_TemperatureCheckTimer
static constexpr const char * GUIDE_CONTROL_TAB
Group Names.
INDI::PropertyNumber CCDRotationNP
virtual void activeDevicesUpdated()
activeDevicesUpdated Inform children that ActiveDevices property was updated so they can snoop on the...
INDI::PropertyNumber FastExposureCountNP
INDI::PropertyText ActiveDeviceTP
ActiveDeviceTP defines 4 devices the camera driver can listen to (snoop) for properties of interest s...
virtual bool UpdateCCDFrame(int x, int y, int w, int h)
CCD calls this function when CCD Frame dimension needs to be updated in the hardware....
virtual void addFITSKeywords(CCDChip *targetChip, std::vector< FITSRecord > &fitsKeywords)
Generate FITS keywords that will be added to FIST/XISF file.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
INDI::PropertyNumber TemperatureRampNP
Temperature Ramp in C/Min with configurable threshold.
virtual bool ExposureComplete(CCDChip *targetChip)
Uploads target Chip exposed buffer as FITS to the client. Derived classes should class this function ...
virtual IPState GuideWest(uint32_t ms) override
Guide westward for ms milliseconds.
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
INDI::PropertyNumber TemperatureNP
TemperatureNP Camera Temperature in Celcius.
virtual int SetTemperature(double temperature)
Set CCD temperature.
INDI::PropertyNumber ScopeInfoNP
INDI::PropertyNumber J2000EqNP
J200EqNP Snoop property to read the equatorial J2000 coordinates of the mount. ActiveDeviceTP defines...
INDI::PropertyText FITSHeaderTP
virtual bool UpdateGuiderFrame(int x, int y, int w, int h)
CCD calls this function when Guide head frame dimension is updated by the client. Derived classes sho...
virtual bool UpdateCCDBin(int hor, int ver)
CCD calls this function when CCD Binning needs to be updated in the hardware. Derived classes should ...
INDI::PropertySwitch FastExposureToggleSP
INDI::PropertySwitch EncodeFormatSP
Specifies Driver image encoding format (FITS, Native, JPG, ..etc).
virtual IPState GuideSouth(uint32_t ms) override
Guide southward for ms milliseconds.
virtual bool SetCaptureFormat(uint8_t index)
SetCaptureFormat Set Active Capture format.
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool StartGuideExposure(float duration)
Start exposing guide CCD chip.
virtual bool AbortExposure()
Abort ongoing exposure.
virtual IPState GuideNorth(uint32_t ms) override
Guide northward for ms milliseconds.
INDI::PropertyText BayerTP
BayerTP Bayer pattern offset and type.
char exposureStartTime[MAXINDINAME]
virtual bool StartStreaming()
StartStreaming Start live video streaming.
virtual bool UpdateGuiderFrameType(CCDChip::CCD_FRAME fType)
CCD calls this function when Guide frame type is updated by the client.
INDI::PropertyText UploadSettingsTP
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual IPState GuideEast(uint32_t ms) override
Guide easward for ms milliseconds.
virtual void addCaptureFormat(const CaptureFormat &format)
addCaptureFormat Add a supported camera native capture format (e.g. Mono, Bayer8.....
virtual void checkTemperatureTarget()
checkTemperatureTarget Checks the current temperature against target temperature and calculates the n...
INDI::PropertyText FileNameTP
FileNameTP File name of locally-saved images. By default, images are uploaded to the client but when ...
std::vector< std::string > FilterNames
virtual void SetGuiderParams(int x, int y, int bpp, float xf, float yf)
Setup CCD parameters for guide head CCD. Child classes call this function to update CCD parameters.
INDI::ElapsedTimer m_TemperatureElapsedTimer
virtual bool UpdateGuiderBin(int hor, int ver)
CCD calls this function when Guide head binning is updated by the client. Derived classes should impl...
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save configuration items in XML file.
virtual void GuideComplete(INDI_EQ_AXIS axis) override
GuideComplete Signal guide pulse completion.
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
virtual void UploadComplete(CCDChip *)
UploadComplete Signal that capture is completed and image was uploaded and/or saved successfully.
INDI::PropertySwitch CaptureFormatSP
Specifies Camera NATIVE capture format (e.g. Mono, RGB, RAW8..etc).
void SetCCDCapability(uint32_t cap)
SetCCDCapability Set the CCD capabilities. All fields must be initialized.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool UpdateCCDFrameType(CCDChip::CCD_FRAME fType)
CCD calls this function when CCD frame type needs to be updated in the hardware.
INDI::ElapsedTimer m_TemperatureRampTimer
virtual void SetCCDParams(int x, int y, int bpp, float xf, float yf)
Setup CCD parameters for primary CCD. Child classes call this function to update CCD parameters.
virtual bool UpdateCCDUploadMode(CCD_UPLOAD_MODE mode)
CCD calls this function when client upload mode switch is updated.
virtual bool StopStreaming()
StopStreaming Stop live video streaming.
double snoopedFocalLength
std::vector< CaptureFormat > m_CaptureFormats
double m_TargetTemperature
INDI::ElapsedTimer m_TemperatureStabilizationTimer
virtual bool AbortGuideExposure()
Abort ongoing exposure.
void addPollPeriodControl()
Add Polling period control to the driver.
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
void setCurrentPollingPeriod(uint32_t msec)
setCurrentPollingPeriod Change the current polling period to call TimerHit() function in the driver.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process the client newSwitch command.
virtual void ISGetProperties(const char *dev)
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual bool ISSnoopDevice(XMLEle *root)
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
void setDriverInterface(uint32_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
uint32_t getPollingPeriod() const
getPollingPeriod Return the polling period.
void defineProperty(INumberVectorProperty *property)
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
uint32_t getCurrentPollingPeriod() const
getCurrentPollingPeriod Return the current polling period.
virtual bool initProperties()
Initialize properties initial state and value. The child class must implement this function.
void syncDriverInfo()
syncDriverInfo sends the current driver information to the client.
uint32_t getDriverInterface() const
virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
Process the client newBLOB command.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process the client newNumber command.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process the client newSwitch command.
virtual void GuideComplete(INDI_EQ_AXIS axis)
Call GuideComplete once the guiding pulse is complete.
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
void initProperties(const char *groupName)
Initialize guider properties. It is recommended to call this function within initProperties() of your...
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Call this function whenever client updates GuideNSNP or GuideWSP properties in the primary device....
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
const char * INFO_TAB
INFO_TAB Where all the properties for general information are located.
const char * OPTIONS_TAB
OPTIONS_TAB Where all the driver's options are located. Those may include auxiliary controls,...
int fp_pack_data_to_data(const char *inputBuffer, size_t inputBufferSize, unsigned char **outputBuffer, size_t *outputBufferSize, fpstate fpvar, int *islossless)
int fp_init(fpstate *fpptr)
const char * IMAGE_SETTINGS_TAB
std::string join(std::vector< std::string > const &strings, std::string delim)
const char * IMAGE_INFO_TAB
const char * GUIDE_HEAD_TAB
int fs_sexa(char *out, double a, int w, int fracbase)
Converts a sexagesimal number to a string. sprint the variable a in sexagesimal format into out[].
Implementations for common driver routines.
void IUFillNumberVector(INumberVectorProperty *nvp, INumber *np, int nnp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a number vector property. The vector's auxiliary elements will be set to NULL.
void IUFillSwitch(ISwitch *sp, const char *name, const char *label, ISState s)
Assign attributes for a switch property. The switch's auxiliary elements will be set to NULL.
void IUFillNumber(INumber *np, const char *name, const char *label, const char *format, double min, double max, double step, double value)
Assign attributes for a number property. The number's auxiliary elements will be set to NULL.
void IUFillSwitchVector(ISwitchVectorProperty *svp, ISwitch *sp, int nsp, const char *dev, const char *name, const char *label, const char *group, IPerm p, ISRule r, double timeout, IPState s)
Assign attributes for a switch vector property. The vector's auxiliary elements will be set to NULL.
int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
Update all switches in a switch vector property.
void IDSetNumber(const INumberVectorProperty *nvp, const char *fmt,...)
void IDSetSwitch(const ISwitchVectorProperty *svp, const char *fmt,...)
int IUGetConfigOnSwitchName(const char *dev, const char *property, char *name, size_t size)
IUGetConfigOnSwitchLabel Opens configuration file and returns the name of the ON switch property,...
void IDSnoopDevice(const char *snooped_device, const char *snooped_property)
Function a Driver calls to snoop on another Device. Snooped messages will then arrive via ISSnoopDevi...
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
int IUGetConfigOnSwitchIndex(const char *dev, const char *property, int *index)
IUGetConfigOnSwitchIndex Opens configuration file and reads single switch property to find ON switch ...
*brief user defined string literal for JSON values *sa std::size_t n
#define LOGF_INFO(fmt,...)
#define DEBUG(priority, msg)
Macro to print log messages. Example of usage of the Logger: DEBUG(DBG_DEBUG, "hello " << "world");.
#define LOGF_DEBUG(fmt,...)
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
#define LOGF_ERROR(fmt,...)
#define DEBUGF(priority, msg,...)
const char * findXMLAttValu(XMLEle *ep, const char *name)
Find an XML element's attribute value.
XMLEle * nextXMLEle(XMLEle *ep, int init)
Iterate an XML element for a list of nesetd XML elements.
char * pcdataXMLEle(XMLEle *ep)
Return the pcdata of an XML element.
std::vector< uint8_t > buffer
The DSP Namespace adds signal processing to INDI drivers. Primarily written for sensors and detectors...
Namespace to encapsulate INDI client, drivers, and mediator classes.
void J2000toObserved(IEquatorialCoordinates *J2000pos, double jd, IEquatorialCoordinates *observed)
*J2000toObserved converts catalogue to observed
void EquatorialToHorizontal(IEquatorialCoordinates *object, IGeographicCoordinates *observer, double JD, IHorizontalCoordinates *position)
EquatorialToHorizontal Calculate horizontal coordinates from equatorial coordinates.
void ObservedToJ2000(IEquatorialCoordinates *observed, double jd, IEquatorialCoordinates *J2000pos)
ObservedToJ2000 converts an observed position to a J2000 catalogue position removes aberration,...
std::string regex_replace_compat(const std::string &input, const std::string &pattern, const std::string &replace)
void replace_all(std::string &subject, const std::string &search, const std::string &replace)
int mkpath(std::string s, mode_t mode)
@ error
throw a parse_error exception in case of a tag
*brief create JSON pointer *sa reference_tokens end()