@@ -705,6 +705,18 @@ impl MultiplexedIPdu {
705705 format ! ( "{:#?}" , self . 0 )
706706 }
707707
708+ #[ setter]
709+ fn set_static_part ( & self , static_part : & ISignalIPdu ) -> PyResult < ( ) > {
710+ self . 0
711+ . set_static_part ( & static_part. 0 )
712+ . map_err ( abstraction_err_to_pyerr)
713+ }
714+
715+ #[ getter]
716+ fn static_part ( & self ) -> Option < ISignalIPdu > {
717+ self . 0 . static_part ( ) . map ( |pdu| ISignalIPdu ( pdu. clone ( ) ) )
718+ }
719+
708720 // --------- AbstractPdu methods ---------
709721
710722 /// set the length of this PDU
@@ -728,6 +740,35 @@ impl MultiplexedIPdu {
728740 . collect ( )
729741 }
730742
743+ /// addd a dynamic part alternative to this `MultiplexedIPdu`
744+ #[ pyo3( signature = ( dynamic_ipdu, selector_code, /, * , initial_dynamic_part) ) ]
745+ #[ pyo3(
746+ text_signature = "(self, dynamic_ipdu: ISignalIPdu, selector_code: int, /, *, initial_dynamic_part: bool = false)"
747+ ) ]
748+ fn add_dynamic_part (
749+ & self ,
750+ dynamic_ipdu : & ISignalIPdu ,
751+ selector_code : u16 ,
752+ initial_dynamic_part : bool ,
753+ ) -> PyResult < DynamicPartAlternative > {
754+ match self
755+ . 0
756+ . add_dynamic_part ( & dynamic_ipdu. 0 , selector_code, initial_dynamic_part)
757+ {
758+ Ok ( value) => Ok ( DynamicPartAlternative ( value) ) ,
759+ Err ( e) => Err ( AutosarAbstractionError :: new_err ( e. to_string ( ) ) ) ,
760+ }
761+ }
762+
763+ // TODO: enable iterator once the fixed version of autosar-data-abstraction is published
764+ // fn dynamic_part_alternatives(&self) -> DynamicPartAlternativesIterator {
765+ // DynamicPartAlternativesIterator::new(
766+ // self.0
767+ // .dynamic_part_alternatives()
768+ // .map(DynamicPartAlternative),
769+ // )
770+ // }
771+
731772 // --------- AbstractIPdu methods ---------
732773
733774 /// set the ContainedIPduProps for this `IPdu`
@@ -749,6 +790,45 @@ impl MultiplexedIPdu {
749790
750791//##################################################################
751792
793+ // iterator_wrapper!(DynamicPartAlternativesIterator, DynamicPartAlternative);
794+
795+ //##################################################################
796+
797+ /// An alternative for the dynamic part of a `MultiplexedIPdu`
798+ #[ pyclass(
799+ frozen,
800+ eq,
801+ module = "autosar_data._autosar_data._abstraction._communication"
802+ ) ]
803+ #[ derive( Clone , PartialEq ) ]
804+ pub ( crate ) struct DynamicPartAlternative (
805+ pub ( crate ) autosar_data_abstraction:: communication:: DynamicPartAlternative ,
806+ ) ;
807+
808+ #[ pymethods]
809+ impl DynamicPartAlternative {
810+ #[ new]
811+ fn new ( element : & Element ) -> PyResult < Self > {
812+ match autosar_data_abstraction:: communication:: DynamicPartAlternative :: try_from (
813+ element. 0 . clone ( ) ,
814+ ) {
815+ Ok ( value) => Ok ( Self ( value) ) ,
816+ Err ( e) => Err ( AutosarAbstractionError :: new_err ( e. to_string ( ) ) ) ,
817+ }
818+ }
819+
820+ #[ getter]
821+ fn element ( & self ) -> Element {
822+ Element ( self . 0 . element ( ) . clone ( ) )
823+ }
824+
825+ fn __repr__ ( & self ) -> String {
826+ format ! ( "{:#?}" , self . 0 )
827+ }
828+ }
829+
830+ //##################################################################
831+
752832/// a `PduTriggering` triggers a PDU in a frame or ethernet connection
753833#[ pyclass(
754834 frozen,
0 commit comments