Instrument Neutral Distributed Interface INDI  1.9.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 }
INDI::FilterInterface::FilterSlotNP
INumberVectorProperty FilterSlotNP
Definition: indifilterinterface.h:121
indibase.h
INDI::FilterInterface::FilterInterface
FilterInterface(DefaultDevice *defaultDevice)
FilterInterface Initiailize Filter Interface.
Definition: indifilterinterface.cpp:28
INumber
One number descriptor.
INDI::FilterInterface::processNumber
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process number properties.
Definition: indifilterinterface.cpp:71
INDI::FilterInterface::CurrentFilter
int CurrentFilter
Definition: indifilterinterface.h:128
INDI::FilterInterface::FilterSlotN
INumber FilterSlotN[1]
Definition: indifilterinterface.h:122
INDI::FilterInterface::GetFilterNames
virtual bool GetFilterNames()
Obtains a list of filter names from the hardware and initializes the FilterNameTP property....
Definition: indifilterinterface.cpp:215
INDI::FilterInterface::generateSampleFilters
void generateSampleFilters()
generateSampleFilters Generate sample 8-filter wheel and fill it sample filters
Definition: indifilterinterface.cpp:187
INDI::FilterInterface::updateProperties
bool updateProperties()
updateProperties Defines or Delete proprties based on default device connection status
Definition: indifilterinterface.cpp:48
_ITextVectorProperty
Text vector property descriptor.
Definition: indiapi.h:244
INDI::FilterInterface
Definition: indifilterinterface.h:45
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
INDI::FilterInterface::SelectFilter
virtual bool SelectFilter(int position)=0
Select a new filter position.
IText
One text descriptor.
INDI::FilterInterface::SetFilterNames
virtual bool SetFilterNames()
Set filter names as defined by the client for each filter position. The desired filter names are stor...
Definition: indifilterinterface.cpp:235
INDI::FilterInterface::FilterNameTP
ITextVectorProperty * FilterNameTP
Definition: indifilterinterface.h:125
INDI::FilterInterface::loadingFromConfig
bool loadingFromConfig
Definition: indifilterinterface.h:130
INDI::FilterInterface::TargetFilter
int TargetFilter
Definition: indifilterinterface.h:129
INDI::FilterInterface::FilterNameT
IText * FilterNameT
Definition: indifilterinterface.h:126
INDI::FilterInterface::saveConfigItems
bool saveConfigItems(FILE *fp)
saveConfigItems save Filter Names in config file
Definition: indifilterinterface.cpp:167
INDI::FilterInterface::processText
bool processText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process text properties.
Definition: indifilterinterface.cpp:112
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition: AlignmentSubsystemForClients.cpp:11
INDI::FilterInterface::SelectFilterDone
void SelectFilterDone(int newpos)
The child class calls this function when the hardware successfully finished selecting a new filter wh...
Definition: indifilterinterface.cpp:176
INDI::FilterInterface::~FilterInterface
~FilterInterface()
Definition: indifilterinterface.cpp:34
INDI::FilterInterface::QueryFilter
virtual int QueryFilter()=0
Return current filter position.
INDI::FilterInterface::initProperties
void initProperties(const char *groupName)
Initilize filter wheel properties. It is recommended to call this function within initProperties() of...
Definition: indifilterinterface.cpp:39
INDI::DefaultDevice
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Definition: defaultdevice.h:118
INDI::FilterInterface::m_defaultDevice
DefaultDevice * m_defaultDevice
Definition: indifilterinterface.h:132