28static std::unique_ptr<DomeSim> domeSim(
new DomeSim());
49 SpeedNP[Dome].fill(
"DOME",
"Dome (deg/s)",
"%.2f", 0.1, 10, 1, 5);
50 SpeedNP[Shutter].fill(
"SHUTTER",
"Shutter (m/s)",
"%.2f", 0.01, 1, 0.1, 0.1);
69bool DomeSim::SetupParms()
95 return "Dome Simulator";
142 if (SpeedNP.isNameMatch(name))
144 SpeedNP.update(values, names,
n);
163 auto domeSpeed = SpeedNP[Dome].getValue();
164 auto shutterSpeed = SpeedNP[Shutter].getValue();
170 if (m_MoveDirection != 0)
179 int sign = (a - b >= 0 && a - b <= 180) || (a - b <= -180 && a - b >= -360) ? 1 : -1;
182 if (std::abs(targetAz -
DomeAbsPosNP[0].getValue()) <= domeSpeed)
185 LOG_INFO(
"Dome reached requested azimuth angle.");
202 m_ShutterDistance -= shutterSpeed;
204 if (m_ShutterDistance <= 0)
206 m_ShutterDistance = 0;
208 LOGF_INFO(
"Shutter is %s.", opened ?
"open" :
"closed");
224 m_MoveDirection = (dir ==
DOME_CW) ? 1 : -1;
247 if (std::abs(az -
DomeAbsPosNP[0].getValue()) < SpeedNP[Dome].getValue())
263 if (std::abs(targetAz -
DomeAbsPosNP[0].value) < SpeedNP[Dome].getValue())
309 LOG_ERROR(
"Shutter operation aborted. Status: unknown.");
The DomeSim class provides an absolute position dome that supports parking, unparking,...
virtual bool Abort() override
Abort all dome motion.
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual IPState Park() override
Goto Park Position. The park position is an absolute azimuth value.
virtual const char * getDefaultName() override
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
bool Disconnect() override
Disconnect from device.
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual IPState UnPark() override
UnPark dome. The action of the Unpark command is dome specific, but it may include opening the shutte...
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the Device Port and Dome Presets in the configuration file
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual IPState MoveAbs(double az) override
Move the Dome to an absolute azimuth.
virtual IPState MoveRel(double azDiff) override
Move the Dome to an relative position.
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
virtual IPState ControlShutter(ShutterOperation operation) override
Open or Close shutter.
virtual IPState Move(DomeDirection dir, DomeMotionCommand operation) override
Move the Dome in a particular direction.
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
uint32_t getPollingPeriod() const
getPollingPeriod Return the polling period.
void defineProperty(INumberVectorProperty *property)
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
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.
INDI::PropertySwitch ShutterParkPolicySP
void SetAxis1Park(double value)
SetRAPark Set current AZ parking position. The data park file (stored in ~/.indi/ParkData....
ShutterOperation
Shutter operation command.
void SetAxis1ParkDefault(double steps)
SetAxis1Park Set default AZ parking position.
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
INDI::PropertyNumber DomeMeasurementsNP
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
INDI::PropertyNumber DomeAbsPosNP
void setShutterState(const ShutterState &value)
void setDomeState(const DomeState &value)
bool InitPark()
InitPark Loads parking data (stored in ~/.indi/ParkData.xml) that contains parking status and parking...
void SetParkDataType(DomeParkData type)
setParkDataType Sets the type of parking data stored in the park data file and presented to the user.
INDI::PropertySwitch DomeShutterSP
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
DomeState getDomeState() const
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
double range360(double r)
range360 Limits an angle to be between 0-360 degrees.
Implementations for common driver routines.
*brief user defined string literal for JSON values *sa std::size_t n
#define LOGF_INFO(fmt,...)
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...