Instrument Neutral Distributed Interface INDI 2.2.5
pac_simulator.h
Go to the documentation of this file.
1/*******************************************************************************
2 PAC Simulator (Polar Alignment Correction)
3
4 SPDX-FileCopyrightText: 2026 Joaquin Rodriguez
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*******************************************************************************/
7
8#pragma once
9
10#include "defaultdevice.h"
11#include "indipacinterface.h"
12
14{
15 public:
17 virtual ~PACSimulator() override = default;
18
19 bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
20 bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
21
22 protected:
23 bool initProperties() override;
24 bool updateProperties() override;
25 bool saveConfigItems(FILE *fp) override;
26
27 bool Connect() override
28 {
29 return true;
30 }
31 bool Disconnect() override
32 {
33 return true;
34 }
35 const char *getDefaultName() override
36 {
37 return "Alignment Correction Simulator";
38 }
39
40 // From PACInterface – single-axis movement
41 // MoveAZ: positive = East, negative = West
42 virtual IPState MoveAZ(double degrees) override;
43 // MoveALT: positive = North, negative = South
44 virtual IPState MoveALT(double degrees) override;
45
46 // From PACInterface – abort, speed and reverse
47 virtual bool AbortMotion() override;
48 virtual bool SetPACSpeed(uint16_t speed) override;
49 virtual bool ReverseAZ(bool enabled) override;
50 virtual bool ReverseALT(bool enabled) override;
51
52 private:
53 INDI::PropertyNumber CorrectionGainNP {1};
54
55 // Track how many axes are still moving so we can set the final state correctly.
56 int m_MovingAxes {0};
57};
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
virtual bool ReverseAZ(bool enabled) override
ReverseAZ Reverse the direction of azimuth axis movement.
virtual bool ReverseALT(bool enabled) override
ReverseALT Reverse the direction of altitude axis movement.
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
virtual bool SetPACSpeed(uint16_t speed) override
SetPACSpeed Set the motor speed used for axis movements.
bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
const char * getDefaultName() override
bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
bool Disconnect() override
Disconnect from device.
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual IPState MoveALT(double degrees) override
MoveALT Move the altitude axis by the given number of degrees.
virtual IPState MoveAZ(double degrees) override
Move the azimuth axis by the given number of degrees.
virtual bool AbortMotion() override
AbortMotion Abort all axis motion immediately.
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual ~PACSimulator() override=default
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158