26#include <libnova/sidereal_time.h>
27#include <libnova/transform.h>
43 :
DefaultDevice(), ParkDataFileName(GetHomeDirectory() +
"/.indi/ParkData.xml")
187 char curTime[32] = {0};
188 std::time_t t = std::time(
nullptr);
189 struct std::tm *utctimeinfo = std::gmtime(&t);
190 strftime(curTime,
sizeof(curTime),
"%Y-%m-%dT%H:%M:%S", utctimeinfo);
290 double longitude = 0, latitude = 0, elevation = 0;
486 auto useJoystick =
getSwitch(
"USEJOYSTICK");
491 if (useJoystick[0].getState() ==
ISS_ON)
536 double longitude = -1, latitude = -1, elevation = -1;
542 if (!strcmp(elemName,
"LAT"))
544 else if (!strcmp(elemName,
"LONG"))
546 else if (!strcmp(elemName,
"ELEV"))
550 return processLocationInfo(latitude, longitude, elevation);
564 if (!strcmp(elemName,
"UTC"))
566 else if (!strcmp(elemName,
"OFFSET"))
570 return processTimeInfo(utc, offset);
580 if ((DomeClosedLockT[2].s ==
ISS_ON || DomeClosedLockT[3].s ==
ISS_ON) && !IsLocked && !
IsParked)
585 if (( (!strcmp(elemName,
"SHUTTER_CLOSE") || !strcmp(elemName,
"PARK"))
590 LOG_INFO(
"Dome is closing, parking mount...");
599 bool prevState = IsLocked;
604 if (!IsLocked && (!strcmp(elemName,
"PARK")) && !strcmp(
pcdataXMLEle(ep),
"On"))
606 else if (IsLocked && (!strcmp(elemName,
"UNPARK")) && !strcmp(
pcdataXMLEle(ep),
"On"))
610 LOGF_INFO(
"Dome status changed. Lock is set to: %s", IsLocked ?
"locked" :
"unlock");
619void Telescope::triggerSnoop(
const char *driverName,
const char *snoopedProp)
621 LOGF_DEBUG(
"Active Snoop, driver: %s, property: %s", driverName, snoopedProp);
627 return telescopeConnection;
634 if (value == 0 || (mask & value) == 0)
640 telescopeConnection = value;
710 constexpr double RA_NOTIFY_THRESHOLD = EQ_NOTIFY_THRESHOLD / 15.0;
711 if (std::abs(
EqNP[
AXIS_RA].getValue() -
ra) > RA_NOTIFY_THRESHOLD ||
766 return processTimeInfo(texts[utcindex], texts[offsetindex]);
787 controller->
ISNewText(dev, name, texts, names, n);
803 if (strcmp(name,
"EQUATORIAL_EOD_COORD") == 0)
810 for (
int x = 0; x < n; x++)
817 if ((
ra >= 0) && (
ra <= 24) && (
dec >= -90) && (
dec <= 90))
825 "Please unpark the mount before issuing any motion/sync commands.");
888 int elevationindex =
IUFindIndex(
"ELEV", names, n);
890 if (latindex == -1 || longindex == -1 || elevationindex == -1)
893 LOG_ERROR(
"Location data missing or corrupted.");
897 double targetLat = values[latindex];
898 double targetLong = values[longindex];
899 double targetElev = values[elevationindex];
901 return processLocationInfo(targetLat, targetLong, targetElev);
909 double axis1 = std::numeric_limits<double>::quiet_NaN(), axis2 = std::numeric_limits<double>::quiet_NaN();
910 for (
int x = 0; x < n; x++)
922 if (std::isnan(axis1) ==
false && std::isnan(axis2) ==
false)
951 if (
TrackRateNP.
update(values, names, n) ==
false || currentTrackingMode ==
nullptr)
965 LOG_ERROR(
"Cannot reverse tracking while tracking is engaged. Disengage tracking then try again.");
985 LOG_INFO(
"Custom tracking rates set. Tracking mode must be set to Custom for these rates to take effect.");
1045 LOG_INFO(
"Parking/Unparking aborted.");
1060 LOG_INFO(
"Telescope already unparked.");
1071 LOG_WARN(
"Cannot unpark mount when dome is locking. See: Dome Policy in options tab.");
1082 LOG_INFO(
"Telescope already parked.");
1127 "Please unpark the mount before issuing any motion/sync commands.");
1200 "Please unpark the mount before issuing any motion/sync commands.");
1280 if (onSwitchName == NULL)
1289 auto actionString = std::string(onSwitchName);
1291 if (actionString ==
"SET")
1293 else if (actionString ==
"GO")
1414 if (previousState == targetState)
1461 LOG_INFO(
"Can not change park position while slewing or already parked.");
1478 LOG_INFO(
"Saved Park Status/Position.");
1503 LOG_INFO(
"Dome Policy set to: Dome ignored. Mount can park or unpark regardless of dome parking state.");
1505 LOG_WARN(
"Dome Policy set to: Dome locks. This prevents the mount from unparking when dome is parked.");
1507 else if (!strcmp(names[0], DomeClosedLockT[2].name))
1508 LOG_INFO(
"Warning: Dome parking policy set to: Dome parks. This tells "
1509 "scope to park if dome is parking. This will disable the locking "
1510 "for dome parking, EVEN IF MOUNT PARKING FAILS");
1511 else if (!strcmp(names[0], DomeClosedLockT[3].name))
1512 LOG_INFO(
"Warning: Dome parking policy set to: Both. This disallows the "
1513 "scope from unparking when dome is parked, and tells scope to "
1514 "park if dome is parking. This will disable the locking for dome "
1515 "parking, EVEN IF MOUNT PARKING FAILS.");
1534 LOG_INFO(
"Cannot determine whether pier side simulation should be switched on or off.");
1539 bool pierSideEnabled = index == 0;
1541 LOGF_INFO(
"Simulating Pier Side %s.", (pierSideEnabled ?
"enabled" :
"disabled"));
1544 if (pierSideEnabled)
1562 LOG_INFO(
"Motion control is set to 4-way joystick.");
1564 LOG_INFO(
"Motion control is set to 2 separate axes.");
1579 LOG_INFO(
"Joystick motion is locked to West/East axis only.");
1581 LOG_INFO(
"Joystick motion is locked to North/South axis only.");
1583 LOG_INFO(
"Joystick motion is unlocked.");
1600 bool rc = controller->
ISNewSwitch(dev, name, states, names, n);
1603 auto useJoystick =
getSwitch(
"USEJOYSTICK");
1604 if (useJoystick && useJoystick[0].getState() ==
ISS_ON)
1629 if (telescopeConnection > 0)
1743bool Telescope::processTimeInfo(
const char *utc,
const char *offset)
1745 struct ln_date utc_date;
1746 double utc_offset = 0;
1751 LOGF_ERROR(
"Date/Time is invalid: %s.", utc);
1756 utc_offset = atof(offset);
1774bool Telescope::processLocationInfo(
double latitude,
double longitude,
double elevation)
1788 if (latitude == 0 && longitude == 0)
1790 LOG_DEBUG(
"Silently ignoring invalid latitude and longitude.");
1852 double display_longitude = longitude > 180 ? longitude - 360 : longitude;
1854 fs_sexa(lng_str, display_longitude, 2, 36000);
1867void Telescope::generateCoordSet()
1901 nSlewRate = slewRateCount;
1910 for (
int i = 0; i < nSlewRate; i++)
1913 auto name = std::to_string(i + 1) +
"x";
2047 LOGF_INFO(
"InitPark: No Park data in file %s: %s", ParkDataFileName.c_str(), loadres);
2056 LOGF_DEBUG(
"InitPark Axis1 %.2f Axis2 %.2f", Axis1ParkPosition, Axis2ParkPosition);
2065const char *Telescope::LoadParkXML()
2072 XMLEle *parkxml =
nullptr;
2074 bool devicefound =
false;
2077 ParkstatusXml =
nullptr;
2078 ParkdeviceXml =
nullptr;
2079 ParkpositionXml =
nullptr;
2080 ParkpositionAxis1Xml =
nullptr;
2081 ParkpositionAxis2Xml =
nullptr;
2083 if (wordexp(ParkDataFileName.c_str(), &wexp, 0))
2086 return "Badly formed filename.";
2089 if (!(fp = fopen(wexp.we_wordv[0],
"r")))
2092 return strerror(
errno);
2098 if (ParkdataXmlRoot)
2105 if (!ParkdataXmlRoot)
2111 return "Empty park file.";
2113 if (!strcmp(
tagXMLEle(parkxml),
"parkdata"))
2116 return "Not a park data file";
2121 if (strcmp(
tagXMLEle(parkxml),
"device"))
2127 if (ap && (!strcmp(
valuXMLAtt(ap), ParkDeviceName)))
2138 return "No park data found for this device";
2141 ParkdeviceXml = parkxml;
2142 ParkstatusXml =
findXMLEle(parkxml,
"parkstatus");
2146 ParkpositionXml =
findXMLEle(parkxml,
"parkposition");
2147 if (ParkpositionXml)
2148 ParkpositionAxis1Xml =
findXMLEle(ParkpositionXml,
"axis1position");
2149 if (ParkpositionXml)
2150 ParkpositionAxis2Xml =
findXMLEle(ParkpositionXml,
"axis2position");
2152 if (ParkstatusXml ==
nullptr || ParkpositionAxis1Xml ==
nullptr || ParkpositionAxis2Xml ==
nullptr)
2154 return "Park data invalid or missing.";
2157 else if (ParkstatusXml ==
nullptr)
2159 return "Park data invalid or missing.";
2169 const char *result = LoadParkXML();
2170 if (result !=
nullptr)
2178 double axis1Pos = std::numeric_limits<double>::quiet_NaN();
2179 double axis2Pos = std::numeric_limits<double>::quiet_NaN();
2181 int rc = sscanf(
pcdataXMLEle(ParkpositionAxis1Xml),
"%lf", &axis1Pos);
2184 return "Unable to parse Park Position Axis 1.";
2186 rc = sscanf(
pcdataXMLEle(ParkpositionAxis2Xml),
"%lf", &axis2Pos);
2189 return "Unable to parse Park Position Axis 2.";
2192 if (std::isnan(axis1Pos) ==
false && std::isnan(axis2Pos) ==
false)
2194 Axis1ParkPosition = axis1Pos;
2195 Axis2ParkPosition = axis2Pos;
2199 return "Failed to parse Park Position.";
2209 if (LoadParkXML() !=
nullptr)
2210 LOG_DEBUG(
"Failed to refresh parking data.");
2217 XMLEle *parkxml =
nullptr;
2219 bool devicefound =
false;
2223 if (wordexp(ParkDataFileName.c_str(), &wexp, 0))
2229 if (!(fp = fopen(wexp.we_wordv[0],
"r")))
2239 if (ParkdataXmlRoot)
2246 if (!ParkdataXmlRoot)
2254 if (!strcmp(
tagXMLEle(parkxml),
"parkdata"))
2262 if (strcmp(
tagXMLEle(parkxml),
"device"))
2268 if (ap && (!strcmp(
valuXMLAtt(ap), ParkDeviceName)))
2281 ParkstatusXml =
nullptr;
2282 ParkdeviceXml =
nullptr;
2283 ParkpositionXml =
nullptr;
2284 ParkpositionAxis1Xml =
nullptr;
2285 ParkpositionAxis2Xml =
nullptr;
2287 wordexp(ParkDataFileName.c_str(), &wexp, 0);
2288 if (!(fp = fopen(wexp.we_wordv[0],
"w")))
2291 LOGF_INFO(
"WriteParkData: can not write file %s: %s", ParkDataFileName.c_str(), strerror(
errno));
2305 if (LoadParkXML() !=
nullptr)
2306 LOG_DEBUG(
"Failed to refresh parking data.");
2313 if (wordexp(ParkDataFileName.c_str(), &wexp, 0))
2316 LOGF_INFO(
"WriteParkData: can not write file %s: Badly formed filename.",
2317 ParkDataFileName.c_str());
2321 if (!(fp = fopen(wexp.we_wordv[0],
"w")))
2324 LOGF_INFO(
"WriteParkData: can not write file %s: %s", ParkDataFileName.c_str(),
2329 if (!ParkdataXmlRoot)
2330 ParkdataXmlRoot =
addXMLEle(
nullptr,
"parkdata");
2334 ParkdeviceXml =
addXMLEle(ParkdataXmlRoot,
"device");
2335 addXMLAtt(ParkdeviceXml,
"name", ParkDeviceName);
2339 ParkstatusXml =
addXMLEle(ParkdeviceXml,
"parkstatus");
2344 if (!ParkpositionXml)
2345 ParkpositionXml =
addXMLEle(ParkdeviceXml,
"parkposition");
2346 if (!ParkpositionAxis1Xml)
2347 ParkpositionAxis1Xml =
addXMLEle(ParkpositionXml,
"axis1position");
2348 if (!ParkpositionAxis2Xml)
2349 ParkpositionAxis2Xml =
addXMLEle(ParkpositionXml,
"axis2position");
2351 snprintf(pcdata,
sizeof(pcdata),
"%lf", Axis1ParkPosition);
2353 snprintf(pcdata,
sizeof(pcdata),
"%lf", Axis2ParkPosition);
2366 return Axis1ParkPosition;
2370 return Axis1DefaultParkPosition;
2374 return Axis2ParkPosition;
2378 return Axis2DefaultParkPosition;
2383 LOGF_DEBUG(
"Setting Park Axis1 to %.2f", value);
2384 Axis1ParkPosition = value;
2391 LOGF_DEBUG(
"Setting Default Park Axis1 to %.2f", value);
2392 Axis1DefaultParkPosition = value;
2397 LOGF_DEBUG(
"Setting Park Axis2 to %.2f", value);
2398 Axis2ParkPosition = value;
2405 LOGF_DEBUG(
"Setting Default Park Axis2 to %.2f", value);
2406 Axis2DefaultParkPosition = value;
2426 if (!strcmp(button_n,
"ABORTBUTTON"))
2428 auto trackSW =
getSwitch(
"TELESCOPE_TRACK_MODE");
2432 (trackSW && trackSW.getState() ==
IPS_BUSY))
2440 else if (!strcmp(button_n,
"PARKBUTTON"))
2446 else if (!strcmp(button_n,
"UNPARKBUTTON"))
2452 else if (!strcmp(button_n,
"SLEWPRESETUP"))
2456 m_slewPresetArmed =
true;
2460 else if (!strcmp(button_n,
"SLEWPRESETDOWN"))
2463 m_slewPresetArmed =
true;
2481 else if (!strcmp(joystick_n,
"SLEWPRESET"))
2489 if (!strcmp(axis_n,
"MOTIONDIRNS") || !strcmp(axis_n,
"MOTIONDIRWE"))
2493 LOG_WARN(
"Cannot slew while mount is parking/parked.");
2497 if (!strcmp(axis_n,
"MOTIONDIRNS"))
2502 motionDirNSValue = -1;
2507 motionDirNSValue = 1;
2511 motionDirNSValue = 0;
2514 else if (!strcmp(axis_n,
"MOTIONDIRWE"))
2519 motionDirWEValue = 1;
2524 motionDirWEValue = -1;
2528 motionDirWEValue = 0;
2532 float x = motionDirWEValue * sqrt(1 - pow(motionDirNSValue, 2) / 2.0f);
2533 float y = motionDirNSValue * sqrt(1 - pow(motionDirWEValue, 2) / 2.0f);
2534 float angle = atan2(y, x) * (180.0 / 3.141592653589);
2535 float mag = sqrt(pow(y, 2) + pow(x, 2));
2592 if (angle >= 90 && angle <= 270)
2601 if (angle >= 0 && angle <= 180)
2609 if (angle > 75 && angle < 105)
2613 if (angle > 165 && angle < 195)
2617 if (angle > 255 && angle < 285)
2621 if (angle > 345 || angle < 15)
2628 angle = fmod(angle + 90.0, 360.0);
2630 angle = fmod(360.0 - angle, 360.0);
2632 angle = fmod(540.0 - angle, 360.0);
2635 if (angle > 0 && angle < 180)
2647 if (angle > 180 && angle < 360)
2659 if (angle < 90 || angle > 270)
2672 if (angle > 90 && angle < 270)
2693 if (mag < 0.5 && !m_slewPresetArmed)
2694 m_slewPresetArmed =
true;
2699 if (!m_slewPresetArmed)
2702 m_slewPresetArmed =
false;
2712 if (angle > 45 && angle <= 225)
2724 if (currentIndex <= 0)
2806 const char *HomeDir = getenv(
"HOME");
2811 HomeDir = getpwuid(getuid())->pw_dir;
2813 return (HomeDir ? std::string(HomeDir) :
"");
2818 FILE *FilePtr = fopen(file_name.c_str(), (writable ?
"a" :
"r"));
2832 std::time_t t = std::time(
nullptr);
2833 struct std::tm *utctimeinfo = std::gmtime(&t);
2835 strftime(ts,
sizeof(ts),
"%Y-%m-%dT%H:%M:%S", utctimeinfo);
2838 struct std::tm *localtimeinfo = std::localtime(&t);
2839 snprintf(ts,
sizeof(ts),
"%4.2f", (localtimeinfo->tm_gmtoff / 3600.0));
2849 return m_simulatePierSide;
2861 return "PIER_UNKNOWN";
2880 capability &=
static_cast<uint32_t
>(~TELESCOPE_HAS_PIER_SIDE);
2884 m_simulatePierSide = simulate;
void registerHandshake(std::function< bool()> callback)
registerHandshake Register a handshake function to be called once the initial connection to the devic...
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 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()
void setAxisCallback(axisFunc axisCallback)
setAxisCallback Sets the callback function when a new axis input is detected.
virtual bool saveConfigItems(FILE *fp)
virtual void ISGetProperties(const char *dev)
virtual bool updateProperties()
void setJoystickCallback(joystickFunc joystickCallback)
setJoystickCallback Sets the callback function when a new joystick input is detected.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
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 setDeviceName(const char *name)
void push(WidgetView< T > &&item)
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
bool load()
load Attempt to load property values from configuration file.
void save(FILE *f) const
save Save property to configuration file.
void setLabel(const char *label)
const char * getName() const
bool isNameMatch(const char *otherName) const
bool update(const double values[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
bool isSwitchOn(const std::string &name) const
bool update(const ISState states[], const char *const names[], int n)
INDI::WidgetViewSwitch * findOnSwitch() const
int findOnSwitchIndex() const
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, ISRule rule, double timeout, IPState state)
bool update(const char *const texts[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
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.
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 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.
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
@ TELESCOPE_HAS_PIER_SIDE
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....
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
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
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_PASS_WINDOW_END
Index for end of the window.
@ SAT_PASS_WINDOW_START
Index for start of the window.
@ SAT_HALT
Halt signal (abort)
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.
#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.