36#ifdef _USE_SYSTEM_JSONLIB
37#include <nlohmann/json.hpp>
71 virtual bool ISNewSwitch(
const char *dev,
const char *name,
ISState *states,
char *names[],
int n)
override;
78 virtual bool ISNewNumber(
const char *dev,
const char *name,
double values[],
char *names[],
int n)
override;
85 virtual bool ISNewText(
const char * dev,
const char * name,
char * texts[],
char * names[],
int n)
override;
100 return m_CanCalibrate;
116 return m_CanSetAltitude;
124 return m_CanSetAzimuth;
140 return m_CanSetShutter;
156 return m_CanSyncAzimuth;
193 virtual bool Connect()
override;
206 virtual bool SetSpeed(
double rpm)
override;
233 virtual bool Sync(
double az)
override;
239 virtual bool Abort()
override;
296 virtual std::string
getAlpacaURL(
const std::string &endpoint);
339 struct AlapacaDomeState
350 void updateDomeStatus(AlapacaDomeState &state);
351 void updateShutterStatus(AlapacaDomeState &state);
356 bool sendAlpacaGET(
const std::string &endpoint,
nlohmann::json &response);
362 bool alpacaConnect();
363 bool alpacaDisconnect();
368 bool alpacaGetBool(
const std::string &endpoint,
bool& value,
bool defaultValue =
false);
369 bool alpacaGetInt(
const std::string &endpoint,
int& value,
int defaultValue = 0);
370 bool alpacaGetDouble(
const std::string &endpoint,
double& value,
double defaultValue = 0.0);
371 bool alpacaGetString(
const std::string &endpoint, std::string& value,
const std::string& defaultValue =
"");
372 bool alpacaGetDeviceState(AlapacaDomeState &value,
double defaultAz = 0.0,
double defaultAlt = 0.0);
378 bool alpacaDomeAbortSlew();
379 bool alpacaDomeCloseShutter();
380 bool alpacaDomeFindHome();
381 bool alpacaDomeOpenShutter();
382 bool alpacaDomePark();
383 bool alpacaDomeSetPark();
384 bool alpacaDomeSlewToAltitude(
double alt);
385 bool alpacaDomeSlewToAzimuth(
double az);
386 bool alpacaDomeSyncToAzimuth(
double az);
391 bool m_CanFindHome {
false};
392 bool m_CanCalibrate {
false};
393 bool m_CanPark {
false};
394 bool m_CanSetAltitude {
false};
395 bool m_CanSetAzimuth {
false};
396 bool m_CanSetPark {
false};
397 bool m_CanSetShutter {
true};
398 bool m_CanSlave {
false};
399 bool m_CanSyncAzimuth {
false};
402 std::string m_DeviceName, m_Description, m_DriverInfo, m_DriverVersion;
403 int m_InterfaceVersion {1};
408 std::unique_ptr<httplib::Client> httpClient;
409 uint32_t m_ClientTransactionID {1};
412 std::string m_ConfigHost;
413 std::string m_ConfigPort;
INDI::PropertySwitch OperationSP
virtual bool saveConfigItems(FILE *fp) override
Save all dome parameters in the configuration file. This overridden method adds the HTTP connection i...
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool Abort() override
Abort all dome motion (spinning and shutter).
virtual IPState FindHome()
Request the dome for moving and finding its Home position. The method is asynchronous and the dome sh...
virtual bool SetCurrentPark() override
Set parking position of the dome with the current position.
virtual IPState Park() override
Park the dome.
virtual bool SetSpeed(double rpm) override
Set Dome speed. This does not initiate motion, it sets the speed for the next motion command....
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual IPState MoveAbs(double az) override
Move the Dome to an absolute azimuth.
virtual bool Disconnect() override
Disconnect from the remote dome device.
virtual IPState MoveRel(double azDiff) override
Move the Dome to an relative 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...
virtual uint32_t getTransactionId()
INDI::PropertyText ServerAddressTP
Additional properties.
virtual IPState Move(DomeDirection dir, DomeMotionCommand operation) override
Move the Dome in a particular direction.
INDI::PropertyNumber DeviceNumberNP
virtual IPState ControlShutter(ShutterOperation operation) override
Open or Close the shutter.
virtual bool updateProperties() override
Called whenever there is a change in the CONNECTION status of the driver. This will enable the driver...
INDI::PropertyText InfoTP
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual std::string buildAlpacaFormData(const nlohmann::json &request)
INDI::PropertyNumber ConnectionSettingsNP
virtual bool initProperties() override
Initialize properties state and value for Alpaca dome device.
virtual const char * getDefaultName() override
virtual void setDefaultServerAddress(const char *host, const char *port, bool force=false)
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual IPState Calibrate()
Request the dome for moving in order to calibrate itself. The calibration is an asynchronous process ...
virtual bool Sync(double az) override
Set the dome current azimuth with the supplied azimuth position.
virtual bool Connect() override
Connect to the remote dome device. For Alpaca drivers, this method tries to connect to the device usi...
virtual IPState UnPark() override
UnPark the dome. The action of the Unpark command is dome specific, but it may include opening the sh...
virtual ~AlpacaDome()=default
virtual bool SetDefaultPark() override
Set parking position of the dome with the current position.
virtual std::string getAlpacaURL(const std::string &endpoint)
Class to provide general functionality of a Dome device.
ShutterOperation
Shutter operation command.
a class to store JSON values