Instrument Neutral Distributed Interface INDI 2.2.5
focus_simulator.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2012 Jasem Mutlaq. All rights reserved.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7 .
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12 .
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*******************************************************************************/
18
19#pragma once
20
21#include "indifocuser.h"
22#include "indipropertynumber.h"
23
35class FocusSim : public INDI::Focuser
36{
37 public:
38 FocusSim();
39 virtual ~FocusSim() override = default;
40
41 const char *getDefaultName() override;
42
43 void ISGetProperties(const char *dev) override;
44 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
45 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
46
47 protected:
48
49 bool initProperties() override;
50 bool updateProperties() override;
51
52 bool Connect() override;
53 bool Disconnect() override;
54
55 virtual IPState MoveFocuser(FocusDirection dir, int speed, uint16_t duration) override;
56 virtual IPState MoveAbsFocuser(uint32_t targetTicks) override;
57 virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
58 virtual bool SetFocuserSpeed(int speed) override;
59 virtual bool SyncFocuser(uint32_t ticks) override;
60
61 virtual bool SetFocuserBacklash(int32_t steps) override;
62 virtual bool SetFocuserBacklashEnabled(bool enabled) override;
63
64 virtual bool saveConfigItems(FILE *fp) override;
65
66 private:
67 double internalTicks { 0 };
68 double initTicks { 0 };
69
70 // Seeing in arcseconds
71 INDI::PropertyNumber SeeingNP {1};
72
73 // FWHM to be used by CCD driver to draw 'fuzzy' stars
74 INDI::PropertyNumber FWHMNP {1};
75
76 // Temperature in celcius degrees
77 INDI::PropertyNumber TemperatureNP {1};
78
79 INDI::PropertyNumber DelayNP {1};
80
81 // Current mode of Focus simulator for testing purposes
82 enum
83 {
84 MODE_ALL,
85 MODE_ABSOLUTE,
86 MODE_RELATIVE,
87 MODE_TIMER,
88 MODE_COUNT
89 };
90 INDI::PropertySwitch ModeSP {4};
91 // ISwitch ModeS[MODE_COUNT];
92};
The FocusSim class provides a simple Focuser simulator that can simulator the following devices:
virtual bool SyncFocuser(uint32_t ticks) override
SyncFocuser Set current position to ticks without moving the focuser.
bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
virtual bool SetFocuserBacklash(int32_t steps) override
SetFocuserBacklash Set the focuser backlash compensation value.
void ISGetProperties(const char *dev) override
Handles client requests for property definitions for this device or all devices. Delegates to the bas...
bool Disconnect() override
Disconnect from device.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Processes incoming new number values from the client for this device. Handles updates to FocuserInter...
const char * getDefaultName() override
virtual IPState MoveFocuser(FocusDirection dir, int speed, uint16_t duration) override
MoveFocuser the focuser in a particular direction with a specific speed for a finite duration.
virtual bool SetFocuserBacklashEnabled(bool enabled) override
SetFocuserBacklashEnabled Enables or disables the focuser backlash compensation.
virtual ~FocusSim() override=default
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Processes incoming new switch states from the client for this device. Handles updates to FocuserInter...
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
virtual bool saveConfigItems(FILE *fp) override
bool updateProperties() override
Updates the state and definition of properties based on the current connection status....
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
virtual bool SetFocuserSpeed(int speed) override
SetFocuserSpeed Set Focuser speed.
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158