26#include <libnova/sidereal_time.h>
27#include <libnova/transform.h>
88 EqNP[
AXIS_RA].fill(
"RA",
"RA (hh:mm:ss)",
"%010.6m", 0, 24, 0, 0);
89 EqNP[
AXIS_DE].fill(
"DEC",
"DEC (dd:mm:ss)",
"%010.6m", -90, 90, 0, 0);
96 TargetNP[
AXIS_DE].fill(
"DEC",
"DEC (dd:mm:ss)",
"%010.6m", -90, 90, 0, 0);
108 TimeTP[
UTC].fill(
"UTC",
"UTC Time",
nullptr);
164 TrackRateNP[
AXIS_RA].fill(
"TRACK_RATE_RA",
"RA (arcsecs/s)",
"%.6f", -16384.0, 16384.0, 0.000001,
166 TrackRateNP[
AXIS_DE].fill(
"TRACK_RATE_DE",
"DE (arcsecs/s)",
"%.6f", -16384.0, 16384.0, 0.000001, 0.0);
188 char curTime[32] = {0};
189 std::time_t t = std::time(
nullptr);
190 struct std::tm *utctimeinfo = std::gmtime(&t);
191 strftime(curTime,
sizeof(curTime),
"%Y-%m-%dT%H:%M:%S", utctimeinfo);
235 controller->initProperties();
291 double longitude = 0, latitude = 0, elevation = 0;
330 controller->ISGetProperties(dev);
488 controller->updateProperties();
490 auto useJoystick =
getSwitch(
"USEJOYSTICK");
495 if (useJoystick[0].getState() ==
ISS_ON)
526 controller->ISSnoopDevice(root);
540 double longitude = -1, latitude = -1, elevation = -1;
546 if (!strcmp(elemName,
"LAT"))
548 else if (!strcmp(elemName,
"LONG"))
550 else if (!strcmp(elemName,
"ELEV"))
554 return processLocationInfo(latitude, longitude, elevation);
568 if (!strcmp(elemName,
"UTC"))
570 else if (!strcmp(elemName,
"OFFSET"))
574 return processTimeInfo(utc, offset);
584 if ((DomeClosedLockT[2].s ==
ISS_ON || DomeClosedLockT[3].s ==
ISS_ON) && !IsLocked && !
IsParked)
589 if (( (!strcmp(elemName,
"SHUTTER_CLOSE") || !strcmp(elemName,
"PARK"))
594 LOG_INFO(
"Dome is closing, parking mount...");
603 bool prevState = IsLocked;
608 if (!IsLocked && (!strcmp(elemName,
"PARK")) && !strcmp(
pcdataXMLEle(ep),
"On"))
610 else if (IsLocked && (!strcmp(elemName,
"UNPARK")) && !strcmp(
pcdataXMLEle(ep),
"On"))
614 LOGF_INFO(
"Dome status changed. Lock is set to: %s", IsLocked ?
"locked" :
"unlock");
623void Telescope::triggerSnoop(
const char *driverName,
const char *snoopedProp)
625 LOGF_DEBUG(
"Active Snoop, driver: %s, property: %s", driverName, snoopedProp);
631 return telescopeConnection;
638 if (value == 0 || (mask & value) == 0)
644 telescopeConnection = value;
672 controller->saveConfigItems(fp);
716 constexpr double RA_NOTIFY_THRESHOLD = EQ_NOTIFY_THRESHOLD / 15.0;
717 if (std::abs(
EqNP[
AXIS_RA].getValue() -
ra) > RA_NOTIFY_THRESHOLD ||
719 EqNP.getState() != lastEqState)
723 lastEqState =
EqNP.getState();
767 if (
TimeTP.isNameMatch(name))
772 return processTimeInfo(texts[utcindex], texts[offsetindex]);
793 controller->ISNewText(dev, name, texts, names,
n);
809 if (strcmp(name,
"EQUATORIAL_EOD_COORD") == 0)
816 for (
int x = 0; x <
n; x++)
823 if ((
ra >= 0) && (
ra <= 24) && (
dec >= -90) && (
dec <= 90))
831 "Please unpark the mount before issuing any motion/sync commands.");
841 if (
CoordSP.isSwitchOn(
"SYNC"))
856 doFlip =
CoordSP.isSwitchOn(
"FLIP");
896 if (latindex == -1 || longindex == -1 || elevationindex == -1)
899 LOG_ERROR(
"Location data missing or corrupted.");
903 double targetLat = values[latindex];
904 double targetLong = values[longindex];
905 double targetElev = values[elevationindex];
907 return processLocationInfo(targetLat, targetLong, targetElev);
915 double axis1 = std::numeric_limits<double>::quiet_NaN(), axis2 = std::numeric_limits<double>::quiet_NaN();
916 for (
int x = 0; x <
n; x++)
928 if (std::isnan(axis1) ==
false && std::isnan(axis2) ==
false)
956 auto currentTrackingMode =
TrackModeSP.findOnSwitch();
957 if (
TrackRateNP.update(values, names,
n) ==
false || currentTrackingMode ==
nullptr)
971 LOG_ERROR(
"Cannot reverse tracking while tracking is engaged. Disengage tracking then try again.");
991 LOG_INFO(
"Custom tracking rates set. Tracking mode must be set to Custom for these rates to take effect.");
1011 if (
CoordSP.isNameMatch(name))
1026 int preIndex =
SlewRateSP.findOnSwitchIndex();
1028 int nowIndex =
SlewRateSP.findOnSwitchIndex();
1044 if (
ParkSP.isNameMatch(name))
1051 LOG_INFO(
"Parking/Unparking aborted.");
1056 int preIndex =
ParkSP.findOnSwitchIndex();
1057 ParkSP.update(states, names,
n);
1066 LOG_INFO(
"Telescope already unparked.");
1077 LOG_WARN(
"Cannot unpark mount when dome is locking. See: Dome Policy in options tab.");
1088 LOG_INFO(
"Telescope already parked.");
1133 "Please unpark the mount before issuing any motion/sync commands.");
1206 "Please unpark the mount before issuing any motion/sync commands.");
1282 if (
HomeSP.isNameMatch(name))
1286 if (onSwitchName == NULL)
1295 auto actionString = std::string(onSwitchName);
1297 if (actionString ==
"SET")
1299 else if (actionString ==
"GO")
1314 HomeSP.update(states, names,
n);
1322 if (
AbortSP.isNameMatch(name))
1384 LOG_WARN(
"The mount type is reported by the driver and cannot be changed.");
1397 const auto requestedIndex =
MountTypeSP.findOnSwitchIndex();
1398 if (requestedIndex < 0)
1405 if (requestedType == previousType)
1471 if (previousState == targetState)
1518 LOG_INFO(
"Can not change park position while slewing or already parked.");
1535 LOG_INFO(
"Saved Park Status/Position.");
1560 LOG_INFO(
"Dome Policy set to: Dome ignored. Mount can park or unpark regardless of dome parking state.");
1562 LOG_WARN(
"Dome Policy set to: Dome locks. This prevents the mount from unparking when dome is parked.");
1564 else if (!strcmp(names[0], DomeClosedLockT[2].name))
1565 LOG_INFO(
"Warning: Dome parking policy set to: Dome parks. This tells "
1566 "scope to park if dome is parking. This will disable the locking "
1567 "for dome parking, EVEN IF MOUNT PARKING FAILS");
1568 else if (!strcmp(names[0], DomeClosedLockT[3].name))
1569 LOG_INFO(
"Warning: Dome parking policy set to: Both. This disallows the "
1570 "scope from unparking when dome is parked, and tells scope to "
1571 "park if dome is parking. This will disable the locking for dome "
1572 "parking, EVEN IF MOUNT PARKING FAILS.");
1591 LOG_INFO(
"Cannot determine whether pier side simulation should be switched on or off.");
1596 bool pierSideEnabled = index == 0;
1598 LOGF_INFO(
"Simulating Pier Side %s.", (pierSideEnabled ?
"enabled" :
"disabled"));
1601 if (pierSideEnabled)
1619 LOG_INFO(
"Motion control is set to 4-way joystick.");
1621 LOG_INFO(
"Motion control is set to 2 separate axes.");
1636 LOG_INFO(
"Joystick motion is locked to West/East axis only.");
1638 LOG_INFO(
"Joystick motion is locked to North/South axis only.");
1640 LOG_INFO(
"Joystick motion is unlocked.");
1657 bool rc = controller->ISNewSwitch(dev, name, states, names,
n);
1660 auto useJoystick =
getSwitch(
"USEJOYSTICK");
1661 if (useJoystick && useJoystick[0].getState() ==
ISS_ON)
1686 if (telescopeConnection > 0)
1806bool Telescope::processTimeInfo(
const char *utc,
const char *offset)
1808 struct ln_date utc_date;
1809 double utc_offset = 0;
1814 LOGF_ERROR(
"Date/Time is invalid: %s.", utc);
1819 utc_offset = atof(offset);
1837bool Telescope::processLocationInfo(
double latitude,
double longitude,
double elevation)
1851 if (latitude == 0 && longitude == 0)
1853 LOG_DEBUG(
"Silently ignoring invalid latitude and longitude.");
1915 double display_longitude = longitude > 180 ? longitude - 360 : longitude;
1917 fs_sexa(lng_str, display_longitude, 2, 36000);
1919 LOGF_INFO(
"Observer location updated: Latitude %.12s (%.2f) Longitude %.12s (%.2f)", lat_str,
m_Location.latitude, lng_str,
1930void Telescope::generateCoordSet()
1957 CoordSP.push(std::move(node));
1964 nSlewRate = slewRateCount;
1975 for (
int i = 0; i < nSlewRate; i++)
1978 auto name = std::to_string(i + 1) +
"x";
2009 HomeSP.push(std::move(node));
2016 HomeSP.push(std::move(node));
2023 HomeSP.push(std::move(node));
2112 LOGF_INFO(
"InitPark: No Park data in file %s: %s", ParkDataFileName.c_str(), loadres);
2121 LOGF_DEBUG(
"InitPark Axis1 %.2f Axis2 %.2f", Axis1ParkPosition, Axis2ParkPosition);
2130const char *Telescope::LoadParkXML()
2137 XMLEle *parkxml =
nullptr;
2139 bool devicefound =
false;
2142 ParkstatusXml =
nullptr;
2143 ParkdeviceXml =
nullptr;
2144 ParkpositionXml =
nullptr;
2145 ParkpositionAxis1Xml =
nullptr;
2146 ParkpositionAxis2Xml =
nullptr;
2148 if (wordexp(ParkDataFileName.c_str(), &wexp, 0))
2151 return "Badly formed filename.";
2154 if (!(fp = fopen(wexp.we_wordv[0],
"r")))
2157 return strerror(
errno);
2163 if (ParkdataXmlRoot)
2170 if (!ParkdataXmlRoot)
2176 return "Empty park file.";
2178 if (!strcmp(
tagXMLEle(parkxml),
"parkdata"))
2181 return "Not a park data file";
2186 if (strcmp(
tagXMLEle(parkxml),
"device"))
2192 if (ap && (!strcmp(
valuXMLAtt(ap), ParkDeviceName)))
2203 return "No park data found for this device";
2206 ParkdeviceXml = parkxml;
2207 ParkstatusXml =
findXMLEle(parkxml,
"parkstatus");
2211 ParkpositionXml =
findXMLEle(parkxml,
"parkposition");
2212 if (ParkpositionXml)
2213 ParkpositionAxis1Xml =
findXMLEle(ParkpositionXml,
"axis1position");
2214 if (ParkpositionXml)
2215 ParkpositionAxis2Xml =
findXMLEle(ParkpositionXml,
"axis2position");
2217 if (ParkstatusXml ==
nullptr || ParkpositionAxis1Xml ==
nullptr || ParkpositionAxis2Xml ==
nullptr)
2219 return "Park data invalid or missing.";
2222 else if (ParkstatusXml ==
nullptr)
2224 return "Park data invalid or missing.";
2234 const char *result = LoadParkXML();
2235 if (result !=
nullptr)
2243 double axis1Pos = std::numeric_limits<double>::quiet_NaN();
2244 double axis2Pos = std::numeric_limits<double>::quiet_NaN();
2246 int rc = sscanf(
pcdataXMLEle(ParkpositionAxis1Xml),
"%lf", &axis1Pos);
2249 return "Unable to parse Park Position Axis 1.";
2251 rc = sscanf(
pcdataXMLEle(ParkpositionAxis2Xml),
"%lf", &axis2Pos);
2254 return "Unable to parse Park Position Axis 2.";
2257 if (std::isnan(axis1Pos) ==
false && std::isnan(axis2Pos) ==
false)
2259 Axis1ParkPosition = axis1Pos;
2260 Axis2ParkPosition = axis2Pos;
2264 return "Failed to parse Park Position.";
2274 if (LoadParkXML() !=
nullptr)
2275 LOG_DEBUG(
"Failed to refresh parking data.");
2282 XMLEle *parkxml =
nullptr;
2284 bool devicefound =
false;
2288 if (wordexp(ParkDataFileName.c_str(), &wexp, 0))
2294 if (!(fp = fopen(wexp.we_wordv[0],
"r")))
2304 if (ParkdataXmlRoot)
2311 if (!ParkdataXmlRoot)
2319 if (!strcmp(
tagXMLEle(parkxml),
"parkdata"))
2327 if (strcmp(
tagXMLEle(parkxml),
"device"))
2333 if (ap && (!strcmp(
valuXMLAtt(ap), ParkDeviceName)))
2346 ParkstatusXml =
nullptr;
2347 ParkdeviceXml =
nullptr;
2348 ParkpositionXml =
nullptr;
2349 ParkpositionAxis1Xml =
nullptr;
2350 ParkpositionAxis2Xml =
nullptr;
2352 wordexp(ParkDataFileName.c_str(), &wexp, 0);
2353 if (!(fp = fopen(wexp.we_wordv[0],
"w")))
2356 LOGF_INFO(
"WriteParkData: can not write file %s: %s", ParkDataFileName.c_str(), strerror(
errno));
2370 if (LoadParkXML() !=
nullptr)
2371 LOG_DEBUG(
"Failed to refresh parking data.");
2378 if (wordexp(ParkDataFileName.c_str(), &wexp, 0))
2381 LOGF_INFO(
"WriteParkData: can not write file %s: Badly formed filename.",
2382 ParkDataFileName.c_str());
2386 if (!(fp = fopen(wexp.we_wordv[0],
"w")))
2389 LOGF_INFO(
"WriteParkData: can not write file %s: %s", ParkDataFileName.c_str(),
2394 if (!ParkdataXmlRoot)
2395 ParkdataXmlRoot =
addXMLEle(
nullptr,
"parkdata");
2399 ParkdeviceXml =
addXMLEle(ParkdataXmlRoot,
"device");
2400 addXMLAtt(ParkdeviceXml,
"name", ParkDeviceName);
2404 ParkstatusXml =
addXMLEle(ParkdeviceXml,
"parkstatus");
2409 if (!ParkpositionXml)
2410 ParkpositionXml =
addXMLEle(ParkdeviceXml,
"parkposition");
2411 if (!ParkpositionAxis1Xml)
2412 ParkpositionAxis1Xml =
addXMLEle(ParkpositionXml,
"axis1position");
2413 if (!ParkpositionAxis2Xml)
2414 ParkpositionAxis2Xml =
addXMLEle(ParkpositionXml,
"axis2position");
2416 snprintf(pcdata,
sizeof(pcdata),
"%lf", Axis1ParkPosition);
2418 snprintf(pcdata,
sizeof(pcdata),
"%lf", Axis2ParkPosition);
2431 return Axis1ParkPosition;
2435 return Axis1DefaultParkPosition;
2439 return Axis2ParkPosition;
2443 return Axis2DefaultParkPosition;
2448 LOGF_DEBUG(
"Setting Park Axis1 to %.2f", value);
2449 Axis1ParkPosition = value;
2456 LOGF_DEBUG(
"Setting Default Park Axis1 to %.2f", value);
2457 Axis1DefaultParkPosition = value;
2462 LOGF_DEBUG(
"Setting Park Axis2 to %.2f", value);
2463 Axis2ParkPosition = value;
2470 LOGF_DEBUG(
"Setting Default Park Axis2 to %.2f", value);
2471 Axis2DefaultParkPosition = value;
2491 if (!strcmp(button_n,
"ABORTBUTTON"))
2493 auto trackSW =
getSwitch(
"TELESCOPE_TRACK_MODE");
2497 (trackSW && trackSW.getState() ==
IPS_BUSY))
2501 const char *names[1] = {
AbortSP[0].getName() };
2505 else if (!strcmp(button_n,
"PARKBUTTON"))
2511 else if (!strcmp(button_n,
"UNPARKBUTTON"))
2517 else if (!strcmp(button_n,
"SLEWPRESETUP"))
2521 m_slewPresetArmed =
true;
2525 else if (!strcmp(button_n,
"SLEWPRESETDOWN"))
2528 m_slewPresetArmed =
true;
2546 else if (!strcmp(joystick_n,
"SLEWPRESET"))
2554 if (!strcmp(axis_n,
"MOTIONDIRNS") || !strcmp(axis_n,
"MOTIONDIRWE"))
2558 LOG_WARN(
"Cannot slew while mount is parking/parked.");
2562 if (!strcmp(axis_n,
"MOTIONDIRNS"))
2567 motionDirNSValue = -1;
2572 motionDirNSValue = 1;
2576 motionDirNSValue = 0;
2579 else if (!strcmp(axis_n,
"MOTIONDIRWE"))
2584 motionDirWEValue = 1;
2589 motionDirWEValue = -1;
2593 motionDirWEValue = 0;
2597 float x = motionDirWEValue * sqrt(1 - pow(motionDirNSValue, 2) / 2.0f);
2598 float y = motionDirNSValue * sqrt(1 - pow(motionDirWEValue, 2) / 2.0f);
2599 float angle = atan2(y, x) * (180.0 / 3.141592653589);
2600 float mag = sqrt(pow(y, 2) + pow(x, 2));
2657 if (angle >= 90 && angle <= 270)
2666 if (angle >= 0 && angle <= 180)
2674 if (angle > 75 && angle < 105)
2678 if (angle > 165 && angle < 195)
2682 if (angle > 255 && angle < 285)
2686 if (angle > 345 || angle < 15)
2693 angle = fmod(angle + 90.0, 360.0);
2695 angle = fmod(360.0 - angle, 360.0);
2697 angle = fmod(540.0 - angle, 360.0);
2700 if (angle > 0 && angle < 180)
2712 if (angle > 180 && angle < 360)
2724 if (angle < 90 || angle > 270)
2737 if (angle > 90 && angle < 270)
2758 if (mag < 0.5 && !m_slewPresetArmed)
2759 m_slewPresetArmed =
true;
2764 if (!m_slewPresetArmed)
2767 m_slewPresetArmed =
false;
2769 size_t currentIndex =
SlewRateSP.findOnSwitchIndex();
2777 if (angle > 45 && angle <= 225)
2789 if (currentIndex <= 0)
2870 const auto index =
MountTypeSP.findOnSwitchIndex();
2871 return index < 0 ? MOUNT_EQ_GEM : static_cast<TelescopeMountType>(index);
2893 const char *HomeDir = getenv(
"HOME");
2898 HomeDir = getpwuid(getuid())->pw_dir;
2900 return (HomeDir ? std::string(HomeDir) :
"");
2905 FILE *FilePtr = fopen(file_name.c_str(), (writable ?
"a" :
"r"));
2919 std::time_t t = std::time(
nullptr);
2920 struct std::tm *utctimeinfo = std::gmtime(&t);
2922 strftime(ts,
sizeof(ts),
"%Y-%m-%dT%H:%M:%S", utctimeinfo);
2925 struct std::tm *localtimeinfo = std::localtime(&t);
2926 snprintf(ts,
sizeof(ts),
"%4.2f", (localtimeinfo->tm_gmtoff / 3600.0));
2936 return m_simulatePierSide;
2948 return "PIER_UNKNOWN";
2971 m_simulatePierSide = simulate;
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 successful connection...
const char * getDeviceName() const
INDI::PropertySwitch getSwitch(const char *name) const
INDI::PropertyText getText(const char *name) const
The Controller class provides functionality to access a controller (e.g. joystick) input and send it ...
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.
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...
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.
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 const char * getDefaultName()=0
virtual bool initProperties()
Initialize 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.
Connection::Interface * getActiveConnection()
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process the client newSwitch command.
void push(WidgetView< T > &&item)
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
TelescopeStatus TrackState
bool isLocked() const
isLocked is mount currently locked?
virtual bool SetTrackMode(uint8_t mode)
SetTrackMode Set active tracking mode. Do not change track state.
void SetAxis1Park(double value)
SetRAPark Set current RA/AZ parking position. The data park file (stored in ~/.indi/ParkData....
bool HasPierSideSimulation()
virtual bool Goto(double ra, double dec)
Move the scope to the supplied RA and DEC coordinates.
TelescopeMountType getMountType() const
void processButton(const char *button_n, ISState state)
static void axisHelper(const char *axis_n, double value, void *context)
void processAxis(const char *axis_n, double value)
bool CheckFile(const std::string &file_name, bool writable) const
Check if a file exists and it is readable.
void SetAxis1ParkDefault(double steps)
SetRAPark Set default RA/AZ parking position.
virtual bool ReadScopeStatus()=0
Read telescope status.
void SetTelescopeCapability(uint32_t cap, uint8_t slewRateCount)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
virtual bool Park()
Park the telescope to its home position.
virtual bool SetCurrentPark()
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
TelescopeParkData parkDataType
std::string GetHomeDirectory() const
Validate a file name.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual void TimerHit() override
Called when setTimer() time is up.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool SetTrackRate(double raRate, double deRate)
SetTrackRate Set custom tracking rates.
double GetAxis1Park() const
virtual bool UnPark()
Unpark the telescope if already parked.
virtual bool SetSlewRate(int index)
SetSlewRate Set desired slew rate index.
virtual bool SetDefaultPark()
SetDefaultPark Set default coordinates/encoders value as the desired parking 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...
void setTelescopeConnection(const uint8_t &value)
setTelescopeConnection Set telescope connection mode. Child class should call this in the constructor...
double GetAxis2Park() const
bool isParked()
isParked is mount currently parked?
void processNSWE(double mag, double angle)
virtual int AddTrackMode(const char *name, const char *label, bool isDefault=false)
AddTrackMode.
Connection::Serial * serialConnection
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
static void joystickHelper(const char *joystick_n, double mag, double angle, void *context)
void updateObserverLocation(double latitude, double longitude, double elevation)
Update location settings of the observer.
double GetAxis1ParkDefault() const
virtual bool Handshake()
perform handshake with device to check communication
virtual bool SetMountType(TelescopeMountType type)
SetMountType Called when the user selects a different mount type in TELESCOPE_MOUNT_TYPE....
virtual bool SetTrackEnabled(bool enabled)
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
virtual void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
virtual bool updateTime(ln_date *utc, double utc_offset)
Update telescope time, date, and UTC offset.
Connection::TCP * tcpConnection
static void buttonHelper(const char *button_n, ISState state, void *context)
uint8_t getTelescopeConnection() const
const char * LoadParkData()
void setPECState(TelescopePECState state)
virtual IPState ExecuteHomeAction(TelescopeHomeAction action)
Execute a homing action.
TelescopeMountType
Mount geometry reported in the standard TELESCOPE_MOUNT_TYPE property. The values are the indices of ...
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool updateLocation(double latitude, double longitude, double elevation)
Update telescope location settings.
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 bool SetParkPosition(double Axis1Value, double Axis2Value)
SetParkPosition Set desired parking position to the supplied value. This ONLY sets the desired park p...
IGeographicCoordinates m_Location
void processJoystick(const char *joystick_n, double mag, double angle)
bool callHandshake()
callHandshake Helper function that sets the port file descriptor before calling the actual Handshake ...
void NewRaDec(double ra, double dec)
The child class calls this function when it has updates.
virtual void SyncParkStatus(bool isparked)
SyncParkStatus Update the state and switches for parking.
void setPierSide(TelescopePierSide side)
bool InitPark()
InitPark Loads parking data (stored in ~/.indi/ParkData.xml) that contains parking status and parking...
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command)
Move the telescope in the direction dir.
TelescopeStatus RememberTrackState
RememberTrackState Remember last state of Track State to fall back to in case of errors or aborts.
virtual bool Abort()
Abort any telescope motion including tracking if possible.
double GetAxis2ParkDefault() const
TelescopePECState currentPECState
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
void SetAxis2Park(double steps)
SetDEPark Set current DEC/ALT parking position. The data park file (stored in ~/.indi/ParkData....
void setMountType(TelescopeMountType type)
setMountType Report the mount type in TELESCOPE_MOUNT_TYPE. Drivers call it when the type is fixed by...
virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command)
Start or Stop the telescope motion in the direction dir.
virtual bool Flip(double ra, double dec)
Move and flip the scope to the supplied RA and DEC coordinates.
void processSlewPresets(double mag, double angle)
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
void SetParkDataType(TelescopeParkData type)
setParkDataType Sets the type of parking data stored in the park data file and presented to the user.
TelescopePECState lastPECState
@ TELESCOPE_HAS_PIER_SIDE
TelescopePierSide expectedPierSide(double ra)
Calculate the expected pier side for scopes that do not report this property themselves.
void SetAxis2ParkDefault(double steps)
SetDEParkDefault Set default DEC/ALT parking position.
virtual bool Sync(double ra, double dec)
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
const char * SATELLITE_TAB
SATELLITE_TAB.
const char * MOTION_TAB
MOTION_TAB Where all the motion control properties of 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,...
INDI::PropertySwitch ParkSP
INDI::PropertySwitch SimulatePierSideSP
TelescopePierSide currentPierSide
INDI::PropertySwitch AbortSP
INDI::PropertySwitch DomePolicySP
INDI::PropertyText ActiveDeviceTP
INDI::PropertyText TLEtoTrackTP
Text Vector property defining the orbital elements of an artificial satellite (TLE)....
INDI::PropertyNumber TrackRateNP
INDI::PropertySwitch MovementNSSP
INDI::PropertyText SatPassWindowTP
Text Vector property defining the start and end of a satellite pass (window contains pass)....
TelescopePierSide lastPierSide
INDI::PropertyNumber EqNP
INDI::PropertySwitch TrackStateSP
bool getSimulatePierSide() const
INDI::PropertySwitch PECStateSP
INDI::PropertySwitch HomeSP
INDI::PropertySwitch MotionControlModeTP
INDI::PropertySwitch TrackSatSP
Switch Vector property defining the state of the satellite tracking of the mount. Example implementat...
INDI::PropertySwitch SlewRateSP
INDI::PropertySwitch TrackModeSP
INDI::PropertyText TimeTP
INDI::PropertySwitch MountTypeSP
Standard TELESCOPE_MOUNT_TYPE property, indexed by TelescopeMountType. Writable if the driver sets TE...
INDI::PropertySwitch PierSideSP
INDI::PropertySwitch LockAxisSP
INDI::PropertySwitch ReverseMovementSP
INDI::PropertySwitch MovementWESP
INDI::PropertySwitch JoystickReverseSP
INDI::PropertySwitch ParkOptionSP
INDI::PropertySwitch CoordSP
void setSimulatePierSide(bool value)
void sendTimeFromSystem()
INDI::PropertyNumber LocationNP
INDI::PropertyNumber ParkPositionNP
const char * getPierSideStr(TelescopePierSide ps)
INDI::PropertyNumber TargetNP
@ MOTION_CONTROL_MODE_JOYSTICK
@ MOTION_CONTROL_MODE_AXES
@ SAT_HALT
Halt signal (abort).
@ SAT_PASS_WINDOW_END
Index for end of the window.
@ SAT_PASS_WINDOW_START
Index for start of the window.
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[].
double get_local_hour_angle(double sideral_time, double ra)
get_local_hour_angle Returns local hour angle of an object
Implementations for common driver routines.
double get_local_sidereal_time(double longitude)
get_local_sidereal_time Returns local sidereal time given longitude and system clock.
int extractISOTime(const char *timestr, struct ln_date *iso_date)
Extract ISO 8601 time and store it in a tm struct.
int IUFindIndex(const char *needle, char **hay, unsigned int n)
Returns the index of the string in a string array.
const char * IUFindOnSwitchName(ISState *states, char *names[], int n)
Returns the name of the first ON switch it finds in the supplied arguments.
void IDSetNumber(const INumberVectorProperty *nvp, const char *fmt,...)
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 IUGetConfigNumber(const char *dev, const char *property, const char *member, double *value)
IUGetConfigNumber Opens configuration file and reads single number property.
int IUGetConfigSwitch(const char *dev, const char *property, const char *member, ISState *value)
IUGetConfigSwitch Opens configuration file and reads single switch property.
*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,...)
#define TRACKRATE_SIDEREAL
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.
XMLAtt * findXMLAtt(XMLEle *ep, const char *name)
Find an XML attribute within an XML element.
LilXML * newLilXML()
Create a new lilxml parser.
char * tagXMLEle(XMLEle *ep)
Return the tag of an XML element.
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.
void editXMLEle(XMLEle *ep, const char *pcdata)
set the pcdata of the given element
void prXMLEle(FILE *fp, XMLEle *ep, int level)
Print an XML element.
void delXMLEle(XMLEle *ep)
delXMLEle Delete XML element.
char * pcdataXMLEle(XMLEle *ep)
Return the pcdata of an XML element.
void delLilXML(LilXML *lp)
Delete a lilxml parser.
XMLAtt * addXMLAtt(XMLEle *ep, const char *name, const char *valu)
Add an XML attribute to an existing XML element.
XMLEle * readXMLFile(FILE *fp, LilXML *lp, char ynot[])
Handy wrapper to read one xml file.
Namespace to encapsulate INDI client, drivers, and mediator classes.
INDI::WidgetViewSwitch WidgetSwitch