62 it->defaultDevice->ISGetProperties(dev);
69 if (dev ==
nullptr || strcmp(dev, it->defaultDevice->getDeviceName()) == 0)
70 it->defaultDevice->ISNewSwitch(dev, name, states, names, n);
73 void ISNewNumber(
const char *dev,
const char *name,
double values[],
char *names[],
int n)
77 if (dev ==
nullptr || strcmp(dev, it->defaultDevice->getDeviceName()) == 0)
78 it->defaultDevice->ISNewNumber(dev, name, values, names, n);
81 void ISNewText(
const char *dev,
const char *name,
char *texts[],
char *names[],
int n)
85 if (dev ==
nullptr || strcmp(dev, it->defaultDevice->getDeviceName()) == 0)
86 it->defaultDevice->ISNewText(dev, name, texts, names, n);
90 int sizes[],
int blobsizes[],
char *blobs[],
char *formats[],
char *names[],
int n
95 if (dev ==
nullptr || strcmp(dev, it->defaultDevice->getDeviceName()) == 0)
96 it->defaultDevice->ISNewBLOB(dev, name, sizes, blobsizes, blobs, formats, names, n);
103 it->defaultDevice->ISSnoopDevice(root);
126 static struct WeakIDLoader
151 if (devPtr !=
nullptr)
166 : defaultDevice(defaultDevice)
182 d->m_MainLoopTimer.setSingleShot(
true);
196 d->isConfigLoading =
true;
198 d->isConfigLoading =
false;
204 LOG_DEBUG(
"Configuration successfully loaded.");
207 LOG_INFO(
"No previous configuration found. To save driver configuration, click Save Configuration in Options tab.");
212 if (d->isDefaultConfigLoaded ==
false)
224 d->PollPeriodNP.save(fp);
225 if (!d->ConnectionModeSP.isEmpty())
226 d->ConnectionModeSP.save(fp);
228 if (d->activeConnection !=
nullptr)
229 d->activeConnection->saveConfigItems(fp);
240 const auto &svp = oneProperty.getSwitch();
244 (svp->getRule() ==
ISR_1OFMANY && svp->findOnSwitch() ==
nullptr)
248 oneProperty.save(fp);
262 LOG_INFO(
"Configuration file successfully purged.");
279 if (property ==
nullptr)
286 LOGF_WARN(
"Failed to save configuration. %s", errmsg);
299 if (d->isDefaultConfigLoaded ==
false)
304 LOG_DEBUG(
"Configuration successfully saved.");
329 bool propertySaved =
false;
336 if (strcmp(elemName, property))
339 if (!strcmp(tagName,
"newSwitchVector"))
351 auto oneSwitch = svp.findWidgetByName(
findXMLAttValu(sw,
"name"));
358 snprintf(formatString,
MAXRBUF,
" %s\n", oneSwitch->getStateAsString());
362 propertySaved =
true;
365 else if (!strcmp(tagName,
"newNumberVector"))
377 auto oneNumber = nvp.findWidgetByName(
findXMLAttValu(np,
"name"));
382 snprintf(formatString,
MAXRBUF,
" %.20g\n", oneNumber->getValue());
386 propertySaved =
true;
389 else if (!strcmp(tagName,
"newTextVector"))
406 snprintf(formatString,
MAXRBUF,
" %s\n", oneText->getText() ? oneText->getText() :
"");
410 propertySaved =
true;
422 LOGF_DEBUG(
"Configuration successfully saved for %s.", property);
438 char configDefaultFileName[
MAXRBUF];
440 bool pResult =
false;
442 if (getenv(
"INDICONFIG"))
443 snprintf(configDefaultFileName,
MAXRBUF,
"%s.default", getenv(
"INDICONFIG"));
445 snprintf(configDefaultFileName,
MAXRBUF,
"%s/.indi/%s_config.xml.default", getenv(
"HOME"),
getDeviceName());
447 LOGF_DEBUG(
"Requesting to load default config with: %s", configDefaultFileName);
452 LOG_INFO(
"Default configuration loaded.");
454 LOGF_INFO(
"Error loading default configuraiton. %s", errmsg);
468 if (!property.isValid())
476 property.isNameMatch(
"DEBUG_LEVEL") ||
477 property.isNameMatch(
"LOGGING_LEVEL") ||
478 property.isNameMatch(
"LOG_OUTPUT"))
482 if (property.isNameMatch(
"LOG_OUTPUT"))
484 auto sw =
property.findWidgetByName(
"FILE_DEBUG");
485 if (sw !=
nullptr && sw->getState() ==
ISS_ON)
492 property.update(states, names, n);
493 if (property.hasUpdateCallback())
498 rc |= oneConnection->
ISNewSwitch(dev, name, states, names, n);
509 if (!property.isValid())
512 property.update(values, names, n);
513 if (property.hasUpdateCallback())
517 oneConnection->
ISNewNumber(dev, name, values, names, n);
528 if (!property.isValid())
531 property.update(texts, names, n);
532 if (property.hasUpdateCallback())
536 oneConnection->
ISNewText(dev, name, texts, names, n);
542 char *formats[],
char *names[],
int n)
548 if (!property.isValid())
551 property.update(sizes, blobsizes, blobs, formats, names, n);
552 if (property.hasUpdateCallback())
556 oneConnection->
ISNewBLOB(dev, name, sizes, blobsizes, blobs, formats, names, n);
571 d->watchDevice.watchDevice(name, callback);
586 d->isSimulation =
false;
612 if (d->isDebug == enable)
614 d->DebugSP.setState(
IPS_OK);
621 auto sp = d->DebugSP.findWidgetByName(enable ?
"ENABLE" :
"DISABLE");
625 LOGF_INFO(
"Debug is %s.", enable ?
"enabled" :
"disabled");
635 d->DebugSP.setState(
IPS_OK);
642 if (d->isSimulation == enable)
644 d->SimulationSP.setState(
IPS_OK);
645 d->SimulationSP.apply();
649 d->SimulationSP.reset();
651 auto sp = d->SimulationSP.findWidgetByName(enable ?
"ENABLE" :
"DISABLE");
654 LOGF_INFO(
"Simulation is %s.", enable ?
"enabled" :
"disabled");
658 d->isSimulation = enable;
660 d->SimulationSP.setState(
IPS_OK);
661 d->SimulationSP.apply();
673 return d->isSimulation;
689 if (d->isInit ==
false)
695 char *envDev = getenv(
"INDIDEV");
696 if (envDev !=
nullptr)
707 if (d->connections.size() == 0)
708 d->DriverInfoTP.setGroupName(
INFO_TAB);
713 if (d->defineDynamicProperties ==
false && oneProperty.isDynamic())
716 oneProperty.define();
720 if (d->isInit ==
false)
729 if (d->ConnectionModeSP.isEmpty())
731 if (d->connections.size() > 0)
733 d->ConnectionModeSP.resize(d->connections.size());
734 auto sp = &d->ConnectionModeSP[0];
745 d->ConnectionModeSP[d->m_ConfigConnectionMode].setState(
ISS_ON);
746 d->activeConnection = d->connections[d->m_ConfigConnectionMode];
749 else if (d->activeConnection !=
nullptr)
751 auto it = std::find(d->connections.begin(), d->connections.end(), d->activeConnection);
752 if (it != d->connections.end())
754 int index = std::distance(d->connections.begin(), it);
756 d->ConnectionModeSP[index].setState(
ISS_ON);
762 d->ConnectionModeSP[0].setState(
ISS_ON);
763 d->activeConnection = d->connections[0];
767 d->activeConnection->Activated();
796 svp.apply(
"%s", msg);
804 d->m_MainLoopTimer.start(ms);
814 d->m_MainLoopTimer.stop();
842 return atoi(d->DriverInfoTP[3 ].getText());
854 d->DriverInfoTP.apply();
861 char interfaceStr[16];
863 snprintf(versionStr, 16,
"%d.%d", d->majorVersion, d->minorVersion);
867 d->ConnectionModeSP.onUpdate([d](){
868 int activeConnectionMode = d->ConnectionModeSP.findOnSwitchIndex();
870 if (activeConnectionMode >= 0 && activeConnectionMode <
static_cast<int>(d->connections.size()))
872 d->activeConnection = d->connections[activeConnectionMode];
873 d->activeConnection->Activated();
875 for (Connection::Interface *oneConnection : d->connections)
877 if (oneConnection == d->activeConnection)
880 oneConnection->Deactivated();
883 d->ConnectionModeSP.setState(
IPS_OK);
888 d->ConnectionModeSP.apply();
893 d->ConnectionSP[INDI_ENABLED ].fill(
"CONNECT",
"Connect",
ISS_OFF);
894 d->ConnectionSP[INDI_DISABLED].fill(
"DISCONNECT",
"Disconnect",
ISS_ON);
901 if (isConnected() == false)
910 setConnected(false, IPS_ALERT);
920 if (isConnected() == true)
925 setConnected(false, IPS_IDLE);
929 setConnected(true, IPS_ALERT);
937 registerProperty(d->ConnectionSP);
939 d->DriverInfoTP[0].fill(
"DRIVER_NAME",
"Name", getDriverName());
940 d->DriverInfoTP[1].fill(
"DRIVER_EXEC",
"Exec", getDriverExec());
941 d->DriverInfoTP[2].fill(
"DRIVER_VERSION",
"Version", versionStr);
942 d->DriverInfoTP[3].fill(
"DRIVER_INTERFACE",
"Interface", interfaceStr);
944 registerProperty(d->DriverInfoTP);
947 d->DebugSP[INDI_ENABLED ].fill(
"ENABLE",
"Enable",
ISS_OFF);
948 d->DebugSP[INDI_DISABLED].fill(
"DISABLE",
"Disable",
ISS_ON);
950 d->DebugSP.onUpdate([
this, d]()
952 auto sp = d->DebugSP.findOnSwitch();
953 assert(sp !=
nullptr);
954 setDebug(sp->isNameMatch(
"ENABLE") ?
true :
false);
958 d->SimulationSP[INDI_ENABLED ].fill(
"ENABLE",
"Enable",
ISS_OFF);
959 d->SimulationSP[INDI_DISABLED].fill(
"DISABLE",
"Disable",
ISS_ON);
961 d->SimulationSP.onUpdate([
this, d]()
963 auto sp = d->SimulationSP.findOnSwitch();
964 assert(sp !=
nullptr);
965 setSimulation(sp->isNameMatch(
"ENABLE") ?
true :
false);
969 d->ConfigProcessSP[0].fill(
"CONFIG_LOAD",
"Load",
ISS_OFF);
970 d->ConfigProcessSP[1].fill(
"CONFIG_SAVE",
"Save",
ISS_OFF);
971 d->ConfigProcessSP[2].fill(
"CONFIG_DEFAULT",
"Default",
ISS_OFF);
972 d->ConfigProcessSP[3].fill(
"CONFIG_PURGE",
"Purge",
ISS_OFF);
974 d->ConfigProcessSP.onUpdate([
this, d]()
976 auto svp = d->ConfigProcessSP;
977 auto sp = svp.findOnSwitch();
979 bool pResult =
false;
989 if (sp->isNameMatch(
"CONFIG_LOAD"))
990 pResult = loadConfig();
991 else if (sp->isNameMatch(
"CONFIG_SAVE"))
992 pResult = saveConfig();
993 else if (sp->isNameMatch(
"CONFIG_DEFAULT"))
994 pResult = loadDefaultConfig();
995 else if (sp->isNameMatch(
"CONFIG_PURGE"))
996 pResult = purgeConfig();
1003 d->PollPeriodNP[0].fill(
"PERIOD_MS",
"Period (ms)",
"%.f", 10, 600000, 1000, d->pollingPeriod);
1005 d->PollPeriodNP.onUpdate([d]()
1007 d->PollPeriodNP.setState(
IPS_OK);
1008 d->pollingPeriod =
static_cast<uint32_t
>(d->PollPeriodNP[0].getValue());
1009 d->PollPeriodNP.apply();
1015 std::string logFile = getDriverExec();
1017 DEBUG_CONF(logFile, Logger::file_off | Logger::screen_on, Logger::defaultlevel, Logger::defaultlevel)
1024 return deleteProperty(property.
getName());
1027 bool DefaultDevice::deleteProperty(
const char *propertyName)
1032 if (propertyName ==
nullptr)
1040 if (d->deleteDynamicProperties ==
false)
1050 if (removeProperty(propertyName, errmsg) == 0)
1091 registerProperty(property);
1097 defineProperty(nvp);
1102 defineProperty(tvp);
1107 defineProperty(svp);
1112 defineProperty(lvp);
1117 defineProperty(bvp);
1120 bool DefaultDevice::Connect()
1126 if (d->activeConnection ==
nullptr)
1128 LOG_ERROR(
"No active connection defined.");
1132 bool rc = d->activeConnection->Connect();
1136 if (d->ConnectionModeSP.findOnSwitchIndex() != d->m_ConfigConnectionMode)
1137 saveConfig(
true, d->ConnectionModeSP.getName());
1138 if (d->pollingPeriod > 0)
1139 SetTimer(d->pollingPeriod);
1145 bool DefaultDevice::Disconnect()
1154 if (d->activeConnection)
1156 bool rc = d->activeConnection->Disconnect();
1172 d->connections.push_back(newConnection);
1179 auto i = std::begin(d->connections);
1181 while (i != std::end(d->connections))
1183 if (*i == existingConnection)
1185 i = d->connections.erase(i);
1195 void DefaultDevice::setCurrentPollingPeriod(uint32_t msec)
1198 d->pollingPeriod = msec;
1201 uint32_t DefaultDevice::getCurrentPollingPeriod()
const
1204 return d->pollingPeriod;
1207 uint32_t &DefaultDevice::refCurrentPollingPeriod()
1210 return d->pollingPeriod;
1213 uint32_t DefaultDevice::refCurrentPollingPeriod()
const
1216 return d->pollingPeriod;
1219 void DefaultDevice::setDefaultPollingPeriod(uint32_t msec)
1222 d->PollPeriodNP[0].setValue(msec);
1223 d->pollingPeriod = msec;
1226 void DefaultDevice::setPollingPeriodRange(uint32_t minimum, uint32_t maximum)
1230 d->PollPeriodNP[0].setMinMax(minimum, maximum);
1231 d->PollPeriodNP.updateMinMax();
1238 if (existingConnection == d->activeConnection)
1243 if (oneConnection == d->activeConnection)
1250 d->activeConnection = existingConnection;
1251 if (!d->ConnectionModeSP.isEmpty())
1253 auto it = std::find(d->connections.begin(), d->connections.end(), d->activeConnection);
1254 if (it != d->connections.end())
1256 int index = std::distance(d->connections.begin(), it);
1259 d->ConnectionModeSP.reset();
1260 d->ConnectionModeSP[index].setState(
ISS_ON);
1261 d->ConnectionModeSP.setState(
IPS_OK);
1264 if (connectionProperty && connectionProperty.
getRegistered())
1265 d->ConnectionModeSP.apply();
1271 const char *DefaultDevice::getDriverExec()
1276 const char *DefaultDevice::getDriverName()
1278 return getDefaultName();
1281 void DefaultDevice::setVersion(uint16_t vMajor, uint16_t vMinor)
1284 d->majorVersion = vMajor;
1285 d->minorVersion = vMinor;
1288 uint16_t DefaultDevice::getMajorVersion()
const
1291 return d->majorVersion;
1294 uint16_t DefaultDevice::getMinorVersion()
const
1297 return d->minorVersion;
1300 void DefaultDevice::setDynamicPropertiesBehavior(
bool defineEnabled,
bool deleteEnabled)
1303 d->defineDynamicProperties = defineEnabled;
1304 d->deleteDynamicProperties = deleteEnabled;
1310 return d->activeConnection;
1313 uint32_t DefaultDevice::getPollingPeriod()
const
1316 return static_cast<uint32_t
>(d->PollPeriodNP[0].getValue());
1319 bool DefaultDevice::isConfigLoading()
const
1322 return d->isConfigLoading;
1325 bool DefaultDevice::isInitializationComplete()
const
The Interface class is the base class for all INDI connection plugins.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
virtual std::string name()=0
virtual void Deactivated()=0
Deactivated Function called by the framework when the plugin is deactivated. It is usually used to de...
virtual std::string label()=0
Class to provide basic INDI device functionality.
INDI::PropertyNumber getNumber(const char *name) const
const char * getDeviceName() const
Property getProperty(const char *name, INDI_PROPERTY_TYPE type=INDI_UNKNOWN) const
Return a property and its type given its name.
INDI::PropertySwitch getSwitch(const char *name) const
void setDeviceName(const char *dev)
Set the device name.
void registerProperty(const INDI::Property &property)
Register the property to be able to observe and update.
INDI::PropertyText getText(const char *name) const
Properties getProperties()
Return a list of all properties in the device.
static std::list< DefaultDevicePrivate * > devices
virtual ~DefaultDevicePrivate()
static std::recursive_mutex devicesLock
DefaultDevicePrivate(DefaultDevice *defaultDevice)
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
void addPollPeriodControl()
Add Polling period control to the driver.
virtual bool purgeConfig()
purgeConfig Remove config file from disk.
virtual bool updateProperties()
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
void setSimulation(bool enable)
Toggle driver simulation status A driver can run in simulation mode if Simulation option is enabled b...
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
virtual const char * getDefaultName()=0
void addConfigurationControl()
Add Configuration control to the driver.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process the client newSwitch command.
void addSimulationControl()
Add Simulation control to the driver.
virtual void ISGetProperties(const char *dev)
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual void setConnected(bool status, IPState state=IPS_OK, const char *msg=nullptr)
Set connection switch status in the client.
virtual bool ISSnoopDevice(XMLEle *root)
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
virtual bool loadConfig(bool silent=false, const char *property=nullptr)
Load the last saved configuration file.
void watchDevice(const char *deviceName, const std::function< void(INDI::BaseDevice)> &callback)
Add a device to the watch list.
uint32_t getPollingPeriod() const
getPollingPeriod Return the polling period.
virtual void simulationTriggered(bool enable)
Inform driver that the simulation option was triggered. This function is called after setSimulation i...
void defineProperty(INumberVectorProperty *property)
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual void TimerHit()
Callback function to be called once SetTimer duration elapses.
void setDebug(bool enable)
Toggle driver debug status A driver can be more verbose if Debug option is enabled by the client.
virtual bool initProperties()
Initilize properties initial state and value. The child class must implement this function.
bool isSimulation() const
void syncDriverInfo()
syncDriverInfo sends the current driver information to the client.
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
virtual bool saveAllConfigItems(FILE *fp)
saveAllConfigItems Save all the drivers' properties in the configuration file
virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
Process the client newBLOB command.
virtual bool loadDefaultConfig()
Load the default configuration file.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process the client newNumber command.
void setDriverInterface(uint16_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
void resetProperties()
Set all properties to IDLE state.
virtual void debugTriggered(bool enable)
Inform driver that the debug option was triggered. This function is called after setDebug is triggere...
void RemoveTimer(int id)
Remove timer added with SetTimer.
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
uint16_t getDriverInterface() const
void addDebugControl()
Add Debug control to the driver.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process the client newSwitch command.
The class is used to create device instances. Class copying is not allowed. When an object is destroy...
Provides generic container for INDI properties.
const char * getName() const
bool getRegistered() const
void(* WeakIDSetBLOBVA)(const IBLOBVectorProperty *, const char *, va_list)
const char * GUIDE_TAB
GUIDE_TAB Where all the properties for guiding are located.
const char * CONNECTION_TAB
CONNECTION_TAB Where all device connection settings (serial, usb, ethernet) are defined and controlle...
int(* WeakIUUpdateText)(ITextVectorProperty *, char *[], char *[], int)
int(* WeakIUUpdateNumber)(INumberVectorProperty *, double[], char *[], int n)
void ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
Update data of an existing blob vector property.
int(* WeakIUUpdateBLOB)(IBLOBVectorProperty *, int[], int[], char *[], char *[], char *[], int n)
void(* WeakIDSetLightVA)(const ILightVectorProperty *, const char *, va_list)
void(* WeakIDDefSwitchVA)(const ISwitchVectorProperty *, const char *, va_list)
void(* WeakIDDefTextVA)(const ITextVectorProperty *, const char *, va_list)
const char * FILTER_TAB
FILTER_TAB Where all the properties for filter wheels are located.
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
void(* WeakIDSetTextVA)(const ITextVectorProperty *, const char *, va_list)
void(* WeakIDDefBLOBVA)(const IBLOBVectorProperty *, const char *, va_list)
void ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Update the value of an existing switch vector property.
const char * DATETIME_TAB
DATETIME_TAB Where all date and time setting properties are located.
void ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Update the value of an existing text vector property.
const char * SATELLITE_TAB
SATELLITE_TAB.
const char * COMMUNICATION_TAB
COMMUNICATION_TAB Where all the properties required to connect/disconnect from a device are located....
const char * INFO_TAB
INFO_TAB Where all the properties for general information are located.
void ISGetProperties(const char *dev)
Get Device Properties.
void(* WeakIDDefNumberVA)(const INumberVectorProperty *, const char *, va_list)
void(* WeakIDDefLightVA)(const ILightVectorProperty *, const char *, va_list)
const char * MOTION_TAB
MOTION_TAB Where all the motion control properties of the device are located.
int(* WeakIUUpdateSwitch)(ISwitchVectorProperty *, ISState *, char *[], int n)
const char * ALIGNMENT_TAB
ALIGNMENT_TAB Where all the properties for guiding are located.
void ISSnoopDevice(XMLEle *root)
Function defined by Drivers that is called when another Driver it is snooping (by having previously c...
void(* WeakIDSetNumberVA)(const INumberVectorProperty *, const char *, va_list)
void ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
void(* WeakIDSetSwitchVA)(const ISwitchVectorProperty *, const char *, va_list)
void(* WeakIUUpdateMinMax)(const INumberVectorProperty *)
const char * SITE_TAB
SITE_TAB Where all site information setting are located.
const char * FOCUS_TAB
FOCUS_TAB Where all the properties for focuser are located.
const char * OPTIONS_TAB
OPTIONS_TAB Where all the driver's options are located. Those may include auxiliary controls,...
Constants and Data structure definitions for the interface to the reference INDI C API implementation...
Implementations for common driver routines.
int IUUpdateBLOB(IBLOBVectorProperty *bvp, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
Update all BLOB members in a BLOB vector property.
int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
Update all switches in a switch vector property.
void IDSetNumberVA(const INumberVectorProperty *nvp, const char *fmt, va_list ap)
void IDDefSwitchVA(const ISwitchVectorProperty *svp, const char *fmt, va_list ap)
void IDDefNumberVA(const INumberVectorProperty *nvp, const char *fmt, va_list ap)
void IDDelete(const char *dev, const char *name, const char *fmt,...)
int IUUpdateText(ITextVectorProperty *tvp, char *texts[], char *names[], int n)
Update all text members in a text vector property.
void IDDefTextVA(const ITextVectorProperty *tvp, const char *fmt, va_list ap)
void IDSetBLOBVA(const IBLOBVectorProperty *bvp, const char *fmt, va_list ap)
void IUSaveConfigTag(FILE *fp, int ctag, const char *dev, int silent)
Add opening or closing tag to a configuration file. A configuration file root XML element is <INDIDri...
void IDSetTextVA(const ITextVectorProperty *tvp, const char *fmt, va_list ap)
void IDSnoopDevice(const char *snooped_device, const char *snooped_property)
Function a Driver calls to snoop on another Device. Snooped messages will then arrive via ISSnoopDevi...
int IUReadConfig(const char *filename, const char *dev, const char *property, int silent, char errmsg[])
Loads and processes a configuration file. Once a configuration file is successful loaded,...
void IDDefLightVA(const ILightVectorProperty *lvp, const char *fmt, va_list ap)
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
int IUPurgeConfig(const char *filename, const char *dev, char errmsg[])
void IDDefBLOBVA(const IBLOBVectorProperty *bvp, const char *fmt, va_list ap)
int IUSaveDefaultConfig(const char *source_config, const char *dest_config, const char *dev)
Copies an existing configuration file into a default configuration file. If no default configuration ...
int IUGetConfigOnSwitchIndex(const char *dev, const char *property, int *index)
IUGetConfigOnSwitchIndex Opens configuration file and reads single switch property to find ON switch ...
void IUUpdateMinMax(const INumberVectorProperty *nvp)
Function to update the min and max elements of a number in the client.
void IDSetSwitchVA(const ISwitchVectorProperty *svp, const char *fmt, va_list ap)
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.
void IDSetLightVA(const ILightVectorProperty *lvp, const char *fmt, va_list ap)
#define DEBUG_CONF(outputFile, configuration, fileVerbosityLevel, screenVerbosityLevel)
Macro to configure the logger. Example of configuration of the Logger: DEBUG_CONF("outputfile",...
#define LOGF_INFO(fmt,...)
#define DEBUG(priority, msg)
Macro to print log messages. Example of usage of the Logger: DEBUG(DBG_DEBUG, "hello " << "world");.
#define LOGF_WARN(fmt,...)
#define LOGF_DEBUG(fmt,...)
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
#define DEBUGF(priority, msg,...)
LilXML * newLilXML()
Create a new lilxml parser.
const char * findXMLAttValu(XMLEle *ep, const char *name)
Find an XML element's attribute value.
void editXMLEle(XMLEle *ep, const char *pcdata)
set the pcdata of the given element
char * tagXMLEle(XMLEle *ep)
Return the tag of an XML element.
void prXMLEle(FILE *fp, XMLEle *ep, int level)
Print an XML element.
XMLEle * readXMLFile(FILE *fp, LilXML *lp, char ynot[])
Handy wrapper to read one xml file.
XMLEle * nextXMLEle(XMLEle *ep, int init)
Iterate an XML element for a list of nesetd XML elements.
void delXMLEle(XMLEle *ep)
delXMLEle Delete XML element.
void delLilXML(LilXML *lp)
Delete a lilxml parser.
const char * CONNECTION
Connect to and disconnect from device.
Namespace to encapsulate INDI client, drivers, and mediator classes.
const char * getDeviceName()
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
static bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
static bool initProperties(INDI::DefaultDevice *device)
static bool updateProperties(bool enable)
static bool saveConfigItems(FILE *fp)
static std::string getLogFile()
bool contains(const std::string &key, const ISState &state) const
Provides decorator for Low-Level IXXXVectorProperty/IXXX.
BLOB (Binary Large Object) vector property descriptor.
Light vector property descriptor.
Number vector property descriptor.
Switch vector property descriptor.
Text vector property descriptor.