fprime/Ref/PingReceiver/PingReceiverComponentImpl.cpp
2025-09-10 15:02:07 -07:00

47 lines
1.7 KiB
C++

// ======================================================================
// \title PingReceiverImpl.cpp
// \author tim
// \brief cpp file for PingReceiver component implementation class
//
// \copyright
// Copyright 2009-2015, by the California Institute of Technology.
// ALL RIGHTS RESERVED. United States Government Sponsorship
// acknowledged.
//
// ======================================================================
#include <Fw/FPrimeBasicTypes.hpp>
#include <Ref/PingReceiver/PingReceiverComponentImpl.hpp>
namespace Ref {
// ----------------------------------------------------------------------
// Construction, initialization, and destruction
// ----------------------------------------------------------------------
PingReceiverComponentImpl ::PingReceiverComponentImpl(const char* const compName)
: PingReceiverComponentBase(compName), m_inhibitPings(false), m_pingsRecvd(0) {}
PingReceiverComponentImpl ::~PingReceiverComponentImpl() {}
// ----------------------------------------------------------------------
// Handler implementations for user-defined typed input ports
// ----------------------------------------------------------------------
void PingReceiverComponentImpl ::PingIn_handler(const FwIndexType portNum, U32 key) {
// this->log_DIAGNOSTIC_PR_PingReceived(key);
this->tlmWrite_PR_NumPings(this->m_pingsRecvd++);
if (not this->m_inhibitPings) {
PingOut_out(0, key);
}
}
void PingReceiverComponentImpl::PR_StopPings_cmdHandler(FwOpcodeType opCode, /*!< The opcode*/
U32 cmdSeq /*!< The command sequence number*/
) {
this->m_inhibitPings = true;
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
}
} // end namespace Ref