45 if (command.
delay != 0.0f)
continue;
47 if (command.
name ==
"AcknowledgeAllMessages")
55 #pragma region Watches 56 for (UINT i = 0; i <
watches.size(); i++)
58 if (!
watches.at(i).currentState)
59 watches.at(i).currentState =
bus->GetComponentCurrentStatePtr(
watches.at(i).guid);
63 bool removedOne =
false, addedOne =
false, breakOut =
false;
64 for (UINT j = 0; j <
watches.at(i).conditions.size(); j++)
66 watches.at(i).conditions.at(j).secondsSinceLast += fElapsed;
67 if (!addedOne &&
watches.at(i).conditions.at(j).fault.is_set() &&
watches.at(i).conditions.at(j).fault.get() & *
watches.at(i).faultState)
69 if (!
watches.at(i).conditions.at(j).messageOnStack)
72 watches.at(i).conditions.at(j).messageOnStack =
true;
77 else if (!addedOne &&
watches.at(i).conditions.at(j).below.is_set() && *
watches.at(i).currentState <
watches.at(i).conditions.at(j).below)
79 bool reTrip =
watches.at(i).conditions.at(j).repeatBelow.is_set() && *
watches.at(i).currentState <
watches.at(i).conditions.at(j).repeatBelow &&
watches.at(i).conditions.at(j).secondsSinceLast > 60.0f;
80 if (!
watches.at(i).conditions.at(j).messageOnStack || reTrip)
83 watches.at(i).conditions.at(j).secondsSinceLast = 0.0f;
84 watches.at(i).conditions.at(j).messageOnStack =
true;
89 else if (!addedOne &&
watches.at(i).conditions.at(j).above.is_set() && *
watches.at(i).currentState >
watches.at(i).conditions.at(j).above)
91 bool reTrip =
watches.at(i).conditions.at(j).repeatAbove.is_set() && *
watches.at(i).currentState >
watches.at(i).conditions.at(j).repeatAbove &&
watches.at(i).conditions.at(j).secondsSinceLast > 60.0f;
92 if (!
watches.at(i).conditions.at(j).messageOnStack || reTrip)
95 watches.at(i).conditions.at(j).secondsSinceLast = 0.0f;
96 watches.at(i).conditions.at(j).messageOnStack =
true;
101 else if (addedOne ||
watches.at(i).conditions.at(j).messageOnStack)
104 watches.at(i).conditions.at(j).messageOnStack =
false;
109 if (!addedOne && removedOne && !
watches.at(i).onClear.empty())
112 if (
watches.at(i).quietStart.is_set() &&
watches.at(i).quietEnd.is_set())
116 if (st.wHour >
watches.at(i).quietStart.get().wHour || (st.wHour ==
watches.at(i).quietStart.get().wHour && st.wMinute >=
watches.at(i).quietStart.get().wMinute))
118 if (st.wHour <
watches.at(i).quietEnd.get().wHour || (st.wHour ==
watches.at(i).quietEnd.get().wHour && st.wMinute <
watches.at(i).quietEnd.get().wMinute))
121 if (!quiet &&
watches.at(i).sendEmail)
124 command.
name =
"SendEmail";
131 sprintf_s(msg, 199,
"Cas::FrameMove Did not send clear message due to quiet time: %s",
watches.at(i).onClear.c_str());
175 logger->
Log(
"CAS::AcknowledgeAllMessages Completed!");
189 sprintf_s(msg, 99,
"CAS::IsMessageOnStack Retripped: %S",
bus->
messages.at(i).text.c_str());
209 sprintf_s(msg, 99,
"CAS::RemoveMessage Removed: %S", text.c_str());
222 command.
name =
"SendEmail";
223 sprintf_s(command.
svalue, 64,
"%S", text.c_str());
232 message.
level = level;
236 sprintf_s(msg, 99,
"CAS::AddMessage Added: %S (%i)", text.c_str(), level);
247 newCommand.
name =
"CASMasterWarningChime";
249 logger->
Log(
"CAS::AddMessage MasterWarningChime requested!");
256 newCommand.
name =
"CASMasterCautionChime";
258 logger->
Log(
"CAS::AddMessage MasterCautionChime requested!");
269 for (UINT w = 0; w <
watches.size(); w++)
271 for (UINT c = 0; c <
watches.at(w).conditions.size(); c++)
273 watches.at(w).conditions.at(c).messageOnStack =
false;
277 logger->
Log(
"CAS::UnacknowledgeAllMessages Completed!");
std::vector< Message > messages
void UnacknowledgeAllMessages()
double ProgramTime
Identified a need for these in modules.
std::vector< Command > commandStream
Systems::Fault * GetComponentFaultStatePtr(std::string guidStr)
Cas(Bus *prmBus, Logger *prmLogger, std::vector< Watch > watches, float *prmCasGetFloatPtr)
bool IsMessageOnStack(std::wstring text, bool renew) const
void FrameMove(float fElapsedTime) override
std::string name
command name
std::vector< Watch > watches
bool RemoveMessage(std::wstring text) const
Abstract base class for modules By definition, instruments don't do any of the work (they don't modif...
void Log(const char *msg, Level level=Info, int errorCode=0)
These have to be in this order.
void AddMessage(std::wstring text, MessageLevel level, bool sendEmail)
float delay
wait number of seconds before executing command
float secsincereset
2 second power up delay
void AcknowledgeAllMessages() const
Logger * logger
2 second application start delay