M1M3 Support System
Loading...
Searching...
No Matches
InterlockWarning.h
1/*
2 * This file is part of LSST M1M3 support system package.
3 *
4 * Developed for the Vera C. Rubin Telescope and Site System.
5 * This product includes software developed by the LSST Project
6 * (https://www.lsst.org).
7 * See the COPYRIGHT file at the top-level directory of this distribution
8 * for details of code ownership.
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef LSST_INTERLOCKWARNING_H
25#define LSST_INTERLOCKWARNING_H
26
27#include <SAL_MTM1M3.h>
28
29#include <M1M3SSPublisher.h>
30#include <cRIO/Singleton.h>
31
32namespace LSST {
33namespace M1M3 {
34namespace SS {
35
39class InterlockWarning : public MTM1M3_logevent_interlockWarningC, public cRIO::Singleton<InterlockWarning> {
40public:
45 timestamp = NAN;
46 _currentInput = 0xFFFF;
47 _heartbeatMismatch = -1;
48 }
49
56 void setData(double globalTimestamp, uint16_t inputStates) {
57 timestamp = globalTimestamp;
58 if (_currentInput != inputStates) {
59 anyWarning = (inputStates & 0x00DB) != 0x00DB; // this needs to be changed if new bits are added
60 auxPowerNetworksOff = (inputStates & 0x0001) == 0;
61 thermalEquipmentOff = (inputStates & 0x0002) == 0;
62 airSupplyOff = (inputStates & 0x0008) == 0;
63 cabinetDoorOpen = (inputStates & 0x0010) == 0;
64 tmaMotionStop = (inputStates & 0x0040) == 0;
65 gisHeartbeatLost = (inputStates & 0x0080) == 0;
66 _currentInput = inputStates;
67 M1M3SSPublisher::instance().logInterlockWarning(this);
68 }
69 }
70
77 void setHearbeatOutputMismatch(double globalTimestamp, bool mismatched) {
78 if (_heartbeatMismatch < 0 || _heartbeatMismatch != mismatched) {
79 timestamp = globalTimestamp;
80 _heartbeatMismatch = mismatched;
81 heartbeatStateOutputMismatch = mismatched;
82 M1M3SSPublisher::instance().logInterlockWarning(this);
83 }
84 }
85
86private:
87 uint16_t _currentInput;
88 int _heartbeatMismatch;
89};
90
91} // namespace SS
92} // namespace M1M3
93} // namespace LSST
94
95#endif // LSST_INTERLOCKWARNING_H
Wrapper object for MTM1M3_logevent_interlockWarningC.
Definition InterlockWarning.h:39
InterlockWarning(token)
Construct new InterlockWarning.
Definition InterlockWarning.h:44
void setHearbeatOutputMismatch(double globalTimestamp, bool mismatched)
Definition InterlockWarning.h:77
void setData(double globalTimestamp, uint16_t inputStates)
Sets interlock data.
Definition InterlockWarning.h:56