16 this->selectedColor = DpDemo_ColorEnum::RED;
19 this->dpInProgress =
false;
28 void DpDemo ::run_handler(
FwIndexType portNum, U32 context) {
30 if (this->dpInProgress) {
31 this->dpContainer.serializeRecord_StringRecord(
Fw::String(
"Test string"));
32 this->dpContainer.serializeRecord_BooleanRecord(
true);
33 this->dpContainer.serializeRecord_I32Record(-100);
34 this->dpContainer.serializeRecord_F64Record(1.25);
35 this->dpContainer.serializeRecord_U32ArrayRecord(DpDemo_U32Array({1, 2, 3, 4, 5}));
36 this->dpContainer.serializeRecord_F32ArrayRecord(DpDemo_F32Array({1.1f, 2.2f, 3.3f}));
37 this->dpContainer.serializeRecord_BooleanArrayRecord(DpDemo_BooleanArray({
true,
false}));
44 this->dpContainer.serializeRecord_StringArrayRecord(strings, 3);
46 const DpDemo_StringArray arrayArray[1] = {DpDemo_StringArray(
47 {
Fw::String(
"0 - String array record element 0"),
Fw::String(
"0 - String array record element 1")})};
48 this->dpContainer.serializeRecord_ArrayArrayRecord(arrayArray, 1);
50 const DpDemo_StructWithStringMembers structArray[2] = {
51 DpDemo_StructWithStringMembers(
Fw::String(
"0 - String member"),
52 DpDemo_StringArray({
Fw::String(
"0 - String array element 0"),
54 DpDemo_StructWithStringMembers(
Fw::String(
"1 - String member"),
55 DpDemo_StringArray({
Fw::String(
"1 - String array element 0"),
57 this->dpContainer.serializeRecord_StructArrayRecord(structArray, 2);
58 this->dpContainer.serializeRecord_ArrayOfStringArrayRecord(DpDemo_ArrayOfStringArray(
59 {DpDemo_StringArray({
Fw::String(
"0 - String array element 0"),
Fw::String(
"0 - String array element 1")}),
60 DpDemo_StringArray({
Fw::String(
"1 - String array element 0"),
Fw::String(
"1 - String array element 1")}),
63 this->dpContainer.serializeRecord_ArrayOfStructsRecord(DpDemo_ArrayOfStructs(
64 {DpDemo_StructWithStringMembers(
Fw::String(
"0 - String member"),
65 DpDemo_StringArray({
Fw::String(
"0 - String array element 0"),
67 DpDemo_StructWithStringMembers(
Fw::String(
"1 - String member"),
68 DpDemo_StringArray({
Fw::String(
"1 - String array element 0"),
70 DpDemo_StructWithStringMembers(
Fw::String(
"2 - String member"),
71 DpDemo_StringArray({
Fw::String(
"2 - String array element 0"),
72 Fw::String(
"2 - String array element 1")}))}));
73 this->dpContainer.serializeRecord_EnumArrayRecord(
74 DpDemo_EnumArray({DpDemo_ColorEnum::RED, DpDemo_ColorEnum::GREEN, DpDemo_ColorEnum::BLUE}));
75 this->dpContainer.serializeRecord_StructWithEverythingRecord(DpDemo_StructWithEverything(
76 -1, 2.5,
Fw::String(
"String Member"),
false, this->selectedColor,
77 {DpDemo_U32Array({1, 2, 3, 4, 5}), DpDemo_U32Array({6, 7, 8, 9, 10})}, DpDemo_F32Array({4.4f, 5.5f, 6.6f}),
78 DpDemo_U32Array({6, 7, 8, 9, 10}),
79 DpDemo_EnumArray({DpDemo_ColorEnum::RED, DpDemo_ColorEnum::GREEN, DpDemo_ColorEnum::BLUE}),
80 DpDemo_StringArray({
Fw::String(
"String array element 0"),
Fw::String(
"String array element 1")}),
81 DpDemo_BooleanArray({
true,
false}),
82 DpDemo_StructWithStringMembers(
84 DpDemo_StringArray({
Fw::String(
"String array element 0"),
Fw::String(
"String array element 1")})),
85 DpDemo_ArrayOfStringArray({DpDemo_StringArray({
Fw::String(
"0 - String array element 0"),
87 DpDemo_StringArray({
Fw::String(
"1 - String array element 0"),
89 DpDemo_StringArray({
Fw::String(
"2 - String array element 0"),
90 Fw::String(
"2 - String array element 1")})})));
91 this->log_ACTIVITY_LO_DpComplete(this->numRecords);
92 this->cleanupAndSendDp();
100 void DpDemo ::SelectColor_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq,
const Ref::DpDemo_ColorEnum& color) {
101 this->selectedColor = color;
102 log_ACTIVITY_HI_ColorSelected(color);
108 const DpDemo_DpReqType& reqType,
112 if (!this->isConnected_productGetOut_OutputPort(0) || !this->isConnected_productRequestOut_OutputPort(0)) {
113 this->log_WARNING_HI_DpsNotConnected();
118 this->numRecords = 14;
128 FwSizeType dpSize = SIZE_OF_StringRecord_RECORD + SIZE_OF_BooleanRecord_RECORD + SIZE_OF_I32Record_RECORD +
129 SIZE_OF_F64Record_RECORD + SIZE_OF_U32ArrayRecord_RECORD + SIZE_OF_F32ArrayRecord_RECORD +
130 SIZE_OF_BooleanArrayRecord_RECORD + SIZE_OF_EnumArrayRecord_RECORD +
131 SIZE_OF_StructWithEverythingRecord_RECORD + SIZE_OF_ArrayOfStringArrayRecord_RECORD +
132 SIZE_OF_ArrayOfStructsRecord_RECORD + SIZE_OF_StringArrayRecord_RECORD(stringArrayElements) +
133 SIZE_OF_ArrayArrayRecord_RECORD(arrayArrayElements) +
134 SIZE_OF_StructArrayRecord_RECORD(structArrayElements);
138 this->log_ACTIVITY_LO_DpMemRequested(dpSize);
139 if (reqType == DpDemo_DpReqType::IMMEDIATE) {
140 Fw::Success stat = this->dpGet_DpDemoContainer(dpSize, this->dpContainer);
143 this->log_WARNING_HI_DpMemoryFail();
146 this->dpInProgress =
true;
147 this->log_ACTIVITY_LO_DpStarted(numRecords);
148 this->log_ACTIVITY_LO_DpMemReceived(this->dpContainer.getBuffer().getSize());
150 this->dpContainer.setPriority(priority);
151 this->dpContainer.setProcTypes(proc);
154 }
else if (reqType == DpDemo_DpReqType::ASYNC) {
156 this->pendingOpCode = opCode;
157 this->pendingCmdSeq = cmdSeq;
158 this->dpRequest_DpDemoContainer(dpSize);
169 void DpDemo ::dpRecv_DpDemoContainer_handler(DpContainer& container,
Fw::Success::T status) {
172 this->dpContainer = container;
173 this->dpInProgress =
true;
175 this->dpContainer.setPriority(this->dpPriority);
176 this->dpContainer.setProcTypes(this->dpProc);
177 this->log_ACTIVITY_LO_DpStarted(this->numRecords);
180 this->log_WARNING_HI_DpMemoryFail();
182 this->dpInProgress =
false;
183 this->numRecords = 0;
188 void DpDemo ::cleanupAndSendDp() {
189 this->dpSend(this->dpContainer);
190 this->dpInProgress =
false;
191 this->numRecords = 0;
FwIdType FwOpcodeType
The type of a command opcode.
PlatformSizeType FwSizeType
U32 FwDpPriorityType
The type of a data product priority.
StringTemplate< FW_FIXED_LENGTH_STRING_SIZE > String
~DpDemo()
Destroy DpDemo object.
Command successfully executed.
Command had execution error.
PlatformIndexType FwIndexType
DpDemo(const char *const compName)
Construct DpDemo object.