41 FilterSlotNP[0].fill(
"FILTER_SLOT_VALUE",
"Filter",
"%.f", 1.0, 12, 1.0, 1.0);
53 int maxSlots =
static_cast<int>(
FilterSlotNP[0].getMax());
55 if (nameCount > 0 && nameCount < maxSlots)
60 for (
int i = nameCount; i < maxSlots; i++)
62 snprintf(filterName,
MAXINDINAME,
"FILTER_SLOT_NAME_%d", i + 1);
66 oneWidget.
fill(filterName, filterLabel, filterLabel);
72 "Filter wheel has %d slots but only %d names were saved. "
73 "Added default names for slots %d-%d.",
74 maxSlots, nameCount, nameCount + 1, maxSlots);
78 else if (nameCount > maxSlots)
85 "Filter wheel has %d slots but %d names were saved. "
87 maxSlots, nameCount, maxSlots);
134 "Error: requested slot %d is invalid (Range from %.f to %.f",
157 if (dev && !strcmp(dev,
m_defaultDevice->getDeviceName()) && !strcmp(name,
"FILTER_NAME"))
202 const char *filterDesignation[8] = {
"Red",
"Green",
"Blue",
"H_Alpha",
"SII",
"OIII",
"LPR",
"Luminance" };
206 for (
int i = 0; i < MaxFilter; i++)
208 snprintf(filterName,
MAXINDINAME,
"FILTER_SLOT_NAME_%d", i + 1);
209 snprintf(filterLabel,
MAXINDILABEL,
"Filter#%d", i + 1);
212 oneText.
fill(filterName, filterLabel, i < 8 ? filterDesignation[i] : filterLabel);
235bool FilterInterface::loadFilterNames()
241 XMLEle *root =
nullptr, *fproot =
nullptr;
256 if (fproot ==
nullptr)
266 if (
crackDN(root, &rdev, &rname, errmsg) < 0)
278 if (!strcmp(
"FILTER_NAME", rname))
282 XMLEle *oneText =
nullptr;
288 snprintf(filterName,
MAXINDINAME,
"FILTER_SLOT_NAME_%d", counter + 1);
291 oneWidget.
fill(filterName, filter, filter);
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
virtual const char * getDefaultName()=0
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.
INDI::PropertyNumber FilterSlotNP
DefaultDevice * m_defaultDevice
INDI::PropertyText FilterNameTP
virtual bool SetFilterNames()
Set filter names as defined by the client for each filter position. The desired filter names are stor...
bool updateProperties()
updateProperties Defines or Delete properties 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)
Initialize filter wheel properties. It is recommended to call this function within initProperties() o...
bool saveConfigItems(FILE *fp)
saveConfigItems save Filter Names in config file
int crackDN(XMLEle *root, char **dev, char **name, char msg[])
Extract dev and name attributes from an XML element.
FILE * IUGetConfigFP(const char *filename, const char *dev, const char *mode, char errmsg[])
Open a configuration file for writing and return a configuration file FILE pointer.
*brief user defined string literal for JSON values *sa std::size_t n
#define DEBUGDEVICE(device, priority, msg)
#define DEBUGFDEVICE(device, priority, msg,...)
XMLEle * nextXMLEle(XMLEle *ep, int init)
Iterate an XML element for a list of nesetd XML elements.
LilXML * newLilXML()
Create a new lilxml parser.
void delXMLEle(XMLEle *ep)
delXMLEle Delete XML element.
char * pcdataXMLEle(XMLEle *ep)
Return the pcdata of an XML element.
void delLilXML(LilXML *lp)
Delete a lilxml parser.
XMLEle * readXMLFile(FILE *fp, LilXML *lp, char ynot[])
Handy wrapper to read one xml file.
Namespace to encapsulate INDI client, drivers, and mediator classes.
INDI::WidgetViewText WidgetText
void fill(const char *name, const char *label, const char *initialText)