The following functions are used for initializing and using the watchdogs from the client application.
This function initializes or changes the watchdog functionality.
- Parameters
-
[in] | connection | Handle for multiple connections. |
[in] | timeout | This is the timeout of the watchdog in ms. The timeout is checked every millisecond. |
[in] | action | This is the action that will be taken in the case that the watchdog expires. |
- Returns
- Return value indicating success (>=0) or error (<0).
- Example:
1 // initialization of the watchdog (2 seconds).
2 // configured so that the watchdog will fire a warning if it doesn't get triggered in time.
3 MLPIRESULT result = mlpiWatchdogSetup(connection, 2000, MLPI_WATCHDOG_WARNING);
4 if (MLPI_FAILED(result)) {
5 printf("\ncall of MLPI function failed with 0x%08x!", (unsigned)result);
9 // starting the Watchdog
10 result = mlpiWatchdogStart(connection);
11 if (MLPI_FAILED(result)) {
12 printf("\ncall of MLPI function failed with 0x%08x!", (unsigned)result);
This function starts the watchdog supervision.
- Parameters
-
[in] | connection | Handle for multiple connections. |
- Returns
- Return value indicating success (>=0) or error (<0).
- Example:
- See example for mlpiWatchdogSetup.
This function stops the watchdog supervision.
- Parameters
-
[in] | connection | Handle for multiple connections. |
- Returns
- Return value indicating success (>=0) or error (<0).
- Example:
1 // stop the Watchdog, calls to mlpiWatchdogReset() no longer necessary
2 MLPIRESULT result = mlpiWatchdogStop(connection);
3 if (MLPI_FAILED(result)) {
4 printf("\ncall of MLPI function failed with 0x%08x!", (unsigned)result);
This function resets the watchdog. Has to be called in an interval which is shorter than the timeout that has been specified in Setup
method.
- Parameters
-
[in] | connection | Handle for multiple connections. |
- Returns
- Return value indicating success (>=0) or error (<0).
- Example:
3 // you may want to do some work here...
6 // reset watchdog to prevent watchdog from triggering, do this every loop
7 MLPIRESULT result = mlpiWatchdogReset(connection);
8 if (MLPI_FAILED(result)) {
9 printf("\ncall of MLPI function failed with 0x%08x!", (unsigned)result);
This function will return the current state of the watchdog. Once the watchdog fired, the function will return that state until it is reset using mlpiWatchdogReset.
- Parameters
-
[in] | connection | Handle for multiple connections. |
[out] | state | Pointer to where the state should be stored. |
- Returns
- Return value indicating success (>=0) or error (<0).
- Example:
1 // print current state of watchdog
2 MlpiWatchdogState state;
3 MLPIRESULT result = mlpiWatchdogGetState(connection, &state);
4 if (MLPI_FAILED(result)) {
5 printf("\ncall of MLPI function failed with 0x%08x!", (unsigned)result);
9 case MLPI_WATCHDOG_DISABLED:
10 printf("\nWATCHDOG_DISABLED");
12 case MLPI_WATCHDOG_ENABLED:
13 printf("\nWATCHDOG_ENABLED");
15 case MLPI_WATCHDOG_TIMEOUT:
16 printf("\nWATCHDOG_TIMEOUT");