Instrument Neutral Distributed Interface INDI  2.0.2
indifilterinterface.h
Go to the documentation of this file.
1 /*
2  Filter Interface
3  Copyright (C) 2011 Jasem Mutlaq (mutlaqja@ikarustech.com)
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 */
20 
21 #pragma once
22 
23 #include <string>
24 #include <vector>
25 #include "indibase.h"
26 
42 namespace INDI
43 {
44 
46 {
47  public:
49  virtual int QueryFilter() = 0;
50 
55  virtual bool SelectFilter(int position) = 0;
56 
63  virtual bool SetFilterNames();
64 
72  virtual bool GetFilterNames();
73 
79  void SelectFilterDone(int newpos);
80 
81  protected:
86  explicit FilterInterface(DefaultDevice *defaultDevice);
88 
94  void initProperties(const char *groupName);
95 
100  bool updateProperties();
101 
103  bool processNumber(const char *dev, const char *name, double values[], char *names[], int n);
104 
106  bool processText(const char *dev, const char *name, char *texts[], char *names[], int n);
107 
111  void generateSampleFilters();
112 
118  bool saveConfigItems(FILE *fp);
119 
120  // A number vector for filter slot
123 
124  // A text vector that stores out physical port name
127 
128  int CurrentFilter = 1;
129  int TargetFilter = 1;
130  bool loadingFromConfig = false;
131 
133 
134  private:
140  bool loadFilterNames();
141 };
142 }
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
FilterInterface(DefaultDevice *defaultDevice)
FilterInterface Initiailize Filter Interface.
virtual bool SelectFilter(int position)=0
Select a new filter position.
bool processText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process text properties.
DefaultDevice * m_defaultDevice
virtual bool SetFilterNames()
Set filter names as defined by the client for each filter position. The desired filter names are stor...
ITextVectorProperty * FilterNameTP
INumberVectorProperty FilterSlotNP
virtual int QueryFilter()=0
Return current filter position.
bool updateProperties()
updateProperties Defines or Delete proprties based on default device connection status
void generateSampleFilters()
generateSampleFilters Generate sample 8-filter wheel and fill it sample filters
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process number properties.
void SelectFilterDone(int newpos)
The child class calls this function when the hardware successfully finished selecting a new filter wh...
virtual bool GetFilterNames()
Obtains a list of filter names from the hardware and initializes the FilterNameTP property....
void initProperties(const char *groupName)
Initilize filter wheel properties. It is recommended to call this function within initProperties() of...
bool saveConfigItems(FILE *fp)
saveConfigItems save Filter Names in config file
Namespace to encapsulate INDI client, drivers, and mediator classes.
One number descriptor.
One text descriptor.
Number vector property descriptor.
Definition: indiapi.h:319
Text vector property descriptor.
Definition: indiapi.h:246