fprime/Autocoders/Python/templates/ExampleComponentImpl.cpp
Rob Bocchino 53b2dcd0c9 FPP Types and Ports (#727)
* Revise command response port

Replace inline enum with XML enum type
Generate XML from FPP
Revise uses to match

* Revise xml-gen script

* Revise event ports

Replace inline enums with external enums

* Add missing files

* Revise ActiveLogger

* Revise text log port

* Revise text log port

Replace inline enum with external LogSeverity enum
Now Log and TextLog share the same enum for severity

* Revise Fw/Prm

* Revise uses of Fw/Prm

* Revise Fw/Cmd model

* Revise Fw/Cmd build

* Revise build for Fw/Cmd

* Refactor Fw/Log model

* Refactor build for Fw/Prm

* Revise build scripts

Remove workarounds after compiler fix

* Revise model

Revise build scripts
Regerate XML

* Revise FPP model in Fw

* Add gen-xml

* Add metadata files

* Add redo scripts

* Remove gen-xml scripts

* Revise redo scripts

* Revise redo scripts

* Add redo scripts

* Add FPP model for Fw/Com

* Add FPP model for Fw/Time

* Revise redo scripts

* Add FPP model for Fw/Tlm

* Revise redo scripts

* Revise redo scripts

* Revise redo scripts, gitignore

* Remove unused file

* Revise redo scripts

* Add FPP.adoc

* Add FPP model for Svc/Cycle

* Revise defs.fpp and build rules

* Revise do files

Rename fpp-defs to defs

* Update redo scripts

* Revise redo scripts

* Fix build rules

* Add FPP model for Svc/Sched

* Revise update script

* Rename defs.fpp --> locs.fpp

* Revise build scripts

* Revise Svc.Cycle model

Make TimerVal argument by value, not by reference

This is required for compliance with FPP semantics, because
Svc.Cycle is used in async input ports

* Revert "Revise Svc.Cycle model"

This reverts commit a31c12f1c0a9639da818d79da4f7ddd036c0b3d8.

Under the revised semantics of FPP, this change is not necessary.

* Revise Fw/Types build

Add missing file

* Revise FatalHandler

Abort with SIGABRT, not SIGSEGV

* Add FPP model for Ping port

* Revise GDS launcher

Make the HTML server port configurable
Interpret -g 5001 as "Run the HTML GUI at port 5001"

* Fix bug in XML array parser

* Revise build scripts

* Revise build script

* Fix merge errors

* Fix merge errors

* Fix redo scripts

* redo not overwriting Svc/FileDownlink .xml files

* Remove redo database

* Revise .gitignore

* Revise FileDownlink FPP model

* pre redo all in Drv/ByteStreamDriveModel

* Revisited SignalPair to run redo all

* redo all in Ref/SignalGen

* Saving before running redo all

* /Svc/Watchdog pre redo all

* All Svc Enums etc. done minus /Svc/PolyIf and /Svc/WatchDog

* Forgot to add /Seq/Seq.fpp on last commit

* Created Type.fpp, ran redo xml in /Svc/Seq

* /Svc/PolyIf pre redo all

* /Svc/PolyIf returning .hpp error on fprime-util build

* Svc ports etc. complete

* Svc/ActiveLogger pre redo

* /Svc/PolyDb pre redo

* /Svc/ActiveTextLogger pre-redo

* /Svc/ActiveTextLogger post redo

* Svc/ComSplitter pre redo

* Svc/ComSplitter post redo

* /Svc/Deframer pre redo

* Svc/Deframer post redo

* /Svc/FatalHandler pre redo

* /Svc/FatalHandler post redo

* /Svc/Framer pre redo

* /Svc/FramerComponentAi post redo

* /Svc/LinuxTimer pre redo

* post redo for /Svc/LinuxTimer /Svc/PolyDb

* /Svc/Time pre redo

* /Svc/Time post redo

* /Svc/TlmChan pre redo

* /Svc/TlmChan post redo

* Remove files deleted from mainline

* Revert change to Fatal Handler

* Rename CommandResponse to CmdResponse

* Revert name of enum constant

* updated Fw/types.fpp

* Added ActiveRateGroupOutputPorts to Fpconfig.fpp, Svc/ActiveRateGroup pre redo

* /Svc/ActiveRateGroup component finished

* Revise build scripts

* Revise Ref redo build

Make it into a separate project

* Revise fpp build

* Revise fpp build

* Revise ActiveRateGroup

Put AcConstants variable back in for now

* Revise FPP model

* Revise fpp model

Add AcConstants.fpp

* Remove local setup scripts

* Fix spelling in comment

* Revise spell check

Co-authored-by: jweadick <joshua.m.weadick@jpl.nasa.gov>
2021-06-25 18:14:29 -07:00

79 lines
2.8 KiB
C++

/*
* ExampleComponentImpl.cpp
*
* Created on: Nov 3, 2014
* Author: tcanham
*/
#include <Autocoders/Python/templates/ExampleComponentImpl.hpp>
#include <stdio.h>
namespace ExampleComponents {
#if FW_OBJECT_NAMES == 1
ExampleComponentImpl::ExampleComponentImpl(const char* name) : ExampleComponentBase(name) {
}
#else
ExampleComponentImpl::ExampleComponentImpl() {
}
#endif
ExampleComponentImpl::~ExampleComponentImpl() {
}
void ExampleComponentImpl::init(NATIVE_INT_TYPE queueDepth, NATIVE_INT_TYPE instance) {
ExampleComponentBase::init(queueDepth,instance);
}
void ExampleComponentImpl::exampleInput_handler(NATIVE_INT_TYPE portNum, I32 arg1, ANameSpace::mytype arg2, U8 arg3, Example3::ExampleSerializable arg4, AnotherExample::SomeEnum arg5) {
Fw::TlmString arg = "A string arg";
// write some telemetry
this->tlmWrite_stringchan(arg);
// call the output port
if (this->isConnected_exampleOutput_OutputPort(0)) {
this->exampleOutput_out(0,arg1,arg2,arg3,arg4,arg5);
} else {
printf("Output port not connected.\n");
}
}
SomeOtherNamespace::AnotherEnum ExampleComponentImpl::anotherInput_handler(NATIVE_INT_TYPE portNum, I32 arg1, F64 arg2, SomeOtherNamespace::SomeEnum arg3) {
return SomeOtherNamespace::MEMB1;
}
void ExampleComponentImpl::TEST_CMD_1_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, I32 arg1, ExampleComponentBase::CmdEnum arg2, const Fw::CmdStringArg& arg3) {
// issue the test event with the opcode
Fw::LogStringArg str = "TEST_CMD_1";
this->log_ACTIVITY_HI_SomeEvent(opCode,(F32)arg1, Example4::Example2(2.0,3.0,4,5), str,ExampleComponentBase::EVENT_MEMB2);
// write a value to a telemetry channel
U32 chan = 12;
this->tlmWrite_somechan(chan);
this->cmdResponse_out(opCode,cmdSeq, Fw::CmdResponse::OK);
}
void ExampleComponentImpl::TEST_CMD_2_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, I32 arg1, F32 arg2) {
Fw::LogStringArg str = "TEST_CMD_2";
this->log_ACTIVITY_HI_SomeEvent(opCode,arg2, Example4::Example2(6.0,7.0,8,9), str,ExampleComponentBase::EVENT_MEMB3);
Example4::Example2 ex(10.0,11.0,12,13);
this->tlmWrite_anotherchan(ex); // <! Example output port
this->cmdResponse_out(opCode,cmdSeq, Fw::CmdResponse::EXECUTION_ERROR);
}
void ExampleComponentImpl::parameterUpdated(FwPrmIdType id) {
printf("Parameter ID %d was updated!\n",id);
}
void ExampleComponentImpl::test_internalInterfaceHandler(I32 arg1, F32 arg2, U8 arg3) {
}
void ExampleComponentImpl::test2_internalInterfaceHandler(I32 arg1, SomeEnum arg2, const Fw::InternalInterfaceString& arg3, Example4::Example2& arg4) {
}
} /* namespace ExampleComponents */