fprime/Ref/PingReceiver/PingReceiverComponentImpl.cpp
Joshua Anderson 3cccd731d9
Refactor FW_OBJECT_NAMES switches and fix building without object names
Instead of adding the name argument to a constructor when FW_OBJECT_NAMES
is enabled, always supply a name argument.

Add a marco that conditionally sets the name to "" if FW_OBJECT_NAMES is not set.
This cleans up a lot of the conditional compilation switches that weren't being tested
and would silently break, while still stripping the strings from the binary.
2020-10-07 17:19:05 -07:00

72 lines
2.0 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 <Ref/PingReceiver/PingReceiverComponentImpl.hpp>
#include "Fw/Types/BasicTypes.hpp"
namespace Ref {
// ----------------------------------------------------------------------
// Construction, initialization, and destruction
// ----------------------------------------------------------------------
PingReceiverComponentImpl ::
PingReceiverComponentImpl(
const char *const compName
) : PingReceiverComponentBase(compName), m_inhibitPings(false), m_pingsRecvd(0)
{
}
void PingReceiverComponentImpl ::
init(
const NATIVE_INT_TYPE queueDepth,
const NATIVE_INT_TYPE instance
)
{
PingReceiverComponentBase::init(queueDepth, instance);
}
PingReceiverComponentImpl ::
~PingReceiverComponentImpl(void)
{
}
// ----------------------------------------------------------------------
// Handler implementations for user-defined typed input ports
// ----------------------------------------------------------------------
void PingReceiverComponentImpl ::
PingIn_handler(
const NATIVE_INT_TYPE 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::COMMAND_OK);
}
} // end namespace Ref