rasProject_01 / weSweetHome
R. 240
process control / RasPi software by weinert-automation
|
Process control helpers for Raspberry Pi: lock and watchdog. More...
#include "weLockWatch.h"
Functions | |
void | closeLock (void) |
Unlock the lock file | |
int | initWatchdog (void) |
Get and initialise or arm the watchdog. More... | |
int | justInitWatchdog (void) |
Get and initialise or arm the watchdog. More... | |
int | justLock (char const *lckPiGpioFil) |
Open and lock the lock file. More... | |
int | openLock (char const *lckPiGpioFil, uint8_t const perr) |
Open and lock the lock file. More... | |
void | stopWatchdog (void) |
Stop and disarm the watchdog. More... | |
void | triggerWatchdog (void) |
Trigger the watchdog. More... | |
Variables | |
int | lockFd |
Lock file handle. More... | |
int | retCode |
Basic start-up function failure. More... | |
int | useIOlock |
flag to use IO (singleton) lock; default on More... | |
int | useWatchdog |
flag to use watchdog; default on More... | |
Process control helpers for Raspberry Pi: lock and watchdog.
Revision history
cross-compile by:
This is a supplementary library basic library to be used in conjunction with the pigpio library (link: -lpigpiod_if2 -lrt). For documentation see the include file weLOckWatch.h .
int justLock | ( | char const * | lckPiGpioFil | ) |
Open and lock the lock file.
This function is the basic implementation of openLock. Applications not wanting its optional logging or doing their own should use this function directly.
lckPiGpioFil | lock file name |
int openLock | ( | char const * | lckPiGpioFil, |
uint8_t const | perr | ||
) |
Open and lock the lock file.
This function may use logging and streams not available on smaller applications. Those applications not wanting that optional logging or doing their own should use the function justLock().
lckPiGpioFil | lock file path name |
perr | make error message when lock file does not exist or can't be locked |
int justInitWatchdog | ( | void | ) |
Get and initialise or arm the watchdog.
This function justInitWatchdog() is the basic implementation of initWatchdog() without logging failure.
int initWatchdog | ( | void | ) |
Get and initialise or arm the watchdog.
If the watchdog is to be used, i.e. useWatchdog is ON. this function tries to get it. Otherwise it does nothing but return 0 (success).
On no success 1 is returned and useWatchdog is set OFF and the misfortune is logged. Use justInitWatchdog() :: for silence.
void stopWatchdog | ( | void | ) |
Stop and disarm the watchdog.
If the watchdog is to be used, i.e. useWatchdog is ON, this function stops and disarms it.
useWatchdog is then OFF .
void triggerWatchdog | ( | void | ) |
Trigger the watchdog.
If the watchdog is to be used, i.e. useWatchdog is ON, this function triggers it.
If the watchdog is armed (by initWatchdog()) not triggering it at least once about every 15 s will lead to system reset.
int useIOlock |
flag to use IO (singleton) lock; default on
Do use IO lock.
int lockFd |
Lock file handle.
Do not use directly.
int retCode |
Basic start-up function failure.
Allows for compact code without saving the (error) return:
if (openLock(lckPiGpioPth, ON)) return retCode;
Storage for return/error codes. Used by: openLock(char const *, uint8_t) theCyclistStart(int) theCyclistWaitEnd()
Value: 0: OK, else: error
int useWatchdog |
flag to use watchdog; default on
flag to use watchdog; default ON