Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4COM)  1.26.2
IWatchdog Interface Reference

Inherits IDispatch.

Collaboration diagram for IWatchdog:
Collaboration graph

Public Types

Public Member Functions

HRESULT Setup ([in]LONG timeout, [in]WatchdogAction action)
 
HRESULT Start (void)
 
HRESULT Stop (void)
 
HRESULT Reset (void)
 
HRESULT GetState ([out, retval]WatchdogState *state)
 

Detailed Description

Definition of the IWatchdog interface.

The IWatchdog interface provides a watchdog mechanism which allows the MLPI Device to react on connection or general exception errors in the user program.

Example:
try
{
// initialization of the watchdog (2 seconds).
// configure that the watchdog will fire a warning if it doesn't get triggered in time.
connection.Watchdog.Setup(2000, WatchdogAction.WATCHDOG_WARNING);
// starting the Watchdog
connection.Watchdog.Start();
// enter main loop
Console.WriteLine("\nWatchdog active! Press any key to block watchdog reset or 'q' to quit.");
bool isRunning = true;
while (isRunning)
{
// you may want to do some work here...
Thread.Sleep(1000);
// reset watchdog to prevent watchdog from triggering, do this every loop
connection.Watchdog.Reset();
// print current state of watchdog
Console.WriteLine(connection.Watchdog.GetState().ToString());
// on key press by user, delay and block reset of the watchdog --> simulate watchdog timeout
if (Console.KeyAvailable)
{
switch (Console.ReadKey(true).Key)
{
case ConsoleKey.Q:
isRunning = false;
break;
default:
Console.WriteLine("\nBlocking reset of Watchdog. -> Should result in warning on device!");
Thread.Sleep(5000);
break;
}
}
}
// stop watchdog on server
connection.Watchdog.Stop();
}
catch (System.Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
Console.WriteLine("\nWatchdog stopped.");

Definition at line 126 of file IWatchdog.idl.

Member Enumeration Documentation

This enumeration must be used to define the action when a watchdog has expired.

Enumerator
WATCHDOG_REBOOT 

Control will be rebooted.

WATCHDOG_PLCSTOPP 

PLC will be stopped.

WATCHDOG_ERROR 

Error with class F5 severity (all axes go to error stop) will be generated.

WATCHDOG_WARNING 

Error with class F0 severity (warning, no action) will be generated.

Definition at line 130 of file IWatchdog.idl.

This enumeration describes the state of a watchdog.

Enumerator
WATCHDOG_DISABLED 

Watchdog has not started.

WATCHDOG_ENABLED 

Watchdog has started.

WATCHDOG_TIMEOUT 

Watchdog has expired and has been disabled.

Definition at line 140 of file IWatchdog.idl.

Member Function Documentation

HRESULT IWatchdog::Setup ( [in] LONG  timeout,
[in] WatchdogAction  action 
)

This function initializes or changes the watchdog functionality.

Parameters
[in]timeoutThis is the timeout of the watchdog in ms. The timeout is checked every millisecond.
[in]actionThis is the action that will be taken in case the watchdog expires.
Returns
Return value indicating success (>=0) or error (<0).
Example C#:
...
try
{
// initialization of the watchdog (2 seconds).
// configure that the watchdog will fire a warning if it doesn't get triggered in time.
connection.Watchdog.Setup(2000, WatchdogAction.WATCHDOG_WARNING);
}
catch (System.Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
Note:
This method maps to the mlpiCore function mlpiWatchdogSetup, where you can find further documentation.
HRESULT IWatchdog::Start ( void  )

This function starts the watchdog supervision.

Returns
Return value indicating success (>=0) or error (<0).
Example C#:
...
try
{
// starting the Watchdog
connection.Watchdog.Start();
}
catch (System.Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
Note:
This method maps to the mlpiCore function mlpiWatchdogStart, where you can find further documentation.
HRESULT IWatchdog::Stop ( void  )

This function stops the watchdog supervision.

Returns
Return value indicating success (>=0) or error (<0).
Example C#:
...
try
{
// stopping the Watchdog
connection.Watchdog.Stop();
}
catch (System.Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
Note:
This method maps to the mlpiCore function mlpiWatchdogStop, where you can find further documentation.
HRESULT IWatchdog::Reset ( void  )

This function resets the watchdog. It has to be called in an interval which is shorter than the timeout that has been specified in Setup method.

Returns
Return value indicating success (>=0) or error (<0).
Example C#:
...
try
{
// resetting the Watchdog
connection.Watchdog.Reset();
}
catch (System.Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
Note:
This method maps to the mlpiCore function mlpiWatchdogReset, where you can find further documentation.
HRESULT IWatchdog::GetState ( [out, retval] WatchdogState state)

This function will return the current state of the watchdog. The state will read that the watchdog is fired until the watchdog is started again.

Parameters
[out]stateReturns the current state of the watchdog.
Returns
Return value indicating success (>=0) or error (<0).
Example C#:
...
try
{
// print current state of watchdog
Console.WriteLine(connection.Watchdog.GetState().ToString());
}
catch (System.Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
Note:
This method maps to the mlpiCore function mlpiWatchdogGetState, where you can find further documentation.

The documentation for this interface was generated from the following file: