16 this->selectedColor = DpDemo_ColorEnum::RED;
27 void DpDemo ::run_handler(
FwIndexType portNum, U32 context) {
29 if (this->dpInProgress) {
30 this->dpContainer.serializeRecord_StringRecord(
Fw::String(
"Test string"));
31 this->dpContainer.serializeRecord_BooleanRecord(
true);
32 this->dpContainer.serializeRecord_I32Record(-100);
33 this->dpContainer.serializeRecord_F64Record(1.25);
34 this->dpContainer.serializeRecord_U32ArrayRecord(DpDemo_U32Array({1, 2, 3, 4, 5}));
35 this->dpContainer.serializeRecord_F32ArrayRecord(DpDemo_F32Array({1.1f, 2.2f, 3.3f}));
36 this->dpContainer.serializeRecord_BooleanArrayRecord(DpDemo_BooleanArray({
true,
false}));
43 this->dpContainer.serializeRecord_StringArrayRecord(strings, 3);
45 const DpDemo_StringArray arrayArray[1] = {DpDemo_StringArray(
46 {
Fw::String(
"0 - String array record element 0"),
Fw::String(
"0 - String array record element 1")})};
47 this->dpContainer.serializeRecord_ArrayArrayRecord(arrayArray, 1);
49 const DpDemo_StructWithStringMembers structArray[2] = {
50 DpDemo_StructWithStringMembers(
Fw::String(
"0 - String member"),
51 DpDemo_StringArray({
Fw::String(
"0 - String array element 0"),
53 DpDemo_StructWithStringMembers(
Fw::String(
"1 - String member"),
54 DpDemo_StringArray({
Fw::String(
"1 - String array element 0"),
56 this->dpContainer.serializeRecord_StructArrayRecord(structArray, 2);
57 this->dpContainer.serializeRecord_ArrayOfStringArrayRecord(DpDemo_ArrayOfStringArray(
58 {DpDemo_StringArray({
Fw::String(
"0 - String array element 0"),
Fw::String(
"0 - String array element 1")}),
59 DpDemo_StringArray({
Fw::String(
"1 - String array element 0"),
Fw::String(
"1 - String array element 1")}),
62 this->dpContainer.serializeRecord_ArrayOfStructsRecord(DpDemo_ArrayOfStructs(
63 {DpDemo_StructWithStringMembers(
Fw::String(
"0 - String member"),
64 DpDemo_StringArray({
Fw::String(
"0 - String array element 0"),
66 DpDemo_StructWithStringMembers(
Fw::String(
"1 - String member"),
67 DpDemo_StringArray({
Fw::String(
"1 - String array element 0"),
69 DpDemo_StructWithStringMembers(
Fw::String(
"2 - String member"),
70 DpDemo_StringArray({
Fw::String(
"2 - String array element 0"),
71 Fw::String(
"2 - String array element 1")}))}));
72 this->dpContainer.serializeRecord_EnumArrayRecord(
73 DpDemo_EnumArray({DpDemo_ColorEnum::RED, DpDemo_ColorEnum::GREEN, DpDemo_ColorEnum::BLUE}));
74 this->dpContainer.serializeRecord_StructWithEverythingRecord(DpDemo_StructWithEverything(
75 -1, 2.5,
Fw::String(
"String Member"),
false, this->selectedColor,
76 {DpDemo_U32Array({1, 2, 3, 4, 5}), DpDemo_U32Array({6, 7, 8, 9, 10})}, DpDemo_F32Array({4.4f, 5.5f, 6.6f}),
77 DpDemo_U32Array({6, 7, 8, 9, 10}),
78 DpDemo_EnumArray({DpDemo_ColorEnum::RED, DpDemo_ColorEnum::GREEN, DpDemo_ColorEnum::BLUE}),
79 DpDemo_StringArray({
Fw::String(
"String array element 0"),
Fw::String(
"String array element 1")}),
80 DpDemo_BooleanArray({
true,
false}),
81 DpDemo_StructWithStringMembers(
83 DpDemo_StringArray({
Fw::String(
"String array element 0"),
Fw::String(
"String array element 1")})),
84 DpDemo_ArrayOfStringArray({DpDemo_StringArray({
Fw::String(
"0 - String array element 0"),
86 DpDemo_StringArray({
Fw::String(
"1 - String array element 0"),
88 DpDemo_StringArray({
Fw::String(
"2 - String array element 0"),
89 Fw::String(
"2 - String array element 1")})})));
90 this->log_ACTIVITY_LO_DpComplete(this->numRecords);
91 this->cleanupAndSendDp();
99 void DpDemo ::SelectColor_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq, Ref::DpDemo_ColorEnum color) {
100 this->selectedColor = color;
101 log_ACTIVITY_HI_ColorSelected(color);
105 void DpDemo ::Dp_cmdHandler(
FwOpcodeType opCode, U32 cmdSeq, DpDemo_DpReqType reqType, U32 priority) {
107 if (!this->isConnected_productGetOut_OutputPort(0) || !this->isConnected_productRequestOut_OutputPort(0)) {
108 this->log_WARNING_HI_DpsNotConnected();
113 this->numRecords = 15;
114 FwSizeType dpSize = DpDemo_StringAlias::SERIALIZED_SIZE +
sizeof(DpDemo_BoolAlias) +
sizeof(DpDemo_I32Alias) +
115 sizeof(DpDemo_F64Alias) + DpDemo_U32Array::SERIALIZED_SIZE + DpDemo_F32Array::SERIALIZED_SIZE +
116 DpDemo_BooleanArray::SERIALIZED_SIZE + DpDemo_EnumArray::SERIALIZED_SIZE +
117 DpDemo_StringArray::SERIALIZED_SIZE + DpDemo_StructWithEverything::SERIALIZED_SIZE +
118 DpDemo_StructWithStringMembers::SERIALIZED_SIZE + (DpDemo_StringArray::SERIALIZED_SIZE * 3) +
119 (DpDemo_StringArray::SERIALIZED_SIZE * 1) +
120 (DpDemo_StructWithStringMembers::SERIALIZED_SIZE * 2) +
121 DpDemo_ArrayOfStringArray::SERIALIZED_SIZE + (numRecords *
sizeof(
FwDpIdType));
124 this->log_ACTIVITY_LO_DpMemRequested(dpSize);
125 if (reqType == DpDemo_DpReqType::IMMEDIATE) {
126 Fw::Success stat = this->dpGet_DpDemoContainer(dpSize, this->dpContainer);
129 this->log_WARNING_HI_DpMemoryFail();
132 this->dpInProgress =
true;
133 this->log_ACTIVITY_LO_DpStarted(numRecords);
134 this->log_ACTIVITY_LO_DpMemReceived(this->dpContainer.getBuffer().getSize());
136 this->dpContainer.setPriority(priority);
139 }
else if (reqType == DpDemo_DpReqType::ASYNC) {
140 this->dpRequest_DpDemoContainer(dpSize);
151 void DpDemo ::dpRecv_DpDemoContainer_handler(DpContainer& container,
Fw::Success::T status) {
154 this->dpContainer = container;
155 this->dpInProgress =
true;
157 this->dpContainer.setPriority(this->dpPriority);
158 this->log_ACTIVITY_LO_DpStarted(this->numRecords);
160 this->log_WARNING_HI_DpMemoryFail();
162 this->dpInProgress =
false;
163 this->numRecords = 0;
167 void DpDemo ::cleanupAndSendDp() {
168 this->dpSend(this->dpContainer);
169 this->dpInProgress =
false;
170 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.
FwIdType FwDpIdType
The type of a data product identifier.
PlatformIndexType FwIndexType
DpDemo(const char *const compName)
Construct DpDemo object.