31 #include <libnova/julian_day.h>
32 #include <libnova/sidereal_time.h>
33 #include <libnova/transform.h>
43 #define DOME_SLAVING_TAB "Slaving"
44 #define DOME_COORD_THRESHOLD \
50 Dome::Dome() : ParkDataFileName(GetHomeDirectory() +
"/.indi/ParkData.xml")
66 ParkdataXmlRoot =
nullptr;
80 std::string Dome::GetHomeDirectory()
const
83 const char * HomeDir = getenv(
"HOME");
88 HomeDir = getpwuid(getuid())->pw_dir;
90 return (HomeDir ? std::string(HomeDir) :
"");
107 IUFillSwitchVector(&
PresetGotoSP,
PresetGotoS, 3,
getDeviceName(),
"Goto",
"",
"Presets",
IP_RW,
ISR_1OFMANY, 0,
138 -10.0, 10.0, 1.0, 0.0);
186 IUFillNumber(&
DomeParamN[0],
"AUTOSYNC_THRESHOLD",
"Autosync threshold (deg)",
"%6.2f", 0.0, 360.0, 1.0, 0.5);
241 return callHandshake();
251 return callHandshake();
390 bool Dome::ISNewNumber(
const char * dev,
const char * name,
double values[],
char * names[],
int n)
430 double newSpeed = values[0];
436 double newPos = values[0];
442 double newPos = values[0];
475 uint32_t steps =
static_cast<uint32_t
>(values[0]);
504 "Please unpark before issuing any motion commands.");
516 LOGF_INFO(
"Moving to Preset %d (%.2f degrees).", index + 1,
PresetN[index].value);
536 LOG_WARN(
"Dome will now be synced to mount azimuth position.");
539 m_MountUpdateTimer.
start(HORZ_UPDATE_TIMER);
544 LOG_WARN(
"Dome is no longer synced to mount azimuth position.");
545 m_MountUpdateTimer.
stop();
563 LOG_WARN(
"Dome shall be synced assuming OTA situated east of the pier");
567 LOG_WARN(
"Dome shall be synced assuming OTA situated west of the pier");
571 LOG_WARN(
"Dome shall be synced from pier side as reported by the mount.");
575 LOG_WARN(
"Dome shall be synced for OTA pier side derived from Hour Angle.");
580 LOG_WARN(
"Dome shall be synced by ignoring pier side as in a fork mount.");
593 for (
int i = 0; i < n; i++)
609 if (current_direction < 0)
634 for (
int i = 0; i < n; i++)
656 for (
int i = 0; i < n; i++)
660 if (!strcmp(
ParkS[0].name, names[i]))
691 if (!strcmp(sp->name,
"PARK_CURRENT"))
695 else if (!strcmp(sp->name,
"PARK_DEFAULT"))
699 else if (!strcmp(sp->name,
"PARK_WRITE_DATA"))
705 LOG_WARN(
"Can not save Park Status/Position.");
717 else if (!strcmp(name, AutoParkSP.name))
723 if (AutoParkS[0].s ==
ISS_ON)
724 LOG_WARN(
"Warning: Auto park is enabled. If weather conditions are in the "
725 "danger zone, the dome will be automatically parked. Only enable this "
726 "option is parking the dome at any time will not cause damage to any "
744 LOG_INFO(
"Mount Policy set to: Mount ignored. Dome can park regardless of mount parking state.");
746 LOG_WARN(
"Mount Policy set to: Mount locks. This prevents the dome from parking when mount is unparked.");
774 LOGF_INFO(
"Dome backlash is %s.", (enabled ?
"enabled" :
"disabled"));
781 LOG_ERROR(
"Failed to set trigger Dome backlash.");
789 controller->
ISNewSwitch(dev, name, states, names, n);
795 bool Dome::ISNewText(
const char * dev,
const char * name,
char * texts[],
char * names[],
int n)
817 controller->
ISNewText(dev, name, texts, names, n);
828 if (!strcmp(
"TARGET_EOD_COORD", propName))
830 int rc_ra = -1, rc_de = -1;
831 double ra = 0, de = 0;
838 if (!strcmp(elemName,
"RA"))
840 else if (!strcmp(elemName,
"DEC"))
846 if (rc_ra == 0 && rc_de == 0)
856 LOGF_DEBUG(
"Calling Update mount to anticipate goto target: %g - DEC: %g",
860 UseHourAngle =
false;
867 if (!strcmp(
"EQUATORIAL_EOD_COORD", propName))
869 int rc_ra = -1, rc_de = -1;
870 double ra = 0, de = 0;
876 if (!strcmp(elemName,
"RA"))
878 else if (!strcmp(elemName,
"DEC"))
882 if (rc_ra == 0 && rc_de == 0)
888 char RAStr[64] = {0}, DEStr[64] = {0};
892 LOGF_DEBUG(
"Snooped RA %s DEC %s", RAStr, DEStr);
922 if (!strcmp(
"GEOGRAPHIC_COORD", propName))
927 if (!strcmp(elemName,
"LONG"))
936 else if (!strcmp(elemName,
"LAT"))
948 if (!strcmp(
"TELESCOPE_PARK", propName))
952 bool prevState = IsLocked;
957 if ((!strcmp(elemName,
"PARK") && !strcmp(
pcdataXMLEle(ep),
"On")))
958 IsMountParked =
true;
959 else if ((!strcmp(elemName,
"UNPARK") && !strcmp(
pcdataXMLEle(ep),
"On")))
960 IsMountParked =
false;
962 if (IsLocked && !strcmp(elemName,
"PARK") && !strcmp(
pcdataXMLEle(ep),
"On"))
964 else if (!IsLocked && !strcmp(elemName,
"UNPARK") && !strcmp(
pcdataXMLEle(ep),
"On"))
968 LOGF_INFO(
"Telescope status changed. Lock is set to: %s",
969 IsLocked ?
"locked" :
"unlocked");
977 if (!strcmp(
"WEATHER_STATUS", propName))
988 if (AutoParkS[0].s ==
ISS_ON)
990 LOG_WARN(
"Weather conditions in the danger zone! Parking dome...");
995 LOG_WARN(
"Weather conditions in the danger zone! AutoPark is disabled. Please park the dome!");
1000 LOG_WARN(
"Weather conditions in the danger zone! Close the dome immediately!");
1006 if (!strcmp(
"TELESCOPE_PIER_SIDE", propName))
1013 if (!strcmp(elemName,
"PIER_EAST") && !strcmp(
pcdataXMLEle(ep),
"On"))
1015 else if (!strcmp(elemName,
"PIER_WEST") && !strcmp(
pcdataXMLEle(ep),
"On"))
1030 LOG_ERROR(
"Dome does not support backlash compensation.");
1071 void Dome::triggerSnoop(
const char * driverName,
const char * snoopedProp)
1073 LOGF_DEBUG(
"Active Snoop, driver: %s, property: %s", driverName, snoopedProp);
1084 static_cast<Dome *
>(context)->processButton(button_n, state);
1087 void Dome::processButton(
const char * button_n,
ISState state)
1094 if (!strcmp(button_n,
"Dome CW"))
1101 else if (!strcmp(button_n,
"Dome CCW"))
1108 else if (!strcmp(button_n,
"Dome Abort"))
1148 LOG_WARN(
"Unknown shutter status.");
1275 point3D MountCenter, OptCenter, OptVector, DomeIntersect;
1282 LOG_WARN(
"Geographic coordinates are not yet defined, triggering snoop...");
1286 double JD = ln_get_julian_from_sys();
1287 double MSD = ln_get_mean_sidereal_time(JD);
1295 LOGF_DEBUG(
"MC.x: %g - MC.y: %g MC.z: %g", MountCenter.
x, MountCenter.
y, MountCenter.
z);
1329 LOGF_DEBUG(
"OC.x: %g - OC.y: %g OC.z: %g", OptCenter.
x, OptCenter.
y, OptCenter.
z);
1337 LOGF_DEBUG(
"OV.x: %g - OV.y: %g OV.z: %g", OptVector.
x, OptVector.
y, OptVector.
z);
1346 double HalfApertureChordAngle;
1349 DomeIntersect.
x = OptCenter.
x + mu1 * (OptVector.
x );
1350 DomeIntersect.
y = OptCenter.
y + mu1 * (OptVector.
y );
1351 DomeIntersect.
z = OptCenter.
z + mu1 * (OptVector.
z );
1353 if (fabs(DomeIntersect.
x) > 0.00001)
1355 yx = DomeIntersect.
y / DomeIntersect.
x;
1356 Az = 90 - 180 * atan(yx) / M_PI;
1357 if (DomeIntersect.
x < 0)
1369 if (DomeIntersect.
y > 0)
1375 if ((fabs(DomeIntersect.
x) > 0.00001) || (fabs(DomeIntersect.
y) > 0.00001))
1377 atan(DomeIntersect.
z /
1378 sqrt((DomeIntersect.
x * DomeIntersect.
x) + (DomeIntersect.
y * DomeIntersect.
y))) /
1390 minAz = Az - HalfApertureChordAngle;
1392 minAz = minAz + 360;
1393 maxAz = Az + HalfApertureChordAngle;
1395 maxAz = maxAz - 360;
1413 a = dp.
x * dp.
x + dp.
y * dp.
y + dp.
z * dp.
z;
1414 b = 2 * (dp.
x * p1.
x + dp.
y * p1.
y + dp.
z * p1.
z);
1416 c = c + p1.
x * p1.
x + p1.
y * p1.
y + p1.
z * p1.
z;
1418 bb4ac = b * b - 4 * a * c;
1419 if ((fabs(a) < 0.0000001) || (bb4ac < 0))
1426 mu1 = (-b + sqrt(bb4ac)) / (2 * a);
1427 mu2 = (-b - sqrt(bb4ac)) / (2 * a);
1435 double cosf, sinf, cosq, sinq;
1438 q = M_PI * (90 - Lat) / 180;
1439 f = -M_PI * (180 + Ah * 15) / 180;
1446 OP.
x = (dOpticalAxis * cosf + MountCenter.
x);
1447 OP.
y = (dOpticalAxis * sinf * cosq + MountCenter.
y);
1448 OP.
z = (dOpticalAxis * sinf * sinq + MountCenter.
z);
1457 q = M_PI * Alt / 180;
1458 f = M_PI * Az / 180;
1459 OV.
x = cos(q) * sin(f);
1460 OV.
y = cos(q) * cos(f);
1468 return 1.0 / sin(x);
1473 return 1.0 / cos(x);
1480 sinh_value = cos(lat) * cos(HA) * cos(
dec) + sin(lat) * sin(
dec);
1482 if (sinh_value >= 0.0)
1512 if (IsMountParked ==
false)
1524 if (AutoSyncWarning ==
false)
1526 LOG_WARN(
"Cannot perform autosync with dome parked. Please unpark to enable autosync operation.");
1527 AutoSyncWarning =
true;
1533 AutoSyncWarning =
false;
1534 double targetAz = 0, targetAlt = 0, minAz = 0, maxAz = 0;
1536 res =
GetTargetAz(targetAz, targetAlt, minAz, maxAz);
1539 LOGF_DEBUG(
"GetTargetAz failed %g", targetAz);
1542 LOGF_DEBUG(
"Calculated target azimuth is %.2f. MinAz: %.2f, MaxAz: %.2f", targetAz, minAz,
1549 LOGF_DEBUG(
"Dome synced to position %.2f degrees.", targetAz);
1551 LOGF_DEBUG(
"Dome is syncing to position %.2f degrees...", targetAz);
1553 LOG_ERROR(
"Dome failed to sync to new requested position.");
1574 return "Shutter is open.";
1576 return "Shutter is closed.";
1578 return "Shutter is moving.";
1580 return "Shutter has errors.";
1583 return "Shutter status is unknown.";
1615 void Dome::SyncParkStatus(
bool isparked)
1617 IsParked = isparked;
1635 SyncParkStatus(isparked);
1649 LOGF_INFO(
"InitPark: No Park data in file %s: %s", ParkDataFileName.c_str(), loadres);
1650 SyncParkStatus(
false);
1658 LOGF_DEBUG(
"InitPark Axis1 %.2f", Axis1ParkPosition);
1673 const char * Dome::LoadParkXML()
1678 static char errmsg[512];
1682 bool devicefound =
false;
1685 ParkstatusXml =
nullptr;
1686 ParkdeviceXml =
nullptr;
1687 ParkpositionXml =
nullptr;
1688 ParkpositionAxis1Xml =
nullptr;
1690 if (wordexp(ParkDataFileName.c_str(), &wexp, 0))
1693 return "Badly formed filename.";
1696 if (!(fp = fopen(wexp.we_wordv[0],
"r")))
1699 return strerror(
errno);
1705 if (ParkdataXmlRoot)
1712 if (!ParkdataXmlRoot)
1716 return "Not a park data file";
1722 if (strcmp(
tagXMLEle(parkxml),
"device"))
1728 if (ap && (!strcmp(
valuXMLAtt(ap), ParkDeviceName)))
1737 return "No park data found for this device";
1739 ParkdeviceXml = parkxml;
1740 ParkstatusXml =
findXMLEle(parkxml,
"parkstatus");
1744 ParkpositionXml =
findXMLEle(parkxml,
"parkposition");
1745 ParkpositionAxis1Xml =
findXMLEle(ParkpositionXml,
"axis1position");
1747 if (ParkpositionAxis1Xml ==
nullptr)
1749 return "Park position invalid or missing.";
1752 else if (ParkstatusXml ==
nullptr)
1753 return "Park status invalid or missing.";
1762 const char * result = LoadParkXML();
1763 if (result !=
nullptr)
1772 double axis1Pos = std::numeric_limits<double>::quiet_NaN();
1774 int rc = sscanf(
pcdataXMLEle(ParkpositionAxis1Xml),
"%lf", &axis1Pos);
1777 return "Unable to parse Park Position Axis 1.";
1780 if (std::isnan(axis1Pos) ==
false)
1782 Axis1ParkPosition = axis1Pos;
1786 return "Failed to parse Park Position.";
1793 if (LoadParkXML() !=
nullptr)
1794 LOG_DEBUG(
"Failed to refresh parking data.");
1801 if (wordexp(ParkDataFileName.c_str(), &wexp, 0))
1804 LOGF_INFO(
"WriteParkData: can not write file %s: Badly formed filename.",
1805 ParkDataFileName.c_str());
1809 if (!(fp = fopen(wexp.we_wordv[0],
"w")))
1812 LOGF_INFO(
"WriteParkData: can not write file %s: %s", ParkDataFileName.c_str(),
1817 if (!ParkdataXmlRoot)
1818 ParkdataXmlRoot =
addXMLEle(
nullptr,
"parkdata");
1822 ParkdeviceXml =
addXMLEle(ParkdataXmlRoot,
"device");
1823 addXMLAtt(ParkdeviceXml,
"name", ParkDeviceName);
1827 ParkstatusXml =
addXMLEle(ParkdeviceXml,
"parkstatus");
1830 if (!ParkpositionXml)
1831 ParkpositionXml =
addXMLEle(ParkdeviceXml,
"parkposition");
1832 if (!ParkpositionAxis1Xml)
1833 ParkpositionAxis1Xml =
addXMLEle(ParkpositionXml,
"axis1position");
1836 editXMLEle(ParkstatusXml, (IsParked ?
"true" :
"false"));
1840 snprintf(pcdata,
sizeof(pcdata),
"%lf", Axis1ParkPosition);
1853 return Axis1ParkPosition;
1858 return Axis1DefaultParkPosition;
1863 Axis1ParkPosition = value;
1870 Axis1DefaultParkPosition = value;
1880 LOG_WARN(
"Please unpark the dome before issuing any motion commands.");
1888 LOG_WARN(
"Please stop dome before issuing any further motion commands.");
1917 LOG_ERROR(
"Dome does not support relative motion.");
1923 LOG_ERROR(
"Please unpark before issuing any motion commands.");
1931 LOG_WARN(
"Please stop dome before issuing any further motion commands.");
1945 (azDiff > 0) ?
"clockwise" :
"counter clockwise");
1959 (azDiff > 0) ?
"clockwise" :
"counter clockwise");
1976 LOG_WARN(
"Dome failed to move to new requested position.");
1985 LOG_ERROR(
"Dome does not support MoveAbs(). MoveAbs() must be implemented in the child class.");
1991 LOG_ERROR(
"Please unpark before issuing any motion commands.");
1999 LOG_WARN(
"Please stop dome before issuing any further motion commands.");
2007 LOGF_ERROR(
"Error: requested azimuth angle %.2f is out of range.", az);
2018 LOGF_INFO(
"Dome moved to position %.2f degrees azimuth.", az);
2027 LOGF_INFO(
"Dome is moving to position %.2f degrees azimuth...", az);
2048 LOG_WARN(
"Syncing is not supported.");
2056 LOG_ERROR(
"Dome does not support abort.");
2110 LOG_ERROR(
"Dome does not support variable speed.");
2131 LOG_ERROR(
"Dome does not have shutter control.");
2176 LOG_ERROR(
"Dome does not support parking.");
2197 LOG_INFO(
"Cannot Park Dome when mount is locking. See: Mount Policy in options tab.");
2229 LOG_ERROR(
"Dome does not support parking.");
2264 LOG_WARN(
"Parking is not supported.");
2270 LOG_WARN(
"Parking is not supported.");
2279 bool Dome::callHandshake()
2281 if (domeConnection > 0)
2294 return domeConnection;
2301 if (value == 0 || (mask & value) == 0)
2303 LOGF_ERROR(
"Invalid connection mode %d", value);
2307 domeConnection = value;
void registerHandshake(std::function< bool()> callback)
registerHandshake Register a handshake function to be called once the intial connection to the device...
The Serial class manages connection with serial devices including Bluetooth. Serial communication is ...
The TCP class manages connection with devices over the network via TCP/IP. Upon successfull connectio...
const char * getDeviceName() const
The Controller class provides functionality to access a controller (e.g. joystick) input and send it ...
void setButtonCallback(buttonFunc buttonCallback)
setButtonCallback Sets the callback function when a new button input is detected.
virtual bool ISSnoopDevice(XMLEle *root)
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
void mapController(const char *propertyName, const char *propertyLabel, ControllerType type, const char *initialValue)
mapController adds a new property to the joystick's settings.
virtual bool initProperties()
virtual bool saveConfigItems(FILE *fp)
virtual void ISGetProperties(const char *dev)
virtual bool updateProperties()
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process the client newSwitch command.
void registerConnection(Connection::Interface *newConnection)
registerConnection Add new connection plugin to the existing connection pool. The connection type sha...
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...
virtual bool loadConfig(bool silent=false, const char *property=nullptr)
Load the last saved configuration file.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool initProperties()
Initilize properties initial state and value. The child class must implement this function.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process the client newNumber command.
void setDriverInterface(uint16_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
Connection::Interface * getActiveConnection()
void addDebugControl()
Add Debug control to the driver.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process the client newSwitch command.
Class to provide general functionality of a Dome device.
INumberVectorProperty DomeMeasurementsNP
INDI::IHorizontalCoordinates mountHoriztonalCoords
INumberVectorProperty PresetNP
Connection::TCP * tcpConnection
INumber DomeMeasurementsN[6]
virtual IPState UnPark()
UnPark dome. The action of the Unpark command is dome specific, but it may include opening the shutte...
void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
void SetDomeCapability(uint32_t cap)
SetDomeCapability set the dome capabilities. All capabilities must be initialized.
void setDomeConnection(const uint8_t &value)
setDomeConnection Set Dome connection mode. Child class should call this in the constructor before Do...
ISwitchVectorProperty PresetGotoSP
const char * GetShutterStatusString(ShutterState status)
getShutterStatusString
INDI::IEquatorialCoordinates mountEquatorialCoords
bool CheckHorizon(double HA, double dec, double lat)
CheckHorizon Returns true if telescope points above horizon.
ITextVectorProperty ActiveDeviceTP
ISwitchVectorProperty ShutterParkPolicySP
bool isParked()
isParked is dome currently parked?
bool OpticalCenter(point3D MountCenter, double dOpticalAxis, double Lat, double Ah, point3D &OP)
OpticalCenter This function calculates the distance from the optical axis to the Dome center.
virtual bool SetSpeed(double rpm)
SetSpeed Set Dome speed. This does not initiate motion, it sets the speed for the next motion command...
virtual bool Sync(double az)
Sync sets the dome current azimuth as the supplied azimuth position.
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...
ShutterState m_ShutterState
ISwitchVectorProperty OTASideSP
void SetAxis1Park(double value)
SetRAPark Set current AZ parking position. The data park file (stored in ~/.indi/ParkData....
void UpdateMountCoords()
updateCoords updates the horizontal coordinates (Az & Alt) of the mount from the snooped RA,...
INumberVectorProperty DomeParamNP
IPState getMountState() const
ISwitch ShutterParkPolicyS[2]
void SetAxis1ParkDefault(double steps)
SetAxis1Park Set default AZ parking position.
ShutterOperation
Shutter operation command.
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
virtual void UpdateAutoSync()
UpdateAutoSync This function calculates the target dome azimuth from the mount's target coordinates g...
virtual IPState MoveRel(double azDiff)
Move the Dome to an relative position.
INumberVectorProperty DomeAbsPosNP
INumberVectorProperty ParkPositionNP
ISwitchVectorProperty AbortSP
ISwitchVectorProperty DomeShutterSP
ISwitchVectorProperty ParkOptionSP
bool isLocked()
isLocked, is the dome currently locked?
INumberVectorProperty DomeSyncNP
virtual bool SetBacklash(int32_t steps)
SetBacklash Set the dome backlash compensation value.
ISwitchVectorProperty ParkSP
double GetAxis1ParkDefault()
virtual IPState Park()
Goto Park Position. The park position is an absolute azimuth value.
const char * LoadParkData()
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
ISwitchVectorProperty DomeBacklashSP
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool SetDefaultPark()
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
bool Intersection(point3D p1, point3D p2, double r, double &mu1, double &mu2)
Intersection Calculate the intersection of a ray and a sphere. The line segment is defined from p1 to...
virtual bool SetBacklashEnabled(bool enabled)
SetBacklashEnabled Enables or disables the dome backlash compensation.
virtual IPState MoveAbs(double az)
Move the Dome to an absolute azimuth.
INumberVectorProperty DomeRelPosNP
IGeographicCoordinates observer
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
ISwitchVectorProperty DomeMotionSP
static void buttonHelper(const char *button_n, ISState state, void *context)
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the Device Port and Dome Presets in the configuration file
INumberVectorProperty DomeBacklashNP
virtual bool SetCurrentPark()
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
void setShutterState(const ShutterState &value)
bool OpticalVector(double Az, double Alt, point3D &OV)
OpticalVector This function calculates a second point for determining the optical axis.
void setDomeState(const DomeState &value)
INumberVectorProperty DomeSpeedNP
bool InitPark()
InitPark Loads parking data (stored in ~/.indi/ParkData.xml) that contains parking status and parking...
Connection::Serial * serialConnection
void SetParkDataType(DomeParkData type)
setParkDataType Sets the type of parking data stored in the park data file and presented to the user.
ISwitchVectorProperty MountPolicySP
DomeParkData parkDataType
virtual bool Handshake()
perform handshake with device to check communication
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual IPState ControlShutter(ShutterOperation operation)
Open or Close shutter.
ISwitchVectorProperty DomeAutoSyncSP
bool GetTargetAz(double &Az, double &Alt, double &minAz, double &maxAz)
GetTargetAz.
uint8_t getDomeConnection() const
virtual IPState Move(DomeDirection dir, DomeMotionCommand operation)
Move the Dome in a particular direction.
virtual bool Abort()
Abort all dome motion.
void callOnTimeout(const std::function< void()> &callback)
void start()
Starts or restarts the timer with the timeout specified in interval.
void stop()
Stops the timer.
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
const char * SITE_TAB
SITE_TAB Where all site information setting are located.
const char * OPTIONS_TAB
OPTIONS_TAB Where all the driver's options are located. Those may include auxiliary controls,...
int f_scansexa(const char *str0, double *dp)
convert sexagesimal string str AxBxC to double. x can be anything non-numeric. Any missing A,...
double rangeHA(double r)
rangeHA Limits the hour angle value to be between -12 —> 12
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 IUSaveConfigSwitch(FILE *fp, const ISwitchVectorProperty *svp)
Add a switch vector property value to the configuration file.
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.
int IUFindOnSwitchIndex(const ISwitchVectorProperty *svp)
Returns the index of first ON switch it finds in the vector switch property.
void IUResetSwitch(ISwitchVectorProperty *svp)
Reset all switches in a switch vector property to OFF.
void IUFillTextVector(ITextVectorProperty *tvp, IText *tp, int ntp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.
ISwitch * IUFindOnSwitch(const ISwitchVectorProperty *svp)
Returns the first ON switch it finds in the vector switch property.
void IUSaveConfigNumber(FILE *fp, const INumberVectorProperty *nvp)
Add a number vector property value to the configuration file.
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 IUFillText(IText *tp, const char *name, const char *label, const char *initialText)
Assign attributes for a text property. The text'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 IUSaveConfigText(FILE *fp, const ITextVectorProperty *tvp)
Add a text vector property value to the configuration file.
int crackIPState(const char *str, IPState *ip)
Extract property state (Idle, OK, Busy, Alert) from the supplied string.
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.
#define DOME_COORD_THRESHOLD
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 IUUpdateText(ITextVectorProperty *tvp, char *texts[], char *names[], int n)
Update all text members in a text vector 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.
void IDSetText(const ITextVectorProperty *tvp, const char *fmt,...)
int IUGetConfigSwitch(const char *dev, const char *property, const char *member, ISState *value)
IUGetConfigSwitch Opens configuration file and reads single switch property.
#define LOGF_INFO(fmt,...)
#define DEBUGDEVICE(device, priority, msg)
#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,...)
XMLAtt * findXMLAtt(XMLEle *ep, const char *name)
Find an XML attribute within an XML element.
LilXML * newLilXML()
Create a new lilxml parser.
const char * findXMLAttValu(XMLEle *ep, const char *name)
Find an XML element's attribute value.
XMLAtt * addXMLAtt(XMLEle *ep, const char *name, const char *valu)
Add an XML attribute to an existing XML element.
char * pcdataXMLEle(XMLEle *ep)
Return the pcdata of an XML element.
void editXMLEle(XMLEle *ep, const char *pcdata)
set the pcdata of the given element
char * tagXMLEle(XMLEle *ep)
Return the tag of an XML element.
void prXMLEle(FILE *fp, XMLEle *ep, int level)
Print an XML element.
XMLEle * readXMLFile(FILE *fp, LilXML *lp, char ynot[])
Handy wrapper to read one xml file.
XMLEle * nextXMLEle(XMLEle *ep, int init)
Iterate an XML element for a list of nesetd XML elements.
void delXMLEle(XMLEle *ep)
delXMLEle Delete XML element.
void delLilXML(LilXML *lp)
Delete a lilxml parser.
XMLEle * addXMLEle(XMLEle *parent, const char *tag)
add an element with the given tag to the given element. parent can be NULL to make a new root.
XMLEle * findXMLEle(XMLEle *ep, const char *tag)
Find an XML element within an XML element.
char * valuXMLAtt(XMLAtt *ap)
Return the value of an XML attribute.
Namespace to encapsulate INDI client, drivers, and mediator classes.
void EquatorialToHorizontal(IEquatorialCoordinates *object, IGeographicCoordinates *observer, double JD, IHorizontalCoordinates *position)
EquatorialToHorizontal Calculate horizontal coordinates from equatorial coordinates.