F´ Flight Software - C/C++ Documentation devel
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
CmdSequencerComponentAc.cpp
Go to the documentation of this file.
1// ======================================================================
2// \title CmdSequencerComponentAc.cpp
3// \author Generated by fpp-to-cpp
4// \brief cpp file for CmdSequencer component base class
5// ======================================================================
6
7#include <cstdio>
8
10#include "Fw/Types/Assert.hpp"
11#if FW_ENABLE_TEXT_LOGGING
12#include "Fw/Types/String.hpp"
13#endif
14
15namespace Svc {
16
17 namespace {
18 enum MsgTypeEnum {
19 CMDSEQUENCER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
20 CMDRESPONSEIN_CMDRESPONSE,
21 PINGIN_PING,
22 SCHEDIN_SCHED,
23 SEQCANCELIN_CMDSEQCANCEL,
24 SEQRUNIN_CMDSEQIN,
25 CMD_CS_RUN,
26 CMD_CS_VALIDATE,
27 CMD_CS_CANCEL,
28 CMD_CS_START,
29 CMD_CS_STEP,
30 CMD_CS_AUTO,
31 CMD_CS_MANUAL,
32 CMD_CS_JOIN_WAIT,
33 };
34
35 // Get the max size by constructing a union of the async input, command, and
36 // internal port serialization sizes
37 union BuffUnion {
43 };
44
45 // Define a message buffer class large enough to handle all the
46 // asynchronous inputs to the component
47 class ComponentIpcSerializableBuffer :
49 {
50
51 public:
52
53 enum {
54 // Max. message size = size of data + message id + port
55 SERIALIZATION_SIZE =
56 sizeof(BuffUnion) +
57 sizeof(NATIVE_INT_TYPE) +
58 sizeof(NATIVE_INT_TYPE)
59 };
60
61 NATIVE_UINT_TYPE getBuffCapacity() const {
62 return sizeof(m_buff);
63 }
64
65 U8* getBuffAddr() {
66 return m_buff;
67 }
68
69 const U8* getBuffAddr() const {
70 return m_buff;
71 }
72
73 private:
74 // Should be the max of all the input ports serialized sizes...
75 U8 m_buff[SERIALIZATION_SIZE];
76
77 };
78 }
79
80 // ----------------------------------------------------------------------
81 // Component initialization
82 // ----------------------------------------------------------------------
83
84 void CmdSequencerComponentBase ::
85 init(
86 NATIVE_INT_TYPE queueDepth,
87 NATIVE_INT_TYPE instance
88 )
89 {
90 // Initialize base class
92
93 // Connect input port cmdIn
94 for (
95 PlatformIntType port = 0;
96 port < static_cast<PlatformIntType>(this->getNum_cmdIn_InputPorts());
97 port++
98 ) {
99 this->m_cmdIn_InputPort[port].init();
100 this->m_cmdIn_InputPort[port].addCallComp(
101 this,
102 m_p_cmdIn_in
103 );
104 this->m_cmdIn_InputPort[port].setPortNum(port);
105
106#if FW_OBJECT_NAMES == 1
107 // The port name consists of this->m_objName and some extra info.
108 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
109 // However, the compiler may assume that this->m_objName fills
110 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
111 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
112 // bytes to cover the extra info.
113 char portName[2*FW_OBJ_NAME_MAX_SIZE];
114 (void) snprintf(
115 portName,
116 sizeof(portName),
117 "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]",
118 this->m_objName,
119 port
120 );
121 this->m_cmdIn_InputPort[port].setObjName(portName);
122#endif
123 }
124
125 // Connect input port cmdResponseIn
126 for (
127 PlatformIntType port = 0;
128 port < static_cast<PlatformIntType>(this->getNum_cmdResponseIn_InputPorts());
129 port++
130 ) {
131 this->m_cmdResponseIn_InputPort[port].init();
132 this->m_cmdResponseIn_InputPort[port].addCallComp(
133 this,
134 m_p_cmdResponseIn_in
135 );
136 this->m_cmdResponseIn_InputPort[port].setPortNum(port);
137
138#if FW_OBJECT_NAMES == 1
139 // The port name consists of this->m_objName and some extra info.
140 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
141 // However, the compiler may assume that this->m_objName fills
142 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
143 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
144 // bytes to cover the extra info.
145 char portName[2*FW_OBJ_NAME_MAX_SIZE];
146 (void) snprintf(
147 portName,
148 sizeof(portName),
149 "%s_cmdResponseIn_InputPort[%" PRI_PlatformIntType "]",
150 this->m_objName,
151 port
152 );
153 this->m_cmdResponseIn_InputPort[port].setObjName(portName);
154#endif
155 }
156
157 // Connect input port pingIn
158 for (
159 PlatformIntType port = 0;
160 port < static_cast<PlatformIntType>(this->getNum_pingIn_InputPorts());
161 port++
162 ) {
163 this->m_pingIn_InputPort[port].init();
164 this->m_pingIn_InputPort[port].addCallComp(
165 this,
166 m_p_pingIn_in
167 );
168 this->m_pingIn_InputPort[port].setPortNum(port);
169
170#if FW_OBJECT_NAMES == 1
171 // The port name consists of this->m_objName and some extra info.
172 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
173 // However, the compiler may assume that this->m_objName fills
174 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
175 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
176 // bytes to cover the extra info.
177 char portName[2*FW_OBJ_NAME_MAX_SIZE];
178 (void) snprintf(
179 portName,
180 sizeof(portName),
181 "%s_pingIn_InputPort[%" PRI_PlatformIntType "]",
182 this->m_objName,
183 port
184 );
185 this->m_pingIn_InputPort[port].setObjName(portName);
186#endif
187 }
188
189 // Connect input port schedIn
190 for (
191 PlatformIntType port = 0;
192 port < static_cast<PlatformIntType>(this->getNum_schedIn_InputPorts());
193 port++
194 ) {
195 this->m_schedIn_InputPort[port].init();
196 this->m_schedIn_InputPort[port].addCallComp(
197 this,
198 m_p_schedIn_in
199 );
200 this->m_schedIn_InputPort[port].setPortNum(port);
201
202#if FW_OBJECT_NAMES == 1
203 // The port name consists of this->m_objName and some extra info.
204 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
205 // However, the compiler may assume that this->m_objName fills
206 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
207 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
208 // bytes to cover the extra info.
209 char portName[2*FW_OBJ_NAME_MAX_SIZE];
210 (void) snprintf(
211 portName,
212 sizeof(portName),
213 "%s_schedIn_InputPort[%" PRI_PlatformIntType "]",
214 this->m_objName,
215 port
216 );
217 this->m_schedIn_InputPort[port].setObjName(portName);
218#endif
219 }
220
221 // Connect input port seqCancelIn
222 for (
223 PlatformIntType port = 0;
224 port < static_cast<PlatformIntType>(this->getNum_seqCancelIn_InputPorts());
225 port++
226 ) {
227 this->m_seqCancelIn_InputPort[port].init();
228 this->m_seqCancelIn_InputPort[port].addCallComp(
229 this,
230 m_p_seqCancelIn_in
231 );
232 this->m_seqCancelIn_InputPort[port].setPortNum(port);
233
234#if FW_OBJECT_NAMES == 1
235 // The port name consists of this->m_objName and some extra info.
236 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
237 // However, the compiler may assume that this->m_objName fills
238 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
239 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
240 // bytes to cover the extra info.
241 char portName[2*FW_OBJ_NAME_MAX_SIZE];
242 (void) snprintf(
243 portName,
244 sizeof(portName),
245 "%s_seqCancelIn_InputPort[%" PRI_PlatformIntType "]",
246 this->m_objName,
247 port
248 );
249 this->m_seqCancelIn_InputPort[port].setObjName(portName);
250#endif
251 }
252
253 // Connect input port seqRunIn
254 for (
255 PlatformIntType port = 0;
256 port < static_cast<PlatformIntType>(this->getNum_seqRunIn_InputPorts());
257 port++
258 ) {
259 this->m_seqRunIn_InputPort[port].init();
260 this->m_seqRunIn_InputPort[port].addCallComp(
261 this,
262 m_p_seqRunIn_in
263 );
264 this->m_seqRunIn_InputPort[port].setPortNum(port);
265
266#if FW_OBJECT_NAMES == 1
267 // The port name consists of this->m_objName and some extra info.
268 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
269 // However, the compiler may assume that this->m_objName fills
270 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
271 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
272 // bytes to cover the extra info.
273 char portName[2*FW_OBJ_NAME_MAX_SIZE];
274 (void) snprintf(
275 portName,
276 sizeof(portName),
277 "%s_seqRunIn_InputPort[%" PRI_PlatformIntType "]",
278 this->m_objName,
279 port
280 );
281 this->m_seqRunIn_InputPort[port].setObjName(portName);
282#endif
283 }
284
285#if FW_ENABLE_TEXT_LOGGING == 1
286 // Connect output port LogText
287 for (
288 PlatformIntType port = 0;
289 port < static_cast<PlatformIntType>(this->getNum_LogText_OutputPorts());
290 port++
291 ) {
292 this->m_LogText_OutputPort[port].init();
293
294#if FW_OBJECT_NAMES == 1
295 // The port name consists of this->m_objName and some extra info.
296 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
297 // However, the compiler may assume that this->m_objName fills
298 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
299 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
300 // bytes to cover the extra info.
301 char portName[2*FW_OBJ_NAME_MAX_SIZE];
302 (void) snprintf(
303 portName,
304 sizeof(portName),
305 "%s_LogText_OutputPort[%" PRI_PlatformIntType "]",
306 this->m_objName,
307 port
308 );
309 this->m_LogText_OutputPort[port].setObjName(portName);
310#endif
311 }
312#endif
313
314 // Connect output port cmdRegOut
315 for (
316 PlatformIntType port = 0;
317 port < static_cast<PlatformIntType>(this->getNum_cmdRegOut_OutputPorts());
318 port++
319 ) {
320 this->m_cmdRegOut_OutputPort[port].init();
321
322#if FW_OBJECT_NAMES == 1
323 // The port name consists of this->m_objName and some extra info.
324 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
325 // However, the compiler may assume that this->m_objName fills
326 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
327 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
328 // bytes to cover the extra info.
329 char portName[2*FW_OBJ_NAME_MAX_SIZE];
330 (void) snprintf(
331 portName,
332 sizeof(portName),
333 "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]",
334 this->m_objName,
335 port
336 );
337 this->m_cmdRegOut_OutputPort[port].setObjName(portName);
338#endif
339 }
340
341 // Connect output port cmdResponseOut
342 for (
343 PlatformIntType port = 0;
344 port < static_cast<PlatformIntType>(this->getNum_cmdResponseOut_OutputPorts());
345 port++
346 ) {
347 this->m_cmdResponseOut_OutputPort[port].init();
348
349#if FW_OBJECT_NAMES == 1
350 // The port name consists of this->m_objName and some extra info.
351 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
352 // However, the compiler may assume that this->m_objName fills
353 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
354 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
355 // bytes to cover the extra info.
356 char portName[2*FW_OBJ_NAME_MAX_SIZE];
357 (void) snprintf(
358 portName,
359 sizeof(portName),
360 "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]",
361 this->m_objName,
362 port
363 );
364 this->m_cmdResponseOut_OutputPort[port].setObjName(portName);
365#endif
366 }
367
368 // Connect output port logOut
369 for (
370 PlatformIntType port = 0;
371 port < static_cast<PlatformIntType>(this->getNum_logOut_OutputPorts());
372 port++
373 ) {
374 this->m_logOut_OutputPort[port].init();
375
376#if FW_OBJECT_NAMES == 1
377 // The port name consists of this->m_objName and some extra info.
378 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
379 // However, the compiler may assume that this->m_objName fills
380 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
381 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
382 // bytes to cover the extra info.
383 char portName[2*FW_OBJ_NAME_MAX_SIZE];
384 (void) snprintf(
385 portName,
386 sizeof(portName),
387 "%s_logOut_OutputPort[%" PRI_PlatformIntType "]",
388 this->m_objName,
389 port
390 );
391 this->m_logOut_OutputPort[port].setObjName(portName);
392#endif
393 }
394
395 // Connect output port timeCaller
396 for (
397 PlatformIntType port = 0;
398 port < static_cast<PlatformIntType>(this->getNum_timeCaller_OutputPorts());
399 port++
400 ) {
401 this->m_timeCaller_OutputPort[port].init();
402
403#if FW_OBJECT_NAMES == 1
404 // The port name consists of this->m_objName and some extra info.
405 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
406 // However, the compiler may assume that this->m_objName fills
407 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
408 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
409 // bytes to cover the extra info.
410 char portName[2*FW_OBJ_NAME_MAX_SIZE];
411 (void) snprintf(
412 portName,
413 sizeof(portName),
414 "%s_timeCaller_OutputPort[%" PRI_PlatformIntType "]",
415 this->m_objName,
416 port
417 );
418 this->m_timeCaller_OutputPort[port].setObjName(portName);
419#endif
420 }
421
422 // Connect output port tlmOut
423 for (
424 PlatformIntType port = 0;
425 port < static_cast<PlatformIntType>(this->getNum_tlmOut_OutputPorts());
426 port++
427 ) {
428 this->m_tlmOut_OutputPort[port].init();
429
430#if FW_OBJECT_NAMES == 1
431 // The port name consists of this->m_objName and some extra info.
432 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
433 // However, the compiler may assume that this->m_objName fills
434 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
435 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
436 // bytes to cover the extra info.
437 char portName[2*FW_OBJ_NAME_MAX_SIZE];
438 (void) snprintf(
439 portName,
440 sizeof(portName),
441 "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]",
442 this->m_objName,
443 port
444 );
445 this->m_tlmOut_OutputPort[port].setObjName(portName);
446#endif
447 }
448
449 // Connect output port comCmdOut
450 for (
451 PlatformIntType port = 0;
452 port < static_cast<PlatformIntType>(this->getNum_comCmdOut_OutputPorts());
453 port++
454 ) {
455 this->m_comCmdOut_OutputPort[port].init();
456
457#if FW_OBJECT_NAMES == 1
458 // The port name consists of this->m_objName and some extra info.
459 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
460 // However, the compiler may assume that this->m_objName fills
461 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
462 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
463 // bytes to cover the extra info.
464 char portName[2*FW_OBJ_NAME_MAX_SIZE];
465 (void) snprintf(
466 portName,
467 sizeof(portName),
468 "%s_comCmdOut_OutputPort[%" PRI_PlatformIntType "]",
469 this->m_objName,
470 port
471 );
472 this->m_comCmdOut_OutputPort[port].setObjName(portName);
473#endif
474 }
475
476 // Connect output port pingOut
477 for (
478 PlatformIntType port = 0;
479 port < static_cast<PlatformIntType>(this->getNum_pingOut_OutputPorts());
480 port++
481 ) {
482 this->m_pingOut_OutputPort[port].init();
483
484#if FW_OBJECT_NAMES == 1
485 // The port name consists of this->m_objName and some extra info.
486 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
487 // However, the compiler may assume that this->m_objName fills
488 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
489 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
490 // bytes to cover the extra info.
491 char portName[2*FW_OBJ_NAME_MAX_SIZE];
492 (void) snprintf(
493 portName,
494 sizeof(portName),
495 "%s_pingOut_OutputPort[%" PRI_PlatformIntType "]",
496 this->m_objName,
497 port
498 );
499 this->m_pingOut_OutputPort[port].setObjName(portName);
500#endif
501 }
502
503 // Connect output port seqDone
504 for (
505 PlatformIntType port = 0;
506 port < static_cast<PlatformIntType>(this->getNum_seqDone_OutputPorts());
507 port++
508 ) {
509 this->m_seqDone_OutputPort[port].init();
510
511#if FW_OBJECT_NAMES == 1
512 // The port name consists of this->m_objName and some extra info.
513 // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
514 // However, the compiler may assume that this->m_objName fills
515 // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
516 // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
517 // bytes to cover the extra info.
518 char portName[2*FW_OBJ_NAME_MAX_SIZE];
519 (void) snprintf(
520 portName,
521 sizeof(portName),
522 "%s_seqDone_OutputPort[%" PRI_PlatformIntType "]",
523 this->m_objName,
524 port
525 );
526 this->m_seqDone_OutputPort[port].setObjName(portName);
527#endif
528 }
529
530 Os::Queue::QueueStatus qStat = this->createQueue(
531 queueDepth,
532 ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
533 );
534 FW_ASSERT(
535 Os::Queue::QUEUE_OK == qStat,
536 static_cast<FwAssertArgType>(qStat)
537 );
538 }
539
540 // ----------------------------------------------------------------------
541 // Getters for special input ports
542 // ----------------------------------------------------------------------
543
544 Fw::InputCmdPort* CmdSequencerComponentBase ::
545 get_cmdIn_InputPort(NATIVE_INT_TYPE portNum)
546 {
547 FW_ASSERT(
548 portNum < this->getNum_cmdIn_InputPorts(),
549 static_cast<FwAssertArgType>(portNum)
550 );
551
552 return &this->m_cmdIn_InputPort[portNum];
553 }
554
555 // ----------------------------------------------------------------------
556 // Getters for typed input ports
557 // ----------------------------------------------------------------------
558
559 Fw::InputCmdResponsePort* CmdSequencerComponentBase ::
560 get_cmdResponseIn_InputPort(NATIVE_INT_TYPE portNum)
561 {
562 FW_ASSERT(
563 portNum < this->getNum_cmdResponseIn_InputPorts(),
564 static_cast<FwAssertArgType>(portNum)
565 );
566
567 return &this->m_cmdResponseIn_InputPort[portNum];
568 }
569
570 Svc::InputPingPort* CmdSequencerComponentBase ::
571 get_pingIn_InputPort(NATIVE_INT_TYPE portNum)
572 {
573 FW_ASSERT(
574 portNum < this->getNum_pingIn_InputPorts(),
575 static_cast<FwAssertArgType>(portNum)
576 );
577
578 return &this->m_pingIn_InputPort[portNum];
579 }
580
581 Svc::InputSchedPort* CmdSequencerComponentBase ::
582 get_schedIn_InputPort(NATIVE_INT_TYPE portNum)
583 {
584 FW_ASSERT(
585 portNum < this->getNum_schedIn_InputPorts(),
586 static_cast<FwAssertArgType>(portNum)
587 );
588
589 return &this->m_schedIn_InputPort[portNum];
590 }
591
592 Svc::InputCmdSeqCancelPort* CmdSequencerComponentBase ::
593 get_seqCancelIn_InputPort(NATIVE_INT_TYPE portNum)
594 {
595 FW_ASSERT(
596 portNum < this->getNum_seqCancelIn_InputPorts(),
597 static_cast<FwAssertArgType>(portNum)
598 );
599
600 return &this->m_seqCancelIn_InputPort[portNum];
601 }
602
603 Svc::InputCmdSeqInPort* CmdSequencerComponentBase ::
604 get_seqRunIn_InputPort(NATIVE_INT_TYPE portNum)
605 {
606 FW_ASSERT(
607 portNum < this->getNum_seqRunIn_InputPorts(),
608 static_cast<FwAssertArgType>(portNum)
609 );
610
611 return &this->m_seqRunIn_InputPort[portNum];
612 }
613
614 // ----------------------------------------------------------------------
615 // Connect input ports to special output ports
616 // ----------------------------------------------------------------------
617
618#if FW_ENABLE_TEXT_LOGGING == 1
619
620 void CmdSequencerComponentBase ::
621 set_LogText_OutputPort(
622 NATIVE_INT_TYPE portNum,
624 )
625 {
626 FW_ASSERT(
627 portNum < this->getNum_LogText_OutputPorts(),
628 static_cast<FwAssertArgType>(portNum)
629 );
630
631 this->m_LogText_OutputPort[portNum].addCallPort(port);
632 }
633
634#endif
635
636 void CmdSequencerComponentBase ::
637 set_cmdRegOut_OutputPort(
638 NATIVE_INT_TYPE portNum,
640 )
641 {
642 FW_ASSERT(
643 portNum < this->getNum_cmdRegOut_OutputPorts(),
644 static_cast<FwAssertArgType>(portNum)
645 );
646
647 this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
648 }
649
650 void CmdSequencerComponentBase ::
651 set_cmdResponseOut_OutputPort(
652 NATIVE_INT_TYPE portNum,
654 )
655 {
656 FW_ASSERT(
657 portNum < this->getNum_cmdResponseOut_OutputPorts(),
658 static_cast<FwAssertArgType>(portNum)
659 );
660
661 this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
662 }
663
664 void CmdSequencerComponentBase ::
665 set_logOut_OutputPort(
666 NATIVE_INT_TYPE portNum,
667 Fw::InputLogPort* port
668 )
669 {
670 FW_ASSERT(
671 portNum < this->getNum_logOut_OutputPorts(),
672 static_cast<FwAssertArgType>(portNum)
673 );
674
675 this->m_logOut_OutputPort[portNum].addCallPort(port);
676 }
677
678 void CmdSequencerComponentBase ::
679 set_timeCaller_OutputPort(
680 NATIVE_INT_TYPE portNum,
682 )
683 {
684 FW_ASSERT(
685 portNum < this->getNum_timeCaller_OutputPorts(),
686 static_cast<FwAssertArgType>(portNum)
687 );
688
689 this->m_timeCaller_OutputPort[portNum].addCallPort(port);
690 }
691
692 void CmdSequencerComponentBase ::
693 set_tlmOut_OutputPort(
694 NATIVE_INT_TYPE portNum,
695 Fw::InputTlmPort* port
696 )
697 {
698 FW_ASSERT(
699 portNum < this->getNum_tlmOut_OutputPorts(),
700 static_cast<FwAssertArgType>(portNum)
701 );
702
703 this->m_tlmOut_OutputPort[portNum].addCallPort(port);
704 }
705
706 // ----------------------------------------------------------------------
707 // Connect typed input ports to typed output ports
708 // ----------------------------------------------------------------------
709
710 void CmdSequencerComponentBase ::
711 set_comCmdOut_OutputPort(
712 NATIVE_INT_TYPE portNum,
713 Fw::InputComPort* port
714 )
715 {
716 FW_ASSERT(
717 portNum < this->getNum_comCmdOut_OutputPorts(),
718 static_cast<FwAssertArgType>(portNum)
719 );
720
721 this->m_comCmdOut_OutputPort[portNum].addCallPort(port);
722 }
723
724 void CmdSequencerComponentBase ::
725 set_pingOut_OutputPort(
726 NATIVE_INT_TYPE portNum,
728 )
729 {
730 FW_ASSERT(
731 portNum < this->getNum_pingOut_OutputPorts(),
732 static_cast<FwAssertArgType>(portNum)
733 );
734
735 this->m_pingOut_OutputPort[portNum].addCallPort(port);
736 }
737
738 void CmdSequencerComponentBase ::
739 set_seqDone_OutputPort(
740 NATIVE_INT_TYPE portNum,
742 )
743 {
744 FW_ASSERT(
745 portNum < this->getNum_seqDone_OutputPorts(),
746 static_cast<FwAssertArgType>(portNum)
747 );
748
749 this->m_seqDone_OutputPort[portNum].addCallPort(port);
750 }
751
752#if FW_PORT_SERIALIZATION
753
754 // ----------------------------------------------------------------------
755 // Connect serial input ports to special output ports
756 // ----------------------------------------------------------------------
757
758#if FW_ENABLE_TEXT_LOGGING == 1
759
760 void CmdSequencerComponentBase ::
761 set_LogText_OutputPort(
762 NATIVE_INT_TYPE portNum,
763 Fw::InputSerializePort* port
764 )
765 {
766 FW_ASSERT(
767 portNum < this->getNum_LogText_OutputPorts(),
768 static_cast<FwAssertArgType>(portNum)
769 );
770
771 this->m_LogText_OutputPort[portNum].registerSerialPort(port);
772 }
773
774#endif
775
776 void CmdSequencerComponentBase ::
777 set_cmdRegOut_OutputPort(
778 NATIVE_INT_TYPE portNum,
779 Fw::InputSerializePort* port
780 )
781 {
782 FW_ASSERT(
783 portNum < this->getNum_cmdRegOut_OutputPorts(),
784 static_cast<FwAssertArgType>(portNum)
785 );
786
787 this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
788 }
789
790 void CmdSequencerComponentBase ::
791 set_cmdResponseOut_OutputPort(
792 NATIVE_INT_TYPE portNum,
793 Fw::InputSerializePort* port
794 )
795 {
796 FW_ASSERT(
797 portNum < this->getNum_cmdResponseOut_OutputPorts(),
798 static_cast<FwAssertArgType>(portNum)
799 );
800
801 this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
802 }
803
804 void CmdSequencerComponentBase ::
805 set_logOut_OutputPort(
806 NATIVE_INT_TYPE portNum,
807 Fw::InputSerializePort* port
808 )
809 {
810 FW_ASSERT(
811 portNum < this->getNum_logOut_OutputPorts(),
812 static_cast<FwAssertArgType>(portNum)
813 );
814
815 this->m_logOut_OutputPort[portNum].registerSerialPort(port);
816 }
817
818 void CmdSequencerComponentBase ::
819 set_timeCaller_OutputPort(
820 NATIVE_INT_TYPE portNum,
821 Fw::InputSerializePort* port
822 )
823 {
824 FW_ASSERT(
825 portNum < this->getNum_timeCaller_OutputPorts(),
826 static_cast<FwAssertArgType>(portNum)
827 );
828
829 this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
830 }
831
832 void CmdSequencerComponentBase ::
833 set_tlmOut_OutputPort(
834 NATIVE_INT_TYPE portNum,
835 Fw::InputSerializePort* port
836 )
837 {
838 FW_ASSERT(
839 portNum < this->getNum_tlmOut_OutputPorts(),
840 static_cast<FwAssertArgType>(portNum)
841 );
842
843 this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
844 }
845
846#endif
847
848#if FW_PORT_SERIALIZATION
849
850 // ----------------------------------------------------------------------
851 // Connect serial input ports to typed output ports
852 // ----------------------------------------------------------------------
853
854 void CmdSequencerComponentBase ::
855 set_comCmdOut_OutputPort(
856 NATIVE_INT_TYPE portNum,
857 Fw::InputSerializePort* port
858 )
859 {
860 FW_ASSERT(
861 portNum < this->getNum_comCmdOut_OutputPorts(),
862 static_cast<FwAssertArgType>(portNum)
863 );
864
865 this->m_comCmdOut_OutputPort[portNum].registerSerialPort(port);
866 }
867
868 void CmdSequencerComponentBase ::
869 set_pingOut_OutputPort(
870 NATIVE_INT_TYPE portNum,
871 Fw::InputSerializePort* port
872 )
873 {
874 FW_ASSERT(
875 portNum < this->getNum_pingOut_OutputPorts(),
876 static_cast<FwAssertArgType>(portNum)
877 );
878
879 this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
880 }
881
882 void CmdSequencerComponentBase ::
883 set_seqDone_OutputPort(
884 NATIVE_INT_TYPE portNum,
885 Fw::InputSerializePort* port
886 )
887 {
888 FW_ASSERT(
889 portNum < this->getNum_seqDone_OutputPorts(),
890 static_cast<FwAssertArgType>(portNum)
891 );
892
893 this->m_seqDone_OutputPort[portNum].registerSerialPort(port);
894 }
895
896#endif
897
898 // ----------------------------------------------------------------------
899 // Command registration
900 // ----------------------------------------------------------------------
901
902 void CmdSequencerComponentBase ::
903 regCommands()
904 {
905 FW_ASSERT(this->m_cmdRegOut_OutputPort[0].isConnected());
906
907 this->m_cmdRegOut_OutputPort[0].invoke(
908 this->getIdBase() + OPCODE_CS_RUN
909 );
910
911 this->m_cmdRegOut_OutputPort[0].invoke(
912 this->getIdBase() + OPCODE_CS_VALIDATE
913 );
914
915 this->m_cmdRegOut_OutputPort[0].invoke(
916 this->getIdBase() + OPCODE_CS_CANCEL
917 );
918
919 this->m_cmdRegOut_OutputPort[0].invoke(
920 this->getIdBase() + OPCODE_CS_START
921 );
922
923 this->m_cmdRegOut_OutputPort[0].invoke(
924 this->getIdBase() + OPCODE_CS_STEP
925 );
926
927 this->m_cmdRegOut_OutputPort[0].invoke(
928 this->getIdBase() + OPCODE_CS_AUTO
929 );
930
931 this->m_cmdRegOut_OutputPort[0].invoke(
932 this->getIdBase() + OPCODE_CS_MANUAL
933 );
934
935 this->m_cmdRegOut_OutputPort[0].invoke(
936 this->getIdBase() + OPCODE_CS_JOIN_WAIT
937 );
938 }
939
940 // ----------------------------------------------------------------------
941 // Component construction and destruction
942 // ----------------------------------------------------------------------
943
944 CmdSequencerComponentBase ::
945 CmdSequencerComponentBase(const char* compName) :
946 Fw::ActiveComponentBase(compName)
947 {
948
949 }
950
951 CmdSequencerComponentBase ::
952 ~CmdSequencerComponentBase()
953 {
954
955 }
956
957 // ----------------------------------------------------------------------
958 // Getters for numbers of special input ports
959 // ----------------------------------------------------------------------
960
961 NATIVE_INT_TYPE CmdSequencerComponentBase ::
962 getNum_cmdIn_InputPorts() const
963 {
964 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort));
965 }
966
967 // ----------------------------------------------------------------------
968 // Getters for numbers of typed input ports
969 // ----------------------------------------------------------------------
970
971 NATIVE_INT_TYPE CmdSequencerComponentBase ::
972 getNum_cmdResponseIn_InputPorts() const
973 {
974 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseIn_InputPort));
975 }
976
977 NATIVE_INT_TYPE CmdSequencerComponentBase ::
978 getNum_pingIn_InputPorts() const
979 {
980 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_pingIn_InputPort));
981 }
982
983 NATIVE_INT_TYPE CmdSequencerComponentBase ::
984 getNum_schedIn_InputPorts() const
985 {
986 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_schedIn_InputPort));
987 }
988
989 NATIVE_INT_TYPE CmdSequencerComponentBase ::
990 getNum_seqCancelIn_InputPorts() const
991 {
992 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_seqCancelIn_InputPort));
993 }
994
995 NATIVE_INT_TYPE CmdSequencerComponentBase ::
996 getNum_seqRunIn_InputPorts() const
997 {
998 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_seqRunIn_InputPort));
999 }
1000
1001 // ----------------------------------------------------------------------
1002 // Getters for numbers of special output ports
1003 // ----------------------------------------------------------------------
1004
1005#if FW_ENABLE_TEXT_LOGGING == 1
1006
1007 NATIVE_INT_TYPE CmdSequencerComponentBase ::
1008 getNum_LogText_OutputPorts() const
1009 {
1010 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
1011 }
1012
1013#endif
1014
1015 NATIVE_INT_TYPE CmdSequencerComponentBase ::
1016 getNum_cmdRegOut_OutputPorts() const
1017 {
1018 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort));
1019 }
1020
1021 NATIVE_INT_TYPE CmdSequencerComponentBase ::
1022 getNum_cmdResponseOut_OutputPorts() const
1023 {
1024 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort));
1025 }
1026
1027 NATIVE_INT_TYPE CmdSequencerComponentBase ::
1028 getNum_logOut_OutputPorts() const
1029 {
1030 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_logOut_OutputPort));
1031 }
1032
1033 NATIVE_INT_TYPE CmdSequencerComponentBase ::
1034 getNum_timeCaller_OutputPorts() const
1035 {
1036 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
1037 }
1038
1039 NATIVE_INT_TYPE CmdSequencerComponentBase ::
1040 getNum_tlmOut_OutputPorts() const
1041 {
1042 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
1043 }
1044
1045 // ----------------------------------------------------------------------
1046 // Getters for numbers of typed output ports
1047 // ----------------------------------------------------------------------
1048
1049 NATIVE_INT_TYPE CmdSequencerComponentBase ::
1050 getNum_comCmdOut_OutputPorts() const
1051 {
1052 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_comCmdOut_OutputPort));
1053 }
1054
1055 NATIVE_INT_TYPE CmdSequencerComponentBase ::
1056 getNum_pingOut_OutputPorts() const
1057 {
1058 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_pingOut_OutputPort));
1059 }
1060
1061 NATIVE_INT_TYPE CmdSequencerComponentBase ::
1062 getNum_seqDone_OutputPorts() const
1063 {
1064 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_seqDone_OutputPort));
1065 }
1066
1067 // ----------------------------------------------------------------------
1068 // Connection status queries for special output ports
1069 // ----------------------------------------------------------------------
1070
1071#if FW_ENABLE_TEXT_LOGGING == 1
1072
1073 bool CmdSequencerComponentBase ::
1074 isConnected_LogText_OutputPort(NATIVE_INT_TYPE portNum)
1075 {
1076 FW_ASSERT(
1077 portNum < this->getNum_LogText_OutputPorts(),
1078 static_cast<FwAssertArgType>(portNum)
1079 );
1080
1081 return this->m_LogText_OutputPort[portNum].isConnected();
1082 }
1083
1084#endif
1085
1086 bool CmdSequencerComponentBase ::
1087 isConnected_cmdRegOut_OutputPort(NATIVE_INT_TYPE portNum)
1088 {
1089 FW_ASSERT(
1090 portNum < this->getNum_cmdRegOut_OutputPorts(),
1091 static_cast<FwAssertArgType>(portNum)
1092 );
1093
1094 return this->m_cmdRegOut_OutputPort[portNum].isConnected();
1095 }
1096
1097 bool CmdSequencerComponentBase ::
1098 isConnected_cmdResponseOut_OutputPort(NATIVE_INT_TYPE portNum)
1099 {
1100 FW_ASSERT(
1101 portNum < this->getNum_cmdResponseOut_OutputPorts(),
1102 static_cast<FwAssertArgType>(portNum)
1103 );
1104
1105 return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
1106 }
1107
1108 bool CmdSequencerComponentBase ::
1109 isConnected_logOut_OutputPort(NATIVE_INT_TYPE portNum)
1110 {
1111 FW_ASSERT(
1112 portNum < this->getNum_logOut_OutputPorts(),
1113 static_cast<FwAssertArgType>(portNum)
1114 );
1115
1116 return this->m_logOut_OutputPort[portNum].isConnected();
1117 }
1118
1119 bool CmdSequencerComponentBase ::
1120 isConnected_timeCaller_OutputPort(NATIVE_INT_TYPE portNum)
1121 {
1122 FW_ASSERT(
1123 portNum < this->getNum_timeCaller_OutputPorts(),
1124 static_cast<FwAssertArgType>(portNum)
1125 );
1126
1127 return this->m_timeCaller_OutputPort[portNum].isConnected();
1128 }
1129
1130 bool CmdSequencerComponentBase ::
1131 isConnected_tlmOut_OutputPort(NATIVE_INT_TYPE portNum)
1132 {
1133 FW_ASSERT(
1134 portNum < this->getNum_tlmOut_OutputPorts(),
1135 static_cast<FwAssertArgType>(portNum)
1136 );
1137
1138 return this->m_tlmOut_OutputPort[portNum].isConnected();
1139 }
1140
1141 // ----------------------------------------------------------------------
1142 // Connection status queries for typed output ports
1143 // ----------------------------------------------------------------------
1144
1145 bool CmdSequencerComponentBase ::
1146 isConnected_comCmdOut_OutputPort(NATIVE_INT_TYPE portNum)
1147 {
1148 FW_ASSERT(
1149 portNum < this->getNum_comCmdOut_OutputPorts(),
1150 static_cast<FwAssertArgType>(portNum)
1151 );
1152
1153 return this->m_comCmdOut_OutputPort[portNum].isConnected();
1154 }
1155
1156 bool CmdSequencerComponentBase ::
1157 isConnected_pingOut_OutputPort(NATIVE_INT_TYPE portNum)
1158 {
1159 FW_ASSERT(
1160 portNum < this->getNum_pingOut_OutputPorts(),
1161 static_cast<FwAssertArgType>(portNum)
1162 );
1163
1164 return this->m_pingOut_OutputPort[portNum].isConnected();
1165 }
1166
1167 bool CmdSequencerComponentBase ::
1168 isConnected_seqDone_OutputPort(NATIVE_INT_TYPE portNum)
1169 {
1170 FW_ASSERT(
1171 portNum < this->getNum_seqDone_OutputPorts(),
1172 static_cast<FwAssertArgType>(portNum)
1173 );
1174
1175 return this->m_seqDone_OutputPort[portNum].isConnected();
1176 }
1177
1178 // ----------------------------------------------------------------------
1179 // Port handler base-class functions for typed input ports
1180 //
1181 // Call these functions directly to bypass the corresponding ports
1182 // ----------------------------------------------------------------------
1183
1184 void CmdSequencerComponentBase ::
1185 cmdResponseIn_handlerBase(
1186 NATIVE_INT_TYPE portNum,
1187 FwOpcodeType opCode,
1188 U32 cmdSeq,
1189 const Fw::CmdResponse& response
1190 )
1191 {
1192 // Make sure port number is valid
1193 FW_ASSERT(
1194 portNum < this->getNum_cmdResponseIn_InputPorts(),
1195 static_cast<FwAssertArgType>(portNum)
1196 );
1197
1198 // Call pre-message hook
1199 cmdResponseIn_preMsgHook(
1200 portNum,
1201 opCode,
1202 cmdSeq,
1203 response
1204 );
1205 ComponentIpcSerializableBuffer msg;
1207
1208 // Serialize message ID
1209 _status = msg.serialize(
1210 static_cast<NATIVE_INT_TYPE>(CMDRESPONSEIN_CMDRESPONSE)
1211 );
1212 FW_ASSERT(
1213 _status == Fw::FW_SERIALIZE_OK,
1214 static_cast<FwAssertArgType>(_status)
1215 );
1216
1217 // Serialize port number
1218 _status = msg.serialize(portNum);
1219 FW_ASSERT(
1220 _status == Fw::FW_SERIALIZE_OK,
1221 static_cast<FwAssertArgType>(_status)
1222 );
1223
1224 // Serialize argument opCode
1225 _status = msg.serialize(opCode);
1226 FW_ASSERT(
1227 _status == Fw::FW_SERIALIZE_OK,
1228 static_cast<FwAssertArgType>(_status)
1229 );
1230
1231 // Serialize argument cmdSeq
1232 _status = msg.serialize(cmdSeq);
1233 FW_ASSERT(
1234 _status == Fw::FW_SERIALIZE_OK,
1235 static_cast<FwAssertArgType>(_status)
1236 );
1237
1238 // Serialize argument response
1239 _status = msg.serialize(response);
1240 FW_ASSERT(
1241 _status == Fw::FW_SERIALIZE_OK,
1242 static_cast<FwAssertArgType>(_status)
1243 );
1244
1245 // Send message
1247 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1248
1249 FW_ASSERT(
1250 qStatus == Os::Queue::QUEUE_OK,
1251 static_cast<FwAssertArgType>(qStatus)
1252 );
1253 }
1254
1255 void CmdSequencerComponentBase ::
1256 pingIn_handlerBase(
1257 NATIVE_INT_TYPE portNum,
1258 U32 key
1259 )
1260 {
1261 // Make sure port number is valid
1262 FW_ASSERT(
1263 portNum < this->getNum_pingIn_InputPorts(),
1264 static_cast<FwAssertArgType>(portNum)
1265 );
1266
1267 // Call pre-message hook
1268 pingIn_preMsgHook(
1269 portNum,
1270 key
1271 );
1272 ComponentIpcSerializableBuffer msg;
1274
1275 // Serialize message ID
1276 _status = msg.serialize(
1277 static_cast<NATIVE_INT_TYPE>(PINGIN_PING)
1278 );
1279 FW_ASSERT(
1280 _status == Fw::FW_SERIALIZE_OK,
1281 static_cast<FwAssertArgType>(_status)
1282 );
1283
1284 // Serialize port number
1285 _status = msg.serialize(portNum);
1286 FW_ASSERT(
1287 _status == Fw::FW_SERIALIZE_OK,
1288 static_cast<FwAssertArgType>(_status)
1289 );
1290
1291 // Serialize argument key
1292 _status = msg.serialize(key);
1293 FW_ASSERT(
1294 _status == Fw::FW_SERIALIZE_OK,
1295 static_cast<FwAssertArgType>(_status)
1296 );
1297
1298 // Send message
1300 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1301
1302 FW_ASSERT(
1303 qStatus == Os::Queue::QUEUE_OK,
1304 static_cast<FwAssertArgType>(qStatus)
1305 );
1306 }
1307
1308 void CmdSequencerComponentBase ::
1309 schedIn_handlerBase(
1310 NATIVE_INT_TYPE portNum,
1311 NATIVE_UINT_TYPE context
1312 )
1313 {
1314 // Make sure port number is valid
1315 FW_ASSERT(
1316 portNum < this->getNum_schedIn_InputPorts(),
1317 static_cast<FwAssertArgType>(portNum)
1318 );
1319
1320 // Call pre-message hook
1321 schedIn_preMsgHook(
1322 portNum,
1323 context
1324 );
1325 ComponentIpcSerializableBuffer msg;
1327
1328 // Serialize message ID
1329 _status = msg.serialize(
1330 static_cast<NATIVE_INT_TYPE>(SCHEDIN_SCHED)
1331 );
1332 FW_ASSERT(
1333 _status == Fw::FW_SERIALIZE_OK,
1334 static_cast<FwAssertArgType>(_status)
1335 );
1336
1337 // Serialize port number
1338 _status = msg.serialize(portNum);
1339 FW_ASSERT(
1340 _status == Fw::FW_SERIALIZE_OK,
1341 static_cast<FwAssertArgType>(_status)
1342 );
1343
1344 // Serialize argument context
1345 _status = msg.serialize(context);
1346 FW_ASSERT(
1347 _status == Fw::FW_SERIALIZE_OK,
1348 static_cast<FwAssertArgType>(_status)
1349 );
1350
1351 // Send message
1353 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1354
1355 FW_ASSERT(
1356 qStatus == Os::Queue::QUEUE_OK,
1357 static_cast<FwAssertArgType>(qStatus)
1358 );
1359 }
1360
1361 void CmdSequencerComponentBase ::
1362 seqCancelIn_handlerBase(NATIVE_INT_TYPE portNum)
1363 {
1364 // Make sure port number is valid
1365 FW_ASSERT(
1366 portNum < this->getNum_seqCancelIn_InputPorts(),
1367 static_cast<FwAssertArgType>(portNum)
1368 );
1369
1370 // Call pre-message hook
1371 seqCancelIn_preMsgHook(portNum);
1372 ComponentIpcSerializableBuffer msg;
1374
1375 // Serialize message ID
1376 _status = msg.serialize(
1377 static_cast<NATIVE_INT_TYPE>(SEQCANCELIN_CMDSEQCANCEL)
1378 );
1379 FW_ASSERT(
1380 _status == Fw::FW_SERIALIZE_OK,
1381 static_cast<FwAssertArgType>(_status)
1382 );
1383
1384 // Serialize port number
1385 _status = msg.serialize(portNum);
1386 FW_ASSERT(
1387 _status == Fw::FW_SERIALIZE_OK,
1388 static_cast<FwAssertArgType>(_status)
1389 );
1390
1391 // Send message
1393 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1394
1395 FW_ASSERT(
1396 qStatus == Os::Queue::QUEUE_OK,
1397 static_cast<FwAssertArgType>(qStatus)
1398 );
1399 }
1400
1401 void CmdSequencerComponentBase ::
1402 seqRunIn_handlerBase(
1403 NATIVE_INT_TYPE portNum,
1404 Fw::String& filename
1405 )
1406 {
1407 // Make sure port number is valid
1408 FW_ASSERT(
1409 portNum < this->getNum_seqRunIn_InputPorts(),
1410 static_cast<FwAssertArgType>(portNum)
1411 );
1412
1413 // Call pre-message hook
1414 seqRunIn_preMsgHook(
1415 portNum,
1416 filename
1417 );
1418 ComponentIpcSerializableBuffer msg;
1420
1421 // Serialize message ID
1422 _status = msg.serialize(
1423 static_cast<NATIVE_INT_TYPE>(SEQRUNIN_CMDSEQIN)
1424 );
1425 FW_ASSERT(
1426 _status == Fw::FW_SERIALIZE_OK,
1427 static_cast<FwAssertArgType>(_status)
1428 );
1429
1430 // Serialize port number
1431 _status = msg.serialize(portNum);
1432 FW_ASSERT(
1433 _status == Fw::FW_SERIALIZE_OK,
1434 static_cast<FwAssertArgType>(_status)
1435 );
1436
1437 // Serialize argument filename
1438 _status = msg.serialize(filename);
1439 FW_ASSERT(
1440 _status == Fw::FW_SERIALIZE_OK,
1441 static_cast<FwAssertArgType>(_status)
1442 );
1443
1444 // Send message
1446 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1447
1448 FW_ASSERT(
1449 qStatus == Os::Queue::QUEUE_OK,
1450 static_cast<FwAssertArgType>(qStatus)
1451 );
1452 }
1453
1454 // ----------------------------------------------------------------------
1455 // Pre-message hooks for typed async input ports
1456 //
1457 // Each of these functions is invoked just before processing a message
1458 // on the corresponding port. By default, they do nothing. You can
1459 // override them to provide specific pre-message behavior.
1460 // ----------------------------------------------------------------------
1461
1462 void CmdSequencerComponentBase ::
1463 cmdResponseIn_preMsgHook(
1464 NATIVE_INT_TYPE portNum,
1465 FwOpcodeType opCode,
1466 U32 cmdSeq,
1467 const Fw::CmdResponse& response
1468 )
1469 {
1470 // Default: no-op
1471 }
1472
1473 void CmdSequencerComponentBase ::
1474 pingIn_preMsgHook(
1475 NATIVE_INT_TYPE portNum,
1476 U32 key
1477 )
1478 {
1479 // Default: no-op
1480 }
1481
1482 void CmdSequencerComponentBase ::
1483 schedIn_preMsgHook(
1484 NATIVE_INT_TYPE portNum,
1485 NATIVE_UINT_TYPE context
1486 )
1487 {
1488 // Default: no-op
1489 }
1490
1491 void CmdSequencerComponentBase ::
1492 seqCancelIn_preMsgHook(NATIVE_INT_TYPE portNum)
1493 {
1494 // Default: no-op
1495 }
1496
1497 void CmdSequencerComponentBase ::
1498 seqRunIn_preMsgHook(
1499 NATIVE_INT_TYPE portNum,
1500 Fw::String& filename
1501 )
1502 {
1503 // Default: no-op
1504 }
1505
1506 // ----------------------------------------------------------------------
1507 // Invocation functions for typed output ports
1508 // ----------------------------------------------------------------------
1509
1510 void CmdSequencerComponentBase ::
1511 comCmdOut_out(
1512 NATIVE_INT_TYPE portNum,
1513 Fw::ComBuffer& data,
1514 U32 context
1515 )
1516 {
1517 FW_ASSERT(
1518 portNum < this->getNum_comCmdOut_OutputPorts(),
1519 static_cast<FwAssertArgType>(portNum)
1520 );
1521 this->m_comCmdOut_OutputPort[portNum].invoke(
1522 data,
1523 context
1524 );
1525 }
1526
1527 void CmdSequencerComponentBase ::
1528 pingOut_out(
1529 NATIVE_INT_TYPE portNum,
1530 U32 key
1531 )
1532 {
1533 FW_ASSERT(
1534 portNum < this->getNum_pingOut_OutputPorts(),
1535 static_cast<FwAssertArgType>(portNum)
1536 );
1537 this->m_pingOut_OutputPort[portNum].invoke(
1538 key
1539 );
1540 }
1541
1542 void CmdSequencerComponentBase ::
1543 seqDone_out(
1544 NATIVE_INT_TYPE portNum,
1545 FwOpcodeType opCode,
1546 U32 cmdSeq,
1547 const Fw::CmdResponse& response
1548 )
1549 {
1550 FW_ASSERT(
1551 portNum < this->getNum_seqDone_OutputPorts(),
1552 static_cast<FwAssertArgType>(portNum)
1553 );
1554 this->m_seqDone_OutputPort[portNum].invoke(
1555 opCode,
1556 cmdSeq,
1557 response
1558 );
1559 }
1560
1561 // ----------------------------------------------------------------------
1562 // Command response
1563 // ----------------------------------------------------------------------
1564
1565 void CmdSequencerComponentBase ::
1566 cmdResponse_out(
1567 FwOpcodeType opCode,
1568 U32 cmdSeq,
1569 Fw::CmdResponse response
1570 )
1571 {
1572 FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
1573 this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
1574 }
1575
1576 // ----------------------------------------------------------------------
1577 // Command handler base-class functions
1578 //
1579 // Call these functions directly to bypass the command input port
1580 // ----------------------------------------------------------------------
1581
1582 void CmdSequencerComponentBase ::
1583 CS_RUN_cmdHandlerBase(
1584 FwOpcodeType opCode,
1585 U32 cmdSeq,
1586 Fw::CmdArgBuffer& args
1587 )
1588 {
1589 // Call pre-message hook
1590 this->CS_RUN_preMsgHook(opCode,cmdSeq);
1591
1592 // Defer deserializing arguments to the message dispatcher
1593 // to avoid deserializing and reserializing just for IPC
1594 ComponentIpcSerializableBuffer msg;
1596
1597 // Serialize for IPC
1598 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_CS_RUN));
1599 FW_ASSERT (
1600 _status == Fw::FW_SERIALIZE_OK,
1601 static_cast<FwAssertArgType>(_status)
1602 );
1603
1604 // Fake port number to make message dequeue work
1605 NATIVE_INT_TYPE port = 0;
1606
1607 _status = msg.serialize(port);
1608 FW_ASSERT (
1609 _status == Fw::FW_SERIALIZE_OK,
1610 static_cast<FwAssertArgType>(_status)
1611 );
1612
1613 _status = msg.serialize(opCode);
1614 FW_ASSERT (
1615 _status == Fw::FW_SERIALIZE_OK,
1616 static_cast<FwAssertArgType>(_status)
1617 );
1618
1619 _status = msg.serialize(cmdSeq);
1620 FW_ASSERT (
1621 _status == Fw::FW_SERIALIZE_OK,
1622 static_cast<FwAssertArgType>(_status)
1623 );
1624
1625 _status = msg.serialize(args);
1626 FW_ASSERT (
1627 _status == Fw::FW_SERIALIZE_OK,
1628 static_cast<FwAssertArgType>(_status)
1629 );
1630
1631 // Send message
1633 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1634
1635 FW_ASSERT(
1636 qStatus == Os::Queue::QUEUE_OK,
1637 static_cast<FwAssertArgType>(qStatus)
1638 );
1639 }
1640
1641 void CmdSequencerComponentBase ::
1642 CS_VALIDATE_cmdHandlerBase(
1643 FwOpcodeType opCode,
1644 U32 cmdSeq,
1645 Fw::CmdArgBuffer& args
1646 )
1647 {
1648 // Call pre-message hook
1649 this->CS_VALIDATE_preMsgHook(opCode,cmdSeq);
1650
1651 // Defer deserializing arguments to the message dispatcher
1652 // to avoid deserializing and reserializing just for IPC
1653 ComponentIpcSerializableBuffer msg;
1655
1656 // Serialize for IPC
1657 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_CS_VALIDATE));
1658 FW_ASSERT (
1659 _status == Fw::FW_SERIALIZE_OK,
1660 static_cast<FwAssertArgType>(_status)
1661 );
1662
1663 // Fake port number to make message dequeue work
1664 NATIVE_INT_TYPE port = 0;
1665
1666 _status = msg.serialize(port);
1667 FW_ASSERT (
1668 _status == Fw::FW_SERIALIZE_OK,
1669 static_cast<FwAssertArgType>(_status)
1670 );
1671
1672 _status = msg.serialize(opCode);
1673 FW_ASSERT (
1674 _status == Fw::FW_SERIALIZE_OK,
1675 static_cast<FwAssertArgType>(_status)
1676 );
1677
1678 _status = msg.serialize(cmdSeq);
1679 FW_ASSERT (
1680 _status == Fw::FW_SERIALIZE_OK,
1681 static_cast<FwAssertArgType>(_status)
1682 );
1683
1684 _status = msg.serialize(args);
1685 FW_ASSERT (
1686 _status == Fw::FW_SERIALIZE_OK,
1687 static_cast<FwAssertArgType>(_status)
1688 );
1689
1690 // Send message
1692 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1693
1694 FW_ASSERT(
1695 qStatus == Os::Queue::QUEUE_OK,
1696 static_cast<FwAssertArgType>(qStatus)
1697 );
1698 }
1699
1700 void CmdSequencerComponentBase ::
1701 CS_CANCEL_cmdHandlerBase(
1702 FwOpcodeType opCode,
1703 U32 cmdSeq,
1704 Fw::CmdArgBuffer& args
1705 )
1706 {
1707 // Call pre-message hook
1708 this->CS_CANCEL_preMsgHook(opCode,cmdSeq);
1709
1710 // Defer deserializing arguments to the message dispatcher
1711 // to avoid deserializing and reserializing just for IPC
1712 ComponentIpcSerializableBuffer msg;
1714
1715 // Serialize for IPC
1716 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_CS_CANCEL));
1717 FW_ASSERT (
1718 _status == Fw::FW_SERIALIZE_OK,
1719 static_cast<FwAssertArgType>(_status)
1720 );
1721
1722 // Fake port number to make message dequeue work
1723 NATIVE_INT_TYPE port = 0;
1724
1725 _status = msg.serialize(port);
1726 FW_ASSERT (
1727 _status == Fw::FW_SERIALIZE_OK,
1728 static_cast<FwAssertArgType>(_status)
1729 );
1730
1731 _status = msg.serialize(opCode);
1732 FW_ASSERT (
1733 _status == Fw::FW_SERIALIZE_OK,
1734 static_cast<FwAssertArgType>(_status)
1735 );
1736
1737 _status = msg.serialize(cmdSeq);
1738 FW_ASSERT (
1739 _status == Fw::FW_SERIALIZE_OK,
1740 static_cast<FwAssertArgType>(_status)
1741 );
1742
1743 _status = msg.serialize(args);
1744 FW_ASSERT (
1745 _status == Fw::FW_SERIALIZE_OK,
1746 static_cast<FwAssertArgType>(_status)
1747 );
1748
1749 // Send message
1751 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1752
1753 FW_ASSERT(
1754 qStatus == Os::Queue::QUEUE_OK,
1755 static_cast<FwAssertArgType>(qStatus)
1756 );
1757 }
1758
1759 void CmdSequencerComponentBase ::
1760 CS_START_cmdHandlerBase(
1761 FwOpcodeType opCode,
1762 U32 cmdSeq,
1763 Fw::CmdArgBuffer& args
1764 )
1765 {
1766 // Call pre-message hook
1767 this->CS_START_preMsgHook(opCode,cmdSeq);
1768
1769 // Defer deserializing arguments to the message dispatcher
1770 // to avoid deserializing and reserializing just for IPC
1771 ComponentIpcSerializableBuffer msg;
1773
1774 // Serialize for IPC
1775 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_CS_START));
1776 FW_ASSERT (
1777 _status == Fw::FW_SERIALIZE_OK,
1778 static_cast<FwAssertArgType>(_status)
1779 );
1780
1781 // Fake port number to make message dequeue work
1782 NATIVE_INT_TYPE port = 0;
1783
1784 _status = msg.serialize(port);
1785 FW_ASSERT (
1786 _status == Fw::FW_SERIALIZE_OK,
1787 static_cast<FwAssertArgType>(_status)
1788 );
1789
1790 _status = msg.serialize(opCode);
1791 FW_ASSERT (
1792 _status == Fw::FW_SERIALIZE_OK,
1793 static_cast<FwAssertArgType>(_status)
1794 );
1795
1796 _status = msg.serialize(cmdSeq);
1797 FW_ASSERT (
1798 _status == Fw::FW_SERIALIZE_OK,
1799 static_cast<FwAssertArgType>(_status)
1800 );
1801
1802 _status = msg.serialize(args);
1803 FW_ASSERT (
1804 _status == Fw::FW_SERIALIZE_OK,
1805 static_cast<FwAssertArgType>(_status)
1806 );
1807
1808 // Send message
1810 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1811
1812 FW_ASSERT(
1813 qStatus == Os::Queue::QUEUE_OK,
1814 static_cast<FwAssertArgType>(qStatus)
1815 );
1816 }
1817
1818 void CmdSequencerComponentBase ::
1819 CS_STEP_cmdHandlerBase(
1820 FwOpcodeType opCode,
1821 U32 cmdSeq,
1822 Fw::CmdArgBuffer& args
1823 )
1824 {
1825 // Call pre-message hook
1826 this->CS_STEP_preMsgHook(opCode,cmdSeq);
1827
1828 // Defer deserializing arguments to the message dispatcher
1829 // to avoid deserializing and reserializing just for IPC
1830 ComponentIpcSerializableBuffer msg;
1832
1833 // Serialize for IPC
1834 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_CS_STEP));
1835 FW_ASSERT (
1836 _status == Fw::FW_SERIALIZE_OK,
1837 static_cast<FwAssertArgType>(_status)
1838 );
1839
1840 // Fake port number to make message dequeue work
1841 NATIVE_INT_TYPE port = 0;
1842
1843 _status = msg.serialize(port);
1844 FW_ASSERT (
1845 _status == Fw::FW_SERIALIZE_OK,
1846 static_cast<FwAssertArgType>(_status)
1847 );
1848
1849 _status = msg.serialize(opCode);
1850 FW_ASSERT (
1851 _status == Fw::FW_SERIALIZE_OK,
1852 static_cast<FwAssertArgType>(_status)
1853 );
1854
1855 _status = msg.serialize(cmdSeq);
1856 FW_ASSERT (
1857 _status == Fw::FW_SERIALIZE_OK,
1858 static_cast<FwAssertArgType>(_status)
1859 );
1860
1861 _status = msg.serialize(args);
1862 FW_ASSERT (
1863 _status == Fw::FW_SERIALIZE_OK,
1864 static_cast<FwAssertArgType>(_status)
1865 );
1866
1867 // Send message
1869 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1870
1871 FW_ASSERT(
1872 qStatus == Os::Queue::QUEUE_OK,
1873 static_cast<FwAssertArgType>(qStatus)
1874 );
1875 }
1876
1877 void CmdSequencerComponentBase ::
1878 CS_AUTO_cmdHandlerBase(
1879 FwOpcodeType opCode,
1880 U32 cmdSeq,
1881 Fw::CmdArgBuffer& args
1882 )
1883 {
1884 // Call pre-message hook
1885 this->CS_AUTO_preMsgHook(opCode,cmdSeq);
1886
1887 // Defer deserializing arguments to the message dispatcher
1888 // to avoid deserializing and reserializing just for IPC
1889 ComponentIpcSerializableBuffer msg;
1891
1892 // Serialize for IPC
1893 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_CS_AUTO));
1894 FW_ASSERT (
1895 _status == Fw::FW_SERIALIZE_OK,
1896 static_cast<FwAssertArgType>(_status)
1897 );
1898
1899 // Fake port number to make message dequeue work
1900 NATIVE_INT_TYPE port = 0;
1901
1902 _status = msg.serialize(port);
1903 FW_ASSERT (
1904 _status == Fw::FW_SERIALIZE_OK,
1905 static_cast<FwAssertArgType>(_status)
1906 );
1907
1908 _status = msg.serialize(opCode);
1909 FW_ASSERT (
1910 _status == Fw::FW_SERIALIZE_OK,
1911 static_cast<FwAssertArgType>(_status)
1912 );
1913
1914 _status = msg.serialize(cmdSeq);
1915 FW_ASSERT (
1916 _status == Fw::FW_SERIALIZE_OK,
1917 static_cast<FwAssertArgType>(_status)
1918 );
1919
1920 _status = msg.serialize(args);
1921 FW_ASSERT (
1922 _status == Fw::FW_SERIALIZE_OK,
1923 static_cast<FwAssertArgType>(_status)
1924 );
1925
1926 // Send message
1928 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1929
1930 FW_ASSERT(
1931 qStatus == Os::Queue::QUEUE_OK,
1932 static_cast<FwAssertArgType>(qStatus)
1933 );
1934 }
1935
1936 void CmdSequencerComponentBase ::
1937 CS_MANUAL_cmdHandlerBase(
1938 FwOpcodeType opCode,
1939 U32 cmdSeq,
1940 Fw::CmdArgBuffer& args
1941 )
1942 {
1943 // Call pre-message hook
1944 this->CS_MANUAL_preMsgHook(opCode,cmdSeq);
1945
1946 // Defer deserializing arguments to the message dispatcher
1947 // to avoid deserializing and reserializing just for IPC
1948 ComponentIpcSerializableBuffer msg;
1950
1951 // Serialize for IPC
1952 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_CS_MANUAL));
1953 FW_ASSERT (
1954 _status == Fw::FW_SERIALIZE_OK,
1955 static_cast<FwAssertArgType>(_status)
1956 );
1957
1958 // Fake port number to make message dequeue work
1959 NATIVE_INT_TYPE port = 0;
1960
1961 _status = msg.serialize(port);
1962 FW_ASSERT (
1963 _status == Fw::FW_SERIALIZE_OK,
1964 static_cast<FwAssertArgType>(_status)
1965 );
1966
1967 _status = msg.serialize(opCode);
1968 FW_ASSERT (
1969 _status == Fw::FW_SERIALIZE_OK,
1970 static_cast<FwAssertArgType>(_status)
1971 );
1972
1973 _status = msg.serialize(cmdSeq);
1974 FW_ASSERT (
1975 _status == Fw::FW_SERIALIZE_OK,
1976 static_cast<FwAssertArgType>(_status)
1977 );
1978
1979 _status = msg.serialize(args);
1980 FW_ASSERT (
1981 _status == Fw::FW_SERIALIZE_OK,
1982 static_cast<FwAssertArgType>(_status)
1983 );
1984
1985 // Send message
1987 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1988
1989 FW_ASSERT(
1990 qStatus == Os::Queue::QUEUE_OK,
1991 static_cast<FwAssertArgType>(qStatus)
1992 );
1993 }
1994
1995 void CmdSequencerComponentBase ::
1996 CS_JOIN_WAIT_cmdHandlerBase(
1997 FwOpcodeType opCode,
1998 U32 cmdSeq,
1999 Fw::CmdArgBuffer& args
2000 )
2001 {
2002 // Call pre-message hook
2003 this->CS_JOIN_WAIT_preMsgHook(opCode,cmdSeq);
2004
2005 // Defer deserializing arguments to the message dispatcher
2006 // to avoid deserializing and reserializing just for IPC
2007 ComponentIpcSerializableBuffer msg;
2009
2010 // Serialize for IPC
2011 _status = msg.serialize(static_cast<NATIVE_INT_TYPE>(CMD_CS_JOIN_WAIT));
2012 FW_ASSERT (
2013 _status == Fw::FW_SERIALIZE_OK,
2014 static_cast<FwAssertArgType>(_status)
2015 );
2016
2017 // Fake port number to make message dequeue work
2018 NATIVE_INT_TYPE port = 0;
2019
2020 _status = msg.serialize(port);
2021 FW_ASSERT (
2022 _status == Fw::FW_SERIALIZE_OK,
2023 static_cast<FwAssertArgType>(_status)
2024 );
2025
2026 _status = msg.serialize(opCode);
2027 FW_ASSERT (
2028 _status == Fw::FW_SERIALIZE_OK,
2029 static_cast<FwAssertArgType>(_status)
2030 );
2031
2032 _status = msg.serialize(cmdSeq);
2033 FW_ASSERT (
2034 _status == Fw::FW_SERIALIZE_OK,
2035 static_cast<FwAssertArgType>(_status)
2036 );
2037
2038 _status = msg.serialize(args);
2039 FW_ASSERT (
2040 _status == Fw::FW_SERIALIZE_OK,
2041 static_cast<FwAssertArgType>(_status)
2042 );
2043
2044 // Send message
2046 Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
2047
2048 FW_ASSERT(
2049 qStatus == Os::Queue::QUEUE_OK,
2050 static_cast<FwAssertArgType>(qStatus)
2051 );
2052 }
2053
2054 // ----------------------------------------------------------------------
2055 // Pre-message hooks for async commands
2056 //
2057 // Each of these functions is invoked just before processing the
2058 // corresponding command. By default they do nothing. You can
2059 // override them to provide specific pre-command behavior.
2060 // ----------------------------------------------------------------------
2061
2062 void CmdSequencerComponentBase ::
2063 CS_RUN_preMsgHook(
2064 FwOpcodeType opCode,
2065 U32 cmdSeq
2066 )
2067 {
2068 // Defaults to no-op; can be overridden
2069 (void) opCode;
2070 (void) cmdSeq;
2071 }
2072
2073 void CmdSequencerComponentBase ::
2074 CS_VALIDATE_preMsgHook(
2075 FwOpcodeType opCode,
2076 U32 cmdSeq
2077 )
2078 {
2079 // Defaults to no-op; can be overridden
2080 (void) opCode;
2081 (void) cmdSeq;
2082 }
2083
2084 void CmdSequencerComponentBase ::
2085 CS_CANCEL_preMsgHook(
2086 FwOpcodeType opCode,
2087 U32 cmdSeq
2088 )
2089 {
2090 // Defaults to no-op; can be overridden
2091 (void) opCode;
2092 (void) cmdSeq;
2093 }
2094
2095 void CmdSequencerComponentBase ::
2096 CS_START_preMsgHook(
2097 FwOpcodeType opCode,
2098 U32 cmdSeq
2099 )
2100 {
2101 // Defaults to no-op; can be overridden
2102 (void) opCode;
2103 (void) cmdSeq;
2104 }
2105
2106 void CmdSequencerComponentBase ::
2107 CS_STEP_preMsgHook(
2108 FwOpcodeType opCode,
2109 U32 cmdSeq
2110 )
2111 {
2112 // Defaults to no-op; can be overridden
2113 (void) opCode;
2114 (void) cmdSeq;
2115 }
2116
2117 void CmdSequencerComponentBase ::
2118 CS_AUTO_preMsgHook(
2119 FwOpcodeType opCode,
2120 U32 cmdSeq
2121 )
2122 {
2123 // Defaults to no-op; can be overridden
2124 (void) opCode;
2125 (void) cmdSeq;
2126 }
2127
2128 void CmdSequencerComponentBase ::
2129 CS_MANUAL_preMsgHook(
2130 FwOpcodeType opCode,
2131 U32 cmdSeq
2132 )
2133 {
2134 // Defaults to no-op; can be overridden
2135 (void) opCode;
2136 (void) cmdSeq;
2137 }
2138
2139 void CmdSequencerComponentBase ::
2140 CS_JOIN_WAIT_preMsgHook(
2141 FwOpcodeType opCode,
2142 U32 cmdSeq
2143 )
2144 {
2145 // Defaults to no-op; can be overridden
2146 (void) opCode;
2147 (void) cmdSeq;
2148 }
2149
2150 // ----------------------------------------------------------------------
2151 // Event logging functions
2152 // ----------------------------------------------------------------------
2153
2154 void CmdSequencerComponentBase ::
2155 log_ACTIVITY_LO_CS_SequenceLoaded(const Fw::LogStringArg& fileName)
2156 {
2157 // Get the time
2158 Fw::Time _logTime;
2159 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2160 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2161 }
2162
2163 FwEventIdType _id = static_cast<FwEventIdType>(0);
2164
2165 _id = this->getIdBase() + EVENTID_CS_SEQUENCELOADED;
2166
2167 // Emit the event on the log port
2168 if (this->m_logOut_OutputPort[0].isConnected()) {
2169 Fw::LogBuffer _logBuff;
2171
2172#if FW_AMPCS_COMPATIBLE
2173 // Serialize the number of arguments
2174 _status = _logBuff.serialize(static_cast<U8>(1));
2175 FW_ASSERT(
2176 _status == Fw::FW_SERIALIZE_OK,
2177 static_cast<FwAssertArgType>(_status)
2178 );
2179#endif
2180
2181 _status = fileName.serialize(_logBuff, 60);
2182 FW_ASSERT(
2183 _status == Fw::FW_SERIALIZE_OK,
2184 static_cast<FwAssertArgType>(_status)
2185 );
2186
2187 this->m_logOut_OutputPort[0].invoke(
2188 _id,
2189 _logTime,
2191 _logBuff
2192 );
2193 }
2194
2195 // Emit the event on the text log port
2196#if FW_ENABLE_TEXT_LOGGING
2197 if (this->m_LogText_OutputPort[0].isConnected()) {
2198#if FW_OBJECT_NAMES == 1
2199 const char* _formatString =
2200 "(%s) %s: Loaded sequence %s";
2201#else
2202 const char* _formatString =
2203 "%s: Loaded sequence %s";
2204#endif
2205
2206 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2207
2208 (void) snprintf(
2209 _textBuffer,
2211 _formatString,
2212#if FW_OBJECT_NAMES == 1
2213 this->m_objName,
2214#endif
2215 "CS_SequenceLoaded ",
2216 fileName.toChar()
2217 );
2218
2219 // Null terminate
2220 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2221 Fw::TextLogString _logString = _textBuffer;
2222 this->m_LogText_OutputPort[0].invoke(
2223 _id,
2224 _logTime,
2226 _logString
2227 );
2228 }
2229#endif
2230 }
2231
2232 void CmdSequencerComponentBase ::
2233 log_ACTIVITY_HI_CS_SequenceCanceled(const Fw::LogStringArg& fileName)
2234 {
2235 // Get the time
2236 Fw::Time _logTime;
2237 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2238 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2239 }
2240
2241 FwEventIdType _id = static_cast<FwEventIdType>(0);
2242
2243 _id = this->getIdBase() + EVENTID_CS_SEQUENCECANCELED;
2244
2245 // Emit the event on the log port
2246 if (this->m_logOut_OutputPort[0].isConnected()) {
2247 Fw::LogBuffer _logBuff;
2249
2250#if FW_AMPCS_COMPATIBLE
2251 // Serialize the number of arguments
2252 _status = _logBuff.serialize(static_cast<U8>(1));
2253 FW_ASSERT(
2254 _status == Fw::FW_SERIALIZE_OK,
2255 static_cast<FwAssertArgType>(_status)
2256 );
2257#endif
2258
2259 _status = fileName.serialize(_logBuff, 60);
2260 FW_ASSERT(
2261 _status == Fw::FW_SERIALIZE_OK,
2262 static_cast<FwAssertArgType>(_status)
2263 );
2264
2265 this->m_logOut_OutputPort[0].invoke(
2266 _id,
2267 _logTime,
2269 _logBuff
2270 );
2271 }
2272
2273 // Emit the event on the text log port
2274#if FW_ENABLE_TEXT_LOGGING
2275 if (this->m_LogText_OutputPort[0].isConnected()) {
2276#if FW_OBJECT_NAMES == 1
2277 const char* _formatString =
2278 "(%s) %s: Sequence file %s canceled";
2279#else
2280 const char* _formatString =
2281 "%s: Sequence file %s canceled";
2282#endif
2283
2284 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2285
2286 (void) snprintf(
2287 _textBuffer,
2289 _formatString,
2290#if FW_OBJECT_NAMES == 1
2291 this->m_objName,
2292#endif
2293 "CS_SequenceCanceled ",
2294 fileName.toChar()
2295 );
2296
2297 // Null terminate
2298 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2299 Fw::TextLogString _logString = _textBuffer;
2300 this->m_LogText_OutputPort[0].invoke(
2301 _id,
2302 _logTime,
2304 _logString
2305 );
2306 }
2307#endif
2308 }
2309
2310 void CmdSequencerComponentBase ::
2311 log_WARNING_HI_CS_FileReadError(const Fw::LogStringArg& fileName)
2312 {
2313 // Get the time
2314 Fw::Time _logTime;
2315 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2316 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2317 }
2318
2319 FwEventIdType _id = static_cast<FwEventIdType>(0);
2320
2321 _id = this->getIdBase() + EVENTID_CS_FILEREADERROR;
2322
2323 // Emit the event on the log port
2324 if (this->m_logOut_OutputPort[0].isConnected()) {
2325 Fw::LogBuffer _logBuff;
2327
2328#if FW_AMPCS_COMPATIBLE
2329 // Serialize the number of arguments
2330 _status = _logBuff.serialize(static_cast<U8>(1));
2331 FW_ASSERT(
2332 _status == Fw::FW_SERIALIZE_OK,
2333 static_cast<FwAssertArgType>(_status)
2334 );
2335#endif
2336
2337 _status = fileName.serialize(_logBuff, 60);
2338 FW_ASSERT(
2339 _status == Fw::FW_SERIALIZE_OK,
2340 static_cast<FwAssertArgType>(_status)
2341 );
2342
2343 this->m_logOut_OutputPort[0].invoke(
2344 _id,
2345 _logTime,
2347 _logBuff
2348 );
2349 }
2350
2351 // Emit the event on the text log port
2352#if FW_ENABLE_TEXT_LOGGING
2353 if (this->m_LogText_OutputPort[0].isConnected()) {
2354#if FW_OBJECT_NAMES == 1
2355 const char* _formatString =
2356 "(%s) %s: Error reading sequence file %s";
2357#else
2358 const char* _formatString =
2359 "%s: Error reading sequence file %s";
2360#endif
2361
2362 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2363
2364 (void) snprintf(
2365 _textBuffer,
2367 _formatString,
2368#if FW_OBJECT_NAMES == 1
2369 this->m_objName,
2370#endif
2371 "CS_FileReadError ",
2372 fileName.toChar()
2373 );
2374
2375 // Null terminate
2376 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2377 Fw::TextLogString _logString = _textBuffer;
2378 this->m_LogText_OutputPort[0].invoke(
2379 _id,
2380 _logTime,
2382 _logString
2383 );
2384 }
2385#endif
2386 }
2387
2388 void CmdSequencerComponentBase ::
2389 log_WARNING_HI_CS_FileInvalid(
2390 const Fw::LogStringArg& fileName,
2392 I32 error
2393 )
2394 {
2395 // Get the time
2396 Fw::Time _logTime;
2397 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2398 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2399 }
2400
2401 FwEventIdType _id = static_cast<FwEventIdType>(0);
2402
2403 _id = this->getIdBase() + EVENTID_CS_FILEINVALID;
2404
2405 // Emit the event on the log port
2406 if (this->m_logOut_OutputPort[0].isConnected()) {
2407 Fw::LogBuffer _logBuff;
2409
2410#if FW_AMPCS_COMPATIBLE
2411 // Serialize the number of arguments
2412 _status = _logBuff.serialize(static_cast<U8>(3));
2413 FW_ASSERT(
2414 _status == Fw::FW_SERIALIZE_OK,
2415 static_cast<FwAssertArgType>(_status)
2416 );
2417#endif
2418
2419 _status = fileName.serialize(_logBuff, 60);
2420 FW_ASSERT(
2421 _status == Fw::FW_SERIALIZE_OK,
2422 static_cast<FwAssertArgType>(_status)
2423 );
2424
2425#if FW_AMPCS_COMPATIBLE
2426 // Serialize the argument size
2427 _status = _logBuff.serialize(
2429 );
2430 FW_ASSERT(
2431 _status == Fw::FW_SERIALIZE_OK,
2432 static_cast<FwAssertArgType>(_status)
2433 );
2434#endif
2435 _status = _logBuff.serialize(stage);
2436 FW_ASSERT(
2437 _status == Fw::FW_SERIALIZE_OK,
2438 static_cast<FwAssertArgType>(_status)
2439 );
2440
2441#if FW_AMPCS_COMPATIBLE
2442 // Serialize the argument size
2443 _status = _logBuff.serialize(
2444 static_cast<U8>(sizeof(I32))
2445 );
2446 FW_ASSERT(
2447 _status == Fw::FW_SERIALIZE_OK,
2448 static_cast<FwAssertArgType>(_status)
2449 );
2450#endif
2451 _status = _logBuff.serialize(error);
2452 FW_ASSERT(
2453 _status == Fw::FW_SERIALIZE_OK,
2454 static_cast<FwAssertArgType>(_status)
2455 );
2456
2457 this->m_logOut_OutputPort[0].invoke(
2458 _id,
2459 _logTime,
2461 _logBuff
2462 );
2463 }
2464
2465 // Emit the event on the text log port
2466#if FW_ENABLE_TEXT_LOGGING
2467 if (this->m_LogText_OutputPort[0].isConnected()) {
2468#if FW_OBJECT_NAMES == 1
2469 const char* _formatString =
2470 "(%s) %s: Sequence file %s invalid. Stage: %s Error: %" PRIi32 "";
2471#else
2472 const char* _formatString =
2473 "%s: Sequence file %s invalid. Stage: %s Error: %" PRIi32 "";
2474#endif
2475
2476 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2477
2478 Fw::String stageStr;
2479 stage.toString(stageStr);
2480
2481 (void) snprintf(
2482 _textBuffer,
2484 _formatString,
2485#if FW_OBJECT_NAMES == 1
2486 this->m_objName,
2487#endif
2488 "CS_FileInvalid ",
2489 fileName.toChar(),
2490 stageStr.toChar(),
2491 error
2492 );
2493
2494 // Null terminate
2495 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2496 Fw::TextLogString _logString = _textBuffer;
2497 this->m_LogText_OutputPort[0].invoke(
2498 _id,
2499 _logTime,
2501 _logString
2502 );
2503 }
2504#endif
2505 }
2506
2507 void CmdSequencerComponentBase ::
2508 log_WARNING_HI_CS_RecordInvalid(
2509 const Fw::LogStringArg& fileName,
2510 U32 recordNumber,
2511 I32 error
2512 )
2513 {
2514 // Get the time
2515 Fw::Time _logTime;
2516 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2517 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2518 }
2519
2520 FwEventIdType _id = static_cast<FwEventIdType>(0);
2521
2522 _id = this->getIdBase() + EVENTID_CS_RECORDINVALID;
2523
2524 // Emit the event on the log port
2525 if (this->m_logOut_OutputPort[0].isConnected()) {
2526 Fw::LogBuffer _logBuff;
2528
2529#if FW_AMPCS_COMPATIBLE
2530 // Serialize the number of arguments
2531 _status = _logBuff.serialize(static_cast<U8>(3));
2532 FW_ASSERT(
2533 _status == Fw::FW_SERIALIZE_OK,
2534 static_cast<FwAssertArgType>(_status)
2535 );
2536#endif
2537
2538 _status = fileName.serialize(_logBuff, 60);
2539 FW_ASSERT(
2540 _status == Fw::FW_SERIALIZE_OK,
2541 static_cast<FwAssertArgType>(_status)
2542 );
2543
2544#if FW_AMPCS_COMPATIBLE
2545 // Serialize the argument size
2546 _status = _logBuff.serialize(
2547 static_cast<U8>(sizeof(U32))
2548 );
2549 FW_ASSERT(
2550 _status == Fw::FW_SERIALIZE_OK,
2551 static_cast<FwAssertArgType>(_status)
2552 );
2553#endif
2554 _status = _logBuff.serialize(recordNumber);
2555 FW_ASSERT(
2556 _status == Fw::FW_SERIALIZE_OK,
2557 static_cast<FwAssertArgType>(_status)
2558 );
2559
2560#if FW_AMPCS_COMPATIBLE
2561 // Serialize the argument size
2562 _status = _logBuff.serialize(
2563 static_cast<U8>(sizeof(I32))
2564 );
2565 FW_ASSERT(
2566 _status == Fw::FW_SERIALIZE_OK,
2567 static_cast<FwAssertArgType>(_status)
2568 );
2569#endif
2570 _status = _logBuff.serialize(error);
2571 FW_ASSERT(
2572 _status == Fw::FW_SERIALIZE_OK,
2573 static_cast<FwAssertArgType>(_status)
2574 );
2575
2576 this->m_logOut_OutputPort[0].invoke(
2577 _id,
2578 _logTime,
2580 _logBuff
2581 );
2582 }
2583
2584 // Emit the event on the text log port
2585#if FW_ENABLE_TEXT_LOGGING
2586 if (this->m_LogText_OutputPort[0].isConnected()) {
2587#if FW_OBJECT_NAMES == 1
2588 const char* _formatString =
2589 "(%s) %s: Sequence file %s: Record %" PRIu32 " invalid. Err: %" PRIi32 "";
2590#else
2591 const char* _formatString =
2592 "%s: Sequence file %s: Record %" PRIu32 " invalid. Err: %" PRIi32 "";
2593#endif
2594
2595 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2596
2597 (void) snprintf(
2598 _textBuffer,
2600 _formatString,
2601#if FW_OBJECT_NAMES == 1
2602 this->m_objName,
2603#endif
2604 "CS_RecordInvalid ",
2605 fileName.toChar(),
2606 recordNumber,
2607 error
2608 );
2609
2610 // Null terminate
2611 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2612 Fw::TextLogString _logString = _textBuffer;
2613 this->m_LogText_OutputPort[0].invoke(
2614 _id,
2615 _logTime,
2617 _logString
2618 );
2619 }
2620#endif
2621 }
2622
2623 void CmdSequencerComponentBase ::
2624 log_WARNING_HI_CS_FileSizeError(
2625 const Fw::LogStringArg& fileName,
2626 U32 size
2627 )
2628 {
2629 // Get the time
2630 Fw::Time _logTime;
2631 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2632 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2633 }
2634
2635 FwEventIdType _id = static_cast<FwEventIdType>(0);
2636
2637 _id = this->getIdBase() + EVENTID_CS_FILESIZEERROR;
2638
2639 // Emit the event on the log port
2640 if (this->m_logOut_OutputPort[0].isConnected()) {
2641 Fw::LogBuffer _logBuff;
2643
2644#if FW_AMPCS_COMPATIBLE
2645 // Serialize the number of arguments
2646 _status = _logBuff.serialize(static_cast<U8>(2));
2647 FW_ASSERT(
2648 _status == Fw::FW_SERIALIZE_OK,
2649 static_cast<FwAssertArgType>(_status)
2650 );
2651#endif
2652
2653 _status = fileName.serialize(_logBuff, 60);
2654 FW_ASSERT(
2655 _status == Fw::FW_SERIALIZE_OK,
2656 static_cast<FwAssertArgType>(_status)
2657 );
2658
2659#if FW_AMPCS_COMPATIBLE
2660 // Serialize the argument size
2661 _status = _logBuff.serialize(
2662 static_cast<U8>(sizeof(U32))
2663 );
2664 FW_ASSERT(
2665 _status == Fw::FW_SERIALIZE_OK,
2666 static_cast<FwAssertArgType>(_status)
2667 );
2668#endif
2669 _status = _logBuff.serialize(size);
2670 FW_ASSERT(
2671 _status == Fw::FW_SERIALIZE_OK,
2672 static_cast<FwAssertArgType>(_status)
2673 );
2674
2675 this->m_logOut_OutputPort[0].invoke(
2676 _id,
2677 _logTime,
2679 _logBuff
2680 );
2681 }
2682
2683 // Emit the event on the text log port
2684#if FW_ENABLE_TEXT_LOGGING
2685 if (this->m_LogText_OutputPort[0].isConnected()) {
2686#if FW_OBJECT_NAMES == 1
2687 const char* _formatString =
2688 "(%s) %s: Sequence file %s too large. Size: %" PRIu32 "";
2689#else
2690 const char* _formatString =
2691 "%s: Sequence file %s too large. Size: %" PRIu32 "";
2692#endif
2693
2694 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2695
2696 (void) snprintf(
2697 _textBuffer,
2699 _formatString,
2700#if FW_OBJECT_NAMES == 1
2701 this->m_objName,
2702#endif
2703 "CS_FileSizeError ",
2704 fileName.toChar(),
2705 size
2706 );
2707
2708 // Null terminate
2709 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2710 Fw::TextLogString _logString = _textBuffer;
2711 this->m_LogText_OutputPort[0].invoke(
2712 _id,
2713 _logTime,
2715 _logString
2716 );
2717 }
2718#endif
2719 }
2720
2721 void CmdSequencerComponentBase ::
2722 log_WARNING_HI_CS_FileNotFound(const Fw::LogStringArg& fileName)
2723 {
2724 // Get the time
2725 Fw::Time _logTime;
2726 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2727 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2728 }
2729
2730 FwEventIdType _id = static_cast<FwEventIdType>(0);
2731
2732 _id = this->getIdBase() + EVENTID_CS_FILENOTFOUND;
2733
2734 // Emit the event on the log port
2735 if (this->m_logOut_OutputPort[0].isConnected()) {
2736 Fw::LogBuffer _logBuff;
2738
2739#if FW_AMPCS_COMPATIBLE
2740 // Serialize the number of arguments
2741 _status = _logBuff.serialize(static_cast<U8>(1));
2742 FW_ASSERT(
2743 _status == Fw::FW_SERIALIZE_OK,
2744 static_cast<FwAssertArgType>(_status)
2745 );
2746#endif
2747
2748 _status = fileName.serialize(_logBuff, 60);
2749 FW_ASSERT(
2750 _status == Fw::FW_SERIALIZE_OK,
2751 static_cast<FwAssertArgType>(_status)
2752 );
2753
2754 this->m_logOut_OutputPort[0].invoke(
2755 _id,
2756 _logTime,
2758 _logBuff
2759 );
2760 }
2761
2762 // Emit the event on the text log port
2763#if FW_ENABLE_TEXT_LOGGING
2764 if (this->m_LogText_OutputPort[0].isConnected()) {
2765#if FW_OBJECT_NAMES == 1
2766 const char* _formatString =
2767 "(%s) %s: Sequence file %s not found.";
2768#else
2769 const char* _formatString =
2770 "%s: Sequence file %s not found.";
2771#endif
2772
2773 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2774
2775 (void) snprintf(
2776 _textBuffer,
2778 _formatString,
2779#if FW_OBJECT_NAMES == 1
2780 this->m_objName,
2781#endif
2782 "CS_FileNotFound ",
2783 fileName.toChar()
2784 );
2785
2786 // Null terminate
2787 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2788 Fw::TextLogString _logString = _textBuffer;
2789 this->m_LogText_OutputPort[0].invoke(
2790 _id,
2791 _logTime,
2793 _logString
2794 );
2795 }
2796#endif
2797 }
2798
2799 void CmdSequencerComponentBase ::
2800 log_WARNING_HI_CS_FileCrcFailure(
2801 const Fw::LogStringArg& fileName,
2802 U32 storedCRC,
2803 U32 computedCRC
2804 )
2805 {
2806 // Get the time
2807 Fw::Time _logTime;
2808 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2809 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2810 }
2811
2812 FwEventIdType _id = static_cast<FwEventIdType>(0);
2813
2814 _id = this->getIdBase() + EVENTID_CS_FILECRCFAILURE;
2815
2816 // Emit the event on the log port
2817 if (this->m_logOut_OutputPort[0].isConnected()) {
2818 Fw::LogBuffer _logBuff;
2820
2821#if FW_AMPCS_COMPATIBLE
2822 // Serialize the number of arguments
2823 _status = _logBuff.serialize(static_cast<U8>(3));
2824 FW_ASSERT(
2825 _status == Fw::FW_SERIALIZE_OK,
2826 static_cast<FwAssertArgType>(_status)
2827 );
2828#endif
2829
2830 _status = fileName.serialize(_logBuff, 60);
2831 FW_ASSERT(
2832 _status == Fw::FW_SERIALIZE_OK,
2833 static_cast<FwAssertArgType>(_status)
2834 );
2835
2836#if FW_AMPCS_COMPATIBLE
2837 // Serialize the argument size
2838 _status = _logBuff.serialize(
2839 static_cast<U8>(sizeof(U32))
2840 );
2841 FW_ASSERT(
2842 _status == Fw::FW_SERIALIZE_OK,
2843 static_cast<FwAssertArgType>(_status)
2844 );
2845#endif
2846 _status = _logBuff.serialize(storedCRC);
2847 FW_ASSERT(
2848 _status == Fw::FW_SERIALIZE_OK,
2849 static_cast<FwAssertArgType>(_status)
2850 );
2851
2852#if FW_AMPCS_COMPATIBLE
2853 // Serialize the argument size
2854 _status = _logBuff.serialize(
2855 static_cast<U8>(sizeof(U32))
2856 );
2857 FW_ASSERT(
2858 _status == Fw::FW_SERIALIZE_OK,
2859 static_cast<FwAssertArgType>(_status)
2860 );
2861#endif
2862 _status = _logBuff.serialize(computedCRC);
2863 FW_ASSERT(
2864 _status == Fw::FW_SERIALIZE_OK,
2865 static_cast<FwAssertArgType>(_status)
2866 );
2867
2868 this->m_logOut_OutputPort[0].invoke(
2869 _id,
2870 _logTime,
2872 _logBuff
2873 );
2874 }
2875
2876 // Emit the event on the text log port
2877#if FW_ENABLE_TEXT_LOGGING
2878 if (this->m_LogText_OutputPort[0].isConnected()) {
2879#if FW_OBJECT_NAMES == 1
2880 const char* _formatString =
2881 "(%s) %s: Sequence file %s had invalid CRC. Stored 0x%" PRIx32 ", Computed 0x%" PRIx32 ".";
2882#else
2883 const char* _formatString =
2884 "%s: Sequence file %s had invalid CRC. Stored 0x%" PRIx32 ", Computed 0x%" PRIx32 ".";
2885#endif
2886
2887 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
2888
2889 (void) snprintf(
2890 _textBuffer,
2892 _formatString,
2893#if FW_OBJECT_NAMES == 1
2894 this->m_objName,
2895#endif
2896 "CS_FileCrcFailure ",
2897 fileName.toChar(),
2898 storedCRC,
2899 computedCRC
2900 );
2901
2902 // Null terminate
2903 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
2904 Fw::TextLogString _logString = _textBuffer;
2905 this->m_LogText_OutputPort[0].invoke(
2906 _id,
2907 _logTime,
2909 _logString
2910 );
2911 }
2912#endif
2913 }
2914
2915 void CmdSequencerComponentBase ::
2916 log_ACTIVITY_LO_CS_CommandComplete(
2917 const Fw::LogStringArg& fileName,
2918 U32 recordNumber,
2919 U32 opCode
2920 )
2921 {
2922 // Get the time
2923 Fw::Time _logTime;
2924 if (this->m_timeCaller_OutputPort[0].isConnected()) {
2925 this->m_timeCaller_OutputPort[0].invoke(_logTime);
2926 }
2927
2928 FwEventIdType _id = static_cast<FwEventIdType>(0);
2929
2930 _id = this->getIdBase() + EVENTID_CS_COMMANDCOMPLETE;
2931
2932 // Emit the event on the log port
2933 if (this->m_logOut_OutputPort[0].isConnected()) {
2934 Fw::LogBuffer _logBuff;
2936
2937#if FW_AMPCS_COMPATIBLE
2938 // Serialize the number of arguments
2939 _status = _logBuff.serialize(static_cast<U8>(3));
2940 FW_ASSERT(
2941 _status == Fw::FW_SERIALIZE_OK,
2942 static_cast<FwAssertArgType>(_status)
2943 );
2944#endif
2945
2946 _status = fileName.serialize(_logBuff, 60);
2947 FW_ASSERT(
2948 _status == Fw::FW_SERIALIZE_OK,
2949 static_cast<FwAssertArgType>(_status)
2950 );
2951
2952#if FW_AMPCS_COMPATIBLE
2953 // Serialize the argument size
2954 _status = _logBuff.serialize(
2955 static_cast<U8>(sizeof(U32))
2956 );
2957 FW_ASSERT(
2958 _status == Fw::FW_SERIALIZE_OK,
2959 static_cast<FwAssertArgType>(_status)
2960 );
2961#endif
2962 _status = _logBuff.serialize(recordNumber);
2963 FW_ASSERT(
2964 _status == Fw::FW_SERIALIZE_OK,
2965 static_cast<FwAssertArgType>(_status)
2966 );
2967
2968#if FW_AMPCS_COMPATIBLE
2969 // Serialize the argument size
2970 _status = _logBuff.serialize(
2971 static_cast<U8>(sizeof(U32))
2972 );
2973 FW_ASSERT(
2974 _status == Fw::FW_SERIALIZE_OK,
2975 static_cast<FwAssertArgType>(_status)
2976 );
2977#endif
2978 _status = _logBuff.serialize(opCode);
2979 FW_ASSERT(
2980 _status == Fw::FW_SERIALIZE_OK,
2981 static_cast<FwAssertArgType>(_status)
2982 );
2983
2984 this->m_logOut_OutputPort[0].invoke(
2985 _id,
2986 _logTime,
2988 _logBuff
2989 );
2990 }
2991
2992 // Emit the event on the text log port
2993#if FW_ENABLE_TEXT_LOGGING
2994 if (this->m_LogText_OutputPort[0].isConnected()) {
2995#if FW_OBJECT_NAMES == 1
2996 const char* _formatString =
2997 "(%s) %s: Sequence file %s: Command %" PRIu32 " (opcode %" PRIu32 ") complete";
2998#else
2999 const char* _formatString =
3000 "%s: Sequence file %s: Command %" PRIu32 " (opcode %" PRIu32 ") complete";
3001#endif
3002
3003 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3004
3005 (void) snprintf(
3006 _textBuffer,
3008 _formatString,
3009#if FW_OBJECT_NAMES == 1
3010 this->m_objName,
3011#endif
3012 "CS_CommandComplete ",
3013 fileName.toChar(),
3014 recordNumber,
3015 opCode
3016 );
3017
3018 // Null terminate
3019 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3020 Fw::TextLogString _logString = _textBuffer;
3021 this->m_LogText_OutputPort[0].invoke(
3022 _id,
3023 _logTime,
3025 _logString
3026 );
3027 }
3028#endif
3029 }
3030
3031 void CmdSequencerComponentBase ::
3032 log_ACTIVITY_HI_CS_SequenceComplete(const Fw::LogStringArg& fileName)
3033 {
3034 // Get the time
3035 Fw::Time _logTime;
3036 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3037 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3038 }
3039
3040 FwEventIdType _id = static_cast<FwEventIdType>(0);
3041
3042 _id = this->getIdBase() + EVENTID_CS_SEQUENCECOMPLETE;
3043
3044 // Emit the event on the log port
3045 if (this->m_logOut_OutputPort[0].isConnected()) {
3046 Fw::LogBuffer _logBuff;
3048
3049#if FW_AMPCS_COMPATIBLE
3050 // Serialize the number of arguments
3051 _status = _logBuff.serialize(static_cast<U8>(1));
3052 FW_ASSERT(
3053 _status == Fw::FW_SERIALIZE_OK,
3054 static_cast<FwAssertArgType>(_status)
3055 );
3056#endif
3057
3058 _status = fileName.serialize(_logBuff, 60);
3059 FW_ASSERT(
3060 _status == Fw::FW_SERIALIZE_OK,
3061 static_cast<FwAssertArgType>(_status)
3062 );
3063
3064 this->m_logOut_OutputPort[0].invoke(
3065 _id,
3066 _logTime,
3068 _logBuff
3069 );
3070 }
3071
3072 // Emit the event on the text log port
3073#if FW_ENABLE_TEXT_LOGGING
3074 if (this->m_LogText_OutputPort[0].isConnected()) {
3075#if FW_OBJECT_NAMES == 1
3076 const char* _formatString =
3077 "(%s) %s: Sequence file %s complete";
3078#else
3079 const char* _formatString =
3080 "%s: Sequence file %s complete";
3081#endif
3082
3083 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3084
3085 (void) snprintf(
3086 _textBuffer,
3088 _formatString,
3089#if FW_OBJECT_NAMES == 1
3090 this->m_objName,
3091#endif
3092 "CS_SequenceComplete ",
3093 fileName.toChar()
3094 );
3095
3096 // Null terminate
3097 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3098 Fw::TextLogString _logString = _textBuffer;
3099 this->m_LogText_OutputPort[0].invoke(
3100 _id,
3101 _logTime,
3103 _logString
3104 );
3105 }
3106#endif
3107 }
3108
3109 void CmdSequencerComponentBase ::
3110 log_WARNING_HI_CS_CommandError(
3111 const Fw::LogStringArg& fileName,
3112 U32 recordNumber,
3113 U32 opCode,
3114 U32 errorStatus
3115 )
3116 {
3117 // Get the time
3118 Fw::Time _logTime;
3119 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3120 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3121 }
3122
3123 FwEventIdType _id = static_cast<FwEventIdType>(0);
3124
3125 _id = this->getIdBase() + EVENTID_CS_COMMANDERROR;
3126
3127 // Emit the event on the log port
3128 if (this->m_logOut_OutputPort[0].isConnected()) {
3129 Fw::LogBuffer _logBuff;
3131
3132#if FW_AMPCS_COMPATIBLE
3133 // Serialize the number of arguments
3134 _status = _logBuff.serialize(static_cast<U8>(4));
3135 FW_ASSERT(
3136 _status == Fw::FW_SERIALIZE_OK,
3137 static_cast<FwAssertArgType>(_status)
3138 );
3139#endif
3140
3141 _status = fileName.serialize(_logBuff, 60);
3142 FW_ASSERT(
3143 _status == Fw::FW_SERIALIZE_OK,
3144 static_cast<FwAssertArgType>(_status)
3145 );
3146
3147#if FW_AMPCS_COMPATIBLE
3148 // Serialize the argument size
3149 _status = _logBuff.serialize(
3150 static_cast<U8>(sizeof(U32))
3151 );
3152 FW_ASSERT(
3153 _status == Fw::FW_SERIALIZE_OK,
3154 static_cast<FwAssertArgType>(_status)
3155 );
3156#endif
3157 _status = _logBuff.serialize(recordNumber);
3158 FW_ASSERT(
3159 _status == Fw::FW_SERIALIZE_OK,
3160 static_cast<FwAssertArgType>(_status)
3161 );
3162
3163#if FW_AMPCS_COMPATIBLE
3164 // Serialize the argument size
3165 _status = _logBuff.serialize(
3166 static_cast<U8>(sizeof(U32))
3167 );
3168 FW_ASSERT(
3169 _status == Fw::FW_SERIALIZE_OK,
3170 static_cast<FwAssertArgType>(_status)
3171 );
3172#endif
3173 _status = _logBuff.serialize(opCode);
3174 FW_ASSERT(
3175 _status == Fw::FW_SERIALIZE_OK,
3176 static_cast<FwAssertArgType>(_status)
3177 );
3178
3179#if FW_AMPCS_COMPATIBLE
3180 // Serialize the argument size
3181 _status = _logBuff.serialize(
3182 static_cast<U8>(sizeof(U32))
3183 );
3184 FW_ASSERT(
3185 _status == Fw::FW_SERIALIZE_OK,
3186 static_cast<FwAssertArgType>(_status)
3187 );
3188#endif
3189 _status = _logBuff.serialize(errorStatus);
3190 FW_ASSERT(
3191 _status == Fw::FW_SERIALIZE_OK,
3192 static_cast<FwAssertArgType>(_status)
3193 );
3194
3195 this->m_logOut_OutputPort[0].invoke(
3196 _id,
3197 _logTime,
3199 _logBuff
3200 );
3201 }
3202
3203 // Emit the event on the text log port
3204#if FW_ENABLE_TEXT_LOGGING
3205 if (this->m_LogText_OutputPort[0].isConnected()) {
3206#if FW_OBJECT_NAMES == 1
3207 const char* _formatString =
3208 "(%s) %s: Sequence file %s: Command %" PRIu32 " (opcode %" PRIu32 ") completed with error %" PRIu32 "";
3209#else
3210 const char* _formatString =
3211 "%s: Sequence file %s: Command %" PRIu32 " (opcode %" PRIu32 ") completed with error %" PRIu32 "";
3212#endif
3213
3214 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3215
3216 (void) snprintf(
3217 _textBuffer,
3219 _formatString,
3220#if FW_OBJECT_NAMES == 1
3221 this->m_objName,
3222#endif
3223 "CS_CommandError ",
3224 fileName.toChar(),
3225 recordNumber,
3226 opCode,
3227 errorStatus
3228 );
3229
3230 // Null terminate
3231 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3232 Fw::TextLogString _logString = _textBuffer;
3233 this->m_LogText_OutputPort[0].invoke(
3234 _id,
3235 _logTime,
3237 _logString
3238 );
3239 }
3240#endif
3241 }
3242
3243 void CmdSequencerComponentBase ::
3244 log_WARNING_HI_CS_InvalidMode()
3245 {
3246 // Get the time
3247 Fw::Time _logTime;
3248 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3249 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3250 }
3251
3252 FwEventIdType _id = static_cast<FwEventIdType>(0);
3253
3254 _id = this->getIdBase() + EVENTID_CS_INVALIDMODE;
3255
3256 // Emit the event on the log port
3257 if (this->m_logOut_OutputPort[0].isConnected()) {
3258 Fw::LogBuffer _logBuff;
3259
3260#if FW_AMPCS_COMPATIBLE
3262 // Serialize the number of arguments
3263 _status = _logBuff.serialize(static_cast<U8>(0));
3264 FW_ASSERT(
3265 _status == Fw::FW_SERIALIZE_OK,
3266 static_cast<FwAssertArgType>(_status)
3267 );
3268#endif
3269
3270 this->m_logOut_OutputPort[0].invoke(
3271 _id,
3272 _logTime,
3274 _logBuff
3275 );
3276 }
3277
3278 // Emit the event on the text log port
3279#if FW_ENABLE_TEXT_LOGGING
3280 if (this->m_LogText_OutputPort[0].isConnected()) {
3281#if FW_OBJECT_NAMES == 1
3282 const char* _formatString =
3283 "(%s) %s: Invalid mode";
3284#else
3285 const char* _formatString =
3286 "%s: Invalid mode";
3287#endif
3288
3289 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3290
3291 (void) snprintf(
3292 _textBuffer,
3294 _formatString,
3295#if FW_OBJECT_NAMES == 1
3296 this->m_objName,
3297#endif
3298 "CS_InvalidMode "
3299 );
3300
3301 // Null terminate
3302 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3303 Fw::TextLogString _logString = _textBuffer;
3304 this->m_LogText_OutputPort[0].invoke(
3305 _id,
3306 _logTime,
3308 _logString
3309 );
3310 }
3311#endif
3312 }
3313
3314 void CmdSequencerComponentBase ::
3315 log_WARNING_HI_CS_RecordMismatch(
3316 const Fw::LogStringArg& fileName,
3317 U32 header_records,
3318 U32 extra_bytes
3319 )
3320 {
3321 // Get the time
3322 Fw::Time _logTime;
3323 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3324 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3325 }
3326
3327 FwEventIdType _id = static_cast<FwEventIdType>(0);
3328
3329 _id = this->getIdBase() + EVENTID_CS_RECORDMISMATCH;
3330
3331 // Emit the event on the log port
3332 if (this->m_logOut_OutputPort[0].isConnected()) {
3333 Fw::LogBuffer _logBuff;
3335
3336#if FW_AMPCS_COMPATIBLE
3337 // Serialize the number of arguments
3338 _status = _logBuff.serialize(static_cast<U8>(3));
3339 FW_ASSERT(
3340 _status == Fw::FW_SERIALIZE_OK,
3341 static_cast<FwAssertArgType>(_status)
3342 );
3343#endif
3344
3345 _status = fileName.serialize(_logBuff, 60);
3346 FW_ASSERT(
3347 _status == Fw::FW_SERIALIZE_OK,
3348 static_cast<FwAssertArgType>(_status)
3349 );
3350
3351#if FW_AMPCS_COMPATIBLE
3352 // Serialize the argument size
3353 _status = _logBuff.serialize(
3354 static_cast<U8>(sizeof(U32))
3355 );
3356 FW_ASSERT(
3357 _status == Fw::FW_SERIALIZE_OK,
3358 static_cast<FwAssertArgType>(_status)
3359 );
3360#endif
3361 _status = _logBuff.serialize(header_records);
3362 FW_ASSERT(
3363 _status == Fw::FW_SERIALIZE_OK,
3364 static_cast<FwAssertArgType>(_status)
3365 );
3366
3367#if FW_AMPCS_COMPATIBLE
3368 // Serialize the argument size
3369 _status = _logBuff.serialize(
3370 static_cast<U8>(sizeof(U32))
3371 );
3372 FW_ASSERT(
3373 _status == Fw::FW_SERIALIZE_OK,
3374 static_cast<FwAssertArgType>(_status)
3375 );
3376#endif
3377 _status = _logBuff.serialize(extra_bytes);
3378 FW_ASSERT(
3379 _status == Fw::FW_SERIALIZE_OK,
3380 static_cast<FwAssertArgType>(_status)
3381 );
3382
3383 this->m_logOut_OutputPort[0].invoke(
3384 _id,
3385 _logTime,
3387 _logBuff
3388 );
3389 }
3390
3391 // Emit the event on the text log port
3392#if FW_ENABLE_TEXT_LOGGING
3393 if (this->m_LogText_OutputPort[0].isConnected()) {
3394#if FW_OBJECT_NAMES == 1
3395 const char* _formatString =
3396 "(%s) %s: Sequence file %s header records mismatch: %" PRIu32 " in header, found %" PRIu32 " extra bytes.";
3397#else
3398 const char* _formatString =
3399 "%s: Sequence file %s header records mismatch: %" PRIu32 " in header, found %" PRIu32 " extra bytes.";
3400#endif
3401
3402 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3403
3404 (void) snprintf(
3405 _textBuffer,
3407 _formatString,
3408#if FW_OBJECT_NAMES == 1
3409 this->m_objName,
3410#endif
3411 "CS_RecordMismatch ",
3412 fileName.toChar(),
3413 header_records,
3414 extra_bytes
3415 );
3416
3417 // Null terminate
3418 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3419 Fw::TextLogString _logString = _textBuffer;
3420 this->m_LogText_OutputPort[0].invoke(
3421 _id,
3422 _logTime,
3424 _logString
3425 );
3426 }
3427#endif
3428 }
3429
3430 void CmdSequencerComponentBase ::
3431 log_WARNING_HI_CS_TimeBaseMismatch(
3432 const Fw::LogStringArg& fileName,
3433 U16 time_base,
3434 U16 seq_time_base
3435 )
3436 {
3437 // Get the time
3438 Fw::Time _logTime;
3439 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3440 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3441 }
3442
3443 FwEventIdType _id = static_cast<FwEventIdType>(0);
3444
3445 _id = this->getIdBase() + EVENTID_CS_TIMEBASEMISMATCH;
3446
3447 // Emit the event on the log port
3448 if (this->m_logOut_OutputPort[0].isConnected()) {
3449 Fw::LogBuffer _logBuff;
3451
3452#if FW_AMPCS_COMPATIBLE
3453 // Serialize the number of arguments
3454 _status = _logBuff.serialize(static_cast<U8>(3));
3455 FW_ASSERT(
3456 _status == Fw::FW_SERIALIZE_OK,
3457 static_cast<FwAssertArgType>(_status)
3458 );
3459#endif
3460
3461 _status = fileName.serialize(_logBuff, 60);
3462 FW_ASSERT(
3463 _status == Fw::FW_SERIALIZE_OK,
3464 static_cast<FwAssertArgType>(_status)
3465 );
3466
3467#if FW_AMPCS_COMPATIBLE
3468 // Serialize the argument size
3469 _status = _logBuff.serialize(
3470 static_cast<U8>(sizeof(U16))
3471 );
3472 FW_ASSERT(
3473 _status == Fw::FW_SERIALIZE_OK,
3474 static_cast<FwAssertArgType>(_status)
3475 );
3476#endif
3477 _status = _logBuff.serialize(time_base);
3478 FW_ASSERT(
3479 _status == Fw::FW_SERIALIZE_OK,
3480 static_cast<FwAssertArgType>(_status)
3481 );
3482
3483#if FW_AMPCS_COMPATIBLE
3484 // Serialize the argument size
3485 _status = _logBuff.serialize(
3486 static_cast<U8>(sizeof(U16))
3487 );
3488 FW_ASSERT(
3489 _status == Fw::FW_SERIALIZE_OK,
3490 static_cast<FwAssertArgType>(_status)
3491 );
3492#endif
3493 _status = _logBuff.serialize(seq_time_base);
3494 FW_ASSERT(
3495 _status == Fw::FW_SERIALIZE_OK,
3496 static_cast<FwAssertArgType>(_status)
3497 );
3498
3499 this->m_logOut_OutputPort[0].invoke(
3500 _id,
3501 _logTime,
3503 _logBuff
3504 );
3505 }
3506
3507 // Emit the event on the text log port
3508#if FW_ENABLE_TEXT_LOGGING
3509 if (this->m_LogText_OutputPort[0].isConnected()) {
3510#if FW_OBJECT_NAMES == 1
3511 const char* _formatString =
3512 "(%s) %s: Sequence file %s: Current time base doesn't match sequence time: base: %" PRIu16 " seq: %" PRIu16 "";
3513#else
3514 const char* _formatString =
3515 "%s: Sequence file %s: Current time base doesn't match sequence time: base: %" PRIu16 " seq: %" PRIu16 "";
3516#endif
3517
3518 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3519
3520 (void) snprintf(
3521 _textBuffer,
3523 _formatString,
3524#if FW_OBJECT_NAMES == 1
3525 this->m_objName,
3526#endif
3527 "CS_TimeBaseMismatch ",
3528 fileName.toChar(),
3529 time_base,
3530 seq_time_base
3531 );
3532
3533 // Null terminate
3534 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3535 Fw::TextLogString _logString = _textBuffer;
3536 this->m_LogText_OutputPort[0].invoke(
3537 _id,
3538 _logTime,
3540 _logString
3541 );
3542 }
3543#endif
3544 }
3545
3546 void CmdSequencerComponentBase ::
3547 log_WARNING_HI_CS_TimeContextMismatch(
3548 const Fw::LogStringArg& fileName,
3549 U8 currTimeBase,
3550 U8 seqTimeBase
3551 )
3552 {
3553 // Get the time
3554 Fw::Time _logTime;
3555 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3556 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3557 }
3558
3559 FwEventIdType _id = static_cast<FwEventIdType>(0);
3560
3561 _id = this->getIdBase() + EVENTID_CS_TIMECONTEXTMISMATCH;
3562
3563 // Emit the event on the log port
3564 if (this->m_logOut_OutputPort[0].isConnected()) {
3565 Fw::LogBuffer _logBuff;
3567
3568#if FW_AMPCS_COMPATIBLE
3569 // Serialize the number of arguments
3570 _status = _logBuff.serialize(static_cast<U8>(3));
3571 FW_ASSERT(
3572 _status == Fw::FW_SERIALIZE_OK,
3573 static_cast<FwAssertArgType>(_status)
3574 );
3575#endif
3576
3577 _status = fileName.serialize(_logBuff, 60);
3578 FW_ASSERT(
3579 _status == Fw::FW_SERIALIZE_OK,
3580 static_cast<FwAssertArgType>(_status)
3581 );
3582
3583#if FW_AMPCS_COMPATIBLE
3584 // Serialize the argument size
3585 _status = _logBuff.serialize(
3586 static_cast<U8>(sizeof(U8))
3587 );
3588 FW_ASSERT(
3589 _status == Fw::FW_SERIALIZE_OK,
3590 static_cast<FwAssertArgType>(_status)
3591 );
3592#endif
3593 _status = _logBuff.serialize(currTimeBase);
3594 FW_ASSERT(
3595 _status == Fw::FW_SERIALIZE_OK,
3596 static_cast<FwAssertArgType>(_status)
3597 );
3598
3599#if FW_AMPCS_COMPATIBLE
3600 // Serialize the argument size
3601 _status = _logBuff.serialize(
3602 static_cast<U8>(sizeof(U8))
3603 );
3604 FW_ASSERT(
3605 _status == Fw::FW_SERIALIZE_OK,
3606 static_cast<FwAssertArgType>(_status)
3607 );
3608#endif
3609 _status = _logBuff.serialize(seqTimeBase);
3610 FW_ASSERT(
3611 _status == Fw::FW_SERIALIZE_OK,
3612 static_cast<FwAssertArgType>(_status)
3613 );
3614
3615 this->m_logOut_OutputPort[0].invoke(
3616 _id,
3617 _logTime,
3619 _logBuff
3620 );
3621 }
3622
3623 // Emit the event on the text log port
3624#if FW_ENABLE_TEXT_LOGGING
3625 if (this->m_LogText_OutputPort[0].isConnected()) {
3626#if FW_OBJECT_NAMES == 1
3627 const char* _formatString =
3628 "(%s) %s: Sequence file %s: Current time context doesn't match sequence context: base: %" PRIu8 " seq: %" PRIu8 "";
3629#else
3630 const char* _formatString =
3631 "%s: Sequence file %s: Current time context doesn't match sequence context: base: %" PRIu8 " seq: %" PRIu8 "";
3632#endif
3633
3634 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3635
3636 (void) snprintf(
3637 _textBuffer,
3639 _formatString,
3640#if FW_OBJECT_NAMES == 1
3641 this->m_objName,
3642#endif
3643 "CS_TimeContextMismatch ",
3644 fileName.toChar(),
3645 currTimeBase,
3646 seqTimeBase
3647 );
3648
3649 // Null terminate
3650 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3651 Fw::TextLogString _logString = _textBuffer;
3652 this->m_LogText_OutputPort[0].invoke(
3653 _id,
3654 _logTime,
3656 _logString
3657 );
3658 }
3659#endif
3660 }
3661
3662 void CmdSequencerComponentBase ::
3663 log_ACTIVITY_HI_CS_PortSequenceStarted(const Fw::LogStringArg& filename)
3664 {
3665 // Get the time
3666 Fw::Time _logTime;
3667 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3668 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3669 }
3670
3671 FwEventIdType _id = static_cast<FwEventIdType>(0);
3672
3673 _id = this->getIdBase() + EVENTID_CS_PORTSEQUENCESTARTED;
3674
3675 // Emit the event on the log port
3676 if (this->m_logOut_OutputPort[0].isConnected()) {
3677 Fw::LogBuffer _logBuff;
3679
3680#if FW_AMPCS_COMPATIBLE
3681 // Serialize the number of arguments
3682 _status = _logBuff.serialize(static_cast<U8>(1));
3683 FW_ASSERT(
3684 _status == Fw::FW_SERIALIZE_OK,
3685 static_cast<FwAssertArgType>(_status)
3686 );
3687#endif
3688
3689 _status = filename.serialize(_logBuff, 60);
3690 FW_ASSERT(
3691 _status == Fw::FW_SERIALIZE_OK,
3692 static_cast<FwAssertArgType>(_status)
3693 );
3694
3695 this->m_logOut_OutputPort[0].invoke(
3696 _id,
3697 _logTime,
3699 _logBuff
3700 );
3701 }
3702
3703 // Emit the event on the text log port
3704#if FW_ENABLE_TEXT_LOGGING
3705 if (this->m_LogText_OutputPort[0].isConnected()) {
3706#if FW_OBJECT_NAMES == 1
3707 const char* _formatString =
3708 "(%s) %s: Local request for sequence %s started.";
3709#else
3710 const char* _formatString =
3711 "%s: Local request for sequence %s started.";
3712#endif
3713
3714 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3715
3716 (void) snprintf(
3717 _textBuffer,
3719 _formatString,
3720#if FW_OBJECT_NAMES == 1
3721 this->m_objName,
3722#endif
3723 "CS_PortSequenceStarted ",
3724 filename.toChar()
3725 );
3726
3727 // Null terminate
3728 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3729 Fw::TextLogString _logString = _textBuffer;
3730 this->m_LogText_OutputPort[0].invoke(
3731 _id,
3732 _logTime,
3734 _logString
3735 );
3736 }
3737#endif
3738 }
3739
3740 void CmdSequencerComponentBase ::
3741 log_WARNING_HI_CS_UnexpectedCompletion(U32 opcode)
3742 {
3743 // Get the time
3744 Fw::Time _logTime;
3745 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3746 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3747 }
3748
3749 FwEventIdType _id = static_cast<FwEventIdType>(0);
3750
3751 _id = this->getIdBase() + EVENTID_CS_UNEXPECTEDCOMPLETION;
3752
3753 // Emit the event on the log port
3754 if (this->m_logOut_OutputPort[0].isConnected()) {
3755 Fw::LogBuffer _logBuff;
3757
3758#if FW_AMPCS_COMPATIBLE
3759 // Serialize the number of arguments
3760 _status = _logBuff.serialize(static_cast<U8>(1));
3761 FW_ASSERT(
3762 _status == Fw::FW_SERIALIZE_OK,
3763 static_cast<FwAssertArgType>(_status)
3764 );
3765#endif
3766
3767#if FW_AMPCS_COMPATIBLE
3768 // Serialize the argument size
3769 _status = _logBuff.serialize(
3770 static_cast<U8>(sizeof(U32))
3771 );
3772 FW_ASSERT(
3773 _status == Fw::FW_SERIALIZE_OK,
3774 static_cast<FwAssertArgType>(_status)
3775 );
3776#endif
3777 _status = _logBuff.serialize(opcode);
3778 FW_ASSERT(
3779 _status == Fw::FW_SERIALIZE_OK,
3780 static_cast<FwAssertArgType>(_status)
3781 );
3782
3783 this->m_logOut_OutputPort[0].invoke(
3784 _id,
3785 _logTime,
3787 _logBuff
3788 );
3789 }
3790
3791 // Emit the event on the text log port
3792#if FW_ENABLE_TEXT_LOGGING
3793 if (this->m_LogText_OutputPort[0].isConnected()) {
3794#if FW_OBJECT_NAMES == 1
3795 const char* _formatString =
3796 "(%s) %s: Command complete status received while no sequences active. Opcode: %" PRIu32 "";
3797#else
3798 const char* _formatString =
3799 "%s: Command complete status received while no sequences active. Opcode: %" PRIu32 "";
3800#endif
3801
3802 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3803
3804 (void) snprintf(
3805 _textBuffer,
3807 _formatString,
3808#if FW_OBJECT_NAMES == 1
3809 this->m_objName,
3810#endif
3811 "CS_UnexpectedCompletion ",
3812 opcode
3813 );
3814
3815 // Null terminate
3816 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3817 Fw::TextLogString _logString = _textBuffer;
3818 this->m_LogText_OutputPort[0].invoke(
3819 _id,
3820 _logTime,
3822 _logString
3823 );
3824 }
3825#endif
3826 }
3827
3828 void CmdSequencerComponentBase ::
3829 log_ACTIVITY_HI_CS_ModeSwitched(Svc::CmdSequencer_SeqMode mode)
3830 {
3831 // Get the time
3832 Fw::Time _logTime;
3833 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3834 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3835 }
3836
3837 FwEventIdType _id = static_cast<FwEventIdType>(0);
3838
3839 _id = this->getIdBase() + EVENTID_CS_MODESWITCHED;
3840
3841 // Emit the event on the log port
3842 if (this->m_logOut_OutputPort[0].isConnected()) {
3843 Fw::LogBuffer _logBuff;
3845
3846#if FW_AMPCS_COMPATIBLE
3847 // Serialize the number of arguments
3848 _status = _logBuff.serialize(static_cast<U8>(1));
3849 FW_ASSERT(
3850 _status == Fw::FW_SERIALIZE_OK,
3851 static_cast<FwAssertArgType>(_status)
3852 );
3853#endif
3854
3855#if FW_AMPCS_COMPATIBLE
3856 // Serialize the argument size
3857 _status = _logBuff.serialize(
3859 );
3860 FW_ASSERT(
3861 _status == Fw::FW_SERIALIZE_OK,
3862 static_cast<FwAssertArgType>(_status)
3863 );
3864#endif
3865 _status = _logBuff.serialize(mode);
3866 FW_ASSERT(
3867 _status == Fw::FW_SERIALIZE_OK,
3868 static_cast<FwAssertArgType>(_status)
3869 );
3870
3871 this->m_logOut_OutputPort[0].invoke(
3872 _id,
3873 _logTime,
3875 _logBuff
3876 );
3877 }
3878
3879 // Emit the event on the text log port
3880#if FW_ENABLE_TEXT_LOGGING
3881 if (this->m_LogText_OutputPort[0].isConnected()) {
3882#if FW_OBJECT_NAMES == 1
3883 const char* _formatString =
3884 "(%s) %s: Sequencer switched to %s step mode";
3885#else
3886 const char* _formatString =
3887 "%s: Sequencer switched to %s step mode";
3888#endif
3889
3890 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3891
3892 Fw::String modeStr;
3893 mode.toString(modeStr);
3894
3895 (void) snprintf(
3896 _textBuffer,
3898 _formatString,
3899#if FW_OBJECT_NAMES == 1
3900 this->m_objName,
3901#endif
3902 "CS_ModeSwitched ",
3903 modeStr.toChar()
3904 );
3905
3906 // Null terminate
3907 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3908 Fw::TextLogString _logString = _textBuffer;
3909 this->m_LogText_OutputPort[0].invoke(
3910 _id,
3911 _logTime,
3913 _logString
3914 );
3915 }
3916#endif
3917 }
3918
3919 void CmdSequencerComponentBase ::
3920 log_WARNING_LO_CS_NoSequenceActive()
3921 {
3922 // Get the time
3923 Fw::Time _logTime;
3924 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3925 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3926 }
3927
3928 FwEventIdType _id = static_cast<FwEventIdType>(0);
3929
3930 _id = this->getIdBase() + EVENTID_CS_NOSEQUENCEACTIVE;
3931
3932 // Emit the event on the log port
3933 if (this->m_logOut_OutputPort[0].isConnected()) {
3934 Fw::LogBuffer _logBuff;
3935
3936#if FW_AMPCS_COMPATIBLE
3938 // Serialize the number of arguments
3939 _status = _logBuff.serialize(static_cast<U8>(0));
3940 FW_ASSERT(
3941 _status == Fw::FW_SERIALIZE_OK,
3942 static_cast<FwAssertArgType>(_status)
3943 );
3944#endif
3945
3946 this->m_logOut_OutputPort[0].invoke(
3947 _id,
3948 _logTime,
3950 _logBuff
3951 );
3952 }
3953
3954 // Emit the event on the text log port
3955#if FW_ENABLE_TEXT_LOGGING
3956 if (this->m_LogText_OutputPort[0].isConnected()) {
3957#if FW_OBJECT_NAMES == 1
3958 const char* _formatString =
3959 "(%s) %s: No sequence active.";
3960#else
3961 const char* _formatString =
3962 "%s: No sequence active.";
3963#endif
3964
3965 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
3966
3967 (void) snprintf(
3968 _textBuffer,
3970 _formatString,
3971#if FW_OBJECT_NAMES == 1
3972 this->m_objName,
3973#endif
3974 "CS_NoSequenceActive "
3975 );
3976
3977 // Null terminate
3978 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
3979 Fw::TextLogString _logString = _textBuffer;
3980 this->m_LogText_OutputPort[0].invoke(
3981 _id,
3982 _logTime,
3984 _logString
3985 );
3986 }
3987#endif
3988 }
3989
3990 void CmdSequencerComponentBase ::
3991 log_ACTIVITY_HI_CS_SequenceValid(const Fw::LogStringArg& filename)
3992 {
3993 // Get the time
3994 Fw::Time _logTime;
3995 if (this->m_timeCaller_OutputPort[0].isConnected()) {
3996 this->m_timeCaller_OutputPort[0].invoke(_logTime);
3997 }
3998
3999 FwEventIdType _id = static_cast<FwEventIdType>(0);
4000
4001 _id = this->getIdBase() + EVENTID_CS_SEQUENCEVALID;
4002
4003 // Emit the event on the log port
4004 if (this->m_logOut_OutputPort[0].isConnected()) {
4005 Fw::LogBuffer _logBuff;
4007
4008#if FW_AMPCS_COMPATIBLE
4009 // Serialize the number of arguments
4010 _status = _logBuff.serialize(static_cast<U8>(1));
4011 FW_ASSERT(
4012 _status == Fw::FW_SERIALIZE_OK,
4013 static_cast<FwAssertArgType>(_status)
4014 );
4015#endif
4016
4017 _status = filename.serialize(_logBuff, 60);
4018 FW_ASSERT(
4019 _status == Fw::FW_SERIALIZE_OK,
4020 static_cast<FwAssertArgType>(_status)
4021 );
4022
4023 this->m_logOut_OutputPort[0].invoke(
4024 _id,
4025 _logTime,
4027 _logBuff
4028 );
4029 }
4030
4031 // Emit the event on the text log port
4032#if FW_ENABLE_TEXT_LOGGING
4033 if (this->m_LogText_OutputPort[0].isConnected()) {
4034#if FW_OBJECT_NAMES == 1
4035 const char* _formatString =
4036 "(%s) %s: Sequence %s is valid.";
4037#else
4038 const char* _formatString =
4039 "%s: Sequence %s is valid.";
4040#endif
4041
4042 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
4043
4044 (void) snprintf(
4045 _textBuffer,
4047 _formatString,
4048#if FW_OBJECT_NAMES == 1
4049 this->m_objName,
4050#endif
4051 "CS_SequenceValid ",
4052 filename.toChar()
4053 );
4054
4055 // Null terminate
4056 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
4057 Fw::TextLogString _logString = _textBuffer;
4058 this->m_LogText_OutputPort[0].invoke(
4059 _id,
4060 _logTime,
4062 _logString
4063 );
4064 }
4065#endif
4066 }
4067
4068 void CmdSequencerComponentBase ::
4069 log_WARNING_HI_CS_SequenceTimeout(
4070 const Fw::LogStringArg& filename,
4071 U32 command
4072 )
4073 {
4074 // Get the time
4075 Fw::Time _logTime;
4076 if (this->m_timeCaller_OutputPort[0].isConnected()) {
4077 this->m_timeCaller_OutputPort[0].invoke(_logTime);
4078 }
4079
4080 FwEventIdType _id = static_cast<FwEventIdType>(0);
4081
4082 _id = this->getIdBase() + EVENTID_CS_SEQUENCETIMEOUT;
4083
4084 // Emit the event on the log port
4085 if (this->m_logOut_OutputPort[0].isConnected()) {
4086 Fw::LogBuffer _logBuff;
4088
4089#if FW_AMPCS_COMPATIBLE
4090 // Serialize the number of arguments
4091 _status = _logBuff.serialize(static_cast<U8>(2));
4092 FW_ASSERT(
4093 _status == Fw::FW_SERIALIZE_OK,
4094 static_cast<FwAssertArgType>(_status)
4095 );
4096#endif
4097
4098 _status = filename.serialize(_logBuff, 60);
4099 FW_ASSERT(
4100 _status == Fw::FW_SERIALIZE_OK,
4101 static_cast<FwAssertArgType>(_status)
4102 );
4103
4104#if FW_AMPCS_COMPATIBLE
4105 // Serialize the argument size
4106 _status = _logBuff.serialize(
4107 static_cast<U8>(sizeof(U32))
4108 );
4109 FW_ASSERT(
4110 _status == Fw::FW_SERIALIZE_OK,
4111 static_cast<FwAssertArgType>(_status)
4112 );
4113#endif
4114 _status = _logBuff.serialize(command);
4115 FW_ASSERT(
4116 _status == Fw::FW_SERIALIZE_OK,
4117 static_cast<FwAssertArgType>(_status)
4118 );
4119
4120 this->m_logOut_OutputPort[0].invoke(
4121 _id,
4122 _logTime,
4124 _logBuff
4125 );
4126 }
4127
4128 // Emit the event on the text log port
4129#if FW_ENABLE_TEXT_LOGGING
4130 if (this->m_LogText_OutputPort[0].isConnected()) {
4131#if FW_OBJECT_NAMES == 1
4132 const char* _formatString =
4133 "(%s) %s: Sequence %s timed out on command %" PRIu32 "";
4134#else
4135 const char* _formatString =
4136 "%s: Sequence %s timed out on command %" PRIu32 "";
4137#endif
4138
4139 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
4140
4141 (void) snprintf(
4142 _textBuffer,
4144 _formatString,
4145#if FW_OBJECT_NAMES == 1
4146 this->m_objName,
4147#endif
4148 "CS_SequenceTimeout ",
4149 filename.toChar(),
4150 command
4151 );
4152
4153 // Null terminate
4154 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
4155 Fw::TextLogString _logString = _textBuffer;
4156 this->m_LogText_OutputPort[0].invoke(
4157 _id,
4158 _logTime,
4160 _logString
4161 );
4162 }
4163#endif
4164 }
4165
4166 void CmdSequencerComponentBase ::
4167 log_ACTIVITY_HI_CS_CmdStepped(
4168 const Fw::LogStringArg& filename,
4169 U32 command
4170 )
4171 {
4172 // Get the time
4173 Fw::Time _logTime;
4174 if (this->m_timeCaller_OutputPort[0].isConnected()) {
4175 this->m_timeCaller_OutputPort[0].invoke(_logTime);
4176 }
4177
4178 FwEventIdType _id = static_cast<FwEventIdType>(0);
4179
4180 _id = this->getIdBase() + EVENTID_CS_CMDSTEPPED;
4181
4182 // Emit the event on the log port
4183 if (this->m_logOut_OutputPort[0].isConnected()) {
4184 Fw::LogBuffer _logBuff;
4186
4187#if FW_AMPCS_COMPATIBLE
4188 // Serialize the number of arguments
4189 _status = _logBuff.serialize(static_cast<U8>(2));
4190 FW_ASSERT(
4191 _status == Fw::FW_SERIALIZE_OK,
4192 static_cast<FwAssertArgType>(_status)
4193 );
4194#endif
4195
4196 _status = filename.serialize(_logBuff, 60);
4197 FW_ASSERT(
4198 _status == Fw::FW_SERIALIZE_OK,
4199 static_cast<FwAssertArgType>(_status)
4200 );
4201
4202#if FW_AMPCS_COMPATIBLE
4203 // Serialize the argument size
4204 _status = _logBuff.serialize(
4205 static_cast<U8>(sizeof(U32))
4206 );
4207 FW_ASSERT(
4208 _status == Fw::FW_SERIALIZE_OK,
4209 static_cast<FwAssertArgType>(_status)
4210 );
4211#endif
4212 _status = _logBuff.serialize(command);
4213 FW_ASSERT(
4214 _status == Fw::FW_SERIALIZE_OK,
4215 static_cast<FwAssertArgType>(_status)
4216 );
4217
4218 this->m_logOut_OutputPort[0].invoke(
4219 _id,
4220 _logTime,
4222 _logBuff
4223 );
4224 }
4225
4226 // Emit the event on the text log port
4227#if FW_ENABLE_TEXT_LOGGING
4228 if (this->m_LogText_OutputPort[0].isConnected()) {
4229#if FW_OBJECT_NAMES == 1
4230 const char* _formatString =
4231 "(%s) %s: Sequence %s command %" PRIu32 " stepped";
4232#else
4233 const char* _formatString =
4234 "%s: Sequence %s command %" PRIu32 " stepped";
4235#endif
4236
4237 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
4238
4239 (void) snprintf(
4240 _textBuffer,
4242 _formatString,
4243#if FW_OBJECT_NAMES == 1
4244 this->m_objName,
4245#endif
4246 "CS_CmdStepped ",
4247 filename.toChar(),
4248 command
4249 );
4250
4251 // Null terminate
4252 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
4253 Fw::TextLogString _logString = _textBuffer;
4254 this->m_LogText_OutputPort[0].invoke(
4255 _id,
4256 _logTime,
4258 _logString
4259 );
4260 }
4261#endif
4262 }
4263
4264 void CmdSequencerComponentBase ::
4265 log_ACTIVITY_HI_CS_CmdStarted(const Fw::LogStringArg& filename)
4266 {
4267 // Get the time
4268 Fw::Time _logTime;
4269 if (this->m_timeCaller_OutputPort[0].isConnected()) {
4270 this->m_timeCaller_OutputPort[0].invoke(_logTime);
4271 }
4272
4273 FwEventIdType _id = static_cast<FwEventIdType>(0);
4274
4275 _id = this->getIdBase() + EVENTID_CS_CMDSTARTED;
4276
4277 // Emit the event on the log port
4278 if (this->m_logOut_OutputPort[0].isConnected()) {
4279 Fw::LogBuffer _logBuff;
4281
4282#if FW_AMPCS_COMPATIBLE
4283 // Serialize the number of arguments
4284 _status = _logBuff.serialize(static_cast<U8>(1));
4285 FW_ASSERT(
4286 _status == Fw::FW_SERIALIZE_OK,
4287 static_cast<FwAssertArgType>(_status)
4288 );
4289#endif
4290
4291 _status = filename.serialize(_logBuff, 60);
4292 FW_ASSERT(
4293 _status == Fw::FW_SERIALIZE_OK,
4294 static_cast<FwAssertArgType>(_status)
4295 );
4296
4297 this->m_logOut_OutputPort[0].invoke(
4298 _id,
4299 _logTime,
4301 _logBuff
4302 );
4303 }
4304
4305 // Emit the event on the text log port
4306#if FW_ENABLE_TEXT_LOGGING
4307 if (this->m_LogText_OutputPort[0].isConnected()) {
4308#if FW_OBJECT_NAMES == 1
4309 const char* _formatString =
4310 "(%s) %s: Sequence %s started";
4311#else
4312 const char* _formatString =
4313 "%s: Sequence %s started";
4314#endif
4315
4316 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
4317
4318 (void) snprintf(
4319 _textBuffer,
4321 _formatString,
4322#if FW_OBJECT_NAMES == 1
4323 this->m_objName,
4324#endif
4325 "CS_CmdStarted ",
4326 filename.toChar()
4327 );
4328
4329 // Null terminate
4330 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
4331 Fw::TextLogString _logString = _textBuffer;
4332 this->m_LogText_OutputPort[0].invoke(
4333 _id,
4334 _logTime,
4336 _logString
4337 );
4338 }
4339#endif
4340 }
4341
4342 void CmdSequencerComponentBase ::
4343 log_ACTIVITY_HI_CS_JoinWaiting(
4344 const Fw::LogStringArg& filename,
4345 U32 recordNumber,
4346 U32 opCode
4347 )
4348 {
4349 // Get the time
4350 Fw::Time _logTime;
4351 if (this->m_timeCaller_OutputPort[0].isConnected()) {
4352 this->m_timeCaller_OutputPort[0].invoke(_logTime);
4353 }
4354
4355 FwEventIdType _id = static_cast<FwEventIdType>(0);
4356
4357 _id = this->getIdBase() + EVENTID_CS_JOINWAITING;
4358
4359 // Emit the event on the log port
4360 if (this->m_logOut_OutputPort[0].isConnected()) {
4361 Fw::LogBuffer _logBuff;
4363
4364#if FW_AMPCS_COMPATIBLE
4365 // Serialize the number of arguments
4366 _status = _logBuff.serialize(static_cast<U8>(3));
4367 FW_ASSERT(
4368 _status == Fw::FW_SERIALIZE_OK,
4369 static_cast<FwAssertArgType>(_status)
4370 );
4371#endif
4372
4373 _status = filename.serialize(_logBuff, 60);
4374 FW_ASSERT(
4375 _status == Fw::FW_SERIALIZE_OK,
4376 static_cast<FwAssertArgType>(_status)
4377 );
4378
4379#if FW_AMPCS_COMPATIBLE
4380 // Serialize the argument size
4381 _status = _logBuff.serialize(
4382 static_cast<U8>(sizeof(U32))
4383 );
4384 FW_ASSERT(
4385 _status == Fw::FW_SERIALIZE_OK,
4386 static_cast<FwAssertArgType>(_status)
4387 );
4388#endif
4389 _status = _logBuff.serialize(recordNumber);
4390 FW_ASSERT(
4391 _status == Fw::FW_SERIALIZE_OK,
4392 static_cast<FwAssertArgType>(_status)
4393 );
4394
4395#if FW_AMPCS_COMPATIBLE
4396 // Serialize the argument size
4397 _status = _logBuff.serialize(
4398 static_cast<U8>(sizeof(U32))
4399 );
4400 FW_ASSERT(
4401 _status == Fw::FW_SERIALIZE_OK,
4402 static_cast<FwAssertArgType>(_status)
4403 );
4404#endif
4405 _status = _logBuff.serialize(opCode);
4406 FW_ASSERT(
4407 _status == Fw::FW_SERIALIZE_OK,
4408 static_cast<FwAssertArgType>(_status)
4409 );
4410
4411 this->m_logOut_OutputPort[0].invoke(
4412 _id,
4413 _logTime,
4415 _logBuff
4416 );
4417 }
4418
4419 // Emit the event on the text log port
4420#if FW_ENABLE_TEXT_LOGGING
4421 if (this->m_LogText_OutputPort[0].isConnected()) {
4422#if FW_OBJECT_NAMES == 1
4423 const char* _formatString =
4424 "(%s) %s: Start waiting for sequence file %s: Command %" PRIu32 " (opcode %" PRIu32 ") to complete";
4425#else
4426 const char* _formatString =
4427 "%s: Start waiting for sequence file %s: Command %" PRIu32 " (opcode %" PRIu32 ") to complete";
4428#endif
4429
4430 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
4431
4432 (void) snprintf(
4433 _textBuffer,
4435 _formatString,
4436#if FW_OBJECT_NAMES == 1
4437 this->m_objName,
4438#endif
4439 "CS_JoinWaiting ",
4440 filename.toChar(),
4441 recordNumber,
4442 opCode
4443 );
4444
4445 // Null terminate
4446 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
4447 Fw::TextLogString _logString = _textBuffer;
4448 this->m_LogText_OutputPort[0].invoke(
4449 _id,
4450 _logTime,
4452 _logString
4453 );
4454 }
4455#endif
4456 }
4457
4458 void CmdSequencerComponentBase ::
4459 log_WARNING_HI_CS_JoinWaitingNotComplete()
4460 {
4461 // Get the time
4462 Fw::Time _logTime;
4463 if (this->m_timeCaller_OutputPort[0].isConnected()) {
4464 this->m_timeCaller_OutputPort[0].invoke(_logTime);
4465 }
4466
4467 FwEventIdType _id = static_cast<FwEventIdType>(0);
4468
4469 _id = this->getIdBase() + EVENTID_CS_JOINWAITINGNOTCOMPLETE;
4470
4471 // Emit the event on the log port
4472 if (this->m_logOut_OutputPort[0].isConnected()) {
4473 Fw::LogBuffer _logBuff;
4474
4475#if FW_AMPCS_COMPATIBLE
4477 // Serialize the number of arguments
4478 _status = _logBuff.serialize(static_cast<U8>(0));
4479 FW_ASSERT(
4480 _status == Fw::FW_SERIALIZE_OK,
4481 static_cast<FwAssertArgType>(_status)
4482 );
4483#endif
4484
4485 this->m_logOut_OutputPort[0].invoke(
4486 _id,
4487 _logTime,
4489 _logBuff
4490 );
4491 }
4492
4493 // Emit the event on the text log port
4494#if FW_ENABLE_TEXT_LOGGING
4495 if (this->m_LogText_OutputPort[0].isConnected()) {
4496#if FW_OBJECT_NAMES == 1
4497 const char* _formatString =
4498 "(%s) %s: Still waiting for sequence file to complete";
4499#else
4500 const char* _formatString =
4501 "%s: Still waiting for sequence file to complete";
4502#endif
4503
4504 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
4505
4506 (void) snprintf(
4507 _textBuffer,
4509 _formatString,
4510#if FW_OBJECT_NAMES == 1
4511 this->m_objName,
4512#endif
4513 "CS_JoinWaitingNotComplete "
4514 );
4515
4516 // Null terminate
4517 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
4518 Fw::TextLogString _logString = _textBuffer;
4519 this->m_LogText_OutputPort[0].invoke(
4520 _id,
4521 _logTime,
4523 _logString
4524 );
4525 }
4526#endif
4527 }
4528
4529 // ----------------------------------------------------------------------
4530 // Telemetry write functions
4531 // ----------------------------------------------------------------------
4532
4533 void CmdSequencerComponentBase ::
4534 tlmWrite_CS_LoadCommands(
4535 U32 arg,
4536 Fw::Time _tlmTime
4537 )
4538 {
4539 if (this->m_tlmOut_OutputPort[0].isConnected()) {
4540 if (
4541 this->m_timeCaller_OutputPort[0].isConnected() &&
4542 (_tlmTime == Fw::ZERO_TIME)
4543 ) {
4544 this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
4545 }
4546
4547 Fw::TlmBuffer _tlmBuff;
4548 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
4549 FW_ASSERT(
4550 _stat == Fw::FW_SERIALIZE_OK,
4551 static_cast<FwAssertArgType>(_stat)
4552 );
4553
4554 FwChanIdType _id;
4555
4556 _id = this->getIdBase() + CHANNELID_CS_LOADCOMMANDS;
4557
4558 this->m_tlmOut_OutputPort[0].invoke(
4559 _id,
4560 _tlmTime,
4561 _tlmBuff
4562 );
4563 }
4564 }
4565
4566 void CmdSequencerComponentBase ::
4567 tlmWrite_CS_CancelCommands(
4568 U32 arg,
4569 Fw::Time _tlmTime
4570 )
4571 {
4572 if (this->m_tlmOut_OutputPort[0].isConnected()) {
4573 if (
4574 this->m_timeCaller_OutputPort[0].isConnected() &&
4575 (_tlmTime == Fw::ZERO_TIME)
4576 ) {
4577 this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
4578 }
4579
4580 Fw::TlmBuffer _tlmBuff;
4581 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
4582 FW_ASSERT(
4583 _stat == Fw::FW_SERIALIZE_OK,
4584 static_cast<FwAssertArgType>(_stat)
4585 );
4586
4587 FwChanIdType _id;
4588
4589 _id = this->getIdBase() + CHANNELID_CS_CANCELCOMMANDS;
4590
4591 this->m_tlmOut_OutputPort[0].invoke(
4592 _id,
4593 _tlmTime,
4594 _tlmBuff
4595 );
4596 }
4597 }
4598
4599 void CmdSequencerComponentBase ::
4600 tlmWrite_CS_Errors(
4601 U32 arg,
4602 Fw::Time _tlmTime
4603 )
4604 {
4605 if (this->m_tlmOut_OutputPort[0].isConnected()) {
4606 if (
4607 this->m_timeCaller_OutputPort[0].isConnected() &&
4608 (_tlmTime == Fw::ZERO_TIME)
4609 ) {
4610 this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
4611 }
4612
4613 Fw::TlmBuffer _tlmBuff;
4614 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
4615 FW_ASSERT(
4616 _stat == Fw::FW_SERIALIZE_OK,
4617 static_cast<FwAssertArgType>(_stat)
4618 );
4619
4620 FwChanIdType _id;
4621
4622 _id = this->getIdBase() + CHANNELID_CS_ERRORS;
4623
4624 this->m_tlmOut_OutputPort[0].invoke(
4625 _id,
4626 _tlmTime,
4627 _tlmBuff
4628 );
4629 }
4630 }
4631
4632 void CmdSequencerComponentBase ::
4633 tlmWrite_CS_CommandsExecuted(
4634 U32 arg,
4635 Fw::Time _tlmTime
4636 )
4637 {
4638 if (this->m_tlmOut_OutputPort[0].isConnected()) {
4639 if (
4640 this->m_timeCaller_OutputPort[0].isConnected() &&
4641 (_tlmTime == Fw::ZERO_TIME)
4642 ) {
4643 this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
4644 }
4645
4646 Fw::TlmBuffer _tlmBuff;
4647 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
4648 FW_ASSERT(
4649 _stat == Fw::FW_SERIALIZE_OK,
4650 static_cast<FwAssertArgType>(_stat)
4651 );
4652
4653 FwChanIdType _id;
4654
4655 _id = this->getIdBase() + CHANNELID_CS_COMMANDSEXECUTED;
4656
4657 this->m_tlmOut_OutputPort[0].invoke(
4658 _id,
4659 _tlmTime,
4660 _tlmBuff
4661 );
4662 }
4663 }
4664
4665 void CmdSequencerComponentBase ::
4666 tlmWrite_CS_SequencesCompleted(
4667 U32 arg,
4668 Fw::Time _tlmTime
4669 )
4670 {
4671 if (this->m_tlmOut_OutputPort[0].isConnected()) {
4672 if (
4673 this->m_timeCaller_OutputPort[0].isConnected() &&
4674 (_tlmTime == Fw::ZERO_TIME)
4675 ) {
4676 this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
4677 }
4678
4679 Fw::TlmBuffer _tlmBuff;
4680 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
4681 FW_ASSERT(
4682 _stat == Fw::FW_SERIALIZE_OK,
4683 static_cast<FwAssertArgType>(_stat)
4684 );
4685
4686 FwChanIdType _id;
4687
4688 _id = this->getIdBase() + CHANNELID_CS_SEQUENCESCOMPLETED;
4689
4690 this->m_tlmOut_OutputPort[0].invoke(
4691 _id,
4692 _tlmTime,
4693 _tlmBuff
4694 );
4695 }
4696 }
4697
4698 // ----------------------------------------------------------------------
4699 // Time
4700 // ----------------------------------------------------------------------
4701
4702 Fw::Time CmdSequencerComponentBase ::
4703 getTime()
4704 {
4705 if (this->m_timeCaller_OutputPort[0].isConnected()) {
4706 Fw::Time _time;
4707 this->m_timeCaller_OutputPort[0].invoke(_time);
4708 return _time;
4709 }
4710 else {
4711 return Fw::Time(TB_NONE, 0, 0);
4712 }
4713 }
4714
4715 // ----------------------------------------------------------------------
4716 // Message dispatch functions
4717 // ----------------------------------------------------------------------
4718
4719 Fw::QueuedComponentBase::MsgDispatchStatus CmdSequencerComponentBase ::
4720 doDispatch()
4721 {
4722 ComponentIpcSerializableBuffer msg;
4723 NATIVE_INT_TYPE priority = 0;
4724
4725 Os::Queue::QueueStatus msgStatus = this->m_queue.receive(
4726 msg,
4727 priority,
4729 );
4730 FW_ASSERT(
4731 msgStatus == Os::Queue::QUEUE_OK,
4732 static_cast<FwAssertArgType>(msgStatus)
4733 );
4734
4735 // Reset to beginning of buffer
4736 msg.resetDeser();
4737
4738 NATIVE_INT_TYPE desMsg = 0;
4739 Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
4740 FW_ASSERT(
4741 deserStatus == Fw::FW_SERIALIZE_OK,
4742 static_cast<FwAssertArgType>(deserStatus)
4743 );
4744
4745 MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
4746
4747 if (msgType == CMDSEQUENCER_COMPONENT_EXIT) {
4748 return MSG_DISPATCH_EXIT;
4749 }
4750
4751 NATIVE_INT_TYPE portNum = 0;
4752 deserStatus = msg.deserialize(portNum);
4753 FW_ASSERT(
4754 deserStatus == Fw::FW_SERIALIZE_OK,
4755 static_cast<FwAssertArgType>(deserStatus)
4756 );
4757
4758 switch (msgType) {
4759 // Handle async input port cmdResponseIn
4760 case CMDRESPONSEIN_CMDRESPONSE: {
4761 // Deserialize argument opCode
4762 FwOpcodeType opCode;
4763 deserStatus = msg.deserialize(opCode);
4764 FW_ASSERT(
4765 deserStatus == Fw::FW_SERIALIZE_OK,
4766 static_cast<FwAssertArgType>(deserStatus)
4767 );
4768
4769 // Deserialize argument cmdSeq
4770 U32 cmdSeq;
4771 deserStatus = msg.deserialize(cmdSeq);
4772 FW_ASSERT(
4773 deserStatus == Fw::FW_SERIALIZE_OK,
4774 static_cast<FwAssertArgType>(deserStatus)
4775 );
4776
4777 // Deserialize argument response
4778 Fw::CmdResponse response;
4779 deserStatus = msg.deserialize(response);
4780 FW_ASSERT(
4781 deserStatus == Fw::FW_SERIALIZE_OK,
4782 static_cast<FwAssertArgType>(deserStatus)
4783 );
4784 // Call handler function
4785 this->cmdResponseIn_handler(
4786 portNum,
4787 opCode,
4788 cmdSeq,
4789 response
4790 );
4791
4792 break;
4793 }
4794
4795 // Handle async input port pingIn
4796 case PINGIN_PING: {
4797 // Deserialize argument key
4798 U32 key;
4799 deserStatus = msg.deserialize(key);
4800 FW_ASSERT(
4801 deserStatus == Fw::FW_SERIALIZE_OK,
4802 static_cast<FwAssertArgType>(deserStatus)
4803 );
4804 // Call handler function
4805 this->pingIn_handler(
4806 portNum,
4807 key
4808 );
4809
4810 break;
4811 }
4812
4813 // Handle async input port schedIn
4814 case SCHEDIN_SCHED: {
4815 // Deserialize argument context
4816 NATIVE_UINT_TYPE context;
4817 deserStatus = msg.deserialize(context);
4818 FW_ASSERT(
4819 deserStatus == Fw::FW_SERIALIZE_OK,
4820 static_cast<FwAssertArgType>(deserStatus)
4821 );
4822 // Call handler function
4823 this->schedIn_handler(
4824 portNum,
4825 context
4826 );
4827
4828 break;
4829 }
4830
4831 // Handle async input port seqCancelIn
4832 case SEQCANCELIN_CMDSEQCANCEL: {
4833 // Call handler function
4834 this->seqCancelIn_handler(portNum);
4835
4836 break;
4837 }
4838
4839 // Handle async input port seqRunIn
4840 case SEQRUNIN_CMDSEQIN: {
4841 // Deserialize argument filename
4842 Fw::String filename;
4843 deserStatus = msg.deserialize(filename);
4844 FW_ASSERT(
4845 deserStatus == Fw::FW_SERIALIZE_OK,
4846 static_cast<FwAssertArgType>(deserStatus)
4847 );
4848 // Call handler function
4849 this->seqRunIn_handler(
4850 portNum,
4851 filename
4852 );
4853
4854 break;
4855 }
4856
4857 // Handle command CS_RUN
4858 case CMD_CS_RUN: {
4859 // Deserialize opcode
4860 FwOpcodeType opCode = 0;
4861 deserStatus = msg.deserialize(opCode);
4862 FW_ASSERT (
4863 deserStatus == Fw::FW_SERIALIZE_OK,
4864 static_cast<FwAssertArgType>(deserStatus)
4865 );
4866
4867 // Deserialize command sequence
4868 U32 cmdSeq = 0;
4869 deserStatus = msg.deserialize(cmdSeq);
4870 FW_ASSERT (
4871 deserStatus == Fw::FW_SERIALIZE_OK,
4872 static_cast<FwAssertArgType>(deserStatus)
4873 );
4874
4875 // Deserialize command argument buffer
4876 Fw::CmdArgBuffer args;
4877 deserStatus = msg.deserialize(args);
4878 FW_ASSERT (
4879 deserStatus == Fw::FW_SERIALIZE_OK,
4880 static_cast<FwAssertArgType>(deserStatus)
4881 );
4882
4883 // Reset buffer
4884 args.resetDeser();
4885
4886 // Deserialize argument fileName
4887 Fw::CmdStringArg fileName;
4888 deserStatus = args.deserialize(fileName);
4889 if (deserStatus != Fw::FW_SERIALIZE_OK) {
4890 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
4891 this->cmdResponse_out(
4892 opCode,
4893 cmdSeq,
4895 );
4896 }
4897 // Don't crash the task if bad arguments were passed from the ground
4898 break;
4899 }
4900
4901 // Deserialize argument block
4903 deserStatus = args.deserialize(block);
4904 if (deserStatus != Fw::FW_SERIALIZE_OK) {
4905 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
4906 this->cmdResponse_out(
4907 opCode,
4908 cmdSeq,
4910 );
4911 }
4912 // Don't crash the task if bad arguments were passed from the ground
4913 break;
4914 }
4915
4916 // Make sure there was no data left over.
4917 // That means the argument buffer size was incorrect.
4918#if FW_CMD_CHECK_RESIDUAL
4919 if (args.getBuffLeft() != 0) {
4920 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
4921 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
4922 }
4923 // Don't crash the task if bad arguments were passed from the ground
4924 break;
4925 }
4926#endif
4927
4928 // Call handler function
4929 this->CS_RUN_cmdHandler(
4930 opCode, cmdSeq,
4931 fileName,
4932 block
4933 );
4934
4935 break;
4936 }
4937
4938 // Handle command CS_VALIDATE
4939 case CMD_CS_VALIDATE: {
4940 // Deserialize opcode
4941 FwOpcodeType opCode = 0;
4942 deserStatus = msg.deserialize(opCode);
4943 FW_ASSERT (
4944 deserStatus == Fw::FW_SERIALIZE_OK,
4945 static_cast<FwAssertArgType>(deserStatus)
4946 );
4947
4948 // Deserialize command sequence
4949 U32 cmdSeq = 0;
4950 deserStatus = msg.deserialize(cmdSeq);
4951 FW_ASSERT (
4952 deserStatus == Fw::FW_SERIALIZE_OK,
4953 static_cast<FwAssertArgType>(deserStatus)
4954 );
4955
4956 // Deserialize command argument buffer
4957 Fw::CmdArgBuffer args;
4958 deserStatus = msg.deserialize(args);
4959 FW_ASSERT (
4960 deserStatus == Fw::FW_SERIALIZE_OK,
4961 static_cast<FwAssertArgType>(deserStatus)
4962 );
4963
4964 // Reset buffer
4965 args.resetDeser();
4966
4967 // Deserialize argument fileName
4968 Fw::CmdStringArg fileName;
4969 deserStatus = args.deserialize(fileName);
4970 if (deserStatus != Fw::FW_SERIALIZE_OK) {
4971 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
4972 this->cmdResponse_out(
4973 opCode,
4974 cmdSeq,
4976 );
4977 }
4978 // Don't crash the task if bad arguments were passed from the ground
4979 break;
4980 }
4981
4982 // Make sure there was no data left over.
4983 // That means the argument buffer size was incorrect.
4984#if FW_CMD_CHECK_RESIDUAL
4985 if (args.getBuffLeft() != 0) {
4986 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
4987 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
4988 }
4989 // Don't crash the task if bad arguments were passed from the ground
4990 break;
4991 }
4992#endif
4993
4994 // Call handler function
4995 this->CS_VALIDATE_cmdHandler(
4996 opCode, cmdSeq,
4997 fileName
4998 );
4999
5000 break;
5001 }
5002
5003 // Handle command CS_CANCEL
5004 case CMD_CS_CANCEL: {
5005 // Deserialize opcode
5006 FwOpcodeType opCode = 0;
5007 deserStatus = msg.deserialize(opCode);
5008 FW_ASSERT (
5009 deserStatus == Fw::FW_SERIALIZE_OK,
5010 static_cast<FwAssertArgType>(deserStatus)
5011 );
5012
5013 // Deserialize command sequence
5014 U32 cmdSeq = 0;
5015 deserStatus = msg.deserialize(cmdSeq);
5016 FW_ASSERT (
5017 deserStatus == Fw::FW_SERIALIZE_OK,
5018 static_cast<FwAssertArgType>(deserStatus)
5019 );
5020
5021 // Deserialize command argument buffer
5022 Fw::CmdArgBuffer args;
5023 deserStatus = msg.deserialize(args);
5024 FW_ASSERT (
5025 deserStatus == Fw::FW_SERIALIZE_OK,
5026 static_cast<FwAssertArgType>(deserStatus)
5027 );
5028
5029 // Reset buffer
5030 args.resetDeser();
5031
5032 // Make sure there was no data left over.
5033 // That means the argument buffer size was incorrect.
5034#if FW_CMD_CHECK_RESIDUAL
5035 if (args.getBuffLeft() != 0) {
5036 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
5037 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
5038 }
5039 // Don't crash the task if bad arguments were passed from the ground
5040 break;
5041 }
5042#endif
5043
5044 // Call handler function
5045 this->CS_CANCEL_cmdHandler(opCode, cmdSeq);
5046
5047 break;
5048 }
5049
5050 // Handle command CS_START
5051 case CMD_CS_START: {
5052 // Deserialize opcode
5053 FwOpcodeType opCode = 0;
5054 deserStatus = msg.deserialize(opCode);
5055 FW_ASSERT (
5056 deserStatus == Fw::FW_SERIALIZE_OK,
5057 static_cast<FwAssertArgType>(deserStatus)
5058 );
5059
5060 // Deserialize command sequence
5061 U32 cmdSeq = 0;
5062 deserStatus = msg.deserialize(cmdSeq);
5063 FW_ASSERT (
5064 deserStatus == Fw::FW_SERIALIZE_OK,
5065 static_cast<FwAssertArgType>(deserStatus)
5066 );
5067
5068 // Deserialize command argument buffer
5069 Fw::CmdArgBuffer args;
5070 deserStatus = msg.deserialize(args);
5071 FW_ASSERT (
5072 deserStatus == Fw::FW_SERIALIZE_OK,
5073 static_cast<FwAssertArgType>(deserStatus)
5074 );
5075
5076 // Reset buffer
5077 args.resetDeser();
5078
5079 // Make sure there was no data left over.
5080 // That means the argument buffer size was incorrect.
5081#if FW_CMD_CHECK_RESIDUAL
5082 if (args.getBuffLeft() != 0) {
5083 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
5084 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
5085 }
5086 // Don't crash the task if bad arguments were passed from the ground
5087 break;
5088 }
5089#endif
5090
5091 // Call handler function
5092 this->CS_START_cmdHandler(opCode, cmdSeq);
5093
5094 break;
5095 }
5096
5097 // Handle command CS_STEP
5098 case CMD_CS_STEP: {
5099 // Deserialize opcode
5100 FwOpcodeType opCode = 0;
5101 deserStatus = msg.deserialize(opCode);
5102 FW_ASSERT (
5103 deserStatus == Fw::FW_SERIALIZE_OK,
5104 static_cast<FwAssertArgType>(deserStatus)
5105 );
5106
5107 // Deserialize command sequence
5108 U32 cmdSeq = 0;
5109 deserStatus = msg.deserialize(cmdSeq);
5110 FW_ASSERT (
5111 deserStatus == Fw::FW_SERIALIZE_OK,
5112 static_cast<FwAssertArgType>(deserStatus)
5113 );
5114
5115 // Deserialize command argument buffer
5116 Fw::CmdArgBuffer args;
5117 deserStatus = msg.deserialize(args);
5118 FW_ASSERT (
5119 deserStatus == Fw::FW_SERIALIZE_OK,
5120 static_cast<FwAssertArgType>(deserStatus)
5121 );
5122
5123 // Reset buffer
5124 args.resetDeser();
5125
5126 // Make sure there was no data left over.
5127 // That means the argument buffer size was incorrect.
5128#if FW_CMD_CHECK_RESIDUAL
5129 if (args.getBuffLeft() != 0) {
5130 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
5131 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
5132 }
5133 // Don't crash the task if bad arguments were passed from the ground
5134 break;
5135 }
5136#endif
5137
5138 // Call handler function
5139 this->CS_STEP_cmdHandler(opCode, cmdSeq);
5140
5141 break;
5142 }
5143
5144 // Handle command CS_AUTO
5145 case CMD_CS_AUTO: {
5146 // Deserialize opcode
5147 FwOpcodeType opCode = 0;
5148 deserStatus = msg.deserialize(opCode);
5149 FW_ASSERT (
5150 deserStatus == Fw::FW_SERIALIZE_OK,
5151 static_cast<FwAssertArgType>(deserStatus)
5152 );
5153
5154 // Deserialize command sequence
5155 U32 cmdSeq = 0;
5156 deserStatus = msg.deserialize(cmdSeq);
5157 FW_ASSERT (
5158 deserStatus == Fw::FW_SERIALIZE_OK,
5159 static_cast<FwAssertArgType>(deserStatus)
5160 );
5161
5162 // Deserialize command argument buffer
5163 Fw::CmdArgBuffer args;
5164 deserStatus = msg.deserialize(args);
5165 FW_ASSERT (
5166 deserStatus == Fw::FW_SERIALIZE_OK,
5167 static_cast<FwAssertArgType>(deserStatus)
5168 );
5169
5170 // Reset buffer
5171 args.resetDeser();
5172
5173 // Make sure there was no data left over.
5174 // That means the argument buffer size was incorrect.
5175#if FW_CMD_CHECK_RESIDUAL
5176 if (args.getBuffLeft() != 0) {
5177 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
5178 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
5179 }
5180 // Don't crash the task if bad arguments were passed from the ground
5181 break;
5182 }
5183#endif
5184
5185 // Call handler function
5186 this->CS_AUTO_cmdHandler(opCode, cmdSeq);
5187
5188 break;
5189 }
5190
5191 // Handle command CS_MANUAL
5192 case CMD_CS_MANUAL: {
5193 // Deserialize opcode
5194 FwOpcodeType opCode = 0;
5195 deserStatus = msg.deserialize(opCode);
5196 FW_ASSERT (
5197 deserStatus == Fw::FW_SERIALIZE_OK,
5198 static_cast<FwAssertArgType>(deserStatus)
5199 );
5200
5201 // Deserialize command sequence
5202 U32 cmdSeq = 0;
5203 deserStatus = msg.deserialize(cmdSeq);
5204 FW_ASSERT (
5205 deserStatus == Fw::FW_SERIALIZE_OK,
5206 static_cast<FwAssertArgType>(deserStatus)
5207 );
5208
5209 // Deserialize command argument buffer
5210 Fw::CmdArgBuffer args;
5211 deserStatus = msg.deserialize(args);
5212 FW_ASSERT (
5213 deserStatus == Fw::FW_SERIALIZE_OK,
5214 static_cast<FwAssertArgType>(deserStatus)
5215 );
5216
5217 // Reset buffer
5218 args.resetDeser();
5219
5220 // Make sure there was no data left over.
5221 // That means the argument buffer size was incorrect.
5222#if FW_CMD_CHECK_RESIDUAL
5223 if (args.getBuffLeft() != 0) {
5224 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
5225 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
5226 }
5227 // Don't crash the task if bad arguments were passed from the ground
5228 break;
5229 }
5230#endif
5231
5232 // Call handler function
5233 this->CS_MANUAL_cmdHandler(opCode, cmdSeq);
5234
5235 break;
5236 }
5237
5238 // Handle command CS_JOIN_WAIT
5239 case CMD_CS_JOIN_WAIT: {
5240 // Deserialize opcode
5241 FwOpcodeType opCode = 0;
5242 deserStatus = msg.deserialize(opCode);
5243 FW_ASSERT (
5244 deserStatus == Fw::FW_SERIALIZE_OK,
5245 static_cast<FwAssertArgType>(deserStatus)
5246 );
5247
5248 // Deserialize command sequence
5249 U32 cmdSeq = 0;
5250 deserStatus = msg.deserialize(cmdSeq);
5251 FW_ASSERT (
5252 deserStatus == Fw::FW_SERIALIZE_OK,
5253 static_cast<FwAssertArgType>(deserStatus)
5254 );
5255
5256 // Deserialize command argument buffer
5257 Fw::CmdArgBuffer args;
5258 deserStatus = msg.deserialize(args);
5259 FW_ASSERT (
5260 deserStatus == Fw::FW_SERIALIZE_OK,
5261 static_cast<FwAssertArgType>(deserStatus)
5262 );
5263
5264 // Reset buffer
5265 args.resetDeser();
5266
5267 // Make sure there was no data left over.
5268 // That means the argument buffer size was incorrect.
5269#if FW_CMD_CHECK_RESIDUAL
5270 if (args.getBuffLeft() != 0) {
5271 if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
5272 this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
5273 }
5274 // Don't crash the task if bad arguments were passed from the ground
5275 break;
5276 }
5277#endif
5278
5279 // Call handler function
5280 this->CS_JOIN_WAIT_cmdHandler(opCode, cmdSeq);
5281
5282 break;
5283 }
5284
5285 default:
5286 return MSG_DISPATCH_ERROR;
5287 }
5288
5289 return MSG_DISPATCH_OK;
5290 }
5291
5292 // ----------------------------------------------------------------------
5293 // Calls for messages received on special input ports
5294 // ----------------------------------------------------------------------
5295
5296 void CmdSequencerComponentBase ::
5297 m_p_cmdIn_in(
5298 Fw::PassiveComponentBase* callComp,
5299 NATIVE_INT_TYPE portNum,
5300 FwOpcodeType opCode,
5301 U32 cmdSeq,
5302 Fw::CmdArgBuffer& args
5303 )
5304 {
5305 FW_ASSERT(callComp);
5306 CmdSequencerComponentBase* compPtr = static_cast<CmdSequencerComponentBase*>(callComp);
5307
5308 const U32 idBase = callComp->getIdBase();
5309 FW_ASSERT(opCode >= idBase, opCode, idBase);
5310
5311 // Select base class function based on opcode
5312 switch (opCode - idBase) {
5313 case OPCODE_CS_RUN: {
5314 compPtr->CS_RUN_cmdHandlerBase(
5315 opCode,
5316 cmdSeq,
5317 args
5318 );
5319 break;
5320 }
5321
5322 case OPCODE_CS_VALIDATE: {
5323 compPtr->CS_VALIDATE_cmdHandlerBase(
5324 opCode,
5325 cmdSeq,
5326 args
5327 );
5328 break;
5329 }
5330
5331 case OPCODE_CS_CANCEL: {
5332 compPtr->CS_CANCEL_cmdHandlerBase(
5333 opCode,
5334 cmdSeq,
5335 args
5336 );
5337 break;
5338 }
5339
5340 case OPCODE_CS_START: {
5341 compPtr->CS_START_cmdHandlerBase(
5342 opCode,
5343 cmdSeq,
5344 args
5345 );
5346 break;
5347 }
5348
5349 case OPCODE_CS_STEP: {
5350 compPtr->CS_STEP_cmdHandlerBase(
5351 opCode,
5352 cmdSeq,
5353 args
5354 );
5355 break;
5356 }
5357
5358 case OPCODE_CS_AUTO: {
5359 compPtr->CS_AUTO_cmdHandlerBase(
5360 opCode,
5361 cmdSeq,
5362 args
5363 );
5364 break;
5365 }
5366
5367 case OPCODE_CS_MANUAL: {
5368 compPtr->CS_MANUAL_cmdHandlerBase(
5369 opCode,
5370 cmdSeq,
5371 args
5372 );
5373 break;
5374 }
5375
5376 case OPCODE_CS_JOIN_WAIT: {
5377 compPtr->CS_JOIN_WAIT_cmdHandlerBase(
5378 opCode,
5379 cmdSeq,
5380 args
5381 );
5382 break;
5383 }
5384 }
5385 }
5386
5387 // ----------------------------------------------------------------------
5388 // Calls for messages received on typed input ports
5389 // ----------------------------------------------------------------------
5390
5391 void CmdSequencerComponentBase ::
5392 m_p_cmdResponseIn_in(
5393 Fw::PassiveComponentBase* callComp,
5394 NATIVE_INT_TYPE portNum,
5395 FwOpcodeType opCode,
5396 U32 cmdSeq,
5397 const Fw::CmdResponse& response
5398 )
5399 {
5400 FW_ASSERT(callComp);
5401 CmdSequencerComponentBase* compPtr = static_cast<CmdSequencerComponentBase*>(callComp);
5402 compPtr->cmdResponseIn_handlerBase(
5403 portNum,
5404 opCode,
5405 cmdSeq,
5406 response
5407 );
5408 }
5409
5410 void CmdSequencerComponentBase ::
5411 m_p_pingIn_in(
5412 Fw::PassiveComponentBase* callComp,
5413 NATIVE_INT_TYPE portNum,
5414 U32 key
5415 )
5416 {
5417 FW_ASSERT(callComp);
5418 CmdSequencerComponentBase* compPtr = static_cast<CmdSequencerComponentBase*>(callComp);
5419 compPtr->pingIn_handlerBase(
5420 portNum,
5421 key
5422 );
5423 }
5424
5425 void CmdSequencerComponentBase ::
5426 m_p_schedIn_in(
5427 Fw::PassiveComponentBase* callComp,
5428 NATIVE_INT_TYPE portNum,
5429 NATIVE_UINT_TYPE context
5430 )
5431 {
5432 FW_ASSERT(callComp);
5433 CmdSequencerComponentBase* compPtr = static_cast<CmdSequencerComponentBase*>(callComp);
5434 compPtr->schedIn_handlerBase(
5435 portNum,
5436 context
5437 );
5438 }
5439
5440 void CmdSequencerComponentBase ::
5441 m_p_seqCancelIn_in(
5442 Fw::PassiveComponentBase* callComp,
5443 NATIVE_INT_TYPE portNum
5444 )
5445 {
5446 FW_ASSERT(callComp);
5447 CmdSequencerComponentBase* compPtr = static_cast<CmdSequencerComponentBase*>(callComp);
5448 compPtr->seqCancelIn_handlerBase(portNum);
5449 }
5450
5451 void CmdSequencerComponentBase ::
5452 m_p_seqRunIn_in(
5453 Fw::PassiveComponentBase* callComp,
5454 NATIVE_INT_TYPE portNum,
5455 Fw::String& filename
5456 )
5457 {
5458 FW_ASSERT(callComp);
5459 CmdSequencerComponentBase* compPtr = static_cast<CmdSequencerComponentBase*>(callComp);
5460 compPtr->seqRunIn_handlerBase(
5461 portNum,
5462 filename
5463 );
5464 }
5465
5466}
#define FW_ASSERT(...)
Definition Assert.hpp:14
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
U8 BYTE
byte type
Definition BasicTypes.h:27
uint8_t U8
8-bit unsigned integer
Definition BasicTypes.h:26
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition BasicTypes.h:66
PlatformUIntType NATIVE_UINT_TYPE
Definition BasicTypes.h:52
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
#define PRI_PlatformIntType
@ TB_NONE
No time base has been established.
Definition FpConfig.h:39
PlatformAssertArgType FwAssertArgType
Definition FpConfig.h:21
U32 FwChanIdType
Definition FpConfig.h:59
U32 FwEventIdType
Definition FpConfig.h:62
U32 FwOpcodeType
Definition FpConfig.h:56
#define FW_LOG_TEXT_BUFFER_SIZE
Max size of string for text log message.
Definition FpConfig.h:299
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects)
Definition FpConfig.h:88
@ ACTIVE_COMPONENT_EXIT
message to exit active component task
Enum representing a command response.
@ FORMAT_ERROR
Command failed to deserialize.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition CmdPortAc.hpp:37
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
@ WARNING_HI
A serious but recoverable event.
@ ACTIVITY_HI
Important informational events.
@ WARNING_LO
A less serious but recoverable event.
@ ACTIVITY_LO
Less important informational events.
const char * toChar() const override
Definition LogString.cpp:49
SerializeStatus serialize(SerializeBufferBase &buffer) const override
serialization function
Definition LogString.cpp:57
void init()
Object initializer.
Definition ObjBase.cpp:27
NATIVE_UINT_TYPE getBuffLeft() const
returns how much deserialization buffer is left
void resetDeser()
reset deserialization to beginning
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
const char * toChar() const
gets char buffer
Definition String.cpp:48
@ QUEUE_OK
message sent/received okay
Definition Queue.hpp:28
QueueBlocking
Definition Queue.hpp:40
@ QUEUE_BLOCKING
Queue receive blocks until a message arrives.
Definition Queue.hpp:41
@ QUEUE_NONBLOCKING
Queue receive always returns even if there is no message.
Definition Queue.hpp:42
The stage of the file read operation.
@ SERIALIZED_SIZE
The size of the serial representation.
@ SERIALIZED_SIZE
The size of the serial representation.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
const Time ZERO_TIME
Definition Time.cpp:5