F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
DpCompressProcComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title DpCompressProcComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for DpCompressProc component base class
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  // ----------------------------------------------------------------------
17  // Types for data products
18  // ----------------------------------------------------------------------
19 
22  FwDpIdType id,
23  const Fw::Buffer& buffer,
24  FwDpIdType baseId
25  ) :
26  Fw::DpContainer(id, buffer),
27  m_baseId(baseId)
28  {
29 
30  }
31 
34  Fw::DpContainer(),
35  m_baseId(0)
36  {
37 
38  }
39 
42  const U8* array,
43  FwSizeType size
44  )
45  {
46  FW_ASSERT(array != nullptr);
47  // Compute the size delta
48  const FwSizeType sizeDelta =
49  sizeof(FwDpIdType) +
50  sizeof(FwSizeStoreType) +
51  size * sizeof(U8);
52  // Serialize the elements if they will fit
54  if ((this->m_dataBuffer.getSize() + sizeDelta) <= this->m_dataBuffer.getCapacity()) {
55  const FwDpIdType id = this->m_baseId + RecordId::CompressionRecord;
56  status = this->m_dataBuffer.serializeFrom(id);
57  FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
58  status = this->m_dataBuffer.serializeSize(size);
59  FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
60  status = this->m_dataBuffer.serializeFrom(array, size, Fw::Serialization::OMIT_LENGTH);
61  FW_ASSERT(status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(status));
62  this->m_dataSize += sizeDelta;
63  }
64  else {
66  }
67  return status;
68  }
69 
70  // ----------------------------------------------------------------------
71  // Component initialization
72  // ----------------------------------------------------------------------
73 
76  {
77  // Initialize base class
79 
80 #if !FW_DIRECT_PORT_CALLS
81  // Connect input port cmdIn
82  for (
83  FwIndexType port = 0;
84  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
85  port++
86  ) {
87  this->m_cmdIn_InputPort[port].init();
88  this->m_cmdIn_InputPort[port].addCallComp(
89  this,
90  m_p_cmdIn_in
91  );
92  this->m_cmdIn_InputPort[port].setPortNum(port);
93 
94 #if FW_OBJECT_NAMES == 1
95  Fw::ObjectName portName;
96  portName.format(
97  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
98  this->m_objName.toChar(),
99  port
100  );
101  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
102 #endif
103  }
104 #endif
105 
106 #if !FW_DIRECT_PORT_CALLS
107  // Connect input port procRequest
108  for (
109  FwIndexType port = 0;
110  port < static_cast<FwIndexType>(this->getNum_procRequest_InputPorts());
111  port++
112  ) {
113  this->m_procRequest_InputPort[port].init();
114  this->m_procRequest_InputPort[port].addCallComp(
115  this,
116  m_p_procRequest_in
117  );
118  this->m_procRequest_InputPort[port].setPortNum(port);
119 
120 #if FW_OBJECT_NAMES == 1
121  Fw::ObjectName portName;
122  portName.format(
123  "%s_procRequest_InputPort[%" PRI_FwIndexType "]",
124  this->m_objName.toChar(),
125  port
126  );
127  this->m_procRequest_InputPort[port].setObjName(portName.toChar());
128 #endif
129  }
130 #endif
131 
132 #if !FW_DIRECT_PORT_CALLS
133  // Connect output port cmdRegOut
134  for (
135  FwIndexType port = 0;
136  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
137  port++
138  ) {
139  this->m_cmdRegOut_OutputPort[port].init();
140 
141 #if FW_OBJECT_NAMES == 1
142  Fw::ObjectName portName;
143  portName.format(
144  "%s_cmdRegOut_OutputPort[%" PRI_FwIndexType "]",
145  this->m_objName.toChar(),
146  port
147  );
148  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
149 #endif
150  }
151 #endif
152 
153 #if !FW_DIRECT_PORT_CALLS
154  // Connect output port cmdResponseOut
155  for (
156  FwIndexType port = 0;
157  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
158  port++
159  ) {
160  this->m_cmdResponseOut_OutputPort[port].init();
161 
162 #if FW_OBJECT_NAMES == 1
163  Fw::ObjectName portName;
164  portName.format(
165  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
166  this->m_objName.toChar(),
167  port
168  );
169  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
170 #endif
171  }
172 #endif
173 
174 #if !FW_DIRECT_PORT_CALLS
175  // Connect output port dpGet
176  for (
177  FwIndexType port = 0;
178  port < static_cast<FwIndexType>(this->getNum_dpGet_OutputPorts());
179  port++
180  ) {
181  this->m_dpGet_OutputPort[port].init();
182 
183 #if FW_OBJECT_NAMES == 1
184  Fw::ObjectName portName;
185  portName.format(
186  "%s_dpGet_OutputPort[%" PRI_FwIndexType "]",
187  this->m_objName.toChar(),
188  port
189  );
190  this->m_dpGet_OutputPort[port].setObjName(portName.toChar());
191 #endif
192  }
193 #endif
194 
195 #if !FW_DIRECT_PORT_CALLS
196  // Connect output port dpSend
197  for (
198  FwIndexType port = 0;
199  port < static_cast<FwIndexType>(this->getNum_dpSend_OutputPorts());
200  port++
201  ) {
202  this->m_dpSend_OutputPort[port].init();
203 
204 #if FW_OBJECT_NAMES == 1
205  Fw::ObjectName portName;
206  portName.format(
207  "%s_dpSend_OutputPort[%" PRI_FwIndexType "]",
208  this->m_objName.toChar(),
209  port
210  );
211  this->m_dpSend_OutputPort[port].setObjName(portName.toChar());
212 #endif
213  }
214 #endif
215 
216 #if !FW_DIRECT_PORT_CALLS
217  // Connect output port logOut
218  for (
219  FwIndexType port = 0;
220  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
221  port++
222  ) {
223  this->m_logOut_OutputPort[port].init();
224 
225 #if FW_OBJECT_NAMES == 1
226  Fw::ObjectName portName;
227  portName.format(
228  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
229  this->m_objName.toChar(),
230  port
231  );
232  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
233 #endif
234  }
235 #endif
236 
237 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
238  // Connect output port logTextOut
239  for (
240  FwIndexType port = 0;
241  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
242  port++
243  ) {
244  this->m_logTextOut_OutputPort[port].init();
245 
246 #if FW_OBJECT_NAMES == 1
247  Fw::ObjectName portName;
248  portName.format(
249  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
250  this->m_objName.toChar(),
251  port
252  );
253  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
254 #endif
255  }
256 #endif
257 
258 #if !FW_DIRECT_PORT_CALLS
259  // Connect output port prmGetOut
260  for (
261  FwIndexType port = 0;
262  port < static_cast<FwIndexType>(this->getNum_prmGetOut_OutputPorts());
263  port++
264  ) {
265  this->m_prmGetOut_OutputPort[port].init();
266 
267 #if FW_OBJECT_NAMES == 1
268  Fw::ObjectName portName;
269  portName.format(
270  "%s_prmGetOut_OutputPort[%" PRI_FwIndexType "]",
271  this->m_objName.toChar(),
272  port
273  );
274  this->m_prmGetOut_OutputPort[port].setObjName(portName.toChar());
275 #endif
276  }
277 #endif
278 
279 #if !FW_DIRECT_PORT_CALLS
280  // Connect output port prmSetOut
281  for (
282  FwIndexType port = 0;
283  port < static_cast<FwIndexType>(this->getNum_prmSetOut_OutputPorts());
284  port++
285  ) {
286  this->m_prmSetOut_OutputPort[port].init();
287 
288 #if FW_OBJECT_NAMES == 1
289  Fw::ObjectName portName;
290  portName.format(
291  "%s_prmSetOut_OutputPort[%" PRI_FwIndexType "]",
292  this->m_objName.toChar(),
293  port
294  );
295  this->m_prmSetOut_OutputPort[port].setObjName(portName.toChar());
296 #endif
297  }
298 #endif
299 
300 #if !FW_DIRECT_PORT_CALLS
301  // Connect output port timeCaller
302  for (
303  FwIndexType port = 0;
304  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
305  port++
306  ) {
307  this->m_timeCaller_OutputPort[port].init();
308 
309 #if FW_OBJECT_NAMES == 1
310  Fw::ObjectName portName;
311  portName.format(
312  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
313  this->m_objName.toChar(),
314  port
315  );
316  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
317 #endif
318  }
319 #endif
320 
321 #if !FW_DIRECT_PORT_CALLS
322  // Connect output port compressChunk
323  for (
324  FwIndexType port = 0;
325  port < static_cast<FwIndexType>(this->getNum_compressChunk_OutputPorts());
326  port++
327  ) {
328  this->m_compressChunk_OutputPort[port].init();
329 
330 #if FW_OBJECT_NAMES == 1
331  Fw::ObjectName portName;
332  portName.format(
333  "%s_compressChunk_OutputPort[%" PRI_FwIndexType "]",
334  this->m_objName.toChar(),
335  port
336  );
337  this->m_compressChunk_OutputPort[port].setObjName(portName.toChar());
338 #endif
339  }
340 #endif
341  }
342 
343 #if !FW_DIRECT_PORT_CALLS
344 
345  // ----------------------------------------------------------------------
346  // Getters for special input ports
347  // ----------------------------------------------------------------------
348 
351  {
352  FW_ASSERT(
353  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
354  static_cast<FwAssertArgType>(portNum)
355  );
356 
357  return &this->m_cmdIn_InputPort[portNum];
358  }
359 
360 #endif
361 
362 #if !FW_DIRECT_PORT_CALLS
363 
364  // ----------------------------------------------------------------------
365  // Getters for typed input ports
366  // ----------------------------------------------------------------------
367 
370  {
371  FW_ASSERT(
372  (0 <= portNum) && (portNum < this->getNum_procRequest_InputPorts()),
373  static_cast<FwAssertArgType>(portNum)
374  );
375 
376  return &this->m_procRequest_InputPort[portNum];
377  }
378 
379 #endif
380 
381 #if !FW_DIRECT_PORT_CALLS
382 
383  // ----------------------------------------------------------------------
384  // Connect input ports to special output ports
385  // ----------------------------------------------------------------------
386 
389  FwIndexType portNum,
390  Fw::InputCmdRegPort* port
391  )
392  {
393  FW_ASSERT(
394  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
395  static_cast<FwAssertArgType>(portNum)
396  );
397 
398  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
399  }
400 
403  FwIndexType portNum,
405  )
406  {
407  FW_ASSERT(
408  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
409  static_cast<FwAssertArgType>(portNum)
410  );
411 
412  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
413  }
414 
417  FwIndexType portNum,
418  Fw::InputDpGetPort* port
419  )
420  {
421  FW_ASSERT(
422  (0 <= portNum) && (portNum < this->getNum_dpGet_OutputPorts()),
423  static_cast<FwAssertArgType>(portNum)
424  );
425 
426  this->m_dpGet_OutputPort[portNum].addCallPort(port);
427  }
428 
431  FwIndexType portNum,
432  Fw::InputDpSendPort* port
433  )
434  {
435  FW_ASSERT(
436  (0 <= portNum) && (portNum < this->getNum_dpSend_OutputPorts()),
437  static_cast<FwAssertArgType>(portNum)
438  );
439 
440  this->m_dpSend_OutputPort[portNum].addCallPort(port);
441  }
442 
445  FwIndexType portNum,
446  Fw::InputLogPort* port
447  )
448  {
449  FW_ASSERT(
450  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
451  static_cast<FwAssertArgType>(portNum)
452  );
453 
454  this->m_logOut_OutputPort[portNum].addCallPort(port);
455  }
456 
457 #if FW_ENABLE_TEXT_LOGGING == 1
458 
459  void DpCompressProcComponentBase ::
460  set_logTextOut_OutputPort(
461  FwIndexType portNum,
463  )
464  {
465  FW_ASSERT(
466  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
467  static_cast<FwAssertArgType>(portNum)
468  );
469 
470  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
471  }
472 
473 #endif
474 
477  FwIndexType portNum,
478  Fw::InputPrmGetPort* port
479  )
480  {
481  FW_ASSERT(
482  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
483  static_cast<FwAssertArgType>(portNum)
484  );
485 
486  this->m_prmGetOut_OutputPort[portNum].addCallPort(port);
487  }
488 
491  FwIndexType portNum,
492  Fw::InputPrmSetPort* port
493  )
494  {
495  FW_ASSERT(
496  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
497  static_cast<FwAssertArgType>(portNum)
498  );
499 
500  this->m_prmSetOut_OutputPort[portNum].addCallPort(port);
501  }
502 
505  FwIndexType portNum,
506  Fw::InputTimePort* port
507  )
508  {
509  FW_ASSERT(
510  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
511  static_cast<FwAssertArgType>(portNum)
512  );
513 
514  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
515  }
516 
517 #endif
518 
519 #if !FW_DIRECT_PORT_CALLS
520 
521  // ----------------------------------------------------------------------
522  // Connect typed input ports to typed output ports
523  // ----------------------------------------------------------------------
524 
527  FwIndexType portNum,
529  )
530  {
531  FW_ASSERT(
532  (0 <= portNum) && (portNum < this->getNum_compressChunk_OutputPorts()),
533  static_cast<FwAssertArgType>(portNum)
534  );
535 
536  this->m_compressChunk_OutputPort[portNum].addCallPort(port);
537  }
538 
539 #endif
540 
541 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
542 
543  // ----------------------------------------------------------------------
544  // Connect serial input ports to special output ports
545  // ----------------------------------------------------------------------
546 
549  FwIndexType portNum,
550  Fw::InputSerializePort* port
551  )
552  {
553  FW_ASSERT(
554  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
555  static_cast<FwAssertArgType>(portNum)
556  );
557 
558  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
559  }
560 
563  FwIndexType portNum,
564  Fw::InputSerializePort* port
565  )
566  {
567  FW_ASSERT(
568  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
569  static_cast<FwAssertArgType>(portNum)
570  );
571 
572  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
573  }
574 
577  FwIndexType portNum,
578  Fw::InputSerializePort* port
579  )
580  {
581  FW_ASSERT(
582  (0 <= portNum) && (portNum < this->getNum_dpSend_OutputPorts()),
583  static_cast<FwAssertArgType>(portNum)
584  );
585 
586  this->m_dpSend_OutputPort[portNum].registerSerialPort(port);
587  }
588 
591  FwIndexType portNum,
592  Fw::InputSerializePort* port
593  )
594  {
595  FW_ASSERT(
596  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
597  static_cast<FwAssertArgType>(portNum)
598  );
599 
600  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
601  }
602 
603 #if FW_ENABLE_TEXT_LOGGING == 1
604 
605  void DpCompressProcComponentBase ::
606  set_logTextOut_OutputPort(
607  FwIndexType portNum,
608  Fw::InputSerializePort* port
609  )
610  {
611  FW_ASSERT(
612  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
613  static_cast<FwAssertArgType>(portNum)
614  );
615 
616  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
617  }
618 
619 #endif
620 
623  FwIndexType portNum,
624  Fw::InputSerializePort* port
625  )
626  {
627  FW_ASSERT(
628  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
629  static_cast<FwAssertArgType>(portNum)
630  );
631 
632  this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port);
633  }
634 
637  FwIndexType portNum,
638  Fw::InputSerializePort* port
639  )
640  {
641  FW_ASSERT(
642  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
643  static_cast<FwAssertArgType>(portNum)
644  );
645 
646  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
647  }
648 
649 #endif
650 
651  // ----------------------------------------------------------------------
652  // Command registration
653  // ----------------------------------------------------------------------
654 
657  {
659 
660  this->cmdRegOut_out(
661  0,
663  );
664 
665  this->cmdRegOut_out(
666  0,
668  );
669 
670  this->cmdRegOut_out(
671  0,
672  this->getIdBase() + OPCODE_ENABLE_SET
673  );
674 
675  this->cmdRegOut_out(
676  0,
677  this->getIdBase() + OPCODE_ENABLE_SAVE
678  );
679  }
680 
681  // ----------------------------------------------------------------------
682  // Parameter loading
683  // ----------------------------------------------------------------------
684 
687  {
689  const FwPrmIdType _baseId = static_cast<FwPrmIdType>(this->getIdBase());
691 
692  FwPrmIdType _id{};
693  Fw::ParamBuffer _paramBuffer;
694 
695  _id = _baseId + PARAMID_CHUNK_SIZE;
696 
697  // Get serialized parameter CHUNK_SIZE
698  this->m_param_CHUNK_SIZE_valid = this->prmGetOut_out(
699  0,
700  _id,
701  _paramBuffer
702  );
703 
704  this->m_paramLock.lock();
705 
706  // Deserialize parameter or use default value
707  if (this->m_param_CHUNK_SIZE_valid == Fw::ParamValid::VALID) {
708  _stat = _paramBuffer.deserializeTo(this->m_CHUNK_SIZE);
709  if (_stat != Fw::FW_SERIALIZE_OK) {
710  this->m_param_CHUNK_SIZE_valid = Fw::ParamValid::DEFAULT;
711  }
712  }
713  else {
714  this->m_param_CHUNK_SIZE_valid = Fw::ParamValid::DEFAULT;
715  }
716  if (this->m_param_CHUNK_SIZE_valid == Fw::ParamValid::DEFAULT) {
717  this->m_CHUNK_SIZE = 32768;
718  }
719 
720  this->m_paramLock.unlock();
721 
722  _id = _baseId + PARAMID_ENABLE;
723 
724  // Get serialized parameter ENABLE
725  this->m_param_ENABLE_valid = this->prmGetOut_out(
726  0,
727  _id,
728  _paramBuffer
729  );
730 
731  this->m_paramLock.lock();
732 
733  // Deserialize parameter or use default value
734  if (this->m_param_ENABLE_valid == Fw::ParamValid::VALID) {
735  _stat = _paramBuffer.deserializeTo(this->m_ENABLE);
736  if (_stat != Fw::FW_SERIALIZE_OK) {
737  this->m_param_ENABLE_valid = Fw::ParamValid::DEFAULT;
738  }
739  }
740  else {
741  this->m_param_ENABLE_valid = Fw::ParamValid::DEFAULT;
742  }
743  if (this->m_param_ENABLE_valid == Fw::ParamValid::DEFAULT) {
744  this->m_ENABLE = Fw::Enabled::ENABLED;
745  }
746 
747  this->m_paramLock.unlock();
748 
749  // Call notifier
750  this->parametersLoaded();
751  }
752 
753  // ----------------------------------------------------------------------
754  // Component construction and destruction
755  // ----------------------------------------------------------------------
756 
758  DpCompressProcComponentBase(const char* compName) :
759  Fw::PassiveComponentBase(compName)
760  {
761  this->m_DidNotCompressThrottle = 0;
762  }
763 
766  {
767 
768  }
769 
770 #if !FW_DIRECT_PORT_CALLS
771 
772  // ----------------------------------------------------------------------
773  // Connection status queries for special output ports
774  // ----------------------------------------------------------------------
775 
778  {
779  FW_ASSERT(
780  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
781  static_cast<FwAssertArgType>(portNum)
782  );
783 
784  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
785  }
786 
789  {
790  FW_ASSERT(
791  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
792  static_cast<FwAssertArgType>(portNum)
793  );
794 
795  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
796  }
797 
800  {
801  FW_ASSERT(
802  (0 <= portNum) && (portNum < this->getNum_dpGet_OutputPorts()),
803  static_cast<FwAssertArgType>(portNum)
804  );
805 
806  return this->m_dpGet_OutputPort[portNum].isConnected();
807  }
808 
811  {
812  FW_ASSERT(
813  (0 <= portNum) && (portNum < this->getNum_dpSend_OutputPorts()),
814  static_cast<FwAssertArgType>(portNum)
815  );
816 
817  return this->m_dpSend_OutputPort[portNum].isConnected();
818  }
819 
822  {
823  FW_ASSERT(
824  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
825  static_cast<FwAssertArgType>(portNum)
826  );
827 
828  return this->m_logOut_OutputPort[portNum].isConnected();
829  }
830 
831 #if FW_ENABLE_TEXT_LOGGING == 1
832 
833  bool DpCompressProcComponentBase ::
834  isConnected_logTextOut_OutputPort(FwIndexType portNum) const
835  {
836  FW_ASSERT(
837  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
838  static_cast<FwAssertArgType>(portNum)
839  );
840 
841  return this->m_logTextOut_OutputPort[portNum].isConnected();
842  }
843 
844 #endif
845 
848  {
849  FW_ASSERT(
850  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
851  static_cast<FwAssertArgType>(portNum)
852  );
853 
854  return this->m_prmGetOut_OutputPort[portNum].isConnected();
855  }
856 
859  {
860  FW_ASSERT(
861  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
862  static_cast<FwAssertArgType>(portNum)
863  );
864 
865  return this->m_prmSetOut_OutputPort[portNum].isConnected();
866  }
867 
870  {
871  FW_ASSERT(
872  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
873  static_cast<FwAssertArgType>(portNum)
874  );
875 
876  return this->m_timeCaller_OutputPort[portNum].isConnected();
877  }
878 
879 #endif
880 
881 #if !FW_DIRECT_PORT_CALLS
882 
883  // ----------------------------------------------------------------------
884  // Connection status queries for typed output ports
885  // ----------------------------------------------------------------------
886 
889  {
890  FW_ASSERT(
891  (0 <= portNum) && (portNum < this->getNum_compressChunk_OutputPorts()),
892  static_cast<FwAssertArgType>(portNum)
893  );
894 
895  return this->m_compressChunk_OutputPort[portNum].isConnected();
896  }
897 
898 #endif
899 
900  // ----------------------------------------------------------------------
901  // Port handler base-class functions for special input ports
902  //
903  // Call these functions directly to bypass the corresponding ports
904  // ----------------------------------------------------------------------
905 
908  FwIndexType portNum,
909  FwOpcodeType opCode,
910  U32 cmdSeq,
911  Fw::CmdArgBuffer& args
912  )
913  {
914 
915  const U32 idBase = this->getIdBase();
916  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
917 
918  // Select base class function based on opcode
919  switch (opCode - idBase) {
920  case OPCODE_CHUNK_SIZE_SET: {
921  Fw::CmdResponse _cstat = this->paramSet_CHUNK_SIZE(args);
922  this->cmdResponse_out(
923  opCode,
924  cmdSeq,
925  _cstat
926  );
927  break;
928  }
929 
930  case OPCODE_CHUNK_SIZE_SAVE: {
931  Fw::CmdResponse _cstat = this->paramSave_CHUNK_SIZE();
932  this->cmdResponse_out(
933  opCode,
934  cmdSeq,
935  _cstat
936  );
937  break;
938  }
939 
940  case OPCODE_ENABLE_SET: {
941  Fw::CmdResponse _cstat = this->paramSet_ENABLE(args);
942  this->cmdResponse_out(
943  opCode,
944  cmdSeq,
945  _cstat
946  );
947  break;
948  }
949 
950  case OPCODE_ENABLE_SAVE: {
951  Fw::CmdResponse _cstat = this->paramSave_ENABLE();
952  this->cmdResponse_out(
953  opCode,
954  cmdSeq,
955  _cstat
956  );
957  break;
958  }
959  default:
960  // Unknown opcode: ignore it
961  break;
962  }
963  }
964 
965  // ----------------------------------------------------------------------
966  // Port handler base-class functions for typed input ports
967  //
968  // Call these functions directly to bypass the corresponding ports
969  // ----------------------------------------------------------------------
970 
973  FwIndexType portNum,
974  Fw::Buffer& fwBuffer
975  )
976  {
977  // Make sure port number is valid
978  FW_ASSERT(
979  (0 <= portNum) && (portNum < this->getNum_procRequest_InputPorts()),
980  static_cast<FwAssertArgType>(portNum)
981  );
982 
983  // Call handler function
984  this->procRequest_handler(
985  portNum,
986  fwBuffer
987  );
988  }
989 
990 #if !FW_DIRECT_PORT_CALLS
991 
992  // ----------------------------------------------------------------------
993  // Invocation functions for typed output ports
994  // ----------------------------------------------------------------------
995 
998  FwIndexType portNum,
999  Fw::Buffer& buffer,
1000  FwSizeType min_compression,
1001  FwSizeType write_offset
1002  ) const
1003  {
1004  FW_ASSERT(
1005  (0 <= portNum) && (portNum < this->getNum_compressChunk_OutputPorts()),
1006  static_cast<FwAssertArgType>(portNum)
1007  );
1008 
1009  FW_ASSERT(
1010  this->m_compressChunk_OutputPort[portNum].isConnected(),
1011  static_cast<FwAssertArgType>(portNum)
1012  );
1013  return this->m_compressChunk_OutputPort[portNum].invoke(
1014  buffer,
1015  min_compression,
1016  write_offset
1017  );
1018  }
1019 
1020 #endif
1021 
1022  // ----------------------------------------------------------------------
1023  // Command response
1024  // ----------------------------------------------------------------------
1025 
1028  FwOpcodeType opCode,
1029  U32 cmdSeq,
1030  Fw::CmdResponse response
1031  )
1032  {
1034  this->cmdResponseOut_out(0, opCode, cmdSeq, response);
1035  }
1036 
1037  // ----------------------------------------------------------------------
1038  // Event logging functions
1039  // ----------------------------------------------------------------------
1040 
1043  FwDpIdType dp_id,
1044  FwSizeType initial_size,
1045  FwSizeType final_size
1046  ) const
1047  {
1048  // Get the time
1049  Fw::Time _logTime;
1050  if (this->isConnected_timeCaller_OutputPort(0)) {
1051  this->timeCaller_out(0, _logTime);
1052  }
1053 
1054  const FwEventIdType _id = this->getIdBase() + EVENTID_COMPRESSIONCOMPLETE;
1055 
1056  // Emit the event on the log port
1057  if (this->isConnected_logOut_OutputPort(0)) {
1058  Fw::LogBuffer _logBuff;
1060 
1061 #if FW_AMPCS_COMPATIBLE
1062  // Serialize the number of arguments
1063  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1064  FW_ASSERT(
1065  _status == Fw::FW_SERIALIZE_OK,
1066  static_cast<FwAssertArgType>(_status)
1067  );
1068 #endif
1069 
1070 #if FW_AMPCS_COMPATIBLE
1071  // Serialize the argument size
1072  _status = _logBuff.serializeFrom(
1073  static_cast<U8>(sizeof(FwDpIdType))
1074  );
1075  FW_ASSERT(
1076  _status == Fw::FW_SERIALIZE_OK,
1077  static_cast<FwAssertArgType>(_status)
1078  );
1079 #endif
1080  _status = _logBuff.serializeFrom(dp_id);
1081  FW_ASSERT(
1082  _status == Fw::FW_SERIALIZE_OK,
1083  static_cast<FwAssertArgType>(_status)
1084  );
1085 
1086 #if FW_AMPCS_COMPATIBLE
1087  // Serialize the argument size
1088  _status = _logBuff.serializeFrom(
1089  static_cast<U8>(sizeof(FwSizeType))
1090  );
1091  FW_ASSERT(
1092  _status == Fw::FW_SERIALIZE_OK,
1093  static_cast<FwAssertArgType>(_status)
1094  );
1095 #endif
1096  _status = _logBuff.serializeFrom(initial_size);
1097  FW_ASSERT(
1098  _status == Fw::FW_SERIALIZE_OK,
1099  static_cast<FwAssertArgType>(_status)
1100  );
1101 
1102 #if FW_AMPCS_COMPATIBLE
1103  // Serialize the argument size
1104  _status = _logBuff.serializeFrom(
1105  static_cast<U8>(sizeof(FwSizeType))
1106  );
1107  FW_ASSERT(
1108  _status == Fw::FW_SERIALIZE_OK,
1109  static_cast<FwAssertArgType>(_status)
1110  );
1111 #endif
1112  _status = _logBuff.serializeFrom(final_size);
1113  FW_ASSERT(
1114  _status == Fw::FW_SERIALIZE_OK,
1115  static_cast<FwAssertArgType>(_status)
1116  );
1117 
1118  this->logOut_out(
1119  0,
1120  _id,
1121  _logTime,
1123  _logBuff
1124  );
1125  }
1126 
1127  // Emit the event on the text log port
1128 #if FW_ENABLE_TEXT_LOGGING
1129  if (this->isConnected_logTextOut_OutputPort(0)) {
1130 #if FW_OBJECT_NAMES == 1
1131  const char* _formatString =
1132  "(%s) %s: Compressed Data Product %" PRIu32 " from %" PRIu64 " to %" PRIu64 " bytes";
1133 #else
1134  const char* _formatString =
1135  "%s: Compressed Data Product %" PRIu32 " from %" PRIu64 " to %" PRIu64 " bytes";
1136 #endif
1137 
1138  Fw::TextLogString _logString;
1139  _logString.format(
1140  _formatString,
1141 #if FW_OBJECT_NAMES == 1
1142  this->m_objName.toChar(),
1143 #endif
1144  "CompressionComplete ",
1145  dp_id,
1146  initial_size,
1147  final_size
1148  );
1149 
1150  this->logTextOut_out(
1151  0,
1152  _id,
1153  _logTime,
1155  _logString
1156  );
1157  }
1158 #endif
1159  }
1160 
1163  FwDpIdType dp_id,
1164  FwSizeType data_size
1165  )
1166  {
1167  // Check throttle value
1168  if (this->m_DidNotCompressThrottle >= EVENTID_DIDNOTCOMPRESS_THROTTLE) {
1169  return;
1170  }
1171  else {
1172  this->m_DidNotCompressThrottle++;
1173  }
1174 
1175  // Get the time
1176  Fw::Time _logTime;
1177  if (this->isConnected_timeCaller_OutputPort(0)) {
1178  this->timeCaller_out(0, _logTime);
1179  }
1180 
1181  const FwEventIdType _id = this->getIdBase() + EVENTID_DIDNOTCOMPRESS;
1182 
1183  // Emit the event on the log port
1184  if (this->isConnected_logOut_OutputPort(0)) {
1185  Fw::LogBuffer _logBuff;
1187 
1188 #if FW_AMPCS_COMPATIBLE
1189  // Serialize the number of arguments
1190  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1191  FW_ASSERT(
1192  _status == Fw::FW_SERIALIZE_OK,
1193  static_cast<FwAssertArgType>(_status)
1194  );
1195 #endif
1196 
1197 #if FW_AMPCS_COMPATIBLE
1198  // Serialize the argument size
1199  _status = _logBuff.serializeFrom(
1200  static_cast<U8>(sizeof(FwDpIdType))
1201  );
1202  FW_ASSERT(
1203  _status == Fw::FW_SERIALIZE_OK,
1204  static_cast<FwAssertArgType>(_status)
1205  );
1206 #endif
1207  _status = _logBuff.serializeFrom(dp_id);
1208  FW_ASSERT(
1209  _status == Fw::FW_SERIALIZE_OK,
1210  static_cast<FwAssertArgType>(_status)
1211  );
1212 
1213 #if FW_AMPCS_COMPATIBLE
1214  // Serialize the argument size
1215  _status = _logBuff.serializeFrom(
1216  static_cast<U8>(sizeof(FwSizeType))
1217  );
1218  FW_ASSERT(
1219  _status == Fw::FW_SERIALIZE_OK,
1220  static_cast<FwAssertArgType>(_status)
1221  );
1222 #endif
1223  _status = _logBuff.serializeFrom(data_size);
1224  FW_ASSERT(
1225  _status == Fw::FW_SERIALIZE_OK,
1226  static_cast<FwAssertArgType>(_status)
1227  );
1228 
1229  this->logOut_out(
1230  0,
1231  _id,
1232  _logTime,
1234  _logBuff
1235  );
1236  }
1237 
1238  // Emit the event on the text log port
1239 #if FW_ENABLE_TEXT_LOGGING
1240  if (this->isConnected_logTextOut_OutputPort(0)) {
1241 #if FW_OBJECT_NAMES == 1
1242  const char* _formatString =
1243  "(%s) %s: Unable to reduce size of Data Product %" PRIu32 ". Uncompressed size %" PRIu64 "";
1244 #else
1245  const char* _formatString =
1246  "%s: Unable to reduce size of Data Product %" PRIu32 ". Uncompressed size %" PRIu64 "";
1247 #endif
1248 
1249  Fw::TextLogString _logString;
1250  _logString.format(
1251  _formatString,
1252 #if FW_OBJECT_NAMES == 1
1253  this->m_objName.toChar(),
1254 #endif
1255  "DidNotCompress ",
1256  dp_id,
1257  data_size
1258  );
1259 
1260  this->logTextOut_out(
1261  0,
1262  _id,
1263  _logTime,
1265  _logString
1266  );
1267  }
1268 #endif
1269  }
1270 
1271  // ----------------------------------------------------------------------
1272  // Event throttle reset functions
1273  // ----------------------------------------------------------------------
1274 
1277  {
1278  // Reset throttle counter
1279  this->m_DidNotCompressThrottle = 0;
1280  }
1281 
1282  // ----------------------------------------------------------------------
1283  // Parameter hook functions
1284  // ----------------------------------------------------------------------
1285 
1288  {
1289  // Do nothing by default
1290  }
1291 
1294  {
1295  // Do nothing by default
1296  }
1297 
1298  // ----------------------------------------------------------------------
1299  // Parameter get functions
1300  // ----------------------------------------------------------------------
1301 
1304  {
1305  FwSizeStoreType _local{};
1306  this->m_paramLock.lock();
1307  valid = this->m_param_CHUNK_SIZE_valid;
1308  if ((valid == Fw::ParamValid::VALID) || (valid == Fw::ParamValid::DEFAULT)) {
1309  _local = this->m_CHUNK_SIZE;
1310  }
1311  this->m_paramLock.unlock();
1312  return _local;
1313  }
1314 
1317  {
1318  Fw::Enabled _local{};
1319  this->m_paramLock.lock();
1320  valid = this->m_param_ENABLE_valid;
1321  if ((valid == Fw::ParamValid::VALID) || (valid == Fw::ParamValid::DEFAULT)) {
1322  _local = this->m_ENABLE;
1323  }
1324  this->m_paramLock.unlock();
1325  return _local;
1326  }
1327 
1328  // ----------------------------------------------------------------------
1329  // Functions for managing data products
1330  // ----------------------------------------------------------------------
1331 
1334  DpContainer& container,
1335  Fw::Time timeTag
1336  )
1337  {
1338  // Update the time tag
1339  if (timeTag == Fw::ZERO_TIME) {
1340  // Get the time from the time port
1341  timeTag = this->getTime();
1342  }
1343  container.setTimeTag(timeTag);
1344  // Serialize the header into the packet
1345  container.serializeHeader();
1346  // Update the size of the buffer according to the data size
1347  const FwSizeType packetSize = container.getPacketSize();
1348  Fw::Buffer buffer = container.getBuffer();
1349  FW_ASSERT(packetSize <= buffer.getSize(), static_cast<FwAssertArgType>(packetSize),
1350  static_cast<FwAssertArgType>(buffer.getSize()));
1351  buffer.setSize(static_cast<U32>(packetSize));
1352  // Invalidate the buffer in the container, so it can't be reused
1353  container.invalidateBuffer();
1354  // Send the buffer
1355  this->dpSend_out(0, container.getId(), buffer);
1356  }
1357 
1358  // ----------------------------------------------------------------------
1359  // Time
1360  // ----------------------------------------------------------------------
1361 
1363  getTime() const
1364  {
1365  if (this->isConnected_timeCaller_OutputPort(0)) {
1366  Fw::Time _time;
1367  this->timeCaller_out(0, _time);
1368  return _time;
1369  }
1370  else {
1371  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1372  }
1373  }
1374 
1375  // ----------------------------------------------------------------------
1376  // Calls for messages received on special input ports
1377  // ----------------------------------------------------------------------
1378 
1379  void DpCompressProcComponentBase ::
1380  m_p_cmdIn_in(
1381  Fw::PassiveComponentBase* callComp,
1382  FwIndexType portNum,
1383  FwOpcodeType opCode,
1384  U32 cmdSeq,
1385  Fw::CmdArgBuffer& args
1386  )
1387  {
1388  FW_ASSERT(callComp);
1389  DpCompressProcComponentBase* compPtr = static_cast<DpCompressProcComponentBase*>(callComp);
1390  compPtr->cmdIn_handlerBase(
1391  portNum,
1392  opCode,
1393  cmdSeq,
1394  args
1395  );
1396  }
1397 
1398  // ----------------------------------------------------------------------
1399  // Calls for messages received on typed input ports
1400  // ----------------------------------------------------------------------
1401 
1402  void DpCompressProcComponentBase ::
1403  m_p_procRequest_in(
1404  Fw::PassiveComponentBase* callComp,
1405  FwIndexType portNum,
1406  Fw::Buffer& fwBuffer
1407  )
1408  {
1409  FW_ASSERT(callComp);
1410  DpCompressProcComponentBase* compPtr = static_cast<DpCompressProcComponentBase*>(callComp);
1411  compPtr->procRequest_handlerBase(
1412  portNum,
1413  fwBuffer
1414  );
1415  }
1416 
1417 #if !FW_DIRECT_PORT_CALLS
1418 
1419  // ----------------------------------------------------------------------
1420  // Invocation functions for special output ports
1421  // ----------------------------------------------------------------------
1422 
1423  void DpCompressProcComponentBase ::
1424  cmdRegOut_out(
1425  FwIndexType portNum,
1426  FwOpcodeType opCode
1427  ) const
1428  {
1429  FW_ASSERT(
1430  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
1431  static_cast<FwAssertArgType>(portNum)
1432  );
1433 
1434  FW_ASSERT(
1435  this->m_cmdRegOut_OutputPort[portNum].isConnected(),
1436  static_cast<FwAssertArgType>(portNum)
1437  );
1438  this->m_cmdRegOut_OutputPort[portNum].invoke(
1439  opCode
1440  );
1441  }
1442 
1443  void DpCompressProcComponentBase ::
1444  cmdResponseOut_out(
1445  FwIndexType portNum,
1446  FwOpcodeType opCode,
1447  U32 cmdSeq,
1448  const Fw::CmdResponse& response
1449  ) const
1450  {
1451  FW_ASSERT(
1452  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
1453  static_cast<FwAssertArgType>(portNum)
1454  );
1455 
1456  FW_ASSERT(
1457  this->m_cmdResponseOut_OutputPort[portNum].isConnected(),
1458  static_cast<FwAssertArgType>(portNum)
1459  );
1460  this->m_cmdResponseOut_OutputPort[portNum].invoke(
1461  opCode,
1462  cmdSeq,
1463  response
1464  );
1465  }
1466 
1467  Fw::Success DpCompressProcComponentBase ::
1468  dpGet_out(
1469  FwIndexType portNum,
1470  FwDpIdType id,
1471  FwSizeType dataSize,
1472  Fw::Buffer& buffer
1473  ) const
1474  {
1475  FW_ASSERT(
1476  (0 <= portNum) && (portNum < this->getNum_dpGet_OutputPorts()),
1477  static_cast<FwAssertArgType>(portNum)
1478  );
1479 
1480  FW_ASSERT(
1481  this->m_dpGet_OutputPort[portNum].isConnected(),
1482  static_cast<FwAssertArgType>(portNum)
1483  );
1484  return this->m_dpGet_OutputPort[portNum].invoke(
1485  id,
1486  dataSize,
1487  buffer
1488  );
1489  }
1490 
1491  void DpCompressProcComponentBase ::
1492  dpSend_out(
1493  FwIndexType portNum,
1494  FwDpIdType id,
1495  const Fw::Buffer& buffer
1496  ) const
1497  {
1498  FW_ASSERT(
1499  (0 <= portNum) && (portNum < this->getNum_dpSend_OutputPorts()),
1500  static_cast<FwAssertArgType>(portNum)
1501  );
1502 
1503  FW_ASSERT(
1504  this->m_dpSend_OutputPort[portNum].isConnected(),
1505  static_cast<FwAssertArgType>(portNum)
1506  );
1507  this->m_dpSend_OutputPort[portNum].invoke(
1508  id,
1509  buffer
1510  );
1511  }
1512 
1513  void DpCompressProcComponentBase ::
1514  logOut_out(
1515  FwIndexType portNum,
1516  FwEventIdType id,
1517  Fw::Time& timeTag,
1518  const Fw::LogSeverity& severity,
1519  Fw::LogBuffer& args
1520  ) const
1521  {
1522  FW_ASSERT(
1523  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
1524  static_cast<FwAssertArgType>(portNum)
1525  );
1526 
1527  FW_ASSERT(
1528  this->m_logOut_OutputPort[portNum].isConnected(),
1529  static_cast<FwAssertArgType>(portNum)
1530  );
1531  this->m_logOut_OutputPort[portNum].invoke(
1532  id,
1533  timeTag,
1534  severity,
1535  args
1536  );
1537  }
1538 
1539 #if FW_ENABLE_TEXT_LOGGING
1540 
1541  void DpCompressProcComponentBase ::
1542  logTextOut_out(
1543  FwIndexType portNum,
1544  FwEventIdType id,
1545  Fw::Time& timeTag,
1546  const Fw::LogSeverity& severity,
1547  Fw::TextLogString& text
1548  ) const
1549  {
1550  FW_ASSERT(
1551  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
1552  static_cast<FwAssertArgType>(portNum)
1553  );
1554 
1555  FW_ASSERT(
1556  this->m_logTextOut_OutputPort[portNum].isConnected(),
1557  static_cast<FwAssertArgType>(portNum)
1558  );
1559  this->m_logTextOut_OutputPort[portNum].invoke(
1560  id,
1561  timeTag,
1562  severity,
1563  text
1564  );
1565  }
1566 
1567 #endif
1568 
1569  Fw::ParamValid DpCompressProcComponentBase ::
1570  prmGetOut_out(
1571  FwIndexType portNum,
1572  FwPrmIdType id,
1573  Fw::ParamBuffer& val
1574  ) const
1575  {
1576  FW_ASSERT(
1577  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
1578  static_cast<FwAssertArgType>(portNum)
1579  );
1580 
1581  FW_ASSERT(
1582  this->m_prmGetOut_OutputPort[portNum].isConnected(),
1583  static_cast<FwAssertArgType>(portNum)
1584  );
1585  return this->m_prmGetOut_OutputPort[portNum].invoke(
1586  id,
1587  val
1588  );
1589  }
1590 
1591  void DpCompressProcComponentBase ::
1592  prmSetOut_out(
1593  FwIndexType portNum,
1594  FwPrmIdType id,
1595  Fw::ParamBuffer& val
1596  ) const
1597  {
1598  FW_ASSERT(
1599  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
1600  static_cast<FwAssertArgType>(portNum)
1601  );
1602 
1603  FW_ASSERT(
1604  this->m_prmSetOut_OutputPort[portNum].isConnected(),
1605  static_cast<FwAssertArgType>(portNum)
1606  );
1607  this->m_prmSetOut_OutputPort[portNum].invoke(
1608  id,
1609  val
1610  );
1611  }
1612 
1613  void DpCompressProcComponentBase ::
1614  timeCaller_out(
1615  FwIndexType portNum,
1616  Fw::Time& time
1617  ) const
1618  {
1619  FW_ASSERT(
1620  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
1621  static_cast<FwAssertArgType>(portNum)
1622  );
1623 
1624  FW_ASSERT(
1625  this->m_timeCaller_OutputPort[portNum].isConnected(),
1626  static_cast<FwAssertArgType>(portNum)
1627  );
1628  this->m_timeCaller_OutputPort[portNum].invoke(
1629  time
1630  );
1631  }
1632 
1633 #endif
1634 
1635  // ----------------------------------------------------------------------
1636  // Parameter set functions
1637  // ----------------------------------------------------------------------
1638 
1639  Fw::CmdResponse DpCompressProcComponentBase ::
1640  paramSet_CHUNK_SIZE(Fw::SerialBufferBase& val)
1641  {
1642  FwSizeStoreType _localVal{};
1643  const Fw::SerializeStatus _stat = val.deserializeTo(_localVal);
1644  if (_stat != Fw::FW_SERIALIZE_OK) {
1646  }
1647 
1648  // Assign value only if successfully deserialized
1649  this->m_paramLock.lock();
1650  this->m_CHUNK_SIZE = _localVal;
1651  this->m_param_CHUNK_SIZE_valid = Fw::ParamValid::VALID;
1652  this->m_paramLock.unlock();
1653 
1654  // Call notifier
1656  return Fw::CmdResponse::OK;
1657  }
1658 
1659  Fw::CmdResponse DpCompressProcComponentBase ::
1660  paramSet_ENABLE(Fw::SerialBufferBase& val)
1661  {
1662  Fw::Enabled _localVal{};
1663  const Fw::SerializeStatus _stat = val.deserializeTo(_localVal);
1664  if (_stat != Fw::FW_SERIALIZE_OK) {
1666  }
1667 
1668  // Assign value only if successfully deserialized
1669  this->m_paramLock.lock();
1670  this->m_ENABLE = _localVal;
1671  this->m_param_ENABLE_valid = Fw::ParamValid::VALID;
1672  this->m_paramLock.unlock();
1673 
1674  // Call notifier
1676  return Fw::CmdResponse::OK;
1677  }
1678 
1679  // ----------------------------------------------------------------------
1680  // Parameter save functions
1681  // ----------------------------------------------------------------------
1682 
1683  Fw::CmdResponse DpCompressProcComponentBase ::
1684  paramSave_CHUNK_SIZE()
1685  {
1686  if (!this->isConnected_prmSetOut_OutputPort(0)) {
1688  }
1689  Fw::ParamBuffer _paramBuffer;
1690  const FwIdType idBase = this->getIdBase();
1692  // Serialize the parameter
1693  this->m_paramLock.lock();
1694  if ((this->m_param_CHUNK_SIZE_valid == Fw::ParamValid::VALID) || (this->m_param_CHUNK_SIZE_valid == Fw::ParamValid::DEFAULT)) {
1695  _stat = _paramBuffer.serializeFrom(m_CHUNK_SIZE);
1696  }
1697  this->m_paramLock.unlock();
1698  if (_stat != Fw::FW_SERIALIZE_OK) {
1700  }
1701  // Save the parameter
1702  this->prmSetOut_out(
1703  0,
1704  static_cast<FwPrmIdType>(idBase + PARAMID_CHUNK_SIZE),
1705  _paramBuffer
1706  );
1707  // Return the command response
1708  return Fw::CmdResponse::OK;
1709  }
1710 
1711  Fw::CmdResponse DpCompressProcComponentBase ::
1712  paramSave_ENABLE()
1713  {
1714  if (!this->isConnected_prmSetOut_OutputPort(0)) {
1716  }
1717  Fw::ParamBuffer _paramBuffer;
1718  const FwIdType idBase = this->getIdBase();
1720  // Serialize the parameter
1721  this->m_paramLock.lock();
1722  if ((this->m_param_ENABLE_valid == Fw::ParamValid::VALID) || (this->m_param_ENABLE_valid == Fw::ParamValid::DEFAULT)) {
1723  _stat = _paramBuffer.serializeFrom(m_ENABLE);
1724  }
1725  this->m_paramLock.unlock();
1726  if (_stat != Fw::FW_SERIALIZE_OK) {
1728  }
1729  // Save the parameter
1730  this->prmSetOut_out(
1731  0,
1732  static_cast<FwPrmIdType>(idBase + PARAMID_ENABLE),
1733  _paramBuffer
1734  );
1735  // Return the command response
1736  return Fw::CmdResponse::OK;
1737  }
1738 
1739  // ----------------------------------------------------------------------
1740  // Private data product handling functions
1741  // ----------------------------------------------------------------------
1742 
1743  Fw::Success::T DpCompressProcComponentBase ::
1744  dpGet(
1745  ContainerId::T containerId,
1746  FwSizeType dataSize,
1747  FwDpPriorityType priority,
1748  DpContainer& container
1749  )
1750  {
1751  const FwDpIdType baseId = this->getIdBase();
1752  const FwDpIdType globalId = baseId + containerId;
1753  const FwSizeType size = DpContainer::getPacketSizeForDataSize(dataSize);
1754  Fw::Buffer buffer;
1755  const Fw::Success::T status = this->dpGet_out(0, globalId, size, buffer);
1756  if (status == Fw::Success::SUCCESS) {
1757  // Assign a fresh DpContainer into container
1758  // This action clears out all the container state
1759  container = DpContainer(globalId, buffer, baseId);
1760  container.setPriority(priority);
1761  }
1762  return status;
1763  }
1764 
1765 }
Serialization/Deserialization operation was successful.
Number of bytes to use in a compression chunk.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
void setTimeTag(Fw::Time timeTag)
Set the time tag.
FwIdType FwOpcodeType
The type of a command opcode.
static constexpr FwIndexType getNum_dpSend_OutputPorts()
virtual void parametersLoaded()
Called whenever parameters are loaded.
static constexpr FwIndexType getNum_compressChunk_OutputPorts()
void set_compressChunk_OutputPort(FwIndexType portNum, Svc::InputCompressChunkPort *port)
Connect port to compressChunk[portNum].
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
static constexpr FwIndexType getNum_prmGetOut_OutputPorts()
void init()
Initialization function.
Representing success.
PlatformSizeType FwSizeType
U32 FwDpPriorityType
The type of a data product priority.
I32 FwEnumStoreType
void addCallPort(InputDpSendPort *callPort)
Register an input port.
void setSize(FwSizeType size)
Definition: Buffer.cpp:75
Enabled state.
bool isConnected_prmGetOut_OutputPort(FwIndexType portNum) const
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
FwIdType FwPrmIdType
The type of a parameter identifier.
void addCallPort(InputPrmSetPort *callPort)
Register an input port.
Chunk size to use when passing data to the compression backend.
static constexpr FwIndexType getNum_procRequest_InputPorts()
No room left in the buffer to serialize data.
void dpSend(DpContainer &container, Fw::Time timeTag=Fw::ZERO_TIME)
Send a data product.
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum) const
const Time ZERO_TIME
Definition: Time.cpp:5
Fw::SerializeStatus serializeRecord_CompressionRecord(const U8 *array, FwSizeType size)
PassiveComponentBase(const char *name)
Named constructor.
bool isConnected_prmSetOut_OutputPort(FwIndexType portNum) const
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
Enum representing a command response.
void set_prmGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to prmGetOut[portNum].
No time base has been established (Required)
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum) const
bool isConnected_compressChunk_OutputPort(FwIndexType portNum) const
void init()
Initialization function.
Software diagnostic events.
void addCallPort(InputPrmGetPort *callPort)
Register an input port.
void init()
Object initializer.
Definition: ObjBase.cpp:24
void cmdIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port cmdIn.
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
virtual SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)=0
Deserialize an 8-bit unsigned integer value.
static constexpr FwIndexType getNum_dpGet_OutputPorts()
void addCallPort(InputCompressChunkPort *callPort)
Register an input port.
void unlock()
alias for unLock to meet BasicLockable requirements
Definition: Mutex.hpp:64
void log_ACTIVITY_LO_DidNotCompress(FwDpIdType dp_id, FwSizeType data_size)
Log event DidNotCompress.
U16 FwSizeStoreType
The type used to serialize a size value.
FwIdType FwEventIdType
The type of an event identifier.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
DpCompressProcComponentBase(const char *compName="")
Construct DpCompressProcComponentBase object.
bool isConnected_dpSend_OutputPort(FwIndexType portNum) const
void invoke(FwOpcodeType opCode) const
Invoke a port connection.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
Auto-generated base for DpCompressProc component.
void init()
Initialization function.
Definition: TimePortAc.cpp:151
Data was the wrong format (e.g. wrong packet type)
static constexpr FwIndexType getNum_logOut_OutputPorts()
Less important informational events.
Fw::ParamValid invoke(FwPrmIdType id, Fw::ParamBuffer &val) const
Omit length from serialization.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
Fw::InputBufferSendPort * get_procRequest_InputPort(FwIndexType portNum)
void init()
Initialization function.
Svc::CompressionAlgorithm compressChunk_out(FwIndexType portNum, Fw::Buffer &buffer, FwSizeType min_compression, FwSizeType write_offset) const
Invoke output port compressChunk.
static constexpr FwIndexType getNum_cmdIn_InputPorts()
void set_dpGet_OutputPort(FwIndexType portNum, Fw::InputDpGetPort *port)
Connect port to dpGet[portNum].
void procRequest_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port procRequest.
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
static constexpr FwIndexType getNum_prmSetOut_OutputPorts()
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
void invalidateBuffer()
Invalidate the packet buffer.
T
The raw enum type.
void log_DIAGNOSTIC_CompressionComplete(FwDpIdType dp_id, FwSizeType initial_size, FwSizeType final_size) const
Log event CompressionComplete.
static constexpr FwSizeType getPacketSizeForDataSize(FwSizeType dataSize)
Get the packet size for a given data size.
const char * toChar() const
Convert to a C-style char*.
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
virtual ~DpCompressProcComponentBase()
Destroy DpCompressProcComponentBase object.
FwSizeType getPacketSize() const
Get the packet size corresponding to the data size.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
Fw::Buffer getBuffer() const
#define PRI_FwIndexType
Enabled and disabled states.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:180
Command successfully executed.
void log_ACTIVITY_LO_DidNotCompress_ThrottleClear()
Reset throttle value for DidNotCompress.
DpContainer()
Constructor with default initialization.
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
void init()
Initialization function.
FwSizeType getSize() const
Definition: Buffer.cpp:60
Svc::CompressionAlgorithm invoke(Fw::Buffer &buffer, FwSizeType min_compression, FwSizeType write_offset) const
Command had execution error.
FwIdType FwDpIdType
The type of a data product identifier.
virtual void parameterUpdated(FwPrmIdType id)
Called whenever a parameter is updated.
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
FwSizeStoreType paramGet_CHUNK_SIZE(Fw::ParamValid &valid)
Fw::Success invoke(FwDpIdType id, FwSizeType dataSize, Fw::Buffer &buffer) const
PlatformIndexType FwIndexType
void serializeHeader()
Definition: DpContainer.cpp:89
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
void addCallPort(InputDpGetPort *callPort)
Register an input port.
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
void init()
Initialization function.
Command failed validation.
RateGroupDivider component implementation.
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
bool isConnected_dpGet_OutputPort(FwIndexType portNum) const
Enum representing parameter validity.
void set_dpSend_OutputPort(FwIndexType portNum, Fw::InputDpSendPort *port)
Connect port to dpSend[portNum].
void invoke(FwPrmIdType id, Fw::ParamBuffer &val) const
Invoke a port connection.
Input CompressChunk port.
virtual void procRequest_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port procRequest.
FwDpIdType getId() const
Definition: DpContainer.hpp:98
Implementation of malloc based allocator.
void loadParameters()
Load the parameters from a parameter source.
void regCommands()
Register commands with the Command Dispatcher.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void init()
Initialization function.
Fw::Enabled paramGet_ENABLE(Fw::ParamValid &valid)
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
void init()
Initialization function.
void invoke(FwDpIdType id, const Fw::Buffer &buffer) const
Invoke a port connection.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
void init()
Initialization function.
Success/Failure.
PlatformAssertArgType FwAssertArgType
The type of arguments to assert functions.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
U32 FwIdType
The id type.