56 size_t nAutoDewPorts,
size_t nUSBPorts)
84 for (
size_t i = 0; i < nPowerPorts; i++)
87 snprintf(channelNum,
sizeof(channelNum),
"%d",
static_cast<int>(i + 1));
91 snprintf(propName,
MAXINDINAME,
"POWER_CHANNEL_%d",
static_cast<int>(i + 1));
92 snprintf(propLabel,
MAXINDILABEL,
"Channel %d",
static_cast<int>(i + 1));
101 for (
size_t i = 0; i < nPowerPorts; i++)
104 snprintf(channelNum,
sizeof(channelNum),
"%d",
static_cast<int>(i + 1));
108 snprintf(propName,
MAXINDINAME,
"POWER_CHANNEL_%d",
static_cast<int>(i + 1));
118 for (
size_t i = 0; i < nPowerPorts; i++)
121 snprintf(channelNum,
sizeof(channelNum),
"%d",
static_cast<int>(i + 1));
125 snprintf(propName,
MAXINDINAME,
"POWER_CHANNEL_%d",
static_cast<int>(i + 1));
143 for (
size_t i = 0; i < nDewPorts; i++)
146 snprintf(channelNum,
sizeof(channelNum),
"%d",
static_cast<int>(i + 1));
150 snprintf(propName,
MAXINDINAME,
"DEW_CHANNEL_%d",
static_cast<int>(i + 1));
151 snprintf(propLabel,
MAXINDILABEL,
"Channel %d",
static_cast<int>(i + 1));
160 for (
size_t i = 0; i < nDewPorts; i++)
163 snprintf(channelNum,
sizeof(channelNum),
"%d",
static_cast<int>(i + 1));
167 snprintf(propName,
MAXINDINAME,
"DEW_CHANNEL_%d",
static_cast<int>(i + 1));
176 for (
size_t i = 0; i < nDewPorts; i++)
179 snprintf(channelNum,
sizeof(channelNum),
"%d",
static_cast<int>(i + 1));
183 snprintf(propName,
MAXINDINAME,
"DEW_CHANNEL_%d",
static_cast<int>(i + 1));
198 if (nAutoDewPorts > 0)
202 for (
size_t i = 0; i < nDewPorts; i++)
205 snprintf(channelNum,
sizeof(channelNum),
"%d",
static_cast<int>(i + 1));
209 snprintf(propName,
MAXINDINAME,
"DEW_CHANNEL_%d",
static_cast<int>(i + 1));
217 for (
size_t i = 0; i < nAutoDewPorts; i++)
220 snprintf(portNum,
sizeof(portNum),
"%d",
static_cast<int>(i + 1));
224 snprintf(propName,
MAXINDINAME,
"DEW_CHANNEL_%d",
static_cast<int>(i + 1));
228 if (nAutoDewPorts > 0)
246 for (
size_t i = 0; i < nUSBPorts; i++)
249 snprintf(portNum,
sizeof(portNum),
"%d",
static_cast<int>(i + 1));
253 snprintf(propName,
MAXINDINAME,
"USB_PORT_%d",
static_cast<int>(i + 1));
254 snprintf(propLabel,
MAXINDILABEL,
"Port %d",
static_cast<int>(i + 1));
265 for (
size_t i = 0; i < nUSBPorts; i++)
268 snprintf(portNum,
sizeof(portNum),
"%d",
static_cast<int>(i + 1));
272 snprintf(propName,
MAXINDINAME,
"USB_PORT_%d",
static_cast<int>(i + 1));
289 if (nVariablePorts > 0)
293 for (
size_t i = 0; i < nVariablePorts; i++)
296 snprintf(channelNum,
sizeof(channelNum),
"%d",
static_cast<int>(i + 1));
300 snprintf(propName,
MAXINDINAME,
"VAR_CHANNEL_%d",
static_cast<int>(i + 1));
301 snprintf(propLabel,
MAXINDILABEL,
"Channel %d",
static_cast<int>(i + 1));
309 for (
size_t i = 0; i < nVariablePorts; i++)
312 snprintf(channelNum,
sizeof(channelNum),
"%d",
static_cast<int>(i + 1));
316 snprintf(propName,
MAXINDINAME,
"VAR_CHANNEL_%d",
static_cast<int>(i + 1));
325 for (
size_t i = 0; i < nVariablePorts; i++)
328 snprintf(channelNum,
sizeof(channelNum),
"%d",
static_cast<int>(i + 1));
332 snprintf(propName,
MAXINDINAME,
"VAR_CHANNEL_%d",
static_cast<int>(i + 1));
481 bool allSuccessful =
true;
483 for (
int j = 0; j < n; j++)
488 const size_t i =
static_cast<size_t>(index);
493 allSuccessful =
false;
496 return allSuccessful;
505 bool allSuccessful =
true;
507 for (
int j = 0; j < n; j++)
512 const size_t i =
static_cast<size_t>(index);
517 allSuccessful =
false;
520 return allSuccessful;
545 std::this_thread::sleep_for(std::chrono::milliseconds(500));
582 bool allSuccessful =
true;
584 for (
int j = 0; j < n; j++)
589 const size_t i =
static_cast<size_t>(index);
591 if (
AutoDewSP[i].getState() != states[j])
595 allSuccessful =
false;
599 return allSuccessful;
625 bool allSuccessful =
true;
627 for (
int j = 0; j < n; j++)
632 const size_t i =
static_cast<size_t>(index);
638 allSuccessful =
false;
642 return allSuccessful;
651 bool allSuccessful =
true;
653 for (
int j = 0; j < n; j++)
658 const size_t i =
static_cast<size_t>(index);
664 allSuccessful =
false;
668 return allSuccessful;
677 bool allSuccessful =
true;
679 for (
int j = 0; j < n; j++)
684 const size_t i =
static_cast<size_t>(index);
689 allSuccessful =
false;
693 return allSuccessful;
702 bool allSuccessful =
true;
704 for (
int j = 0; j < n; j++)
709 const size_t i =
static_cast<size_t>(index);
710 if (
USBPortSP[i].getState() != states[j])
714 allSuccessful =
false;
718 return allSuccessful;
const char * getDeviceName() const
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
bool updateProperty(PropertyType &property, ValueType *values, char *names[], int n, std::function< bool()> updater, bool saveConfig=false)
Generic helper function to update an INDI property based on an external operation.
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 bool SetUSBPort(size_t port, bool enabled)
SetUSBPort Set USB port on/off.
virtual bool CyclePower()
CyclePower Cycle power to all ports.
INDI::PropertySwitch PowerCycleAllSP
INDI::PropertySwitch DewChannelsSP
bool saveConfigItems(FILE *fp)
saveConfigItems Save power properties in config file
virtual bool SetAutoDewEnabled(size_t port, bool enabled)
SetAutoDewEnabled Enable/disable automatic dew control.
INDI::PropertySwitch AutoDewSP
virtual bool SetDewPort(size_t port, bool enabled, double dutyCycle)
SetDewPort Set DEW/Dew port duty cycle.
INDI::PropertyNumber VariableChannelVoltsNP
INDI::PropertyNumber OverVoltageProtectionNP
virtual bool SetVariablePort(size_t port, bool enabled, double voltage)
SetVariablePort Set variable voltage port.
bool HasOverVoltageProtection()
INDI::PropertyNumber PowerSensorsNP
INDI::PropertyText VariableChannelLabelsTP
INDI::PropertyNumber PowerChannelCurrentNP
virtual bool SetPowerPort(size_t port, bool enabled)
SetPowerPort Set power port on/off.
virtual bool SetLEDEnabled(bool enabled)
SetLEDEnabled Enable/disable power LEDs.
INDI::PropertyNumber DewChannelCurrentNP
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process Power number properties.
void initProperties(const char *groupName, size_t nPowerPorts=0, size_t nDewPorts=0, size_t nVariablePorts=0, size_t nAutoDewPorts=0, size_t nUSBPorts=0)
Initialize Power properties. It is recommended to call this function within initProperties() of your ...
INDI::PropertyText PowerChannelLabelsTP
bool processText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process Power text properties.
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process Power switch properties.
INDI::PropertySwitch PowerChannelsSP
const char * VARIABLE_TAB
INDI::PropertySwitch USBPortSP
INDI::PropertyNumber DewChannelDutyCycleNP
INDI::PropertyText USBPortLabelsTP
bool updateProperties()
updateProperties Define or Delete Power properties based on the connection status of the base device
INDI::PropertySwitch LEDControlSP
INDI::PropertySwitch VariableChannelsSP
DefaultDevice * m_defaultDevice
PowerInterface(DefaultDevice *defaultDevice)
bool ShouldPowerOffOnDisconnect()
INDI::PropertyText DewChannelLabelsTP
INDI::PropertySwitch PowerOffOnDisconnectSP
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
bool load()
load Attempt to load property values from configuration file.
void save(FILE *f) const
save Save property to configuration file.
bool isNameMatch(const char *otherName) const
int findWidgetIndexByName(const char *name) const
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
bool update(const ISState states[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, ISRule rule, double timeout, IPState state)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
Namespace to encapsulate INDI client, drivers, and mediator classes.