1 | #include "filter_simulator.h" |
---|
2 | |
---|
3 | |
---|
4 | // We declare an auto pointer to FilterSim. |
---|
5 | std::auto_ptr<FilterSim> filter_sim(0); |
---|
6 | |
---|
7 | void ISPoll(void *p); |
---|
8 | |
---|
9 | |
---|
10 | void ISInit() |
---|
11 | { |
---|
12 | static int isInit =0; |
---|
13 | |
---|
14 | if (isInit == 1) |
---|
15 | return; |
---|
16 | |
---|
17 | isInit = 1; |
---|
18 | if(filter_sim.get() == 0) filter_sim.reset(new FilterSim()); |
---|
19 | //IEAddTimer(POLLMS, ISPoll, NULL); |
---|
20 | |
---|
21 | } |
---|
22 | |
---|
23 | void ISGetProperties(const char *dev) |
---|
24 | { |
---|
25 | ISInit(); |
---|
26 | filter_sim->ISGetProperties(dev); |
---|
27 | } |
---|
28 | |
---|
29 | void ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int num) |
---|
30 | { |
---|
31 | ISInit(); |
---|
32 | filter_sim->ISNewSwitch(dev, name, states, names, num); |
---|
33 | } |
---|
34 | |
---|
35 | void ISNewText( const char *dev, const char *name, char *texts[], char *names[], int num) |
---|
36 | { |
---|
37 | ISInit(); |
---|
38 | filter_sim->ISNewText(dev, name, texts, names, num); |
---|
39 | } |
---|
40 | |
---|
41 | void ISNewNumber(const char *dev, const char *name, double values[], char *names[], int num) |
---|
42 | { |
---|
43 | ISInit(); |
---|
44 | filter_sim->ISNewNumber(dev, name, values, names, num); |
---|
45 | } |
---|
46 | |
---|
47 | void ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n) |
---|
48 | { |
---|
49 | INDI_UNUSED(dev); |
---|
50 | INDI_UNUSED(name); |
---|
51 | INDI_UNUSED(sizes); |
---|
52 | INDI_UNUSED(blobsizes); |
---|
53 | INDI_UNUSED(blobs); |
---|
54 | INDI_UNUSED(formats); |
---|
55 | INDI_UNUSED(names); |
---|
56 | INDI_UNUSED(n); |
---|
57 | } |
---|
58 | void ISSnoopDevice (XMLEle *root) |
---|
59 | { |
---|
60 | INDI_UNUSED(root); |
---|
61 | } |
---|
62 | |
---|
63 | |
---|
64 | FilterSim::FilterSim() |
---|
65 | { |
---|
66 | //ctor |
---|
67 | } |
---|
68 | |
---|
69 | FilterSim::~FilterSim() |
---|
70 | { |
---|
71 | //dtor |
---|
72 | } |
---|
73 | |
---|
74 | const char *FilterSim::getDefaultName() |
---|
75 | { |
---|
76 | return (char *)"Filter Simulator"; |
---|
77 | } |
---|
78 | |
---|
79 | bool FilterSim::Connect() |
---|
80 | { |
---|
81 | CurrentFilter=1; |
---|
82 | MinFilter=1; |
---|
83 | MaxFilter=7; |
---|
84 | return true; |
---|
85 | } |
---|
86 | |
---|
87 | bool FilterSim::Disconnect() |
---|
88 | { |
---|
89 | return true; |
---|
90 | } |
---|
91 | |
---|
92 | int FilterSim::SelectFilter(int f) |
---|
93 | { |
---|
94 | CurrentFilter=f; |
---|
95 | SetTimer(500); |
---|
96 | return 0; |
---|
97 | } |
---|
98 | |
---|
99 | void FilterSim::TimerHit() |
---|
100 | { |
---|
101 | SelectFilterDone(CurrentFilter); |
---|
102 | } |
---|