Debian Codegraph @

drivers/auxiliary/watchdog.h

raw symbols SCIP
1 /*******************************************************************************
2 Copyright(c) 2015 Jasem Mutlaq. All rights reserved.
3
4 INDI Watchdog driver.
5
6 The driver expects a heartbeat from the client every X minutes. If no heartbeat
7 is received, the driver executes the shutdown procedures.
8
9 This program is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 2 of the License, or (at your option)
12 any later version.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA.
23
24 The full GNU General Public License is included in this distribution in the
25 file called LICENSE.
26 *******************************************************************************/
27
28 #pragma once
29
30 #include "defaultdevice.h"cxx . . $ `<file>/libs/indibase/defaultdevice.h`/
31
32 class WatchDogClientcxx . . $ WatchDogClient#;
33
34 class WatchDogcxx . . $ WatchDog# : public INDIcxx . . $ INDI/::DefaultDevicecxx . . $ INDI/DefaultDevice#
35 {
36 public:
37 typedef enumcxx . . $ WatchDog#$anonymous_type_0#
38 {
39 WATCHDOG_IDLEcxx . . $ WatchDog#WATCHDOG_IDLE.,
40 WATCHDOG_CLIENT_STARTEDcxx . . $ WatchDog#WATCHDOG_CLIENT_STARTED.,
41 WATCHDOG_MOUNT_PARKEDcxx . . $ WatchDog#WATCHDOG_MOUNT_PARKED.,
42 WATCHDOG_DOME_PARKEDcxx . . $ WatchDog#WATCHDOG_DOME_PARKED.,
43 WATCHDOG_COMPLETEcxx . . $ WatchDog#WATCHDOG_COMPLETE.,
44 WATCHDOG_ERRORcxx . . $ WatchDog#WATCHDOG_ERROR.
45 } ShutdownStagescxx . . $ WatchDog#ShutdownStages#;
46 typedef enumcxx . . $ WatchDog#$anonymous_type_1# { PARK_MOUNTcxx . . $ WatchDog#PARK_MOUNT., PARK_DOMEcxx . . $ WatchDog#PARK_DOME., EXECUTE_SCRIPTcxx . . $ WatchDog#EXECUTE_SCRIPT. } ShutdownProcedurecxx . . $ WatchDog#ShutdownProcedure#;
47 typedef enumcxx . . $ WatchDog#$anonymous_type_2# { MOUNT_IGNOREDcxx . . $ WatchDog#MOUNT_IGNORED., MOUNT_LOCKScxx . . $ WatchDog#MOUNT_LOCKS. } MountPolicycxx . . $ WatchDog#MountPolicy#;
48
49 WatchDogcxx . . $ WatchDog#WatchDog(49f6e7a06ebc5aa8).();
50 virtual ~cxx . . $ WatchDog#`~WatchDog`(49f6e7a06ebc5aa8).WatchDogcxx . . $ WatchDog#();
51
52 virtual void ISGetPropertiescxx . . $ WatchDog#ISGetProperties(85c52e162fed56f9).(const char *dev) override;
53 virtual bool ISSnoopDevicecxx . . $ WatchDog#ISSnoopDevice(4c5c830808cba56b).(XMLEle * root) override;
54 virtual bool ISNewTextcxx . . $ WatchDog#ISNewText(1f3dbebc116ed926).(const char *dev, const char *name, char *texts[], char *names[], int n) override;
55 virtual bool ISNewNumbercxx . . $ WatchDog#ISNewNumber(b910d3521abb33fb).(const char *dev, const char *name, double values[], char *names[], int n) override;
56 virtual bool ISNewSwitchcxx . . $ WatchDog#ISNewSwitch(e439c05866add404).(const char *dev, const char *name, ISStatecxx . . $ ISState# *states, char *names[], int n) override;
57
58 protected:
59 virtual bool initPropertiescxx . . $ WatchDog#initProperties(c9857a73d68e59ba).() override;
60
61 virtual void TimerHitcxx . . $ WatchDog#TimerHit(49f6e7a06ebc5aa8).() override;
62
63 virtual bool Connectcxx . . $ WatchDog#Connect(c9857a73d68e59ba).() override;
64 virtual bool Disconnectcxx . . $ WatchDog#Disconnect(c9857a73d68e59ba).() override;
65 virtual const char *getDefaultNamecxx . . $ WatchDog#getDefaultName(33a1f659e94feb42).() override;
66
67 virtual bool saveConfigItemscxx . . $ WatchDog#saveConfigItems(dc9e5a301483124c).(FILE *fp) override;
68
69 private:
70 void parkDomecxx . . $ WatchDog#parkDome(49f6e7a06ebc5aa8).();
71 void parkMountcxx . . $ WatchDog#parkMount(49f6e7a06ebc5aa8).();
72 void executeScriptcxx . . $ WatchDog#executeScript(49f6e7a06ebc5aa8).();
73
74 // Heart Beat to check if client is alive
75 INumberVectorPropertycxx . . $ INumberVectorProperty# HeartBeatNPcxx . . $ WatchDog#HeartBeatNP.;
76 INumbercxx . . $ INumber# HeartBeatNcxx . . $ WatchDog#HeartBeatN.[1];
77
78 // Weather threshold
79 INumberVectorPropertycxx . . $ INumberVectorProperty# WeatherThresholdNPcxx . . $ WatchDog#WeatherThresholdNP.;
80 INumbercxx . . $ INumber# WeatherThresholdNcxx . . $ WatchDog#WeatherThresholdN.[1];
81
82 // Settings
83 ITextVectorPropertycxx . . $ ITextVectorProperty# SettingsTPcxx . . $ WatchDog#SettingsTP.;
84 ITextcxx . . $ IText# SettingsTcxx . . $ WatchDog#SettingsT.[4] {};
85 enumcxx . . $ WatchDog#$anonymous_type_3# {INDISERVER_HOSTcxx . . $ WatchDog#INDISERVER_HOST., INDISERVER_PORTcxx . . $ WatchDog#INDISERVER_PORT., SHUTDOWN_SCRIPTcxx . . $ WatchDog#SHUTDOWN_SCRIPT.};
86
87 // Shutdown steps
88 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# ShutdownProcedureSPcxx . . $ WatchDog#ShutdownProcedureSP.;
89 ISwitchcxx . . $ ISwitch# ShutdownProcedureScxx . . $ WatchDog#ShutdownProcedureS.[3];
90
91 // Mount Policy
92 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# MountPolicySPcxx . . $ WatchDog#MountPolicySP.;
93 ISwitchcxx . . $ ISwitch# MountPolicyScxx . . $ WatchDog#MountPolicyS.[2];
94
95 // Which source should trigger the shutdown?
96 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# ShutdownTriggerSPcxx . . $ WatchDog#ShutdownTriggerSP.;
97 ISwitchcxx . . $ ISwitch# ShutdownTriggerScxx . . $ WatchDog#ShutdownTriggerS.[2];
98 enumcxx . . $ WatchDog#$anonymous_type_4# { TRIGGER_CLIENTcxx . . $ WatchDog#TRIGGER_CLIENT., TRIGGER_WEATHERcxx . . $ WatchDog#TRIGGER_WEATHER. };
99
100 // Active Devices to Snoop on
101 ITextVectorPropertycxx . . $ ITextVectorProperty# ActiveDeviceTPcxx . . $ WatchDog#ActiveDeviceTP.;
102 ITextcxx . . $ IText# ActiveDeviceTcxx . . $ WatchDog#ActiveDeviceT.[3] {};
103 enumcxx . . $ WatchDog#$anonymous_type_5# { ACTIVE_TELESCOPEcxx . . $ WatchDog#ACTIVE_TELESCOPE., ACTIVE_DOMEcxx . . $ WatchDog#ACTIVE_DOME., ACTIVE_WEATHERcxx . . $ WatchDog#ACTIVE_WEATHER. };
104
105 // Pointer to client to issue commands to the respective mount and/or dome drivers.
106 WatchDogClientcxx . . $ WatchDogClient# *watchdogClientcxx . . $ WatchDog#watchdogClient. {nullptr};
107 // Watchdog timer to ensure heart beat is there
108 int32_t m_WatchDogTimercxx . . $ WatchDog#m_WatchDogTimer. {-1};
109 // Weather timer to trigger shutdown if weather remains ALERT for this many seconds.
110 int32_t m_WeatherAlertTimercxx . . $ WatchDog#m_WeatherAlertTimer. {-1};
111 // INDI Port
112 uint32_tcxx . . $ uint32_t# m_INDIServerPortcxx . . $ WatchDog#m_INDIServerPort. { 7624 };
113 // Weather State
114 IPStatecxx . . $ IPState# m_WeatherStatecxx . . $ WatchDog#m_WeatherState. { IPS_IDLEcxx . . $ IPS_IDLE. };
115 // Mount Parked?
116 bool m_IsMountParkedcxx . . $ WatchDog#m_IsMountParked. { false };
117 // Dome Parked?
118 bool m_IsDomeParkedcxx . . $ WatchDog#m_IsDomeParked. { false };
119 // State machine to store where in the shutdown procedure we currently stand
120 ShutdownStagescxx . . $ WatchDog#ShutdownStages# m_ShutdownStagecxx . . $ WatchDog#m_ShutdownStage.;
121 };