#include <yocto_powersupply.h>
Public Member Functions | |
virtual int | _invokeValueCallback (string value) |
string | command (void) |
double | currentAtStartUp (void) |
double | currentLimit (void) |
string | get_command (void) |
double | get_currentAtStartUp (void) |
double | get_currentLimit (void) |
double | get_inputVoltage (void) |
double | get_ldoTemperature (void) |
double | get_measuredCurrent (void) |
double | get_measuredVoltage (void) |
Y_POWEROUTPUT_enum | get_powerOutput (void) |
double | get_vInt (void) |
double | get_voltageAtStartUp (void) |
Y_VOLTAGESENSE_enum | get_voltageSense (void) |
double | get_voltageSetPoint (void) |
string | get_voltageTransition (void) |
double | inputVoltage (void) |
double | ldoTemperature (void) |
double | measuredCurrent (void) |
double | measuredVoltage (void) |
YPowerSupply * | next (void) |
YPowerSupply * | nextPowerSupply (void) |
Y_POWEROUTPUT_enum | powerOutput (void) |
virtual int | registerValueCallback (YPowerSupplyValueCallback callback) |
int | set_command (const string &newval) |
int | set_currentAtStartUp (double newval) |
int | set_currentLimit (double newval) |
int | set_powerOutput (Y_POWEROUTPUT_enum newval) |
int | set_voltageAtStartUp (double newval) |
int | set_voltageSense (Y_VOLTAGESENSE_enum newval) |
int | set_voltageSetPoint (double newval) |
int | set_voltageTransition (const string &newval) |
int | setCommand (const string &newval) |
int | setCurrentAtStartUp (double newval) |
int | setCurrentLimit (double newval) |
int | setPowerOutput (Y_POWEROUTPUT_enum newval) |
int | setVoltageAtStartUp (double newval) |
int | setVoltageSense (Y_VOLTAGESENSE_enum newval) |
int | setVoltageSetPoint (double newval) |
int | setVoltageTransition (const string &newval) |
double | vInt (void) |
double | voltageAtStartUp (void) |
virtual int | voltageMove (double V_target, int ms_duration) |
Y_VOLTAGESENSE_enum | voltageSense (void) |
double | voltageSetPoint (void) |
string | voltageTransition (void) |
~YPowerSupply () | |
Public Member Functions inherited from YFunction | |
void | _clearDataStreamCache () |
string | _decode_json_string (const string &json) |
string | _download (const string &url) |
YDataStream * | _findDataStream (YDataSet &dataset, const string &def) |
string | _get_json_path (const string &json, const string &path) |
vector< string > | _json_get_array (const string &json) |
string | _json_get_key (const string &json, const string &data) |
string | _json_get_string (const string &json) |
int | _parseEx (yJsonStateMachine &j) |
virtual int | _parserHelper (void) |
string | _parseString (yJsonStateMachine &j) |
string | _request (const string &request) |
string | _requestEx (int tcpchan, const string &request, yapiRequestProgressCallback callback, void *context) |
void | _throw (YRETCODE errType, string errMsg) |
YRETCODE | _upload (const string &path, const string &content) |
YRETCODE | _uploadWithProgress (const string &path, const string &content, yapiRequestProgressCallback callback, void *context) |
string | advertisedValue (void) |
void | clearCache () |
string | describe (void) |
string | errMessage (void) |
string | errorMessage (void) |
YRETCODE | errorType (void) |
YRETCODE | errType (void) |
YFUN_DESCR | functionDescriptor (void) |
string | get_advertisedValue (void) |
string | get_errorMessage (void) |
YRETCODE | get_errorType (void) |
virtual string | get_friendlyName (void) |
YFUN_DESCR | get_functionDescriptor (void) |
string | get_functionId (void) |
string | get_hardwareId (void) |
string | get_hubSerial () |
string | get_logicalName (void) |
YModule * | get_module (void) |
void * | get_userData (void) |
bool | isOnline (void) |
YRETCODE | load (int msValidity) |
virtual string | loadAttribute (string attrName) |
string | logicalName (void) |
YModule * | module (void) |
virtual int | muteValueCallbacks (void) |
YFunction * | next (void) |
YFunction * | nextFunction (void) |
virtual int | registerValueCallback (YFunctionValueCallback callback) |
int | set_advertisedValue (const string &newval) |
int | set_logicalName (const string &newval) |
void | set_userData (void *data) |
int | setAdvertisedValue (const string &newval) |
int | setLogicalName (const string &newval) |
void | setUserData (void *data) |
virtual int | unmuteValueCallbacks (void) |
void * | userData (void) |
virtual | ~YFunction () |
Static Public Member Functions | |
static YPowerSupply * | Find (string func) |
static YPowerSupply * | FindPowerSupply (string func) |
static YPowerSupply * | First (void) |
static YPowerSupply * | FirstPowerSupply (void) |
Static Public Member Functions inherited from YFunction | |
static void | _ClearCache (void) |
static YFunction * | Find (string func) |
static YFunction * | FindFunction (string func) |
static YFunction * | First (void) |
static YFunction * | FirstFunction (void) |
Protected Member Functions | |
virtual int | _parseAttr (YJSONObject *json_val) |
YPowerSupply (const string &func) | |
Protected Member Functions inherited from YFunction | |
YRETCODE | _buildSetRequest (const string &changeattr, const string *changeval, string &request, string &errmsg) |
string | _escapeAttr (const string &changeval) |
YRETCODE | _getDescriptor (YFUN_DESCR &fundescr, string &errMsg) |
YRETCODE | _getDevice (YDevice *&dev, string &errMsg) |
YRETCODE | _load_unsafe (int msValidity) |
YRETCODE | _nextFunction (string &hwId) |
int | _parse (YJSONObject *j) |
YRETCODE | _setAttr (string attrname, string newvalue) |
YFunction (const string &func) | |
Protected Attributes | |
string | _command |
double | _currentAtStartUp |
double | _currentLimit |
double | _inputVoltage |
double | _ldoTemperature |
double | _measuredCurrent |
double | _measuredVoltage |
Y_POWEROUTPUT_enum | _powerOutput |
YPowerSupplyValueCallback | _valueCallbackPowerSupply |
double | _vInt |
double | _voltageAtStartUp |
Y_VOLTAGESENSE_enum | _voltageSense |
double | _voltageSetPoint |
string | _voltageTransition |
Protected Attributes inherited from YFunction | |
string | _advertisedValue |
u64 | _cacheExpiration |
string | _className |
std::map< string, YDataStream * > | _dataStreams |
string | _func |
YFUN_DESCR | _fundescr |
string | _funId |
string | _hwId |
string | _lastErrorMsg |
YRETCODE | _lastErrorType |
string | _logicalName |
string | _serial |
yCRITICAL_SECTION | _this_cs |
void * | _userData |
YFunctionValueCallback | _valueCallbackFunction |
Friends | |
YPowerSupply * | yFindPowerSupply (const string &func) |
YPowerSupply * | yFirstPowerSupply (void) |
Additional Inherited Members | |
Static Protected Member Functions inherited from YFunction | |
static void | _AddToCache (const string &classname, const string &func, YFunction *obj) |
static YFunction * | _FindFromCache (const string &classname, const string &func) |
static void | _UpdateTimedReportCallbackList (YFunction *func, bool add) |
static void | _UpdateValueCallbackList (YFunction *func, bool add) |
Static Protected Attributes inherited from YFunction | |
static std::map< string, YFunction * > | _cache |
YPowerSupply Class: PowerSupply function interface
The Yoctopuce application programming interface allows you to change the voltage set point, the current limit and the enable/disable the output.
Definition at line 91 of file yocto_powersupply.h.
|
protected |
Definition at line 51 of file yocto_powersupply.cpp.
YPowerSupply::~YPowerSupply | ( | ) |
Definition at line 72 of file yocto_powersupply.cpp.
|
virtual |
Reimplemented from YFunction.
Definition at line 761 of file yocto_powersupply.cpp.
|
protectedvirtual |
Reimplemented from YFunction.
Definition at line 91 of file yocto_powersupply.cpp.
|
inline |
Definition at line 369 of file yocto_powersupply.h.
|
inline |
Definition at line 364 of file yocto_powersupply.h.
|
inline |
Definition at line 193 of file yocto_powersupply.h.
|
inlinestatic |
Definition at line 434 of file yocto_powersupply.h.
|
static |
Retrieves a regulated power supply for a given identifier. The identifier can be specified using several formats:
This function does not require that the regulated power supply is online at the time it is invoked. The returned object is nevertheless valid. Use the method YPowerSupply.isOnline() to test if the regulated power supply is indeed online at a given time. In case of ambiguity when looking for a regulated power supply by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.
If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.
func | : a string that uniquely characterizes the regulated power supply |
Definition at line 710 of file yocto_powersupply.cpp.
|
inlinestatic |
Definition at line 458 of file yocto_powersupply.h.
|
static |
Starts the enumeration of regulated power supplies currently accessible. Use the method YPowerSupply.nextPowerSupply() to iterate on next regulated power supplies.
Definition at line 802 of file yocto_powersupply.cpp.
string YPowerSupply::get_command | ( | void | ) |
Definition at line 645 of file yocto_powersupply.cpp.
double YPowerSupply::get_currentAtStartUp | ( | void | ) |
Returns the selected current limit at device startup, in mA.
On failure, throws an exception or returns Y_CURRENTATSTARTUP_INVALID.
Definition at line 623 of file yocto_powersupply.cpp.
double YPowerSupply::get_currentLimit | ( | void | ) |
Returns the current limit, in mA.
On failure, throws an exception or returns Y_CURRENTLIMIT_INVALID.
Definition at line 222 of file yocto_powersupply.cpp.
double YPowerSupply::get_inputVoltage | ( | void | ) |
Returns the measured input voltage, in V.
On failure, throws an exception or returns Y_INPUTVOLTAGE_INVALID.
Definition at line 417 of file yocto_powersupply.cpp.
double YPowerSupply::get_ldoTemperature | ( | void | ) |
Returns the LDO temperature, in Celsius.
On failure, throws an exception or returns Y_LDOTEMPERATURE_INVALID.
Definition at line 475 of file yocto_powersupply.cpp.
double YPowerSupply::get_measuredCurrent | ( | void | ) |
Returns the measured output current, in mA.
On failure, throws an exception or returns Y_MEASUREDCURRENT_INVALID.
Definition at line 388 of file yocto_powersupply.cpp.
double YPowerSupply::get_measuredVoltage | ( | void | ) |
Returns the measured output voltage, in V.
On failure, throws an exception or returns Y_MEASUREDVOLTAGE_INVALID.
Definition at line 359 of file yocto_powersupply.cpp.
Y_POWEROUTPUT_enum YPowerSupply::get_powerOutput | ( | void | ) |
Returns the power supply output switch state.
On failure, throws an exception or returns Y_POWEROUTPUT_INVALID.
Definition at line 251 of file yocto_powersupply.cpp.
double YPowerSupply::get_vInt | ( | void | ) |
Returns the internal voltage, in V.
On failure, throws an exception or returns Y_VINT_INVALID.
Definition at line 446 of file yocto_powersupply.cpp.
double YPowerSupply::get_voltageAtStartUp | ( | void | ) |
Returns the selected voltage set point at device startup, in V.
On failure, throws an exception or returns Y_VOLTAGEATSTARTUP_INVALID.
Definition at line 568 of file yocto_powersupply.cpp.
Y_VOLTAGESENSE_enum YPowerSupply::get_voltageSense | ( | void | ) |
Returns the output voltage control point.
On failure, throws an exception or returns Y_VOLTAGESENSE_INVALID.
Definition at line 305 of file yocto_powersupply.cpp.
double YPowerSupply::get_voltageSetPoint | ( | void | ) |
Returns the voltage set point, in V.
On failure, throws an exception or returns Y_VOLTAGESETPOINT_INVALID.
Definition at line 168 of file yocto_powersupply.cpp.
string YPowerSupply::get_voltageTransition | ( | void | ) |
Definition at line 497 of file yocto_powersupply.cpp.
|
inline |
Definition at line 279 of file yocto_powersupply.h.
|
inline |
Definition at line 303 of file yocto_powersupply.h.
|
inline |
Definition at line 267 of file yocto_powersupply.h.
|
inline |
Definition at line 255 of file yocto_powersupply.h.
|
inline |
Definition at line 445 of file yocto_powersupply.h.
YPowerSupply * YPowerSupply::nextPowerSupply | ( | void | ) |
Continues the enumeration of regulated power supplies started using yFirstPowerSupply().
Definition at line 792 of file yocto_powersupply.cpp.
|
inline |
Definition at line 205 of file yocto_powersupply.h.
|
virtual |
Registers the callback function that is invoked on every change of advertised value. The callback is invoked only during the execution of ySleep or yHandleEvents. This provides control over the time when the callback is triggered. For good responsiveness, remember to call one of these two functions periodically. To unregister a callback, pass a NULL pointer as argument.
callback | : the callback function to call, or a NULL pointer. The callback function should take two arguments: the function object of which the value has changed, and the character string describing the new advertised value. |
Definition at line 742 of file yocto_powersupply.cpp.
int YPowerSupply::set_command | ( | const string & | newval | ) |
Definition at line 667 of file yocto_powersupply.cpp.
int YPowerSupply::set_currentAtStartUp | ( | double | newval | ) |
Changes the current limit at device start up. Remember to call the matching module saveToFlash() method, otherwise this call has no effect.
newval | : a floating point number corresponding to the current limit at device start up |
On failure, throws an exception or returns a negative error code.
Definition at line 600 of file yocto_powersupply.cpp.
int YPowerSupply::set_currentLimit | ( | double | newval | ) |
Changes the current limit, in mA.
newval | : a floating point number corresponding to the current limit, in mA |
On failure, throws an exception or returns a negative error code.
Definition at line 199 of file yocto_powersupply.cpp.
int YPowerSupply::set_powerOutput | ( | Y_POWEROUTPUT_enum | newval | ) |
Changes the power supply output switch state.
newval | : either Y_POWEROUTPUT_OFF or Y_POWEROUTPUT_ON, according to the power supply output switch state |
On failure, throws an exception or returns a negative error code.
Definition at line 282 of file yocto_powersupply.cpp.
int YPowerSupply::set_voltageAtStartUp | ( | double | newval | ) |
Changes the voltage set point at device start up. Remember to call the matching module saveToFlash() method, otherwise this call has no effect.
newval | : a floating point number corresponding to the voltage set point at device start up |
On failure, throws an exception or returns a negative error code.
Definition at line 545 of file yocto_powersupply.cpp.
int YPowerSupply::set_voltageSense | ( | Y_VOLTAGESENSE_enum | newval | ) |
Changes the voltage control point.
newval | : either Y_VOLTAGESENSE_INT or Y_VOLTAGESENSE_EXT, according to the voltage control point |
On failure, throws an exception or returns a negative error code.
Definition at line 336 of file yocto_powersupply.cpp.
int YPowerSupply::set_voltageSetPoint | ( | double | newval | ) |
Changes the voltage set point, in V.
newval | : a floating point number corresponding to the voltage set point, in V |
On failure, throws an exception or returns a negative error code.
Definition at line 145 of file yocto_powersupply.cpp.
int YPowerSupply::set_voltageTransition | ( | const string & | newval | ) |
Definition at line 519 of file yocto_powersupply.cpp.
|
inline |
Definition at line 373 of file yocto_powersupply.h.
|
inline |
Definition at line 352 of file yocto_powersupply.h.
|
inline |
Definition at line 181 of file yocto_powersupply.h.
|
inline |
Definition at line 218 of file yocto_powersupply.h.
|
inline |
Definition at line 326 of file yocto_powersupply.h.
|
inline |
Definition at line 243 of file yocto_powersupply.h.
|
inline |
Definition at line 156 of file yocto_powersupply.h.
|
inline |
Definition at line 312 of file yocto_powersupply.h.
|
inline |
Definition at line 291 of file yocto_powersupply.h.
|
inline |
Definition at line 338 of file yocto_powersupply.h.
|
virtual |
Performs a smooth transistion of output voltage. Any explicit voltage change cancels any ongoing transition process.
V_target | : new output voltage value at the end of the transition (floating-point number, representing the end voltage in V) |
ms_duration | : total duration of the transition, in milliseconds |
Definition at line 781 of file yocto_powersupply.cpp.
|
inline |
Definition at line 230 of file yocto_powersupply.h.
|
inline |
Definition at line 168 of file yocto_powersupply.h.
|
inline |
Definition at line 308 of file yocto_powersupply.h.
|
friend |
Retrieves a regulated power supply for a given identifier. The identifier can be specified using several formats:
This function does not require that the regulated power supply is online at the time it is invoked. The returned object is nevertheless valid. Use the method YPowerSupply.isOnline() to test if the regulated power supply is indeed online at a given time. In case of ambiguity when looking for a regulated power supply by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.
If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.
func | : a string that uniquely characterizes the regulated power supply |
Definition at line 495 of file yocto_powersupply.h.
|
friend |
Starts the enumeration of regulated power supplies currently accessible. Use the method YPowerSupply.nextPowerSupply() to iterate on next regulated power supplies.
Definition at line 506 of file yocto_powersupply.h.
|
protected |
Definition at line 111 of file yocto_powersupply.h.
|
protected |
Definition at line 110 of file yocto_powersupply.h.
|
protected |
Definition at line 100 of file yocto_powersupply.h.
|
protected |
Definition at line 105 of file yocto_powersupply.h.
|
protected |
Definition at line 107 of file yocto_powersupply.h.
|
protected |
Definition at line 104 of file yocto_powersupply.h.
|
protected |
Definition at line 103 of file yocto_powersupply.h.
|
protected |
Definition at line 101 of file yocto_powersupply.h.
|
protected |
Definition at line 112 of file yocto_powersupply.h.
|
protected |
Definition at line 106 of file yocto_powersupply.h.
|
protected |
Definition at line 109 of file yocto_powersupply.h.
|
protected |
Definition at line 102 of file yocto_powersupply.h.
|
protected |
Definition at line 99 of file yocto_powersupply.h.
|
protected |
Definition at line 108 of file yocto_powersupply.h.
|
static |
Definition at line 144 of file yocto_powersupply.h.
|
static |
Definition at line 143 of file yocto_powersupply.h.
|
static |
Definition at line 129 of file yocto_powersupply.h.
|
static |
Definition at line 138 of file yocto_powersupply.h.
|
static |
Definition at line 140 of file yocto_powersupply.h.
|
static |
Definition at line 137 of file yocto_powersupply.h.
|
static |
Definition at line 136 of file yocto_powersupply.h.
|
static |
Definition at line 132 of file yocto_powersupply.h.
|
static |
Definition at line 130 of file yocto_powersupply.h.
|
static |
Definition at line 131 of file yocto_powersupply.h.
|
static |
Definition at line 139 of file yocto_powersupply.h.
|
static |
Definition at line 142 of file yocto_powersupply.h.
|
static |
Definition at line 134 of file yocto_powersupply.h.
|
static |
Definition at line 133 of file yocto_powersupply.h.
|
static |
Definition at line 135 of file yocto_powersupply.h.
|
static |
Definition at line 128 of file yocto_powersupply.h.
|
static |
Definition at line 141 of file yocto_powersupply.h.