1 | /******************************************************************************* |
---|
2 | Copyright(c) 2010 Gerry Rozema. All rights reserved. |
---|
3 | |
---|
4 | This program is free software; you can redistribute it and/or modify it |
---|
5 | under the terms of the GNU General Public License as published by the Free |
---|
6 | Software Foundation; either version 2 of the License, or (at your option) |
---|
7 | any later version. |
---|
8 | |
---|
9 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
12 | more details. |
---|
13 | |
---|
14 | You should have received a copy of the GNU General Public License along with |
---|
15 | this program; if not, write to the Free Software Foundation, Inc., 59 |
---|
16 | Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
17 | |
---|
18 | The full GNU General Public License is included in this distribution in the |
---|
19 | file called LICENSE. |
---|
20 | *******************************************************************************/ |
---|
21 | |
---|
22 | #ifndef CCDSIM_H |
---|
23 | #define CCDSIM_H |
---|
24 | |
---|
25 | #include "indibase/indiccd.h" |
---|
26 | |
---|
27 | /* Some headers we need */ |
---|
28 | #include <math.h> |
---|
29 | #include <sys/time.h> |
---|
30 | |
---|
31 | |
---|
32 | class CCDSim : public INDI::CCD |
---|
33 | { |
---|
34 | protected: |
---|
35 | private: |
---|
36 | |
---|
37 | bool InExposure; |
---|
38 | float ExposureRequest; |
---|
39 | struct timeval ExpStart; |
---|
40 | |
---|
41 | bool InGuideExposure; |
---|
42 | float GuideExposureRequest; |
---|
43 | struct timeval GuideExpStart; |
---|
44 | |
---|
45 | float CalcTimeLeft(timeval,float); |
---|
46 | |
---|
47 | int testvalue; |
---|
48 | int ShowStarField; |
---|
49 | int bias; |
---|
50 | int maxnoise; |
---|
51 | int maxval; |
---|
52 | float skyglow; |
---|
53 | float limitingmag; |
---|
54 | float saturationmag; |
---|
55 | float seeing; |
---|
56 | float ImageScalex; |
---|
57 | float ImageScaley; |
---|
58 | float focallength; |
---|
59 | float OAGoffset; |
---|
60 | float TimeFactor; |
---|
61 | // our zero point calcs used for drawing stars |
---|
62 | float k; |
---|
63 | float z; |
---|
64 | |
---|
65 | bool AbortGuideFrame; |
---|
66 | |
---|
67 | float RA; |
---|
68 | float Dec; |
---|
69 | float GuideRate; |
---|
70 | |
---|
71 | float PEPeriod; |
---|
72 | float PEMax; |
---|
73 | time_t RunStart; |
---|
74 | |
---|
75 | // We are going to snoop these from a telescope |
---|
76 | INumberVectorProperty EqNV; |
---|
77 | INumber EqN[2]; |
---|
78 | |
---|
79 | // And this lives in our simulator settings page |
---|
80 | |
---|
81 | INumberVectorProperty *SimulatorSettingsNV; |
---|
82 | INumber SimulatorSettingsN[13]; |
---|
83 | |
---|
84 | ITextVectorProperty *TelescopeTV; // A text vector that stores the telescope we want to snoop |
---|
85 | IText TelescopeT[1]; |
---|
86 | |
---|
87 | //ISwitch ConfigSaveRestoreS[2]; |
---|
88 | //ISwitchVectorProperty ConfigSaveRestoreSV; |
---|
89 | |
---|
90 | ISwitch TimeFactorS[3]; |
---|
91 | ISwitchVectorProperty *TimeFactorSV; |
---|
92 | |
---|
93 | bool SetupParms(); |
---|
94 | |
---|
95 | public: |
---|
96 | CCDSim(); |
---|
97 | virtual ~CCDSim(); |
---|
98 | |
---|
99 | const char *getDefaultName(); |
---|
100 | |
---|
101 | bool initProperties(); |
---|
102 | bool updateProperties(); |
---|
103 | |
---|
104 | void ISGetProperties (const char *dev); |
---|
105 | void ISSnoopDevice (XMLEle *root); |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | bool Connect(); |
---|
110 | bool Disconnect(); |
---|
111 | |
---|
112 | int StartExposure(float duration); |
---|
113 | int StartGuideExposure(float); |
---|
114 | bool AbortGuideExposure(); |
---|
115 | |
---|
116 | |
---|
117 | void TimerHit(); |
---|
118 | |
---|
119 | int DrawCcdFrame(); |
---|
120 | int DrawGuiderFrame(); |
---|
121 | |
---|
122 | int DrawImageStar(float,float,float); |
---|
123 | int AddToPixel(int,int,int); |
---|
124 | |
---|
125 | int GuideNorth(float); |
---|
126 | int GuideSouth(float); |
---|
127 | int GuideEast(float); |
---|
128 | int GuideWest(float); |
---|
129 | |
---|
130 | virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n); |
---|
131 | virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n); |
---|
132 | virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n); |
---|
133 | |
---|
134 | }; |
---|
135 | |
---|
136 | #endif // CCDSim_H |
---|