#include <yocto_watchdog.h>
Static Public Member Functions | |
static YWatchdog * | Find (string func) |
static YWatchdog * | FindWatchdog (string func) |
static YWatchdog * | First (void) |
static YWatchdog * | FirstWatchdog (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) |
YWatchdog (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 | |
Y_AUTOSTART_enum | _autoStart |
s64 | _countdown |
YDelayedPulse | _delayedPulseTimer |
s64 | _maxTimeOnStateA |
s64 | _maxTimeOnStateB |
Y_OUTPUT_enum | _output |
s64 | _pulseTimer |
Y_RUNNING_enum | _running |
Y_STATE_enum | _state |
Y_STATEATPOWERON_enum | _stateAtPowerOn |
s64 | _triggerDelay |
s64 | _triggerDuration |
YWatchdogValueCallback | _valueCallbackWatchdog |
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 | |
YWatchdog * | yFindWatchdog (const string &func) |
YWatchdog * | yFirstWatchdog (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 |
YWatchdog Class: Watchdog function interface
The watchog function works like a relay and can cause a brief power cut to an appliance after a preset delay to force this appliance to reset. The Watchdog must be called from time to time to reset the timer and prevent the appliance reset. The watchdog can be driven direcly with pulse and delayedpulse methods to switch off an appliance for a given duration.
Definition at line 132 of file yocto_watchdog.h.
|
protected |
Definition at line 51 of file yocto_watchdog.cpp.
YWatchdog::~YWatchdog | ( | ) |
Definition at line 71 of file yocto_watchdog.cpp.
|
virtual |
Reimplemented from YFunction.
Definition at line 879 of file yocto_watchdog.cpp.
|
protectedvirtual |
Reimplemented from YFunction.
Definition at line 80 of file yocto_watchdog.cpp.
|
inline |
Definition at line 405 of file yocto_watchdog.h.
|
inline |
Definition at line 393 of file yocto_watchdog.h.
int YWatchdog::delayedPulse | ( | int | ms_delay, |
int | ms_duration | ||
) |
Schedules a pulse.
ms_delay | : waiting time before the pulse, in millisecondes |
ms_duration | : pulse duration, in millisecondes |
On failure, throws an exception or returns a negative error code.
Definition at line 527 of file yocto_watchdog.cpp.
|
inline |
Definition at line 363 of file yocto_watchdog.h.
|
inlinestatic |
Definition at line 557 of file yocto_watchdog.h.
|
static |
Retrieves a watchdog for a given identifier. The identifier can be specified using several formats:
This function does not require that the watchdog is online at the time it is invoked. The returned object is nevertheless valid. Use the method YWatchdog.isOnline() to test if the watchdog is indeed online at a given time. In case of ambiguity when looking for a watchdog 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 watchdog |
Definition at line 828 of file yocto_watchdog.cpp.
|
inlinestatic |
Definition at line 581 of file yocto_watchdog.h.
|
static |
Starts the enumeration of watchdog currently accessible. Use the method YWatchdog.nextWatchdog() to iterate on next watchdog.
Definition at line 899 of file yocto_watchdog.cpp.
Y_AUTOSTART_enum YWatchdog::get_autoStart | ( | void | ) |
Returns the watchdog runing state at module power on.
On failure, throws an exception or returns Y_AUTOSTART_INVALID.
Definition at line 572 of file yocto_watchdog.cpp.
s64 YWatchdog::get_countdown | ( | void | ) |
Returns the number of milliseconds remaining before a pulse (delayedPulse() call) When there is no scheduled pulse, returns zero.
On failure, throws an exception or returns Y_COUNTDOWN_INVALID.
Definition at line 543 of file yocto_watchdog.cpp.
YDelayedPulse YWatchdog::get_delayedPulseTimer | ( | void | ) |
Definition at line 479 of file yocto_watchdog.cpp.
s64 YWatchdog::get_maxTimeOnStateA | ( | void | ) |
Retourne the maximum time (ms) allowed for $THEFUNCTIONS$ to stay in state A before automatically switching back in to B state. Zero means no maximum time.
On failure, throws an exception or returns Y_MAXTIMEONSTATEA_INVALID.
Definition at line 254 of file yocto_watchdog.cpp.
s64 YWatchdog::get_maxTimeOnStateB | ( | void | ) |
Retourne the maximum time (ms) allowed for $THEFUNCTIONS$ to stay in state B before automatically switching back in to A state. Zero means no maximum time.
On failure, throws an exception or returns Y_MAXTIMEONSTATEB_INVALID.
Definition at line 310 of file yocto_watchdog.cpp.
Y_OUTPUT_enum YWatchdog::get_output | ( | void | ) |
Returns the output state of the watchdog, when used as a simple switch (single throw).
On failure, throws an exception or returns Y_OUTPUT_INVALID.
Definition at line 366 of file yocto_watchdog.cpp.
s64 YWatchdog::get_pulseTimer | ( | void | ) |
Returns the number of milliseconds remaining before the watchdog is returned to idle position (state A), during a measured pulse generation. When there is no ongoing pulse, returns zero.
On failure, throws an exception or returns Y_PULSETIMER_INVALID.
Definition at line 424 of file yocto_watchdog.cpp.
Y_RUNNING_enum YWatchdog::get_running | ( | void | ) |
Returns the watchdog running state.
On failure, throws an exception or returns Y_RUNNING_INVALID.
Definition at line 628 of file yocto_watchdog.cpp.
Y_STATE_enum YWatchdog::get_state | ( | void | ) |
Returns the state of the watchdog (A for the idle position, B for the active position).
On failure, throws an exception or returns Y_STATE_INVALID.
Definition at line 139 of file yocto_watchdog.cpp.
Y_STATEATPOWERON_enum YWatchdog::get_stateAtPowerOn | ( | void | ) |
Returns the state of the watchdog at device startup (A for the idle position, B for the active position, UNCHANGED for no change).
On failure, throws an exception or returns Y_STATEATPOWERON_INVALID.
Definition at line 197 of file yocto_watchdog.cpp.
s64 YWatchdog::get_triggerDelay | ( | void | ) |
Returns the waiting duration before a reset is automatically triggered by the watchdog, in milliseconds.
On failure, throws an exception or returns Y_TRIGGERDELAY_INVALID.
Definition at line 699 of file yocto_watchdog.cpp.
s64 YWatchdog::get_triggerDuration | ( | void | ) |
Returns the duration of resets caused by the watchdog, in milliseconds.
On failure, throws an exception or returns Y_TRIGGERDURATION_INVALID.
Definition at line 754 of file yocto_watchdog.cpp.
|
inline |
Definition at line 259 of file yocto_watchdog.h.
|
inline |
Definition at line 286 of file yocto_watchdog.h.
|
inline |
Definition at line 568 of file yocto_watchdog.h.
YWatchdog * YWatchdog::nextWatchdog | ( | void | ) |
Continues the enumeration of watchdog started using yFirstWatchdog().
Definition at line 889 of file yocto_watchdog.cpp.
|
inline |
Definition at line 313 of file yocto_watchdog.h.
int YWatchdog::pulse | ( | int | ms_duration | ) |
Sets the relay to output B (active) for a specified duration, then brings it automatically back to output A (idle state).
ms_duration | : pulse duration, in millisecondes |
On failure, throws an exception or returns a negative error code.
Definition at line 472 of file yocto_watchdog.cpp.
|
inline |
Definition at line 342 of file yocto_watchdog.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 860 of file yocto_watchdog.cpp.
int YWatchdog::resetWatchdog | ( | void | ) |
Resets the watchdog. When the watchdog is running, this function must be called on a regular basis to prevent the watchog to trigger
On failure, throws an exception or returns a negative error code.
Definition at line 684 of file yocto_watchdog.cpp.
|
inline |
Definition at line 432 of file yocto_watchdog.h.
int YWatchdog::set_autoStart | ( | Y_AUTOSTART_enum | newval | ) |
Changes the watchdog runningsttae at module power on. Remember to call the saveToFlash() method and then to reboot the module to apply this setting.
newval | : either Y_AUTOSTART_OFF or Y_AUTOSTART_ON, according to the watchdog runningsttae at module power on |
On failure, throws an exception or returns a negative error code.
Definition at line 605 of file yocto_watchdog.cpp.
int YWatchdog::set_delayedPulseTimer | ( | YDelayedPulse | newval | ) |
Definition at line 501 of file yocto_watchdog.cpp.
int YWatchdog::set_maxTimeOnStateA | ( | s64 | newval | ) |
Sets the maximum time (ms) allowed for $THEFUNCTIONS$ to stay in state A before automatically switching back in to B state. Use zero for no maximum time.
newval | : an integer |
On failure, throws an exception or returns a negative error code.
Definition at line 286 of file yocto_watchdog.cpp.
int YWatchdog::set_maxTimeOnStateB | ( | s64 | newval | ) |
Sets the maximum time (ms) allowed for $THEFUNCTIONS$ to stay in state B before automatically switching back in to A state. Use zero for no maximum time.
newval | : an integer |
On failure, throws an exception or returns a negative error code.
Definition at line 342 of file yocto_watchdog.cpp.
int YWatchdog::set_output | ( | Y_OUTPUT_enum | newval | ) |
Changes the output state of the watchdog, when used as a simple switch (single throw).
newval | : either Y_OUTPUT_OFF or Y_OUTPUT_ON, according to the output state of the watchdog, when used as a simple switch (single throw) |
On failure, throws an exception or returns a negative error code.
Definition at line 398 of file yocto_watchdog.cpp.
int YWatchdog::set_pulseTimer | ( | s64 | newval | ) |
Definition at line 446 of file yocto_watchdog.cpp.
int YWatchdog::set_running | ( | Y_RUNNING_enum | newval | ) |
Changes the running state of the watchdog.
newval | : either Y_RUNNING_OFF or Y_RUNNING_ON, according to the running state of the watchdog |
On failure, throws an exception or returns a negative error code.
Definition at line 659 of file yocto_watchdog.cpp.
int YWatchdog::set_state | ( | Y_STATE_enum | newval | ) |
Changes the state of the watchdog (A for the idle position, B for the active position).
newval | : either Y_STATE_A or Y_STATE_B, according to the state of the watchdog (A for the idle position, B for the active position) |
On failure, throws an exception or returns a negative error code.
Definition at line 171 of file yocto_watchdog.cpp.
int YWatchdog::set_stateAtPowerOn | ( | Y_STATEATPOWERON_enum | newval | ) |
Preset the state of the watchdog at device startup (A for the idle position, B for the active position, UNCHANGED for no modification). Remember to call the matching module saveToFlash() method, otherwise this call will have no effect.
newval | : a value among Y_STATEATPOWERON_UNCHANGED, Y_STATEATPOWERON_A and Y_STATEATPOWERON_B |
On failure, throws an exception or returns a negative error code.
Definition at line 230 of file yocto_watchdog.cpp.
int YWatchdog::set_triggerDelay | ( | s64 | newval | ) |
Changes the waiting delay before a reset is triggered by the watchdog, in milliseconds.
newval | : an integer corresponding to the waiting delay before a reset is triggered by the watchdog, in milliseconds |
On failure, throws an exception or returns a negative error code.
Definition at line 731 of file yocto_watchdog.cpp.
int YWatchdog::set_triggerDuration | ( | s64 | newval | ) |
Changes the duration of resets caused by the watchdog, in milliseconds.
newval | : an integer corresponding to the duration of resets caused by the watchdog, in milliseconds |
On failure, throws an exception or returns a negative error code.
Definition at line 785 of file yocto_watchdog.cpp.
|
inline |
Definition at line 420 of file yocto_watchdog.h.
|
inline |
Definition at line 367 of file yocto_watchdog.h.
|
inline |
Definition at line 273 of file yocto_watchdog.h.
|
inline |
Definition at line 300 of file yocto_watchdog.h.
|
inline |
Definition at line 327 of file yocto_watchdog.h.
|
inline |
Definition at line 346 of file yocto_watchdog.h.
|
inline |
Definition at line 445 of file yocto_watchdog.h.
|
inline |
Definition at line 216 of file yocto_watchdog.h.
|
inline |
Definition at line 246 of file yocto_watchdog.h.
|
inline |
Definition at line 483 of file yocto_watchdog.h.
|
inline |
Definition at line 508 of file yocto_watchdog.h.
|
inline |
Definition at line 202 of file yocto_watchdog.h.
|
inline |
Definition at line 231 of file yocto_watchdog.h.
|
inline |
Definition at line 469 of file yocto_watchdog.h.
|
inline |
Definition at line 495 of file yocto_watchdog.h.
|
friend |
Retrieves a watchdog for a given identifier. The identifier can be specified using several formats:
This function does not require that the watchdog is online at the time it is invoked. The returned object is nevertheless valid. Use the method YWatchdog.isOnline() to test if the watchdog is indeed online at a given time. In case of ambiguity when looking for a watchdog 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 watchdog |
Definition at line 618 of file yocto_watchdog.h.
|
friend |
Starts the enumeration of watchdog currently accessible. Use the method YWatchdog.nextWatchdog() to iterate on next watchdog.
Definition at line 629 of file yocto_watchdog.h.
|
protected |
Definition at line 148 of file yocto_watchdog.h.
|
protected |
Definition at line 147 of file yocto_watchdog.h.
|
protected |
Definition at line 146 of file yocto_watchdog.h.
|
protected |
Definition at line 142 of file yocto_watchdog.h.
|
protected |
Definition at line 143 of file yocto_watchdog.h.
|
protected |
Definition at line 144 of file yocto_watchdog.h.
|
protected |
Definition at line 145 of file yocto_watchdog.h.
|
protected |
Definition at line 149 of file yocto_watchdog.h.
|
protected |
Definition at line 140 of file yocto_watchdog.h.
|
protected |
Definition at line 141 of file yocto_watchdog.h.
|
protected |
Definition at line 150 of file yocto_watchdog.h.
|
protected |
Definition at line 151 of file yocto_watchdog.h.
|
protected |
Definition at line 152 of file yocto_watchdog.h.
|
static |
Definition at line 185 of file yocto_watchdog.h.
|
static |
Definition at line 183 of file yocto_watchdog.h.
|
static |
Definition at line 184 of file yocto_watchdog.h.
|
static |
Definition at line 182 of file yocto_watchdog.h.
|
static |
Definition at line 181 of file yocto_watchdog.h.
|
static |
Definition at line 175 of file yocto_watchdog.h.
|
static |
Definition at line 176 of file yocto_watchdog.h.
|
static |
Definition at line 179 of file yocto_watchdog.h.
|
static |
Definition at line 177 of file yocto_watchdog.h.
|
static |
Definition at line 178 of file yocto_watchdog.h.
|
static |
Definition at line 180 of file yocto_watchdog.h.
|
static |
Definition at line 188 of file yocto_watchdog.h.
|
static |
Definition at line 186 of file yocto_watchdog.h.
|
static |
Definition at line 187 of file yocto_watchdog.h.
|
static |
Definition at line 168 of file yocto_watchdog.h.
|
static |
Definition at line 169 of file yocto_watchdog.h.
|
static |
Definition at line 170 of file yocto_watchdog.h.
|
static |
Definition at line 172 of file yocto_watchdog.h.
|
static |
Definition at line 173 of file yocto_watchdog.h.
|
static |
Definition at line 174 of file yocto_watchdog.h.
|
static |
Definition at line 171 of file yocto_watchdog.h.
|
static |
Definition at line 189 of file yocto_watchdog.h.
|
static |
Definition at line 190 of file yocto_watchdog.h.