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",
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);
const char * getDeviceName() const
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
bool isConfigLoading() const
isConfigLoading Check if driver configuration is currently in the process of getting loaded.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
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
void push(WidgetView< T > &&item)
void setState(IPState state)
WidgetView< T > * findWidgetByName(const char *name) const
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
void save(FILE *f) const
save Save property to configuration file.
const char * getName() const
bool isNameMatch(const char *otherName) const
const char * getGroupName() const
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
bool update(const char *const texts[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
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.
#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.
void fill(const char *name, const char *label, const char *initialText)