cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsWatchdogServer.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5  Author(s): Marcin Balicki
6  Created on: 2014
7 
8  (C) Copyright 2014 Johns Hopkins University (JHU), All Rights Reserved.
9 
10 --- begin cisst license - do not edit ---
11 
12 This software is provided "as is" under an open source license, with
13 no warranty. The complete license can be found in license.txt and
14 http://www.cisst.org/cisst/license.txt.
15 
16 --- end cisst license ---
17 */
18 #ifndef _mtsWatchdogServer_h
19 #define _mtsWatchdogServer_h
20 
24 
27 
29  // used to control the log level, "Run Error" by default
30  CMN_DECLARE_SERVICES(CMN_NO_DYNAMIC_CREATION, CMN_LOG_LOD_RUN_ERROR);
31 protected:
33  double Timeout;
34 
37 
38  bool IsOK;
39 
40  //if false then it was remotely updated
41  //set to true locally as an acknowledgment
43 
44 public:
46  Timeout(0),
47  IsOK(false),
48  WatchdogState(true)
49  {};
50 
52 
53  void AddToProvidedInterface(mtsInterfaceProvided & provInt, mtsStateTable & stateTable);
54 
55  void SetTimeoutPeriod(const double & seconds) {
56  Timeout = seconds;
57  }
58 
59  void Start(void);
60 
61  //true if everything is ok;
62  bool CheckAndUpdate(void);
63  void Reset(void);
64 };
65 
67 
68 #endif // _mtsWatchdogServer_h
#define CMN_LOG_LOD_RUN_ERROR
Definition: cmnLogLoD.h:93
mtsWatchdogServer(void)
Definition: mtsWatchdogServer.h:45
void Reset(void)
Base class for high level objects.
Definition: cmnGenericObject.h:51
CMN_DECLARE_SERVICES_INSTANTIATION(mtsWatchdogServer)
Definition: mtsWatchdogServer.h:28
bool IsOK
Definition: mtsWatchdogServer.h:38
~mtsWatchdogServer()
Definition: mtsWatchdogServer.h:51
Definition: mtsStateTable.h:67
Forward declarations and #define for cisstMultiTask.
Definition: osaStopwatch.h:82
double Timeout
Definition: mtsWatchdogServer.h:33
Defines cmnGenericObject.
bool WatchdogState
Definition: mtsWatchdogServer.h:42
osaStopwatch StopWatch
Definition: mtsWatchdogServer.h:32
mtsFunctionWrite * WatchdogReadBool
Definition: mtsWatchdogServer.h:35
void Start(void)
void AddToProvidedInterface(mtsInterfaceProvided &provInt, mtsStateTable &stateTable)
Definition: mtsInterfaceProvided.h:96
void SetTimeoutPeriod(const double &seconds)
Definition: mtsWatchdogServer.h:55
mtsFunctionWrite * WatchdogWriteBool
Definition: mtsWatchdogServer.h:36
Definition: mtsFunctionWrite.h:37
bool CheckAndUpdate(void)
const int CMN_NO_DYNAMIC_CREATION
Definition: cmnClassRegisterMacros.h:328