Instrument Neutral Distributed Interface INDI 2.2.5
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
INDI::PowerInterface Class Reference

#include <indipowerinterface.h>

Inheritance diagram for INDI::PowerInterface:
CelestronDewPower CheapoDC GeminiPBH MyDCP4ESP PegasusPPB PegasusPPBA PegasusSPB PegasusUPB PegasusUPB3 SVBONYPowerBox TerransPowerBoxGoV2 TerransPowerBoxProV2 USBDewpoint myDewControllerPro

Public Types

enum  {
  POWER_HAS_DC_OUT = 1 << 0 , POWER_HAS_DEW_OUT = 1 << 1 , POWER_HAS_VARIABLE_OUT = 1 << 2 , POWER_HAS_VOLTAGE_SENSOR = 1 << 3 ,
  POWER_HAS_OVERALL_CURRENT = 1 << 4 , POWER_HAS_PER_PORT_CURRENT = 1 << 5 , POWER_HAS_LED_TOGGLE = 1 << 6 , POWER_HAS_AUTO_DEW = 1 << 7 ,
  POWER_HAS_POWER_CYCLE = 1 << 8 , POWER_HAS_USB_TOGGLE = 1 << 9 , POWER_HAS_OVER_VOLTAGE_PROTECTION = 1 << 10 , POWER_HAS_OVER_VOTALGE_PROTECTION = POWER_HAS_OVER_VOLTAGE_PROTECTION ,
  POWER_OFF_ON_DISCONNECT = 1 << 11
}
 

Public Member Functions

uint32_t GetCapability () const
 GetPowerCapability returns the capability of the Power device.
 
void SetCapability (uint32_t cap)
 SetPowerCapability sets the Power capabilities. All capabilities must be initialized.
 
bool HasDCOutput ()
 
bool HasDewOutput ()
 
bool HasVariableOutput ()
 
bool HasVoltageSensor ()
 
bool HasOverallCurrent ()
 
bool HasPerPortCurrent ()
 
bool HasLEDToggle ()
 
bool HasAutoDew ()
 
bool HasUSBPort ()
 
bool HasOverVoltageProtection ()
 
bool ShouldPowerOffOnDisconnect ()
 

Public Attributes

enum INDI::PowerInterface:: { ... }  PowerCapability
 

Protected Types

enum  { SENSOR_VOLTAGE , SENSOR_CURRENT , SENSOR_POWER , N_POWER_SENSORS }
 

Protected Member Functions

 PowerInterface (DefaultDevice *defaultDevice)
 
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 primary device.
 
bool updateProperties ()
 updateProperties Define or Delete Power properties based on the connection status of the base device
 
bool processNumber (const char *dev, const char *name, double values[], char *names[], int n)
 Process Power number properties.
 
bool processSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
 Process Power switch properties.
 
bool processText (const char *dev, const char *name, char *texts[], char *names[], int n)
 Process Power text properties.
 
virtual bool SetPowerPort (size_t port, bool enabled)
 SetPowerPort Set power port on/off.
 
virtual bool SetDewPort (size_t port, bool enabled, double dutyCycle)
 SetDewPort Set DEW/Dew port duty cycle.
 
virtual bool SetVariablePort (size_t port, bool enabled, double voltage)
 SetVariablePort Set variable voltage port.
 
virtual bool SetLEDEnabled (bool enabled)
 SetLEDEnabled Enable/disable power LEDs.
 
virtual bool SetAutoDewEnabled (size_t port, bool enabled)
 SetAutoDewEnabled Enable/disable automatic dew control.
 
virtual bool CyclePower ()
 CyclePower Cycle power to all ports.
 
virtual bool SetUSBPort (size_t port, bool enabled)
 SetUSBPort Set USB port on/off.
 
bool saveConfigItems (FILE *fp)
 saveConfigItems Save power properties in config file
 

Protected Attributes

INDI::PropertyNumber PowerSensorsNP {N_POWER_SENSORS}
 
INDI::PropertySwitch PowerChannelsSP {0}
 
INDI::PropertyNumber PowerChannelCurrentNP {0}
 
INDI::PropertyText PowerChannelLabelsTP {0}
 
INDI::PropertySwitch DewChannelsSP {0}
 
INDI::PropertyNumber DewChannelDutyCycleNP {0}
 
INDI::PropertyNumber DewChannelCurrentNP {0}
 
INDI::PropertyText DewChannelLabelsTP {0}
 
INDI::PropertySwitch VariableChannelsSP {0}
 
INDI::PropertyNumber VariableChannelVoltsNP {0}
 
INDI::PropertyText VariableChannelLabelsTP {0}
 
INDI::PropertyNumber OverVoltageProtectionNP {1}
 
INDI::PropertySwitch PowerOffOnDisconnectSP {2}
 
INDI::PropertySwitch LEDControlSP {2}
 
INDI::PropertySwitch AutoDewSP {0}
 
INDI::PropertySwitch USBPortSP {0}
 
INDI::PropertyText USBPortLabelsTP {0}
 
INDI::PropertySwitch PowerCycleAllSP {1}
 
uint32_t powerCapability = 0
 
DefaultDevice * m_defaultDevice { nullptr }
 
const char * POWER_TAB {"Power"}
 
const char * DEW_TAB {"Dew"}
 
const char * USB_TAB {"USB"}
 
const char * VARIABLE_TAB {"Variable"}
 

Detailed Description

Definition at line 34 of file indipowerinterface.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
POWER_HAS_DC_OUT 

Has 12V DC outputs

POWER_HAS_DEW_OUT 

Has DEW outputs for dew heaters

POWER_HAS_VARIABLE_OUT 

Has variable voltage outputs

POWER_HAS_VOLTAGE_SENSOR 

Has voltage monitoring

POWER_HAS_OVERALL_CURRENT 

Has overall current monitoring

POWER_HAS_PER_PORT_CURRENT 

Has per-port current monitoring

POWER_HAS_LED_TOGGLE 

Can toggle power LEDs

POWER_HAS_AUTO_DEW 

Has automatic dew control

POWER_HAS_POWER_CYCLE 

Can cycle power to all ports

POWER_HAS_USB_TOGGLE 

Can toggle power to specific USB ports

POWER_HAS_OVER_VOLTAGE_PROTECTION 

Do not toggle output DC ports if voltage exceeds a threshold

POWER_HAS_OVER_VOTALGE_PROTECTION 

Deprecated misspelling, use POWER_HAS_OVER_VOLTAGE_PROTECTION

POWER_OFF_ON_DISCONNECT 

Power off all DC, Dew, and Variable ports when driver is disconnected

Definition at line 41 of file indipowerinterface.h.

◆ anonymous enum

anonymous enum
protected
Enumerator
SENSOR_VOLTAGE 

Input voltage

SENSOR_CURRENT 

Total current draw

SENSOR_POWER 

Total power consumption

N_POWER_SENSORS 

Number of power sensors

Definition at line 258 of file indipowerinterface.h.

Constructor & Destructor Documentation

◆ PowerInterface()

INDI::PowerInterface::PowerInterface ( DefaultDevice *  defaultDevice)
explicitprotected

Definition at line 32 of file indipowerinterface.cpp.

Member Function Documentation

◆ CyclePower()

bool INDI::PowerInterface::CyclePower ( )
protectedvirtual

CyclePower Cycle power to all ports.

Returns
True if successful, false otherwise

Reimplemented in CheapoDC, MyDCP4ESP, PegasusPPB, PegasusPPBA, PegasusUPB, PegasusUPB3, SVBONYPowerBox, TerransPowerBoxGoV2, TerransPowerBoxProV2, and USBDewpoint.

Definition at line 535 of file indipowerinterface.cpp.

◆ GetCapability()

uint32_t INDI::PowerInterface::GetCapability ( ) const
inline

GetPowerCapability returns the capability of the Power device.

Definition at line 61 of file indipowerinterface.h.

◆ HasAutoDew()

bool INDI::PowerInterface::HasAutoDew ( )
inline
Returns
True if power device has automatic dew control

Definition at line 134 of file indipowerinterface.h.

◆ HasDCOutput()

bool INDI::PowerInterface::HasDCOutput ( )
inline
Returns
True if power device has 12V DC outputs

Definition at line 78 of file indipowerinterface.h.

◆ HasDewOutput()

bool INDI::PowerInterface::HasDewOutput ( )
inline
Returns
True if power device has DEW outputs for dew heaters

Definition at line 86 of file indipowerinterface.h.

◆ HasLEDToggle()

bool INDI::PowerInterface::HasLEDToggle ( )
inline
Returns
True if power device can toggle power LEDs

Definition at line 126 of file indipowerinterface.h.

◆ HasOverallCurrent()

bool INDI::PowerInterface::HasOverallCurrent ( )
inline
Returns
True if power device has overall current monitoring

Definition at line 110 of file indipowerinterface.h.

◆ HasOverVoltageProtection()

bool INDI::PowerInterface::HasOverVoltageProtection ( )
inline
Returns
True if DC ports can only be toggled if the input voltage is within a certain threshold.
Note
This applies to unregulated power controller where the output DC voltage matches the input DC voltage

Definition at line 151 of file indipowerinterface.h.

◆ HasPerPortCurrent()

bool INDI::PowerInterface::HasPerPortCurrent ( )
inline
Returns
True if power device has per-port current monitoring

Definition at line 118 of file indipowerinterface.h.

◆ HasUSBPort()

bool INDI::PowerInterface::HasUSBPort ( )
inline
Returns
True if power device can toggle power to specific USB ports

Definition at line 142 of file indipowerinterface.h.

◆ HasVariableOutput()

bool INDI::PowerInterface::HasVariableOutput ( )
inline
Returns
True if power device has variable voltage outputs

Definition at line 94 of file indipowerinterface.h.

◆ HasVoltageSensor()

bool INDI::PowerInterface::HasVoltageSensor ( )
inline
Returns
True if power device has voltage monitoring

Definition at line 102 of file indipowerinterface.h.

◆ initProperties()

void INDI::PowerInterface::initProperties ( const char *  groupName,
size_t  nPowerPorts = 0,
size_t  nDewPorts = 0,
size_t  nVariablePorts = 0,
size_t  nAutoDewPorts = 0,
size_t  nUSBPorts = 0 
)
protected

Initialize Power properties. It is recommended to call this function within initProperties() of your primary device.

Parameters
groupNameGroup or tab name to be used to define Power properties.
nPowerPortsNumber of 12V power ports
nDewPortsNumber of DEW/Dew heater ports
nVariablePortsNumber of variable voltage ports
nAutoDewPortsNumber of Auto Dew ports
nUSBPortsNumber of USB ports

Definition at line 55 of file indipowerinterface.cpp.

◆ processNumber()

bool INDI::PowerInterface::processNumber ( const char *  dev,
const char *  name,
double  values[],
char *  names[],
int  n 
)
protected

Process Power number properties.

Definition at line 463 of file indipowerinterface.cpp.

◆ processSwitch()

bool INDI::PowerInterface::processSwitch ( const char *  dev,
const char *  name,
ISState *  states,
char *  names[],
int  n 
)
protected

Process Power switch properties.

Definition at line 554 of file indipowerinterface.cpp.

◆ processText()

bool INDI::PowerInterface::processText ( const char *  dev,
const char *  name,
char *  texts[],
char *  names[],
int  n 
)
protected

Process Power text properties.

Definition at line 726 of file indipowerinterface.cpp.

◆ saveConfigItems()

bool INDI::PowerInterface::saveConfigItems ( FILE *  fp)
protected

saveConfigItems Save power properties in config file

Parameters
fpPointer to config file
Returns
Always return true

Definition at line 806 of file indipowerinterface.cpp.

◆ SetAutoDewEnabled()

bool INDI::PowerInterface::SetAutoDewEnabled ( size_t  port,
bool  enabled 
)
protectedvirtual

SetAutoDewEnabled Enable/disable automatic dew control.

Parameters
enabledTrue to enable, false to disable
Returns
True if successful, false otherwise

Reimplemented in CheapoDC, CelestronDewPower, MyDCP4ESP, myDewControllerPro, PegasusPPB, PegasusPPBA, PegasusSPB, PegasusUPB, PegasusUPB3, SVBONYPowerBox, TerransPowerBoxGoV2, TerransPowerBoxProV2, and USBDewpoint.

Definition at line 528 of file indipowerinterface.cpp.

◆ SetCapability()

void INDI::PowerInterface::SetCapability ( uint32_t  cap)
inline

SetPowerCapability sets the Power capabilities. All capabilities must be initialized.

Parameters
cappointer to Power capability struct.

Definition at line 70 of file indipowerinterface.h.

◆ SetDewPort()

bool INDI::PowerInterface::SetDewPort ( size_t  port,
bool  enabled,
double  dutyCycle 
)
protectedvirtual

SetDewPort Set DEW/Dew port duty cycle.

Parameters
portPort number starting from 0
enabledTrue to turn on, false to turn off
dutyCycleDuty cycle value 0-100
Returns
True if successful, false otherwise

Reimplemented in CheapoDC, CelestronDewPower, GeminiPBH, MyDCP4ESP, myDewControllerPro, PegasusPPB, PegasusPPBA, PegasusSPB, PegasusUPB, PegasusUPB3, SVBONYPowerBox, TerransPowerBoxGoV2, TerransPowerBoxProV2, and USBDewpoint.

Definition at line 777 of file indipowerinterface.cpp.

◆ SetLEDEnabled()

bool INDI::PowerInterface::SetLEDEnabled ( bool  enabled)
protectedvirtual

SetLEDEnabled Enable/disable power LEDs.

Parameters
enabledTrue to enable LEDs, false to disable
Returns
True if successful, false otherwise

Reimplemented in CheapoDC, CelestronDewPower, MyDCP4ESP, PegasusPPB, PegasusPPBA, PegasusSPB, PegasusUPB, PegasusUPB3, SVBONYPowerBox, TerransPowerBoxGoV2, TerransPowerBoxProV2, and USBDewpoint.

Definition at line 793 of file indipowerinterface.cpp.

◆ SetPowerPort()

bool INDI::PowerInterface::SetPowerPort ( size_t  port,
bool  enabled 
)
protectedvirtual

SetPowerPort Set power port on/off.

Parameters
portPort number starting from 0
enabledTrue to turn on, false to turn off
Returns
True if successful, false otherwise

Reimplemented in CheapoDC, CelestronDewPower, GeminiPBH, MyDCP4ESP, PegasusPPB, PegasusPPBA, PegasusSPB, PegasusUPB, PegasusUPB3, SVBONYPowerBox, TerransPowerBoxGoV2, TerransPowerBoxProV2, and USBDewpoint.

Definition at line 770 of file indipowerinterface.cpp.

◆ SetUSBPort()

bool INDI::PowerInterface::SetUSBPort ( size_t  port,
bool  enabled 
)
protectedvirtual

SetUSBPort Set USB port on/off.

Parameters
portPort number starting from 0
enabledTrue to turn on, false to turn off
Returns
True if successful, false otherwise

Reimplemented in CheapoDC, GeminiPBH, MyDCP4ESP, PegasusPPB, PegasusPPBA, PegasusSPB, PegasusUPB, PegasusUPB3, SVBONYPowerBox, TerransPowerBoxGoV2, TerransPowerBoxProV2, and USBDewpoint.

Definition at line 799 of file indipowerinterface.cpp.

◆ SetVariablePort()

bool INDI::PowerInterface::SetVariablePort ( size_t  port,
bool  enabled,
double  voltage 
)
protectedvirtual

SetVariablePort Set variable voltage port.

Parameters
portPort number starting from 0
enabledTrue to turn on, false to turn off
voltageTarget voltage
Returns
True if successful, false otherwise

Reimplemented in CheapoDC, CelestronDewPower, MyDCP4ESP, PegasusPPB, PegasusSPB, PegasusUPB, PegasusUPB3, SVBONYPowerBox, TerransPowerBoxGoV2, TerransPowerBoxProV2, and USBDewpoint.

Definition at line 785 of file indipowerinterface.cpp.

◆ ShouldPowerOffOnDisconnect()

bool INDI::PowerInterface::ShouldPowerOffOnDisconnect ( )
inline
Returns
True if all power should be toggled off when driver is connected.
Note
Default behavior is power output does not change on driver disconnect.

Definition at line 160 of file indipowerinterface.h.

◆ updateProperties()

bool INDI::PowerInterface::updateProperties ( )
protected

updateProperties Define or Delete Power properties based on the connection status of the base device

Returns
True if successful, false otherwise.

Definition at line 347 of file indipowerinterface.cpp.

Member Data Documentation

◆ AutoDewSP

INDI::PropertySwitch INDI::PowerInterface::AutoDewSP {0}
protected

Definition at line 295 of file indipowerinterface.h.

◆ DEW_TAB

const char* INDI::PowerInterface::DEW_TAB {"Dew"}
protected

Definition at line 308 of file indipowerinterface.h.

◆ DewChannelCurrentNP

INDI::PropertyNumber INDI::PowerInterface::DewChannelCurrentNP {0}
protected

Definition at line 277 of file indipowerinterface.h.

◆ DewChannelDutyCycleNP

INDI::PropertyNumber INDI::PowerInterface::DewChannelDutyCycleNP {0}
protected

Definition at line 276 of file indipowerinterface.h.

◆ DewChannelLabelsTP

INDI::PropertyText INDI::PowerInterface::DewChannelLabelsTP {0}
protected

Definition at line 278 of file indipowerinterface.h.

◆ DewChannelsSP

INDI::PropertySwitch INDI::PowerInterface::DewChannelsSP {0}
protected

Definition at line 275 of file indipowerinterface.h.

◆ LEDControlSP

INDI::PropertySwitch INDI::PowerInterface::LEDControlSP {2}
protected

Definition at line 292 of file indipowerinterface.h.

◆ m_defaultDevice

DefaultDevice* INDI::PowerInterface::m_defaultDevice { nullptr }
protected

Definition at line 305 of file indipowerinterface.h.

◆ OverVoltageProtectionNP

INDI::PropertyNumber INDI::PowerInterface::OverVoltageProtectionNP {1}
protected

Definition at line 286 of file indipowerinterface.h.

◆ POWER_TAB

const char* INDI::PowerInterface::POWER_TAB {"Power"}
protected

Definition at line 307 of file indipowerinterface.h.

◆ []

enum { ... } INDI::PowerInterface::PowerCapability

◆ powerCapability

uint32_t INDI::PowerInterface::powerCapability = 0
protected

Definition at line 304 of file indipowerinterface.h.

◆ PowerChannelCurrentNP

INDI::PropertyNumber INDI::PowerInterface::PowerChannelCurrentNP {0}
protected

Definition at line 271 of file indipowerinterface.h.

◆ PowerChannelLabelsTP

INDI::PropertyText INDI::PowerInterface::PowerChannelLabelsTP {0}
protected

Definition at line 272 of file indipowerinterface.h.

◆ PowerChannelsSP

INDI::PropertySwitch INDI::PowerInterface::PowerChannelsSP {0}
protected

Definition at line 270 of file indipowerinterface.h.

◆ PowerCycleAllSP

INDI::PropertySwitch INDI::PowerInterface::PowerCycleAllSP {1}
protected

Definition at line 302 of file indipowerinterface.h.

◆ PowerOffOnDisconnectSP

INDI::PropertySwitch INDI::PowerInterface::PowerOffOnDisconnectSP {2}
protected

Definition at line 289 of file indipowerinterface.h.

◆ PowerSensorsNP

INDI::PropertyNumber INDI::PowerInterface::PowerSensorsNP {N_POWER_SENSORS}
protected

Definition at line 267 of file indipowerinterface.h.

◆ USB_TAB

const char* INDI::PowerInterface::USB_TAB {"USB"}
protected

Definition at line 309 of file indipowerinterface.h.

◆ USBPortLabelsTP

INDI::PropertyText INDI::PowerInterface::USBPortLabelsTP {0}
protected

Definition at line 299 of file indipowerinterface.h.

◆ USBPortSP

INDI::PropertySwitch INDI::PowerInterface::USBPortSP {0}
protected

Definition at line 298 of file indipowerinterface.h.

◆ VARIABLE_TAB

const char* INDI::PowerInterface::VARIABLE_TAB {"Variable"}
protected

Definition at line 310 of file indipowerinterface.h.

◆ VariableChannelLabelsTP

INDI::PropertyText INDI::PowerInterface::VariableChannelLabelsTP {0}
protected

Definition at line 283 of file indipowerinterface.h.

◆ VariableChannelsSP

INDI::PropertySwitch INDI::PowerInterface::VariableChannelsSP {0}
protected

Definition at line 281 of file indipowerinterface.h.

◆ VariableChannelVoltsNP

INDI::PropertyNumber INDI::PowerInterface::VariableChannelVoltsNP {0}
protected

Definition at line 282 of file indipowerinterface.h.


The documentation for this class was generated from the following files: