1#[cfg(not(target_endian = "little"))]
2compile_error!("Zero-copy serialization requires a little-endian target");
3#[allow(unused_variables, unused_braces, unused_parens)]
4#[allow(clippy::identity_op)]
5pub mod reg {
6 pub mod udral {
7 pub mod physics {
8 pub mod acoustics {
9 pub mod note_0_1 {
10 #[cfg_attr(
15 not(doctest),
16 doc = " Description of a generic musical note in terms of basic physical quantities.\n\n This type may be used to control sound notification emitters assuming the best effort policy:\n if the requested parameters exceed the capabilities of the emitter, the closest possible values should be assumed."
17 )]
18 #[derive(
19 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
20 )]
21 #[repr(C, packed)]
22 pub struct Note {
23 pub frequency: crate::uavcan::si::unit::frequency::scalar_1_0::Scalar,
29 pub duration: crate::uavcan::si::unit::duration::scalar_1_0::Scalar,
35 pub acoustic_power: crate::uavcan::si::unit::power::scalar_1_0::Scalar,
41 }
42 impl ::canadensis_encoding::DataType for Note {
43 const EXTENT_BYTES: Option<u32> = None;
45 }
46 impl ::canadensis_encoding::Message for Note {}
47 impl Note {}
48 impl ::canadensis_encoding::Serialize for Note {
49 fn size_bits(&self) -> usize {
50 96
51 }
52 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
53 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
54 }
55 }
56 impl ::canadensis_encoding::Deserialize for Note {
57 fn deserialize(
58 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
59 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
60 where
61 Self: Sized,
62 {
63 Ok(Self::deserialize_zero_copy(cursor))
64 }
65 }
66 #[test]
67 fn test_layout() {
68 assert_eq!(::core::mem::size_of::<Note>() * 8, 96);
69 assert_eq!(::core::mem::offset_of!(Note, frequency) * 8, 0);
70 assert_eq!(::core::mem::offset_of!(Note, duration) * 8, 32);
71 assert_eq!(::core::mem::offset_of!(Note, acoustic_power) * 8, 64);
72 }
73 }
74 }
75 pub mod dynamics {
76 pub mod rotation {
77 pub mod planar_0_1 {
78 #[cfg_attr(
83 not(doctest),
84 doc = " Positive torque is co-directed with positive position/velocity/acceleration.\n Provided states may allow the consumer to deduce certain hidden states such as the moment of inertia."
85 )]
86 #[derive(
87 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
88 )]
89 #[repr(C, packed)]
90 pub struct Planar {
91pub kinematics: crate::reg::udral::physics::kinematics::rotation::planar_0_1::Planar,
97#[cfg_attr(not(doctest), doc = " NaN if unknown")]
98pub torque: crate::uavcan::si::unit::torque::scalar_1_0::Scalar,
104}
105 impl ::canadensis_encoding::DataType for Planar {
106 const EXTENT_BYTES: Option<u32> = None;
108 }
109 impl ::canadensis_encoding::Message for Planar {}
110 impl Planar {}
111 impl ::canadensis_encoding::Serialize for Planar {
112 fn size_bits(&self) -> usize {
113 128
114 }
115 fn serialize(
116 &self,
117 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
118 ) {
119 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
120 }
121 }
122 impl ::canadensis_encoding::Deserialize for Planar {
123 fn deserialize(
124 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
125 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
126 where
127 Self: Sized,
128 {
129 Ok(Self::deserialize_zero_copy(cursor))
130 }
131 }
132 #[test]
133 fn test_layout() {
134 assert_eq!(::core::mem::size_of::<Planar>() * 8, 128);
135 assert_eq!(::core::mem::offset_of!(Planar, kinematics) * 8, 0);
136 assert_eq!(::core::mem::offset_of!(Planar, torque) * 8, 96);
137 }
138 }
139 pub mod planar_ts_0_1 {
140 pub struct PlanarTs {
145pub timestamp: crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
151pub value: crate::reg::udral::physics::dynamics::rotation::planar_0_1::Planar,
157}
158 impl ::canadensis_encoding::DataType for PlanarTs {
159 const EXTENT_BYTES: Option<u32> = None;
161 }
162 impl ::canadensis_encoding::Message for PlanarTs {}
163 impl PlanarTs {}
164 impl ::canadensis_encoding::Serialize for PlanarTs {
165 fn size_bits(&self) -> usize {
166 184
167 }
168 fn serialize(
169 &self,
170 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
171 ) {
172 cursor.write_composite(&self.timestamp);
173 cursor.write_composite(&self.value);
174 }
175 }
176 impl ::canadensis_encoding::Deserialize for PlanarTs {
177 fn deserialize(
178 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
179 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
180 where
181 Self: Sized,
182 {
183 Ok(PlanarTs {
184 timestamp: { cursor.read_composite()? },
185 value: { cursor.read_composite()? },
186 })
187 }
188 }
189 }
190 }
191 pub mod translation {
192 pub mod linear_0_1 {
193 #[cfg_attr(
198 not(doctest),
199 doc = " Positive force is co-directed with positive position/velocity/acceleration.\n Provided kinetic states may allow the consumer to deduce certain hidden states such as the mass of the load."
200 )]
201 #[derive(
202 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
203 )]
204 #[repr(C, packed)]
205 pub struct Linear {
206pub kinematics: crate::reg::udral::physics::kinematics::translation::linear_0_1::Linear,
212#[cfg_attr(not(doctest), doc = " NaN if unknown")]
213pub force: crate::uavcan::si::unit::force::scalar_1_0::Scalar,
219}
220 impl ::canadensis_encoding::DataType for Linear {
221 const EXTENT_BYTES: Option<u32> = None;
223 }
224 impl ::canadensis_encoding::Message for Linear {}
225 impl Linear {}
226 impl ::canadensis_encoding::Serialize for Linear {
227 fn size_bits(&self) -> usize {
228 128
229 }
230 fn serialize(
231 &self,
232 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
233 ) {
234 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
235 }
236 }
237 impl ::canadensis_encoding::Deserialize for Linear {
238 fn deserialize(
239 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
240 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
241 where
242 Self: Sized,
243 {
244 Ok(Self::deserialize_zero_copy(cursor))
245 }
246 }
247 #[test]
248 fn test_layout() {
249 assert_eq!(::core::mem::size_of::<Linear>() * 8, 128);
250 assert_eq!(::core::mem::offset_of!(Linear, kinematics) * 8, 0);
251 assert_eq!(::core::mem::offset_of!(Linear, force) * 8, 96);
252 }
253 }
254 pub mod linear_ts_0_1 {
255 pub struct LinearTs {
260pub timestamp: crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
266pub value: crate::reg::udral::physics::dynamics::translation::linear_0_1::Linear,
272}
273 impl ::canadensis_encoding::DataType for LinearTs {
274 const EXTENT_BYTES: Option<u32> = None;
276 }
277 impl ::canadensis_encoding::Message for LinearTs {}
278 impl LinearTs {}
279 impl ::canadensis_encoding::Serialize for LinearTs {
280 fn size_bits(&self) -> usize {
281 184
282 }
283 fn serialize(
284 &self,
285 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
286 ) {
287 cursor.write_composite(&self.timestamp);
288 cursor.write_composite(&self.value);
289 }
290 }
291 impl ::canadensis_encoding::Deserialize for LinearTs {
292 fn deserialize(
293 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
294 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
295 where
296 Self: Sized,
297 {
298 Ok(LinearTs {
299 timestamp: { cursor.read_composite()? },
300 value: { cursor.read_composite()? },
301 })
302 }
303 }
304 }
305 }
306 }
307 pub mod electricity {
308 pub mod power_0_1 {
309 #[cfg_attr(
314 not(doctest),
315 doc = " DC or AC line electric power quantities. Generally, the following current sign convention applies:\n\n - Positive current flows from the electric power supply network to the load (e.g., an actuator).\n\n - If the electric network is the load itself powered from a source (e.g., battery), the current is negative."
316 )]
317 #[derive(
318 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
319 )]
320 #[repr(C, packed)]
321 pub struct Power {
322 pub current: crate::uavcan::si::unit::electric_current::scalar_1_0::Scalar,
328 pub voltage: crate::uavcan::si::unit::voltage::scalar_1_0::Scalar,
334 }
335 impl ::canadensis_encoding::DataType for Power {
336 const EXTENT_BYTES: Option<u32> = None;
338 }
339 impl ::canadensis_encoding::Message for Power {}
340 impl Power {}
341 impl ::canadensis_encoding::Serialize for Power {
342 fn size_bits(&self) -> usize {
343 64
344 }
345 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
346 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
347 }
348 }
349 impl ::canadensis_encoding::Deserialize for Power {
350 fn deserialize(
351 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
352 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
353 where
354 Self: Sized,
355 {
356 Ok(Self::deserialize_zero_copy(cursor))
357 }
358 }
359 #[test]
360 fn test_layout() {
361 assert_eq!(::core::mem::size_of::<Power>() * 8, 64);
362 assert_eq!(::core::mem::offset_of!(Power, current) * 8, 0);
363 assert_eq!(::core::mem::offset_of!(Power, voltage) * 8, 32);
364 }
365 }
366 pub mod power_ts_0_1 {
367 pub struct PowerTs {
372 pub timestamp:
378 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
379 pub value: crate::reg::udral::physics::electricity::power_0_1::Power,
385 }
386 impl ::canadensis_encoding::DataType for PowerTs {
387 const EXTENT_BYTES: Option<u32> = None;
389 }
390 impl ::canadensis_encoding::Message for PowerTs {}
391 impl PowerTs {}
392 impl ::canadensis_encoding::Serialize for PowerTs {
393 fn size_bits(&self) -> usize {
394 120
395 }
396 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
397 cursor.write_composite(&self.timestamp);
398 cursor.write_composite(&self.value);
399 }
400 }
401 impl ::canadensis_encoding::Deserialize for PowerTs {
402 fn deserialize(
403 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
404 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
405 where
406 Self: Sized,
407 {
408 Ok(PowerTs {
409 timestamp: { cursor.read_composite()? },
410 value: { cursor.read_composite()? },
411 })
412 }
413 }
414 }
415 pub mod source_0_1 {
416 #[cfg_attr(
421 not(doctest),
422 doc = " A generic source or sink of electric power (battery, turbogenerator, braking resistor, etc.).\n Low-pass filtering should be applied to avoid aliasing effects (as is the case everywhere else)."
423 )]
424 #[derive(
425 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
426 )]
427 #[repr(C, packed)]
428 pub struct Source {
429 #[cfg_attr(
430 not(doctest),
431 doc = " Total instant load power.\n Positive current flows into the source (power sinking).\n Negative current flows from the source to the power supply network (power sourcing)."
432 )]
433 pub power: crate::reg::udral::physics::electricity::power_0_1::Power,
439 #[cfg_attr(
440 not(doctest),
441 doc = " A pessimistic estimate of the amount of energy that can be reclaimed from the source in its current state.\n This may be dependent on the state of charge/health (for batteries), temperature, load profile, humidity, etc.\n Negative values may be reported to indicate overdischarge or depletion of the reserve energy.\n\n This value approximates (full_energy + int(load_power dt)) plus the environmental influences on the source.\n\n Having the instant power, the time to depletion is estimated as (energy/-power).\n When charging (for batteries), the remaining time to full charge can be found similarly as\n ((full_energy-energy)/power).\n\n For the sake of illustration, if this type was used to represent the state of a braking resistor,\n then this value would be negative indicating the amount of dissipated energy."
442 )]
443 pub energy: crate::uavcan::si::unit::energy::scalar_1_0::Scalar,
449 #[cfg_attr(
450 not(doctest),
451 doc = " A pessimistic estimate of the amount of energy that can be reclaimed from a fresh source (fully fueled generator\n or a fully charged battery) under the current conditions (SoH, temperature, load profile, etc)."
452 )]
453 pub full_energy: crate::uavcan::si::unit::energy::scalar_1_0::Scalar,
459 }
460 impl ::canadensis_encoding::DataType for Source {
461 const EXTENT_BYTES: Option<u32> = None;
463 }
464 impl ::canadensis_encoding::Message for Source {}
465 impl Source {}
466 impl ::canadensis_encoding::Serialize for Source {
467 fn size_bits(&self) -> usize {
468 128
469 }
470 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
471 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
472 }
473 }
474 impl ::canadensis_encoding::Deserialize for Source {
475 fn deserialize(
476 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
477 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
478 where
479 Self: Sized,
480 {
481 Ok(Self::deserialize_zero_copy(cursor))
482 }
483 }
484 #[test]
485 fn test_layout() {
486 assert_eq!(::core::mem::size_of::<Source>() * 8, 128);
487 assert_eq!(::core::mem::offset_of!(Source, power) * 8, 0);
488 assert_eq!(::core::mem::offset_of!(Source, energy) * 8, 64);
489 assert_eq!(::core::mem::offset_of!(Source, full_energy) * 8, 96);
490 }
491 }
492 pub mod source_ts_0_1 {
493 pub struct SourceTs {
498 pub timestamp:
504 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
505 pub value: crate::reg::udral::physics::electricity::source_0_1::Source,
511 }
512 impl ::canadensis_encoding::DataType for SourceTs {
513 const EXTENT_BYTES: Option<u32> = None;
515 }
516 impl ::canadensis_encoding::Message for SourceTs {}
517 impl SourceTs {}
518 impl ::canadensis_encoding::Serialize for SourceTs {
519 fn size_bits(&self) -> usize {
520 184
521 }
522 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
523 cursor.write_composite(&self.timestamp);
524 cursor.write_composite(&self.value);
525 }
526 }
527 impl ::canadensis_encoding::Deserialize for SourceTs {
528 fn deserialize(
529 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
530 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
531 where
532 Self: Sized,
533 {
534 Ok(SourceTs {
535 timestamp: { cursor.read_composite()? },
536 value: { cursor.read_composite()? },
537 })
538 }
539 }
540 }
541 }
542 pub mod kinematics {
543 pub mod cartesian {
544 pub mod point_0_1 {
545 #[cfg_attr(
550 not(doctest),
551 doc = " Cartesian coordinates of a point in space."
552 )]
553 #[derive(
554 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
555 )]
556 #[repr(C, packed)]
557 pub struct Point {
558 pub value:
564 crate::uavcan::si::unit::length::wide_vector3_1_0::WideVector3,
565 }
566 impl ::canadensis_encoding::DataType for Point {
567 const EXTENT_BYTES: Option<u32> = None;
569 }
570 impl ::canadensis_encoding::Message for Point {}
571 impl Point {}
572 impl ::canadensis_encoding::Serialize for Point {
573 fn size_bits(&self) -> usize {
574 192
575 }
576 fn serialize(
577 &self,
578 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
579 ) {
580 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
581 }
582 }
583 impl ::canadensis_encoding::Deserialize for Point {
584 fn deserialize(
585 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
586 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
587 where
588 Self: Sized,
589 {
590 Ok(Self::deserialize_zero_copy(cursor))
591 }
592 }
593 #[test]
594 fn test_layout() {
595 assert_eq!(::core::mem::size_of::<Point>() * 8, 192);
596 assert_eq!(::core::mem::offset_of!(Point, value) * 8, 0);
597 }
598 }
599 pub mod point_state_0_1 {
600 #[cfg_attr(
605 not(doctest),
606 doc = " The kinematic state of a point, as opposed to that of a body, is devoid of rotation information.\n Therefore, the velocity is specified in the parent coordinate frame."
607 )]
608 #[derive(
609 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
610 )]
611 #[repr(C, packed)]
612 pub struct PointState {
613 pub position:
619 crate::reg::udral::physics::kinematics::cartesian::point_0_1::Point,
620 pub velocity: crate::uavcan::si::unit::velocity::vector3_1_0::Vector3,
626 }
627 impl ::canadensis_encoding::DataType for PointState {
628 const EXTENT_BYTES: Option<u32> = None;
630 }
631 impl ::canadensis_encoding::Message for PointState {}
632 impl PointState {}
633 impl ::canadensis_encoding::Serialize for PointState {
634 fn size_bits(&self) -> usize {
635 288
636 }
637 fn serialize(
638 &self,
639 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
640 ) {
641 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
642 }
643 }
644 impl ::canadensis_encoding::Deserialize for PointState {
645 fn deserialize(
646 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
647 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
648 where
649 Self: Sized,
650 {
651 Ok(Self::deserialize_zero_copy(cursor))
652 }
653 }
654 #[test]
655 fn test_layout() {
656 assert_eq!(::core::mem::size_of::<PointState>() * 8, 288);
657 assert_eq!(::core::mem::offset_of!(PointState, position) * 8, 0);
658 assert_eq!(::core::mem::offset_of!(PointState, velocity) * 8, 192);
659 }
660 }
661 pub mod point_state_var_0_1 {
662 #[cfg_attr(not(doctest), doc = " See PointState for details.")]
667 #[derive(
668 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
669 )]
670 #[repr(C, packed)]
671 pub struct PointStateVar {
672pub position: crate::reg::udral::physics::kinematics::cartesian::point_var_0_1::PointVar,
678pub velocity: crate::reg::udral::physics::kinematics::translation::velocity3_var_0_2::Velocity3Var,
684}
685 impl ::canadensis_encoding::DataType for PointStateVar {
686 const EXTENT_BYTES: Option<u32> = None;
688 }
689 impl ::canadensis_encoding::Message for PointStateVar {}
690 impl PointStateVar {}
691 impl ::canadensis_encoding::Serialize for PointStateVar {
692 fn size_bits(&self) -> usize {
693 480
694 }
695 fn serialize(
696 &self,
697 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
698 ) {
699 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
700 }
701 }
702 impl ::canadensis_encoding::Deserialize for PointStateVar {
703 fn deserialize(
704 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
705 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
706 where
707 Self: Sized,
708 {
709 Ok(Self::deserialize_zero_copy(cursor))
710 }
711 }
712 #[test]
713 fn test_layout() {
714 assert_eq!(::core::mem::size_of::<PointStateVar>() * 8, 480);
715 assert_eq!(::core::mem::offset_of!(PointStateVar, position) * 8, 0);
716 assert_eq!(::core::mem::offset_of!(PointStateVar, velocity) * 8, 288);
717 }
718 }
719 pub mod point_state_var_ts_0_1 {
720 pub struct PointStateVarTs {
725pub timestamp: crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
731pub value: crate::reg::udral::physics::kinematics::cartesian::point_state_var_0_1::PointStateVar,
737}
738 impl ::canadensis_encoding::DataType for PointStateVarTs {
739 const EXTENT_BYTES: Option<u32> = None;
741 }
742 impl ::canadensis_encoding::Message for PointStateVarTs {}
743 impl PointStateVarTs {}
744 impl ::canadensis_encoding::Serialize for PointStateVarTs {
745 fn size_bits(&self) -> usize {
746 536
747 }
748 fn serialize(
749 &self,
750 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
751 ) {
752 cursor.write_composite(&self.timestamp);
753 cursor.write_composite(&self.value);
754 }
755 }
756 impl ::canadensis_encoding::Deserialize for PointStateVarTs {
757 fn deserialize(
758 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
759 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
760 where
761 Self: Sized,
762 {
763 Ok(PointStateVarTs {
764 timestamp: { cursor.read_composite()? },
765 value: { cursor.read_composite()? },
766 })
767 }
768 }
769 }
770 pub mod point_var_0_1 {
771 #[derive(
776 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
777 )]
778 #[repr(C, packed)]
779 pub struct PointVar {
780 pub value:
786 crate::reg::udral::physics::kinematics::cartesian::point_0_1::Point,
787 #[cfg_attr(
788 not(doctest),
789 doc = " [meter^2] Upper-right triangle of the covariance matrix."
790 )]
791 pub covariance_urt: [::half::f16; 6],
797 }
798 impl ::canadensis_encoding::DataType for PointVar {
799 const EXTENT_BYTES: Option<u32> = None;
801 }
802 impl ::canadensis_encoding::Message for PointVar {}
803 impl PointVar {}
804 impl ::canadensis_encoding::Serialize for PointVar {
805 fn size_bits(&self) -> usize {
806 288
807 }
808 fn serialize(
809 &self,
810 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
811 ) {
812 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
813 }
814 }
815 impl ::canadensis_encoding::Deserialize for PointVar {
816 fn deserialize(
817 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
818 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
819 where
820 Self: Sized,
821 {
822 Ok(Self::deserialize_zero_copy(cursor))
823 }
824 }
825 #[test]
826 fn test_layout() {
827 assert_eq!(::core::mem::size_of::<PointVar>() * 8, 288);
828 assert_eq!(::core::mem::offset_of!(PointVar, value) * 8, 0);
829 assert_eq!(::core::mem::offset_of!(PointVar, covariance_urt) * 8, 192);
830 }
831 }
832 pub mod pose_0_1 {
833 #[derive(
838 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
839 )]
840 #[repr(C, packed)]
841 pub struct Pose {
842 pub position:
848 crate::reg::udral::physics::kinematics::cartesian::point_0_1::Point,
849 pub orientation:
855 crate::uavcan::si::unit::angle::quaternion_1_0::Quaternion,
856 }
857 impl ::canadensis_encoding::DataType for Pose {
858 const EXTENT_BYTES: Option<u32> = None;
860 }
861 impl ::canadensis_encoding::Message for Pose {}
862 impl Pose {}
863 impl ::canadensis_encoding::Serialize for Pose {
864 fn size_bits(&self) -> usize {
865 320
866 }
867 fn serialize(
868 &self,
869 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
870 ) {
871 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
872 }
873 }
874 impl ::canadensis_encoding::Deserialize for Pose {
875 fn deserialize(
876 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
877 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
878 where
879 Self: Sized,
880 {
881 Ok(Self::deserialize_zero_copy(cursor))
882 }
883 }
884 #[test]
885 fn test_layout() {
886 assert_eq!(::core::mem::size_of::<Pose>() * 8, 320);
887 assert_eq!(::core::mem::offset_of!(Pose, position) * 8, 0);
888 assert_eq!(::core::mem::offset_of!(Pose, orientation) * 8, 192);
889 }
890 }
891 pub mod pose_var_0_1 {
892 #[derive(
897 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
898 )]
899 #[repr(C, packed)]
900 pub struct PoseVar {
901 pub value:
907 crate::reg::udral::physics::kinematics::cartesian::pose_0_1::Pose,
908 #[cfg_attr(
909 not(doctest),
910 doc = " Upper-right triangle of the covariance matrix:\n\n [parent frame] [child (body) frame]\n translation along axis rotation about axis\n X Y Z X Y Z\n +-----------------------------------------------\n X position |\n Y position | m^2 m*rad\n Z position |\n X rotation |\n Y rotation | rad^2\n Z rotation |"
911 )]
912 pub covariance_urt: [::half::f16; 21],
918 }
919 impl ::canadensis_encoding::DataType for PoseVar {
920 const EXTENT_BYTES: Option<u32> = None;
922 }
923 impl ::canadensis_encoding::Message for PoseVar {}
924 impl PoseVar {}
925 impl ::canadensis_encoding::Serialize for PoseVar {
926 fn size_bits(&self) -> usize {
927 656
928 }
929 fn serialize(
930 &self,
931 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
932 ) {
933 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
934 }
935 }
936 impl ::canadensis_encoding::Deserialize for PoseVar {
937 fn deserialize(
938 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
939 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
940 where
941 Self: Sized,
942 {
943 Ok(Self::deserialize_zero_copy(cursor))
944 }
945 }
946 #[test]
947 fn test_layout() {
948 assert_eq!(::core::mem::size_of::<PoseVar>() * 8, 656);
949 assert_eq!(::core::mem::offset_of!(PoseVar, value) * 8, 0);
950 assert_eq!(::core::mem::offset_of!(PoseVar, covariance_urt) * 8, 320);
951 }
952 }
953 pub mod pose_var_ts_0_1 {
954 pub struct PoseVarTs {
959pub timestamp: crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
965pub value: crate::reg::udral::physics::kinematics::cartesian::pose_var_0_1::PoseVar,
971}
972 impl ::canadensis_encoding::DataType for PoseVarTs {
973 const EXTENT_BYTES: Option<u32> = None;
975 }
976 impl ::canadensis_encoding::Message for PoseVarTs {}
977 impl PoseVarTs {}
978 impl ::canadensis_encoding::Serialize for PoseVarTs {
979 fn size_bits(&self) -> usize {
980 712
981 }
982 fn serialize(
983 &self,
984 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
985 ) {
986 cursor.write_composite(&self.timestamp);
987 cursor.write_composite(&self.value);
988 }
989 }
990 impl ::canadensis_encoding::Deserialize for PoseVarTs {
991 fn deserialize(
992 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
993 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
994 where
995 Self: Sized,
996 {
997 Ok(PoseVarTs {
998 timestamp: { cursor.read_composite()? },
999 value: { cursor.read_composite()? },
1000 })
1001 }
1002 }
1003 }
1004 pub mod state_0_1 {
1005 #[cfg_attr(
1010 not(doctest),
1011 doc = " First-order kinematic state of a body in space: pose and twist.\n The pose defines a coordinate system transformation from the parent frame to the child frame.\n The twist is specified in the child frame (body frame)."
1012 )]
1013 #[derive(
1014 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
1015 )]
1016 #[repr(C, packed)]
1017 pub struct State {
1018 pub pose:
1024 crate::reg::udral::physics::kinematics::cartesian::pose_0_1::Pose,
1025 pub twist:
1031 crate::reg::udral::physics::kinematics::cartesian::twist_0_1::Twist,
1032 }
1033 impl ::canadensis_encoding::DataType for State {
1034 const EXTENT_BYTES: Option<u32> = None;
1036 }
1037 impl ::canadensis_encoding::Message for State {}
1038 impl State {}
1039 impl ::canadensis_encoding::Serialize for State {
1040 fn size_bits(&self) -> usize {
1041 512
1042 }
1043 fn serialize(
1044 &self,
1045 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1046 ) {
1047 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
1048 }
1049 }
1050 impl ::canadensis_encoding::Deserialize for State {
1051 fn deserialize(
1052 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1053 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1054 where
1055 Self: Sized,
1056 {
1057 Ok(Self::deserialize_zero_copy(cursor))
1058 }
1059 }
1060 #[test]
1061 fn test_layout() {
1062 assert_eq!(::core::mem::size_of::<State>() * 8, 512);
1063 assert_eq!(::core::mem::offset_of!(State, pose) * 8, 0);
1064 assert_eq!(::core::mem::offset_of!(State, twist) * 8, 320);
1065 }
1066 }
1067 pub mod state_var_0_1 {
1068 #[cfg_attr(
1073 not(doctest),
1074 doc = " See State for details. This type extends it with covariance matrices."
1075 )]
1076 #[derive(
1077 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
1078 )]
1079 #[repr(C, packed)]
1080 pub struct StateVar {
1081pub pose: crate::reg::udral::physics::kinematics::cartesian::pose_var_0_1::PoseVar,
1087pub twist: crate::reg::udral::physics::kinematics::cartesian::twist_var_0_1::TwistVar,
1093}
1094 impl ::canadensis_encoding::DataType for StateVar {
1095 const EXTENT_BYTES: Option<u32> = None;
1097 }
1098 impl ::canadensis_encoding::Message for StateVar {}
1099 impl StateVar {}
1100 impl ::canadensis_encoding::Serialize for StateVar {
1101 fn size_bits(&self) -> usize {
1102 1184
1103 }
1104 fn serialize(
1105 &self,
1106 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1107 ) {
1108 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
1109 }
1110 }
1111 impl ::canadensis_encoding::Deserialize for StateVar {
1112 fn deserialize(
1113 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1114 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1115 where
1116 Self: Sized,
1117 {
1118 Ok(Self::deserialize_zero_copy(cursor))
1119 }
1120 }
1121 #[test]
1122 fn test_layout() {
1123 assert_eq!(::core::mem::size_of::<StateVar>() * 8, 1184);
1124 assert_eq!(::core::mem::offset_of!(StateVar, pose) * 8, 0);
1125 assert_eq!(::core::mem::offset_of!(StateVar, twist) * 8, 656);
1126 }
1127 }
1128 pub mod state_var_ts_0_1 {
1129 pub struct StateVarTs {
1134pub timestamp: crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
1140pub value: crate::reg::udral::physics::kinematics::cartesian::state_var_0_1::StateVar,
1146}
1147 impl ::canadensis_encoding::DataType for StateVarTs {
1148 const EXTENT_BYTES: Option<u32> = None;
1150 }
1151 impl ::canadensis_encoding::Message for StateVarTs {}
1152 impl StateVarTs {}
1153 impl ::canadensis_encoding::Serialize for StateVarTs {
1154 fn size_bits(&self) -> usize {
1155 1240
1156 }
1157 fn serialize(
1158 &self,
1159 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1160 ) {
1161 cursor.write_composite(&self.timestamp);
1162 cursor.write_composite(&self.value);
1163 }
1164 }
1165 impl ::canadensis_encoding::Deserialize for StateVarTs {
1166 fn deserialize(
1167 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1168 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1169 where
1170 Self: Sized,
1171 {
1172 Ok(StateVarTs {
1173 timestamp: { cursor.read_composite()? },
1174 value: { cursor.read_composite()? },
1175 })
1176 }
1177 }
1178 }
1179 pub mod twist_0_1 {
1180 #[cfg_attr(
1185 not(doctest),
1186 doc = " Motion of a rigid body in 3D space defined in the body frame."
1187 )]
1188 #[derive(
1189 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
1190 )]
1191 #[repr(C, packed)]
1192 pub struct Twist {
1193 #[cfg_attr(not(doctest), doc = " Linear velocity in the body frame.")]
1194 pub linear: crate::uavcan::si::unit::velocity::vector3_1_0::Vector3,
1200 #[cfg_attr(
1201 not(doctest),
1202 doc = " Angular velocity about the fixed axes of the body frame (extrinsic)."
1203 )]
1204 pub angular:
1210 crate::uavcan::si::unit::angular_velocity::vector3_1_0::Vector3,
1211 }
1212 impl ::canadensis_encoding::DataType for Twist {
1213 const EXTENT_BYTES: Option<u32> = None;
1215 }
1216 impl ::canadensis_encoding::Message for Twist {}
1217 impl Twist {}
1218 impl ::canadensis_encoding::Serialize for Twist {
1219 fn size_bits(&self) -> usize {
1220 192
1221 }
1222 fn serialize(
1223 &self,
1224 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1225 ) {
1226 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
1227 }
1228 }
1229 impl ::canadensis_encoding::Deserialize for Twist {
1230 fn deserialize(
1231 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1232 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1233 where
1234 Self: Sized,
1235 {
1236 Ok(Self::deserialize_zero_copy(cursor))
1237 }
1238 }
1239 #[test]
1240 fn test_layout() {
1241 assert_eq!(::core::mem::size_of::<Twist>() * 8, 192);
1242 assert_eq!(::core::mem::offset_of!(Twist, linear) * 8, 0);
1243 assert_eq!(::core::mem::offset_of!(Twist, angular) * 8, 96);
1244 }
1245 }
1246 pub mod twist_var_0_1 {
1247 #[derive(
1252 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
1253 )]
1254 #[repr(C, packed)]
1255 pub struct TwistVar {
1256 pub value:
1262 crate::reg::udral::physics::kinematics::cartesian::twist_0_1::Twist,
1263 #[cfg_attr(
1264 not(doctest),
1265 doc = " Upper-right triangle of the covariance matrix:\n\n translation along axis rotation about axis\n X Y Z X Y Z\n +----------------------------------------------\n X velocity |\n Y velocity | (m/s)^2 (m*rad)/s^2\n Z velocity |\n X angular velocity |\n Y angular velocity | (rad/s)^2\n Z angular velocity |"
1266 )]
1267 pub covariance_urt: [::half::f16; 21],
1273 }
1274 impl ::canadensis_encoding::DataType for TwistVar {
1275 const EXTENT_BYTES: Option<u32> = None;
1277 }
1278 impl ::canadensis_encoding::Message for TwistVar {}
1279 impl TwistVar {}
1280 impl ::canadensis_encoding::Serialize for TwistVar {
1281 fn size_bits(&self) -> usize {
1282 528
1283 }
1284 fn serialize(
1285 &self,
1286 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1287 ) {
1288 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
1289 }
1290 }
1291 impl ::canadensis_encoding::Deserialize for TwistVar {
1292 fn deserialize(
1293 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1294 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1295 where
1296 Self: Sized,
1297 {
1298 Ok(Self::deserialize_zero_copy(cursor))
1299 }
1300 }
1301 #[test]
1302 fn test_layout() {
1303 assert_eq!(::core::mem::size_of::<TwistVar>() * 8, 528);
1304 assert_eq!(::core::mem::offset_of!(TwistVar, value) * 8, 0);
1305 assert_eq!(::core::mem::offset_of!(TwistVar, covariance_urt) * 8, 192);
1306 }
1307 }
1308 pub mod twist_var_ts_0_1 {
1309 pub struct TwistVarTs {
1314pub timestamp: crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
1320pub value: crate::reg::udral::physics::kinematics::cartesian::twist_var_0_1::TwistVar,
1326}
1327 impl ::canadensis_encoding::DataType for TwistVarTs {
1328 const EXTENT_BYTES: Option<u32> = None;
1330 }
1331 impl ::canadensis_encoding::Message for TwistVarTs {}
1332 impl TwistVarTs {}
1333 impl ::canadensis_encoding::Serialize for TwistVarTs {
1334 fn size_bits(&self) -> usize {
1335 584
1336 }
1337 fn serialize(
1338 &self,
1339 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1340 ) {
1341 cursor.write_composite(&self.timestamp);
1342 cursor.write_composite(&self.value);
1343 }
1344 }
1345 impl ::canadensis_encoding::Deserialize for TwistVarTs {
1346 fn deserialize(
1347 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1348 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1349 where
1350 Self: Sized,
1351 {
1352 Ok(TwistVarTs {
1353 timestamp: { cursor.read_composite()? },
1354 value: { cursor.read_composite()? },
1355 })
1356 }
1357 }
1358 }
1359 }
1360 pub mod geodetic {
1361 pub mod point_0_1 {
1362 #[cfg_attr(
1367 not(doctest),
1368 doc = " Geodetic position: latitude, longitude, and altitude.\n The order is chosen to match the axis ordering of the NED frame.\n The size and layout of this structure is equal to the Cartesian pose type."
1369 )]
1370 #[derive(
1371 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
1372 )]
1373 #[repr(C, packed)]
1374 pub struct Point {
1375 #[cfg_attr(not(doctest), doc = " [radian]")]
1376 pub latitude: f64,
1382 #[cfg_attr(not(doctest), doc = " [radian]")]
1383 pub longitude: f64,
1389 #[cfg_attr(
1390 not(doctest),
1391 doc = " Distance between the local mean sea level (MSL) and the focal point of the antenna. Positive altitude above the MSL."
1392 )]
1393 pub altitude:
1399 crate::uavcan::si::unit::length::wide_scalar_1_0::WideScalar,
1400 }
1401 impl ::canadensis_encoding::DataType for Point {
1402 const EXTENT_BYTES: Option<u32> = None;
1404 }
1405 impl ::canadensis_encoding::Message for Point {}
1406 impl Point {}
1407 impl ::canadensis_encoding::Serialize for Point {
1408 fn size_bits(&self) -> usize {
1409 192
1410 }
1411 fn serialize(
1412 &self,
1413 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1414 ) {
1415 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
1416 }
1417 }
1418 impl ::canadensis_encoding::Deserialize for Point {
1419 fn deserialize(
1420 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1421 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1422 where
1423 Self: Sized,
1424 {
1425 Ok(Self::deserialize_zero_copy(cursor))
1426 }
1427 }
1428 #[test]
1429 fn test_layout() {
1430 assert_eq!(::core::mem::size_of::<Point>() * 8, 192);
1431 assert_eq!(::core::mem::offset_of!(Point, latitude) * 8, 0);
1432 assert_eq!(::core::mem::offset_of!(Point, longitude) * 8, 64);
1433 assert_eq!(::core::mem::offset_of!(Point, altitude) * 8, 128);
1434 }
1435 }
1436 pub mod point_state_0_1 {
1437 #[cfg_attr(
1442 not(doctest),
1443 doc = " The kinematic state of a point, as opposed to that of a body, is devoid of rotation information.\n Therefore, the velocity is specified in the parent coordinate frame."
1444 )]
1445 #[derive(
1446 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
1447 )]
1448 #[repr(C, packed)]
1449 pub struct PointState {
1450 pub position:
1456 crate::reg::udral::physics::kinematics::geodetic::point_0_1::Point,
1457 pub velocity: crate::uavcan::si::unit::velocity::vector3_1_0::Vector3,
1463 }
1464 impl ::canadensis_encoding::DataType for PointState {
1465 const EXTENT_BYTES: Option<u32> = None;
1467 }
1468 impl ::canadensis_encoding::Message for PointState {}
1469 impl PointState {}
1470 impl ::canadensis_encoding::Serialize for PointState {
1471 fn size_bits(&self) -> usize {
1472 288
1473 }
1474 fn serialize(
1475 &self,
1476 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1477 ) {
1478 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
1479 }
1480 }
1481 impl ::canadensis_encoding::Deserialize for PointState {
1482 fn deserialize(
1483 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1484 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1485 where
1486 Self: Sized,
1487 {
1488 Ok(Self::deserialize_zero_copy(cursor))
1489 }
1490 }
1491 #[test]
1492 fn test_layout() {
1493 assert_eq!(::core::mem::size_of::<PointState>() * 8, 288);
1494 assert_eq!(::core::mem::offset_of!(PointState, position) * 8, 0);
1495 assert_eq!(::core::mem::offset_of!(PointState, velocity) * 8, 192);
1496 }
1497 }
1498 pub mod point_state_var_0_1 {
1499 #[cfg_attr(not(doctest), doc = " See PointState for details.")]
1504 #[derive(
1505 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
1506 )]
1507 #[repr(C, packed)]
1508 pub struct PointStateVar {
1509pub position: crate::reg::udral::physics::kinematics::geodetic::point_var_0_1::PointVar,
1515pub velocity: crate::reg::udral::physics::kinematics::translation::velocity3_var_0_2::Velocity3Var,
1521}
1522 impl ::canadensis_encoding::DataType for PointStateVar {
1523 const EXTENT_BYTES: Option<u32> = None;
1525 }
1526 impl ::canadensis_encoding::Message for PointStateVar {}
1527 impl PointStateVar {}
1528 impl ::canadensis_encoding::Serialize for PointStateVar {
1529 fn size_bits(&self) -> usize {
1530 480
1531 }
1532 fn serialize(
1533 &self,
1534 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1535 ) {
1536 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
1537 }
1538 }
1539 impl ::canadensis_encoding::Deserialize for PointStateVar {
1540 fn deserialize(
1541 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1542 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1543 where
1544 Self: Sized,
1545 {
1546 Ok(Self::deserialize_zero_copy(cursor))
1547 }
1548 }
1549 #[test]
1550 fn test_layout() {
1551 assert_eq!(::core::mem::size_of::<PointStateVar>() * 8, 480);
1552 assert_eq!(::core::mem::offset_of!(PointStateVar, position) * 8, 0);
1553 assert_eq!(::core::mem::offset_of!(PointStateVar, velocity) * 8, 288);
1554 }
1555 }
1556 pub mod point_state_var_ts_0_1 {
1557 pub struct PointStateVarTs {
1562pub timestamp: crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
1568pub value: crate::reg::udral::physics::kinematics::geodetic::point_state_var_0_1::PointStateVar,
1574}
1575 impl ::canadensis_encoding::DataType for PointStateVarTs {
1576 const EXTENT_BYTES: Option<u32> = None;
1578 }
1579 impl ::canadensis_encoding::Message for PointStateVarTs {}
1580 impl PointStateVarTs {}
1581 impl ::canadensis_encoding::Serialize for PointStateVarTs {
1582 fn size_bits(&self) -> usize {
1583 536
1584 }
1585 fn serialize(
1586 &self,
1587 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1588 ) {
1589 cursor.write_composite(&self.timestamp);
1590 cursor.write_composite(&self.value);
1591 }
1592 }
1593 impl ::canadensis_encoding::Deserialize for PointStateVarTs {
1594 fn deserialize(
1595 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1596 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1597 where
1598 Self: Sized,
1599 {
1600 Ok(PointStateVarTs {
1601 timestamp: { cursor.read_composite()? },
1602 value: { cursor.read_composite()? },
1603 })
1604 }
1605 }
1606 }
1607 pub mod point_var_0_1 {
1608 #[derive(
1613 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
1614 )]
1615 #[repr(C, packed)]
1616 pub struct PointVar {
1617 pub value:
1623 crate::reg::udral::physics::kinematics::geodetic::point_0_1::Point,
1624 #[cfg_attr(
1625 not(doctest),
1626 doc = " [meter^2]\n Upper-right triangle of the covariance matrix.\n The position covariance is defined relative to a tangential plane through the specified latitude/longitude.\n Element ordering: latitude, longitude, altitude. It is chosen to match the axis ordering of the NED frame."
1627 )]
1628 pub covariance_urt: [::half::f16; 6],
1634 }
1635 impl ::canadensis_encoding::DataType for PointVar {
1636 const EXTENT_BYTES: Option<u32> = None;
1638 }
1639 impl ::canadensis_encoding::Message for PointVar {}
1640 impl PointVar {}
1641 impl ::canadensis_encoding::Serialize for PointVar {
1642 fn size_bits(&self) -> usize {
1643 288
1644 }
1645 fn serialize(
1646 &self,
1647 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1648 ) {
1649 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
1650 }
1651 }
1652 impl ::canadensis_encoding::Deserialize for PointVar {
1653 fn deserialize(
1654 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1655 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1656 where
1657 Self: Sized,
1658 {
1659 Ok(Self::deserialize_zero_copy(cursor))
1660 }
1661 }
1662 #[test]
1663 fn test_layout() {
1664 assert_eq!(::core::mem::size_of::<PointVar>() * 8, 288);
1665 assert_eq!(::core::mem::offset_of!(PointVar, value) * 8, 0);
1666 assert_eq!(::core::mem::offset_of!(PointVar, covariance_urt) * 8, 192);
1667 }
1668 }
1669 pub mod pose_0_1 {
1670 #[cfg_attr(
1675 not(doctest),
1676 doc = " Zero rotation is the state where the axes of the body frame are aligned with the axes of the local NED frame:\n X points north, Y points east, Z points down."
1677 )]
1678 #[derive(
1679 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
1680 )]
1681 #[repr(C, packed)]
1682 pub struct Pose {
1683 pub position:
1689 crate::reg::udral::physics::kinematics::geodetic::point_0_1::Point,
1690 pub orientation:
1696 crate::uavcan::si::unit::angle::quaternion_1_0::Quaternion,
1697 }
1698 impl ::canadensis_encoding::DataType for Pose {
1699 const EXTENT_BYTES: Option<u32> = None;
1701 }
1702 impl ::canadensis_encoding::Message for Pose {}
1703 impl Pose {}
1704 impl ::canadensis_encoding::Serialize for Pose {
1705 fn size_bits(&self) -> usize {
1706 320
1707 }
1708 fn serialize(
1709 &self,
1710 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1711 ) {
1712 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
1713 }
1714 }
1715 impl ::canadensis_encoding::Deserialize for Pose {
1716 fn deserialize(
1717 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1718 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1719 where
1720 Self: Sized,
1721 {
1722 Ok(Self::deserialize_zero_copy(cursor))
1723 }
1724 }
1725 #[test]
1726 fn test_layout() {
1727 assert_eq!(::core::mem::size_of::<Pose>() * 8, 320);
1728 assert_eq!(::core::mem::offset_of!(Pose, position) * 8, 0);
1729 assert_eq!(::core::mem::offset_of!(Pose, orientation) * 8, 192);
1730 }
1731 }
1732 pub mod pose_var_0_1 {
1733 #[derive(
1738 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
1739 )]
1740 #[repr(C, packed)]
1741 pub struct PoseVar {
1742 pub value:
1748 crate::reg::udral::physics::kinematics::geodetic::pose_0_1::Pose,
1749 #[cfg_attr(
1750 not(doctest),
1751 doc = " Upper-right triangle of the covariance matrix:\n\n [parent frame] [child (body) frame]\n translation along axis rotation about axis\n X Y Z X Y Z\n +-----------------------------------------------\n X position |\n Y position | m^2 m*rad\n Z position |\n X rotation |\n Y rotation | rad^2\n Z rotation |"
1752 )]
1753 pub covariance_urt: [::half::f16; 21],
1759 }
1760 impl ::canadensis_encoding::DataType for PoseVar {
1761 const EXTENT_BYTES: Option<u32> = None;
1763 }
1764 impl ::canadensis_encoding::Message for PoseVar {}
1765 impl PoseVar {}
1766 impl ::canadensis_encoding::Serialize for PoseVar {
1767 fn size_bits(&self) -> usize {
1768 656
1769 }
1770 fn serialize(
1771 &self,
1772 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1773 ) {
1774 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
1775 }
1776 }
1777 impl ::canadensis_encoding::Deserialize for PoseVar {
1778 fn deserialize(
1779 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1780 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1781 where
1782 Self: Sized,
1783 {
1784 Ok(Self::deserialize_zero_copy(cursor))
1785 }
1786 }
1787 #[test]
1788 fn test_layout() {
1789 assert_eq!(::core::mem::size_of::<PoseVar>() * 8, 656);
1790 assert_eq!(::core::mem::offset_of!(PoseVar, value) * 8, 0);
1791 assert_eq!(::core::mem::offset_of!(PoseVar, covariance_urt) * 8, 320);
1792 }
1793 }
1794 pub mod state_0_1 {
1795 #[cfg_attr(
1800 not(doctest),
1801 doc = " First-order kinematic state of a body near the surface of a planet.\n The pose defines a coordinate system transformation from the parent frame to the child frame.\n The twist is specified in the child frame (body frame)."
1802 )]
1803 #[derive(
1804 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
1805 )]
1806 #[repr(C, packed)]
1807 pub struct State {
1808 pub pose:
1814 crate::reg::udral::physics::kinematics::geodetic::pose_0_1::Pose,
1815 pub twist:
1821 crate::reg::udral::physics::kinematics::cartesian::twist_0_1::Twist,
1822 }
1823 impl ::canadensis_encoding::DataType for State {
1824 const EXTENT_BYTES: Option<u32> = None;
1826 }
1827 impl ::canadensis_encoding::Message for State {}
1828 impl State {}
1829 impl ::canadensis_encoding::Serialize for State {
1830 fn size_bits(&self) -> usize {
1831 512
1832 }
1833 fn serialize(
1834 &self,
1835 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1836 ) {
1837 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
1838 }
1839 }
1840 impl ::canadensis_encoding::Deserialize for State {
1841 fn deserialize(
1842 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1843 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1844 where
1845 Self: Sized,
1846 {
1847 Ok(Self::deserialize_zero_copy(cursor))
1848 }
1849 }
1850 #[test]
1851 fn test_layout() {
1852 assert_eq!(::core::mem::size_of::<State>() * 8, 512);
1853 assert_eq!(::core::mem::offset_of!(State, pose) * 8, 0);
1854 assert_eq!(::core::mem::offset_of!(State, twist) * 8, 320);
1855 }
1856 }
1857 pub mod state_var_0_1 {
1858 #[cfg_attr(
1863 not(doctest),
1864 doc = " See State for details. This type extends it with covariance matrices."
1865 )]
1866 #[derive(
1867 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
1868 )]
1869 #[repr(C, packed)]
1870 pub struct StateVar {
1871pub pose: crate::reg::udral::physics::kinematics::geodetic::pose_var_0_1::PoseVar,
1877pub twist: crate::reg::udral::physics::kinematics::cartesian::twist_var_0_1::TwistVar,
1883}
1884 impl ::canadensis_encoding::DataType for StateVar {
1885 const EXTENT_BYTES: Option<u32> = None;
1887 }
1888 impl ::canadensis_encoding::Message for StateVar {}
1889 impl StateVar {}
1890 impl ::canadensis_encoding::Serialize for StateVar {
1891 fn size_bits(&self) -> usize {
1892 1184
1893 }
1894 fn serialize(
1895 &self,
1896 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1897 ) {
1898 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
1899 }
1900 }
1901 impl ::canadensis_encoding::Deserialize for StateVar {
1902 fn deserialize(
1903 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1904 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1905 where
1906 Self: Sized,
1907 {
1908 Ok(Self::deserialize_zero_copy(cursor))
1909 }
1910 }
1911 #[test]
1912 fn test_layout() {
1913 assert_eq!(::core::mem::size_of::<StateVar>() * 8, 1184);
1914 assert_eq!(::core::mem::offset_of!(StateVar, pose) * 8, 0);
1915 assert_eq!(::core::mem::offset_of!(StateVar, twist) * 8, 656);
1916 }
1917 }
1918 pub mod state_var_ts_0_1 {
1919 pub struct StateVarTs {
1924pub timestamp: crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
1930pub value: crate::reg::udral::physics::kinematics::geodetic::state_var_0_1::StateVar,
1936}
1937 impl ::canadensis_encoding::DataType for StateVarTs {
1938 const EXTENT_BYTES: Option<u32> = None;
1940 }
1941 impl ::canadensis_encoding::Message for StateVarTs {}
1942 impl StateVarTs {}
1943 impl ::canadensis_encoding::Serialize for StateVarTs {
1944 fn size_bits(&self) -> usize {
1945 1240
1946 }
1947 fn serialize(
1948 &self,
1949 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
1950 ) {
1951 cursor.write_composite(&self.timestamp);
1952 cursor.write_composite(&self.value);
1953 }
1954 }
1955 impl ::canadensis_encoding::Deserialize for StateVarTs {
1956 fn deserialize(
1957 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
1958 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
1959 where
1960 Self: Sized,
1961 {
1962 Ok(StateVarTs {
1963 timestamp: { cursor.read_composite()? },
1964 value: { cursor.read_composite()? },
1965 })
1966 }
1967 }
1968 }
1969 }
1970 pub mod rotation {
1971 pub mod planar_0_1 {
1972 #[cfg_attr(not(doctest), doc = " Rotation about an axis.")]
1977 #[derive(
1978 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
1979 )]
1980 #[repr(C, packed)]
1981 pub struct Planar {
1982 pub angular_position:
1988 crate::uavcan::si::unit::angle::scalar_1_0::Scalar,
1989 pub angular_velocity:
1995 crate::uavcan::si::unit::angular_velocity::scalar_1_0::Scalar,
1996 pub angular_acceleration:
2002 crate::uavcan::si::unit::angular_acceleration::scalar_1_0::Scalar,
2003 }
2004 impl ::canadensis_encoding::DataType for Planar {
2005 const EXTENT_BYTES: Option<u32> = None;
2007 }
2008 impl ::canadensis_encoding::Message for Planar {}
2009 impl Planar {}
2010 impl ::canadensis_encoding::Serialize for Planar {
2011 fn size_bits(&self) -> usize {
2012 96
2013 }
2014 fn serialize(
2015 &self,
2016 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
2017 ) {
2018 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
2019 }
2020 }
2021 impl ::canadensis_encoding::Deserialize for Planar {
2022 fn deserialize(
2023 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2024 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2025 where
2026 Self: Sized,
2027 {
2028 Ok(Self::deserialize_zero_copy(cursor))
2029 }
2030 }
2031 #[test]
2032 fn test_layout() {
2033 assert_eq!(::core::mem::size_of::<Planar>() * 8, 96);
2034 assert_eq!(::core::mem::offset_of!(Planar, angular_position) * 8, 0);
2035 assert_eq!(::core::mem::offset_of!(Planar, angular_velocity) * 8, 32);
2036 assert_eq!(
2037 ::core::mem::offset_of!(Planar, angular_acceleration) * 8,
2038 64
2039 );
2040 }
2041 }
2042 pub mod planar_ts_0_1 {
2043 pub struct PlanarTs {
2048pub timestamp: crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
2054pub value: crate::reg::udral::physics::kinematics::rotation::planar_0_1::Planar,
2060}
2061 impl ::canadensis_encoding::DataType for PlanarTs {
2062 const EXTENT_BYTES: Option<u32> = None;
2064 }
2065 impl ::canadensis_encoding::Message for PlanarTs {}
2066 impl PlanarTs {}
2067 impl ::canadensis_encoding::Serialize for PlanarTs {
2068 fn size_bits(&self) -> usize {
2069 152
2070 }
2071 fn serialize(
2072 &self,
2073 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
2074 ) {
2075 cursor.write_composite(&self.timestamp);
2076 cursor.write_composite(&self.value);
2077 }
2078 }
2079 impl ::canadensis_encoding::Deserialize for PlanarTs {
2080 fn deserialize(
2081 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2082 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2083 where
2084 Self: Sized,
2085 {
2086 Ok(PlanarTs {
2087 timestamp: { cursor.read_composite()? },
2088 value: { cursor.read_composite()? },
2089 })
2090 }
2091 }
2092 }
2093 }
2094 pub mod translation {
2095 pub mod linear_0_1 {
2096 #[cfg_attr(not(doctest), doc = " Movement along an axis.")]
2101 #[derive(
2102 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
2103 )]
2104 #[repr(C, packed)]
2105 pub struct Linear {
2106 pub position: crate::uavcan::si::unit::length::scalar_1_0::Scalar,
2112 pub velocity: crate::uavcan::si::unit::velocity::scalar_1_0::Scalar,
2118 pub acceleration:
2124 crate::uavcan::si::unit::acceleration::scalar_1_0::Scalar,
2125 }
2126 impl ::canadensis_encoding::DataType for Linear {
2127 const EXTENT_BYTES: Option<u32> = None;
2129 }
2130 impl ::canadensis_encoding::Message for Linear {}
2131 impl Linear {}
2132 impl ::canadensis_encoding::Serialize for Linear {
2133 fn size_bits(&self) -> usize {
2134 96
2135 }
2136 fn serialize(
2137 &self,
2138 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
2139 ) {
2140 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
2141 }
2142 }
2143 impl ::canadensis_encoding::Deserialize for Linear {
2144 fn deserialize(
2145 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2146 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2147 where
2148 Self: Sized,
2149 {
2150 Ok(Self::deserialize_zero_copy(cursor))
2151 }
2152 }
2153 #[test]
2154 fn test_layout() {
2155 assert_eq!(::core::mem::size_of::<Linear>() * 8, 96);
2156 assert_eq!(::core::mem::offset_of!(Linear, position) * 8, 0);
2157 assert_eq!(::core::mem::offset_of!(Linear, velocity) * 8, 32);
2158 assert_eq!(::core::mem::offset_of!(Linear, acceleration) * 8, 64);
2159 }
2160 }
2161 pub mod linear_ts_0_1 {
2162 pub struct LinearTs {
2167pub timestamp: crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
2173pub value: crate::reg::udral::physics::kinematics::translation::linear_0_1::Linear,
2179}
2180 impl ::canadensis_encoding::DataType for LinearTs {
2181 const EXTENT_BYTES: Option<u32> = None;
2183 }
2184 impl ::canadensis_encoding::Message for LinearTs {}
2185 impl LinearTs {}
2186 impl ::canadensis_encoding::Serialize for LinearTs {
2187 fn size_bits(&self) -> usize {
2188 152
2189 }
2190 fn serialize(
2191 &self,
2192 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
2193 ) {
2194 cursor.write_composite(&self.timestamp);
2195 cursor.write_composite(&self.value);
2196 }
2197 }
2198 impl ::canadensis_encoding::Deserialize for LinearTs {
2199 fn deserialize(
2200 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2201 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2202 where
2203 Self: Sized,
2204 {
2205 Ok(LinearTs {
2206 timestamp: { cursor.read_composite()? },
2207 value: { cursor.read_composite()? },
2208 })
2209 }
2210 }
2211 }
2212 pub mod linear_var_ts_0_1 {
2213 #[cfg_attr(
2218 not(doctest),
2219 doc = " This is a structural subtype of LinearTs.\n Use best guess if the error variance is unknown."
2220 )]
2221 pub struct LinearVarTs {
2222pub value: crate::reg::udral::physics::kinematics::translation::linear_ts_0_1::LinearTs,
2228#[cfg_attr(not(doctest), doc = " [meter^2]")]
2229pub position_error_variance: ::half::f16,
2235#[cfg_attr(not(doctest), doc = " [(meter/second)^2]")]
2236pub velocity_error_variance: ::half::f16,
2242#[cfg_attr(not(doctest), doc = " [(meter/second^2)^2]")]
2243pub acceleration_error_variance: ::half::f16,
2249}
2250 impl ::canadensis_encoding::DataType for LinearVarTs {
2251 const EXTENT_BYTES: Option<u32> = None;
2253 }
2254 impl ::canadensis_encoding::Message for LinearVarTs {}
2255 impl LinearVarTs {}
2256 impl ::canadensis_encoding::Serialize for LinearVarTs {
2257 fn size_bits(&self) -> usize {
2258 200
2259 }
2260 fn serialize(
2261 &self,
2262 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
2263 ) {
2264 cursor.write_composite(&self.value);
2265 cursor.write_f16(self.position_error_variance);
2266 cursor.write_f16(self.velocity_error_variance);
2267 cursor.write_f16(self.acceleration_error_variance);
2268 }
2269 }
2270 impl ::canadensis_encoding::Deserialize for LinearVarTs {
2271 fn deserialize(
2272 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2273 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2274 where
2275 Self: Sized,
2276 {
2277 Ok(LinearVarTs {
2278 value: { cursor.read_composite()? },
2279 position_error_variance: { cursor.read_f16() },
2280 velocity_error_variance: { cursor.read_f16() },
2281 acceleration_error_variance: { cursor.read_f16() },
2282 })
2283 }
2284 }
2285 }
2286 pub mod velocity1_var_ts_0_1 {
2287 #[cfg_attr(
2292 not(doctest),
2293 doc = " Linear velocity with timestamp and covariance.\n Observe that this is a structural subtype of uavcan.si.sample.velocity.Scalar.1.0.\n For a non-timestamped estimate without covariance use the raw SI type directly."
2294 )]
2295 pub struct Velocity1VarTs {
2296 pub value: crate::uavcan::si::sample::velocity::scalar_1_0::Scalar,
2302 #[cfg_attr(not(doctest), doc = " [(meter/second)^2]")]
2303 pub error_variance: ::half::f16,
2309 }
2310 impl ::canadensis_encoding::DataType for Velocity1VarTs {
2311 const EXTENT_BYTES: Option<u32> = None;
2313 }
2314 impl ::canadensis_encoding::Message for Velocity1VarTs {}
2315 impl Velocity1VarTs {}
2316 impl ::canadensis_encoding::Serialize for Velocity1VarTs {
2317 fn size_bits(&self) -> usize {
2318 104
2319 }
2320 fn serialize(
2321 &self,
2322 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
2323 ) {
2324 cursor.write_composite(&self.value);
2325 cursor.write_f16(self.error_variance);
2326 }
2327 }
2328 impl ::canadensis_encoding::Deserialize for Velocity1VarTs {
2329 fn deserialize(
2330 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2331 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2332 where
2333 Self: Sized,
2334 {
2335 Ok(Velocity1VarTs {
2336 value: { cursor.read_composite()? },
2337 error_variance: { cursor.read_f16() },
2338 })
2339 }
2340 }
2341 }
2342 #[allow(deprecated)]
2343 #[cfg_attr(not(test), deprecated)]
2344 pub mod velocity3_var_0_1 {
2345 #[cfg_attr(
2350 not(doctest),
2351 doc = " Linear velocity with covariance.\n Observe that this is a structural subtype of uavcan.si.unit.velocity.Scalar.1.0."
2352 )]
2353 #[deprecated]
2354 pub struct Velocity3Var {
2355 pub value: crate::uavcan::si::sample::velocity::vector3_1_0::Vector3,
2361 #[cfg_attr(
2362 not(doctest),
2363 doc = " [(meter/second)^2] Upper-right triangle of the covariance matrix."
2364 )]
2365 pub covariance_urt: [::half::f16; 6],
2371 }
2372 impl ::canadensis_encoding::DataType for Velocity3Var {
2373 const EXTENT_BYTES: Option<u32> = None;
2375 }
2376 impl ::canadensis_encoding::Message for Velocity3Var {}
2377 impl Velocity3Var {}
2378 impl ::canadensis_encoding::Serialize for Velocity3Var {
2379 fn size_bits(&self) -> usize {
2380 248
2381 }
2382 fn serialize(
2383 &self,
2384 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
2385 ) {
2386 cursor.write_composite(&self.value);
2387 for value in (self.covariance_urt).iter() {
2388 cursor.write_f16(*value);
2389 }
2390 }
2391 }
2392 impl ::canadensis_encoding::Deserialize for Velocity3Var {
2393 fn deserialize(
2394 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2395 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2396 where
2397 Self: Sized,
2398 {
2399 Ok(Velocity3Var {
2400 value: { cursor.read_composite()? },
2401 covariance_urt: {
2402 [
2403 cursor.read_f16(),
2404 cursor.read_f16(),
2405 cursor.read_f16(),
2406 cursor.read_f16(),
2407 cursor.read_f16(),
2408 cursor.read_f16(),
2409 ]
2410 },
2411 })
2412 }
2413 }
2414 }
2415 pub mod velocity3_var_0_2 {
2416 #[cfg_attr(
2421 not(doctest),
2422 doc = " Linear velocity with covariance.\n Observe that this is a structural subtype of uavcan.si.unit.velocity.Scalar.1.0."
2423 )]
2424 #[derive(
2425 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
2426 )]
2427 #[repr(C, packed)]
2428 pub struct Velocity3Var {
2429 pub value: crate::uavcan::si::unit::velocity::vector3_1_0::Vector3,
2435 #[cfg_attr(
2436 not(doctest),
2437 doc = " [(meter/second)^2] Upper-right triangle of the covariance matrix."
2438 )]
2439 pub covariance_urt: [::half::f16; 6],
2445 }
2446 impl ::canadensis_encoding::DataType for Velocity3Var {
2447 const EXTENT_BYTES: Option<u32> = None;
2449 }
2450 impl ::canadensis_encoding::Message for Velocity3Var {}
2451 impl Velocity3Var {}
2452 impl ::canadensis_encoding::Serialize for Velocity3Var {
2453 fn size_bits(&self) -> usize {
2454 192
2455 }
2456 fn serialize(
2457 &self,
2458 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
2459 ) {
2460 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
2461 }
2462 }
2463 impl ::canadensis_encoding::Deserialize for Velocity3Var {
2464 fn deserialize(
2465 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2466 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2467 where
2468 Self: Sized,
2469 {
2470 Ok(Self::deserialize_zero_copy(cursor))
2471 }
2472 }
2473 #[test]
2474 fn test_layout() {
2475 assert_eq!(::core::mem::size_of::<Velocity3Var>() * 8, 192);
2476 assert_eq!(::core::mem::offset_of!(Velocity3Var, value) * 8, 0);
2477 assert_eq!(
2478 ::core::mem::offset_of!(Velocity3Var, covariance_urt) * 8,
2479 96
2480 );
2481 }
2482 }
2483 }
2484 }
2485 pub mod optics {
2486 pub mod high_color_0_1 {
2487 #[cfg_attr(
2492 not(doctest),
2493 doc = " Color in the standard 16-bit 5-6-5 RGB format (green is wider due to non-uniform color sensitivity of the human eye).\n https://en.wikipedia.org/wiki/High_color\n\n For reasons of unification, a monochrome light can be modeled using the same type,\n where the brightness is defined as the mean of the color components normalized to one:\n\n brightness = (red/MAX_RED + green/MAX_GREEN + blue/MAX_BLUE) / 3"
2494 )]
2495 pub struct HighColor {
2496 pub red: u8,
2502 pub green: u8,
2508 pub blue: u8,
2514 }
2515 impl ::canadensis_encoding::DataType for HighColor {
2516 const EXTENT_BYTES: Option<u32> = None;
2518 }
2519 impl ::canadensis_encoding::Message for HighColor {}
2520 impl HighColor {
2521 pub const MAX_RED: u8 = 31;
2522 pub const MAX_GREEN: u8 = 63;
2523 pub const MAX_BLUE: u8 = 31;
2524 }
2525 impl ::canadensis_encoding::Serialize for HighColor {
2526 fn size_bits(&self) -> usize {
2527 16
2528 }
2529 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
2530 cursor.write_u5(self.red);
2531 cursor.write_u6(self.green);
2532 cursor.write_u5(self.blue);
2533 }
2534 }
2535 impl ::canadensis_encoding::Deserialize for HighColor {
2536 fn deserialize(
2537 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2538 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2539 where
2540 Self: Sized,
2541 {
2542 Ok(HighColor {
2543 red: { cursor.read_u5() as _ },
2544 green: { cursor.read_u6() as _ },
2545 blue: { cursor.read_u5() as _ },
2546 })
2547 }
2548 }
2549 }
2550 }
2551 pub mod thermodynamics {
2552 pub mod pressure_temp_var_ts_0_1 {
2553 #[cfg_attr(
2558 not(doctest),
2559 doc = " Timestamped fluid pressure and temperature (sampled synchronously) with covariance.\n Observe that this is a structural subtype of uavcan.si.sample.pressure.Scalar.1.0."
2560 )]
2561 pub struct PressureTempVarTs {
2562 pub timestamp:
2568 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
2569 pub pressure: crate::uavcan::si::unit::pressure::scalar_1_0::Scalar,
2575 pub temperature: crate::uavcan::si::unit::temperature::scalar_1_0::Scalar,
2581 #[cfg_attr(
2582 not(doctest),
2583 doc = " The upper-right triangle of the covariance matrix (following the matrix packing rules defined in Specification).\n 0 -- pascal^2\n 1 -- pascal*kelvin\n 2 -- kelvin^2"
2584 )]
2585 pub covariance_urt: [::half::f16; 3],
2591 }
2592 impl ::canadensis_encoding::DataType for PressureTempVarTs {
2593 const EXTENT_BYTES: Option<u32> = None;
2595 }
2596 impl ::canadensis_encoding::Message for PressureTempVarTs {}
2597 impl PressureTempVarTs {}
2598 impl ::canadensis_encoding::Serialize for PressureTempVarTs {
2599 fn size_bits(&self) -> usize {
2600 168
2601 }
2602 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
2603 cursor.write_composite(&self.timestamp);
2604 cursor.write_composite(&self.pressure);
2605 cursor.write_composite(&self.temperature);
2606 for value in (self.covariance_urt).iter() {
2607 cursor.write_f16(*value);
2608 }
2609 }
2610 }
2611 impl ::canadensis_encoding::Deserialize for PressureTempVarTs {
2612 fn deserialize(
2613 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2614 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2615 where
2616 Self: Sized,
2617 {
2618 Ok(PressureTempVarTs {
2619 timestamp: { cursor.read_composite()? },
2620 pressure: { cursor.read_composite()? },
2621 temperature: { cursor.read_composite()? },
2622 covariance_urt: {
2623 [cursor.read_f16(), cursor.read_f16(), cursor.read_f16()]
2624 },
2625 })
2626 }
2627 }
2628 }
2629 }
2630 pub mod time {
2631 pub mod tai64_0_1 {
2632 #[cfg_attr(
2637 not(doctest),
2638 doc = " Standard TAI64N time label (https://cr.yp.to/libtai/tai64.html). Quote from the source:\n\n TAI stands for Temps Atomique International, the current international real-time standard.\n One TAI second is defined as the duration of 9192631770 periods of the radiation corresponding\n to the transition between the two hyperfine levels of the ground state of the cesium atom.\n TAI also specifies a frame of reference. Further discussion of special relativity is outside\n the scope of this document.\n\n A TAI64 label is an integer between 0 and 2^64 referring to a particular second of real time. Integer s refers to:\n\n - the TAI second beginning exactly 2^62 - s seconds before the beginning of 1970 TAI,\n if s is between 0 inclusive and 2^62 exclusive; or\n\n - the TAI second beginning exactly s - 2^62 seconds after the beginning of 1970 TAI,\n if s is between 2^62 inclusive and 2^63 exclusive.\n"
2639 )]
2640 #[derive(
2641 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
2642 )]
2643 #[repr(C, packed)]
2644 pub struct TAI64 {
2645 #[cfg_attr(
2646 not(doctest),
2647 doc = " [nanosecond] Nanoseconds elapsed since 1970-01-01T00:00:00Z TAI."
2648 )]
2649 pub tai64n: i64,
2655 }
2656 impl ::canadensis_encoding::DataType for TAI64 {
2657 const EXTENT_BYTES: Option<u32> = None;
2659 }
2660 impl ::canadensis_encoding::Message for TAI64 {}
2661 impl TAI64 {}
2662 impl ::canadensis_encoding::Serialize for TAI64 {
2663 fn size_bits(&self) -> usize {
2664 64
2665 }
2666 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
2667 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
2668 }
2669 }
2670 impl ::canadensis_encoding::Deserialize for TAI64 {
2671 fn deserialize(
2672 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2673 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2674 where
2675 Self: Sized,
2676 {
2677 Ok(Self::deserialize_zero_copy(cursor))
2678 }
2679 }
2680 #[test]
2681 fn test_layout() {
2682 assert_eq!(::core::mem::size_of::<TAI64>() * 8, 64);
2683 assert_eq!(::core::mem::offset_of!(TAI64, tai64n) * 8, 0);
2684 }
2685 }
2686 pub mod tai64_var_0_1 {
2687 #[derive(
2692 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
2693 )]
2694 #[repr(C, packed)]
2695 pub struct TAI64Var {
2696 pub value: crate::reg::udral::physics::time::tai64_0_1::TAI64,
2702 #[cfg_attr(
2703 not(doctest),
2704 doc = " [second^2]\n Error variance, in second squared, of the time estimate.\n Infinity indicates that the time estimates are not yet available.\n A non-positive value indicates that the error variance is unknown."
2705 )]
2706 pub error_variance: f32,
2712 }
2713 impl ::canadensis_encoding::DataType for TAI64Var {
2714 const EXTENT_BYTES: Option<u32> = None;
2716 }
2717 impl ::canadensis_encoding::Message for TAI64Var {}
2718 impl TAI64Var {}
2719 impl ::canadensis_encoding::Serialize for TAI64Var {
2720 fn size_bits(&self) -> usize {
2721 96
2722 }
2723 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
2724 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
2725 }
2726 }
2727 impl ::canadensis_encoding::Deserialize for TAI64Var {
2728 fn deserialize(
2729 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2730 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2731 where
2732 Self: Sized,
2733 {
2734 Ok(Self::deserialize_zero_copy(cursor))
2735 }
2736 }
2737 #[test]
2738 fn test_layout() {
2739 assert_eq!(::core::mem::size_of::<TAI64Var>() * 8, 96);
2740 assert_eq!(::core::mem::offset_of!(TAI64Var, value) * 8, 0);
2741 assert_eq!(::core::mem::offset_of!(TAI64Var, error_variance) * 8, 64);
2742 }
2743 }
2744 pub mod tai64_var_ts_0_1 {
2745 pub struct TAI64VarTs {
2750 pub timestamp:
2756 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
2757 pub value: crate::reg::udral::physics::time::tai64_var_0_1::TAI64Var,
2763 }
2764 impl ::canadensis_encoding::DataType for TAI64VarTs {
2765 const EXTENT_BYTES: Option<u32> = None;
2767 }
2768 impl ::canadensis_encoding::Message for TAI64VarTs {}
2769 impl TAI64VarTs {}
2770 impl ::canadensis_encoding::Serialize for TAI64VarTs {
2771 fn size_bits(&self) -> usize {
2772 152
2773 }
2774 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
2775 cursor.write_composite(&self.timestamp);
2776 cursor.write_composite(&self.value);
2777 }
2778 }
2779 impl ::canadensis_encoding::Deserialize for TAI64VarTs {
2780 fn deserialize(
2781 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2782 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2783 where
2784 Self: Sized,
2785 {
2786 Ok(TAI64VarTs {
2787 timestamp: { cursor.read_composite()? },
2788 value: { cursor.read_composite()? },
2789 })
2790 }
2791 }
2792 }
2793 }
2794 }
2795 pub mod service {
2796 pub mod actuator {
2797 pub mod common {
2798 pub mod _0_1 {
2799 #[cfg_attr(
2804 not(doctest),
2805 doc = " An actuator is a device that actuates a mechanical load using electric energy from the high-voltage DC power bus.\n There are multiple kinds of actuators with a dedicated namespace for each; additionally, this \"common\" namespace\n hosts certain elements shared between several (or all) kinds."
2806 )]
2807 #[derive(
2808 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
2809 )]
2810 #[repr(C, packed)]
2811 pub struct _0 {}
2812 impl ::canadensis_encoding::DataType for _0 {
2813 const EXTENT_BYTES: Option<u32> = Some(0);
2815 }
2816 impl ::canadensis_encoding::Message for _0 {}
2817 impl _0 {
2818 #[cfg_attr(
2819 not(doctest),
2820 doc = " [seconds]\n The actuator is allowed to enter a safe state (e.g., stop the controlled mechanism, disconnect itself from\n the load, etc. depending on the specifics of the application at hand) if no setpoint or readiness control messages\n have been received in this amount of time. Implementations are allowed to reduce this value, but never increase it."
2821 )]
2822 pub const CONTROL_TIMEOUT: f32 = 1_f32;
2823 #[cfg_attr(
2824 not(doctest),
2825 doc = " [second]\n This is the maximum publication period (minimum frequency) for all subjects described in this service.\n Subjects that are clocked by the setpoint should continue being published at least at this rate when setpoint is not\n being updated, unless the actuator is in the SLEEP state.\n The publication periods should be consistent across the group."
2826 )]
2827 pub const MAX_PUBLICATION_PERIOD: u8 = 1;
2828 }
2829 impl ::canadensis_encoding::Serialize for _0 {
2830 fn size_bits(&self) -> usize {
2831 0
2832 }
2833 fn serialize(
2834 &self,
2835 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
2836 ) {
2837 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
2838 }
2839 }
2840 impl ::canadensis_encoding::Deserialize for _0 {
2841 fn deserialize(
2842 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2843 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2844 where
2845 Self: Sized,
2846 {
2847 Ok(Self::deserialize_zero_copy(cursor))
2848 }
2849 }
2850 #[test]
2851 fn test_layout() {
2852 assert_eq!(::core::mem::size_of::<_0>() * 8, 0);
2853 }
2854 }
2855 pub mod fault_flags_0_1 {
2856 #[cfg_attr(
2861 not(doctest),
2862 doc = " A collection of detailed fault flags indicating problems detected by the service provider.\n A fault flag is set when the corresponding parameter exceeds its safe operating area (SOA) as defined by the vendor;\n see https://en.wikipedia.org/wiki/Safe_operating_area.\n As long as at least one flag is set, the service health should not be NOMINAL."
2863 )]
2864 pub struct FaultFlags {
2865 #[cfg_attr(
2866 not(doctest),
2867 doc = " The load is above SOA or regeneration below the SOA."
2868 )]
2869 pub overload: bool,
2875 #[cfg_attr(
2876 not(doctest),
2877 doc = " Supply voltage is above or below the SOA."
2878 )]
2879 pub voltage: bool,
2885 pub motor_temperature: bool,
2891 #[cfg_attr(
2892 not(doctest),
2893 doc = " Temperature is above or below the SOA."
2894 )]
2895 pub controller_temperature: bool,
2901 #[cfg_attr(
2902 not(doctest),
2903 doc = " The absolute velocity of the load is above the SOA."
2904 )]
2905 pub velocity: bool,
2911 #[cfg_attr(
2912 not(doctest),
2913 doc = " The load cannot be driven due to a mechanical failure."
2914 )]
2915 pub mechanical: bool,
2921 #[cfg_attr(
2922 not(doctest),
2923 doc = " The mechanical vibration level exceeds the SOA."
2924 )]
2925 pub vibration: bool,
2931 #[cfg_attr(
2932 not(doctest),
2933 doc = " Configuration is missing or invalid."
2934 )]
2935 pub configuration: bool,
2941 #[cfg_attr(
2942 not(doctest),
2943 doc = " The requested control mode is not supported by the actuator."
2944 )]
2945 pub control_mode: bool,
2951 #[cfg_attr(
2953 not(doctest),
2954 doc = " None of the above (vendor-specific)."
2955 )]
2956 pub other: bool,
2962 }
2963 impl ::canadensis_encoding::DataType for FaultFlags {
2964 const EXTENT_BYTES: Option<u32> = None;
2966 }
2967 impl ::canadensis_encoding::Message for FaultFlags {}
2968 impl FaultFlags {}
2969 impl ::canadensis_encoding::Serialize for FaultFlags {
2970 fn size_bits(&self) -> usize {
2971 16
2972 }
2973 fn serialize(
2974 &self,
2975 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
2976 ) {
2977 cursor.write_bool(self.overload);
2978 cursor.write_bool(self.voltage);
2979 cursor.write_bool(self.motor_temperature);
2980 cursor.write_bool(self.controller_temperature);
2981 cursor.write_bool(self.velocity);
2982 cursor.write_bool(self.mechanical);
2983 cursor.write_bool(self.vibration);
2984 cursor.write_bool(self.configuration);
2985 cursor.write_bool(self.control_mode);
2986 cursor.skip_6();
2987 cursor.write_bool(self.other);
2988 }
2989 }
2990 impl ::canadensis_encoding::Deserialize for FaultFlags {
2991 fn deserialize(
2992 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
2993 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
2994 where
2995 Self: Sized,
2996 {
2997 Ok(FaultFlags {
2998 overload: { cursor.read_bool() },
2999 voltage: { cursor.read_bool() },
3000 motor_temperature: { cursor.read_bool() },
3001 controller_temperature: { cursor.read_bool() },
3002 velocity: { cursor.read_bool() },
3003 mechanical: { cursor.read_bool() },
3004 vibration: { cursor.read_bool() },
3005 configuration: { cursor.read_bool() },
3006 control_mode: { cursor.read_bool() },
3007 other: {
3008 cursor.skip_6();
3009 cursor.read_bool()
3010 },
3011 })
3012 }
3013 }
3014 }
3015 pub mod feedback_0_1 {
3016 #[cfg_attr(
3021 not(doctest),
3022 doc = " This high-rate feedback should be published once immediately after a setpoint is applied.\n It follows that the publication rate of these messages equals that of the setpoint messages.\n When setpoint messages are not being emitted, the publication rate is implementation-defined, but it should not\n be lower than the defined limit.\n The priority of this message should be the same as that of the corresponding setpoint message."
3023 )]
3024 pub struct Feedback {
3025 #[cfg_attr(
3026 not(doctest),
3027 doc = " If ENGAGED, the actuator provides service according to its nominal performance characteristics.\n Otherwise, no availability guarantees are provided.\n Notice that the feedback type is a structural subtype of the heartbeat type, so one can subscribe to a\n feedback subject using the heartbeat type. Similarly, the heartbeat type is a structural subtype of the\n Readiness type, meaning that one can use the Readiness type as well."
3028 )]
3029 pub heartbeat:
3035 crate::reg::udral::service::common::heartbeat_0_1::Heartbeat,
3036 #[cfg_attr(
3037 not(doctest),
3038 doc = " [percent]\n Percentage of the maximum rated output intensity. May exceed +-100% in case of overload.\n Positive value indicates that power is applied to the load; negative indicates that power is being sunk from the\n load into the actuator power source.\n The consumer of this message may leverage this information to manage the control loop saturation."
3039 )]
3040 pub demand_factor_pct: i8,
3046 }
3047 impl ::canadensis_encoding::DataType for Feedback {
3048 const EXTENT_BYTES: Option<u32> = Some(63);
3050 }
3051 impl ::canadensis_encoding::Message for Feedback {}
3052 impl Feedback {}
3053 impl ::canadensis_encoding::Serialize for Feedback {
3054 fn size_bits(&self) -> usize {
3055 24
3056 }
3057 fn serialize(
3058 &self,
3059 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
3060 ) {
3061 cursor.write_composite(&self.heartbeat);
3062 cursor.write_aligned_u8(self.demand_factor_pct as u8);
3063 }
3064 }
3065 impl ::canadensis_encoding::Deserialize for Feedback {
3066 fn deserialize(
3067 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3068 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
3069 where
3070 Self: Sized,
3071 {
3072 Ok(Feedback {
3073 heartbeat: { cursor.read_composite()? },
3074 demand_factor_pct: { cursor.read_u8() as _ },
3075 })
3076 }
3077 }
3078 }
3079 pub mod sp {
3080 pub mod _0_1 {
3081 #[cfg_attr(
3086 not(doctest),
3087 doc = " This is a collection of weakly-typed primitives used to control groups of actuators synchronously.\n\n Actuators are expected to subscribe using the largest array type. Publishers would choose the array type\n depending on the number of actuators in the group. The actuators would be expecting the largest array type,\n where the missing elements will be zero-filled automatically by the protocol stack thanks to the\n Implicit Zero Extension Rule (refer to the Cyphal Specification for details).\n\n The physical meaning of the values contained in the array is defined by the respective actuator service specification.\n If ratiometric control is used, then the range should be [-1, +1].\n\n It follows that a standalone actuator (that is not a member of any group) is just a special case of a group of 1,\n where the setpoint type is a single scalar.\n\n The Cyphal Specification might benefit from supporting flexible array fields to avoid having to deal with redundant\n similar types: https://en.wikipedia.org/wiki/Flexible_array_member, so that instead of having multiple types that\n differ only in size of the array fields, one could just say `float16[0] value` such that the size of zero indicates\n that the array is a flex array."
3088 )]
3089 #[derive(
3090 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
3091 )]
3092 #[repr(C, packed)]
3093 pub struct _0 {}
3094 impl ::canadensis_encoding::DataType for _0 {
3095 const EXTENT_BYTES: Option<u32> = Some(0);
3097 }
3098 impl ::canadensis_encoding::Message for _0 {}
3099 impl _0 {
3100 #[cfg_attr(
3101 not(doctest),
3102 doc = " The float epsilon defined for convenience.\n See https://en.wikipedia.org/wiki/Machine_epsilon."
3103 )]
3104 pub const EPSILON: ::half::f16 = ::half::f16::from_bits(4096);
3105 }
3106 impl ::canadensis_encoding::Serialize for _0 {
3107 fn size_bits(&self) -> usize {
3108 0
3109 }
3110 fn serialize(
3111 &self,
3112 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
3113 ) {
3114 cursor
3115 .write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
3116 }
3117 }
3118 impl ::canadensis_encoding::Deserialize for _0 {
3119 fn deserialize(
3120 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3121 ) -> ::core::result::Result<
3122 Self,
3123 ::canadensis_encoding::DeserializeError,
3124 >
3125 where
3126 Self: Sized,
3127 {
3128 Ok(Self::deserialize_zero_copy(cursor))
3129 }
3130 }
3131 #[test]
3132 fn test_layout() {
3133 assert_eq!(::core::mem::size_of::<_0>() * 8, 0);
3134 }
3135 }
3136 pub mod scalar_0_1 {
3137 #[derive(
3142 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
3143 )]
3144 #[repr(C, packed)]
3145 pub struct Scalar {
3146 pub value: ::half::f16,
3152 }
3153 impl ::canadensis_encoding::DataType for Scalar {
3154 const EXTENT_BYTES: Option<u32> = Some(512);
3156 }
3157 impl ::canadensis_encoding::Message for Scalar {}
3158 impl Scalar {}
3159 impl ::canadensis_encoding::Serialize for Scalar {
3160 fn size_bits(&self) -> usize {
3161 16
3162 }
3163 fn serialize(
3164 &self,
3165 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
3166 ) {
3167 cursor
3168 .write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
3169 }
3170 }
3171 impl ::canadensis_encoding::Deserialize for Scalar {
3172 fn deserialize(
3173 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3174 ) -> ::core::result::Result<
3175 Self,
3176 ::canadensis_encoding::DeserializeError,
3177 >
3178 where
3179 Self: Sized,
3180 {
3181 Ok(Self::deserialize_zero_copy(cursor))
3182 }
3183 }
3184 #[test]
3185 fn test_layout() {
3186 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 16);
3187 assert_eq!(::core::mem::offset_of!(Scalar, value) * 8, 0);
3188 }
3189 }
3190 pub mod vector2_0_1 {
3191 #[derive(
3196 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
3197 )]
3198 #[repr(C, packed)]
3199 pub struct Vector2 {
3200 pub value: [::half::f16; 2],
3206 }
3207 impl ::canadensis_encoding::DataType for Vector2 {
3208 const EXTENT_BYTES: Option<u32> = Some(512);
3210 }
3211 impl ::canadensis_encoding::Message for Vector2 {}
3212 impl Vector2 {}
3213 impl ::canadensis_encoding::Serialize for Vector2 {
3214 fn size_bits(&self) -> usize {
3215 32
3216 }
3217 fn serialize(
3218 &self,
3219 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
3220 ) {
3221 cursor
3222 .write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
3223 }
3224 }
3225 impl ::canadensis_encoding::Deserialize for Vector2 {
3226 fn deserialize(
3227 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3228 ) -> ::core::result::Result<
3229 Self,
3230 ::canadensis_encoding::DeserializeError,
3231 >
3232 where
3233 Self: Sized,
3234 {
3235 Ok(Self::deserialize_zero_copy(cursor))
3236 }
3237 }
3238 #[test]
3239 fn test_layout() {
3240 assert_eq!(::core::mem::size_of::<Vector2>() * 8, 32);
3241 assert_eq!(::core::mem::offset_of!(Vector2, value) * 8, 0);
3242 }
3243 }
3244 pub mod vector31_0_1 {
3245 #[derive(
3250 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
3251 )]
3252 #[repr(C, packed)]
3253 pub struct Vector31 {
3254 pub value: [::half::f16; 31],
3260 }
3261 impl ::canadensis_encoding::DataType for Vector31 {
3262 const EXTENT_BYTES: Option<u32> = Some(512);
3264 }
3265 impl ::canadensis_encoding::Message for Vector31 {}
3266 impl Vector31 {}
3267 impl ::canadensis_encoding::Serialize for Vector31 {
3268 fn size_bits(&self) -> usize {
3269 496
3270 }
3271 fn serialize(
3272 &self,
3273 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
3274 ) {
3275 cursor
3276 .write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
3277 }
3278 }
3279 impl ::canadensis_encoding::Deserialize for Vector31 {
3280 fn deserialize(
3281 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3282 ) -> ::core::result::Result<
3283 Self,
3284 ::canadensis_encoding::DeserializeError,
3285 >
3286 where
3287 Self: Sized,
3288 {
3289 Ok(Self::deserialize_zero_copy(cursor))
3290 }
3291 }
3292 #[test]
3293 fn test_layout() {
3294 assert_eq!(::core::mem::size_of::<Vector31>() * 8, 496);
3295 assert_eq!(::core::mem::offset_of!(Vector31, value) * 8, 0);
3296 }
3297 }
3298 pub mod vector3_0_1 {
3299 #[derive(
3304 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
3305 )]
3306 #[repr(C, packed)]
3307 pub struct Vector3 {
3308 pub value: [::half::f16; 3],
3314 }
3315 impl ::canadensis_encoding::DataType for Vector3 {
3316 const EXTENT_BYTES: Option<u32> = Some(512);
3318 }
3319 impl ::canadensis_encoding::Message for Vector3 {}
3320 impl Vector3 {}
3321 impl ::canadensis_encoding::Serialize for Vector3 {
3322 fn size_bits(&self) -> usize {
3323 48
3324 }
3325 fn serialize(
3326 &self,
3327 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
3328 ) {
3329 cursor
3330 .write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
3331 }
3332 }
3333 impl ::canadensis_encoding::Deserialize for Vector3 {
3334 fn deserialize(
3335 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3336 ) -> ::core::result::Result<
3337 Self,
3338 ::canadensis_encoding::DeserializeError,
3339 >
3340 where
3341 Self: Sized,
3342 {
3343 Ok(Self::deserialize_zero_copy(cursor))
3344 }
3345 }
3346 #[test]
3347 fn test_layout() {
3348 assert_eq!(::core::mem::size_of::<Vector3>() * 8, 48);
3349 assert_eq!(::core::mem::offset_of!(Vector3, value) * 8, 0);
3350 }
3351 }
3352 pub mod vector4_0_1 {
3353 #[derive(
3358 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
3359 )]
3360 #[repr(C, packed)]
3361 pub struct Vector4 {
3362 pub value: [::half::f16; 4],
3368 }
3369 impl ::canadensis_encoding::DataType for Vector4 {
3370 const EXTENT_BYTES: Option<u32> = Some(512);
3372 }
3373 impl ::canadensis_encoding::Message for Vector4 {}
3374 impl Vector4 {}
3375 impl ::canadensis_encoding::Serialize for Vector4 {
3376 fn size_bits(&self) -> usize {
3377 64
3378 }
3379 fn serialize(
3380 &self,
3381 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
3382 ) {
3383 cursor
3384 .write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
3385 }
3386 }
3387 impl ::canadensis_encoding::Deserialize for Vector4 {
3388 fn deserialize(
3389 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3390 ) -> ::core::result::Result<
3391 Self,
3392 ::canadensis_encoding::DeserializeError,
3393 >
3394 where
3395 Self: Sized,
3396 {
3397 Ok(Self::deserialize_zero_copy(cursor))
3398 }
3399 }
3400 #[test]
3401 fn test_layout() {
3402 assert_eq!(::core::mem::size_of::<Vector4>() * 8, 64);
3403 assert_eq!(::core::mem::offset_of!(Vector4, value) * 8, 0);
3404 }
3405 }
3406 pub mod vector6_0_1 {
3407 #[derive(
3412 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
3413 )]
3414 #[repr(C, packed)]
3415 pub struct Vector6 {
3416 pub value: [::half::f16; 6],
3422 }
3423 impl ::canadensis_encoding::DataType for Vector6 {
3424 const EXTENT_BYTES: Option<u32> = Some(512);
3426 }
3427 impl ::canadensis_encoding::Message for Vector6 {}
3428 impl Vector6 {}
3429 impl ::canadensis_encoding::Serialize for Vector6 {
3430 fn size_bits(&self) -> usize {
3431 96
3432 }
3433 fn serialize(
3434 &self,
3435 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
3436 ) {
3437 cursor
3438 .write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
3439 }
3440 }
3441 impl ::canadensis_encoding::Deserialize for Vector6 {
3442 fn deserialize(
3443 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3444 ) -> ::core::result::Result<
3445 Self,
3446 ::canadensis_encoding::DeserializeError,
3447 >
3448 where
3449 Self: Sized,
3450 {
3451 Ok(Self::deserialize_zero_copy(cursor))
3452 }
3453 }
3454 #[test]
3455 fn test_layout() {
3456 assert_eq!(::core::mem::size_of::<Vector6>() * 8, 96);
3457 assert_eq!(::core::mem::offset_of!(Vector6, value) * 8, 0);
3458 }
3459 }
3460 pub mod vector8_0_1 {
3461 #[derive(
3466 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
3467 )]
3468 #[repr(C, packed)]
3469 pub struct Vector8 {
3470 pub value: [::half::f16; 8],
3476 }
3477 impl ::canadensis_encoding::DataType for Vector8 {
3478 const EXTENT_BYTES: Option<u32> = Some(512);
3480 }
3481 impl ::canadensis_encoding::Message for Vector8 {}
3482 impl Vector8 {}
3483 impl ::canadensis_encoding::Serialize for Vector8 {
3484 fn size_bits(&self) -> usize {
3485 128
3486 }
3487 fn serialize(
3488 &self,
3489 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
3490 ) {
3491 cursor
3492 .write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
3493 }
3494 }
3495 impl ::canadensis_encoding::Deserialize for Vector8 {
3496 fn deserialize(
3497 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3498 ) -> ::core::result::Result<
3499 Self,
3500 ::canadensis_encoding::DeserializeError,
3501 >
3502 where
3503 Self: Sized,
3504 {
3505 Ok(Self::deserialize_zero_copy(cursor))
3506 }
3507 }
3508 #[test]
3509 fn test_layout() {
3510 assert_eq!(::core::mem::size_of::<Vector8>() * 8, 128);
3511 assert_eq!(::core::mem::offset_of!(Vector8, value) * 8, 0);
3512 }
3513 }
3514 }
3515 pub mod status_0_1 {
3516 #[cfg_attr(
3521 not(doctest),
3522 doc = " Auxiliary actuator status information published at a low rate asynchronously, usually at 1 Hz.\n It is mostly intended for diagnostics and logging purposes.\n In this revision this type is common for all kinds of actuators, but in the future it may be replaced\n with per-kind specializations."
3523 )]
3524 pub struct Status {
3525pub motor_temperature: crate::uavcan::si::unit::temperature::scalar_1_0::Scalar,
3531#[cfg_attr(not(doctest), doc = " Sampled temperatures. If multiple values are available, reduction is implementation-defined.")]
3532pub controller_temperature: crate::uavcan::si::unit::temperature::scalar_1_0::Scalar,
3538#[cfg_attr(not(doctest), doc = " Incremented once per occurrence. Reset to zero when ENGAGED.\n The exact definition of what constitutes an error is implementation-dependent.")]
3539pub error_count: u32,
3545#[cfg_attr(not(doctest), doc = " TODO: add vibration")]
3546pub fault_flags: crate::reg::udral::service::actuator::common::fault_flags_0_1::FaultFlags,
3552}
3553 impl ::canadensis_encoding::DataType for Status {
3554 const EXTENT_BYTES: Option<u32> = Some(63);
3556 }
3557 impl ::canadensis_encoding::Message for Status {}
3558 impl Status {}
3559 impl ::canadensis_encoding::Serialize for Status {
3560 fn size_bits(&self) -> usize {
3561 112
3562 }
3563 fn serialize(
3564 &self,
3565 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
3566 ) {
3567 cursor.write_composite(&self.motor_temperature);
3568 cursor.write_composite(&self.controller_temperature);
3569 cursor.write_aligned_u32(self.error_count);
3570 cursor.write_composite(&self.fault_flags);
3571 }
3572 }
3573 impl ::canadensis_encoding::Deserialize for Status {
3574 fn deserialize(
3575 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3576 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
3577 where
3578 Self: Sized,
3579 {
3580 Ok(Status {
3581 motor_temperature: { cursor.read_composite()? },
3582 controller_temperature: { cursor.read_composite()? },
3583 error_count: { cursor.read_u32() as _ },
3584 fault_flags: { cursor.read_composite()? },
3585 })
3586 }
3587 }
3588 }
3589 }
3590 pub mod esc {
3591 pub mod _0_1 {
3592 #[cfg_attr(
3597 not(doctest),
3598 doc = " The electronic speed controller (ESC) service is designed for controlling and monitoring electric drives.\n From the standpoint of this standard, an electric drive is just a special case of a servo. For generality,\n COTS electric drives are recommended to also support the servo interface defined in the adjacent namespace.\n\n ESCs (drives) are segregated into groups. Each ESC in a group has an index that is unique within the group.\n Drives in a group are commanded synchronously by publishing a message containing an array of setpoints.\n There are several subjects defined:\n\n - Setpoint array subject. Every participant subscribes to the same setpoint subject.\n Every message is consumed by all participants according to their index in the group.\n The setpoint subject defines the group. There may be an arbitrary number of such groups in the network.\n\n - Readiness subject. Every participant subscribes to the same readiness control subject which is used to command\n the state of the group: sleep, standby, or engaged. In many cases there will be one global subject controlling\n the state of the entire system; in other cases there will be dedicated controls on a per-subsystem basis.\n\n - Feedback subjects published by each ESC separately, as shown on the diagram below.\n\n SUBJECT NAME SUBJECT TYPE\n +----------------+\n | Controller |---------+------------+----... setpoint reg.udral.service.actuator.common.sp.*\n | |-------+-)----------+-)----... readiness reg.udral.service.common.Readiness\n +----------------+ | | | |\n ^ ^ ^ ^ ^ ^ ^ ^ v v v v\n | | | | | | | | +---------+ +---------+\n | | | | | | | | |Drive i=0| |Drive i=1| ...\n | | | | | | | | +---------+ +---------+\n | | | | | | | | | | | | | | | |\n | | | | | | | +-----+ | | | | | | | feedback reg.udral.service.actuator.common.Feedback\n | | | | | | +---------+ | | | | | | status reg.udral.service.actuator.common.Status\n | | | | | +-------------+ | | | | | power reg.udral.physics.electricity.PowerTs\n | | | | +-----------------+ | | | | dynamics reg.udral.physics.dynamics.rotation.PlanarTs\n | | | | | | | |\n | | | +---------------------------+ | | |\n | | +-------------------------------+ | |\n | +-----------------------------------+ |\n +---------------------------------------+\n\n Notice that the physics subjects are timestamped.\n\n Vendor/application-specific subjects are not shown here.\n Vendors are encouraged to publish additional data (e.g., temperatures) on separate subjects.\n\n\n SETPOINT SUBJECT\n\n The setpoint subject is ignored unless the drive is ENGAGED. As long as the drive is not ENGAGED, it shall not apply\n any power to the load excepting non-operational scenarios such as maintenance and diagnostics, which are\n outside of the scope of this service definition. More on readiness and safety in the next section.\n\n Upon reception of a setpoint message, a group participant fetches its setpoint from the array using the array\n element whose index equals the index of the group participant. By virtue of the Implicit Zero Extension Rule,\n if the message is too short, the setpoint will be interpreted as zero.\n\n If no valid setpoint was received in CONTROL_TIMEOUT or a lower implementation-specific value,\n the drive should assume a zero setpoint for safety reasons.\n The minimum setpoint publication period should be at least twice lower than its timeout.\n\n While stopped, the drive may either allow the load to freewheel or it may force it to a particular parking position,\n depending on the implementation requirements. The actual state of the load may be continuously reported using the\n dynamics subject. Notice that per the safety rule introduced earlier, the parking position may be impossile\n to enforce unless the drive is ENGAGED because it may require delivering power to the load.\n\n The setpoint message types that can be used to command a group of drives are defined in\n reg.udral.service.actuator.common.sp; please read the documentation related to that namespace for further information.\n Servo setpoint message types may also be supported on an implementation-specific basis for enhanced interoperability.\n If the group is controlled using different setpoint subjects concurrently, the behavior is implementation-defined.\n\n The following control modes are defined, none of which are mandatory to support.\n The control mode in use is to be specified using the register API.\n This service does not support switching the control mode or setting the motion profile at runtime;\n for that, please refer to the servo service.\n\n 0. Ratiometric voltage control. Each setpoint scalar is a value normalized/saturated in [-1, +1] representing\n the Q-axis/phase/armature (depending on the type of the drive) voltage as a fraction of the maximum.\n This control mode emulates the behavior of a typical RCPWM-controlled BLDC drive.\n\n 1. Ratiometric current/torque control. Each setpoint scalar is a value normalized/saturated in [-1, +1] representing\n the Q-axis/phase/armature (depending on the type of the drive) current as a fraction of the maximum.\n A negative setpoint during forward rotation (positive during reverse rotation) commands braking.\n\n 2. Speed control. Each setpoint scalar contains the target angular velocity of the load in radian/second.\n\n -. More control modes may be added later. Which control modes are supported is implementation-defined.\n\n Considerations that apply to all control modes:\n - Negative setpoint values represent reversal; a positive setpoint is co-directed with positive rotation/torque.\n - If reverse operation is not supported, negative values should be clamped to zero.\n - A non-finite setpoint is to be treated as zero.\n\n\n READINESS SUBJECT\n\n The default state is STANDBY. While in this state, the drive is not allowed to deliver power to the load,\n and the setpoint subject is ignored. The drive shall enter this state automatically if the readiness subject\n is not updated for CONTROL_TIMEOUT.\n\n While the drive is ENGAGED, the setpoint commands are processed normally as described in the adjacent section.\n If the drive does not support bidirectional operation, implementations are recommended to ensure that the load\n is driven at some minimum power level (idling) while the drive is ENGAGED regardless of the commanded setpoint,\n unless such behavior is deemed incompatible with the functional requirements of the controlled drive.\n\n If the selected readiness state is SLEEP, the behavior is implementation-defined. Implementations are recommended to\n power off the high-voltage circuitry and all non-essential components (e.g., LED indication, sensors, etc.)\n to minimize the power consumption.\n\n Implementations are recommended to announce transitions between the readiness states using audiovisual feedback.\n\n The worst-case state transition latency is not defined. The controlling element (that is, the unit that publishes\n to the setpoint and readiness subjects) is expected to monitor the actual readiness status of each component using\n the feedback subject. For example, a sensorless electric motor drive may choose to spool-up before entering the\n ENGAGED state, which would obviously take time; as soon as the spool-up is finished, the drive would switch its\n reported status from STANDBY to ENGAGED, thereby indicating that it is ready for normal operation.\n\n\n PUBLISHED SUBJECTS\n\n The following subjects shall be published immediately after a new setpoint is applied even if the drive is STANDBY:\n\n SUBJECT RECOMMENDED PRIORITY\n ---------------------------------------------\n feedback same as the setpoint\n power second to the setpoint\n dynamics second to the setpoint\n\n If no setpoint is being published, these subjects should continue being updated at least at 1/MAX_PUBLICATION_PERIOD.\n The publication rate requirements do not apply if the readiness state is SLEEP.\n\n If the setpoint publication rate exceeds 50 Hz, implementations are allowed (but not required) to throttle these\n subjects by dropping some of the messages such that the publication rate of each subject does not exceed 50 Hz.\n Implementations operating over Classic CAN are recommended to do this.\n\n The other subjects may be published at an implementation-defined rate and priority,\n which should be consistent across the group.\n\n Implementations are encouraged to provide additional subjects for enhanced feedback and monitoring.\n\n The measurements carried by the published messages should be low-pass filtered with an adequate cutoff frequency to\n avoid aliasing effects. Implementations should strive to sample all parameters simultaneously.\n\n If a float-typed reported quantity is unknown, the corresponding value should be NaN.\n\n\n CONVENTIONS AND ASSUMPTIONS\n\n A drive powers a rotary mechanical load that may be connected via a gearbox. It is the responsibility of\n the drive to account for the gear ratio of the gearbox when calculating related parameters such as angular\n velocity or torque.\n\n It is assumed that there is a well-defined direction of rotation that is referred to as forward rotation.\n A positive angular velocity represents forward rotation. Likewise, forward torque is positive.\n\n It is assumed that the drive is powered from a DC electric power supply network. A positive electric current\n represents current flowing from the network into the drive, also referred to as the state of driving/motoring.\n The opposite -- braking/regeneration -- is represented by negative current.\n\n Excepting edge cases and transients, torque and current are generally of the same sign.\n The above is summarized on the following four-quadrant diagram:\n\n +velocity\n ^\n braking,| forward,\n negative| positive\n power | power\n -----------+----------> +torque/current\n reverse,| braking,\n positive| negative\n power | power\n"
3599 )]
3600 #[derive(
3601 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
3602 )]
3603 #[repr(C, packed)]
3604 pub struct _0 {}
3605 impl ::canadensis_encoding::DataType for _0 {
3606 const EXTENT_BYTES: Option<u32> = Some(0);
3608 }
3609 impl ::canadensis_encoding::Message for _0 {}
3610 impl _0 {}
3611 impl ::canadensis_encoding::Serialize for _0 {
3612 fn size_bits(&self) -> usize {
3613 0
3614 }
3615 fn serialize(
3616 &self,
3617 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
3618 ) {
3619 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
3620 }
3621 }
3622 impl ::canadensis_encoding::Deserialize for _0 {
3623 fn deserialize(
3624 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3625 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
3626 where
3627 Self: Sized,
3628 {
3629 Ok(Self::deserialize_zero_copy(cursor))
3630 }
3631 }
3632 #[test]
3633 fn test_layout() {
3634 assert_eq!(::core::mem::size_of::<_0>() * 8, 0);
3635 }
3636 }
3637 }
3638 pub mod servo {
3639 pub mod _0_1 {
3640 #[cfg_attr(
3645 not(doctest),
3646 doc = " A servo can actuate either a translational or rotary load using electric power from the high-voltage DC bus.\n\n The type of load (translational or rotational) dictates which type is used for commanding the setpoint and reporting\n the status:\n - reg.udral.physics.dynamics.rotation.Planar[Ts]\n - reg.udral.physics.dynamics.translation.Linear[Ts]\n For generality, either or both of these types are referred to as \"timestamped dynamics\" or \"non-timestamped dynamics\".\n\n The default readiness state is STANDBY. While in this state, the servo is not allowed to apply force to the load,\n and the setpoint subject is ignored. The servo shall enter the STANDBY state automatically if the readiness subject\n is not updated for CONTROL_TIMEOUT.\n\n The subjects defined by this service are shown on the following canvas. Implementers are encouraged to add\n custom subjects with additional data. Notice that the physics subjects are timestamped.\n\n SUBJECT NAME SUBJECT TYPE RATE\n\n +------------+ setpoint +------------+ (non-timestamped dynamics) (see below) R\n | |--------------------->| |\n | | readiness | | reg.udral.service.common.Readiness any\n | |--------------------->| |\n | | feedback | | reg.udral.service.actuator.common.Feedback R\n | |<---------------------| |\n | Controller | status | Servo | reg.udral.service.actuator.common.Status any\n | |<---------------------| |\n | | power | | reg.udral.physics.electricity.PowerTs R\n | |<---------------------| |\n | | dynamics | | (timestamped dynamics) R\n | |<---------------------| |\n +------------+ +------------+\n\n Should it be necessary to control a group of servos in lockstep, an arbitrary number of them may subscribe\n to the same setpoint subject (their published subjects would be different of course).\n\n If the servo is ENGAGED, setpoint messages are processed as follows: the first field of the kinematic setpoint type\n that contains a finite value is taken as the commanded setpoint. The following non-negative finite fields define\n the motion profile, where negative and non-finite values are ignored.\n\n For example, a translational dynamics message containing the following values:\n position = +0.35\n velocity = NaN\n acceleration = NaN\n force = 30\n ...is interpreted as follows: position the load at 0.35 meters relative to the neutral, limit the force to 30 newton,\n do not limit the velocity and acceleration. Here is another example:\n angular position = NaN\n angular velocity = +400\n angular acceleration = NaN\n torque = 50\n which is interpreted as follows: reach the angular velocity of 400 radian/second in the forward direction,\n limit the torque to 50 newton*meters, do not limit the acceleration.\n\n The motion profile parameters that are not supported are to be silently ignored by the servo. If the commanded\n parameter cannot be controlled by the servo, the setpoint is to be ignored. For example, in the second example above,\n if the servo does not support angular velocity control, the setpoint message would be discarded.\n\n The above describes the typical use case where each servo is controlled over a dedicated setpoint\n subject independently (or a group of servos are controlled in lockstep using the same setpoint subject).\n Some applications may require synchronous independent control of multiple servos in a group, similar to ESC.\n To address this, a compliant servo should support another operating mode where the controlled quantity\n (position, velocity, force, etc.) is selected statically along with the motion profile (using the register API),\n and the servo subscribes to the setpoint subject of type \"reg.udral.service.actuator.common.sp.*\".\n Having its index in the group configured statically, the servo fetches the setpoint from the appropriate\n index in the setpoint array.\n The resulting topology closely resembles that of the ESC service:\n\n SUBJECT NAME SUBJECT TYPE\n +----------------+\n | Controller |---------+------------+----... setpoint reg.udral.service.actuator.common.sp.*\n | |-------+-)----------+-)----... readiness reg.udral.service.common.Readiness\n +----------------+ | | | |\n ^ ^ ^ ^ ^ ^ ^ ^ v v v v\n | | | | | | | | +---------+ +---------+\n | | | | | | | | |Servo i=0| |Servo i=1| ...\n | | | | | | | | +---------+ +---------+\n | | | | | | | | | | | | | | | |\n | | | | | | | +-----+ | | | | | | | feedback reg.udral.service.actuator.common.Feedback\n | | | | | | +---------+ | | | | | | status reg.udral.service.actuator.common.Status\n | | | | | +-------------+ | | | | | power reg.udral.physics.electricity.PowerTs\n | | | | +-----------------+ | | | | dynamics (timestamped dynamics)\n | | | | | | | |\n | | | +---------------------------+ | | |\n | | +-------------------------------+ | |\n | +-----------------------------------+ |\n +---------------------------------------+\n\n If the selected readiness state is SLEEP, the behavior is implementation-defined. Implementations are recommended to\n power off the high-voltage circuitry and all non-essential components (e.g., LED indication, sensors, etc.)\n to minimize the power consumption. The publication rate requirements do not apply if the state is SLEEP.\n\n The worst-case readiness state transition latency is not defined.\n\n The following subjects shall be published immediately after a new setpoint is applied even if the servo is STANDBY:\n\n SUBJECT NAME RECOMMENDED PRIORITY\n ---------------------------------------------\n feedback same as the setpoint\n power second to the setpoint\n dynamics second to the setpoint\n\n If no setpoint is being published, these subjects should continue being updated at least at 1/MAX_PUBLICATION_PERIOD.\n\n If the setpoint publication rate exceeds 50 Hz, implementations are allowed (but not required) to throttle these\n subjects by dropping some of the messages such that the publication rate of each subject does not exceed 50 Hz.\n Implementations operating over Classic CAN are recommended to do this.\n\n The other subjects may be published at an implementation-defined rate and priority,\n which should be consistent across the group.\n\n The measurements carried by the published messages should be low-pass filtered with an adequate cutoff frequency to\n avoid aliasing effects. Implementations should strive to sample all parameters simultaneously.\n\n It is assumed that the servo is powered from a DC electric power supply network. A positive electric current\n represents current flowing from the DC network into the servo (negative represents regeneration).\n\n Excepting edge cases and transients, torque/force and current are generally of the same sign (barring the difference\n introduced by the power dissipated by the servo itself).\n\n +velocity\n ^\n braking,| forward,\n negative| positive\n power | power\n -----------+----------> +torque/force/current\n reverse,| braking,\n positive| negative\n power | power\n\n An example implementation is available at https://github.com/OpenCyphal/demos"
3647 )]
3648 #[derive(
3649 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
3650 )]
3651 #[repr(C, packed)]
3652 pub struct _0 {}
3653 impl ::canadensis_encoding::DataType for _0 {
3654 const EXTENT_BYTES: Option<u32> = Some(0);
3656 }
3657 impl ::canadensis_encoding::Message for _0 {}
3658 impl _0 {}
3659 impl ::canadensis_encoding::Serialize for _0 {
3660 fn size_bits(&self) -> usize {
3661 0
3662 }
3663 fn serialize(
3664 &self,
3665 cursor: &mut ::canadensis_encoding::WriteCursor<'_>,
3666 ) {
3667 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
3668 }
3669 }
3670 impl ::canadensis_encoding::Deserialize for _0 {
3671 fn deserialize(
3672 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3673 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
3674 where
3675 Self: Sized,
3676 {
3677 Ok(Self::deserialize_zero_copy(cursor))
3678 }
3679 }
3680 #[test]
3681 fn test_layout() {
3682 assert_eq!(::core::mem::size_of::<_0>() * 8, 0);
3683 }
3684 }
3685 }
3686 }
3687 pub mod battery {
3688 pub mod _0_1 {
3689 #[cfg_attr(
3694 not(doctest),
3695 doc = " This is the smart battery monitoring service. A smart battery is required to publish on the following subjects:\n\n SUBJECT TYPE TYP. RATE [Hz]\n energy_source reg.udral.physics.electricity.SourceTs 1...100\n status reg.udral.service.battery.Status ~1\n parameters reg.udral.service.battery.Parameters ~0.2\n\n Observe that only the first subject can be used for estimating the endurance of the power source. The other subjects\n are designed for monitoring, diagnostics, and maintenance.\n\n Optionally, the battery service can subscribe to a readiness control subject (see reg.udral.service.common.Readiness),\n which enables the following two optional capabilities:\n\n - SLEEP mode: when the readiness subject commands the sleep state, the battery management system may enter a\n low power consumption state, possibly deactivating some of its capabilities.\n\n - STANDBY mode: the battery management system may implement additional safety protections that may otherwise\n interfere with the normal operation of the vehicle. For example, the traction battery may limit the maximum\n load current and the depth of discharge unless the commanded state is ENGAGED. By doing so, the battery can\n protect itself and the supplied high-voltage DC network from accidental damage while the vehicle is parked.\n Limiting the output power or discharge of the traction battery might lead to catastrophic consequences in\n an aerial vehicle, hence such safety checks are to be disabled once the battery is commanded into the ENGAGED\n state.\n\n If readiness state selection is not supported, the battery may not subscribe to the readiness control subject,\n in which case it should permanently report its state as ENGAGED unless the battery is unfit for use (e.g., due\n to degradation or a failure).\n\n By convention, positive current flows from the DC network into the battery. Therefore, the current is\n negative when the battery powers the system, and positive when it is being charged.\n\n Systems that leverage multiple battery packs simultaneously should be configured to publish the status of each\n pack on a separate subject.\n\n Published quantities should be low-pass filtered to avoid aliasing effects.\n Publishers should strive to sample all parameters atomically.\n\n The reported quantities are focused on the amount of energy that can be reclaimed from the battery. In a\n simplified view, this can be seen as the amount of energy that is \"stored\" in the battery; however, this\n interpretation is not strictly correct because the amount of retrievable energy may be dependent on external\n factors such as the temperature of the battery or the load current. Energy estimation is hard and requires\n accurate modeling of the state of the battery, which may be impossible to do without precise tracking of each\n charging cycle. Despite the complications, this is considered to be a superior approach compared to the commonly\n used alternative where the state estimation is focused on the electric charge, because the latter cannot be used\n directly to predict the endurance of the system.\n\n The methods of energy estimation are implementation-defined."
3696 )]
3697 #[derive(
3698 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
3699 )]
3700 #[repr(C, packed)]
3701 pub struct _0 {}
3702 impl ::canadensis_encoding::DataType for _0 {
3703 const EXTENT_BYTES: Option<u32> = Some(0);
3705 }
3706 impl ::canadensis_encoding::Message for _0 {}
3707 impl _0 {}
3708 impl ::canadensis_encoding::Serialize for _0 {
3709 fn size_bits(&self) -> usize {
3710 0
3711 }
3712 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
3713 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
3714 }
3715 }
3716 impl ::canadensis_encoding::Deserialize for _0 {
3717 fn deserialize(
3718 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3719 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
3720 where
3721 Self: Sized,
3722 {
3723 Ok(Self::deserialize_zero_copy(cursor))
3724 }
3725 }
3726 #[test]
3727 fn test_layout() {
3728 assert_eq!(::core::mem::size_of::<_0>() * 8, 0);
3729 }
3730 }
3731 pub mod error_0_1 {
3732 #[cfg_attr(
3737 not(doctest),
3738 doc = " Generic error codes reported by the service provider.\n An error is reported when the corresponding parameter exceeds its safe operating area (SOA) as defined by the vendor;\n see https://en.wikipedia.org/wiki/Safe_operating_area.\n As long as an error condition is present, the service health should not be NOMINAL.\n\n If there are multiple error conditions present, the most severe one should be reported. The severity ordering\n is implementation-defined. Barring special requirements, it is recommended to give preference to errors whose\n code is smaller (e.g., BAD_BATTERY trumps TEMPERATURE_COLD)."
3739 )]
3740 #[derive(
3741 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
3742 )]
3743 #[repr(C, packed)]
3744 pub struct Error {
3745 pub value: u8,
3751 }
3752 impl ::canadensis_encoding::DataType for Error {
3753 const EXTENT_BYTES: Option<u32> = None;
3755 }
3756 impl ::canadensis_encoding::Message for Error {}
3757 impl Error {
3758 #[cfg_attr(not(doctest), doc = " Normal operation.")]
3759 pub const NONE: u8 = 0;
3760 #[cfg_attr(
3761 not(doctest),
3762 doc = " The battery should not be used anymore. Detection criteria are implementation-defined."
3763 )]
3764 pub const BAD_BATTERY: u8 = 10;
3765 #[cfg_attr(
3766 not(doctest),
3767 doc = " The battery requires offline maintenance."
3768 )]
3769 pub const NEEDS_SERVICE: u8 = 11;
3770 #[cfg_attr(
3771 not(doctest),
3772 doc = " An internal error in the battery management system, not related to the battery itself."
3773 )]
3774 pub const BMS_ERROR: u8 = 20;
3775 #[cfg_attr(
3776 not(doctest),
3777 doc = " The battery/BMS/node/service configuration is missing or invalid."
3778 )]
3779 pub const CONFIGURATION: u8 = 30;
3780 #[cfg_attr(
3781 not(doctest),
3782 doc = " The battery is discharged beyond the design limits and may have incurred damage."
3783 )]
3784 pub const OVERDISCHARGE: u8 = 50;
3785 #[cfg_attr(
3786 not(doctest),
3787 doc = " The charge or discharge rate exceeds the safe operating limits."
3788 )]
3789 pub const OVERLOAD: u8 = 51;
3790 pub const CELL_OVERVOLTAGE: u8 = 60;
3791 #[cfg_attr(
3792 not(doctest),
3793 doc = " Voltage of one of the battery cells exceeds its SOA."
3794 )]
3795 pub const CELL_UNDERVOLTAGE: u8 = 61;
3796 #[cfg_attr(
3797 not(doctest),
3798 doc = " The sum of cell voltages is far from the total pack voltage.\n The threshold is implementation-defined."
3799 )]
3800 pub const CELL_COUNT: u8 = 62;
3801 pub const TEMPERATURE_HOT: u8 = 100;
3802 #[cfg_attr(
3803 not(doctest),
3804 doc = " At least one cell is above/below the temperature SOA."
3805 )]
3806 pub const TEMPERATURE_COLD: u8 = 101;
3807 }
3808 impl ::canadensis_encoding::Serialize for Error {
3809 fn size_bits(&self) -> usize {
3810 8
3811 }
3812 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
3813 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
3814 }
3815 }
3816 impl ::canadensis_encoding::Deserialize for Error {
3817 fn deserialize(
3818 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
3819 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
3820 where
3821 Self: Sized,
3822 {
3823 Ok(Self::deserialize_zero_copy(cursor))
3824 }
3825 }
3826 #[test]
3827 fn test_layout() {
3828 assert_eq!(::core::mem::size_of::<Error>() * 8, 8);
3829 assert_eq!(::core::mem::offset_of!(Error, value) * 8, 0);
3830 }
3831 }
3832 pub mod parameters_0_3 {
3833 #[cfg_attr(
3838 not(doctest),
3839 doc = " Smart battery parameter message. It is mostly intended for automated battery charging and maintenance systems.\n This message is modeled after the Smart Battery Data Specification (SBS) and the MAVLink battery status messages.\n\n The values carried by this message are either constant or slow-changing, so, generally, the publishing frequency\n should not be higher than 0.2 Hz, and the priority should be either OPTIONAL or SLOW.\n\n All parameters are required unless specifically stated otherwise.\n For non-rechargeable batteries all \"charge_*\" parameters should be NaN."
3840 )]
3841 pub struct Parameters {
3842 #[cfg_attr(
3843 not(doctest),
3844 doc = " A statistically unique number that can be used to identify this exact battery for logging and diagnostic purposes.\n This value should be invariant to the identity of the reporting node unless it is an integral part of the battery.\n If the battery supports SBS, the recommended way to populate this field is from two CRC-32C (Castagnoli) values as:\n - 32 most significant bits identify the vendor as: CRC32C(ManufacturerName)\n - 32 least significant bits identify the battery as: CRC32C(DeviceName + ManufactureDate + SerialNumber)\n If the battery does not support SBS, the vendor may choose arbitrary random numbers.\n Note that these are mere recommendations. The only hard requirement for this field is to be statistically unique."
3845 )]
3846 pub unique_id: u64,
3852 #[cfg_attr(
3853 not(doctest),
3854 doc = " The total mass of the battery, including the packaging, electronics, cabling, and all auxiliary items, if any.\n May be used for predicting the kinematic parameters of the vehicle.\n NaN if unknown."
3855 )]
3856 pub mass: crate::uavcan::si::unit::mass::scalar_1_0::Scalar,
3862 #[cfg_attr(
3863 not(doctest),
3864 doc = " The maximum total charge of the pack, at 100% SoH, specified by the manufacturer."
3865 )]
3866 pub design_capacity:
3872 crate::uavcan::si::unit::electric_charge::scalar_1_0::Scalar,
3873 #[cfg_attr(
3874 not(doctest),
3875 doc = " The minimum (end of discharge) and the maximum (end of charge) resting cell voltage specified by the manufacturer\n at 100% SoH. Example: {2.8, 4.2} V. These voltages correspond to resting voltages; i.e., the stabilized voltages after\n the discharge/charge has been terminated. Voltage below the min may be observed during discharge due to the cell's\n internal resistance. Voltage above the max voltage may be observed during regenerative braking/charging etc due to\n the cell's internal resistance."
3876 )]
3877 pub design_cell_voltage_min_max:
3883 [crate::uavcan::si::unit::voltage::scalar_1_0::Scalar; 2],
3884 #[cfg_attr(
3885 not(doctest),
3886 doc = " Recommended continuous discharge current of the battery."
3887 )]
3888 pub discharge_current:
3894 crate::uavcan::si::unit::electric_current::scalar_1_0::Scalar,
3895 #[cfg_attr(
3896 not(doctest),
3897 doc = " Maximum current that may be safely discharged at least for 5 seconds."
3898 )]
3899 pub discharge_current_burst:
3905 crate::uavcan::si::unit::electric_current::scalar_1_0::Scalar,
3906 #[cfg_attr(
3907 not(doctest),
3908 doc = " Recommended continuous charge current of the battery."
3909 )]
3910 pub charge_current:
3916 crate::uavcan::si::unit::electric_current::scalar_1_0::Scalar,
3917 #[cfg_attr(
3918 not(doctest),
3919 doc = " Recommended safest highest continuous charge current for the battery.\n This may cause accelerated aging of the battery."
3920 )]
3921 pub charge_current_fast:
3927 crate::uavcan::si::unit::electric_current::scalar_1_0::Scalar,
3928 #[cfg_attr(
3929 not(doctest),
3930 doc = " End-of-charging current threshold. Charging may be terminated when the current falls below this threshold."
3931 )]
3932 pub charge_termination_threshold:
3938 crate::uavcan::si::unit::electric_current::scalar_1_0::Scalar,
3939 #[cfg_attr(
3940 not(doctest),
3941 doc = " The total voltage (not per-cell) that may be used by the charger to charge the battery pack."
3942 )]
3943 pub charge_voltage: crate::uavcan::si::unit::voltage::scalar_1_0::Scalar,
3949 #[cfg_attr(
3950 not(doctest),
3951 doc = " The number of charge-discharge cycles. Zero if the battery is new. May increase at runtime.\n What constitutes a charge-discharge cycle is implementation-defined."
3952 )]
3953 pub cycle_count: u16,
3959 #[cfg_attr(
3961 not(doctest),
3962 doc = " The number of cells connected in series. This value should match the array of cell voltages reported via Status."
3963 )]
3964 pub series_cell_count: u8,
3970 #[cfg_attr(
3971 not(doctest),
3972 doc = " [percent]\n The SoH of the battery, or best guess thereof; ranges from 0 (unusable) to 100 (new)."
3973 )]
3974 pub state_of_health_pct: u8,
3980 #[cfg_attr(
3982 not(doctest),
3983 doc = " The battery technology information may be leveraged by the charger to choose the appropriate charging strategy."
3984 )]
3985 pub technology:
3991 crate::reg::udral::service::battery::technology_0_1::Technology,
3992 #[cfg_attr(
3993 not(doctest),
3994 doc = " The nominal voltage of the battery pack (not per-cell) as defined by the vendor.\n E.g., a typical 22S LiCoO2 pack would usually report 81.4 V here."
3995 )]
3996 pub nominal_voltage: crate::uavcan::si::unit::voltage::scalar_1_0::Scalar,
4002 #[cfg_attr(
4003 not(doctest),
4004 doc = " The approximate UNIX Epoch time when the battery was manufactured, zero if unknown."
4005 )]
4006 pub unix_manufacture_time: u64,
4012 #[cfg_attr(
4013 not(doctest),
4014 doc = " An arbitrary human-readable textual description of this battery. Empty if unknown/unused.\n Batteries that support SBS are recommended to report the manufacturer name and the device name here."
4015 )]
4016 pub name: ::heapless::Vec<u8, 64>,
4022 }
4023 impl ::canadensis_encoding::DataType for Parameters {
4024 const EXTENT_BYTES: Option<u32> = Some(300);
4026 }
4027 impl ::canadensis_encoding::Message for Parameters {}
4028 impl Parameters {}
4029 impl ::canadensis_encoding::Serialize for Parameters {
4030 fn size_bits(&self) -> usize {
4031 64 + 32
4032 + 32
4033 + (self.design_cell_voltage_min_max).len() * 32
4034 + 32
4035 + 32
4036 + 32
4037 + 32
4038 + 32
4039 + 32
4040 + 16
4041 + 8
4042 + 8
4043 + 7
4044 + 1
4045 + 8
4046 + 32
4047 + 40
4048 + 8
4049 + (self.name).len() * 8
4050 + 0
4051 }
4052 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
4053 cursor.write_aligned_u64(self.unique_id);
4054 cursor.write_composite(&self.mass);
4055 cursor.write_composite(&self.design_capacity);
4056 for value in (self.design_cell_voltage_min_max).iter() {
4057 cursor.write_composite(value);
4058 }
4059 cursor.write_composite(&self.discharge_current);
4060 cursor.write_composite(&self.discharge_current_burst);
4061 cursor.write_composite(&self.charge_current);
4062 cursor.write_composite(&self.charge_current_fast);
4063 cursor.write_composite(&self.charge_termination_threshold);
4064 cursor.write_composite(&self.charge_voltage);
4065 cursor.write_aligned_u16(self.cycle_count);
4066 cursor.skip_8();
4067 cursor.write_aligned_u8(self.series_cell_count);
4068 cursor.write_u7(self.state_of_health_pct);
4069 cursor.skip_1();
4070 cursor.write_composite(&self.technology);
4071 cursor.write_composite(&self.nominal_voltage);
4072 cursor.write_u40(self.unix_manufacture_time);
4073 cursor.write_aligned_u8((self.name).len() as u8);
4074 cursor.write_bytes(&(self.name)[..]);
4075 }
4076 }
4077 impl ::canadensis_encoding::Deserialize for Parameters {
4078 fn deserialize(
4079 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
4080 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
4081 where
4082 Self: Sized,
4083 {
4084 Ok(Parameters {
4085 unique_id: { cursor.read_u64() as _ },
4086 mass: { cursor.read_composite()? },
4087 design_capacity: { cursor.read_composite()? },
4088 design_cell_voltage_min_max: {
4089 [cursor.read_composite()?, cursor.read_composite()?]
4090 },
4091 discharge_current: { cursor.read_composite()? },
4092 discharge_current_burst: { cursor.read_composite()? },
4093 charge_current: { cursor.read_composite()? },
4094 charge_current_fast: { cursor.read_composite()? },
4095 charge_termination_threshold: { cursor.read_composite()? },
4096 charge_voltage: { cursor.read_composite()? },
4097 cycle_count: { cursor.read_u16() as _ },
4098 series_cell_count: {
4099 cursor.skip_8();
4100 cursor.read_u8() as _
4101 },
4102 state_of_health_pct: { cursor.read_u7() as _ },
4103 technology: {
4104 cursor.skip_1();
4105 cursor.read_composite()?
4106 },
4107 nominal_voltage: { cursor.read_composite()? },
4108 unix_manufacture_time: { cursor.read_u40() as _ },
4109 name: {
4110 let length = cursor.read_u8() as _;
4111 if length <= 64 {
4112 let mut elements = ::heapless::Vec::new();
4113 for _ in 0..length {
4114 let _ = elements.push(cursor.read_u8() as _);
4115 }
4116 elements
4117 } else {
4118 return Err(
4119 ::canadensis_encoding::DeserializeError::ArrayLength,
4120 );
4121 }
4122 },
4123 })
4124 }
4125 }
4126 }
4127 pub mod status_0_2 {
4128 #[cfg_attr(
4133 not(doctest),
4134 doc = " This low-rate battery status should be published at least once per second."
4135 )]
4136 pub struct Status {
4137 #[cfg_attr(
4138 not(doctest),
4139 doc = " Note that the health code generally should not reflect the battery charge unless the service provider knows\n that the availability of energy in the battery is critical for the safe operation of the vehicle, which is usually\n not the case. For example, if the vehicle is equipped with several batteries that are discharged in series, one\n after another, the depletion of energy in the first battery is not a fault condition and it should not be reported\n as such. This follows from the good service design principles reviewed in https://opencyphal.org/guide.\n\n The readiness state depicts the ability of the battery (or its power electronics) to deliver full rated power\n and whether the overdischarge protections are active.\n When the battery is not ENGAGED, it may limit the output power below the nominal rated value and disconnect the load\n should the charge level fall below the critical level.\n When the battery is ENGAGED, it is not permitted to limit the output power or energy regardless of the risk of damage.\n If the adaptive protection is not supported, the battery should always report its status as ENGAGED."
4140 )]
4141 pub heartbeat: crate::reg::udral::service::common::heartbeat_0_1::Heartbeat,
4147 #[cfg_attr(
4148 not(doctest),
4149 doc = " The minimum and maximum readings of the pack temperature sensors.\n For example, if the pack is equipped with three distributed temperature sensors that read {288, 258.15, 360.5} K,\n the reported array value would be {258.15, 360.5} K.\n If there is only one temperature sensor, both elements shall be of the same value."
4150 )]
4151 pub temperature_min_max:
4157 [crate::uavcan::si::unit::temperature::scalar_1_0::Scalar; 2],
4158 #[cfg_attr(
4159 not(doctest),
4160 doc = " The estimated electric charge currently stored in the battery. This is intended for charging and maintenance only.\n Do not use this parameter for endurance prediction! Instead, use the correct energy type from the physics namespace.\n The depth of discharge (DoD), or the state of charge (SoC), can be derived by dividing this value by the\n nominal battery capacity reported in the Parameters message."
4161 )]
4162 pub available_charge:
4168 crate::uavcan::si::unit::electric_charge::scalar_1_0::Scalar,
4169 pub error: crate::reg::udral::service::battery::error_0_1::Error,
4175 #[cfg_attr(
4176 not(doctest),
4177 doc = " [volt]\n The voltages of individual cells in the battery pack."
4178 )]
4179 pub cell_voltages: ::heapless::Vec<::half::f16, 255>,
4185 }
4186 impl ::canadensis_encoding::DataType for Status {
4187 const EXTENT_BYTES: Option<u32> = Some(600);
4189 }
4190 impl ::canadensis_encoding::Message for Status {}
4191 impl Status {
4192 pub const MAX_CELLS: u8 = 255;
4193 }
4194 impl ::canadensis_encoding::Serialize for Status {
4195 fn size_bits(&self) -> usize {
4196 16 + (self.temperature_min_max).len() * 32
4197 + 32
4198 + 8
4199 + 8
4200 + (self.cell_voltages).len() * 16
4201 + 0
4202 }
4203 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
4204 cursor.write_composite(&self.heartbeat);
4205 for value in (self.temperature_min_max).iter() {
4206 cursor.write_composite(value);
4207 }
4208 cursor.write_composite(&self.available_charge);
4209 cursor.write_composite(&self.error);
4210 cursor.write_aligned_u8((self.cell_voltages).len() as u8);
4211 for value in (self.cell_voltages).iter() {
4212 cursor.write_f16(*value);
4213 }
4214 }
4215 }
4216 impl ::canadensis_encoding::Deserialize for Status {
4217 fn deserialize(
4218 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
4219 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
4220 where
4221 Self: Sized,
4222 {
4223 Ok(Status {
4224 heartbeat: { cursor.read_composite()? },
4225 temperature_min_max: {
4226 [cursor.read_composite()?, cursor.read_composite()?]
4227 },
4228 available_charge: { cursor.read_composite()? },
4229 error: { cursor.read_composite()? },
4230 cell_voltages: {
4231 let length = cursor.read_u8() as _;
4232 if length <= 255 {
4233 let mut elements = ::heapless::Vec::new();
4234 for _ in 0..length {
4235 let _ = elements.push(cursor.read_f16());
4236 }
4237 elements
4238 } else {
4239 return Err(
4240 ::canadensis_encoding::DeserializeError::ArrayLength,
4241 );
4242 }
4243 },
4244 })
4245 }
4246 }
4247 }
4248 pub mod technology_0_1 {
4249 #[cfg_attr(
4254 not(doctest),
4255 doc = " Battery chemistry type and its form-factor.\n Observe that there is no item to represent unknown technology because it is required to be known.\n This information may be used by charging systems to select the appropriate charging strategy.\n If the battery is of an uncommon type, it may be preferred to report the closest-matching type listed here\n instead of OTHER."
4256 )]
4257 #[derive(
4258 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
4259 )]
4260 #[repr(C, packed)]
4261 pub struct Technology {
4262 pub value: u8,
4268 }
4269 impl ::canadensis_encoding::DataType for Technology {
4270 const EXTENT_BYTES: Option<u32> = None;
4272 }
4273 impl ::canadensis_encoding::Message for Technology {}
4274 impl Technology {
4275 #[cfg_attr(
4276 not(doctest),
4277 doc = " The technology is not specified in this enumeration. Please submit a pull request.\n NON-RECHARGEABLE"
4278 )]
4279 pub const OTHER: u8 = 0;
4280 #[cfg_attr(not(doctest), doc = " Lithium-thionyl chloride (Li-SOCl2)")]
4281 pub const LI_SOCL2: u8 = 10;
4282 #[cfg_attr(
4283 not(doctest),
4284 doc = " Lithium-thionyl chloride + bromine chloride (Li-BCX)"
4285 )]
4286 pub const LI_BCX: u8 = 11;
4287 #[cfg_attr(
4288 not(doctest),
4289 doc = " Lithium-manganese dioxide (Li-MnO2) (e.g., lithium coin cell, lithium 9V)"
4290 )]
4291 pub const LI_MNO2: u8 = 12;
4292 #[cfg_attr(not(doctest), doc = " Zinc-Air")]
4293 pub const ZN_O2: u8 = 20;
4294 #[cfg_attr(not(doctest), doc = " Aluminum-Air")]
4295 pub const AL_O2: u8 = 21;
4296 #[cfg_attr(
4297 not(doctest),
4298 doc = " Zinc-manganese dioxide - ammonium chloride electrolyte (aka zinc-carbon)"
4299 )]
4300 pub const ZN_MNO2_NH4CL: u8 = 30;
4301 #[cfg_attr(
4302 not(doctest),
4303 doc = " Zinc-manganese dioxide - zinc chloride electrolyte (aka heavy duty zinc-carbon)"
4304 )]
4305 pub const ZN_MNO2_ZNCL2: u8 = 31;
4306 #[cfg_attr(
4307 not(doctest),
4308 doc = " Zinc-manganese dioxide - potassium hydroxide electrolyte (aka alkaline)\n RECHARGEABLE"
4309 )]
4310 pub const ZN_MNO2_KOH: u8 = 32;
4311 #[cfg_attr(
4312 not(doctest),
4313 doc = " Lithium cobalt oxide (commonly known as just \"lithium-ion\")"
4314 )]
4315 pub const LI_LCO: u8 = 100;
4316 #[cfg_attr(not(doctest), doc = " Lithium iron phosphate (LiFePO4)")]
4317 pub const LI_LFP: u8 = 101;
4318 #[cfg_attr(not(doctest), doc = " Lithium nickel manganese cobalt oxide")]
4319 pub const LI_NMC: u8 = 102;
4320 #[cfg_attr(not(doctest), doc = " Lithium nickel cobalt aluminium oxide")]
4321 pub const LI_NCA: u8 = 103;
4322 #[cfg_attr(not(doctest), doc = " Lithium manganese oxide")]
4323 pub const LI_LMO: u8 = 104;
4324 #[cfg_attr(not(doctest), doc = " Lithium-sulfur (LiS)")]
4325 pub const LI_S: u8 = 105;
4326 #[cfg_attr(
4327 not(doctest),
4328 doc = " LiCoO2 in pouch form factor, commonly known as \"lithium-ion polymer\" or \"LiPo\"."
4329 )]
4330 pub const LI_LCO_POUCH: u8 = 110;
4331 #[cfg_attr(
4332 not(doctest),
4333 doc = " LiFePO4 in pouch form factor, commonly known as \"LiFePO4 polymer\"."
4334 )]
4335 pub const LI_LFP_POUCH: u8 = 111;
4336 #[cfg_attr(not(doctest), doc = " Nickel-metal hydride")]
4337 pub const NI_MH: u8 = 120;
4338 #[cfg_attr(not(doctest), doc = " Nickel-cadmium")]
4339 pub const NI_CD: u8 = 121;
4340 #[cfg_attr(not(doctest), doc = " Nickel-zinc")]
4341 pub const NI_ZN: u8 = 122;
4342 #[cfg_attr(not(doctest), doc = " Nickel-iron")]
4343 pub const NI_FE: u8 = 123;
4344 #[cfg_attr(not(doctest), doc = " Lead acid")]
4345 pub const PB_AC: u8 = 130;
4346 #[cfg_attr(not(doctest), doc = " Also known as SLA")]
4347 pub const PB_AC_SEALED: u8 = 131;
4348 #[cfg_attr(not(doctest), doc = " Electrostatic double-layer capacitor")]
4349 pub const EDLC: u8 = 200;
4350 }
4351 impl ::canadensis_encoding::Serialize for Technology {
4352 fn size_bits(&self) -> usize {
4353 8
4354 }
4355 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
4356 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
4357 }
4358 }
4359 impl ::canadensis_encoding::Deserialize for Technology {
4360 fn deserialize(
4361 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
4362 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
4363 where
4364 Self: Sized,
4365 {
4366 Ok(Self::deserialize_zero_copy(cursor))
4367 }
4368 }
4369 #[test]
4370 fn test_layout() {
4371 assert_eq!(::core::mem::size_of::<Technology>() * 8, 8);
4372 assert_eq!(::core::mem::offset_of!(Technology, value) * 8, 0);
4373 }
4374 }
4375 }
4376 pub mod common {
4377 pub mod heartbeat_0_1 {
4378 #[cfg_attr(
4383 not(doctest),
4384 doc = " The function of the service heartbeat is similar to that of the node heartbeat defined in the standard namespace,\n except that it is used on a per-service basis, meaning that there may be more than one publisher per node.\n\n The service heartbeat should be published either on a separate subject, or as a structural supertype of a\n service-specific status subject. The publication rate is service-specific but it should not be lower than 1 Hz.\n\n This is a structural subtype of the Readiness type."
4385 )]
4386 pub struct Heartbeat {
4387 pub readiness: crate::reg::udral::service::common::readiness_0_1::Readiness,
4393 pub health: crate::uavcan::node::health_1_0::Health,
4399 }
4400 impl ::canadensis_encoding::DataType for Heartbeat {
4401 const EXTENT_BYTES: Option<u32> = None;
4403 }
4404 impl ::canadensis_encoding::Message for Heartbeat {}
4405 impl Heartbeat {
4406 #[cfg_attr(
4407 not(doctest),
4408 doc = " Any service that is not in the SLEEP state should publish its heartbeat (or a derived status) at least at this rate."
4409 )]
4410 pub const MAX_PUBLICATION_PERIOD: u8 = 1;
4411 }
4412 impl ::canadensis_encoding::Serialize for Heartbeat {
4413 fn size_bits(&self) -> usize {
4414 16
4415 }
4416 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
4417 cursor.write_composite(&self.readiness);
4418 cursor.write_composite(&self.health);
4419 }
4420 }
4421 impl ::canadensis_encoding::Deserialize for Heartbeat {
4422 fn deserialize(
4423 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
4424 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
4425 where
4426 Self: Sized,
4427 {
4428 Ok(Heartbeat {
4429 readiness: { cursor.read_composite()? },
4430 health: { cursor.read_composite()? },
4431 })
4432 }
4433 }
4434 }
4435 pub mod readiness_0_1 {
4436 #[cfg_attr(
4441 not(doctest),
4442 doc = " The readiness state is used to command or report the availability status of a networked service (subsystem).\n\n Any system shall have at least one readiness command subject that acts as a global power switch.\n Every subsystem controlled in such way would usually report its readiness status back to account for the fact that\n the transition between different readiness states may not be instantaneous.\n The readiness status reporting is done by means of the service heartbeat type that is also defined in this namespace;\n the service heartbeat type is a structural subtype of this type.\n\n +------------+\n | Controller |----------+----------------+----------------+---------... readiness command subject\n +------------+ | | |\n ^ ^ ^ v v v\n | | | +---------+ +---------+ +---------+\n | | | | Service | | Service | | Service | ...\n | | | +---------+ +---------+ +---------+\n | | | | | |\n | | +-------------+ | |\n | +----------------------------------+ | service heartbeat subjects\n +-------------------------------------------------------+\n\n In a less trivial use case there may be an arbitrary number of such readiness command subjects (local power switches)\n controlling various systems within the vehicle (e.g., propulsion, perception sensors, communication, etc).\n\n The publication rate is defined on a per-service basis, but it should never be lower than 1 Hz,\n excepting services that are in the SLEEP state, in which case it is permitted to cease all network activity."
4443 )]
4444 pub struct Readiness {
4445 pub value: u8,
4451 }
4452 impl ::canadensis_encoding::DataType for Readiness {
4453 const EXTENT_BYTES: Option<u32> = None;
4455 }
4456 impl ::canadensis_encoding::Message for Readiness {}
4457 impl Readiness {
4458 #[cfg_attr(
4459 not(doctest),
4460 doc = " The long-term state of minimal power consumption.\n Typically, most subsystems are switched into the SLEEP mode when the vehicle is parked and powered off.\n Subsystems that do not support the SLEEP state should treat it as an equivalent of STANDBY.\n\n A subsystem may require a substantial amount of time to exit the sleep mode (for example, time may be needed to\n boot the operating system and run the self test procedures).\n\n While in the SLEEP mode, the subsystem is allowed to cease service provision and stop all network activity\n regardless of other requirements, except that it shall be able to reactivate itself if a Readiness message is\n received commanding any state other than SLEEP.\n Value 1 is invalid and shall never be commanded.\n Implementations receiving this value should interpret it either as SLEEP or STANDBY."
4461 )]
4462 pub const SLEEP: u8 = 0;
4463 #[cfg_attr(
4464 not(doctest),
4465 doc = " The state of being ready to enter the normal operating mode in a short order.\n A subsystem that is in STANDBY state should be able to participate in the normal network activity.\n This is the default state that the subsystem should reside in after power-on until explicitly commanded otherwise."
4466 )]
4467 pub const STANDBY: u8 = 2;
4468 #[cfg_attr(
4469 not(doctest),
4470 doc = " When ENGAGED, the subsystem is performing its main intended function at the nominal performance characteristics.\n A subsystem may require a short amount of time, possibly under a few seconds, to switch between the ENGAGED and\n STANDBY states (in any direction).\n Some subsystems may not differentiate between STANDBY and ENGAGED (e.g., offboard communication hardware).\n The subsystem may disengage itself autonomously in the event of a fatal malfunction, in which case\n the reported service health status should be WARNING."
4471 )]
4472 pub const ENGAGED: u8 = 3;
4473 }
4474 impl ::canadensis_encoding::Serialize for Readiness {
4475 fn size_bits(&self) -> usize {
4476 8
4477 }
4478 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
4479 cursor.write_u2(self.value);
4480 }
4481 }
4482 impl ::canadensis_encoding::Deserialize for Readiness {
4483 fn deserialize(
4484 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
4485 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
4486 where
4487 Self: Sized,
4488 {
4489 Ok(Readiness {
4490 value: { cursor.read_u2() as _ },
4491 })
4492 }
4493 }
4494 }
4495 }
4496 pub mod sensor {
4497 pub mod status_0_1 {
4498 #[cfg_attr(
4503 not(doctest),
4504 doc = " A generic sensor status information.\n This data should be published at a low rate but not lower than the specified limit."
4505 )]
4506 #[derive(
4507 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
4508 )]
4509 #[repr(C, packed)]
4510 pub struct Status {
4511 #[cfg_attr(
4512 not(doctest),
4513 doc = " Data samples obtained at time Ts are valid at time Tr if: (Tr - Ts) < data_validity_period\n Expired data should be discarded."
4514 )]
4515 pub data_validity_period:
4521 crate::uavcan::si::unit::duration::scalar_1_0::Scalar,
4522 #[cfg_attr(
4523 not(doctest),
4524 doc = " Incremented once per occurrence. Reset to zero when the sensor is ENGAGED.\n The exact definition of what constitutes an error is implementation-dependent."
4525 )]
4526 pub error_count: u32,
4532 #[cfg_attr(
4533 not(doctest),
4534 doc = " The temperature of the sensing element.\n If there are multiple sensing elements or multiple temperature probes per sensor,\n the reduction is implementation-defined.\n In a later revision this field may be moved into a separate type."
4535 )]
4536 pub sensor_temperature:
4542 crate::uavcan::si::unit::temperature::scalar_1_0::Scalar,
4543 }
4544 impl ::canadensis_encoding::DataType for Status {
4545 const EXTENT_BYTES: Option<u32> = Some(63);
4547 }
4548 impl ::canadensis_encoding::Message for Status {}
4549 impl Status {
4550 #[cfg_attr(not(doctest), doc = " [second]")]
4551 pub const MAX_PUBLICATION_PERIOD: u8 = 1;
4552 }
4553 impl ::canadensis_encoding::Serialize for Status {
4554 fn size_bits(&self) -> usize {
4555 96
4556 }
4557 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
4558 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
4559 }
4560 }
4561 impl ::canadensis_encoding::Deserialize for Status {
4562 fn deserialize(
4563 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
4564 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
4565 where
4566 Self: Sized,
4567 {
4568 Ok(Self::deserialize_zero_copy(cursor))
4569 }
4570 }
4571 #[test]
4572 fn test_layout() {
4573 assert_eq!(::core::mem::size_of::<Status>() * 8, 96);
4574 assert_eq!(::core::mem::offset_of!(Status, data_validity_period) * 8, 0);
4575 assert_eq!(::core::mem::offset_of!(Status, error_count) * 8, 32);
4576 assert_eq!(::core::mem::offset_of!(Status, sensor_temperature) * 8, 64);
4577 }
4578 }
4579 }
4580 }
4581 }
4582}
4583#[allow(unused_variables, unused_braces, unused_parens)]
4584#[allow(clippy::identity_op)]
4585pub mod uavcan {
4586 pub mod diagnostic {
4587 #[allow(deprecated)]
4588 #[cfg_attr(not(test), deprecated)]
4589 pub mod record_1_0 {
4590 #[cfg_attr(not(doctest), doc = "The fixed subject ID for this message type")]
4591 #[deprecated]
4592 pub const SUBJECT: ::canadensis_core::SubjectId =
4593 ::canadensis_core::SubjectId::from_truncating(8184);
4594
4595 #[cfg_attr(
4600 not(doctest),
4601 doc = " Generic human-readable text message for logging and displaying purposes.\n Generally, it should be published at the lowest priority level."
4602 )]
4603 #[deprecated]
4604 pub struct Record {
4605 #[cfg_attr(
4606 not(doctest),
4607 doc = " Optional timestamp in the network-synchronized time system; zero if undefined.\n The timestamp value conveys the exact moment when the reported event took place."
4608 )]
4609 pub timestamp:
4615 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
4616 pub severity: crate::uavcan::diagnostic::severity_1_0::Severity,
4622 #[cfg_attr(
4623 not(doctest),
4624 doc = " Message text.\n Normally, messages should be kept as short as possible, especially those of high severity."
4625 )]
4626 pub text: ::heapless::Vec<u8, 112>,
4632 }
4633 impl ::canadensis_encoding::DataType for Record {
4634 const EXTENT_BYTES: Option<u32> = Some(300);
4636 }
4637 impl ::canadensis_encoding::Message for Record {}
4638 impl Record {}
4639 impl ::canadensis_encoding::Serialize for Record {
4640 fn size_bits(&self) -> usize {
4641 56 + 8 + 8 + (self.text).len() * 8 + 0
4642 }
4643 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
4644 cursor.write_composite(&self.timestamp);
4645 cursor.write_composite(&self.severity);
4646 cursor.write_aligned_u8((self.text).len() as u8);
4647 cursor.write_bytes(&(self.text)[..]);
4648 }
4649 }
4650 impl ::canadensis_encoding::Deserialize for Record {
4651 fn deserialize(
4652 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
4653 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
4654 where
4655 Self: Sized,
4656 {
4657 Ok(Record {
4658 timestamp: { cursor.read_composite()? },
4659 severity: { cursor.read_composite()? },
4660 text: {
4661 let length = cursor.read_u8() as _;
4662 if length <= 112 {
4663 let mut elements = ::heapless::Vec::new();
4664 for _ in 0..length {
4665 let _ = elements.push(cursor.read_u8() as _);
4666 }
4667 elements
4668 } else {
4669 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
4670 }
4671 },
4672 })
4673 }
4674 }
4675 }
4676 pub mod record_1_1 {
4677 #[cfg_attr(not(doctest), doc = "The fixed subject ID for this message type")]
4678 pub const SUBJECT: ::canadensis_core::SubjectId =
4679 ::canadensis_core::SubjectId::from_truncating(8184);
4680
4681 #[cfg_attr(
4686 not(doctest),
4687 doc = " Generic human-readable text message for logging and displaying purposes.\n Generally, it should be published at the lowest priority level."
4688 )]
4689 pub struct Record {
4690 #[cfg_attr(
4691 not(doctest),
4692 doc = " Optional timestamp in the network-synchronized time system; zero if undefined.\n The timestamp value conveys the exact moment when the reported event took place."
4693 )]
4694 pub timestamp:
4700 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
4701 pub severity: crate::uavcan::diagnostic::severity_1_0::Severity,
4707 #[cfg_attr(
4708 not(doctest),
4709 doc = " Message text.\n Normally, messages should be kept as short as possible, especially those of high severity."
4710 )]
4711 pub text: ::heapless::Vec<u8, 255>,
4717 }
4718 impl ::canadensis_encoding::DataType for Record {
4719 const EXTENT_BYTES: Option<u32> = Some(300);
4721 }
4722 impl ::canadensis_encoding::Message for Record {}
4723 impl Record {}
4724 impl ::canadensis_encoding::Serialize for Record {
4725 fn size_bits(&self) -> usize {
4726 56 + 8 + 8 + (self.text).len() * 8 + 0
4727 }
4728 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
4729 cursor.write_composite(&self.timestamp);
4730 cursor.write_composite(&self.severity);
4731 cursor.write_aligned_u8((self.text).len() as u8);
4732 cursor.write_bytes(&(self.text)[..]);
4733 }
4734 }
4735 impl ::canadensis_encoding::Deserialize for Record {
4736 fn deserialize(
4737 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
4738 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
4739 where
4740 Self: Sized,
4741 {
4742 Ok(Record {
4743 timestamp: { cursor.read_composite()? },
4744 severity: { cursor.read_composite()? },
4745 text: {
4746 let length = cursor.read_u8() as _;
4747 if length <= 255 {
4748 let mut elements = ::heapless::Vec::new();
4749 for _ in 0..length {
4750 let _ = elements.push(cursor.read_u8() as _);
4751 }
4752 elements
4753 } else {
4754 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
4755 }
4756 },
4757 })
4758 }
4759 }
4760 }
4761 pub mod severity_1_0 {
4762 #[cfg_attr(not(doctest), doc = " Generic message severity representation.")]
4767 pub struct Severity {
4768 #[cfg_attr(
4769 not(doctest),
4770 doc = " The severity level ranging from 0 to 7, where low values represent low-severity (unimportant) messages, and\n high values represent high-severity (important) messages. Several mnemonics for the severity levels are\n defined below. Nodes are advised to implement output filtering mechanisms, allowing users to select\n the minimal severity for emitted messages; messages of the selected and higher severity levels will\n be published, and messages of lower severity will be suppressed (discarded)."
4771 )]
4772 pub value: u8,
4778 }
4779 impl ::canadensis_encoding::DataType for Severity {
4780 const EXTENT_BYTES: Option<u32> = None;
4782 }
4783 impl ::canadensis_encoding::Message for Severity {}
4784 impl Severity {
4785 #[cfg_attr(
4786 not(doctest),
4787 doc = " Messages of this severity can be used only during development.\n They shall not be used in a fielded operational system."
4788 )]
4789 pub const TRACE: u8 = 0;
4790 #[cfg_attr(
4791 not(doctest),
4792 doc = " Messages that can aid in troubleshooting.\n Messages of this severity and lower should be disabled by default."
4793 )]
4794 pub const DEBUG: u8 = 1;
4795 #[cfg_attr(
4796 not(doctest),
4797 doc = " General informational messages of low importance.\n Messages of this severity and lower should be disabled by default."
4798 )]
4799 pub const INFO: u8 = 2;
4800 #[cfg_attr(
4801 not(doctest),
4802 doc = " General informational messages of high importance.\n Messages of this severity and lower should be disabled by default."
4803 )]
4804 pub const NOTICE: u8 = 3;
4805 #[cfg_attr(
4806 not(doctest),
4807 doc = " Messages reporting abnormalities and warning conditions.\n Messages of this severity and higher should be enabled by default."
4808 )]
4809 pub const WARNING: u8 = 4;
4810 #[cfg_attr(
4811 not(doctest),
4812 doc = " Messages reporting problems and error conditions.\n Messages of this severity and higher should be enabled by default."
4813 )]
4814 pub const ERROR: u8 = 5;
4815 #[cfg_attr(
4816 not(doctest),
4817 doc = " Messages reporting serious problems and critical conditions.\n Messages of this severity and higher should be always enabled."
4818 )]
4819 pub const CRITICAL: u8 = 6;
4820 #[cfg_attr(
4821 not(doctest),
4822 doc = " Notifications of dangerous circumstances that demand immediate attention.\n Messages of this severity should be always enabled."
4823 )]
4824 pub const ALERT: u8 = 7;
4825 }
4826 impl ::canadensis_encoding::Serialize for Severity {
4827 fn size_bits(&self) -> usize {
4828 8
4829 }
4830 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
4831 cursor.write_u3(self.value);
4832 }
4833 }
4834 impl ::canadensis_encoding::Deserialize for Severity {
4835 fn deserialize(
4836 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
4837 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
4838 where
4839 Self: Sized,
4840 {
4841 Ok(Severity {
4842 value: { cursor.read_u3() as _ },
4843 })
4844 }
4845 }
4846 }
4847 }
4848 pub mod file {
4849 pub mod error_1_0 {
4850 #[cfg_attr(
4855 not(doctest),
4856 doc = " Nested type.\n Result of a file system operation."
4857 )]
4858 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
4859 #[repr(C, packed)]
4860 pub struct Error {
4861 pub value: u16,
4867 }
4868 impl ::canadensis_encoding::DataType for Error {
4869 const EXTENT_BYTES: Option<u32> = None;
4871 }
4872 impl ::canadensis_encoding::Message for Error {}
4873 impl Error {
4874 pub const OK: u16 = 0;
4875 pub const UNKNOWN_ERROR: u16 = 65535;
4876 pub const NOT_FOUND: u16 = 2;
4877 pub const IO_ERROR: u16 = 5;
4878 pub const ACCESS_DENIED: u16 = 13;
4879 #[cfg_attr(
4880 not(doctest),
4881 doc = " I.e., attempted read/write on a path that points to a directory"
4882 )]
4883 pub const IS_DIRECTORY: u16 = 21;
4884 #[cfg_attr(
4885 not(doctest),
4886 doc = " E.g., file name is not valid for the target file system"
4887 )]
4888 pub const INVALID_VALUE: u16 = 22;
4889 pub const FILE_TOO_LARGE: u16 = 27;
4890 pub const OUT_OF_SPACE: u16 = 28;
4891 pub const NOT_SUPPORTED: u16 = 38;
4892 }
4893 impl ::canadensis_encoding::Serialize for Error {
4894 fn size_bits(&self) -> usize {
4895 16
4896 }
4897 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
4898 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
4899 }
4900 }
4901 impl ::canadensis_encoding::Deserialize for Error {
4902 fn deserialize(
4903 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
4904 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
4905 where
4906 Self: Sized,
4907 {
4908 Ok(Self::deserialize_zero_copy(cursor))
4909 }
4910 }
4911 #[test]
4912 fn test_layout() {
4913 assert_eq!(::core::mem::size_of::<Error>() * 8, 16);
4914 assert_eq!(::core::mem::offset_of!(Error, value) * 8, 0);
4915 }
4916 }
4917 #[allow(deprecated)]
4918 #[cfg_attr(not(test), deprecated)]
4919 pub mod get_info_0_1 {
4920 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
4921 #[deprecated]
4922 pub const SERVICE: ::canadensis_core::ServiceId =
4923 ::canadensis_core::ServiceId::from_truncating(405);
4924
4925 #[cfg_attr(
4930 not(doctest),
4931 doc = " Information about a remote file system entry (file, directory, etc)."
4932 )]
4933 #[deprecated]
4934 pub struct GetInfoRequest {
4935 pub path: crate::uavcan::file::path_1_0::Path,
4941 }
4942 impl ::canadensis_encoding::DataType for GetInfoRequest {
4943 const EXTENT_BYTES: Option<u32> = Some(300);
4945 }
4946 impl ::canadensis_encoding::Request for GetInfoRequest {}
4947 impl GetInfoRequest {}
4948 impl ::canadensis_encoding::Serialize for GetInfoRequest {
4949 fn size_bits(&self) -> usize {
4950 (self.path).size_bits() + 0
4951 }
4952 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
4953 cursor.write_composite(&self.path);
4954 }
4955 }
4956 impl ::canadensis_encoding::Deserialize for GetInfoRequest {
4957 fn deserialize(
4958 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
4959 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
4960 where
4961 Self: Sized,
4962 {
4963 Ok(GetInfoRequest {
4964 path: { cursor.read_composite()? },
4965 })
4966 }
4967 }
4968
4969 #[deprecated]
4974 pub struct GetInfoResponse {
4975 #[cfg_attr(not(doctest), doc = " Result of the operation.")]
4976 pub error: crate::uavcan::file::error_1_0::Error,
4982 #[cfg_attr(
4983 not(doctest),
4984 doc = " File size in bytes. Should be set to zero for directories."
4985 )]
4986 pub size: u64,
4992 #[cfg_attr(
4993 not(doctest),
4994 doc = " The UNIX Epoch time when the entry was last modified. Zero if unknown."
4995 )]
4996 pub unix_timestamp_of_last_modification: u64,
5002 #[cfg_attr(not(doctest), doc = " True if file, false if directory.")]
5003 pub is_file_not_directory: bool,
5009 #[cfg_attr(
5010 not(doctest),
5011 doc = " This is a link to another entry; the above flag indicates the type of the target."
5012 )]
5013 pub is_link: bool,
5019 #[cfg_attr(
5020 not(doctest),
5021 doc = " The item can be read by the caller (applies to files and directories)."
5022 )]
5023 pub is_readable: bool,
5029 #[cfg_attr(
5030 not(doctest),
5031 doc = " The item can be written by the caller (applies to files and directories).\n If such entry does not exist, all flags should be cleared/ignored."
5032 )]
5033 pub is_writeable: bool,
5039 }
5041 impl ::canadensis_encoding::DataType for GetInfoResponse {
5042 const EXTENT_BYTES: Option<u32> = Some(48);
5044 }
5045 impl ::canadensis_encoding::Response for GetInfoResponse {}
5046 impl GetInfoResponse {}
5047 impl ::canadensis_encoding::Serialize for GetInfoResponse {
5048 fn size_bits(&self) -> usize {
5049 104
5050 }
5051 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5052 cursor.write_composite(&self.error);
5053 cursor.write_u40(self.size);
5054 cursor.write_u40(self.unix_timestamp_of_last_modification);
5055 cursor.write_bool(self.is_file_not_directory);
5056 cursor.write_bool(self.is_link);
5057 cursor.write_bool(self.is_readable);
5058 cursor.write_bool(self.is_writeable);
5059 cursor.skip_4();
5060 }
5061 }
5062 impl ::canadensis_encoding::Deserialize for GetInfoResponse {
5063 fn deserialize(
5064 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5065 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5066 where
5067 Self: Sized,
5068 {
5069 Ok(GetInfoResponse {
5070 error: { cursor.read_composite()? },
5071 size: { cursor.read_u40() as _ },
5072 unix_timestamp_of_last_modification: { cursor.read_u40() as _ },
5073 is_file_not_directory: { cursor.read_bool() },
5074 is_link: { cursor.read_bool() },
5075 is_readable: { cursor.read_bool() },
5076 is_writeable: { cursor.read_bool() },
5077 })
5078 }
5079 }
5080 }
5081 pub mod get_info_0_2 {
5082 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
5083 pub const SERVICE: ::canadensis_core::ServiceId =
5084 ::canadensis_core::ServiceId::from_truncating(405);
5085
5086 #[cfg_attr(
5091 not(doctest),
5092 doc = " Information about a remote file system entry (file, directory, etc)."
5093 )]
5094 pub struct GetInfoRequest {
5095 pub path: crate::uavcan::file::path_2_0::Path,
5101 }
5102 impl ::canadensis_encoding::DataType for GetInfoRequest {
5103 const EXTENT_BYTES: Option<u32> = Some(300);
5105 }
5106 impl ::canadensis_encoding::Request for GetInfoRequest {}
5107 impl GetInfoRequest {}
5108 impl ::canadensis_encoding::Serialize for GetInfoRequest {
5109 fn size_bits(&self) -> usize {
5110 (self.path).size_bits() + 0
5111 }
5112 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5113 cursor.write_composite(&self.path);
5114 }
5115 }
5116 impl ::canadensis_encoding::Deserialize for GetInfoRequest {
5117 fn deserialize(
5118 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5119 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5120 where
5121 Self: Sized,
5122 {
5123 Ok(GetInfoRequest {
5124 path: { cursor.read_composite()? },
5125 })
5126 }
5127 }
5128
5129 pub struct GetInfoResponse {
5134 #[cfg_attr(not(doctest), doc = " Result of the operation.")]
5135 pub error: crate::uavcan::file::error_1_0::Error,
5141 #[cfg_attr(
5142 not(doctest),
5143 doc = " File size in bytes. Should be set to zero for directories."
5144 )]
5145 pub size: u64,
5151 #[cfg_attr(
5152 not(doctest),
5153 doc = " The UNIX Epoch time when the entry was last modified. Zero if unknown."
5154 )]
5155 pub unix_timestamp_of_last_modification: u64,
5161 #[cfg_attr(not(doctest), doc = " True if file, false if directory.")]
5162 pub is_file_not_directory: bool,
5168 #[cfg_attr(
5169 not(doctest),
5170 doc = " This is a link to another entry; the above flag indicates the type of the target."
5171 )]
5172 pub is_link: bool,
5178 #[cfg_attr(
5179 not(doctest),
5180 doc = " The item can be read by the caller (applies to files and directories)."
5181 )]
5182 pub is_readable: bool,
5188 #[cfg_attr(
5189 not(doctest),
5190 doc = " The item can be written by the caller (applies to files and directories).\n If such entry does not exist, all flags should be cleared/ignored."
5191 )]
5192 pub is_writeable: bool,
5198 }
5200 impl ::canadensis_encoding::DataType for GetInfoResponse {
5201 const EXTENT_BYTES: Option<u32> = Some(48);
5203 }
5204 impl ::canadensis_encoding::Response for GetInfoResponse {}
5205 impl GetInfoResponse {}
5206 impl ::canadensis_encoding::Serialize for GetInfoResponse {
5207 fn size_bits(&self) -> usize {
5208 104
5209 }
5210 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5211 cursor.write_composite(&self.error);
5212 cursor.write_u40(self.size);
5213 cursor.write_u40(self.unix_timestamp_of_last_modification);
5214 cursor.write_bool(self.is_file_not_directory);
5215 cursor.write_bool(self.is_link);
5216 cursor.write_bool(self.is_readable);
5217 cursor.write_bool(self.is_writeable);
5218 cursor.skip_4();
5219 }
5220 }
5221 impl ::canadensis_encoding::Deserialize for GetInfoResponse {
5222 fn deserialize(
5223 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5224 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5225 where
5226 Self: Sized,
5227 {
5228 Ok(GetInfoResponse {
5229 error: { cursor.read_composite()? },
5230 size: { cursor.read_u40() as _ },
5231 unix_timestamp_of_last_modification: { cursor.read_u40() as _ },
5232 is_file_not_directory: { cursor.read_bool() },
5233 is_link: { cursor.read_bool() },
5234 is_readable: { cursor.read_bool() },
5235 is_writeable: { cursor.read_bool() },
5236 })
5237 }
5238 }
5239 }
5240 #[allow(deprecated)]
5241 #[cfg_attr(not(test), deprecated)]
5242 pub mod list_0_1 {
5243 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
5244 #[deprecated]
5245 pub const SERVICE: ::canadensis_core::ServiceId =
5246 ::canadensis_core::ServiceId::from_truncating(406);
5247
5248 #[cfg_attr(
5253 not(doctest),
5254 doc = " This service can be used to list a remote directory, one entry per request.\n\n The client should query each entry independently, iterating 'entry_index' from 0 until the last entry.\n When the index reaches the number of elements in the directory, the server will report that there is\n no such entry by returning an empty name.\n\n The field entry_index shall be applied to an ordered list of directory entries (e.g. alphabetically ordered).\n The exact sorting criteria does not matter as long as it provides the same ordering for subsequent service calls.\n\n Observe that this listing operation is fundamentally non-atomic. The caller shall beware of possible race conditions\n and is responsible for handling them properly. Particularly, consider what happens if a new item is inserted into\n the directory between two subsequent calls: if the item happened to be inserted at the index that is lower than the\n index of the next request, the next returned item (or several, if more items were inserted) will repeat the ones\n that were listed earlier. The caller should handle that properly, either by ignoring the repeated items or by\n restarting the listing operation from the beginning (index 0)."
5255 )]
5256 #[deprecated]
5257 pub struct ListRequest {
5258 pub entry_index: u32,
5264 pub directory_path: crate::uavcan::file::path_1_0::Path,
5271 }
5272 impl ::canadensis_encoding::DataType for ListRequest {
5273 const EXTENT_BYTES: Option<u32> = Some(300);
5275 }
5276 impl ::canadensis_encoding::Request for ListRequest {}
5277 impl ListRequest {}
5278 impl ::canadensis_encoding::Serialize for ListRequest {
5279 fn size_bits(&self) -> usize {
5280 32 + 32 + (self.directory_path).size_bits() + 0
5281 }
5282 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5283 cursor.write_aligned_u32(self.entry_index);
5284 cursor.skip_32();
5285 cursor.write_composite(&self.directory_path);
5286 }
5287 }
5288 impl ::canadensis_encoding::Deserialize for ListRequest {
5289 fn deserialize(
5290 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5291 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5292 where
5293 Self: Sized,
5294 {
5295 Ok(ListRequest {
5296 entry_index: { cursor.read_u32() as _ },
5297 directory_path: {
5298 cursor.skip_32();
5299 cursor.read_composite()?
5300 },
5301 })
5302 }
5303 }
5304
5305 #[deprecated]
5310 pub struct ListResponse {
5311 #[cfg_attr(
5313 not(doctest),
5314 doc = " The base name of the referenced entry, i.e., relative to the outer directory.\n The outer directory path is not included to conserve bandwidth.\n Empty if such entry does not exist.\n\n For example, suppose there is a file \"/foo/bar/baz.bin\". Listing the directory with the path \"/foo/bar/\" (the slash\n at the end is optional) at the index 0 will return \"baz.bin\". Listing the same directory at the index 1 (or any\n higher) will return an empty name \"\", indicating that the caller has reached the end of the list."
5315 )]
5316 pub entry_base_name: crate::uavcan::file::path_1_0::Path,
5322 }
5323 impl ::canadensis_encoding::DataType for ListResponse {
5324 const EXTENT_BYTES: Option<u32> = Some(300);
5326 }
5327 impl ::canadensis_encoding::Response for ListResponse {}
5328 impl ListResponse {}
5329 impl ::canadensis_encoding::Serialize for ListResponse {
5330 fn size_bits(&self) -> usize {
5331 32 + (self.entry_base_name).size_bits() + 0
5332 }
5333 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5334 cursor.skip_32();
5335 cursor.write_composite(&self.entry_base_name);
5336 }
5337 }
5338 impl ::canadensis_encoding::Deserialize for ListResponse {
5339 fn deserialize(
5340 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5341 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5342 where
5343 Self: Sized,
5344 {
5345 Ok(ListResponse {
5346 entry_base_name: {
5347 cursor.skip_32();
5348 cursor.read_composite()?
5349 },
5350 })
5351 }
5352 }
5353 }
5354 pub mod list_0_2 {
5355 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
5356 pub const SERVICE: ::canadensis_core::ServiceId =
5357 ::canadensis_core::ServiceId::from_truncating(406);
5358
5359 #[cfg_attr(
5364 not(doctest),
5365 doc = " This service can be used to list a remote directory, one entry per request.\n\n The client should query each entry independently, iterating 'entry_index' from 0 until the last entry.\n When the index reaches the number of elements in the directory, the server will report that there is\n no such entry by returning an empty name.\n\n The field entry_index shall be applied to an ordered list of directory entries (e.g. alphabetically ordered).\n The exact sorting criteria does not matter as long as it provides the same ordering for subsequent service calls.\n\n Observe that this listing operation is fundamentally non-atomic. The caller shall beware of possible race conditions\n and is responsible for handling them properly. Particularly, consider what happens if a new item is inserted into\n the directory between two subsequent calls: if the item happened to be inserted at the index that is lower than the\n index of the next request, the next returned item (or several, if more items were inserted) will repeat the ones\n that were listed earlier. The caller should handle that properly, either by ignoring the repeated items or by\n restarting the listing operation from the beginning (index 0)."
5366 )]
5367 pub struct ListRequest {
5368 pub entry_index: u32,
5374 pub directory_path: crate::uavcan::file::path_2_0::Path,
5381 }
5382 impl ::canadensis_encoding::DataType for ListRequest {
5383 const EXTENT_BYTES: Option<u32> = Some(300);
5385 }
5386 impl ::canadensis_encoding::Request for ListRequest {}
5387 impl ListRequest {}
5388 impl ::canadensis_encoding::Serialize for ListRequest {
5389 fn size_bits(&self) -> usize {
5390 32 + 32 + (self.directory_path).size_bits() + 0
5391 }
5392 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5393 cursor.write_aligned_u32(self.entry_index);
5394 cursor.skip_32();
5395 cursor.write_composite(&self.directory_path);
5396 }
5397 }
5398 impl ::canadensis_encoding::Deserialize for ListRequest {
5399 fn deserialize(
5400 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5401 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5402 where
5403 Self: Sized,
5404 {
5405 Ok(ListRequest {
5406 entry_index: { cursor.read_u32() as _ },
5407 directory_path: {
5408 cursor.skip_32();
5409 cursor.read_composite()?
5410 },
5411 })
5412 }
5413 }
5414
5415 pub struct ListResponse {
5420 #[cfg_attr(
5422 not(doctest),
5423 doc = " The base name of the referenced entry, i.e., relative to the outer directory.\n The outer directory path is not included to conserve bandwidth.\n Empty if such entry does not exist.\n\n For example, suppose there is a file \"/foo/bar/baz.bin\". Listing the directory with the path \"/foo/bar/\" (the slash\n at the end is optional) at the index 0 will return \"baz.bin\". Listing the same directory at the index 1 (or any\n higher) will return an empty name \"\", indicating that the caller has reached the end of the list."
5424 )]
5425 pub entry_base_name: crate::uavcan::file::path_2_0::Path,
5431 }
5432 impl ::canadensis_encoding::DataType for ListResponse {
5433 const EXTENT_BYTES: Option<u32> = Some(300);
5435 }
5436 impl ::canadensis_encoding::Response for ListResponse {}
5437 impl ListResponse {}
5438 impl ::canadensis_encoding::Serialize for ListResponse {
5439 fn size_bits(&self) -> usize {
5440 32 + (self.entry_base_name).size_bits() + 0
5441 }
5442 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5443 cursor.skip_32();
5444 cursor.write_composite(&self.entry_base_name);
5445 }
5446 }
5447 impl ::canadensis_encoding::Deserialize for ListResponse {
5448 fn deserialize(
5449 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5450 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5451 where
5452 Self: Sized,
5453 {
5454 Ok(ListResponse {
5455 entry_base_name: {
5456 cursor.skip_32();
5457 cursor.read_composite()?
5458 },
5459 })
5460 }
5461 }
5462 }
5463 #[allow(deprecated)]
5464 #[cfg_attr(not(test), deprecated)]
5465 pub mod modify_1_0 {
5466 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
5467 #[deprecated]
5468 pub const SERVICE: ::canadensis_core::ServiceId =
5469 ::canadensis_core::ServiceId::from_truncating(407);
5470
5471 #[cfg_attr(
5476 not(doctest),
5477 doc = " Manipulate a remote file system entry. Applies to files, directories, and links alike.\n If the remote entry is a directory, all nested entries will be affected, too.\n\n The server should perform all operations atomically, unless atomicity is not supported by\n the underlying file system.\n\n Atomic copying can be effectively employed by remote nodes before reading or after writing\n the file to minimize the possibility of race conditions.\n For example, before reading a large file from the server, the cilent might opt to create\n a temporary copy of it first, then read the copy, and delete it upon completion. Likewise,\n a similar strategy can be employed for writing, where the file is first written at a\n temporary location, and then moved to its final destination. These approaches, however,\n may lead to creation of dangling temporary files if the client failed to dispose of them\n properly, so that risk should be taken into account.\n\n Move/Copy\n Specify the source path and the destination path.\n If the source does not exist, the operation will fail.\n Set the preserve_source flag to copy rather than move.\n If the destination exists and overwrite_destination is not set, the operation will fail.\n If the target path includes non-existent directories, they will be created (like \"mkdir -p\").\n\n Touch\n Specify the destination path and make the source path empty.\n If the path exists (file/directory/link), its modification time will be updated.\n If the path does not exist, an empty file will be created.\n If the target path includes non-existent directories, they will be created (like \"mkdir -p\").\n Flags are ignored.\n\n Remove\n Specify the source path (file/directory/link) and make the destination path empty.\n Fails if the path does not exist.\n Flags are ignored."
5478 )]
5479 #[deprecated]
5480 pub struct ModifyRequest {
5481 #[cfg_attr(
5482 not(doctest),
5483 doc = " Do not remove the source. Used to copy instead of moving."
5484 )]
5485 pub preserve_source: bool,
5491 #[cfg_attr(
5492 not(doctest),
5493 doc = " If the destination exists, remove it beforehand."
5494 )]
5495 pub overwrite_destination: bool,
5501 pub source: crate::uavcan::file::path_1_0::Path,
5508 pub destination: crate::uavcan::file::path_1_0::Path,
5514 }
5515 impl ::canadensis_encoding::DataType for ModifyRequest {
5516 const EXTENT_BYTES: Option<u32> = Some(600);
5518 }
5519 impl ::canadensis_encoding::Request for ModifyRequest {}
5520 impl ModifyRequest {}
5521 impl ::canadensis_encoding::Serialize for ModifyRequest {
5522 fn size_bits(&self) -> usize {
5523 1 + 1 + 30 + (self.source).size_bits() + (self.destination).size_bits() + 0
5524 }
5525 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5526 cursor.write_bool(self.preserve_source);
5527 cursor.write_bool(self.overwrite_destination);
5528 cursor.skip_30();
5529 cursor.write_composite(&self.source);
5530 cursor.write_composite(&self.destination);
5531 }
5532 }
5533 impl ::canadensis_encoding::Deserialize for ModifyRequest {
5534 fn deserialize(
5535 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5536 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5537 where
5538 Self: Sized,
5539 {
5540 Ok(ModifyRequest {
5541 preserve_source: { cursor.read_bool() },
5542 overwrite_destination: { cursor.read_bool() },
5543 source: {
5544 cursor.skip_30();
5545 cursor.read_composite()?
5546 },
5547 destination: { cursor.read_composite()? },
5548 })
5549 }
5550 }
5551
5552 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
5557 #[repr(C, packed)]
5558 #[deprecated]
5559 pub struct ModifyResponse {
5560 pub error: crate::uavcan::file::error_1_0::Error,
5566 }
5567 impl ::canadensis_encoding::DataType for ModifyResponse {
5568 const EXTENT_BYTES: Option<u32> = Some(48);
5570 }
5571 impl ::canadensis_encoding::Response for ModifyResponse {}
5572 impl ModifyResponse {}
5573 impl ::canadensis_encoding::Serialize for ModifyResponse {
5574 fn size_bits(&self) -> usize {
5575 16
5576 }
5577 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5578 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
5579 }
5580 }
5581 impl ::canadensis_encoding::Deserialize for ModifyResponse {
5582 fn deserialize(
5583 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5584 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5585 where
5586 Self: Sized,
5587 {
5588 Ok(Self::deserialize_zero_copy(cursor))
5589 }
5590 }
5591 #[test]
5592 fn test_layout() {
5593 assert_eq!(::core::mem::size_of::<ModifyResponse>() * 8, 16);
5594 assert_eq!(::core::mem::offset_of!(ModifyResponse, error) * 8, 0);
5595 }
5596 }
5597 pub mod modify_1_1 {
5598 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
5599 pub const SERVICE: ::canadensis_core::ServiceId =
5600 ::canadensis_core::ServiceId::from_truncating(407);
5601
5602 #[cfg_attr(
5607 not(doctest),
5608 doc = " Manipulate a remote file system entry. Applies to files, directories, and links alike.\n If the remote entry is a directory, all nested entries will be affected, too.\n\n The server should perform all operations atomically, unless atomicity is not supported by\n the underlying file system.\n\n Atomic copying can be effectively employed by remote nodes before reading or after writing\n the file to minimize the possibility of race conditions.\n For example, before reading a large file from the server, the cilent might opt to create\n a temporary copy of it first, then read the copy, and delete it upon completion. Likewise,\n a similar strategy can be employed for writing, where the file is first written at a\n temporary location, and then moved to its final destination. These approaches, however,\n may lead to creation of dangling temporary files if the client failed to dispose of them\n properly, so that risk should be taken into account.\n\n Move/Copy\n Specify the source path and the destination path.\n If the source does not exist, the operation will fail.\n Set the preserve_source flag to copy rather than move.\n If the destination exists and overwrite_destination is not set, the operation will fail.\n If the target path includes non-existent directories, they will be created (like \"mkdir -p\").\n\n Touch\n Specify the destination path and make the source path empty.\n If the path exists (file/directory/link), its modification time will be updated.\n If the path does not exist, an empty file will be created.\n If the target path includes non-existent directories, they will be created (like \"mkdir -p\").\n Flags are ignored.\n\n Remove\n Specify the source path (file/directory/link) and make the destination path empty.\n Fails if the path does not exist.\n Flags are ignored."
5609 )]
5610 pub struct ModifyRequest {
5611 #[cfg_attr(
5612 not(doctest),
5613 doc = " Do not remove the source. Used to copy instead of moving."
5614 )]
5615 pub preserve_source: bool,
5621 #[cfg_attr(
5622 not(doctest),
5623 doc = " If the destination exists, remove it beforehand."
5624 )]
5625 pub overwrite_destination: bool,
5631 pub source: crate::uavcan::file::path_2_0::Path,
5638 pub destination: crate::uavcan::file::path_2_0::Path,
5644 }
5645 impl ::canadensis_encoding::DataType for ModifyRequest {
5646 const EXTENT_BYTES: Option<u32> = Some(600);
5648 }
5649 impl ::canadensis_encoding::Request for ModifyRequest {}
5650 impl ModifyRequest {}
5651 impl ::canadensis_encoding::Serialize for ModifyRequest {
5652 fn size_bits(&self) -> usize {
5653 1 + 1 + 30 + (self.source).size_bits() + (self.destination).size_bits() + 0
5654 }
5655 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5656 cursor.write_bool(self.preserve_source);
5657 cursor.write_bool(self.overwrite_destination);
5658 cursor.skip_30();
5659 cursor.write_composite(&self.source);
5660 cursor.write_composite(&self.destination);
5661 }
5662 }
5663 impl ::canadensis_encoding::Deserialize for ModifyRequest {
5664 fn deserialize(
5665 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5666 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5667 where
5668 Self: Sized,
5669 {
5670 Ok(ModifyRequest {
5671 preserve_source: { cursor.read_bool() },
5672 overwrite_destination: { cursor.read_bool() },
5673 source: {
5674 cursor.skip_30();
5675 cursor.read_composite()?
5676 },
5677 destination: { cursor.read_composite()? },
5678 })
5679 }
5680 }
5681
5682 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
5687 #[repr(C, packed)]
5688 pub struct ModifyResponse {
5689 pub error: crate::uavcan::file::error_1_0::Error,
5695 }
5696 impl ::canadensis_encoding::DataType for ModifyResponse {
5697 const EXTENT_BYTES: Option<u32> = Some(48);
5699 }
5700 impl ::canadensis_encoding::Response for ModifyResponse {}
5701 impl ModifyResponse {}
5702 impl ::canadensis_encoding::Serialize for ModifyResponse {
5703 fn size_bits(&self) -> usize {
5704 16
5705 }
5706 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5707 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
5708 }
5709 }
5710 impl ::canadensis_encoding::Deserialize for ModifyResponse {
5711 fn deserialize(
5712 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5713 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5714 where
5715 Self: Sized,
5716 {
5717 Ok(Self::deserialize_zero_copy(cursor))
5718 }
5719 }
5720 #[test]
5721 fn test_layout() {
5722 assert_eq!(::core::mem::size_of::<ModifyResponse>() * 8, 16);
5723 assert_eq!(::core::mem::offset_of!(ModifyResponse, error) * 8, 0);
5724 }
5725 }
5726 #[allow(deprecated)]
5727 #[cfg_attr(not(test), deprecated)]
5728 pub mod path_1_0 {
5729 #[cfg_attr(
5734 not(doctest),
5735 doc = " Nested type.\n A file system path encoded in UTF8. The only valid separator is the forward slash \"/\".\n A single slash (\"/\") refers to the root directory (the location of which is defined by the server).\n Relative references (e.g. \"..\") are not defined and not permitted (although this may change in the future).\n Conventions (not enforced):\n - A path pointing to a file or a link to file should not end with a separator.\n - A path pointing to a directory or to a link to directory should end with a separator.\n\n The maximum path length limit is chosen as a trade-off between compatibility with deep directory structures and\n the worst-case transfer length. The limit is 112 bytes, which allows all transfers containing a single instance\n of path and no other large data chunks to fit into two CAN FD frames."
5736 )]
5737 #[deprecated]
5738 pub struct Path {
5739 pub path: ::heapless::Vec<u8, 112>,
5745 }
5746 impl ::canadensis_encoding::DataType for Path {
5747 const EXTENT_BYTES: Option<u32> = None;
5749 }
5750 impl ::canadensis_encoding::Message for Path {}
5751 impl Path {
5752 pub const SEPARATOR: u8 = 47;
5753 pub const MAX_LENGTH: u8 = 112;
5754 }
5755 impl ::canadensis_encoding::Serialize for Path {
5756 fn size_bits(&self) -> usize {
5757 8 + (self.path).len() * 8 + 0
5758 }
5759 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5760 cursor.write_aligned_u8((self.path).len() as u8);
5761 cursor.write_bytes(&(self.path)[..]);
5762 }
5763 }
5764 impl ::canadensis_encoding::Deserialize for Path {
5765 fn deserialize(
5766 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5767 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5768 where
5769 Self: Sized,
5770 {
5771 Ok(Path {
5772 path: {
5773 let length = cursor.read_u8() as _;
5774 if length <= 112 {
5775 let mut elements = ::heapless::Vec::new();
5776 for _ in 0..length {
5777 let _ = elements.push(cursor.read_u8() as _);
5778 }
5779 elements
5780 } else {
5781 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
5782 }
5783 },
5784 })
5785 }
5786 }
5787 }
5788 pub mod path_2_0 {
5789 #[cfg_attr(
5794 not(doctest),
5795 doc = " Nested type.\n A file system path encoded in UTF8. The only valid separator is the forward slash \"/\".\n A single slash (\"/\") refers to the root directory (the location of which is defined by the server).\n Relative references (e.g. \"..\") are not defined and not permitted (although this may change in the future).\n Conventions (not enforced):\n - A path pointing to a file or a link to file should not end with a separator.\n - A path pointing to a directory or to a link to directory should end with a separator."
5796 )]
5797 pub struct Path {
5798 pub path: ::heapless::Vec<u8, 255>,
5804 }
5805 impl ::canadensis_encoding::DataType for Path {
5806 const EXTENT_BYTES: Option<u32> = None;
5808 }
5809 impl ::canadensis_encoding::Message for Path {}
5810 impl Path {
5811 pub const SEPARATOR: u8 = 47;
5812 pub const MAX_LENGTH: u8 = 255;
5813 }
5814 impl ::canadensis_encoding::Serialize for Path {
5815 fn size_bits(&self) -> usize {
5816 8 + (self.path).len() * 8 + 0
5817 }
5818 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5819 cursor.write_aligned_u8((self.path).len() as u8);
5820 cursor.write_bytes(&(self.path)[..]);
5821 }
5822 }
5823 impl ::canadensis_encoding::Deserialize for Path {
5824 fn deserialize(
5825 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5826 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5827 where
5828 Self: Sized,
5829 {
5830 Ok(Path {
5831 path: {
5832 let length = cursor.read_u8() as _;
5833 if length <= 255 {
5834 let mut elements = ::heapless::Vec::new();
5835 for _ in 0..length {
5836 let _ = elements.push(cursor.read_u8() as _);
5837 }
5838 elements
5839 } else {
5840 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
5841 }
5842 },
5843 })
5844 }
5845 }
5846 }
5847 #[allow(deprecated)]
5848 #[cfg_attr(not(test), deprecated)]
5849 pub mod read_1_0 {
5850 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
5851 #[deprecated]
5852 pub const SERVICE: ::canadensis_core::ServiceId =
5853 ::canadensis_core::ServiceId::from_truncating(408);
5854
5855 #[cfg_attr(
5860 not(doctest),
5861 doc = " Read file from a remote node.\n\n There are two possible outcomes of a successful call:\n 1. Data array size equals its capacity. This means that the end of the file is not reached yet.\n 2. Data array size is less than its capacity, possibly zero. This means that the end of the file is reached.\n\n Thus, if the client needs to fetch the entire file, it should repeatedly call this service while increasing the\n offset, until a non-full data array is returned.\n\n If the object pointed by 'path' cannot be read (e.g. it is a directory or it does not exist), an appropriate error\n code will be returned, and the data array will be empty.\n\n It is easy to see that this protocol is prone to race conditions because the remote file can be modified\n between read operations which might result in the client obtaining a damaged file. To combat this,\n application designers are recommended to adhere to the following convention. Let every file whose integrity\n is of interest have a hash or a digital signature, which is stored in an adjacent file under the same name\n suffixed with the appropriate extension according to the type of hash or digital signature used.\n For example, let there be file \"image.bin\", integrity of which shall be ensured by the client upon downloading.\n Suppose that the file is hashed using SHA-256, so the appropriate file extension for the hash would be\n \".sha256\". Following this convention, the hash of \"image.bin\" would be stored in \"image.bin.sha256\".\n After downloading the file, the client would read the hash (being small, the hash can be read in a single\n request) and check it against a locally computed value. Some servers may opt to generate such hash files\n automatically as necessary; for example, if such file is requested but it does not exist, the server would\n compute the necessary signature or hash (the type of hash/signature can be deduced from the requested file\n extension) and return it as if the file existed. Obviously, this would be impractical for very large files;\n in that case, hash/signature should be pre-computed and stored in a real file. If this approach is followed,\n implementers are advised to use only SHA-256 for hashing, in order to reduce the number of fielded\n incompatible implementations."
5862 )]
5863 #[deprecated]
5864 pub struct ReadRequest {
5865 pub offset: u64,
5871 pub path: crate::uavcan::file::path_1_0::Path,
5877 }
5878 impl ::canadensis_encoding::DataType for ReadRequest {
5879 const EXTENT_BYTES: Option<u32> = Some(300);
5881 }
5882 impl ::canadensis_encoding::Request for ReadRequest {}
5883 impl ReadRequest {}
5884 impl ::canadensis_encoding::Serialize for ReadRequest {
5885 fn size_bits(&self) -> usize {
5886 40 + (self.path).size_bits() + 0
5887 }
5888 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5889 cursor.write_u40(self.offset);
5890 cursor.write_composite(&self.path);
5891 }
5892 }
5893 impl ::canadensis_encoding::Deserialize for ReadRequest {
5894 fn deserialize(
5895 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5896 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5897 where
5898 Self: Sized,
5899 {
5900 Ok(ReadRequest {
5901 offset: { cursor.read_u40() as _ },
5902 path: { cursor.read_composite()? },
5903 })
5904 }
5905 }
5906
5907 #[deprecated]
5912 pub struct ReadResponse {
5913 pub error: crate::uavcan::file::error_1_0::Error,
5919 pub data: ::heapless::Vec<u8, 256>,
5925 }
5926 impl ::canadensis_encoding::DataType for ReadResponse {
5927 const EXTENT_BYTES: Option<u32> = Some(300);
5929 }
5930 impl ::canadensis_encoding::Response for ReadResponse {}
5931 impl ReadResponse {}
5932 impl ::canadensis_encoding::Serialize for ReadResponse {
5933 fn size_bits(&self) -> usize {
5934 16 + 16 + (self.data).len() * 8 + 0
5935 }
5936 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
5937 cursor.write_composite(&self.error);
5938 cursor.write_aligned_u16((self.data).len() as u16);
5939 cursor.write_bytes(&(self.data)[..]);
5940 }
5941 }
5942 impl ::canadensis_encoding::Deserialize for ReadResponse {
5943 fn deserialize(
5944 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
5945 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
5946 where
5947 Self: Sized,
5948 {
5949 Ok(ReadResponse {
5950 error: { cursor.read_composite()? },
5951 data: {
5952 let length = cursor.read_u16() as _;
5953 if length <= 256 {
5954 let mut elements = ::heapless::Vec::new();
5955 for _ in 0..length {
5956 let _ = elements.push(cursor.read_u8() as _);
5957 }
5958 elements
5959 } else {
5960 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
5961 }
5962 },
5963 })
5964 }
5965 }
5966 }
5967 pub mod read_1_1 {
5968 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
5969 pub const SERVICE: ::canadensis_core::ServiceId =
5970 ::canadensis_core::ServiceId::from_truncating(408);
5971
5972 #[cfg_attr(
5977 not(doctest),
5978 doc = " Read file from a remote node.\n\n There are two possible outcomes of a successful call:\n 1. Data array size equals its capacity. This means that the end of the file is not reached yet.\n 2. Data array size is less than its capacity, possibly zero. This means that the end of the file is reached.\n\n Thus, if the client needs to fetch the entire file, it should repeatedly call this service while increasing the\n offset, until a non-full data array is returned.\n\n If the object pointed by 'path' cannot be read (e.g. it is a directory or it does not exist), an appropriate error\n code will be returned, and the data array will be empty.\n\n It is easy to see that this protocol is prone to race conditions because the remote file can be modified\n between read operations which might result in the client obtaining a damaged file. To combat this,\n application designers are recommended to adhere to the following convention. Let every file whose integrity\n is of interest have a hash or a digital signature, which is stored in an adjacent file under the same name\n suffixed with the appropriate extension according to the type of hash or digital signature used.\n For example, let there be file \"image.bin\", integrity of which shall be ensured by the client upon downloading.\n Suppose that the file is hashed using SHA-256, so the appropriate file extension for the hash would be\n \".sha256\". Following this convention, the hash of \"image.bin\" would be stored in \"image.bin.sha256\".\n After downloading the file, the client would read the hash (being small, the hash can be read in a single\n request) and check it against a locally computed value. Some servers may opt to generate such hash files\n automatically as necessary; for example, if such file is requested but it does not exist, the server would\n compute the necessary signature or hash (the type of hash/signature can be deduced from the requested file\n extension) and return it as if the file existed. Obviously, this would be impractical for very large files;\n in that case, hash/signature should be pre-computed and stored in a real file. If this approach is followed,\n implementers are advised to use only SHA-256 for hashing, in order to reduce the number of fielded\n incompatible implementations."
5979 )]
5980 pub struct ReadRequest {
5981 pub offset: u64,
5987 pub path: crate::uavcan::file::path_2_0::Path,
5993 }
5994 impl ::canadensis_encoding::DataType for ReadRequest {
5995 const EXTENT_BYTES: Option<u32> = Some(300);
5997 }
5998 impl ::canadensis_encoding::Request for ReadRequest {}
5999 impl ReadRequest {}
6000 impl ::canadensis_encoding::Serialize for ReadRequest {
6001 fn size_bits(&self) -> usize {
6002 40 + (self.path).size_bits() + 0
6003 }
6004 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6005 cursor.write_u40(self.offset);
6006 cursor.write_composite(&self.path);
6007 }
6008 }
6009 impl ::canadensis_encoding::Deserialize for ReadRequest {
6010 fn deserialize(
6011 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6012 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6013 where
6014 Self: Sized,
6015 {
6016 Ok(ReadRequest {
6017 offset: { cursor.read_u40() as _ },
6018 path: { cursor.read_composite()? },
6019 })
6020 }
6021 }
6022
6023 pub struct ReadResponse {
6028 pub error: crate::uavcan::file::error_1_0::Error,
6034 pub data: crate::uavcan::primitive::unstructured_1_0::Unstructured,
6040 }
6041 impl ::canadensis_encoding::DataType for ReadResponse {
6042 const EXTENT_BYTES: Option<u32> = Some(300);
6044 }
6045 impl ::canadensis_encoding::Response for ReadResponse {}
6046 impl ReadResponse {}
6047 impl ::canadensis_encoding::Serialize for ReadResponse {
6048 fn size_bits(&self) -> usize {
6049 16 + (self.data).size_bits() + 0
6050 }
6051 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6052 cursor.write_composite(&self.error);
6053 cursor.write_composite(&self.data);
6054 }
6055 }
6056 impl ::canadensis_encoding::Deserialize for ReadResponse {
6057 fn deserialize(
6058 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6059 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6060 where
6061 Self: Sized,
6062 {
6063 Ok(ReadResponse {
6064 error: { cursor.read_composite()? },
6065 data: { cursor.read_composite()? },
6066 })
6067 }
6068 }
6069 }
6070 #[allow(deprecated)]
6071 #[cfg_attr(not(test), deprecated)]
6072 pub mod write_1_0 {
6073 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
6074 #[deprecated]
6075 pub const SERVICE: ::canadensis_core::ServiceId =
6076 ::canadensis_core::ServiceId::from_truncating(409);
6077
6078 #[cfg_attr(
6083 not(doctest),
6084 doc = " Write into a remote file.\n The server shall place the contents of the field 'data' into the file pointed by 'path' at the offset specified by\n the field 'offset'.\n\n When writing a file, the client should repeatedly call this service with data while advancing the offset until the\n file is written completely. When the write sequence is completed, the client shall call the service one last time,\n with the offset set to the size of the file and with the data field empty, which will signal the server that the\n transfer is finished.\n\n When the write operation is complete, the server shall truncate the resulting file past the specified offset."
6085 )]
6086 #[deprecated]
6087 pub struct WriteRequest {
6088 pub offset: u64,
6094 pub path: crate::uavcan::file::path_1_0::Path,
6100 #[cfg_attr(
6101 not(doctest),
6102 doc = " 192 = 128 + 64; the write protocol permits usage of smaller chunks."
6103 )]
6104 pub data: ::heapless::Vec<u8, 192>,
6110 }
6111 impl ::canadensis_encoding::DataType for WriteRequest {
6112 const EXTENT_BYTES: Option<u32> = Some(600);
6114 }
6115 impl ::canadensis_encoding::Request for WriteRequest {}
6116 impl WriteRequest {}
6117 impl ::canadensis_encoding::Serialize for WriteRequest {
6118 fn size_bits(&self) -> usize {
6119 40 + (self.path).size_bits() + 8 + (self.data).len() * 8 + 0
6120 }
6121 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6122 cursor.write_u40(self.offset);
6123 cursor.write_composite(&self.path);
6124 cursor.write_aligned_u8((self.data).len() as u8);
6125 cursor.write_bytes(&(self.data)[..]);
6126 }
6127 }
6128 impl ::canadensis_encoding::Deserialize for WriteRequest {
6129 fn deserialize(
6130 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6131 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6132 where
6133 Self: Sized,
6134 {
6135 Ok(WriteRequest {
6136 offset: { cursor.read_u40() as _ },
6137 path: { cursor.read_composite()? },
6138 data: {
6139 let length = cursor.read_u8() as _;
6140 if length <= 192 {
6141 let mut elements = ::heapless::Vec::new();
6142 for _ in 0..length {
6143 let _ = elements.push(cursor.read_u8() as _);
6144 }
6145 elements
6146 } else {
6147 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
6148 }
6149 },
6150 })
6151 }
6152 }
6153
6154 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
6159 #[repr(C, packed)]
6160 #[deprecated]
6161 pub struct WriteResponse {
6162 pub error: crate::uavcan::file::error_1_0::Error,
6168 }
6169 impl ::canadensis_encoding::DataType for WriteResponse {
6170 const EXTENT_BYTES: Option<u32> = Some(48);
6172 }
6173 impl ::canadensis_encoding::Response for WriteResponse {}
6174 impl WriteResponse {}
6175 impl ::canadensis_encoding::Serialize for WriteResponse {
6176 fn size_bits(&self) -> usize {
6177 16
6178 }
6179 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6180 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
6181 }
6182 }
6183 impl ::canadensis_encoding::Deserialize for WriteResponse {
6184 fn deserialize(
6185 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6186 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6187 where
6188 Self: Sized,
6189 {
6190 Ok(Self::deserialize_zero_copy(cursor))
6191 }
6192 }
6193 #[test]
6194 fn test_layout() {
6195 assert_eq!(::core::mem::size_of::<WriteResponse>() * 8, 16);
6196 assert_eq!(::core::mem::offset_of!(WriteResponse, error) * 8, 0);
6197 }
6198 }
6199 pub mod write_1_1 {
6200 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
6201 pub const SERVICE: ::canadensis_core::ServiceId =
6202 ::canadensis_core::ServiceId::from_truncating(409);
6203
6204 #[cfg_attr(
6209 not(doctest),
6210 doc = " Write into a remote file.\n The server shall place the contents of the field 'data' into the file pointed by 'path' at the offset specified by\n the field 'offset'.\n\n When writing a file, the client should repeatedly call this service with data while advancing the offset until the\n file is written completely. When the write sequence is completed, the client shall call the service one last time,\n with the offset set to the size of the file and with the data field empty, which will signal the server that the\n transfer is finished.\n\n When the write operation is complete, the server shall truncate the resulting file past the specified offset."
6211 )]
6212 pub struct WriteRequest {
6213 pub offset: u64,
6219 pub path: crate::uavcan::file::path_2_0::Path,
6225 pub data: crate::uavcan::primitive::unstructured_1_0::Unstructured,
6231 }
6232 impl ::canadensis_encoding::DataType for WriteRequest {
6233 const EXTENT_BYTES: Option<u32> = Some(600);
6235 }
6236 impl ::canadensis_encoding::Request for WriteRequest {}
6237 impl WriteRequest {}
6238 impl ::canadensis_encoding::Serialize for WriteRequest {
6239 fn size_bits(&self) -> usize {
6240 40 + (self.path).size_bits() + (self.data).size_bits() + 0
6241 }
6242 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6243 cursor.write_u40(self.offset);
6244 cursor.write_composite(&self.path);
6245 cursor.write_composite(&self.data);
6246 }
6247 }
6248 impl ::canadensis_encoding::Deserialize for WriteRequest {
6249 fn deserialize(
6250 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6251 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6252 where
6253 Self: Sized,
6254 {
6255 Ok(WriteRequest {
6256 offset: { cursor.read_u40() as _ },
6257 path: { cursor.read_composite()? },
6258 data: { cursor.read_composite()? },
6259 })
6260 }
6261 }
6262
6263 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
6268 #[repr(C, packed)]
6269 pub struct WriteResponse {
6270 pub error: crate::uavcan::file::error_1_0::Error,
6276 }
6277 impl ::canadensis_encoding::DataType for WriteResponse {
6278 const EXTENT_BYTES: Option<u32> = Some(48);
6280 }
6281 impl ::canadensis_encoding::Response for WriteResponse {}
6282 impl WriteResponse {}
6283 impl ::canadensis_encoding::Serialize for WriteResponse {
6284 fn size_bits(&self) -> usize {
6285 16
6286 }
6287 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6288 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
6289 }
6290 }
6291 impl ::canadensis_encoding::Deserialize for WriteResponse {
6292 fn deserialize(
6293 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6294 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6295 where
6296 Self: Sized,
6297 {
6298 Ok(Self::deserialize_zero_copy(cursor))
6299 }
6300 }
6301 #[test]
6302 fn test_layout() {
6303 assert_eq!(::core::mem::size_of::<WriteResponse>() * 8, 16);
6304 assert_eq!(::core::mem::offset_of!(WriteResponse, error) * 8, 0);
6305 }
6306 }
6307 }
6308 pub mod internet {
6309 pub mod udp {
6310 #[allow(deprecated)]
6311 #[cfg_attr(not(test), deprecated)]
6312 pub mod handle_incoming_packet_0_1 {
6313 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
6314 #[deprecated]
6315 pub const SERVICE: ::canadensis_core::ServiceId =
6316 ::canadensis_core::ServiceId::from_truncating(500);
6317
6318 #[cfg_attr(
6323 not(doctest),
6324 doc = " This message carries UDP packets sent from a remote host on the Internet or a LAN to a node on the local Cyphal bus.\n Please refer to the definition of the message type OutgoingPacket for a general overview of the packet forwarding\n logic.\n\n This data type has been made a service type rather than a message type in order to make its transfers addressable,\n allowing nodes to employ hardware acceptance filters for filtering out forwarded datagrams that are not addressed\n to them. Additionally, requiring the destination nodes to always respond upon reception of the forwarded datagram\n opens interesting opportunities for future extensions of the forwarding protocol. If the service invocation times\n out, the modem node is permitted to remove the corresponding entry from the NAT table immediately, not waiting\n for its TTL to expire.\n\n It should be noted that this data type definition intentionally leaves out the source address. This is done in\n order to simplify the implementation, reduce the bus traffic overhead, and because the nature of the\n communication patterns proposed by this set of messages does not provide a valid way to implement server hosts\n on the local Cyphal bus. It is assumed that local nodes can be only clients, and therefore, they will be able to\n determine the address of the sender simply by mapping the field session_id to their internally maintained states.\n Furthermore, it is uncertain what is the optimal way of representing the source address for\n client nodes: it is assumed that the local nodes will mostly use DNS names rather than IP addresses, so if there\n was a source address field, modem nodes would have to perform reverse mapping from the IP address they received\n the datagram from to the corresponding DNS name that was used by the local node with the outgoing message. This\n approach creates a number of troubling corner cases and adds a fair amount of hidden complexities to the\n implementation of modem nodes.\n\n It is recommended to perform service invocations at the same transfer priority level as was used for broadcasting\n the latest matching message of type OutgoingPacket. However, meeting this recommendation would require the modem\n node to implement additional logic, which may be undesirable. Therefore, implementers are free to deviate from\n this recommendation and resort to a fixed priority level instead. In the case of a fixed priority level, it is\n advised to use the lowest transfer priority level."
6325 )]
6326 #[deprecated]
6327 pub struct HandleIncomingPacketRequest {
6328 #[cfg_attr(
6329 not(doctest),
6330 doc = " This field shall contain the same value that was used by the local node when sending the corresponding outgoing\n packet using the message type OutgoingPacket. This value will be used by the local node to match the response\n with its local context."
6331 )]
6332 pub session_id: u16,
6338 #[cfg_attr(
6339 not(doctest),
6340 doc = " Effective payload. This data will be forwarded from the remote host verbatim.\n UDP packets that contain more than 508 bytes of payload may be dropped by some types of\n communication equipment. Refer to RFC 791 and 2460 for an in-depth review.\n Cyphal further limits the maximum packet size to reduce the memory and traffic burden on the nodes.\n Datagrams that exceed the capacity of this field should be discarded by the modem node."
6341 )]
6342 pub payload: ::heapless::Vec<u8, 309>,
6348 }
6349 impl ::canadensis_encoding::DataType for HandleIncomingPacketRequest {
6350 const EXTENT_BYTES: Option<u32> = Some(600);
6352 }
6353 impl ::canadensis_encoding::Request for HandleIncomingPacketRequest {}
6354 impl HandleIncomingPacketRequest {}
6355 impl ::canadensis_encoding::Serialize for HandleIncomingPacketRequest {
6356 fn size_bits(&self) -> usize {
6357 16 + 16 + (self.payload).len() * 8 + 0
6358 }
6359 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6360 cursor.write_aligned_u16(self.session_id);
6361 cursor.write_aligned_u16((self.payload).len() as u16);
6362 cursor.write_bytes(&(self.payload)[..]);
6363 }
6364 }
6365 impl ::canadensis_encoding::Deserialize for HandleIncomingPacketRequest {
6366 fn deserialize(
6367 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6368 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6369 where
6370 Self: Sized,
6371 {
6372 Ok(HandleIncomingPacketRequest {
6373 session_id: { cursor.read_u16() as _ },
6374 payload: {
6375 let length = cursor.read_u16() as _;
6376 if length <= 309 {
6377 let mut elements = ::heapless::Vec::new();
6378 for _ in 0..length {
6379 let _ = elements.push(cursor.read_u8() as _);
6380 }
6381 elements
6382 } else {
6383 return Err(
6384 ::canadensis_encoding::DeserializeError::ArrayLength,
6385 );
6386 }
6387 },
6388 })
6389 }
6390 }
6391
6392 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
6397 #[repr(C, packed)]
6398 #[deprecated]
6399 pub struct HandleIncomingPacketResponse {}
6400 impl ::canadensis_encoding::DataType for HandleIncomingPacketResponse {
6401 const EXTENT_BYTES: Option<u32> = Some(63);
6403 }
6404 impl ::canadensis_encoding::Response for HandleIncomingPacketResponse {}
6405 impl HandleIncomingPacketResponse {}
6406 impl ::canadensis_encoding::Serialize for HandleIncomingPacketResponse {
6407 fn size_bits(&self) -> usize {
6408 0
6409 }
6410 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6411 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
6412 }
6413 }
6414 impl ::canadensis_encoding::Deserialize for HandleIncomingPacketResponse {
6415 fn deserialize(
6416 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6417 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6418 where
6419 Self: Sized,
6420 {
6421 Ok(Self::deserialize_zero_copy(cursor))
6422 }
6423 }
6424 #[test]
6425 fn test_layout() {
6426 assert_eq!(
6427 ::core::mem::size_of::<HandleIncomingPacketResponse>() * 8,
6428 0
6429 );
6430 }
6431 }
6432 pub mod handle_incoming_packet_0_2 {
6433 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
6434 pub const SERVICE: ::canadensis_core::ServiceId =
6435 ::canadensis_core::ServiceId::from_truncating(500);
6436
6437 #[cfg_attr(
6442 not(doctest),
6443 doc = " This message carries UDP packets sent from a remote host on the Internet or a LAN to a node on the local Cyphal bus.\n Please refer to the definition of the message type OutgoingPacket for a general overview of the packet forwarding\n logic.\n\n This data type has been made a service type rather than a message type in order to make its transfers addressable,\n allowing nodes to employ hardware acceptance filters for filtering out forwarded datagrams that are not addressed\n to them. Additionally, requiring the destination nodes to always respond upon reception of the forwarded datagram\n opens interesting opportunities for future extensions of the forwarding protocol. If the service invocation times\n out, the modem node is permitted to remove the corresponding entry from the NAT table immediately, not waiting\n for its TTL to expire.\n\n It should be noted that this data type definition intentionally leaves out the source address. This is done in\n order to simplify the implementation, reduce the bus traffic overhead, and because the nature of the\n communication patterns proposed by this set of messages does not provide a valid way to implement server hosts\n on the local Cyphal bus. It is assumed that local nodes can be only clients, and therefore, they will be able to\n determine the address of the sender simply by mapping the field session_id to their internally maintained states.\n Furthermore, it is uncertain what is the optimal way of representing the source address for\n client nodes: it is assumed that the local nodes will mostly use DNS names rather than IP addresses, so if there\n was a source address field, modem nodes would have to perform reverse mapping from the IP address they received\n the datagram from to the corresponding DNS name that was used by the local node with the outgoing message. This\n approach creates a number of troubling corner cases and adds a fair amount of hidden complexities to the\n implementation of modem nodes.\n\n It is recommended to perform service invocations at the same transfer priority level as was used for broadcasting\n the latest matching message of type OutgoingPacket. However, meeting this recommendation would require the modem\n node to implement additional logic, which may be undesirable. Therefore, implementers are free to deviate from\n this recommendation and resort to a fixed priority level instead. In the case of a fixed priority level, it is\n advised to use the lowest transfer priority level."
6444 )]
6445 pub struct HandleIncomingPacketRequest {
6446 #[cfg_attr(
6447 not(doctest),
6448 doc = " This field shall contain the same value that was used by the local node when sending the corresponding outgoing\n packet using the message type OutgoingPacket. This value will be used by the local node to match the response\n with its local context."
6449 )]
6450 pub session_id: u16,
6456 #[cfg_attr(
6457 not(doctest),
6458 doc = " Effective payload. This data will be forwarded from the remote host verbatim.\n UDP packets that contain more than 508 bytes of payload may be dropped by some types of\n communication equipment. Refer to RFC 791 and 2460 for an in-depth review.\n Datagrams that exceed the capacity of this field should be discarded by the modem node."
6459 )]
6460 pub payload: ::heapless::Vec<u8, 508>,
6466 }
6467 impl ::canadensis_encoding::DataType for HandleIncomingPacketRequest {
6468 const EXTENT_BYTES: Option<u32> = Some(600);
6470 }
6471 impl ::canadensis_encoding::Request for HandleIncomingPacketRequest {}
6472 impl HandleIncomingPacketRequest {}
6473 impl ::canadensis_encoding::Serialize for HandleIncomingPacketRequest {
6474 fn size_bits(&self) -> usize {
6475 16 + 16 + (self.payload).len() * 8 + 0
6476 }
6477 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6478 cursor.write_aligned_u16(self.session_id);
6479 cursor.write_aligned_u16((self.payload).len() as u16);
6480 cursor.write_bytes(&(self.payload)[..]);
6481 }
6482 }
6483 impl ::canadensis_encoding::Deserialize for HandleIncomingPacketRequest {
6484 fn deserialize(
6485 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6486 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6487 where
6488 Self: Sized,
6489 {
6490 Ok(HandleIncomingPacketRequest {
6491 session_id: { cursor.read_u16() as _ },
6492 payload: {
6493 let length = cursor.read_u16() as _;
6494 if length <= 508 {
6495 let mut elements = ::heapless::Vec::new();
6496 for _ in 0..length {
6497 let _ = elements.push(cursor.read_u8() as _);
6498 }
6499 elements
6500 } else {
6501 return Err(
6502 ::canadensis_encoding::DeserializeError::ArrayLength,
6503 );
6504 }
6505 },
6506 })
6507 }
6508 }
6509
6510 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
6515 #[repr(C, packed)]
6516 pub struct HandleIncomingPacketResponse {}
6517 impl ::canadensis_encoding::DataType for HandleIncomingPacketResponse {
6518 const EXTENT_BYTES: Option<u32> = Some(63);
6520 }
6521 impl ::canadensis_encoding::Response for HandleIncomingPacketResponse {}
6522 impl HandleIncomingPacketResponse {}
6523 impl ::canadensis_encoding::Serialize for HandleIncomingPacketResponse {
6524 fn size_bits(&self) -> usize {
6525 0
6526 }
6527 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6528 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
6529 }
6530 }
6531 impl ::canadensis_encoding::Deserialize for HandleIncomingPacketResponse {
6532 fn deserialize(
6533 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6534 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6535 where
6536 Self: Sized,
6537 {
6538 Ok(Self::deserialize_zero_copy(cursor))
6539 }
6540 }
6541 #[test]
6542 fn test_layout() {
6543 assert_eq!(
6544 ::core::mem::size_of::<HandleIncomingPacketResponse>() * 8,
6545 0
6546 );
6547 }
6548 }
6549 #[allow(deprecated)]
6550 #[cfg_attr(not(test), deprecated)]
6551 pub mod outgoing_packet_0_1 {
6552 #[cfg_attr(not(doctest), doc = "The fixed subject ID for this message type")]
6553 #[deprecated]
6554 pub const SUBJECT: ::canadensis_core::SubjectId =
6555 ::canadensis_core::SubjectId::from_truncating(8174);
6556
6557 #[cfg_attr(
6562 not(doctest),
6563 doc = " This message carries UDP packets from a node on the local bus to a remote host on the Internet or a LAN.\n\n Any node can broadcast a message of this type.\n\n All nodes that are capable of communication with the Internet or a LAN should subscribe to messages\n of this type and forward the payload to the indicated host and port using exactly one UDP datagram\n per message (i.e. additional fragmentation is to be avoided). Such nodes will be referred to as\n \"modem nodes\".\n\n It is expected that some systems will have more than one modem node available.\n Each modem node is supposed to forward every message it sees, which will naturally create\n some degree of modular redundancy and fault tolerance. The remote host should therefore be able to\n properly handle possibly duplicated messages from different source addresses, in addition to\n possible duplications introduced by the UDP/IP protocol itself. There are at least two obvious\n strategies that can be employed by the remote host:\n\n - Accept only the first message, ignore duplicates. This approach requires that the UDP stream\n should contain some metadata necessary for the remote host to determine the source and ordering\n of each received datum. This approach works best for periodic data, such as telemetry, where\n the sender does not expect any responses.\n\n - Process all messages, including duplicates. This approach assumes that the remote host acts\n as a server, processing all received requests and providing responses to each. This arrangement\n implies that the client may receive duplicated responses. It is therefore the client's\n responsibility to resolve the possible ambiguity. An obvious solution is to accept the first\n arrived response and ignore the later ones.\n\n Applications are free to choose whatever redundancy management strategy works best for them.\n\n If the source node expects that the remote host will send some data back, it shall explicitly notify\n the modem nodes about this, so that they could prepare to perform reverse forwarding when the\n expected data arrives from the remote host. The technique of reverse forwarding is known in\n networking as IP Masquerading, or (in general) Network Address Translation (NAT). The notification\n is performed by means of setting one of the corresponding flags defined below.\n\n In order to be able to match datagrams received from remote hosts and the local nodes they should\n be forwarded to, modem nodes are required to keep certain metadata about outgoing datagrams. Such\n metadata is stored in a data structure referred to as \"NAT table\", where every entry would normally\n contain at least the following fields:\n - The local UDP port number that was used to send the outgoing datagram from.\n Per RFC 4787, the port number is chosen by the modem node automatically.\n - The node-ID of the local node that has sent the outgoing datagram.\n - Value of the field session_id defined below.\n - Possibly some other data, depending on the implementation.\n\n The modem nodes are required to keep each NAT table entry for at least NAT_ENTRY_MIN_TTL seconds\n since the last reverse forwarding action was performed. Should the memory resources of the modem node\n be exhausted, it is allowed to remove old NAT entries earlier, following the policy of least recent use.\n\n Having received a UDP packet from a remote host, the modem node would check the NAT table in order\n to determine where on the Cyphal bus the received data should be forwarded to. If the NAT table\n contains no matches, the received data should be silently dropped. If a match is found, the\n modem node will forward the data to the recipient node using the service HandleIncomingPacket.\n If the service invocation times out, the modem node is permitted to remove the corresponding entry from\n the NAT table immediately (but it is not required). This will ensure that the modem nodes will not be\n tasked with translations for client nodes that are no longer online or are unreachable.\n Additionally, client nodes will be able to hint the modem nodes to remove translation entries they no\n longer need by simply refusing to respond to the corresponding service invocation. Please refer to\n the definition of that service data type for a more in-depth review of the reverse forwarding process.\n\n Modem nodes can also perform traffic shaping, if needed, by means of delaying or dropping UDP\n datagrams that exceed the quota.\n\n To summarize, a typical data exchange occurrence should amount to the following actions:\n\n - A local Cyphal node broadcasts a message of type OutgoingPacket with the payload it needs\n to forward. If the node expects the remote host to send any data back, it sets the masquerading flag.\n\n - Every modem node on the bus receives the message and performs the following actions:\n\n - The domain name is resolved, unless the destination address provided in the message\n is already an IP address, in which case this step should be skipped.\n\n - The domain name to IP address mapping is added to the local DNS cache, although this\n part is entirely implementation defined and is not required.\n\n - The masquerading flag is checked. If it is set, a new entry is added to the NAT table.\n If such entry already existed, its expiration timeout is reset. If no such entry existed\n and a new one cannot be added because of memory limitations, the least recently used\n (i.e. oldest) entry of the NAT table is replaced with the new one.\n\n - The payload is forwarded to the determined IP address.\n\n - At this point, direct forwarding is complete. Should any of the modem nodes receive an incoming\n packet, they would attempt to perform a reverse forwarding according to the above provided algorithm.\n\n It is recommended to use the lowest transport priority level when broadcasting messages of this type,\n in order to avoid interference with a real-time traffic on the bus. Usage of higher priority levels is\n unlikely to be practical because the latency and throughput limitations introduced by the on-board radio\n communication equipment are likely to vastly exceed those of the local CAN bus."
6564 )]
6565 #[deprecated]
6566 pub struct OutgoingPacket {
6567 #[cfg_attr(
6568 not(doctest),
6569 doc = " This field is set to an arbitrary value by the transmitting node in order to be able to match the response\n with the locally kept context. The function of this field is virtually identical to that of UDP/IP port\n numbers. This value can be set to zero safely if the sending node does not have multiple contexts to\n distinguish between."
6570 )]
6571 pub session_id: u16,
6577 #[cfg_attr(not(doctest), doc = " UDP destination port number.")]
6578 pub destination_port: u16,
6584 #[cfg_attr(
6585 not(doctest),
6586 doc = " Domain name or IP address where the payload should be forwarded to.\n Note that broadcast addresses are allowed here, for example, 255.255.255.255.\n Broadcasting with masquerading enabled works the same way as unicasting with masquerading enabled: the modem\n node should take care to channel all traffic arriving at the opened port from any source to the node that\n requested masquerading.\n The full domain name length may not exceed 253 octets, according to the DNS specification.\n Cyphal imposes a stricter length limit in order to reduce the memory and traffic burden on the bus: 45 characters.\n 45 characters is the amount of space that is required to represent the longest possible form of an IPv6 address\n (an IPv4-mapped IPv6 address). Examples:\n \"forum.opencyphal.org\" - domain name\n \"192.168.1.1\" - IPv4 address\n \"2001:0db8:85a3:0000:0000:8a2e:0370:7334\" - IPv6 address, full form\n \"2001:db8:85a3::8a2e:370:7334\" - IPv6 address, same as above, short form (preferred)\n \"ABCD:ABCD:ABCD:ABCD:ABCD:ABCD:192.168.158.190\" - IPv4-mapped IPv6, full form (length limit, 45 characters)"
6587 )]
6588 pub destination_address: ::heapless::Vec<u8, 45>,
6594 #[cfg_attr(
6595 not(doctest),
6596 doc = " Expect data back (i.e., instruct the modem to use the NAT table)."
6597 )]
6598 pub use_masquerading: bool,
6604 #[cfg_attr(
6605 not(doctest),
6606 doc = " Use Datagram Transport Layer Security. Drop the packet if DTLS is not supported.\n Option flags."
6607 )]
6608 pub use_dtls: bool,
6614 #[cfg_attr(
6616 not(doctest),
6617 doc = " Effective payload. This data will be forwarded to the remote host verbatim.\n UDP packets that contain more than 508 bytes of payload may be dropped by some types of\n communication equipment. Refer to RFC 791 and 2460 for an in-depth review.\n Cyphal further limits the maximum packet size to reduce the memory and traffic burden on the nodes."
6618 )]
6619 pub payload: ::heapless::Vec<u8, 260>,
6625 }
6626 impl ::canadensis_encoding::DataType for OutgoingPacket {
6627 const EXTENT_BYTES: Option<u32> = Some(600);
6629 }
6630 impl ::canadensis_encoding::Message for OutgoingPacket {}
6631 impl OutgoingPacket {
6632 #[cfg_attr(
6633 not(doctest),
6634 doc = " [second]\n Modem nodes are required to keep the NAT table entries alive for at least this amount of time, unless the\n table is overflowed, in which case they are allowed to remove least recently used entries in favor of\n newer ones. Modem nodes are required to be able to accommodate at least 100 entries in the NAT table."
6635 )]
6636 pub const NAT_ENTRY_MIN_TTL: u32 = 86400;
6637 }
6638 impl ::canadensis_encoding::Serialize for OutgoingPacket {
6639 fn size_bits(&self) -> usize {
6640 16 + 16
6641 + 8
6642 + (self.destination_address).len() * 8
6643 + 1
6644 + 1
6645 + 6
6646 + 16
6647 + (self.payload).len() * 8
6648 + 0
6649 }
6650 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6651 cursor.write_aligned_u16(self.session_id);
6652 cursor.write_aligned_u16(self.destination_port);
6653 cursor.write_aligned_u8((self.destination_address).len() as u8);
6654 cursor.write_bytes(&(self.destination_address)[..]);
6655 cursor.write_bool(self.use_masquerading);
6656 cursor.write_bool(self.use_dtls);
6657 cursor.skip_6();
6658 cursor.write_aligned_u16((self.payload).len() as u16);
6659 cursor.write_bytes(&(self.payload)[..]);
6660 }
6661 }
6662 impl ::canadensis_encoding::Deserialize for OutgoingPacket {
6663 fn deserialize(
6664 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6665 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6666 where
6667 Self: Sized,
6668 {
6669 Ok(OutgoingPacket {
6670 session_id: { cursor.read_u16() as _ },
6671 destination_port: { cursor.read_u16() as _ },
6672 destination_address: {
6673 let length = cursor.read_u8() as _;
6674 if length <= 45 {
6675 let mut elements = ::heapless::Vec::new();
6676 for _ in 0..length {
6677 let _ = elements.push(cursor.read_u8() as _);
6678 }
6679 elements
6680 } else {
6681 return Err(
6682 ::canadensis_encoding::DeserializeError::ArrayLength,
6683 );
6684 }
6685 },
6686 use_masquerading: { cursor.read_bool() },
6687 use_dtls: { cursor.read_bool() },
6688 payload: {
6689 cursor.skip_6();
6690 let length = cursor.read_u16() as _;
6691 if length <= 260 {
6692 let mut elements = ::heapless::Vec::new();
6693 for _ in 0..length {
6694 let _ = elements.push(cursor.read_u8() as _);
6695 }
6696 elements
6697 } else {
6698 return Err(
6699 ::canadensis_encoding::DeserializeError::ArrayLength,
6700 );
6701 }
6702 },
6703 })
6704 }
6705 }
6706 }
6707 pub mod outgoing_packet_0_2 {
6708 #[cfg_attr(not(doctest), doc = "The fixed subject ID for this message type")]
6709 pub const SUBJECT: ::canadensis_core::SubjectId =
6710 ::canadensis_core::SubjectId::from_truncating(8174);
6711
6712 #[cfg_attr(
6717 not(doctest),
6718 doc = " This message carries UDP packets from a node on the local bus to a remote host on the Internet or a LAN.\n\n Any node can broadcast a message of this type.\n\n All nodes that are capable of communication with the Internet or a LAN should subscribe to messages\n of this type and forward the payload to the indicated host and port using exactly one UDP datagram\n per message (i.e. additional fragmentation is to be avoided). Such nodes will be referred to as\n \"modem nodes\".\n\n It is expected that some systems will have more than one modem node available.\n Each modem node is supposed to forward every message it sees, which will naturally create\n some degree of modular redundancy and fault tolerance. The remote host should therefore be able to\n properly handle possibly duplicated messages from different source addresses, in addition to\n possible duplications introduced by the UDP/IP protocol itself. There are at least two obvious\n strategies that can be employed by the remote host:\n\n - Accept only the first message, ignore duplicates. This approach requires that the UDP stream\n should contain some metadata necessary for the remote host to determine the source and ordering\n of each received datum. This approach works best for periodic data, such as telemetry, where\n the sender does not expect any responses.\n\n - Process all messages, including duplicates. This approach assumes that the remote host acts\n as a server, processing all received requests and providing responses to each. This arrangement\n implies that the client may receive duplicated responses. It is therefore the client's\n responsibility to resolve the possible ambiguity. An obvious solution is to accept the first\n arrived response and ignore the later ones.\n\n Applications are free to choose whatever redundancy management strategy works best for them.\n\n If the source node expects that the remote host will send some data back, it shall explicitly notify\n the modem nodes about this, so that they could prepare to perform reverse forwarding when the\n expected data arrives from the remote host. The technique of reverse forwarding is known in\n networking as IP Masquerading, or (in general) Network Address Translation (NAT). The notification\n is performed by means of setting one of the corresponding flags defined below.\n\n In order to be able to match datagrams received from remote hosts and the local nodes they should\n be forwarded to, modem nodes are required to keep certain metadata about outgoing datagrams. Such\n metadata is stored in a data structure referred to as \"NAT table\", where every entry would normally\n contain at least the following fields:\n - The local UDP port number that was used to send the outgoing datagram from.\n Per RFC 4787, the port number is chosen by the modem node automatically.\n - The node-ID of the local node that has sent the outgoing datagram.\n - Value of the field session_id defined below.\n - Possibly some other data, depending on the implementation.\n\n The modem nodes are required to keep each NAT table entry for at least NAT_ENTRY_MIN_TTL seconds\n since the last reverse forwarding action was performed. Should the memory resources of the modem node\n be exhausted, it is allowed to remove old NAT entries earlier, following the policy of least recent use.\n\n Having received a UDP packet from a remote host, the modem node would check the NAT table in order\n to determine where on the Cyphal bus the received data should be forwarded to. If the NAT table\n contains no matches, the received data should be silently dropped. If a match is found, the\n modem node will forward the data to the recipient node using the service HandleIncomingPacket.\n If the service invocation times out, the modem node is permitted to remove the corresponding entry from\n the NAT table immediately (but it is not required). This will ensure that the modem nodes will not be\n tasked with translations for client nodes that are no longer online or are unreachable.\n Additionally, client nodes will be able to hint the modem nodes to remove translation entries they no\n longer need by simply refusing to respond to the corresponding service invocation. Please refer to\n the definition of that service data type for a more in-depth review of the reverse forwarding process.\n\n Modem nodes can also perform traffic shaping, if needed, by means of delaying or dropping UDP\n datagrams that exceed the quota.\n\n To summarize, a typical data exchange occurrence should amount to the following actions:\n\n - A local Cyphal node broadcasts a message of type OutgoingPacket with the payload it needs\n to forward. If the node expects the remote host to send any data back, it sets the masquerading flag.\n\n - Every modem node on the bus receives the message and performs the following actions:\n\n - The domain name is resolved, unless the destination address provided in the message\n is already an IP address, in which case this step should be skipped.\n\n - The domain name to IP address mapping is added to the local DNS cache, although this\n part is entirely implementation defined and is not required.\n\n - The masquerading flag is checked. If it is set, a new entry is added to the NAT table.\n If such entry already existed, its expiration timeout is reset. If no such entry existed\n and a new one cannot be added because of memory limitations, the least recently used\n (i.e. oldest) entry of the NAT table is replaced with the new one.\n\n - The payload is forwarded to the determined IP address.\n\n - At this point, direct forwarding is complete. Should any of the modem nodes receive an incoming\n packet, they would attempt to perform a reverse forwarding according to the above provided algorithm.\n\n It is recommended to use the lowest transport priority level when broadcasting messages of this type,\n in order to avoid interference with a real-time traffic on the bus. Usage of higher priority levels is\n unlikely to be practical because the latency and throughput limitations introduced by the on-board radio\n communication equipment are likely to vastly exceed those of the local CAN bus."
6719 )]
6720 pub struct OutgoingPacket {
6721 #[cfg_attr(
6722 not(doctest),
6723 doc = " This field is set to an arbitrary value by the transmitting node in order to be able to match the response\n with the locally kept context. The function of this field is virtually identical to that of UDP/IP port\n numbers. This value can be set to zero safely if the sending node does not have multiple contexts to\n distinguish between."
6724 )]
6725 pub session_id: u16,
6731 #[cfg_attr(not(doctest), doc = " UDP destination port number.")]
6732 pub destination_port: u16,
6738 #[cfg_attr(
6739 not(doctest),
6740 doc = " Domain name or IP address where the payload should be forwarded to.\n Note that broadcast addresses are allowed here, for example, 255.255.255.255.\n Broadcasting with masquerading enabled works the same way as unicasting with masquerading enabled: the modem\n node should take care to channel all traffic arriving at the opened port from any source to the node that\n requested masquerading.\n The full domain name length may not exceed 253 octets, according to the DNS specification.\n Cyphal imposes a stricter length limit in order to reduce the memory and traffic burden on the bus: 45 characters.\n 45 characters is the amount of space that is required to represent the longest possible form of an IPv6 address\n (an IPv4-mapped IPv6 address). Examples:\n \"forum.opencyphal.org\" - domain name\n \"192.168.1.1\" - IPv4 address\n \"2001:0db8:85a3:0000:0000:8a2e:0370:7334\" - IPv6 address, full form\n \"2001:db8:85a3::8a2e:370:7334\" - IPv6 address, same as above, short form (preferred)\n \"ABCD:ABCD:ABCD:ABCD:ABCD:ABCD:192.168.158.190\" - IPv4-mapped IPv6, full form (length limit, 45 characters)"
6741 )]
6742 pub destination_address: ::heapless::Vec<u8, 45>,
6748 #[cfg_attr(
6749 not(doctest),
6750 doc = " Expect data back (i.e., instruct the modem to use the NAT table)."
6751 )]
6752 pub use_masquerading: bool,
6758 #[cfg_attr(
6759 not(doctest),
6760 doc = " Use Datagram Transport Layer Security. Drop the packet if DTLS is not supported.\n Option flags."
6761 )]
6762 pub use_dtls: bool,
6768 #[cfg_attr(
6770 not(doctest),
6771 doc = " Effective payload. This data will be forwarded to the remote host verbatim.\n UDP packets that contain more than 508 bytes of payload may be dropped by some types of\n communication equipment. Refer to RFC 791 and 2460 for an in-depth review."
6772 )]
6773 pub payload: ::heapless::Vec<u8, 508>,
6779 }
6780 impl ::canadensis_encoding::DataType for OutgoingPacket {
6781 const EXTENT_BYTES: Option<u32> = Some(600);
6783 }
6784 impl ::canadensis_encoding::Message for OutgoingPacket {}
6785 impl OutgoingPacket {
6786 #[cfg_attr(
6787 not(doctest),
6788 doc = " [second]\n Modem nodes are required to keep the NAT table entries alive for at least this amount of time, unless the\n table is overflowed, in which case they are allowed to remove least recently used entries in favor of\n newer ones. Modem nodes are required to be able to accommodate at least 100 entries in the NAT table."
6789 )]
6790 pub const NAT_ENTRY_MIN_TTL: u32 = 86400;
6791 }
6792 impl ::canadensis_encoding::Serialize for OutgoingPacket {
6793 fn size_bits(&self) -> usize {
6794 16 + 16
6795 + 8
6796 + (self.destination_address).len() * 8
6797 + 1
6798 + 1
6799 + 6
6800 + 16
6801 + (self.payload).len() * 8
6802 + 0
6803 }
6804 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6805 cursor.write_aligned_u16(self.session_id);
6806 cursor.write_aligned_u16(self.destination_port);
6807 cursor.write_aligned_u8((self.destination_address).len() as u8);
6808 cursor.write_bytes(&(self.destination_address)[..]);
6809 cursor.write_bool(self.use_masquerading);
6810 cursor.write_bool(self.use_dtls);
6811 cursor.skip_6();
6812 cursor.write_aligned_u16((self.payload).len() as u16);
6813 cursor.write_bytes(&(self.payload)[..]);
6814 }
6815 }
6816 impl ::canadensis_encoding::Deserialize for OutgoingPacket {
6817 fn deserialize(
6818 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6819 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6820 where
6821 Self: Sized,
6822 {
6823 Ok(OutgoingPacket {
6824 session_id: { cursor.read_u16() as _ },
6825 destination_port: { cursor.read_u16() as _ },
6826 destination_address: {
6827 let length = cursor.read_u8() as _;
6828 if length <= 45 {
6829 let mut elements = ::heapless::Vec::new();
6830 for _ in 0..length {
6831 let _ = elements.push(cursor.read_u8() as _);
6832 }
6833 elements
6834 } else {
6835 return Err(
6836 ::canadensis_encoding::DeserializeError::ArrayLength,
6837 );
6838 }
6839 },
6840 use_masquerading: { cursor.read_bool() },
6841 use_dtls: { cursor.read_bool() },
6842 payload: {
6843 cursor.skip_6();
6844 let length = cursor.read_u16() as _;
6845 if length <= 508 {
6846 let mut elements = ::heapless::Vec::new();
6847 for _ in 0..length {
6848 let _ = elements.push(cursor.read_u8() as _);
6849 }
6850 elements
6851 } else {
6852 return Err(
6853 ::canadensis_encoding::DeserializeError::ArrayLength,
6854 );
6855 }
6856 },
6857 })
6858 }
6859 }
6860 }
6861 }
6862 }
6863 pub mod metatransport {
6864 pub mod can {
6865 pub mod arbitration_id_0_1 {
6866 #[cfg_attr(not(doctest), doc = " CAN frame arbitration field.")]
6871 pub enum ArbitrationID {
6872 Base
6875(crate::uavcan::metatransport::can::base_arbitration_id_0_1::BaseArbitrationID)
6876,Extended
6879(crate::uavcan::metatransport::can::extended_arbitration_id_0_1::ExtendedArbitrationID)
6880,}
6881 impl ::canadensis_encoding::DataType for ArbitrationID {
6882 const EXTENT_BYTES: Option<u32> = None;
6884 }
6885 impl ::canadensis_encoding::Message for ArbitrationID {}
6886 impl ArbitrationID {}
6887 impl ::canadensis_encoding::Serialize for ArbitrationID {
6888 fn size_bits(&self) -> usize {
6889 40
6890 }
6891 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6892 match self {
6893 ArbitrationID::Base(inner) => {
6894 cursor.write_aligned_u8(0);
6895 cursor.write_composite(inner);
6896 }
6897 ArbitrationID::Extended(inner) => {
6898 cursor.write_aligned_u8(1);
6899 cursor.write_composite(inner);
6900 }
6901 }
6902 }
6903 }
6904 impl ::canadensis_encoding::Deserialize for ArbitrationID {
6905 fn deserialize(
6906 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6907 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6908 where
6909 Self: Sized,
6910 {
6911 match cursor.read_aligned_u8() as _ {
6912 0 => Ok(ArbitrationID::Base({ cursor.read_composite()? })),
6913 1 => Ok(ArbitrationID::Extended({ cursor.read_composite()? })),
6914 _ => Err(::canadensis_encoding::DeserializeError::UnionTag),
6915 }
6916 }
6917 }
6918 }
6919 pub mod base_arbitration_id_0_1 {
6920 #[cfg_attr(not(doctest), doc = " 11-bit identifier.")]
6925 pub struct BaseArbitrationID {
6926 pub value: u16,
6932 }
6934 impl ::canadensis_encoding::DataType for BaseArbitrationID {
6935 const EXTENT_BYTES: Option<u32> = None;
6937 }
6938 impl ::canadensis_encoding::Message for BaseArbitrationID {}
6939 impl BaseArbitrationID {}
6940 impl ::canadensis_encoding::Serialize for BaseArbitrationID {
6941 fn size_bits(&self) -> usize {
6942 32
6943 }
6944 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6945 cursor.write_u11(self.value);
6946 cursor.skip_21();
6947 }
6948 }
6949 impl ::canadensis_encoding::Deserialize for BaseArbitrationID {
6950 fn deserialize(
6951 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
6952 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
6953 where
6954 Self: Sized,
6955 {
6956 Ok(BaseArbitrationID {
6957 value: { cursor.read_u11() as _ },
6958 })
6959 }
6960 }
6961 }
6962 pub mod data_classic_0_1 {
6963 #[cfg_attr(not(doctest), doc = " Classic data frame payload.")]
6968 pub struct DataClassic {
6969 pub arbitration_id:
6975 crate::uavcan::metatransport::can::arbitration_id_0_1::ArbitrationID,
6976 pub data: ::heapless::Vec<u8, 8>,
6982 }
6983 impl ::canadensis_encoding::DataType for DataClassic {
6984 const EXTENT_BYTES: Option<u32> = None;
6986 }
6987 impl ::canadensis_encoding::Message for DataClassic {}
6988 impl DataClassic {}
6989 impl ::canadensis_encoding::Serialize for DataClassic {
6990 fn size_bits(&self) -> usize {
6991 40 + 8 + (self.data).len() * 8 + 0
6992 }
6993 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
6994 cursor.write_composite(&self.arbitration_id);
6995 cursor.write_aligned_u8((self.data).len() as u8);
6996 cursor.write_bytes(&(self.data)[..]);
6997 }
6998 }
6999 impl ::canadensis_encoding::Deserialize for DataClassic {
7000 fn deserialize(
7001 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7002 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7003 where
7004 Self: Sized,
7005 {
7006 Ok(DataClassic {
7007 arbitration_id: { cursor.read_composite()? },
7008 data: {
7009 let length = cursor.read_u8() as _;
7010 if length <= 8 {
7011 let mut elements = ::heapless::Vec::new();
7012 for _ in 0..length {
7013 let _ = elements.push(cursor.read_u8() as _);
7014 }
7015 elements
7016 } else {
7017 return Err(
7018 ::canadensis_encoding::DeserializeError::ArrayLength,
7019 );
7020 }
7021 },
7022 })
7023 }
7024 }
7025 }
7026 pub mod data_fd_0_1 {
7027 #[cfg_attr(not(doctest), doc = " CAN FD data frame payload.")]
7032 pub struct DataFD {
7033 pub arbitration_id:
7039 crate::uavcan::metatransport::can::arbitration_id_0_1::ArbitrationID,
7040 pub data: ::heapless::Vec<u8, 64>,
7046 }
7047 impl ::canadensis_encoding::DataType for DataFD {
7048 const EXTENT_BYTES: Option<u32> = None;
7050 }
7051 impl ::canadensis_encoding::Message for DataFD {}
7052 impl DataFD {}
7053 impl ::canadensis_encoding::Serialize for DataFD {
7054 fn size_bits(&self) -> usize {
7055 40 + 8 + (self.data).len() * 8 + 0
7056 }
7057 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
7058 cursor.write_composite(&self.arbitration_id);
7059 cursor.write_aligned_u8((self.data).len() as u8);
7060 cursor.write_bytes(&(self.data)[..]);
7061 }
7062 }
7063 impl ::canadensis_encoding::Deserialize for DataFD {
7064 fn deserialize(
7065 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7066 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7067 where
7068 Self: Sized,
7069 {
7070 Ok(DataFD {
7071 arbitration_id: { cursor.read_composite()? },
7072 data: {
7073 let length = cursor.read_u8() as _;
7074 if length <= 64 {
7075 let mut elements = ::heapless::Vec::new();
7076 for _ in 0..length {
7077 let _ = elements.push(cursor.read_u8() as _);
7078 }
7079 elements
7080 } else {
7081 return Err(
7082 ::canadensis_encoding::DeserializeError::ArrayLength,
7083 );
7084 }
7085 },
7086 })
7087 }
7088 }
7089 }
7090 pub mod error_0_1 {
7091 #[cfg_attr(
7096 not(doctest),
7097 doc = " CAN bus error report: either an intentionally generated error frame or a disturbance."
7098 )]
7099 pub struct Error {
7100 }
7102 impl ::canadensis_encoding::DataType for Error {
7103 const EXTENT_BYTES: Option<u32> = None;
7105 }
7106 impl ::canadensis_encoding::Message for Error {}
7107 impl Error {}
7108 impl ::canadensis_encoding::Serialize for Error {
7109 fn size_bits(&self) -> usize {
7110 32
7111 }
7112 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
7113 cursor.skip_32();
7114 }
7115 }
7116 impl ::canadensis_encoding::Deserialize for Error {
7117 fn deserialize(
7118 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7119 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7120 where
7121 Self: Sized,
7122 {
7123 Ok(Error {})
7124 }
7125 }
7126 }
7127 pub mod extended_arbitration_id_0_1 {
7128 #[cfg_attr(not(doctest), doc = " 29-bit identifier.")]
7133 pub struct ExtendedArbitrationID {
7134 pub value: u32,
7140 }
7142 impl ::canadensis_encoding::DataType for ExtendedArbitrationID {
7143 const EXTENT_BYTES: Option<u32> = None;
7145 }
7146 impl ::canadensis_encoding::Message for ExtendedArbitrationID {}
7147 impl ExtendedArbitrationID {}
7148 impl ::canadensis_encoding::Serialize for ExtendedArbitrationID {
7149 fn size_bits(&self) -> usize {
7150 32
7151 }
7152 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
7153 cursor.write_u29(self.value);
7154 cursor.skip_3();
7155 }
7156 }
7157 impl ::canadensis_encoding::Deserialize for ExtendedArbitrationID {
7158 fn deserialize(
7159 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7160 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7161 where
7162 Self: Sized,
7163 {
7164 Ok(ExtendedArbitrationID {
7165 value: { cursor.read_u29() as _ },
7166 })
7167 }
7168 }
7169 }
7170 #[allow(deprecated)]
7171 #[cfg_attr(not(test), deprecated)]
7172 pub mod frame_0_1 {
7173 #[cfg_attr(
7178 not(doctest),
7179 doc = " CAN 2.0 or CAN FD frame representation. This is the top-level data type in its namespace.\n See next version."
7180 )]
7181 #[deprecated]
7182 pub struct Frame {
7183 pub timestamp:
7189 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
7190 pub manifestation:
7196 crate::uavcan::metatransport::can::manifestation_0_1::Manifestation,
7197 }
7198 impl ::canadensis_encoding::DataType for Frame {
7199 const EXTENT_BYTES: Option<u32> = None;
7201 }
7202 impl ::canadensis_encoding::Message for Frame {}
7203 impl Frame {}
7204 impl ::canadensis_encoding::Serialize for Frame {
7205 fn size_bits(&self) -> usize {
7206 56 + (self.manifestation).size_bits() + 0
7207 }
7208 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
7209 cursor.write_composite(&self.timestamp);
7210 cursor.write_composite(&self.manifestation);
7211 }
7212 }
7213 impl ::canadensis_encoding::Deserialize for Frame {
7214 fn deserialize(
7215 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7216 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7217 where
7218 Self: Sized,
7219 {
7220 Ok(Frame {
7221 timestamp: { cursor.read_composite()? },
7222 manifestation: { cursor.read_composite()? },
7223 })
7224 }
7225 }
7226 }
7227 pub mod frame_0_2 {
7228 #[cfg_attr(
7233 not(doctest),
7234 doc = " Classic CAN or CAN FD frame representation. This is the top-level data type in its namespace."
7235 )]
7236 pub enum Frame {
7237 #[cfg_attr(not(doctest), doc = " CAN error (intentional or disturbance)")]
7238 Error(crate::uavcan::metatransport::can::error_0_1::Error),
7241 #[cfg_attr(not(doctest), doc = " Bit rate switch flag active")]
7242 DataFd(crate::uavcan::metatransport::can::data_fd_0_1::DataFD),
7245 #[cfg_attr(not(doctest), doc = " Bit rate switch flag not active")]
7246 DataClassic(crate::uavcan::metatransport::can::data_classic_0_1::DataClassic),
7249 #[cfg_attr(
7250 not(doctest),
7251 doc = " Bit rate switch flag not active\n Sealed because the structure is rigidly dictated by an external standard."
7252 )]
7253 RemoteTransmissionRequest(crate::uavcan::metatransport::can::rtr_0_1::RTR),
7256 }
7257 impl ::canadensis_encoding::DataType for Frame {
7258 const EXTENT_BYTES: Option<u32> = None;
7260 }
7261 impl ::canadensis_encoding::Message for Frame {}
7262 impl Frame {}
7263 impl ::canadensis_encoding::Serialize for Frame {
7264 fn size_bits(&self) -> usize {
7265 8 + match self {
7266 Frame::Error(inner) => 32,
7267 Frame::DataFd(inner) => (inner).size_bits(),
7268 Frame::DataClassic(inner) => (inner).size_bits(),
7269 Frame::RemoteTransmissionRequest(inner) => 40,
7270 }
7271 }
7272 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
7273 match self {
7274 Frame::Error(inner) => {
7275 cursor.write_aligned_u8(0);
7276 cursor.write_composite(inner);
7277 }
7278 Frame::DataFd(inner) => {
7279 cursor.write_aligned_u8(1);
7280 cursor.write_composite(inner);
7281 }
7282 Frame::DataClassic(inner) => {
7283 cursor.write_aligned_u8(2);
7284 cursor.write_composite(inner);
7285 }
7286 Frame::RemoteTransmissionRequest(inner) => {
7287 cursor.write_aligned_u8(3);
7288 cursor.write_composite(inner);
7289 }
7290 }
7291 }
7292 }
7293 impl ::canadensis_encoding::Deserialize for Frame {
7294 fn deserialize(
7295 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7296 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7297 where
7298 Self: Sized,
7299 {
7300 match cursor.read_aligned_u8() as _ {
7301 0 => Ok(Frame::Error({ cursor.read_composite()? })),
7302 1 => Ok(Frame::DataFd({ cursor.read_composite()? })),
7303 2 => Ok(Frame::DataClassic({ cursor.read_composite()? })),
7304 3 => Ok(Frame::RemoteTransmissionRequest({
7305 cursor.read_composite()?
7306 })),
7307 _ => Err(::canadensis_encoding::DeserializeError::UnionTag),
7308 }
7309 }
7310 }
7311 }
7312 #[allow(deprecated)]
7313 #[cfg_attr(not(test), deprecated)]
7314 pub mod manifestation_0_1 {
7315 #[cfg_attr(
7320 not(doctest),
7321 doc = " CAN frame properties that can be manifested on the bus.\n See Frame.0.2 as a replacement"
7322 )]
7323 #[deprecated]
7324 pub enum Manifestation {
7325 #[cfg_attr(not(doctest), doc = " CAN error (intentional or disturbance)")]
7326 Error(crate::uavcan::metatransport::can::error_0_1::Error),
7329 #[cfg_attr(not(doctest), doc = " Bit rate switch flag active")]
7330 DataFd(crate::uavcan::metatransport::can::data_fd_0_1::DataFD),
7333 #[cfg_attr(not(doctest), doc = " Bit rate switch flag not active")]
7334 DataClassic(crate::uavcan::metatransport::can::data_classic_0_1::DataClassic),
7337 #[cfg_attr(not(doctest), doc = " Bit rate switch flag not active")]
7338 RemoteTransmissionRequest(crate::uavcan::metatransport::can::rtr_0_1::RTR),
7341 }
7342 impl ::canadensis_encoding::DataType for Manifestation {
7343 const EXTENT_BYTES: Option<u32> = None;
7345 }
7346 impl ::canadensis_encoding::Message for Manifestation {}
7347 impl Manifestation {}
7348 impl ::canadensis_encoding::Serialize for Manifestation {
7349 fn size_bits(&self) -> usize {
7350 8 + match self {
7351 Manifestation::Error(inner) => 32,
7352 Manifestation::DataFd(inner) => (inner).size_bits(),
7353 Manifestation::DataClassic(inner) => (inner).size_bits(),
7354 Manifestation::RemoteTransmissionRequest(inner) => 40,
7355 }
7356 }
7357 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
7358 match self {
7359 Manifestation::Error(inner) => {
7360 cursor.write_aligned_u8(0);
7361 cursor.write_composite(inner);
7362 }
7363 Manifestation::DataFd(inner) => {
7364 cursor.write_aligned_u8(1);
7365 cursor.write_composite(inner);
7366 }
7367 Manifestation::DataClassic(inner) => {
7368 cursor.write_aligned_u8(2);
7369 cursor.write_composite(inner);
7370 }
7371 Manifestation::RemoteTransmissionRequest(inner) => {
7372 cursor.write_aligned_u8(3);
7373 cursor.write_composite(inner);
7374 }
7375 }
7376 }
7377 }
7378 impl ::canadensis_encoding::Deserialize for Manifestation {
7379 fn deserialize(
7380 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7381 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7382 where
7383 Self: Sized,
7384 {
7385 match cursor.read_aligned_u8() as _ {
7386 0 => Ok(Manifestation::Error({ cursor.read_composite()? })),
7387 1 => Ok(Manifestation::DataFd({ cursor.read_composite()? })),
7388 2 => Ok(Manifestation::DataClassic({ cursor.read_composite()? })),
7389 3 => Ok(Manifestation::RemoteTransmissionRequest({
7390 cursor.read_composite()?
7391 })),
7392 _ => Err(::canadensis_encoding::DeserializeError::UnionTag),
7393 }
7394 }
7395 }
7396 }
7397 pub mod rtr_0_1 {
7398 #[cfg_attr(
7403 not(doctest),
7404 doc = " Classic remote transmission request (not defined for CAN FD)."
7405 )]
7406 pub struct RTR {
7407 pub arbitration_id:
7413 crate::uavcan::metatransport::can::arbitration_id_0_1::ArbitrationID,
7414 }
7415 impl ::canadensis_encoding::DataType for RTR {
7416 const EXTENT_BYTES: Option<u32> = None;
7418 }
7419 impl ::canadensis_encoding::Message for RTR {}
7420 impl RTR {}
7421 impl ::canadensis_encoding::Serialize for RTR {
7422 fn size_bits(&self) -> usize {
7423 40
7424 }
7425 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
7426 cursor.write_composite(&self.arbitration_id);
7427 }
7428 }
7429 impl ::canadensis_encoding::Deserialize for RTR {
7430 fn deserialize(
7431 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7432 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7433 where
7434 Self: Sized,
7435 {
7436 Ok(RTR {
7437 arbitration_id: { cursor.read_composite()? },
7438 })
7439 }
7440 }
7441 }
7442 }
7443 pub mod ethernet {
7444 pub mod ether_type_0_1 {
7445 #[cfg_attr(
7450 not(doctest),
7451 doc = " Standard EtherType constants as defined by IEEE Registration Authority and IANA.\n This list is only a small subset of constants that are considered to be relevant for Cyphal."
7452 )]
7453 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
7454 #[repr(C, packed)]
7455 pub struct EtherType {
7456 pub value: u16,
7462 }
7463 impl ::canadensis_encoding::DataType for EtherType {
7464 const EXTENT_BYTES: Option<u32> = None;
7466 }
7467 impl ::canadensis_encoding::Message for EtherType {}
7468 impl EtherType {
7469 pub const IP_V4: u16 = 2048;
7470 pub const ARP: u16 = 2054;
7471 pub const IP_V6: u16 = 34525;
7472 }
7473 impl ::canadensis_encoding::Serialize for EtherType {
7474 fn size_bits(&self) -> usize {
7475 16
7476 }
7477 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
7478 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
7479 }
7480 }
7481 impl ::canadensis_encoding::Deserialize for EtherType {
7482 fn deserialize(
7483 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7484 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7485 where
7486 Self: Sized,
7487 {
7488 Ok(Self::deserialize_zero_copy(cursor))
7489 }
7490 }
7491 #[test]
7492 fn test_layout() {
7493 assert_eq!(::core::mem::size_of::<EtherType>() * 8, 16);
7494 assert_eq!(::core::mem::offset_of!(EtherType, value) * 8, 0);
7495 }
7496 }
7497 pub mod frame_0_1 {
7498 #[cfg_attr(
7503 not(doctest),
7504 doc = " IEEE 802.3 Ethernet frame encapsulation.\n In terms of libpcap/tcpdump, the corresponding link type is LINKTYPE_ETHERNET/DLT_EN10MB."
7505 )]
7506 pub struct Frame {
7507 pub destination: [u8; 6],
7513 pub source: [u8; 6],
7519 pub ethertype:
7525 crate::uavcan::metatransport::ethernet::ether_type_0_1::EtherType,
7526 #[cfg_attr(
7527 not(doctest),
7528 doc = " Supports conventional jumbo frames (up to 9 KiB)."
7529 )]
7530 pub payload: ::heapless::Vec<u8, 9216>,
7536 }
7537 impl ::canadensis_encoding::DataType for Frame {
7538 const EXTENT_BYTES: Option<u32> = None;
7540 }
7541 impl ::canadensis_encoding::Message for Frame {}
7542 impl Frame {}
7543 impl ::canadensis_encoding::Serialize for Frame {
7544 fn size_bits(&self) -> usize {
7545 (self.destination).len() * 8
7546 + (self.source).len() * 8
7547 + 16
7548 + 16
7549 + (self.payload).len() * 8
7550 + 0
7551 }
7552 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
7553 cursor.write_bytes(&(self.destination)[..]);
7554 cursor.write_bytes(&(self.source)[..]);
7555 cursor.write_composite(&self.ethertype);
7556 cursor.write_aligned_u16((self.payload).len() as u16);
7557 cursor.write_bytes(&(self.payload)[..]);
7558 }
7559 }
7560 impl ::canadensis_encoding::Deserialize for Frame {
7561 fn deserialize(
7562 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7563 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7564 where
7565 Self: Sized,
7566 {
7567 Ok(Frame {
7568 destination: {
7569 [
7570 cursor.read_u8() as _,
7571 cursor.read_u8() as _,
7572 cursor.read_u8() as _,
7573 cursor.read_u8() as _,
7574 cursor.read_u8() as _,
7575 cursor.read_u8() as _,
7576 ]
7577 },
7578 source: {
7579 [
7580 cursor.read_u8() as _,
7581 cursor.read_u8() as _,
7582 cursor.read_u8() as _,
7583 cursor.read_u8() as _,
7584 cursor.read_u8() as _,
7585 cursor.read_u8() as _,
7586 ]
7587 },
7588 ethertype: { cursor.read_composite()? },
7589 payload: {
7590 let length = cursor.read_u16() as _;
7591 if length <= 9216 {
7592 let mut elements = ::heapless::Vec::new();
7593 for _ in 0..length {
7594 let _ = elements.push(cursor.read_u8() as _);
7595 }
7596 elements
7597 } else {
7598 return Err(
7599 ::canadensis_encoding::DeserializeError::ArrayLength,
7600 );
7601 }
7602 },
7603 })
7604 }
7605 }
7606 }
7607 }
7608 pub mod serial {
7609 #[allow(deprecated)]
7610 #[cfg_attr(not(test), deprecated)]
7611 pub mod fragment_0_1 {
7612 #[cfg_attr(
7617 not(doctest),
7618 doc = " A chunk of raw bytes exchanged over a serial transport. Serial links do not support framing natively.\n The chunk may be of arbitrary size.\n See next version."
7619 )]
7620 #[deprecated]
7621 pub struct Fragment {
7622 pub timestamp:
7628 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
7629 pub data: ::heapless::Vec<u8, 256>,
7635 }
7636 impl ::canadensis_encoding::DataType for Fragment {
7637 const EXTENT_BYTES: Option<u32> = None;
7639 }
7640 impl ::canadensis_encoding::Message for Fragment {}
7641 impl Fragment {
7642 pub const CAPACITY_BYTES: u16 = 256;
7643 }
7644 impl ::canadensis_encoding::Serialize for Fragment {
7645 fn size_bits(&self) -> usize {
7646 56 + 16 + (self.data).len() * 8 + 0
7647 }
7648 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
7649 cursor.write_composite(&self.timestamp);
7650 cursor.write_aligned_u16((self.data).len() as u16);
7651 cursor.write_bytes(&(self.data)[..]);
7652 }
7653 }
7654 impl ::canadensis_encoding::Deserialize for Fragment {
7655 fn deserialize(
7656 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7657 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7658 where
7659 Self: Sized,
7660 {
7661 Ok(Fragment {
7662 timestamp: { cursor.read_composite()? },
7663 data: {
7664 let length = cursor.read_u16() as _;
7665 if length <= 256 {
7666 let mut elements = ::heapless::Vec::new();
7667 for _ in 0..length {
7668 let _ = elements.push(cursor.read_u8() as _);
7669 }
7670 elements
7671 } else {
7672 return Err(
7673 ::canadensis_encoding::DeserializeError::ArrayLength,
7674 );
7675 }
7676 },
7677 })
7678 }
7679 }
7680 }
7681 pub mod fragment_0_2 {
7682 #[cfg_attr(
7687 not(doctest),
7688 doc = " A chunk of raw bytes exchanged over a serial transport. Serial links do not support framing natively.\n The chunk may be of arbitrary size.\n\n If this data type is used to encapsulate Cyphal/serial, then it is recommended to ensure that each message\n contains at most one Cyphal/serial transport frame (frames are separated by zero-valued delimiter bytes)."
7689 )]
7690 pub struct Fragment {
7691 pub data: ::heapless::Vec<u8, 2048>,
7697 }
7698 impl ::canadensis_encoding::DataType for Fragment {
7699 const EXTENT_BYTES: Option<u32> = None;
7701 }
7702 impl ::canadensis_encoding::Message for Fragment {}
7703 impl Fragment {
7704 pub const CAPACITY_BYTES: u16 = 2048;
7705 }
7706 impl ::canadensis_encoding::Serialize for Fragment {
7707 fn size_bits(&self) -> usize {
7708 16 + (self.data).len() * 8 + 0
7709 }
7710 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
7711 cursor.write_aligned_u16((self.data).len() as u16);
7712 cursor.write_bytes(&(self.data)[..]);
7713 }
7714 }
7715 impl ::canadensis_encoding::Deserialize for Fragment {
7716 fn deserialize(
7717 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7718 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7719 where
7720 Self: Sized,
7721 {
7722 Ok(Fragment {
7723 data: {
7724 let length = cursor.read_u16() as _;
7725 if length <= 2048 {
7726 let mut elements = ::heapless::Vec::new();
7727 for _ in 0..length {
7728 let _ = elements.push(cursor.read_u8() as _);
7729 }
7730 elements
7731 } else {
7732 return Err(
7733 ::canadensis_encoding::DeserializeError::ArrayLength,
7734 );
7735 }
7736 },
7737 })
7738 }
7739 }
7740 }
7741 }
7742 pub mod udp {
7743 #[allow(deprecated)]
7744 #[cfg_attr(not(test), deprecated)]
7745 pub mod endpoint_0_1 {
7746 #[cfg_attr(
7751 not(doctest),
7752 doc = " A UDP/IP endpoint address specification.\n Replaced by uavcan.metatransport.ethernet"
7753 )]
7754 #[deprecated]
7755 pub struct Endpoint {
7756 #[cfg_attr(
7757 not(doctest),
7758 doc = " The IP address of the host in the network byte order (big endian).\n IPv6 addresses are represented as-is.\n IPv4 addresses are represented using IPv4-mapped IPv6 addresses."
7759 )]
7760 pub ip_address: [u8; 16],
7766 #[cfg_attr(
7767 not(doctest),
7768 doc = " MAC address of the host in the network byte order (big endian)."
7769 )]
7770 pub mac_address: [u8; 6],
7776 #[cfg_attr(not(doctest), doc = " The UDP port number.")]
7777 pub port: u16,
7783 }
7785 impl ::canadensis_encoding::DataType for Endpoint {
7786 const EXTENT_BYTES: Option<u32> = None;
7788 }
7789 impl ::canadensis_encoding::Message for Endpoint {}
7790 impl Endpoint {}
7791 impl ::canadensis_encoding::Serialize for Endpoint {
7792 fn size_bits(&self) -> usize {
7793 256
7794 }
7795 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
7796 cursor.write_bytes(&(self.ip_address)[..]);
7797 cursor.write_bytes(&(self.mac_address)[..]);
7798 cursor.write_aligned_u16(self.port);
7799 cursor.skip_64();
7800 }
7801 }
7802 impl ::canadensis_encoding::Deserialize for Endpoint {
7803 fn deserialize(
7804 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7805 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7806 where
7807 Self: Sized,
7808 {
7809 Ok(Endpoint {
7810 ip_address: {
7811 [
7812 cursor.read_u8() as _,
7813 cursor.read_u8() as _,
7814 cursor.read_u8() as _,
7815 cursor.read_u8() as _,
7816 cursor.read_u8() as _,
7817 cursor.read_u8() as _,
7818 cursor.read_u8() as _,
7819 cursor.read_u8() as _,
7820 cursor.read_u8() as _,
7821 cursor.read_u8() as _,
7822 cursor.read_u8() as _,
7823 cursor.read_u8() as _,
7824 cursor.read_u8() as _,
7825 cursor.read_u8() as _,
7826 cursor.read_u8() as _,
7827 cursor.read_u8() as _,
7828 ]
7829 },
7830 mac_address: {
7831 [
7832 cursor.read_u8() as _,
7833 cursor.read_u8() as _,
7834 cursor.read_u8() as _,
7835 cursor.read_u8() as _,
7836 cursor.read_u8() as _,
7837 cursor.read_u8() as _,
7838 ]
7839 },
7840 port: { cursor.read_u16() as _ },
7841 })
7842 }
7843 }
7844 }
7845 #[allow(deprecated)]
7846 #[cfg_attr(not(test), deprecated)]
7847 pub mod frame_0_1 {
7848 #[cfg_attr(
7853 not(doctest),
7854 doc = " A generic UDP/IP frame.\n Jumboframes are supported in the interest of greater application compatibility.\n Replaced by uavcan.metatransport.ethernet"
7855 )]
7856 #[deprecated]
7857 pub struct Frame {
7858 pub timestamp:
7864 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
7865 pub source: crate::uavcan::metatransport::udp::endpoint_0_1::Endpoint,
7872 pub destination: crate::uavcan::metatransport::udp::endpoint_0_1::Endpoint,
7878 pub data: ::heapless::Vec<u8, 9188>,
7884 }
7885 impl ::canadensis_encoding::DataType for Frame {
7886 const EXTENT_BYTES: Option<u32> = Some(10240);
7888 }
7889 impl ::canadensis_encoding::Message for Frame {}
7890 impl Frame {
7891 #[cfg_attr(
7892 not(doctest),
7893 doc = " Max jumbo frame 9 KiB, IP header min 20 B, UDP header 8 B."
7894 )]
7895 pub const MTU: u16 = 9188;
7896 }
7897 impl ::canadensis_encoding::Serialize for Frame {
7898 fn size_bits(&self) -> usize {
7899 56 + 8 + 256 + 256 + 16 + (self.data).len() * 8 + 0
7900 }
7901 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
7902 cursor.write_composite(&self.timestamp);
7903 cursor.skip_8();
7904 cursor.write_composite(&self.source);
7905 cursor.write_composite(&self.destination);
7906 cursor.write_aligned_u16((self.data).len() as u16);
7907 cursor.write_bytes(&(self.data)[..]);
7908 }
7909 }
7910 impl ::canadensis_encoding::Deserialize for Frame {
7911 fn deserialize(
7912 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
7913 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
7914 where
7915 Self: Sized,
7916 {
7917 Ok(Frame {
7918 timestamp: { cursor.read_composite()? },
7919 source: {
7920 cursor.skip_8();
7921 cursor.read_composite()?
7922 },
7923 destination: { cursor.read_composite()? },
7924 data: {
7925 let length = cursor.read_u16() as _;
7926 if length <= 9188 {
7927 let mut elements = ::heapless::Vec::new();
7928 for _ in 0..length {
7929 let _ = elements.push(cursor.read_u8() as _);
7930 }
7931 elements
7932 } else {
7933 return Err(
7934 ::canadensis_encoding::DeserializeError::ArrayLength,
7935 );
7936 }
7937 },
7938 })
7939 }
7940 }
7941 }
7942 }
7943 }
7944 pub mod node {
7945 #[allow(deprecated)]
7946 #[cfg_attr(not(test), deprecated)]
7947 pub mod execute_command_1_0 {
7948 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
7949 #[deprecated]
7950 pub const SERVICE: ::canadensis_core::ServiceId =
7951 ::canadensis_core::ServiceId::from_truncating(435);
7952
7953 #[cfg_attr(
7958 not(doctest),
7959 doc = " Instructs the server node to execute or commence execution of a simple predefined command.\n All standard commands are optional; i.e., not guaranteed to be supported by all nodes."
7960 )]
7961 #[deprecated]
7962 pub struct ExecuteCommandRequest {
7963 #[cfg_attr(
7964 not(doctest),
7965 doc = " Standard pre-defined commands are at the top of the range (defined below).\n Vendors can define arbitrary, vendor-specific commands in the bottom part of the range (starting from zero).\n Vendor-specific commands shall not use identifiers above 32767."
7966 )]
7967 pub command: u16,
7973 #[cfg_attr(
7974 not(doctest),
7975 doc = " A string parameter supplied to the command. The format and interpretation is command-specific.\n The standard commands do not use this field (ignore it), excepting the following:\n - COMMAND_BEGIN_SOFTWARE_UPDATE\n Two CAN FD frames max"
7976 )]
7977 pub parameter: ::heapless::Vec<u8, 112>,
7983 }
7984 impl ::canadensis_encoding::DataType for ExecuteCommandRequest {
7985 const EXTENT_BYTES: Option<u32> = Some(300);
7987 }
7988 impl ::canadensis_encoding::Request for ExecuteCommandRequest {}
7989 impl ExecuteCommandRequest {
7990 #[cfg_attr(
7991 not(doctest),
7992 doc = " Reboot the node.\n Note that some standard commands may or may not require a restart in order to take effect; e.g., factory reset."
7993 )]
7994 pub const COMMAND_RESTART: u16 = 65535;
7995 #[cfg_attr(
7996 not(doctest),
7997 doc = " Shut down the node; further access will not be possible until the power is turned back on."
7998 )]
7999 pub const COMMAND_POWER_OFF: u16 = 65534;
8000 #[cfg_attr(
8001 not(doctest),
8002 doc = " Begin the software update process using uavcan.file.Read. This command makes use of the \"parameter\" field below.\n The parameter contains the path to the new software image file to be downloaded by the server from the client\n using the standard service uavcan.file.Read. Observe that this operation swaps the roles of the client and\n the server.\n\n Upon reception of this command, the server (updatee) will evaluate whether it is possible to begin the\n software update process. If that is deemed impossible, the command will be rejected with one of the\n error codes defined in the response section of this definition (e.g., BAD_STATE if the node is currently\n on-duty and a sudden interruption of its activities is considered unsafe, and so on).\n If an update process is already underway, the updatee should abort the process and restart with the new file,\n unless the updatee can determine that the specified file is the same file that is already being downloaded,\n in which case it is allowed to respond SUCCESS and continue the old update process.\n If there are no other conditions precluding the requested update, the updatee will return a SUCCESS and\n initiate the file transfer process by invoking the standard service uavcan.file.Read repeatedly until the file\n is transferred fully (please refer to the documentation for that data type for more information about its usage).\n\n While the software is being updated, the updatee should set its mode (the field \"mode\" in uavcan.node.Heartbeat)\n to MODE_SOFTWARE_UPDATE. Please refer to the documentation for uavcan.node.Heartbeat for more information.\n\n It is recognized that most systems will have to interrupt their normal services to perform the software update\n (unless some form of software hot swapping is implemented, as is the case in some high-availability systems).\n\n Microcontrollers that are requested to update their firmware may need to stop execution of their current firmware\n and start the embedded bootloader (although other approaches are possible as well). In that case,\n while the embedded bootloader is running, the mode reported via the message uavcan.node.Heartbeat should be\n MODE_SOFTWARE_UPDATE as long as the bootloader is runing, even if no update-related activities\n are currently underway. For example, if the update process failed and the bootloader cannot load the software,\n the same mode MODE_SOFTWARE_UPDATE will be reported.\n It is also recognized that in a microcontroller setting, the application that served the update request will have\n to pass the update-related metadata (such as the node-ID of the server and the firmware image file path) to\n the embedded bootloader. The tactics of that transaction lie outside of the scope of this specification."
8003 )]
8004 pub const COMMAND_BEGIN_SOFTWARE_UPDATE: u16 = 65533;
8005 #[cfg_attr(
8006 not(doctest),
8007 doc = " Return the node's configuration back to the factory default settings (may require restart).\n Due to the uncertainty whether a restart is required, generic interfaces should always force a restart."
8008 )]
8009 pub const COMMAND_FACTORY_RESET: u16 = 65532;
8010 #[cfg_attr(
8011 not(doctest),
8012 doc = " Cease activities immediately, enter a safe state until restarted.\n Further operation may no longer be possible until a restart command is executed."
8013 )]
8014 pub const COMMAND_EMERGENCY_STOP: u16 = 65531;
8015 #[cfg_attr(
8016 not(doctest),
8017 doc = " This command instructs the node to store the current configuration parameter values and other persistent states\n to the non-volatile storage. Nodes are allowed to manage persistent states automatically, obviating the need for\n this command by committing all such data to the non-volatile memory automatically as necessary. However, some\n nodes may lack this functionality, in which case this parameter should be used. Generic interfaces should always\n invoke this command in order to ensure that the data is stored even if the node doesn't implement automatic\n persistence management."
8018 )]
8019 pub const COMMAND_STORE_PERSISTENT_STATES: u16 = 65530;
8020 }
8021 impl ::canadensis_encoding::Serialize for ExecuteCommandRequest {
8022 fn size_bits(&self) -> usize {
8023 16 + 8 + (self.parameter).len() * 8 + 0
8024 }
8025 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
8026 cursor.write_aligned_u16(self.command);
8027 cursor.write_aligned_u8((self.parameter).len() as u8);
8028 cursor.write_bytes(&(self.parameter)[..]);
8029 }
8030 }
8031 impl ::canadensis_encoding::Deserialize for ExecuteCommandRequest {
8032 fn deserialize(
8033 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
8034 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
8035 where
8036 Self: Sized,
8037 {
8038 Ok(ExecuteCommandRequest {
8039 command: { cursor.read_u16() as _ },
8040 parameter: {
8041 let length = cursor.read_u8() as _;
8042 if length <= 112 {
8043 let mut elements = ::heapless::Vec::new();
8044 for _ in 0..length {
8045 let _ = elements.push(cursor.read_u8() as _);
8046 }
8047 elements
8048 } else {
8049 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
8050 }
8051 },
8052 })
8053 }
8054 }
8055
8056 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
8061 #[repr(C, packed)]
8062 #[deprecated]
8063 pub struct ExecuteCommandResponse {
8064 #[cfg_attr(not(doctest), doc = " The result of the request.")]
8065 pub status: u8,
8071 }
8072 impl ::canadensis_encoding::DataType for ExecuteCommandResponse {
8073 const EXTENT_BYTES: Option<u32> = Some(48);
8075 }
8076 impl ::canadensis_encoding::Response for ExecuteCommandResponse {}
8077 impl ExecuteCommandResponse {
8078 #[cfg_attr(not(doctest), doc = " Started or executed successfully")]
8079 pub const STATUS_SUCCESS: u8 = 0;
8080 #[cfg_attr(
8081 not(doctest),
8082 doc = " Could not start or the desired outcome could not be reached"
8083 )]
8084 pub const STATUS_FAILURE: u8 = 1;
8085 #[cfg_attr(not(doctest), doc = " Denied due to lack of authorization")]
8086 pub const STATUS_NOT_AUTHORIZED: u8 = 2;
8087 #[cfg_attr(
8088 not(doctest),
8089 doc = " The requested command is not known or not supported"
8090 )]
8091 pub const STATUS_BAD_COMMAND: u8 = 3;
8092 #[cfg_attr(
8093 not(doctest),
8094 doc = " The supplied parameter cannot be used with the selected command"
8095 )]
8096 pub const STATUS_BAD_PARAMETER: u8 = 4;
8097 #[cfg_attr(
8098 not(doctest),
8099 doc = " The current state of the node does not permit execution of this command"
8100 )]
8101 pub const STATUS_BAD_STATE: u8 = 5;
8102 #[cfg_attr(
8103 not(doctest),
8104 doc = " The operation should have succeeded but an unexpected failure occurred"
8105 )]
8106 pub const STATUS_INTERNAL_ERROR: u8 = 6;
8107 }
8108 impl ::canadensis_encoding::Serialize for ExecuteCommandResponse {
8109 fn size_bits(&self) -> usize {
8110 8
8111 }
8112 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
8113 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
8114 }
8115 }
8116 impl ::canadensis_encoding::Deserialize for ExecuteCommandResponse {
8117 fn deserialize(
8118 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
8119 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
8120 where
8121 Self: Sized,
8122 {
8123 Ok(Self::deserialize_zero_copy(cursor))
8124 }
8125 }
8126 #[test]
8127 fn test_layout() {
8128 assert_eq!(::core::mem::size_of::<ExecuteCommandResponse>() * 8, 8);
8129 assert_eq!(
8130 ::core::mem::offset_of!(ExecuteCommandResponse, status) * 8,
8131 0
8132 );
8133 }
8134 }
8135 #[allow(deprecated)]
8136 #[cfg_attr(not(test), deprecated)]
8137 pub mod execute_command_1_1 {
8138 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
8139 #[deprecated]
8140 pub const SERVICE: ::canadensis_core::ServiceId =
8141 ::canadensis_core::ServiceId::from_truncating(435);
8142
8143 #[cfg_attr(
8148 not(doctest),
8149 doc = " Instructs the server node to execute or commence execution of a simple predefined command.\n All standard commands are optional; i.e., not guaranteed to be supported by all nodes."
8150 )]
8151 #[deprecated]
8152 pub struct ExecuteCommandRequest {
8153 #[cfg_attr(
8154 not(doctest),
8155 doc = " Standard pre-defined commands are at the top of the range (defined below).\n Vendors can define arbitrary, vendor-specific commands in the bottom part of the range (starting from zero).\n Vendor-specific commands shall not use identifiers above 32767."
8156 )]
8157 pub command: u16,
8163 #[cfg_attr(
8164 not(doctest),
8165 doc = " A string parameter supplied to the command. The format and interpretation is command-specific.\n The standard commands do not use this field (ignore it), excepting the following:\n - COMMAND_BEGIN_SOFTWARE_UPDATE"
8166 )]
8167 pub parameter: ::heapless::Vec<u8, 255>,
8173 }
8174 impl ::canadensis_encoding::DataType for ExecuteCommandRequest {
8175 const EXTENT_BYTES: Option<u32> = Some(300);
8177 }
8178 impl ::canadensis_encoding::Request for ExecuteCommandRequest {}
8179 impl ExecuteCommandRequest {
8180 #[cfg_attr(
8181 not(doctest),
8182 doc = " Reboot the node.\n Note that some standard commands may or may not require a restart in order to take effect; e.g., factory reset."
8183 )]
8184 pub const COMMAND_RESTART: u16 = 65535;
8185 #[cfg_attr(
8186 not(doctest),
8187 doc = " Shut down the node; further access will not be possible until the power is turned back on."
8188 )]
8189 pub const COMMAND_POWER_OFF: u16 = 65534;
8190 #[cfg_attr(
8191 not(doctest),
8192 doc = " Begin the software update process using uavcan.file.Read. This command makes use of the \"parameter\" field below.\n The parameter contains the path to the new software image file to be downloaded by the server from the client\n using the standard service uavcan.file.Read. Observe that this operation swaps the roles of the client and\n the server.\n\n Upon reception of this command, the server (updatee) will evaluate whether it is possible to begin the\n software update process. If that is deemed impossible, the command will be rejected with one of the\n error codes defined in the response section of this definition (e.g., BAD_STATE if the node is currently\n on-duty and a sudden interruption of its activities is considered unsafe, and so on).\n If an update process is already underway, the updatee should abort the process and restart with the new file,\n unless the updatee can determine that the specified file is the same file that is already being downloaded,\n in which case it is allowed to respond SUCCESS and continue the old update process.\n If there are no other conditions precluding the requested update, the updatee will return a SUCCESS and\n initiate the file transfer process by invoking the standard service uavcan.file.Read repeatedly until the file\n is transferred fully (please refer to the documentation for that data type for more information about its usage).\n\n While the software is being updated, the updatee should set its mode (the field \"mode\" in uavcan.node.Heartbeat)\n to MODE_SOFTWARE_UPDATE. Please refer to the documentation for uavcan.node.Heartbeat for more information.\n\n It is recognized that most systems will have to interrupt their normal services to perform the software update\n (unless some form of software hot swapping is implemented, as is the case in some high-availability systems).\n\n Microcontrollers that are requested to update their firmware may need to stop execution of their current firmware\n and start the embedded bootloader (although other approaches are possible as well). In that case,\n while the embedded bootloader is running, the mode reported via the message uavcan.node.Heartbeat should be\n MODE_SOFTWARE_UPDATE as long as the bootloader is runing, even if no update-related activities\n are currently underway. For example, if the update process failed and the bootloader cannot load the software,\n the same mode MODE_SOFTWARE_UPDATE will be reported.\n It is also recognized that in a microcontroller setting, the application that served the update request will have\n to pass the update-related metadata (such as the node-ID of the server and the firmware image file path) to\n the embedded bootloader. The tactics of that transaction lie outside of the scope of this specification."
8193 )]
8194 pub const COMMAND_BEGIN_SOFTWARE_UPDATE: u16 = 65533;
8195 #[cfg_attr(
8196 not(doctest),
8197 doc = " Return the node's configuration back to the factory default settings (may require restart).\n Due to the uncertainty whether a restart is required, generic interfaces should always force a restart."
8198 )]
8199 pub const COMMAND_FACTORY_RESET: u16 = 65532;
8200 #[cfg_attr(
8201 not(doctest),
8202 doc = " Cease activities immediately, enter a safe state until restarted.\n Further operation may no longer be possible until a restart command is executed."
8203 )]
8204 pub const COMMAND_EMERGENCY_STOP: u16 = 65531;
8205 #[cfg_attr(
8206 not(doctest),
8207 doc = " This command instructs the node to store the current configuration parameter values and other persistent states\n to the non-volatile storage. Nodes are allowed to manage persistent states automatically, obviating the need for\n this command by committing all such data to the non-volatile memory automatically as necessary. However, some\n nodes may lack this functionality, in which case this parameter should be used. Generic interfaces should always\n invoke this command in order to ensure that the data is stored even if the node doesn't implement automatic\n persistence management."
8208 )]
8209 pub const COMMAND_STORE_PERSISTENT_STATES: u16 = 65530;
8210 }
8211 impl ::canadensis_encoding::Serialize for ExecuteCommandRequest {
8212 fn size_bits(&self) -> usize {
8213 16 + 8 + (self.parameter).len() * 8 + 0
8214 }
8215 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
8216 cursor.write_aligned_u16(self.command);
8217 cursor.write_aligned_u8((self.parameter).len() as u8);
8218 cursor.write_bytes(&(self.parameter)[..]);
8219 }
8220 }
8221 impl ::canadensis_encoding::Deserialize for ExecuteCommandRequest {
8222 fn deserialize(
8223 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
8224 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
8225 where
8226 Self: Sized,
8227 {
8228 Ok(ExecuteCommandRequest {
8229 command: { cursor.read_u16() as _ },
8230 parameter: {
8231 let length = cursor.read_u8() as _;
8232 if length <= 255 {
8233 let mut elements = ::heapless::Vec::new();
8234 for _ in 0..length {
8235 let _ = elements.push(cursor.read_u8() as _);
8236 }
8237 elements
8238 } else {
8239 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
8240 }
8241 },
8242 })
8243 }
8244 }
8245
8246 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
8251 #[repr(C, packed)]
8252 #[deprecated]
8253 pub struct ExecuteCommandResponse {
8254 #[cfg_attr(not(doctest), doc = " The result of the request.")]
8255 pub status: u8,
8261 }
8262 impl ::canadensis_encoding::DataType for ExecuteCommandResponse {
8263 const EXTENT_BYTES: Option<u32> = Some(48);
8265 }
8266 impl ::canadensis_encoding::Response for ExecuteCommandResponse {}
8267 impl ExecuteCommandResponse {
8268 #[cfg_attr(not(doctest), doc = " Started or executed successfully")]
8269 pub const STATUS_SUCCESS: u8 = 0;
8270 #[cfg_attr(
8271 not(doctest),
8272 doc = " Could not start or the desired outcome could not be reached"
8273 )]
8274 pub const STATUS_FAILURE: u8 = 1;
8275 #[cfg_attr(not(doctest), doc = " Denied due to lack of authorization")]
8276 pub const STATUS_NOT_AUTHORIZED: u8 = 2;
8277 #[cfg_attr(
8278 not(doctest),
8279 doc = " The requested command is not known or not supported"
8280 )]
8281 pub const STATUS_BAD_COMMAND: u8 = 3;
8282 #[cfg_attr(
8283 not(doctest),
8284 doc = " The supplied parameter cannot be used with the selected command"
8285 )]
8286 pub const STATUS_BAD_PARAMETER: u8 = 4;
8287 #[cfg_attr(
8288 not(doctest),
8289 doc = " The current state of the node does not permit execution of this command"
8290 )]
8291 pub const STATUS_BAD_STATE: u8 = 5;
8292 #[cfg_attr(
8293 not(doctest),
8294 doc = " The operation should have succeeded but an unexpected failure occurred"
8295 )]
8296 pub const STATUS_INTERNAL_ERROR: u8 = 6;
8297 }
8298 impl ::canadensis_encoding::Serialize for ExecuteCommandResponse {
8299 fn size_bits(&self) -> usize {
8300 8
8301 }
8302 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
8303 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
8304 }
8305 }
8306 impl ::canadensis_encoding::Deserialize for ExecuteCommandResponse {
8307 fn deserialize(
8308 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
8309 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
8310 where
8311 Self: Sized,
8312 {
8313 Ok(Self::deserialize_zero_copy(cursor))
8314 }
8315 }
8316 #[test]
8317 fn test_layout() {
8318 assert_eq!(::core::mem::size_of::<ExecuteCommandResponse>() * 8, 8);
8319 assert_eq!(
8320 ::core::mem::offset_of!(ExecuteCommandResponse, status) * 8,
8321 0
8322 );
8323 }
8324 }
8325 #[allow(deprecated)]
8326 #[cfg_attr(not(test), deprecated)]
8327 pub mod execute_command_1_2 {
8328 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
8329 #[deprecated]
8330 pub const SERVICE: ::canadensis_core::ServiceId =
8331 ::canadensis_core::ServiceId::from_truncating(435);
8332
8333 #[cfg_attr(
8338 not(doctest),
8339 doc = " Instructs the server node to execute or commence execution of a simple predefined command.\n All standard commands are optional; i.e., not guaranteed to be supported by all nodes."
8340 )]
8341 #[deprecated]
8342 pub struct ExecuteCommandRequest {
8343 #[cfg_attr(
8344 not(doctest),
8345 doc = " Standard pre-defined commands are at the top of the range (defined below).\n Vendors can define arbitrary, vendor-specific commands in the bottom part of the range (starting from zero).\n Vendor-specific commands shall not use identifiers above 32767."
8346 )]
8347 pub command: u16,
8353 #[cfg_attr(
8354 not(doctest),
8355 doc = " A string parameter supplied to the command. The format and interpretation is command-specific.\n The standard commands do not use this field (ignore it), excepting the following:\n - COMMAND_BEGIN_SOFTWARE_UPDATE"
8356 )]
8357 pub parameter: ::heapless::Vec<u8, 255>,
8363 }
8364 impl ::canadensis_encoding::DataType for ExecuteCommandRequest {
8365 const EXTENT_BYTES: Option<u32> = Some(300);
8367 }
8368 impl ::canadensis_encoding::Request for ExecuteCommandRequest {}
8369 impl ExecuteCommandRequest {
8370 #[cfg_attr(
8371 not(doctest),
8372 doc = " Reboot the node.\n Note that some standard commands may or may not require a restart in order to take effect; e.g., factory reset."
8373 )]
8374 pub const COMMAND_RESTART: u16 = 65535;
8375 #[cfg_attr(
8376 not(doctest),
8377 doc = " Shut down the node; further access will not be possible until the power is turned back on."
8378 )]
8379 pub const COMMAND_POWER_OFF: u16 = 65534;
8380 #[cfg_attr(
8381 not(doctest),
8382 doc = " Begin the software update process using uavcan.file.Read. This command makes use of the \"parameter\" field below.\n The parameter contains the path to the new software image file to be downloaded by the server from the client\n using the standard service uavcan.file.Read. Observe that this operation swaps the roles of the client and\n the server.\n\n Upon reception of this command, the server (updatee) will evaluate whether it is possible to begin the\n software update process. If that is deemed impossible, the command will be rejected with one of the\n error codes defined in the response section of this definition (e.g., BAD_STATE if the node is currently\n on-duty and a sudden interruption of its activities is considered unsafe, and so on).\n If an update process is already underway, the updatee should abort the process and restart with the new file,\n unless the updatee can determine that the specified file is the same file that is already being downloaded,\n in which case it is allowed to respond SUCCESS and continue the old update process.\n If there are no other conditions precluding the requested update, the updatee will return a SUCCESS and\n initiate the file transfer process by invoking the standard service uavcan.file.Read repeatedly until the file\n is transferred fully (please refer to the documentation for that data type for more information about its usage).\n\n While the software is being updated, the updatee should set its mode (the field \"mode\" in uavcan.node.Heartbeat)\n to MODE_SOFTWARE_UPDATE. Please refer to the documentation for uavcan.node.Heartbeat for more information.\n\n It is recognized that most systems will have to interrupt their normal services to perform the software update\n (unless some form of software hot swapping is implemented, as is the case in some high-availability systems).\n\n Microcontrollers that are requested to update their firmware may need to stop execution of their current firmware\n and start the embedded bootloader (although other approaches are possible as well). In that case,\n while the embedded bootloader is running, the mode reported via the message uavcan.node.Heartbeat should be\n MODE_SOFTWARE_UPDATE as long as the bootloader is runing, even if no update-related activities\n are currently underway. For example, if the update process failed and the bootloader cannot load the software,\n the same mode MODE_SOFTWARE_UPDATE will be reported.\n It is also recognized that in a microcontroller setting, the application that served the update request will have\n to pass the update-related metadata (such as the node-ID of the server and the firmware image file path) to\n the embedded bootloader. The tactics of that transaction lie outside of the scope of this specification."
8383 )]
8384 pub const COMMAND_BEGIN_SOFTWARE_UPDATE: u16 = 65533;
8385 #[cfg_attr(
8386 not(doctest),
8387 doc = " Return the node's configuration back to the factory default settings (may require restart).\n Due to the uncertainty whether a restart is required, generic interfaces should always force a restart."
8388 )]
8389 pub const COMMAND_FACTORY_RESET: u16 = 65532;
8390 #[cfg_attr(
8391 not(doctest),
8392 doc = " Cease activities immediately, enter a safe state until restarted.\n Further operation may no longer be possible until a restart command is executed."
8393 )]
8394 pub const COMMAND_EMERGENCY_STOP: u16 = 65531;
8395 #[cfg_attr(
8396 not(doctest),
8397 doc = " This command instructs the node to store the current configuration parameter values and other persistent states\n to the non-volatile storage. Nodes are allowed to manage persistent states automatically, obviating the need for\n this command by committing all such data to the non-volatile memory automatically as necessary. However, some\n nodes may lack this functionality, in which case this parameter should be used. Generic interfaces should always\n invoke this command in order to ensure that the data is stored even if the node doesn't implement automatic\n persistence management."
8398 )]
8399 pub const COMMAND_STORE_PERSISTENT_STATES: u16 = 65530;
8400 #[cfg_attr(
8401 not(doctest),
8402 doc = " This command instructs the node to physically identify itself in some way--e.g., by flashing a light or\n emitting a sound. The duration and the nature of the identification process is implementation-defined.\n This command can be useful for human operators to match assigned node-ID values to physical nodes during setup."
8403 )]
8404 pub const COMMAND_IDENTIFY: u16 = 65529;
8405 }
8406 impl ::canadensis_encoding::Serialize for ExecuteCommandRequest {
8407 fn size_bits(&self) -> usize {
8408 16 + 8 + (self.parameter).len() * 8 + 0
8409 }
8410 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
8411 cursor.write_aligned_u16(self.command);
8412 cursor.write_aligned_u8((self.parameter).len() as u8);
8413 cursor.write_bytes(&(self.parameter)[..]);
8414 }
8415 }
8416 impl ::canadensis_encoding::Deserialize for ExecuteCommandRequest {
8417 fn deserialize(
8418 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
8419 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
8420 where
8421 Self: Sized,
8422 {
8423 Ok(ExecuteCommandRequest {
8424 command: { cursor.read_u16() as _ },
8425 parameter: {
8426 let length = cursor.read_u8() as _;
8427 if length <= 255 {
8428 let mut elements = ::heapless::Vec::new();
8429 for _ in 0..length {
8430 let _ = elements.push(cursor.read_u8() as _);
8431 }
8432 elements
8433 } else {
8434 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
8435 }
8436 },
8437 })
8438 }
8439 }
8440
8441 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
8446 #[repr(C, packed)]
8447 #[deprecated]
8448 pub struct ExecuteCommandResponse {
8449 #[cfg_attr(not(doctest), doc = " The result of the request.")]
8450 pub status: u8,
8456 }
8457 impl ::canadensis_encoding::DataType for ExecuteCommandResponse {
8458 const EXTENT_BYTES: Option<u32> = Some(48);
8460 }
8461 impl ::canadensis_encoding::Response for ExecuteCommandResponse {}
8462 impl ExecuteCommandResponse {
8463 #[cfg_attr(not(doctest), doc = " Started or executed successfully")]
8464 pub const STATUS_SUCCESS: u8 = 0;
8465 #[cfg_attr(
8466 not(doctest),
8467 doc = " Could not start or the desired outcome could not be reached"
8468 )]
8469 pub const STATUS_FAILURE: u8 = 1;
8470 #[cfg_attr(not(doctest), doc = " Denied due to lack of authorization")]
8471 pub const STATUS_NOT_AUTHORIZED: u8 = 2;
8472 #[cfg_attr(
8473 not(doctest),
8474 doc = " The requested command is not known or not supported"
8475 )]
8476 pub const STATUS_BAD_COMMAND: u8 = 3;
8477 #[cfg_attr(
8478 not(doctest),
8479 doc = " The supplied parameter cannot be used with the selected command"
8480 )]
8481 pub const STATUS_BAD_PARAMETER: u8 = 4;
8482 #[cfg_attr(
8483 not(doctest),
8484 doc = " The current state of the node does not permit execution of this command"
8485 )]
8486 pub const STATUS_BAD_STATE: u8 = 5;
8487 #[cfg_attr(
8488 not(doctest),
8489 doc = " The operation should have succeeded but an unexpected failure occurred"
8490 )]
8491 pub const STATUS_INTERNAL_ERROR: u8 = 6;
8492 }
8493 impl ::canadensis_encoding::Serialize for ExecuteCommandResponse {
8494 fn size_bits(&self) -> usize {
8495 8
8496 }
8497 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
8498 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
8499 }
8500 }
8501 impl ::canadensis_encoding::Deserialize for ExecuteCommandResponse {
8502 fn deserialize(
8503 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
8504 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
8505 where
8506 Self: Sized,
8507 {
8508 Ok(Self::deserialize_zero_copy(cursor))
8509 }
8510 }
8511 #[test]
8512 fn test_layout() {
8513 assert_eq!(::core::mem::size_of::<ExecuteCommandResponse>() * 8, 8);
8514 assert_eq!(
8515 ::core::mem::offset_of!(ExecuteCommandResponse, status) * 8,
8516 0
8517 );
8518 }
8519 }
8520 pub mod execute_command_1_3 {
8521 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
8522 pub const SERVICE: ::canadensis_core::ServiceId =
8523 ::canadensis_core::ServiceId::from_truncating(435);
8524
8525 #[cfg_attr(
8530 not(doctest),
8531 doc = " Instructs the server node to execute or commence execution of a simple predefined command.\n All standard commands are optional; i.e., not guaranteed to be supported by all nodes."
8532 )]
8533 pub struct ExecuteCommandRequest {
8534 #[cfg_attr(
8535 not(doctest),
8536 doc = " Standard pre-defined commands are at the top of the range (defined below).\n Vendors can define arbitrary, vendor-specific commands in the bottom part of the range (starting from zero).\n Vendor-specific commands shall not use identifiers above 32767."
8537 )]
8538 pub command: u16,
8544 #[cfg_attr(
8545 not(doctest),
8546 doc = " A string parameter supplied to the command. The format and interpretation is command-specific.\n The standard commands do not use this field (ignore it), excepting the following:\n - COMMAND_BEGIN_SOFTWARE_UPDATE"
8547 )]
8548 pub parameter: ::heapless::Vec<u8, 255>,
8554 }
8555 impl ::canadensis_encoding::DataType for ExecuteCommandRequest {
8556 const EXTENT_BYTES: Option<u32> = Some(300);
8558 }
8559 impl ::canadensis_encoding::Request for ExecuteCommandRequest {}
8560 impl ExecuteCommandRequest {
8561 #[cfg_attr(
8562 not(doctest),
8563 doc = " Reboot the node.\n Note that some standard commands may or may not require a restart in order to take effect; e.g., factory reset."
8564 )]
8565 pub const COMMAND_RESTART: u16 = 65535;
8566 #[cfg_attr(
8567 not(doctest),
8568 doc = " Shut down the node; further access will not be possible until the power is turned back on."
8569 )]
8570 pub const COMMAND_POWER_OFF: u16 = 65534;
8571 #[cfg_attr(
8572 not(doctest),
8573 doc = " Begin the software update process using uavcan.file.Read. This command makes use of the \"parameter\" field below.\n The parameter contains the path to the new software image file to be downloaded by the server from the client\n using the standard service uavcan.file.Read. Observe that this operation swaps the roles of the client and\n the server.\n\n Upon reception of this command, the server (updatee) will evaluate whether it is possible to begin the\n software update process. If that is deemed impossible, the command will be rejected with one of the\n error codes defined in the response section of this definition (e.g., BAD_STATE if the node is currently\n on-duty and a sudden interruption of its activities is considered unsafe, and so on).\n If an update process is already underway, the updatee should abort the process and restart with the new file,\n unless the updatee can determine that the specified file is the same file that is already being downloaded,\n in which case it is allowed to respond SUCCESS and continue the old update process.\n If there are no other conditions precluding the requested update, the updatee will return a SUCCESS and\n initiate the file transfer process by invoking the standard service uavcan.file.Read repeatedly until the file\n is transferred fully (please refer to the documentation for that data type for more information about its usage).\n\n While the software is being updated, the updatee should set its mode (the field \"mode\" in uavcan.node.Heartbeat)\n to MODE_SOFTWARE_UPDATE. Please refer to the documentation for uavcan.node.Heartbeat for more information.\n\n It is recognized that most systems will have to interrupt their normal services to perform the software update\n (unless some form of software hot swapping is implemented, as is the case in some high-availability systems).\n\n Microcontrollers that are requested to update their firmware may need to stop execution of their current firmware\n and start the embedded bootloader (although other approaches are possible as well). In that case,\n while the embedded bootloader is running, the mode reported via the message uavcan.node.Heartbeat should be\n MODE_SOFTWARE_UPDATE as long as the bootloader is runing, even if no update-related activities\n are currently underway. For example, if the update process failed and the bootloader cannot load the software,\n the same mode MODE_SOFTWARE_UPDATE will be reported.\n It is also recognized that in a microcontroller setting, the application that served the update request will have\n to pass the update-related metadata (such as the node-ID of the server and the firmware image file path) to\n the embedded bootloader. The tactics of that transaction lie outside of the scope of this specification."
8574 )]
8575 pub const COMMAND_BEGIN_SOFTWARE_UPDATE: u16 = 65533;
8576 #[cfg_attr(
8577 not(doctest),
8578 doc = " Return the node's configuration back to the factory default settings (may require restart).\n Due to the uncertainty whether a restart is required, generic interfaces should always force a restart."
8579 )]
8580 pub const COMMAND_FACTORY_RESET: u16 = 65532;
8581 #[cfg_attr(
8582 not(doctest),
8583 doc = " Cease activities immediately, enter a safe state until restarted.\n Further operation may no longer be possible until a restart command is executed."
8584 )]
8585 pub const COMMAND_EMERGENCY_STOP: u16 = 65531;
8586 #[cfg_attr(
8587 not(doctest),
8588 doc = " This command instructs the node to store the current configuration parameter values and other persistent states\n to the non-volatile storage. Nodes are allowed to manage persistent states automatically, obviating the need for\n this command by committing all such data to the non-volatile memory automatically as necessary. However, some\n nodes may lack this functionality, in which case this parameter should be used. Generic interfaces should always\n invoke this command in order to ensure that the data is stored even if the node doesn't implement automatic\n persistence management."
8589 )]
8590 pub const COMMAND_STORE_PERSISTENT_STATES: u16 = 65530;
8591 #[cfg_attr(
8592 not(doctest),
8593 doc = " This command instructs the node to physically identify itself in some way--e.g., by flashing a light or\n emitting a sound. The duration and the nature of the identification process is implementation-defined.\n This command can be useful for human operators to match assigned node-ID values to physical nodes during setup."
8594 )]
8595 pub const COMMAND_IDENTIFY: u16 = 65529;
8596 }
8597 impl ::canadensis_encoding::Serialize for ExecuteCommandRequest {
8598 fn size_bits(&self) -> usize {
8599 16 + 8 + (self.parameter).len() * 8 + 0
8600 }
8601 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
8602 cursor.write_aligned_u16(self.command);
8603 cursor.write_aligned_u8((self.parameter).len() as u8);
8604 cursor.write_bytes(&(self.parameter)[..]);
8605 }
8606 }
8607 impl ::canadensis_encoding::Deserialize for ExecuteCommandRequest {
8608 fn deserialize(
8609 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
8610 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
8611 where
8612 Self: Sized,
8613 {
8614 Ok(ExecuteCommandRequest {
8615 command: { cursor.read_u16() as _ },
8616 parameter: {
8617 let length = cursor.read_u8() as _;
8618 if length <= 255 {
8619 let mut elements = ::heapless::Vec::new();
8620 for _ in 0..length {
8621 let _ = elements.push(cursor.read_u8() as _);
8622 }
8623 elements
8624 } else {
8625 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
8626 }
8627 },
8628 })
8629 }
8630 }
8631
8632 pub struct ExecuteCommandResponse {
8637 #[cfg_attr(not(doctest), doc = " The result of the request.")]
8638 pub status: u8,
8644 #[cfg_attr(
8645 not(doctest),
8646 doc = " Any output that could be useful that has the capability to convey detailed information.\n Users can send commands and receive specific data, like device status or measurements back in a streamlined manner.\n The standard commands should leave this field empty unless explicitly specified otherwise."
8647 )]
8648 pub output: ::heapless::Vec<u8, 46>,
8654 }
8655 impl ::canadensis_encoding::DataType for ExecuteCommandResponse {
8656 const EXTENT_BYTES: Option<u32> = Some(48);
8658 }
8659 impl ::canadensis_encoding::Response for ExecuteCommandResponse {}
8660 impl ExecuteCommandResponse {
8661 #[cfg_attr(not(doctest), doc = " Started or executed successfully")]
8662 pub const STATUS_SUCCESS: u8 = 0;
8663 #[cfg_attr(
8664 not(doctest),
8665 doc = " Could not start or the desired outcome could not be reached"
8666 )]
8667 pub const STATUS_FAILURE: u8 = 1;
8668 #[cfg_attr(not(doctest), doc = " Denied due to lack of authorization")]
8669 pub const STATUS_NOT_AUTHORIZED: u8 = 2;
8670 #[cfg_attr(
8671 not(doctest),
8672 doc = " The requested command is not known or not supported"
8673 )]
8674 pub const STATUS_BAD_COMMAND: u8 = 3;
8675 #[cfg_attr(
8676 not(doctest),
8677 doc = " The supplied parameter cannot be used with the selected command"
8678 )]
8679 pub const STATUS_BAD_PARAMETER: u8 = 4;
8680 #[cfg_attr(
8681 not(doctest),
8682 doc = " The current state of the node does not permit execution of this command"
8683 )]
8684 pub const STATUS_BAD_STATE: u8 = 5;
8685 #[cfg_attr(
8686 not(doctest),
8687 doc = " The operation should have succeeded but an unexpected failure occurred"
8688 )]
8689 pub const STATUS_INTERNAL_ERROR: u8 = 6;
8690 }
8691 impl ::canadensis_encoding::Serialize for ExecuteCommandResponse {
8692 fn size_bits(&self) -> usize {
8693 8 + 8 + (self.output).len() * 8 + 0
8694 }
8695 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
8696 cursor.write_aligned_u8(self.status);
8697 cursor.write_aligned_u8((self.output).len() as u8);
8698 cursor.write_bytes(&(self.output)[..]);
8699 }
8700 }
8701 impl ::canadensis_encoding::Deserialize for ExecuteCommandResponse {
8702 fn deserialize(
8703 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
8704 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
8705 where
8706 Self: Sized,
8707 {
8708 Ok(ExecuteCommandResponse {
8709 status: { cursor.read_u8() as _ },
8710 output: {
8711 let length = cursor.read_u8() as _;
8712 if length <= 46 {
8713 let mut elements = ::heapless::Vec::new();
8714 for _ in 0..length {
8715 let _ = elements.push(cursor.read_u8() as _);
8716 }
8717 elements
8718 } else {
8719 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
8720 }
8721 },
8722 })
8723 }
8724 }
8725 }
8726 pub mod get_info_1_0 {
8727 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
8728 pub const SERVICE: ::canadensis_core::ServiceId =
8729 ::canadensis_core::ServiceId::from_truncating(430);
8730
8731 #[cfg_attr(
8736 not(doctest),
8737 doc = " Full node info request.\n All of the returned information shall be static (unchanged) while the node is running.\n It is highly recommended to support this service on all nodes."
8738 )]
8739 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
8740 #[repr(C, packed)]
8741 pub struct GetInfoRequest {}
8742 impl ::canadensis_encoding::DataType for GetInfoRequest {
8743 const EXTENT_BYTES: Option<u32> = None;
8745 }
8746 impl ::canadensis_encoding::Request for GetInfoRequest {}
8747 impl GetInfoRequest {}
8748 impl ::canadensis_encoding::Serialize for GetInfoRequest {
8749 fn size_bits(&self) -> usize {
8750 0
8751 }
8752 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
8753 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
8754 }
8755 }
8756 impl ::canadensis_encoding::Deserialize for GetInfoRequest {
8757 fn deserialize(
8758 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
8759 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
8760 where
8761 Self: Sized,
8762 {
8763 Ok(Self::deserialize_zero_copy(cursor))
8764 }
8765 }
8766 #[test]
8767 fn test_layout() {
8768 assert_eq!(::core::mem::size_of::<GetInfoRequest>() * 8, 0);
8769 }
8770
8771 pub struct GetInfoResponse {
8776 #[cfg_attr(
8777 not(doctest),
8778 doc = " The Cyphal protocol version implemented on this node, both major and minor.\n Not to be changed while the node is running."
8779 )]
8780 pub protocol_version: crate::uavcan::node::version_1_0::Version,
8786 pub hardware_version: crate::uavcan::node::version_1_0::Version,
8792 #[cfg_attr(
8793 not(doctest),
8794 doc = " The version information shall not be changed while the node is running.\n The correct hardware version shall be reported at all times, excepting software-only nodes, in which\n case it should be set to zeros.\n If the node is equipped with a Cyphal-capable bootloader, the bootloader should report the software\n version of the installed application, if there is any; if no application is found, zeros should be reported."
8795 )]
8796 pub software_version: crate::uavcan::node::version_1_0::Version,
8802 #[cfg_attr(
8803 not(doctest),
8804 doc = " A version control system (VCS) revision number or hash. Not to be changed while the node is running.\n For example, this field can be used for reporting the short git commit hash of the current\n software revision.\n Set to zero if not used."
8805 )]
8806 pub software_vcs_revision_id: u64,
8812 #[cfg_attr(
8813 not(doctest),
8814 doc = " The unique-ID (UID) is a 128-bit long sequence that is likely to be globally unique per node.\n The vendor shall ensure that the probability of a collision with any other node UID globally is negligibly low.\n UID is defined once per hardware unit and should never be changed.\n All zeros is not a valid UID.\n If the node is equipped with a Cyphal-capable bootloader, the bootloader shall use the same UID.\n Manual serialization note: only fixed-size fields up to this point. The following fields are dynamically sized."
8815 )]
8816 pub unique_id: [u8; 16],
8822 #[cfg_attr(
8823 not(doctest),
8824 doc = " Human-readable non-empty ASCII node name. An empty name is not permitted.\n The name shall not be changed while the node is running.\n Allowed characters are: a-z (lowercase ASCII letters) 0-9 (decimal digits) . (dot) - (dash) _ (underscore).\n Node name is a reversed Internet domain name (like Java packages), e.g. \"com.manufacturer.project.product\"."
8825 )]
8826 pub name: ::heapless::Vec<u8, 50>,
8832 #[cfg_attr(
8833 not(doctest),
8834 doc = " The value of an arbitrary hash function applied to the software image. Not to be changed while the node is running.\n This field can be used to detect whether the software or firmware running on the node is an exact\n same version as a certain specific revision. This field provides a very strong identity guarantee,\n unlike the version fields above, which can be the same for different builds of the software.\n As can be seen from its definition, this field is optional.\n\n The exact hash function and the methods of its application are implementation-defined.\n However, implementations are recommended to adhere to the following guidelines, fully or partially:\n - The hash function should be CRC-64-WE.\n - The hash function should be applied to the entire application image padded to 8 bytes.\n - If the computed image CRC is stored within the software image itself, the value of\n the hash function becomes ill-defined, because it becomes recursively dependent on itself.\n In order to circumvent this issue, while computing or checking the CRC, its value stored\n within the image should be zeroed out."
8835 )]
8836 pub software_image_crc: ::heapless::Vec<u64, 1>,
8842 #[cfg_attr(
8843 not(doctest),
8844 doc = " The certificate of authenticity (COA) of the node, 222 bytes max, optional. This field can be used for\n reporting digital signatures (e.g., RSA-1776, or ECDSA if a higher degree of cryptographic strength is desired).\n Leave empty if not used. Not to be changed while the node is running.\n At most five CAN FD frames"
8845 )]
8846 pub certificate_of_authenticity: ::heapless::Vec<u8, 222>,
8852 }
8853 impl ::canadensis_encoding::DataType for GetInfoResponse {
8854 const EXTENT_BYTES: Option<u32> = Some(448);
8856 }
8857 impl ::canadensis_encoding::Response for GetInfoResponse {}
8858 impl GetInfoResponse {}
8859 impl ::canadensis_encoding::Serialize for GetInfoResponse {
8860 fn size_bits(&self) -> usize {
8861 16 + 16
8862 + 16
8863 + 64
8864 + (self.unique_id).len() * 8
8865 + 8
8866 + (self.name).len() * 8
8867 + 8
8868 + (self.software_image_crc).len() * 64
8869 + 8
8870 + (self.certificate_of_authenticity).len() * 8
8871 + 0
8872 }
8873 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
8874 cursor.write_composite(&self.protocol_version);
8875 cursor.write_composite(&self.hardware_version);
8876 cursor.write_composite(&self.software_version);
8877 cursor.write_aligned_u64(self.software_vcs_revision_id);
8878 cursor.write_bytes(&(self.unique_id)[..]);
8879 cursor.write_aligned_u8((self.name).len() as u8);
8880 cursor.write_bytes(&(self.name)[..]);
8881 cursor.write_aligned_u8((self.software_image_crc).len() as u8);
8882 for value in (self.software_image_crc).iter() {
8883 cursor.write_u64(*value);
8884 }
8885 cursor.write_aligned_u8((self.certificate_of_authenticity).len() as u8);
8886 cursor.write_bytes(&(self.certificate_of_authenticity)[..]);
8887 }
8888 }
8889 impl ::canadensis_encoding::Deserialize for GetInfoResponse {
8890 fn deserialize(
8891 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
8892 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
8893 where
8894 Self: Sized,
8895 {
8896 Ok(GetInfoResponse {
8897 protocol_version: { cursor.read_composite()? },
8898 hardware_version: { cursor.read_composite()? },
8899 software_version: { cursor.read_composite()? },
8900 software_vcs_revision_id: { cursor.read_u64() as _ },
8901 unique_id: {
8902 [
8903 cursor.read_u8() as _,
8904 cursor.read_u8() as _,
8905 cursor.read_u8() as _,
8906 cursor.read_u8() as _,
8907 cursor.read_u8() as _,
8908 cursor.read_u8() as _,
8909 cursor.read_u8() as _,
8910 cursor.read_u8() as _,
8911 cursor.read_u8() as _,
8912 cursor.read_u8() as _,
8913 cursor.read_u8() as _,
8914 cursor.read_u8() as _,
8915 cursor.read_u8() as _,
8916 cursor.read_u8() as _,
8917 cursor.read_u8() as _,
8918 cursor.read_u8() as _,
8919 ]
8920 },
8921 name: {
8922 let length = cursor.read_u8() as _;
8923 if length <= 50 {
8924 let mut elements = ::heapless::Vec::new();
8925 for _ in 0..length {
8926 let _ = elements.push(cursor.read_u8() as _);
8927 }
8928 elements
8929 } else {
8930 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
8931 }
8932 },
8933 software_image_crc: {
8934 let length = cursor.read_u8() as _;
8935 if length <= 1 {
8936 let mut elements = ::heapless::Vec::new();
8937 for _ in 0..length {
8938 let _ = elements.push(cursor.read_u64() as _);
8939 }
8940 elements
8941 } else {
8942 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
8943 }
8944 },
8945 certificate_of_authenticity: {
8946 let length = cursor.read_u8() as _;
8947 if length <= 222 {
8948 let mut elements = ::heapless::Vec::new();
8949 for _ in 0..length {
8950 let _ = elements.push(cursor.read_u8() as _);
8951 }
8952 elements
8953 } else {
8954 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
8955 }
8956 },
8957 })
8958 }
8959 }
8960 }
8961 pub mod get_transport_statistics_0_1 {
8962 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
8963 pub const SERVICE: ::canadensis_core::ServiceId =
8964 ::canadensis_core::ServiceId::from_truncating(434);
8965
8966 #[cfg_attr(
8971 not(doctest),
8972 doc = " Returns a set of general low-level transport statistical counters.\n Servers are encouraged but not required to sample the data atomically."
8973 )]
8974 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
8975 #[repr(C, packed)]
8976 pub struct GetTransportStatisticsRequest {}
8977 impl ::canadensis_encoding::DataType for GetTransportStatisticsRequest {
8978 const EXTENT_BYTES: Option<u32> = None;
8980 }
8981 impl ::canadensis_encoding::Request for GetTransportStatisticsRequest {}
8982 impl GetTransportStatisticsRequest {}
8983 impl ::canadensis_encoding::Serialize for GetTransportStatisticsRequest {
8984 fn size_bits(&self) -> usize {
8985 0
8986 }
8987 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
8988 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
8989 }
8990 }
8991 impl ::canadensis_encoding::Deserialize for GetTransportStatisticsRequest {
8992 fn deserialize(
8993 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
8994 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
8995 where
8996 Self: Sized,
8997 {
8998 Ok(Self::deserialize_zero_copy(cursor))
8999 }
9000 }
9001 #[test]
9002 fn test_layout() {
9003 assert_eq!(
9004 ::core::mem::size_of::<GetTransportStatisticsRequest>() * 8,
9005 0
9006 );
9007 }
9008
9009 pub struct GetTransportStatisticsResponse {
9014 #[cfg_attr(
9015 not(doctest),
9016 doc = " Cyphal transfer performance statistics:\n the number of Cyphal transfers successfully sent, successfully received, and failed.\n The methods of error counting are implementation-defined."
9017 )]
9018 pub transfer_statistics: crate::uavcan::node::io_statistics_0_1::IOStatistics,
9024 #[cfg_attr(
9025 not(doctest),
9026 doc = " Network interface statistics, separate per interface.\n E.g., for a doubly redundant transport, this array would contain two elements,\n the one at the index zero would apply to the first interface, the other to the second interface.\n The methods of counting are implementation-defined.\n One CAN FD frame"
9027 )]
9028 pub network_interface_statistics:
9034 ::heapless::Vec<crate::uavcan::node::io_statistics_0_1::IOStatistics, 3>,
9035 }
9036 impl ::canadensis_encoding::DataType for GetTransportStatisticsResponse {
9037 const EXTENT_BYTES: Option<u32> = Some(192);
9039 }
9040 impl ::canadensis_encoding::Response for GetTransportStatisticsResponse {}
9041 impl GetTransportStatisticsResponse {
9042 #[cfg_attr(
9043 not(doctest),
9044 doc = " Cyphal supports up to triply modular redundant interfaces."
9045 )]
9046 pub const MAX_NETWORK_INTERFACES: u8 = 3;
9047 }
9048 impl ::canadensis_encoding::Serialize for GetTransportStatisticsResponse {
9049 fn size_bits(&self) -> usize {
9050 120 + 8 + (self.network_interface_statistics).len() * 120 + 0
9051 }
9052 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9053 cursor.write_composite(&self.transfer_statistics);
9054 cursor.write_aligned_u8((self.network_interface_statistics).len() as u8);
9055 for value in (self.network_interface_statistics).iter() {
9056 cursor.write_composite(value);
9057 }
9058 }
9059 }
9060 impl ::canadensis_encoding::Deserialize for GetTransportStatisticsResponse {
9061 fn deserialize(
9062 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9063 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9064 where
9065 Self: Sized,
9066 {
9067 Ok(GetTransportStatisticsResponse {
9068 transfer_statistics: { cursor.read_composite()? },
9069 network_interface_statistics: {
9070 let length = cursor.read_u8() as _;
9071 if length <= 3 {
9072 let mut elements = ::heapless::Vec::new();
9073 for _ in 0..length {
9074 let _ = elements.push(cursor.read_composite()?);
9075 }
9076 elements
9077 } else {
9078 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
9079 }
9080 },
9081 })
9082 }
9083 }
9084 }
9085 pub mod health_1_0 {
9086 #[cfg_attr(
9091 not(doctest),
9092 doc = " Abstract component health information. If the node performs multiple activities (provides multiple network services),\n its health status should reflect the status of the worst-performing activity (network service).\n Follows:\n https://www.law.cornell.edu/cfr/text/14/23.1322\n https://www.faa.gov/documentLibrary/media/Advisory_Circular/AC_25.1322-1.pdf section 6"
9093 )]
9094 pub struct Health {
9095 pub value: u8,
9101 }
9102 impl ::canadensis_encoding::DataType for Health {
9103 const EXTENT_BYTES: Option<u32> = None;
9105 }
9106 impl ::canadensis_encoding::Message for Health {}
9107 impl Health {
9108 #[cfg_attr(
9109 not(doctest),
9110 doc = " The component is functioning properly (nominal)."
9111 )]
9112 pub const NOMINAL: u8 = 0;
9113 #[cfg_attr(
9114 not(doctest),
9115 doc = " A critical parameter went out of range or the component encountered a minor failure that does not prevent\n the subsystem from performing any of its real-time functions."
9116 )]
9117 pub const ADVISORY: u8 = 1;
9118 #[cfg_attr(
9119 not(doctest),
9120 doc = " The component encountered a major failure and is performing in a degraded mode or outside of its designed limitations."
9121 )]
9122 pub const CAUTION: u8 = 2;
9123 #[cfg_attr(
9124 not(doctest),
9125 doc = " The component suffered a fatal malfunction and is unable to perform its intended function."
9126 )]
9127 pub const WARNING: u8 = 3;
9128 }
9129 impl ::canadensis_encoding::Serialize for Health {
9130 fn size_bits(&self) -> usize {
9131 8
9132 }
9133 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9134 cursor.write_u2(self.value);
9135 }
9136 }
9137 impl ::canadensis_encoding::Deserialize for Health {
9138 fn deserialize(
9139 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9140 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9141 where
9142 Self: Sized,
9143 {
9144 Ok(Health {
9145 value: { cursor.read_u2() as _ },
9146 })
9147 }
9148 }
9149 }
9150 pub mod heartbeat_1_0 {
9151 #[cfg_attr(not(doctest), doc = "The fixed subject ID for this message type")]
9152 pub const SUBJECT: ::canadensis_core::SubjectId =
9153 ::canadensis_core::SubjectId::from_truncating(7509);
9154
9155 #[cfg_attr(
9160 not(doctest),
9161 doc = " Abstract node status information.\n This is the only high-level function that shall be implemented by all nodes.\n\n All Cyphal nodes that have a node-ID are required to publish this message to its fixed subject periodically.\n Nodes that do not have a node-ID (also known as \"anonymous nodes\") shall not publish to this subject.\n\n The default subject-ID 7509 is 1110101010101 in binary. The alternating bit pattern at the end helps transceiver\n synchronization (e.g., on CAN-based networks) and on some transports permits automatic bit rate detection.\n\n Network-wide health monitoring can be implemented by subscribing to the fixed subject."
9162 )]
9163 pub struct Heartbeat {
9164 #[cfg_attr(
9165 not(doctest),
9166 doc = " [second]\n The uptime seconds counter should never overflow. The counter will reach the upper limit in ~136 years,\n upon which time it should stay at 0xFFFFFFFF until the node is restarted.\n Other nodes may detect that a remote node has restarted when this value leaps backwards."
9167 )]
9168 pub uptime: u32,
9174 #[cfg_attr(not(doctest), doc = " The abstract health status of this node.")]
9175 pub health: crate::uavcan::node::health_1_0::Health,
9181 #[cfg_attr(
9182 not(doctest),
9183 doc = " The abstract operating mode of the publishing node.\n This field indicates the general level of readiness that can be further elaborated on a per-activity basis\n using various specialized interfaces."
9184 )]
9185 pub mode: crate::uavcan::node::mode_1_0::Mode,
9191 #[cfg_attr(
9192 not(doctest),
9193 doc = " Optional, vendor-specific node status code, e.g. a fault code or a status bitmask.\n Fits into a single-frame Classic CAN transfer (least capable transport, smallest MTU)."
9194 )]
9195 pub vendor_specific_status_code: u8,
9201 }
9202 impl ::canadensis_encoding::DataType for Heartbeat {
9203 const EXTENT_BYTES: Option<u32> = Some(12);
9205 }
9206 impl ::canadensis_encoding::Message for Heartbeat {}
9207 impl Heartbeat {
9208 #[cfg_attr(
9209 not(doctest),
9210 doc = " [second]\n The publication period shall not exceed this limit.\n The period should not change while the node is running."
9211 )]
9212 pub const MAX_PUBLICATION_PERIOD: u16 = 1;
9213 #[cfg_attr(
9214 not(doctest),
9215 doc = " [second]\n If the last message from the node was received more than this amount of time ago, it should be considered offline."
9216 )]
9217 pub const OFFLINE_TIMEOUT: u16 = 3;
9218 }
9219 impl ::canadensis_encoding::Serialize for Heartbeat {
9220 fn size_bits(&self) -> usize {
9221 56
9222 }
9223 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9224 cursor.write_aligned_u32(self.uptime);
9225 cursor.write_composite(&self.health);
9226 cursor.write_composite(&self.mode);
9227 cursor.write_aligned_u8(self.vendor_specific_status_code);
9228 }
9229 }
9230 impl ::canadensis_encoding::Deserialize for Heartbeat {
9231 fn deserialize(
9232 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9233 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9234 where
9235 Self: Sized,
9236 {
9237 Ok(Heartbeat {
9238 uptime: { cursor.read_u32() as _ },
9239 health: { cursor.read_composite()? },
9240 mode: { cursor.read_composite()? },
9241 vendor_specific_status_code: { cursor.read_u8() as _ },
9242 })
9243 }
9244 }
9245 }
9246 pub mod id_1_0 {
9247 #[cfg_attr(
9252 not(doctest),
9253 doc = " Defines a node-ID.\n The maximum valid value is dependent on the underlying transport layer.\n Values lower than 128 are always valid for all transports.\n Refer to the specification for more info."
9254 )]
9255 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
9256 #[repr(C, packed)]
9257 pub struct ID {
9258 pub value: u16,
9264 }
9265 impl ::canadensis_encoding::DataType for ID {
9266 const EXTENT_BYTES: Option<u32> = None;
9268 }
9269 impl ::canadensis_encoding::Message for ID {}
9270 impl ID {}
9271 impl ::canadensis_encoding::Serialize for ID {
9272 fn size_bits(&self) -> usize {
9273 16
9274 }
9275 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9276 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
9277 }
9278 }
9279 impl ::canadensis_encoding::Deserialize for ID {
9280 fn deserialize(
9281 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9282 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9283 where
9284 Self: Sized,
9285 {
9286 Ok(Self::deserialize_zero_copy(cursor))
9287 }
9288 }
9289 #[test]
9290 fn test_layout() {
9291 assert_eq!(::core::mem::size_of::<ID>() * 8, 16);
9292 assert_eq!(::core::mem::offset_of!(ID, value) * 8, 0);
9293 }
9294 }
9295 pub mod io_statistics_0_1 {
9296 #[cfg_attr(
9301 not(doctest),
9302 doc = " A standard set of generic input/output statistical counters that generally should not overflow.\n If a 40-bit counter is incremented every millisecond, it will overflow in ~35 years.\n If an overflow occurs, the value will wrap over to zero.\n\n The values should not be reset while the node is running."
9303 )]
9304 pub struct IOStatistics {
9305 #[cfg_attr(not(doctest), doc = " The number of successfully emitted entities.")]
9306 pub num_emitted: u64,
9312 #[cfg_attr(not(doctest), doc = " The number of successfully received entities.")]
9313 pub num_received: u64,
9319 #[cfg_attr(
9320 not(doctest),
9321 doc = " How many errors have occurred.\n The exact definition of \"error\" and how they are counted are implementation-defined,\n unless specifically defined otherwise."
9322 )]
9323 pub num_errored: u64,
9329 }
9330 impl ::canadensis_encoding::DataType for IOStatistics {
9331 const EXTENT_BYTES: Option<u32> = None;
9333 }
9334 impl ::canadensis_encoding::Message for IOStatistics {}
9335 impl IOStatistics {}
9336 impl ::canadensis_encoding::Serialize for IOStatistics {
9337 fn size_bits(&self) -> usize {
9338 120
9339 }
9340 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9341 cursor.write_u40(self.num_emitted);
9342 cursor.write_u40(self.num_received);
9343 cursor.write_u40(self.num_errored);
9344 }
9345 }
9346 impl ::canadensis_encoding::Deserialize for IOStatistics {
9347 fn deserialize(
9348 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9349 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9350 where
9351 Self: Sized,
9352 {
9353 Ok(IOStatistics {
9354 num_emitted: { cursor.read_u40() as _ },
9355 num_received: { cursor.read_u40() as _ },
9356 num_errored: { cursor.read_u40() as _ },
9357 })
9358 }
9359 }
9360 }
9361 pub mod mode_1_0 {
9362 #[cfg_attr(
9367 not(doctest),
9368 doc = " The operating mode of a node.\n Reserved values can be used in future revisions of the specification."
9369 )]
9370 pub struct Mode {
9371 pub value: u8,
9377 }
9378 impl ::canadensis_encoding::DataType for Mode {
9379 const EXTENT_BYTES: Option<u32> = None;
9381 }
9382 impl ::canadensis_encoding::Message for Mode {}
9383 impl Mode {
9384 #[cfg_attr(not(doctest), doc = " Normal operating mode.")]
9385 pub const OPERATIONAL: u8 = 0;
9386 #[cfg_attr(
9387 not(doctest),
9388 doc = " Initialization is in progress; this mode is entered immediately after startup."
9389 )]
9390 pub const INITIALIZATION: u8 = 1;
9391 #[cfg_attr(not(doctest), doc = " E.g., calibration, self-test, etc.")]
9392 pub const MAINTENANCE: u8 = 2;
9393 #[cfg_attr(
9394 not(doctest),
9395 doc = " New software/firmware is being loaded or the bootloader is running."
9396 )]
9397 pub const SOFTWARE_UPDATE: u8 = 3;
9398 }
9399 impl ::canadensis_encoding::Serialize for Mode {
9400 fn size_bits(&self) -> usize {
9401 8
9402 }
9403 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9404 cursor.write_u3(self.value);
9405 }
9406 }
9407 impl ::canadensis_encoding::Deserialize for Mode {
9408 fn deserialize(
9409 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9410 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9411 where
9412 Self: Sized,
9413 {
9414 Ok(Mode {
9415 value: { cursor.read_u3() as _ },
9416 })
9417 }
9418 }
9419 }
9420 pub mod port {
9421 pub mod id_1_0 {
9422 #[cfg_attr(
9427 not(doctest),
9428 doc = " Used to refer either to a Service or to a Subject.\n The chosen tag identifies the kind of the port, then the numerical ID identifies the port within the kind."
9429 )]
9430 pub enum ID {
9431 SubjectId(crate::uavcan::node::port::subject_id_1_0::SubjectID),
9434 ServiceId(crate::uavcan::node::port::service_id_1_0::ServiceID),
9437 }
9438 impl ::canadensis_encoding::DataType for ID {
9439 const EXTENT_BYTES: Option<u32> = None;
9441 }
9442 impl ::canadensis_encoding::Message for ID {}
9443 impl ID {}
9444 impl ::canadensis_encoding::Serialize for ID {
9445 fn size_bits(&self) -> usize {
9446 24
9447 }
9448 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9449 match self {
9450 ID::SubjectId(inner) => {
9451 cursor.write_aligned_u8(0);
9452 cursor.write_composite(inner);
9453 }
9454 ID::ServiceId(inner) => {
9455 cursor.write_aligned_u8(1);
9456 cursor.write_composite(inner);
9457 }
9458 }
9459 }
9460 }
9461 impl ::canadensis_encoding::Deserialize for ID {
9462 fn deserialize(
9463 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9464 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9465 where
9466 Self: Sized,
9467 {
9468 match cursor.read_aligned_u8() as _ {
9469 0 => Ok(ID::SubjectId({ cursor.read_composite()? })),
9470 1 => Ok(ID::ServiceId({ cursor.read_composite()? })),
9471 _ => Err(::canadensis_encoding::DeserializeError::UnionTag),
9472 }
9473 }
9474 }
9475 }
9476 #[allow(deprecated)]
9477 #[cfg_attr(not(test), deprecated)]
9478 pub mod list_0_1 {
9479 #[cfg_attr(not(doctest), doc = "The fixed subject ID for this message type")]
9480 #[deprecated]
9481 pub const SUBJECT: ::canadensis_core::SubjectId =
9482 ::canadensis_core::SubjectId::from_truncating(7510);
9483
9484 #[cfg_attr(
9489 not(doctest),
9490 doc = " A list of ports that this node is using:\n - Subjects published by this node (whether periodically or ad-hoc).\n - Subjects that this node is subscribed to (a datalogger or a debugger would typically subscribe to all subjects).\n - RPC services consumed by this node (i.e., service clients).\n - RPC services provided by this node (i.e., service servers).\n\n All nodes should implement this capability to provide network introspection and diagnostic capabilities.\n This message should be published using the fixed subject-ID as follows:\n - At the OPTIONAL priority level at least every MAX_PUBLICATION_PERIOD seconds.\n - At the OPTIONAL or SLOW priority level within MAX_PUBLICATION_PERIOD after the port configuration is changed.\n Replaced with v1."
9491 )]
9492 #[deprecated]
9493 pub struct List {
9494 pub publishers: crate::uavcan::node::port::subject_id_list_0_1::SubjectIDList,
9500 pub subscribers: crate::uavcan::node::port::subject_id_list_0_1::SubjectIDList,
9506 pub clients: crate::uavcan::node::port::service_id_list_0_1::ServiceIDList,
9512 pub servers: crate::uavcan::node::port::service_id_list_0_1::ServiceIDList,
9518 }
9519 impl ::canadensis_encoding::DataType for List {
9520 const EXTENT_BYTES: Option<u32> = None;
9522 }
9523 impl ::canadensis_encoding::Message for List {}
9524 impl List {
9525 #[cfg_attr(
9526 not(doctest),
9527 doc = " [seconds]\n If the port configuration is not updated in this amount of time, the node should publish this message anyway."
9528 )]
9529 pub const MAX_PUBLICATION_PERIOD: u8 = 10;
9530 }
9531 impl ::canadensis_encoding::Serialize for List {
9532 fn size_bits(&self) -> usize {
9533 32 + (self.publishers).size_bits()
9534 + 32
9535 + (self.subscribers).size_bits()
9536 + 32
9537 + 512
9538 + 32
9539 + 512
9540 + 0
9541 }
9542 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9543 cursor.write_composite(&self.publishers);
9544 cursor.write_composite(&self.subscribers);
9545 cursor.write_composite(&self.clients);
9546 cursor.write_composite(&self.servers);
9547 }
9548 }
9549 impl ::canadensis_encoding::Deserialize for List {
9550 fn deserialize(
9551 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9552 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9553 where
9554 Self: Sized,
9555 {
9556 Ok(List {
9557 publishers: { cursor.read_composite()? },
9558 subscribers: { cursor.read_composite()? },
9559 clients: { cursor.read_composite()? },
9560 servers: { cursor.read_composite()? },
9561 })
9562 }
9563 }
9564 }
9565 pub mod list_1_0 {
9566 #[cfg_attr(not(doctest), doc = "The fixed subject ID for this message type")]
9567 pub const SUBJECT: ::canadensis_core::SubjectId =
9568 ::canadensis_core::SubjectId::from_truncating(7510);
9569
9570 #[cfg_attr(
9575 not(doctest),
9576 doc = " A list of ports that this node is using:\n - Subjects published by this node (whether periodically or ad-hoc).\n - Subjects that this node is subscribed to (a datalogger or a debugger would typically subscribe to all subjects).\n - RPC services consumed by this node (i.e., service clients).\n - RPC services provided by this node (i.e., service servers).\n\n All nodes should implement this capability to provide network introspection and diagnostic capabilities.\n This message should be published using the fixed subject-ID as follows:\n - At the OPTIONAL priority level at least every MAX_PUBLICATION_PERIOD seconds.\n - At the OPTIONAL or SLOW priority level within MAX_PUBLICATION_PERIOD after the port configuration is changed."
9577 )]
9578 pub struct List {
9579 pub publishers: crate::uavcan::node::port::subject_id_list_1_0::SubjectIDList,
9585 pub subscribers: crate::uavcan::node::port::subject_id_list_1_0::SubjectIDList,
9591 pub clients: crate::uavcan::node::port::service_id_list_1_0::ServiceIDList,
9597 pub servers: crate::uavcan::node::port::service_id_list_1_0::ServiceIDList,
9603 }
9604 impl ::canadensis_encoding::DataType for List {
9605 const EXTENT_BYTES: Option<u32> = None;
9607 }
9608 impl ::canadensis_encoding::Message for List {}
9609 impl List {
9610 #[cfg_attr(
9611 not(doctest),
9612 doc = " [seconds]\n If the port configuration is not updated in this amount of time, the node should publish this message anyway."
9613 )]
9614 pub const MAX_PUBLICATION_PERIOD: u8 = 10;
9615 }
9616 impl ::canadensis_encoding::Serialize for List {
9617 fn size_bits(&self) -> usize {
9618 32 + (self.publishers).size_bits()
9619 + 32
9620 + (self.subscribers).size_bits()
9621 + 32
9622 + 512
9623 + 32
9624 + 512
9625 + 0
9626 }
9627 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9628 cursor.write_composite(&self.publishers);
9629 cursor.write_composite(&self.subscribers);
9630 cursor.write_composite(&self.clients);
9631 cursor.write_composite(&self.servers);
9632 }
9633 }
9634 impl ::canadensis_encoding::Deserialize for List {
9635 fn deserialize(
9636 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9637 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9638 where
9639 Self: Sized,
9640 {
9641 Ok(List {
9642 publishers: { cursor.read_composite()? },
9643 subscribers: { cursor.read_composite()? },
9644 clients: { cursor.read_composite()? },
9645 servers: { cursor.read_composite()? },
9646 })
9647 }
9648 }
9649 }
9650 pub mod service_id_1_0 {
9651 #[cfg_attr(
9656 not(doctest),
9657 doc = " Service-ID. The ranges are defined by the specification."
9658 )]
9659 pub struct ServiceID {
9660 pub value: u16,
9666 }
9667 impl ::canadensis_encoding::DataType for ServiceID {
9668 const EXTENT_BYTES: Option<u32> = None;
9670 }
9671 impl ::canadensis_encoding::Message for ServiceID {}
9672 impl ServiceID {
9673 pub const MAX: u16 = 511;
9674 }
9675 impl ::canadensis_encoding::Serialize for ServiceID {
9676 fn size_bits(&self) -> usize {
9677 16
9678 }
9679 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9680 cursor.write_u9(self.value);
9681 }
9682 }
9683 impl ::canadensis_encoding::Deserialize for ServiceID {
9684 fn deserialize(
9685 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9686 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9687 where
9688 Self: Sized,
9689 {
9690 Ok(ServiceID {
9691 value: { cursor.read_u9() as _ },
9692 })
9693 }
9694 }
9695 }
9696 #[allow(deprecated)]
9697 #[cfg_attr(not(test), deprecated)]
9698 pub mod service_id_list_0_1 {
9699 #[cfg_attr(
9704 not(doctest),
9705 doc = " A list of service identifiers.\n This is a trivial constant-size bitmask with some reserved space in case the range of service-ID is increased\n in a future revision of the protocol.\n Replaced with v1."
9706 )]
9707 #[deprecated]
9708 pub struct ServiceIDList {
9709 #[cfg_attr(
9710 not(doctest),
9711 doc = " The index represents the identifier value. True -- present/used. False -- absent/unused."
9712 )]
9713 pub mask: ::canadensis_encoding::bits::BitArray<64>,
9719 }
9720 impl ::canadensis_encoding::DataType for ServiceIDList {
9721 const EXTENT_BYTES: Option<u32> = Some(128);
9723 }
9724 impl ::canadensis_encoding::Message for ServiceIDList {}
9725 impl ServiceIDList {
9726 pub const CAPACITY: u16 = 512;
9727 }
9728 impl ::canadensis_encoding::Serialize for ServiceIDList {
9729 fn size_bits(&self) -> usize {
9730 512
9731 }
9732 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9733 (self.mask).serialize(cursor);
9734 }
9735 }
9736 impl ::canadensis_encoding::Deserialize for ServiceIDList {
9737 fn deserialize(
9738 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9739 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9740 where
9741 Self: Sized,
9742 {
9743 Ok(ServiceIDList {
9744 mask: {
9745 ::canadensis_encoding::bits::BitArray::deserialize(
9746 512_usize, cursor,
9747 )
9748 },
9749 })
9750 }
9751 }
9752 }
9753 pub mod service_id_list_1_0 {
9754 #[cfg_attr(
9759 not(doctest),
9760 doc = " A list of service identifiers.\n This is a trivial constant-size bitmask with some reserved space in case the range of service-ID is increased\n in a future revision of the protocol."
9761 )]
9762 pub struct ServiceIDList {
9763 #[cfg_attr(
9764 not(doctest),
9765 doc = " The index represents the identifier value. True -- present/used. False -- absent/unused."
9766 )]
9767 pub mask: ::canadensis_encoding::bits::BitArray<64>,
9773 }
9774 impl ::canadensis_encoding::DataType for ServiceIDList {
9775 const EXTENT_BYTES: Option<u32> = Some(128);
9777 }
9778 impl ::canadensis_encoding::Message for ServiceIDList {}
9779 impl ServiceIDList {
9780 pub const CAPACITY: u16 = 512;
9781 }
9782 impl ::canadensis_encoding::Serialize for ServiceIDList {
9783 fn size_bits(&self) -> usize {
9784 512
9785 }
9786 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9787 (self.mask).serialize(cursor);
9788 }
9789 }
9790 impl ::canadensis_encoding::Deserialize for ServiceIDList {
9791 fn deserialize(
9792 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9793 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9794 where
9795 Self: Sized,
9796 {
9797 Ok(ServiceIDList {
9798 mask: {
9799 ::canadensis_encoding::bits::BitArray::deserialize(
9800 512_usize, cursor,
9801 )
9802 },
9803 })
9804 }
9805 }
9806 }
9807 pub mod subject_id_1_0 {
9808 #[cfg_attr(
9813 not(doctest),
9814 doc = " Subject-ID. The ranges are defined by the specification."
9815 )]
9816 pub struct SubjectID {
9817 pub value: u16,
9823 }
9824 impl ::canadensis_encoding::DataType for SubjectID {
9825 const EXTENT_BYTES: Option<u32> = None;
9827 }
9828 impl ::canadensis_encoding::Message for SubjectID {}
9829 impl SubjectID {
9830 pub const MAX: u16 = 8191;
9831 }
9832 impl ::canadensis_encoding::Serialize for SubjectID {
9833 fn size_bits(&self) -> usize {
9834 16
9835 }
9836 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9837 cursor.write_u13(self.value);
9838 }
9839 }
9840 impl ::canadensis_encoding::Deserialize for SubjectID {
9841 fn deserialize(
9842 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9843 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9844 where
9845 Self: Sized,
9846 {
9847 Ok(SubjectID {
9848 value: { cursor.read_u13() as _ },
9849 })
9850 }
9851 }
9852 }
9853 #[allow(deprecated)]
9854 #[cfg_attr(not(test), deprecated)]
9855 pub mod subject_id_list_0_1 {
9856 #[cfg_attr(
9861 not(doctest),
9862 doc = " A list of subject identifiers.\n The range of subject-ID is large, so using a fixed-size bitmask would make this type difficult to handle on\n resource-constrained systems. To address that, we provide two extra options: a simple variable-length list,\n and a special case that indicates that every subject-ID is in use.\n Replaced with v1."
9863 )]
9864 #[deprecated]
9865 pub enum SubjectIDList {
9866 #[cfg_attr(
9867 not(doctest),
9868 doc = " The index represents the identifier value. True -- present/used. False -- absent/unused."
9869 )]
9870 Mask(::canadensis_encoding::bits::BitArray<1024>),
9873 #[cfg_attr(
9874 not(doctest),
9875 doc = " A list of identifiers that can be used instead of the mask if most of the identifiers are unused."
9876 )]
9877 SparseList(
9880 ::heapless::Vec<crate::uavcan::node::port::subject_id_1_0::SubjectID, 255>,
9881 ),
9882 #[cfg_attr(
9883 not(doctest),
9884 doc = " A special case indicating that all identifiers are in use.\n Reserve space in case the range is extended in the future."
9885 )]
9886 Total(crate::uavcan::primitive::empty_1_0::Empty),
9889 }
9890 impl ::canadensis_encoding::DataType for SubjectIDList {
9891 const EXTENT_BYTES: Option<u32> = Some(4097);
9893 }
9894 impl ::canadensis_encoding::Message for SubjectIDList {}
9895 impl SubjectIDList {
9896 pub const CAPACITY: u16 = 8192;
9897 }
9898 impl ::canadensis_encoding::Serialize for SubjectIDList {
9899 fn size_bits(&self) -> usize {
9900 8 + match self {
9901 SubjectIDList::Mask(inner) => (inner).len() * 1,
9902 SubjectIDList::SparseList(inner) => 8 + (inner).len() * 16,
9903 SubjectIDList::Total(inner) => 0,
9904 }
9905 }
9906 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
9907 match self {
9908 SubjectIDList::Mask(inner) => {
9909 cursor.write_aligned_u8(0);
9910 (*inner).serialize(cursor);
9911 }
9912 SubjectIDList::SparseList(inner) => {
9913 cursor.write_aligned_u8(1);
9914 cursor.write_aligned_u8((*inner).len() as u8);
9915 for value in (*inner).iter() {
9916 cursor.write_composite(value);
9917 }
9918 }
9919 SubjectIDList::Total(inner) => {
9920 cursor.write_aligned_u8(2);
9921 cursor.write_composite(inner);
9922 }
9923 }
9924 }
9925 }
9926 impl ::canadensis_encoding::Deserialize for SubjectIDList {
9927 fn deserialize(
9928 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
9929 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
9930 where
9931 Self: Sized,
9932 {
9933 match cursor.read_aligned_u8() as _ {
9934 0 => Ok(SubjectIDList::Mask({
9935 ::canadensis_encoding::bits::BitArray::deserialize(
9936 8192_usize, cursor,
9937 )
9938 })),
9939 1 => Ok(SubjectIDList::SparseList({
9940 let length = cursor.read_u8() as _;
9941 if length <= 255 {
9942 let mut elements = ::heapless::Vec::new();
9943 for _ in 0..length {
9944 let _ = elements.push(cursor.read_composite()?);
9945 }
9946 elements
9947 } else {
9948 return Err(
9949 ::canadensis_encoding::DeserializeError::ArrayLength,
9950 );
9951 }
9952 })),
9953 2 => Ok(SubjectIDList::Total({ cursor.read_composite()? })),
9954 _ => Err(::canadensis_encoding::DeserializeError::UnionTag),
9955 }
9956 }
9957 }
9958 }
9959 pub mod subject_id_list_1_0 {
9960 #[cfg_attr(
9965 not(doctest),
9966 doc = " A list of subject identifiers.\n The range of subject-ID is large, so using a fixed-size bitmask would make this type difficult to handle on\n resource-constrained systems. To address that, we provide two extra options: a simple variable-length list,\n and a special case that indicates that every subject-ID is in use."
9967 )]
9968 pub enum SubjectIDList {
9969 #[cfg_attr(
9970 not(doctest),
9971 doc = " The index represents the identifier value. True -- present/used. False -- absent/unused."
9972 )]
9973 Mask(::canadensis_encoding::bits::BitArray<1024>),
9976 #[cfg_attr(
9977 not(doctest),
9978 doc = " A list of identifiers that can be used instead of the mask if most of the identifiers are unused."
9979 )]
9980 SparseList(
9983 ::heapless::Vec<crate::uavcan::node::port::subject_id_1_0::SubjectID, 255>,
9984 ),
9985 #[cfg_attr(
9986 not(doctest),
9987 doc = " A special case indicating that all identifiers are in use.\n Reserve space in case the range is extended in the future."
9988 )]
9989 Total(crate::uavcan::primitive::empty_1_0::Empty),
9992 }
9993 impl ::canadensis_encoding::DataType for SubjectIDList {
9994 const EXTENT_BYTES: Option<u32> = Some(4097);
9996 }
9997 impl ::canadensis_encoding::Message for SubjectIDList {}
9998 impl SubjectIDList {
9999 pub const CAPACITY: u16 = 8192;
10000 }
10001 impl ::canadensis_encoding::Serialize for SubjectIDList {
10002 fn size_bits(&self) -> usize {
10003 8 + match self {
10004 SubjectIDList::Mask(inner) => (inner).len() * 1,
10005 SubjectIDList::SparseList(inner) => 8 + (inner).len() * 16,
10006 SubjectIDList::Total(inner) => 0,
10007 }
10008 }
10009 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10010 match self {
10011 SubjectIDList::Mask(inner) => {
10012 cursor.write_aligned_u8(0);
10013 (*inner).serialize(cursor);
10014 }
10015 SubjectIDList::SparseList(inner) => {
10016 cursor.write_aligned_u8(1);
10017 cursor.write_aligned_u8((*inner).len() as u8);
10018 for value in (*inner).iter() {
10019 cursor.write_composite(value);
10020 }
10021 }
10022 SubjectIDList::Total(inner) => {
10023 cursor.write_aligned_u8(2);
10024 cursor.write_composite(inner);
10025 }
10026 }
10027 }
10028 }
10029 impl ::canadensis_encoding::Deserialize for SubjectIDList {
10030 fn deserialize(
10031 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10032 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10033 where
10034 Self: Sized,
10035 {
10036 match cursor.read_aligned_u8() as _ {
10037 0 => Ok(SubjectIDList::Mask({
10038 ::canadensis_encoding::bits::BitArray::deserialize(
10039 8192_usize, cursor,
10040 )
10041 })),
10042 1 => Ok(SubjectIDList::SparseList({
10043 let length = cursor.read_u8() as _;
10044 if length <= 255 {
10045 let mut elements = ::heapless::Vec::new();
10046 for _ in 0..length {
10047 let _ = elements.push(cursor.read_composite()?);
10048 }
10049 elements
10050 } else {
10051 return Err(
10052 ::canadensis_encoding::DeserializeError::ArrayLength,
10053 );
10054 }
10055 })),
10056 2 => Ok(SubjectIDList::Total({ cursor.read_composite()? })),
10057 _ => Err(::canadensis_encoding::DeserializeError::UnionTag),
10058 }
10059 }
10060 }
10061 }
10062 }
10063 pub mod version_1_0 {
10064 #[cfg_attr(
10069 not(doctest),
10070 doc = " A shortened semantic version representation: only major and minor.\n The protocol generally does not concern itself with the patch version."
10071 )]
10072 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
10073 #[repr(C, packed)]
10074 pub struct Version {
10075 pub major: u8,
10081 pub minor: u8,
10087 }
10088 impl ::canadensis_encoding::DataType for Version {
10089 const EXTENT_BYTES: Option<u32> = None;
10091 }
10092 impl ::canadensis_encoding::Message for Version {}
10093 impl Version {}
10094 impl ::canadensis_encoding::Serialize for Version {
10095 fn size_bits(&self) -> usize {
10096 16
10097 }
10098 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10099 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
10100 }
10101 }
10102 impl ::canadensis_encoding::Deserialize for Version {
10103 fn deserialize(
10104 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10105 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10106 where
10107 Self: Sized,
10108 {
10109 Ok(Self::deserialize_zero_copy(cursor))
10110 }
10111 }
10112 #[test]
10113 fn test_layout() {
10114 assert_eq!(::core::mem::size_of::<Version>() * 8, 16);
10115 assert_eq!(::core::mem::offset_of!(Version, major) * 8, 0);
10116 assert_eq!(::core::mem::offset_of!(Version, minor) * 8, 8);
10117 }
10118 }
10119 }
10120 pub mod pnp {
10121 pub mod cluster {
10122 pub mod append_entries_1_0 {
10123 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
10124 pub const SERVICE: ::canadensis_core::ServiceId =
10125 ::canadensis_core::ServiceId::from_truncating(390);
10126
10127 #[cfg_attr(
10132 not(doctest),
10133 doc = " This type is a part of the Raft consensus algorithm. The Raft consensus is used for the maintenance of the\n distributed allocation table between redundant allocators. The following description is focused on the exchanges\n between redundant PnP node-ID allocators. It does not apply to the case of non-redundant allocators, because\n in that case the allocation table is stored locally and the process of node-ID allocation is trivial and fully local.\n Exchanges between allocatees and allocators are documented in the appropriate message type definition.\n\n The algorithm used for replication of the allocation table across redundant allocators is a fairly direct\n implementation of the Raft consensus algorithm, as published in the paper\n \"In Search of an Understandable Consensus Algorithm (Extended Version)\" by Diego Ongaro and John Ousterhout.\n The following text assumes that the reader is familiar with the paper.\n\n The Raft log contains entries of type Entry (in the same namespace), where every entry contains the Raft term\n number, the unique-ID, and the corresponding node-ID value (or zeros if it could not be requested from a static\n node). Therefore, the Raft log is the allocation table itself.\n\n Since the maximum number of entries in the allocation table is limited by the range of node-ID values, the log\n capacity is bounded. Therefore, the snapshot transfer and log compaction functions are not required,\n so they are not used in this implementation of the Raft algorithm.\n\n When an allocator becomes the leader of the Raft cluster, it checks if the Raft log contains an entry for its own\n node-ID, and if it doesn't, the leader adds its own allocation entry to the log (the unique-ID can be replaced with\n zeros at the discretion of the implementer). This behavior guarantees that the Raft log always contains at least\n one entry, therefore it is not necessary to support negative log indices, as proposed by the Raft paper.\n\n Since the log is write-only and limited in growth, all allocations are permanent. This restriction is acceptable,\n since Cyphal is a vehicle bus, and configuration of vehicle's components is not expected to change frequently.\n Old allocations can be removed in order to free node-IDs for new allocations by clearing the Raft log on all\n allocators; such clearing shall be performed simultaneously while the network is down, otherwise the Raft cluster\n will automatically attempt to restore the lost state on the allocators where the table was cleared.\n\n The allocators need to be aware of each other's node-ID in order to form a cluster. In order to learn each other's\n node-ID values, the allocators broadcast messages of type Discovery (in the same namespace) until the cluster is\n fully discovered and all allocators know of each other's node-ID. This extension to the Raft algorithm makes the\n cluster almost configuration-free - the only parameter that shall be configured on all allocators of the cluster\n is the number of nodes in the cluster (everything else will be auto-detected).\n\n Runtime cluster membership changes are not supported, since they are not needed for a vehicle bus.\n\n As has been explained in the general description of the PnP node-ID allocation feature, allocators shall watch for\n unknown static nodes appearing on the bus. In the case of a non-redundant allocator, the task is trivial, since the\n allocation table can be updated locally. In the case of a Raft cluster, however, the network monitoring task shall\n be performed by the leader only, since other cluster members cannot commit to the shared allocation table (i.e.,\n the Raft log) anyway. Redundant allocators should not attempt to obtain the true unique-ID of the newly detected\n static nodes (use zeros instead), because the allocation table is write-only: if the unique-ID of a static node\n ever changes (e.g., a replacement unit is installed, or network configuration is changed manually), the change\n will be impossible to reflect in the allocation table.\n\n Only the current Raft leader can process allocation requests and engage in communication with allocatees.\n An allocator is allowed to send allocation responses only if both conditions are met:\n\n - The allocator is currently the Raft leader.\n - Its replica of the Raft log does not contain uncommitted entries (i.e. the last allocation request has been\n completed successfully).\n\n All cluster maintenance traffic should normally use either the lowest or the next-to-lowest transfer priority level."
10134 )]
10135 pub struct AppendEntriesRequest {
10136 pub term: u32,
10142 pub prev_log_term: u32,
10148 pub prev_log_index: u16,
10154 #[cfg_attr(not(doctest), doc = " Refer to the Raft paper for explanation.")]
10155 pub leader_commit: u16,
10161 #[cfg_attr(
10162 not(doctest),
10163 doc = " Worst case replication time per Follower can be computed as:\n\n worst replication time = (node-ID capacity) * (2 trips of next_index) * (request interval per Follower)\n\n E.g., given the request interval of 0.5 seconds, the worst case replication time for CAN bus is:\n\n 128 nodes * 2 trips * 0.5 seconds = 128 seconds.\n\n This is the amount of time it will take for a new Follower to reconstruct a full replica of the distributed log."
10164 )]
10165 pub entries: ::heapless::Vec<crate::uavcan::pnp::cluster::entry_1_0::Entry, 1>,
10171 }
10172 impl ::canadensis_encoding::DataType for AppendEntriesRequest {
10173 const EXTENT_BYTES: Option<u32> = Some(96);
10175 }
10176 impl ::canadensis_encoding::Request for AppendEntriesRequest {}
10177 impl AppendEntriesRequest {
10178 #[cfg_attr(not(doctest), doc = " [second]")]
10179 pub const DEFAULT_MIN_ELECTION_TIMEOUT: u8 = 2;
10180 #[cfg_attr(
10181 not(doctest),
10182 doc = " [second]\n Given the minimum election timeout and the cluster size,\n the maximum recommended request interval can be derived as follows:\n\n max recommended request interval = (min election timeout) / 2 requests / (cluster size - 1)\n\n The equation assumes that the Leader requests one Follower at a time, so that there's at most one pending call\n at any moment. Such behavior is optimal as it creates a uniform bus load, although it is implementation-specific.\n Obviously, the request interval can be lower than that if needed, but higher values are not recommended as they may\n cause Followers to initiate premature elections in case of frame losses or delays.\n\n The timeout value is randomized in the range (MIN, MAX], according to the Raft paper. The randomization granularity\n should be at least one millisecond or higher."
10183 )]
10184 pub const DEFAULT_MAX_ELECTION_TIMEOUT: u8 = 4;
10185 }
10186 impl ::canadensis_encoding::Serialize for AppendEntriesRequest {
10187 fn size_bits(&self) -> usize {
10188 32 + 32 + 16 + 16 + 8 + (self.entries).len() * 176 + 0
10189 }
10190 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10191 cursor.write_aligned_u32(self.term);
10192 cursor.write_aligned_u32(self.prev_log_term);
10193 cursor.write_aligned_u16(self.prev_log_index);
10194 cursor.write_aligned_u16(self.leader_commit);
10195 cursor.write_aligned_u8((self.entries).len() as u8);
10196 for value in (self.entries).iter() {
10197 cursor.write_composite(value);
10198 }
10199 }
10200 }
10201 impl ::canadensis_encoding::Deserialize for AppendEntriesRequest {
10202 fn deserialize(
10203 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10204 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10205 where
10206 Self: Sized,
10207 {
10208 Ok(AppendEntriesRequest {
10209 term: { cursor.read_u32() as _ },
10210 prev_log_term: { cursor.read_u32() as _ },
10211 prev_log_index: { cursor.read_u16() as _ },
10212 leader_commit: { cursor.read_u16() as _ },
10213 entries: {
10214 let length = cursor.read_u8() as _;
10215 if length <= 1 {
10216 let mut elements = ::heapless::Vec::new();
10217 for _ in 0..length {
10218 let _ = elements.push(cursor.read_composite()?);
10219 }
10220 elements
10221 } else {
10222 return Err(
10223 ::canadensis_encoding::DeserializeError::ArrayLength,
10224 );
10225 }
10226 },
10227 })
10228 }
10229 }
10230
10231 pub struct AppendEntriesResponse {
10236 pub term: u32,
10242 #[cfg_attr(not(doctest), doc = " Refer to the Raft paper for explanation.")]
10243 pub success: bool,
10249 }
10250 impl ::canadensis_encoding::DataType for AppendEntriesResponse {
10251 const EXTENT_BYTES: Option<u32> = Some(48);
10253 }
10254 impl ::canadensis_encoding::Response for AppendEntriesResponse {}
10255 impl AppendEntriesResponse {}
10256 impl ::canadensis_encoding::Serialize for AppendEntriesResponse {
10257 fn size_bits(&self) -> usize {
10258 40
10259 }
10260 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10261 cursor.write_aligned_u32(self.term);
10262 cursor.write_bool(self.success);
10263 }
10264 }
10265 impl ::canadensis_encoding::Deserialize for AppendEntriesResponse {
10266 fn deserialize(
10267 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10268 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10269 where
10270 Self: Sized,
10271 {
10272 Ok(AppendEntriesResponse {
10273 term: { cursor.read_u32() as _ },
10274 success: { cursor.read_bool() },
10275 })
10276 }
10277 }
10278 }
10279 pub mod discovery_1_0 {
10280 #[cfg_attr(not(doctest), doc = "The fixed subject ID for this message type")]
10281 pub const SUBJECT: ::canadensis_core::SubjectId =
10282 ::canadensis_core::SubjectId::from_truncating(8164);
10283
10284 #[cfg_attr(
10289 not(doctest),
10290 doc = " This message is used by redundant allocators to find each other's node-ID.\n Please refer to the type AppendEntries for details.\n\n An allocator should stop publishing this message as soon as it has discovered all other allocators in the cluster.\n\n An exception applies: when an allocator receives a Discovery message where the list of known nodes is incomplete\n (i.e. len(known_nodes) < configured_cluster_size), it shall publish a Discovery message once. This condition\n allows other allocators to quickly re-discover the cluster after a restart."
10291 )]
10292 pub struct Discovery {
10293 #[cfg_attr(
10294 not(doctest),
10295 doc = " The number of allocators in the cluster as configured on the sender.\n This value shall be the same across all allocators."
10296 )]
10297 pub configured_cluster_size: u8,
10303 #[cfg_attr(
10305 not(doctest),
10306 doc = " Node-IDs of the allocators that are known to the publishing allocator, including the publishing allocator itself."
10307 )]
10308 pub known_nodes: ::heapless::Vec<crate::uavcan::node::id_1_0::ID, 5>,
10314 }
10315 impl ::canadensis_encoding::DataType for Discovery {
10316 const EXTENT_BYTES: Option<u32> = Some(96);
10318 }
10319 impl ::canadensis_encoding::Message for Discovery {}
10320 impl Discovery {
10321 #[cfg_attr(
10322 not(doctest),
10323 doc = " [second]\n This message should be broadcasted by the allocator at this interval until all other allocators are discovered."
10324 )]
10325 pub const BROADCASTING_PERIOD: u8 = 1;
10326 #[cfg_attr(
10327 not(doctest),
10328 doc = " The redundant allocator cluster cannot contain more than 5 allocators."
10329 )]
10330 pub const MAX_CLUSTER_SIZE: u8 = 5;
10331 }
10332 impl ::canadensis_encoding::Serialize for Discovery {
10333 fn size_bits(&self) -> usize {
10334 3 + 5 + 8 + (self.known_nodes).len() * 16 + 0
10335 }
10336 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10337 cursor.write_u3(self.configured_cluster_size);
10338 cursor.skip_5();
10339 cursor.write_aligned_u8((self.known_nodes).len() as u8);
10340 for value in (self.known_nodes).iter() {
10341 cursor.write_composite(value);
10342 }
10343 }
10344 }
10345 impl ::canadensis_encoding::Deserialize for Discovery {
10346 fn deserialize(
10347 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10348 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10349 where
10350 Self: Sized,
10351 {
10352 Ok(Discovery {
10353 configured_cluster_size: { cursor.read_u3() as _ },
10354 known_nodes: {
10355 cursor.skip_5();
10356 let length = cursor.read_u8() as _;
10357 if length <= 5 {
10358 let mut elements = ::heapless::Vec::new();
10359 for _ in 0..length {
10360 let _ = elements.push(cursor.read_composite()?);
10361 }
10362 elements
10363 } else {
10364 return Err(
10365 ::canadensis_encoding::DeserializeError::ArrayLength,
10366 );
10367 }
10368 },
10369 })
10370 }
10371 }
10372 }
10373 pub mod entry_1_0 {
10374 #[cfg_attr(
10379 not(doctest),
10380 doc = " One PnP node-ID allocation entry.\n This type is a part of the Raft consensus algorithm. Please refer to the type AppendEntries for details."
10381 )]
10382 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
10383 #[repr(C, packed)]
10384 pub struct Entry {
10385 #[cfg_attr(not(doctest), doc = " Refer to the Raft paper for explanation.")]
10386 pub term: u32,
10392 #[cfg_attr(
10393 not(doctest),
10394 doc = " Unique-ID of this allocation; zero if unknown."
10395 )]
10396 pub unique_id: [u8; 16],
10402 #[cfg_attr(not(doctest), doc = " Node-ID of this allocation.")]
10403 pub node_id: crate::uavcan::node::id_1_0::ID,
10409 }
10410 impl ::canadensis_encoding::DataType for Entry {
10411 const EXTENT_BYTES: Option<u32> = None;
10413 }
10414 impl ::canadensis_encoding::Message for Entry {}
10415 impl Entry {}
10416 impl ::canadensis_encoding::Serialize for Entry {
10417 fn size_bits(&self) -> usize {
10418 176
10419 }
10420 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10421 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
10422 }
10423 }
10424 impl ::canadensis_encoding::Deserialize for Entry {
10425 fn deserialize(
10426 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10427 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10428 where
10429 Self: Sized,
10430 {
10431 Ok(Self::deserialize_zero_copy(cursor))
10432 }
10433 }
10434 #[test]
10435 fn test_layout() {
10436 assert_eq!(::core::mem::size_of::<Entry>() * 8, 176);
10437 assert_eq!(::core::mem::offset_of!(Entry, term) * 8, 0);
10438 assert_eq!(::core::mem::offset_of!(Entry, unique_id) * 8, 32);
10439 assert_eq!(::core::mem::offset_of!(Entry, node_id) * 8, 160);
10440 }
10441 }
10442 pub mod request_vote_1_0 {
10443 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
10444 pub const SERVICE: ::canadensis_core::ServiceId =
10445 ::canadensis_core::ServiceId::from_truncating(391);
10446
10447 #[cfg_attr(
10452 not(doctest),
10453 doc = " This type is a part of the Raft consensus algorithm. Please refer to the type AppendEntries for details."
10454 )]
10455 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
10456 #[repr(C, packed)]
10457 pub struct RequestVoteRequest {
10458 pub term: u32,
10464 pub last_log_term: u32,
10470 #[cfg_attr(not(doctest), doc = " Refer to the Raft paper for explanation.")]
10471 pub last_log_index: u16,
10477 }
10478 impl ::canadensis_encoding::DataType for RequestVoteRequest {
10479 const EXTENT_BYTES: Option<u32> = Some(48);
10481 }
10482 impl ::canadensis_encoding::Request for RequestVoteRequest {}
10483 impl RequestVoteRequest {}
10484 impl ::canadensis_encoding::Serialize for RequestVoteRequest {
10485 fn size_bits(&self) -> usize {
10486 80
10487 }
10488 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10489 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
10490 }
10491 }
10492 impl ::canadensis_encoding::Deserialize for RequestVoteRequest {
10493 fn deserialize(
10494 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10495 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10496 where
10497 Self: Sized,
10498 {
10499 Ok(Self::deserialize_zero_copy(cursor))
10500 }
10501 }
10502 #[test]
10503 fn test_layout() {
10504 assert_eq!(::core::mem::size_of::<RequestVoteRequest>() * 8, 80);
10505 assert_eq!(::core::mem::offset_of!(RequestVoteRequest, term) * 8, 0);
10506 assert_eq!(
10507 ::core::mem::offset_of!(RequestVoteRequest, last_log_term) * 8,
10508 32
10509 );
10510 assert_eq!(
10511 ::core::mem::offset_of!(RequestVoteRequest, last_log_index) * 8,
10512 64
10513 );
10514 }
10515
10516 pub struct RequestVoteResponse {
10521 pub term: u32,
10527 #[cfg_attr(not(doctest), doc = " Refer to the Raft paper for explanation.")]
10528 pub vote_granted: bool,
10534 }
10535 impl ::canadensis_encoding::DataType for RequestVoteResponse {
10536 const EXTENT_BYTES: Option<u32> = Some(48);
10538 }
10539 impl ::canadensis_encoding::Response for RequestVoteResponse {}
10540 impl RequestVoteResponse {}
10541 impl ::canadensis_encoding::Serialize for RequestVoteResponse {
10542 fn size_bits(&self) -> usize {
10543 40
10544 }
10545 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10546 cursor.write_aligned_u32(self.term);
10547 cursor.write_bool(self.vote_granted);
10548 }
10549 }
10550 impl ::canadensis_encoding::Deserialize for RequestVoteResponse {
10551 fn deserialize(
10552 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10553 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10554 where
10555 Self: Sized,
10556 {
10557 Ok(RequestVoteResponse {
10558 term: { cursor.read_u32() as _ },
10559 vote_granted: { cursor.read_bool() },
10560 })
10561 }
10562 }
10563 }
10564 }
10565 pub mod node_id_allocation_data_1_0 {
10566 #[cfg_attr(not(doctest), doc = "The fixed subject ID for this message type")]
10567 pub const SUBJECT: ::canadensis_core::SubjectId =
10568 ::canadensis_core::SubjectId::from_truncating(8166);
10569
10570 #[cfg_attr(
10575 not(doctest),
10576 doc = " This definition of the allocation message is intended for use with transports where anonymous transfers are limited\n to 7 bytes of payload, such as Classic CAN. The definition is carried over from the original UAVCAN v0 specification\n with some modifications. For transports other than Classic CAN (e.g., CAN FD, serial, etc.) there is a more\n general, more capable definition NodeIDAllocationData v2.0. The PnP protocol itself is described in the documentation\n for the v2 definition. The documentation provided here builds upon the general case, so read that first please.\n\n The full 128-bit unique-ID can't be accommodated in a single-frame anonymous message transfer over Classic CAN, so\n this definition substitutes the full 128-bit ID with a smaller 48-bit hash of it. The 48-bit hash is obtained by\n applying an arbitrary hash function to the unique-ID that outputs at least 48 bit of data. The recommended hash\n function is the standard CRC-64WE where only the lowest 48 bit of the result are used.\n\n Allocators that support allocation messages of different versions should maintain a shared allocation table for all.\n Requests received via the v1 message obviously do not contain the full unique-ID; the allocators are recommended\n to left-zero-pad the small 48-bit hash in order to obtain a \"pseudo unique-ID\", and use this value in the\n allocation table as a substitute for the real unique-ID. It is recognized that this behavior will have certain\n side effects, such as the same allocatee obtaining different allocated node-ID values depending on which version\n of the message is used, but they are considered tolerable.\n\n Allocatees that may need to operate over Classic CAN along with high-MTU transports may choose to use\n only this constrained method of allocation for consistency and simplification.\n\n In order to save space for the hash, the preferred node-ID is removed from the request. The allocated node-ID\n is provided in the response, however; this is achieved by means of an optional field that is not populated in\n the request but is populated in the response. This implies that the response may be a multi-frame transfer,\n which is acceptable since responses are sent by allocators, which are regular nodes, and therefore they are\n allowed to use regular message transfers rather than being limited to anonymous message transfers as allocatees are.\n\n On the allocatee's side the protocol is defined through the following set of rules:\n\n Rule A. On initialization:\n 1. The allocatee subscribes to this message.\n 2. The allocatee starts the Request Timer with a random interval of Trequest.\n\n Rule B. On expiration of the Request Timer (started as per rules A, B, or C):\n 1. Request Timer restarts with a random interval of Trequest (chosen anew).\n 2. The allocatee broadcasts an allocation request message, where the fields are populated as follows:\n unique_id_hash - a 48-bit hash of the unique-ID of the allocatee.\n allocated_node_id - empty (not populated).\n\n Rule C. On any allocation message, even if other rules also match:\n 1. Request Timer restarts with a random interval of Trequest (chosen anew).\n\n Rule D. On an allocation message WHERE (source node-ID is non-anonymous, i.e., regular allocation response)\n AND (the field unique_id_hash matches the allocatee's 48-bit unique-ID hash)\n AND (the field allocated_node_id is populated):\n 1. Request Timer stops.\n 2. The allocatee initializes its node-ID with the received value.\n 3. The allocatee terminates its subscription to allocation messages.\n 4. Exit."
10577 )]
10578 pub struct NodeIDAllocationData {
10579 #[cfg_attr(
10580 not(doctest),
10581 doc = " An arbitrary 48-bit hash of the unique-ID of the local node."
10582 )]
10583 pub unique_id_hash: u64,
10589 #[cfg_attr(
10590 not(doctest),
10591 doc = " Shall be empty in request messages.\n Shall be populated in response messages."
10592 )]
10593 pub allocated_node_id: ::heapless::Vec<crate::uavcan::node::id_1_0::ID, 1>,
10599 }
10600 impl ::canadensis_encoding::DataType for NodeIDAllocationData {
10601 const EXTENT_BYTES: Option<u32> = None;
10603 }
10604 impl ::canadensis_encoding::Message for NodeIDAllocationData {}
10605 impl NodeIDAllocationData {}
10606 impl ::canadensis_encoding::Serialize for NodeIDAllocationData {
10607 fn size_bits(&self) -> usize {
10608 48 + 8 + (self.allocated_node_id).len() * 16 + 0
10609 }
10610 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10611 cursor.write_u48(self.unique_id_hash);
10612 cursor.write_aligned_u8((self.allocated_node_id).len() as u8);
10613 for value in (self.allocated_node_id).iter() {
10614 cursor.write_composite(value);
10615 }
10616 }
10617 }
10618 impl ::canadensis_encoding::Deserialize for NodeIDAllocationData {
10619 fn deserialize(
10620 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10621 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10622 where
10623 Self: Sized,
10624 {
10625 Ok(NodeIDAllocationData {
10626 unique_id_hash: { cursor.read_u48() as _ },
10627 allocated_node_id: {
10628 let length = cursor.read_u8() as _;
10629 if length <= 1 {
10630 let mut elements = ::heapless::Vec::new();
10631 for _ in 0..length {
10632 let _ = elements.push(cursor.read_composite()?);
10633 }
10634 elements
10635 } else {
10636 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
10637 }
10638 },
10639 })
10640 }
10641 }
10642 }
10643 pub mod node_id_allocation_data_2_0 {
10644 #[cfg_attr(not(doctest), doc = "The fixed subject ID for this message type")]
10645 pub const SUBJECT: ::canadensis_core::SubjectId =
10646 ::canadensis_core::SubjectId::from_truncating(8165);
10647
10648 #[cfg_attr(
10653 not(doctest),
10654 doc = " In order to be able to operate in a Cyphal network, a node shall have a node-ID that is unique within the network.\n Typically, a valid node-ID can be configured manually for each node; however, in certain use cases the manual\n approach is either undesirable or impossible, therefore Cyphal defines the high-level feature of plug-and-play\n nodes that allows nodes to obtain a node-ID value automatically upon connection to the network. When combined\n with automatic physical layer configuration (such as auto bit rate detection), this feature allows one to implement\n nodes that can join a Cyphal network without any prior manual configuration whatsoever. Such nodes are referred to\n as \"plug-and-play nodes\" (or \"PnP nodes\" for brevity).\n\n The feature is fundamentally non-deterministic and is likely to be unfit for some high-reliability systems;\n the designers need to carefully consider the trade-offs involved before deciding to rely on this feature.\n Normally, static node-ID settings should be preferred.\n\n This feature relies on the concept of \"anonymous message transfers\", please consult with the Cyphal transport\n layer specification for details.\n\n The process of plug-and-play node-ID allocation always involves two types of nodes: \"allocators\", which serve\n allocation requests; and \"allocatees\", which request PnP node-ID from allocators. A Cyphal network may implement\n the following configurations of allocators:\n\n - Zero allocators, in which case plug-and-play node-ID allocation cannot be used, only nodes with statically\n configured node-ID can communicate.\n\n - One allocator, in which case the feature of plug-and-play node-ID allocation will become unavailable\n if the allocator fails. In this configuration, the role of the allocator can be performed even by a very\n resource-constrained system, e.g., a low-end microcontroller.\n\n - Three allocators, in which case the allocators will be using a replicated allocation table via a\n distributed consensus algorithm. In this configuration, the network can tolerate the loss of one\n allocator and continue to serve allocation requests. This configuration requires the allocators to\n maintain large data structures for the needs of the distributed consensus algorithm, and may therefore\n require a slightly more sophisticated computational platform, e.g., a high-end microcontroller.\n\n - Five allocators, it is the same as the three allocator configuration reviewed above except that the network\n can tolerate the loss of two allocators and still continue to serve allocation requests.\n\n In order to get a PnP node-ID, an allocatee shall have a globally unique 128-bit integer identifier, known as\n unique-ID (where \"globally unique\" means that the probability of having two nodes anywhere in the world that share\n the same unique-ID is negligibly low). This is the same value that is used in the field unique_id of the data type\n uavcan.node.GetInfo. All PnP nodes shall support the service uavcan.node.GetInfo, and they shall use the same\n unique-ID value when requesting node-ID allocation and when responding to the GetInfo requests (there may exist\n other usages of the unique-ID value, but they lie outside of the scope of the PnP protocol).\n\n During allocation, the allocatee communicates its unique-ID to the allocator (or allocators in the case of a\n redundant allocator configuration), which then use it to produce an appropriate allocation response. Unique-ID\n values are kept by allocators in the \"allocation table\" - a data structure that contains the mapping between\n unique-ID and the corresponding node-ID values. The allocation table is a write-only data structure that can\n only expand. When a new allocatee requests a PnP node-ID, its unique-ID is recorded in the allocation table,\n and all subsequent allocation requests from the same allocatee will be served with the same node-ID value.\n\n In configurations with redundant allocators, every allocator maintains a replica of the same allocation table\n (a Cyphal network cannot contain more than one allocation table, regardless of the number of allocators employed).\n While the allocation table is a write-only data structure that can only grow, it is still possible to wipe the\n table completely (as long as it is removed from all redundant allocators on the network simultaneously),\n forcing the allocators to forget known nodes and perform all future allocations anew.\n\n In the context of the following description, nodes that use a manually-configured node-ID will be referred to as\n \"static nodes\". It is assumed that allocators are always static nodes themselves since there is no other authority\n on the network that can grant a PnP node-ID, so allocators are unable to request a PnP node-ID for themselves.\n Excepting allocators, it is not recommended to mix PnP and static nodes on the same network; i.e., normally,\n a Cyphal network should contain either all static nodes, or all PnP nodes (excepting allocators). If this\n recommendation cannot be followed, the following rules of safe co-existence of PnP nodes with static nodes should\n be adopted:\n - It is safe to connect PnP nodes to the bus at any time.\n - A static node can be connected to the bus if the allocator (allocators) is (are) already aware of it.\n I.e., the static node is already listed in the allocation table.\n - A new static node (i.e., a node that does not meet the above criterion) can be connected to the bus only if\n no PnP allocation requests are happening at the moment.\n\n Due to the possibility of coexistence of static nodes with PnP nodes, allocators are tasked with monitoring\n the nodes present in the network. If the allocator detects an online node in the network the node-ID of which is\n not found in the allocation table (or the local copy thereof in the case of redundant allocators), the allocator\n shall create a new mock entry where the node-ID matches that of the newly detected node and the unique-ID is set to\n zero (i.e., a 128-bit long sequence of zero bits). This behavior ensures that PnP nodes will never be granted\n node-ID values that are already taken by static nodes. Allocators are allowed to request the true unique-ID of the\n newly detected nodes by issuing requests uavcan.node.GetInfo instead of using mock zero unique-IDs, but this is not\n required for the sake of simplicity and determinism (some nodes may fail to respond to the GetInfo request, e.g.,\n if this service is not supported). Note that in the case of redundant allocators, some of them may be relieved of\n this task due to the intrinsic properties of the distributed consensus algorithm; please refer to the documentation\n for the data type uavcan.pnp.cluster.AppendEntries for more information.\n\n The unique-ID & node-ID pair of each allocator shall be kept in the allocation table as well. It is allowed to replace\n the unique-ID values of allocators with zeros at the discretion of the implementer.\n\n As can be inferred from the above, the process of PnP node-ID allocation involves up to two types of communications:\n\n - \"Allocatee-allocator exchange\" - this communication is used when an allocatee requests a PnP node-ID from the\n allocator (or redundant allocators), and also when the allocator transmits a response back to the allocatee.\n This communication is invariant to the allocator configuration used, i.e., the allocatees are not aware of\n how many allocators are available on the network and how they are configured. In configurations with\n non-redundant (i.e., single) allocator, this is the only type of PnP allocation exchanges.\n\n - \"Allocator-allocator exchange\" - this communication is used by redundant allocators for the maintenance of\n the replicated allocation table and for other needs of the distributed consensus algorithm. Allocatees are\n completely isolated and are unaware of these exchanges. This communication is not used with the single-allocator\n configuration, since there is only one server and the allocation table is not distributed. The data types\n used for the allocator-allocator exchanges are defined in the namespace uavcan.pnp.cluster.\n\n As has been said earlier, the logic used for communication between allocators (for the needs of the maintenance of\n the distributed allocation table) is completely unrelated to the allocatees. The allocatees are unaware of these\n exchanges, and they are also unaware of the allocator configuration used on the network: single or redundant.\n As such, the documentation you're currently reading does not describe the logic and requirements of the\n allocator-allocator exchanges for redundant configurations; for that, please refer to the documentation for the\n data type uavcan.pnp.cluster.AppendEntries.\n\n Allocatee-allocator exchanges are performed using only this message type uavcan.pnp.NodeIDAllocationData. Allocators\n use it with regular message transfers; allocatees use it with anonymous message transfers. The specification and\n usage info for this data type is provided below.\n\n The general idea of the allocatee-allocator exchanges is that the allocatee communicates to the allocator its\n unique-ID and, if applicable, the preferred node-ID value that it would like to have. The allocatee uses\n anonymous message transfers of this type. The allocator performs the allocation and sends a response using\n the same message type, where the field for unique-ID is populated with the unique-ID of the requesting node\n and the field for node-ID is populated with the allocated node-ID. All exchanges from allocatee to allocator use\n single-frame transfers only (see the specification for more information on the limitations of anonymous messages).\n\n The allocatee-allocator exchange logic differs between allocators and allocatees. For allocators, the logic is\n trivial: upon reception of a request, the allocator performs an allocation and sends a response back. If the\n allocation could not be performed for any reason (e.g., the allocation table is full, or there was a failure),\n no response is sent back (i.e., the request is simply ignored); the recommended strategy for the allocatee is to\n continue sending new allocation requests until a response is granted or a higher-level system (e.g., a maintenance\n technician or some automation) intervenes to rectify the problem (e.g., by purging the allocation table).\n The allocator that could not complete an allocation for any reason is recommended to emit a diagnostic message\n with a human-readable description of the problem. For allocatees, the logic is described below.\n\n This message is used for PnP node-ID allocation on all transports where the maximum transmission unit size is\n sufficiently large. For low-MTU transports such as Classic CAN there is an older version of the definition (v1)\n that takes the low MTU into account (the unique-ID value is replaced with a short hash in order to fit the data\n into one 7-byte-long transfer).\n\n Generally, the randomly chosen values of the request period (Trequest) should be in the range from 0 to 1 seconds.\n Applications that are not concerned about the allocation time are recommended to pick higher values, as it will\n reduce interference with other nodes where faster allocations may be desirable. The random interval shall be chosen\n anew per transmission, whereas the pseudo node-ID value is allowed to stay constant per node.\n\n The source of random data for Trequest shall be likely to yield different values for participating nodes, avoiding\n common sequences. This implies that the time since boot alone is not a sufficiently robust source of randomness,\n as that would be probable to cause nodes powered up at the same time to emit colliding messages repeatedly.\n\n The response timeout is not explicitly defined for this protocol, as the allocatee will request a new allocation\n Trequest units of time later again, unless an allocation has been granted. Since the request and response messages\n are fully idempotent, accidentally repeated messages (e.g., due to benign race conditions that are inherent to this\n protocol) are harmless.\n\n On the allocatee's side the protocol is defined through the following set of rules:\n\n Rule A. On initialization:\n 1. The allocatee subscribes to this message.\n 2. The allocatee starts the Request Timer with a random interval of Trequest.\n\n Rule B. On expiration of the Request Timer:\n 1. Request Timer restarts with a random interval of Trequest (chosen anew).\n 2. The allocatee broadcasts an allocation request message, where the fields are populated as follows:\n node_id - the preferred node-ID, or the highest valid value if the allocatee doesn't have any preference.\n unique_id - the 128-bit unique-ID of the allocatee, same value that is reported via uavcan.node.GetInfo.\n\n Rule C. On an allocation message WHERE (source node-ID is non-anonymous, i.e., regular allocation response)\n AND (the field unique_id matches the allocatee's unique-ID):\n 1. Request Timer stops.\n 2. The allocatee initializes its node-ID with the received value.\n 3. The allocatee terminates its subscription to allocation messages.\n 4. Exit.\n\n As can be seen, the algorithm assumes that the allocatee will continue to emit requests at random intervals\n until an allocation is granted or the allocatee is disconnected."
10655 )]
10656 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
10657 #[repr(C, packed)]
10658 pub struct NodeIDAllocationData {
10659 #[cfg_attr(
10660 not(doctest),
10661 doc = " If the message transfer is anonymous (i.e., allocation request), this is the preferred ID.\n If the message transfer is non-anonymous (i.e., allocation response), this is the allocated ID.\n\n If the allocatee does not have any preference, it should request the highest possible node-ID. Keep in mind that\n the two highest node-ID values are reserved for network maintenance tools; requesting those is not prohibited,\n but the allocator is recommended to avoid granting these node-ID, using nearest available lower value instead.\n The allocator will traverse the allocation table starting from the preferred node-ID upward,\n until a free node-ID is found (or the first ID reserved for network maintenance tools is reached).\n If a free node-ID could not be found, the allocator will restart the search from the preferred node-ID\n downward, until a free node-ID is found."
10662 )]
10663 pub node_id: crate::uavcan::node::id_1_0::ID,
10669 #[cfg_attr(
10670 not(doctest),
10671 doc = " The unique-ID of the allocatee. This is the SAME value that is reported via uavcan.node.GetInfo.\n The value is subjected to the same set of constraints; e.g., it can't be changed while the node is running,\n and the same value should be unlikely to be used by any two different nodes anywhere in the world.\n\n If this is a non-anonymous transfer (i.e., allocation response), allocatees will match this value against their\n own unique-ID, and ignore the message if there is no match. If the IDs match, then the field node_id contains\n the allocated node-ID value for this node."
10672 )]
10673 pub unique_id: [u8; 16],
10679 }
10680 impl ::canadensis_encoding::DataType for NodeIDAllocationData {
10681 const EXTENT_BYTES: Option<u32> = Some(48);
10683 }
10684 impl ::canadensis_encoding::Message for NodeIDAllocationData {}
10685 impl NodeIDAllocationData {}
10686 impl ::canadensis_encoding::Serialize for NodeIDAllocationData {
10687 fn size_bits(&self) -> usize {
10688 144
10689 }
10690 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10691 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
10692 }
10693 }
10694 impl ::canadensis_encoding::Deserialize for NodeIDAllocationData {
10695 fn deserialize(
10696 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10697 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10698 where
10699 Self: Sized,
10700 {
10701 Ok(Self::deserialize_zero_copy(cursor))
10702 }
10703 }
10704 #[test]
10705 fn test_layout() {
10706 assert_eq!(::core::mem::size_of::<NodeIDAllocationData>() * 8, 144);
10707 assert_eq!(
10708 ::core::mem::offset_of!(NodeIDAllocationData, node_id) * 8,
10709 0
10710 );
10711 assert_eq!(
10712 ::core::mem::offset_of!(NodeIDAllocationData, unique_id) * 8,
10713 16
10714 );
10715 }
10716 }
10717 }
10718 pub mod primitive {
10719 pub mod array {
10720 pub mod bit_1_0 {
10721 #[cfg_attr(
10726 not(doctest),
10727 doc = " 2048 bits + 11 bit length + 4 bit padding = 2064 bits = 258 bytes"
10728 )]
10729 pub struct Bit {
10730 pub value: ::canadensis_encoding::bits::BitArray<256>,
10736 }
10737 impl ::canadensis_encoding::DataType for Bit {
10738 const EXTENT_BYTES: Option<u32> = None;
10740 }
10741 impl ::canadensis_encoding::Message for Bit {}
10742 impl Bit {}
10743 impl ::canadensis_encoding::Serialize for Bit {
10744 fn size_bits(&self) -> usize {
10745 16 + (self.value).len() * 1 + 0
10746 }
10747 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10748 cursor.write_aligned_u16((self.value).len() as u16);
10749 (self.value).serialize(cursor);
10750 }
10751 }
10752 impl ::canadensis_encoding::Deserialize for Bit {
10753 fn deserialize(
10754 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10755 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10756 where
10757 Self: Sized,
10758 {
10759 Ok(Bit {
10760 value: {
10761 {
10762 let length = cursor.read_u16() as _;
10763 ::canadensis_encoding::bits::BitArray::deserialize(
10764 length, cursor,
10765 )
10766 }
10767 },
10768 })
10769 }
10770 }
10771 }
10772 pub mod integer16_1_0 {
10773 pub struct Integer16 {
10778 pub value: ::heapless::Vec<i16, 128>,
10784 }
10785 impl ::canadensis_encoding::DataType for Integer16 {
10786 const EXTENT_BYTES: Option<u32> = None;
10788 }
10789 impl ::canadensis_encoding::Message for Integer16 {}
10790 impl Integer16 {}
10791 impl ::canadensis_encoding::Serialize for Integer16 {
10792 fn size_bits(&self) -> usize {
10793 8 + (self.value).len() * 16 + 0
10794 }
10795 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10796 cursor.write_aligned_u8((self.value).len() as u8);
10797 for value in (self.value).iter() {
10798 cursor.write_u16(*value as u16);
10799 }
10800 }
10801 }
10802 impl ::canadensis_encoding::Deserialize for Integer16 {
10803 fn deserialize(
10804 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10805 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10806 where
10807 Self: Sized,
10808 {
10809 Ok(Integer16 {
10810 value: {
10811 let length = cursor.read_u8() as _;
10812 if length <= 128 {
10813 let mut elements = ::heapless::Vec::new();
10814 for _ in 0..length {
10815 let _ = elements.push(cursor.read_u16() as _);
10816 }
10817 elements
10818 } else {
10819 return Err(
10820 ::canadensis_encoding::DeserializeError::ArrayLength,
10821 );
10822 }
10823 },
10824 })
10825 }
10826 }
10827 }
10828 pub mod integer32_1_0 {
10829 pub struct Integer32 {
10834 pub value: ::heapless::Vec<i32, 64>,
10840 }
10841 impl ::canadensis_encoding::DataType for Integer32 {
10842 const EXTENT_BYTES: Option<u32> = None;
10844 }
10845 impl ::canadensis_encoding::Message for Integer32 {}
10846 impl Integer32 {}
10847 impl ::canadensis_encoding::Serialize for Integer32 {
10848 fn size_bits(&self) -> usize {
10849 8 + (self.value).len() * 32 + 0
10850 }
10851 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10852 cursor.write_aligned_u8((self.value).len() as u8);
10853 for value in (self.value).iter() {
10854 cursor.write_u32(*value as u32);
10855 }
10856 }
10857 }
10858 impl ::canadensis_encoding::Deserialize for Integer32 {
10859 fn deserialize(
10860 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10861 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10862 where
10863 Self: Sized,
10864 {
10865 Ok(Integer32 {
10866 value: {
10867 let length = cursor.read_u8() as _;
10868 if length <= 64 {
10869 let mut elements = ::heapless::Vec::new();
10870 for _ in 0..length {
10871 let _ = elements.push(cursor.read_u32() as _);
10872 }
10873 elements
10874 } else {
10875 return Err(
10876 ::canadensis_encoding::DeserializeError::ArrayLength,
10877 );
10878 }
10879 },
10880 })
10881 }
10882 }
10883 }
10884 pub mod integer64_1_0 {
10885 pub struct Integer64 {
10890 pub value: ::heapless::Vec<i64, 32>,
10896 }
10897 impl ::canadensis_encoding::DataType for Integer64 {
10898 const EXTENT_BYTES: Option<u32> = None;
10900 }
10901 impl ::canadensis_encoding::Message for Integer64 {}
10902 impl Integer64 {}
10903 impl ::canadensis_encoding::Serialize for Integer64 {
10904 fn size_bits(&self) -> usize {
10905 8 + (self.value).len() * 64 + 0
10906 }
10907 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10908 cursor.write_aligned_u8((self.value).len() as u8);
10909 for value in (self.value).iter() {
10910 cursor.write_u64(*value as u64);
10911 }
10912 }
10913 }
10914 impl ::canadensis_encoding::Deserialize for Integer64 {
10915 fn deserialize(
10916 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10917 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10918 where
10919 Self: Sized,
10920 {
10921 Ok(Integer64 {
10922 value: {
10923 let length = cursor.read_u8() as _;
10924 if length <= 32 {
10925 let mut elements = ::heapless::Vec::new();
10926 for _ in 0..length {
10927 let _ = elements.push(cursor.read_u64() as _);
10928 }
10929 elements
10930 } else {
10931 return Err(
10932 ::canadensis_encoding::DeserializeError::ArrayLength,
10933 );
10934 }
10935 },
10936 })
10937 }
10938 }
10939 }
10940 pub mod integer8_1_0 {
10941 pub struct Integer8 {
10946 pub value: ::heapless::Vec<i8, 256>,
10952 }
10953 impl ::canadensis_encoding::DataType for Integer8 {
10954 const EXTENT_BYTES: Option<u32> = None;
10956 }
10957 impl ::canadensis_encoding::Message for Integer8 {}
10958 impl Integer8 {}
10959 impl ::canadensis_encoding::Serialize for Integer8 {
10960 fn size_bits(&self) -> usize {
10961 16 + (self.value).len() * 8 + 0
10962 }
10963 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
10964 cursor.write_aligned_u16((self.value).len() as u16);
10965 for value in (self.value).iter() {
10966 cursor.write_u8(*value as u8);
10967 }
10968 }
10969 }
10970 impl ::canadensis_encoding::Deserialize for Integer8 {
10971 fn deserialize(
10972 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
10973 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
10974 where
10975 Self: Sized,
10976 {
10977 Ok(Integer8 {
10978 value: {
10979 let length = cursor.read_u16() as _;
10980 if length <= 256 {
10981 let mut elements = ::heapless::Vec::new();
10982 for _ in 0..length {
10983 let _ = elements.push(cursor.read_u8() as _);
10984 }
10985 elements
10986 } else {
10987 return Err(
10988 ::canadensis_encoding::DeserializeError::ArrayLength,
10989 );
10990 }
10991 },
10992 })
10993 }
10994 }
10995 }
10996 pub mod natural16_1_0 {
10997 pub struct Natural16 {
11002 pub value: ::heapless::Vec<u16, 128>,
11008 }
11009 impl ::canadensis_encoding::DataType for Natural16 {
11010 const EXTENT_BYTES: Option<u32> = None;
11012 }
11013 impl ::canadensis_encoding::Message for Natural16 {}
11014 impl Natural16 {}
11015 impl ::canadensis_encoding::Serialize for Natural16 {
11016 fn size_bits(&self) -> usize {
11017 8 + (self.value).len() * 16 + 0
11018 }
11019 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11020 cursor.write_aligned_u8((self.value).len() as u8);
11021 for value in (self.value).iter() {
11022 cursor.write_u16(*value);
11023 }
11024 }
11025 }
11026 impl ::canadensis_encoding::Deserialize for Natural16 {
11027 fn deserialize(
11028 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11029 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11030 where
11031 Self: Sized,
11032 {
11033 Ok(Natural16 {
11034 value: {
11035 let length = cursor.read_u8() as _;
11036 if length <= 128 {
11037 let mut elements = ::heapless::Vec::new();
11038 for _ in 0..length {
11039 let _ = elements.push(cursor.read_u16() as _);
11040 }
11041 elements
11042 } else {
11043 return Err(
11044 ::canadensis_encoding::DeserializeError::ArrayLength,
11045 );
11046 }
11047 },
11048 })
11049 }
11050 }
11051 }
11052 pub mod natural32_1_0 {
11053 pub struct Natural32 {
11058 pub value: ::heapless::Vec<u32, 64>,
11064 }
11065 impl ::canadensis_encoding::DataType for Natural32 {
11066 const EXTENT_BYTES: Option<u32> = None;
11068 }
11069 impl ::canadensis_encoding::Message for Natural32 {}
11070 impl Natural32 {}
11071 impl ::canadensis_encoding::Serialize for Natural32 {
11072 fn size_bits(&self) -> usize {
11073 8 + (self.value).len() * 32 + 0
11074 }
11075 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11076 cursor.write_aligned_u8((self.value).len() as u8);
11077 for value in (self.value).iter() {
11078 cursor.write_u32(*value);
11079 }
11080 }
11081 }
11082 impl ::canadensis_encoding::Deserialize for Natural32 {
11083 fn deserialize(
11084 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11085 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11086 where
11087 Self: Sized,
11088 {
11089 Ok(Natural32 {
11090 value: {
11091 let length = cursor.read_u8() as _;
11092 if length <= 64 {
11093 let mut elements = ::heapless::Vec::new();
11094 for _ in 0..length {
11095 let _ = elements.push(cursor.read_u32() as _);
11096 }
11097 elements
11098 } else {
11099 return Err(
11100 ::canadensis_encoding::DeserializeError::ArrayLength,
11101 );
11102 }
11103 },
11104 })
11105 }
11106 }
11107 }
11108 pub mod natural64_1_0 {
11109 pub struct Natural64 {
11114 pub value: ::heapless::Vec<u64, 32>,
11120 }
11121 impl ::canadensis_encoding::DataType for Natural64 {
11122 const EXTENT_BYTES: Option<u32> = None;
11124 }
11125 impl ::canadensis_encoding::Message for Natural64 {}
11126 impl Natural64 {}
11127 impl ::canadensis_encoding::Serialize for Natural64 {
11128 fn size_bits(&self) -> usize {
11129 8 + (self.value).len() * 64 + 0
11130 }
11131 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11132 cursor.write_aligned_u8((self.value).len() as u8);
11133 for value in (self.value).iter() {
11134 cursor.write_u64(*value);
11135 }
11136 }
11137 }
11138 impl ::canadensis_encoding::Deserialize for Natural64 {
11139 fn deserialize(
11140 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11141 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11142 where
11143 Self: Sized,
11144 {
11145 Ok(Natural64 {
11146 value: {
11147 let length = cursor.read_u8() as _;
11148 if length <= 32 {
11149 let mut elements = ::heapless::Vec::new();
11150 for _ in 0..length {
11151 let _ = elements.push(cursor.read_u64() as _);
11152 }
11153 elements
11154 } else {
11155 return Err(
11156 ::canadensis_encoding::DeserializeError::ArrayLength,
11157 );
11158 }
11159 },
11160 })
11161 }
11162 }
11163 }
11164 pub mod natural8_1_0 {
11165 pub struct Natural8 {
11170 pub value: ::heapless::Vec<u8, 256>,
11176 }
11177 impl ::canadensis_encoding::DataType for Natural8 {
11178 const EXTENT_BYTES: Option<u32> = None;
11180 }
11181 impl ::canadensis_encoding::Message for Natural8 {}
11182 impl Natural8 {}
11183 impl ::canadensis_encoding::Serialize for Natural8 {
11184 fn size_bits(&self) -> usize {
11185 16 + (self.value).len() * 8 + 0
11186 }
11187 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11188 cursor.write_aligned_u16((self.value).len() as u16);
11189 cursor.write_bytes(&(self.value)[..]);
11190 }
11191 }
11192 impl ::canadensis_encoding::Deserialize for Natural8 {
11193 fn deserialize(
11194 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11195 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11196 where
11197 Self: Sized,
11198 {
11199 Ok(Natural8 {
11200 value: {
11201 let length = cursor.read_u16() as _;
11202 if length <= 256 {
11203 let mut elements = ::heapless::Vec::new();
11204 for _ in 0..length {
11205 let _ = elements.push(cursor.read_u8() as _);
11206 }
11207 elements
11208 } else {
11209 return Err(
11210 ::canadensis_encoding::DeserializeError::ArrayLength,
11211 );
11212 }
11213 },
11214 })
11215 }
11216 }
11217 }
11218 pub mod real16_1_0 {
11219 #[cfg_attr(not(doctest), doc = " Exactly representable integers: [-2048, +2048]")]
11224 pub struct Real16 {
11225 pub value: ::heapless::Vec<::half::f16, 128>,
11231 }
11232 impl ::canadensis_encoding::DataType for Real16 {
11233 const EXTENT_BYTES: Option<u32> = None;
11235 }
11236 impl ::canadensis_encoding::Message for Real16 {}
11237 impl Real16 {}
11238 impl ::canadensis_encoding::Serialize for Real16 {
11239 fn size_bits(&self) -> usize {
11240 8 + (self.value).len() * 16 + 0
11241 }
11242 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11243 cursor.write_aligned_u8((self.value).len() as u8);
11244 for value in (self.value).iter() {
11245 cursor.write_f16(*value);
11246 }
11247 }
11248 }
11249 impl ::canadensis_encoding::Deserialize for Real16 {
11250 fn deserialize(
11251 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11252 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11253 where
11254 Self: Sized,
11255 {
11256 Ok(Real16 {
11257 value: {
11258 let length = cursor.read_u8() as _;
11259 if length <= 128 {
11260 let mut elements = ::heapless::Vec::new();
11261 for _ in 0..length {
11262 let _ = elements.push(cursor.read_f16());
11263 }
11264 elements
11265 } else {
11266 return Err(
11267 ::canadensis_encoding::DeserializeError::ArrayLength,
11268 );
11269 }
11270 },
11271 })
11272 }
11273 }
11274 }
11275 pub mod real32_1_0 {
11276 #[cfg_attr(
11281 not(doctest),
11282 doc = " Exactly representable integers: [-16777216, +16777216]"
11283 )]
11284 pub struct Real32 {
11285 pub value: ::heapless::Vec<f32, 64>,
11291 }
11292 impl ::canadensis_encoding::DataType for Real32 {
11293 const EXTENT_BYTES: Option<u32> = None;
11295 }
11296 impl ::canadensis_encoding::Message for Real32 {}
11297 impl Real32 {}
11298 impl ::canadensis_encoding::Serialize for Real32 {
11299 fn size_bits(&self) -> usize {
11300 8 + (self.value).len() * 32 + 0
11301 }
11302 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11303 cursor.write_aligned_u8((self.value).len() as u8);
11304 for value in (self.value).iter() {
11305 cursor.write_f32(*value);
11306 }
11307 }
11308 }
11309 impl ::canadensis_encoding::Deserialize for Real32 {
11310 fn deserialize(
11311 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11312 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11313 where
11314 Self: Sized,
11315 {
11316 Ok(Real32 {
11317 value: {
11318 let length = cursor.read_u8() as _;
11319 if length <= 64 {
11320 let mut elements = ::heapless::Vec::new();
11321 for _ in 0..length {
11322 let _ = elements.push(cursor.read_f32());
11323 }
11324 elements
11325 } else {
11326 return Err(
11327 ::canadensis_encoding::DeserializeError::ArrayLength,
11328 );
11329 }
11330 },
11331 })
11332 }
11333 }
11334 }
11335 pub mod real64_1_0 {
11336 #[cfg_attr(
11341 not(doctest),
11342 doc = " Exactly representable integers: [-2**53, +2**53]"
11343 )]
11344 pub struct Real64 {
11345 pub value: ::heapless::Vec<f64, 32>,
11351 }
11352 impl ::canadensis_encoding::DataType for Real64 {
11353 const EXTENT_BYTES: Option<u32> = None;
11355 }
11356 impl ::canadensis_encoding::Message for Real64 {}
11357 impl Real64 {}
11358 impl ::canadensis_encoding::Serialize for Real64 {
11359 fn size_bits(&self) -> usize {
11360 8 + (self.value).len() * 64 + 0
11361 }
11362 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11363 cursor.write_aligned_u8((self.value).len() as u8);
11364 for value in (self.value).iter() {
11365 cursor.write_f64(*value);
11366 }
11367 }
11368 }
11369 impl ::canadensis_encoding::Deserialize for Real64 {
11370 fn deserialize(
11371 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11372 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11373 where
11374 Self: Sized,
11375 {
11376 Ok(Real64 {
11377 value: {
11378 let length = cursor.read_u8() as _;
11379 if length <= 32 {
11380 let mut elements = ::heapless::Vec::new();
11381 for _ in 0..length {
11382 let _ = elements.push(cursor.read_f64());
11383 }
11384 elements
11385 } else {
11386 return Err(
11387 ::canadensis_encoding::DeserializeError::ArrayLength,
11388 );
11389 }
11390 },
11391 })
11392 }
11393 }
11394 }
11395 }
11396 pub mod empty_1_0 {
11397 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
11402 #[repr(C, packed)]
11403 pub struct Empty {}
11404 impl ::canadensis_encoding::DataType for Empty {
11405 const EXTENT_BYTES: Option<u32> = None;
11407 }
11408 impl ::canadensis_encoding::Message for Empty {}
11409 impl Empty {}
11410 impl ::canadensis_encoding::Serialize for Empty {
11411 fn size_bits(&self) -> usize {
11412 0
11413 }
11414 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11415 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
11416 }
11417 }
11418 impl ::canadensis_encoding::Deserialize for Empty {
11419 fn deserialize(
11420 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11421 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11422 where
11423 Self: Sized,
11424 {
11425 Ok(Self::deserialize_zero_copy(cursor))
11426 }
11427 }
11428 #[test]
11429 fn test_layout() {
11430 assert_eq!(::core::mem::size_of::<Empty>() * 8, 0);
11431 }
11432 }
11433 pub mod scalar {
11434 pub mod bit_1_0 {
11435 pub struct Bit {
11440 pub value: bool,
11446 }
11447 impl ::canadensis_encoding::DataType for Bit {
11448 const EXTENT_BYTES: Option<u32> = None;
11450 }
11451 impl ::canadensis_encoding::Message for Bit {}
11452 impl Bit {}
11453 impl ::canadensis_encoding::Serialize for Bit {
11454 fn size_bits(&self) -> usize {
11455 8
11456 }
11457 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11458 cursor.write_bool(self.value);
11459 }
11460 }
11461 impl ::canadensis_encoding::Deserialize for Bit {
11462 fn deserialize(
11463 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11464 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11465 where
11466 Self: Sized,
11467 {
11468 Ok(Bit {
11469 value: { cursor.read_bool() },
11470 })
11471 }
11472 }
11473 }
11474 pub mod integer16_1_0 {
11475 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
11480 #[repr(C, packed)]
11481 pub struct Integer16 {
11482 pub value: i16,
11488 }
11489 impl ::canadensis_encoding::DataType for Integer16 {
11490 const EXTENT_BYTES: Option<u32> = None;
11492 }
11493 impl ::canadensis_encoding::Message for Integer16 {}
11494 impl Integer16 {}
11495 impl ::canadensis_encoding::Serialize for Integer16 {
11496 fn size_bits(&self) -> usize {
11497 16
11498 }
11499 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11500 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
11501 }
11502 }
11503 impl ::canadensis_encoding::Deserialize for Integer16 {
11504 fn deserialize(
11505 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11506 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11507 where
11508 Self: Sized,
11509 {
11510 Ok(Self::deserialize_zero_copy(cursor))
11511 }
11512 }
11513 #[test]
11514 fn test_layout() {
11515 assert_eq!(::core::mem::size_of::<Integer16>() * 8, 16);
11516 assert_eq!(::core::mem::offset_of!(Integer16, value) * 8, 0);
11517 }
11518 }
11519 pub mod integer32_1_0 {
11520 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
11525 #[repr(C, packed)]
11526 pub struct Integer32 {
11527 pub value: i32,
11533 }
11534 impl ::canadensis_encoding::DataType for Integer32 {
11535 const EXTENT_BYTES: Option<u32> = None;
11537 }
11538 impl ::canadensis_encoding::Message for Integer32 {}
11539 impl Integer32 {}
11540 impl ::canadensis_encoding::Serialize for Integer32 {
11541 fn size_bits(&self) -> usize {
11542 32
11543 }
11544 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11545 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
11546 }
11547 }
11548 impl ::canadensis_encoding::Deserialize for Integer32 {
11549 fn deserialize(
11550 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11551 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11552 where
11553 Self: Sized,
11554 {
11555 Ok(Self::deserialize_zero_copy(cursor))
11556 }
11557 }
11558 #[test]
11559 fn test_layout() {
11560 assert_eq!(::core::mem::size_of::<Integer32>() * 8, 32);
11561 assert_eq!(::core::mem::offset_of!(Integer32, value) * 8, 0);
11562 }
11563 }
11564 pub mod integer64_1_0 {
11565 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
11570 #[repr(C, packed)]
11571 pub struct Integer64 {
11572 pub value: i64,
11578 }
11579 impl ::canadensis_encoding::DataType for Integer64 {
11580 const EXTENT_BYTES: Option<u32> = None;
11582 }
11583 impl ::canadensis_encoding::Message for Integer64 {}
11584 impl Integer64 {}
11585 impl ::canadensis_encoding::Serialize for Integer64 {
11586 fn size_bits(&self) -> usize {
11587 64
11588 }
11589 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11590 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
11591 }
11592 }
11593 impl ::canadensis_encoding::Deserialize for Integer64 {
11594 fn deserialize(
11595 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11596 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11597 where
11598 Self: Sized,
11599 {
11600 Ok(Self::deserialize_zero_copy(cursor))
11601 }
11602 }
11603 #[test]
11604 fn test_layout() {
11605 assert_eq!(::core::mem::size_of::<Integer64>() * 8, 64);
11606 assert_eq!(::core::mem::offset_of!(Integer64, value) * 8, 0);
11607 }
11608 }
11609 pub mod integer8_1_0 {
11610 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
11615 #[repr(C, packed)]
11616 pub struct Integer8 {
11617 pub value: i8,
11623 }
11624 impl ::canadensis_encoding::DataType for Integer8 {
11625 const EXTENT_BYTES: Option<u32> = None;
11627 }
11628 impl ::canadensis_encoding::Message for Integer8 {}
11629 impl Integer8 {}
11630 impl ::canadensis_encoding::Serialize for Integer8 {
11631 fn size_bits(&self) -> usize {
11632 8
11633 }
11634 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11635 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
11636 }
11637 }
11638 impl ::canadensis_encoding::Deserialize for Integer8 {
11639 fn deserialize(
11640 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11641 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11642 where
11643 Self: Sized,
11644 {
11645 Ok(Self::deserialize_zero_copy(cursor))
11646 }
11647 }
11648 #[test]
11649 fn test_layout() {
11650 assert_eq!(::core::mem::size_of::<Integer8>() * 8, 8);
11651 assert_eq!(::core::mem::offset_of!(Integer8, value) * 8, 0);
11652 }
11653 }
11654 pub mod natural16_1_0 {
11655 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
11660 #[repr(C, packed)]
11661 pub struct Natural16 {
11662 pub value: u16,
11668 }
11669 impl ::canadensis_encoding::DataType for Natural16 {
11670 const EXTENT_BYTES: Option<u32> = None;
11672 }
11673 impl ::canadensis_encoding::Message for Natural16 {}
11674 impl Natural16 {}
11675 impl ::canadensis_encoding::Serialize for Natural16 {
11676 fn size_bits(&self) -> usize {
11677 16
11678 }
11679 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11680 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
11681 }
11682 }
11683 impl ::canadensis_encoding::Deserialize for Natural16 {
11684 fn deserialize(
11685 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11686 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11687 where
11688 Self: Sized,
11689 {
11690 Ok(Self::deserialize_zero_copy(cursor))
11691 }
11692 }
11693 #[test]
11694 fn test_layout() {
11695 assert_eq!(::core::mem::size_of::<Natural16>() * 8, 16);
11696 assert_eq!(::core::mem::offset_of!(Natural16, value) * 8, 0);
11697 }
11698 }
11699 pub mod natural32_1_0 {
11700 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
11705 #[repr(C, packed)]
11706 pub struct Natural32 {
11707 pub value: u32,
11713 }
11714 impl ::canadensis_encoding::DataType for Natural32 {
11715 const EXTENT_BYTES: Option<u32> = None;
11717 }
11718 impl ::canadensis_encoding::Message for Natural32 {}
11719 impl Natural32 {}
11720 impl ::canadensis_encoding::Serialize for Natural32 {
11721 fn size_bits(&self) -> usize {
11722 32
11723 }
11724 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11725 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
11726 }
11727 }
11728 impl ::canadensis_encoding::Deserialize for Natural32 {
11729 fn deserialize(
11730 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11731 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11732 where
11733 Self: Sized,
11734 {
11735 Ok(Self::deserialize_zero_copy(cursor))
11736 }
11737 }
11738 #[test]
11739 fn test_layout() {
11740 assert_eq!(::core::mem::size_of::<Natural32>() * 8, 32);
11741 assert_eq!(::core::mem::offset_of!(Natural32, value) * 8, 0);
11742 }
11743 }
11744 pub mod natural64_1_0 {
11745 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
11750 #[repr(C, packed)]
11751 pub struct Natural64 {
11752 pub value: u64,
11758 }
11759 impl ::canadensis_encoding::DataType for Natural64 {
11760 const EXTENT_BYTES: Option<u32> = None;
11762 }
11763 impl ::canadensis_encoding::Message for Natural64 {}
11764 impl Natural64 {}
11765 impl ::canadensis_encoding::Serialize for Natural64 {
11766 fn size_bits(&self) -> usize {
11767 64
11768 }
11769 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11770 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
11771 }
11772 }
11773 impl ::canadensis_encoding::Deserialize for Natural64 {
11774 fn deserialize(
11775 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11776 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11777 where
11778 Self: Sized,
11779 {
11780 Ok(Self::deserialize_zero_copy(cursor))
11781 }
11782 }
11783 #[test]
11784 fn test_layout() {
11785 assert_eq!(::core::mem::size_of::<Natural64>() * 8, 64);
11786 assert_eq!(::core::mem::offset_of!(Natural64, value) * 8, 0);
11787 }
11788 }
11789 pub mod natural8_1_0 {
11790 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
11795 #[repr(C, packed)]
11796 pub struct Natural8 {
11797 pub value: u8,
11803 }
11804 impl ::canadensis_encoding::DataType for Natural8 {
11805 const EXTENT_BYTES: Option<u32> = None;
11807 }
11808 impl ::canadensis_encoding::Message for Natural8 {}
11809 impl Natural8 {}
11810 impl ::canadensis_encoding::Serialize for Natural8 {
11811 fn size_bits(&self) -> usize {
11812 8
11813 }
11814 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11815 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
11816 }
11817 }
11818 impl ::canadensis_encoding::Deserialize for Natural8 {
11819 fn deserialize(
11820 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11821 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11822 where
11823 Self: Sized,
11824 {
11825 Ok(Self::deserialize_zero_copy(cursor))
11826 }
11827 }
11828 #[test]
11829 fn test_layout() {
11830 assert_eq!(::core::mem::size_of::<Natural8>() * 8, 8);
11831 assert_eq!(::core::mem::offset_of!(Natural8, value) * 8, 0);
11832 }
11833 }
11834 pub mod real16_1_0 {
11835 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
11840 #[repr(C, packed)]
11841 pub struct Real16 {
11842 #[cfg_attr(
11843 not(doctest),
11844 doc = " Exactly representable integers: [-2048, +2048]"
11845 )]
11846 pub value: ::half::f16,
11852 }
11853 impl ::canadensis_encoding::DataType for Real16 {
11854 const EXTENT_BYTES: Option<u32> = None;
11856 }
11857 impl ::canadensis_encoding::Message for Real16 {}
11858 impl Real16 {}
11859 impl ::canadensis_encoding::Serialize for Real16 {
11860 fn size_bits(&self) -> usize {
11861 16
11862 }
11863 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11864 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
11865 }
11866 }
11867 impl ::canadensis_encoding::Deserialize for Real16 {
11868 fn deserialize(
11869 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11870 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11871 where
11872 Self: Sized,
11873 {
11874 Ok(Self::deserialize_zero_copy(cursor))
11875 }
11876 }
11877 #[test]
11878 fn test_layout() {
11879 assert_eq!(::core::mem::size_of::<Real16>() * 8, 16);
11880 assert_eq!(::core::mem::offset_of!(Real16, value) * 8, 0);
11881 }
11882 }
11883 pub mod real32_1_0 {
11884 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
11889 #[repr(C, packed)]
11890 pub struct Real32 {
11891 #[cfg_attr(
11892 not(doctest),
11893 doc = " Exactly representable integers: [-16777216, +16777216]"
11894 )]
11895 pub value: f32,
11901 }
11902 impl ::canadensis_encoding::DataType for Real32 {
11903 const EXTENT_BYTES: Option<u32> = None;
11905 }
11906 impl ::canadensis_encoding::Message for Real32 {}
11907 impl Real32 {}
11908 impl ::canadensis_encoding::Serialize for Real32 {
11909 fn size_bits(&self) -> usize {
11910 32
11911 }
11912 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11913 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
11914 }
11915 }
11916 impl ::canadensis_encoding::Deserialize for Real32 {
11917 fn deserialize(
11918 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11919 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11920 where
11921 Self: Sized,
11922 {
11923 Ok(Self::deserialize_zero_copy(cursor))
11924 }
11925 }
11926 #[test]
11927 fn test_layout() {
11928 assert_eq!(::core::mem::size_of::<Real32>() * 8, 32);
11929 assert_eq!(::core::mem::offset_of!(Real32, value) * 8, 0);
11930 }
11931 }
11932 pub mod real64_1_0 {
11933 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
11938 #[repr(C, packed)]
11939 pub struct Real64 {
11940 #[cfg_attr(
11941 not(doctest),
11942 doc = " Exactly representable integers: [-2**53, +2**53]"
11943 )]
11944 pub value: f64,
11950 }
11951 impl ::canadensis_encoding::DataType for Real64 {
11952 const EXTENT_BYTES: Option<u32> = None;
11954 }
11955 impl ::canadensis_encoding::Message for Real64 {}
11956 impl Real64 {}
11957 impl ::canadensis_encoding::Serialize for Real64 {
11958 fn size_bits(&self) -> usize {
11959 64
11960 }
11961 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
11962 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
11963 }
11964 }
11965 impl ::canadensis_encoding::Deserialize for Real64 {
11966 fn deserialize(
11967 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
11968 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
11969 where
11970 Self: Sized,
11971 {
11972 Ok(Self::deserialize_zero_copy(cursor))
11973 }
11974 }
11975 #[test]
11976 fn test_layout() {
11977 assert_eq!(::core::mem::size_of::<Real64>() * 8, 64);
11978 assert_eq!(::core::mem::offset_of!(Real64, value) * 8, 0);
11979 }
11980 }
11981 }
11982 pub mod string_1_0 {
11983 #[cfg_attr(
11988 not(doctest),
11989 doc = " A UTF8-encoded string of text.\n Since the string is represented as a dynamic array of bytes, it is not null-terminated. Like Pascal string."
11990 )]
11991 pub struct String {
11992 pub value: ::heapless::Vec<u8, 256>,
11998 }
11999 impl ::canadensis_encoding::DataType for String {
12000 const EXTENT_BYTES: Option<u32> = None;
12002 }
12003 impl ::canadensis_encoding::Message for String {}
12004 impl String {}
12005 impl ::canadensis_encoding::Serialize for String {
12006 fn size_bits(&self) -> usize {
12007 16 + (self.value).len() * 8 + 0
12008 }
12009 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12010 cursor.write_aligned_u16((self.value).len() as u16);
12011 cursor.write_bytes(&(self.value)[..]);
12012 }
12013 }
12014 impl ::canadensis_encoding::Deserialize for String {
12015 fn deserialize(
12016 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12017 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12018 where
12019 Self: Sized,
12020 {
12021 Ok(String {
12022 value: {
12023 let length = cursor.read_u16() as _;
12024 if length <= 256 {
12025 let mut elements = ::heapless::Vec::new();
12026 for _ in 0..length {
12027 let _ = elements.push(cursor.read_u8() as _);
12028 }
12029 elements
12030 } else {
12031 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
12032 }
12033 },
12034 })
12035 }
12036 }
12037 }
12038 pub mod unstructured_1_0 {
12039 #[cfg_attr(
12044 not(doctest),
12045 doc = " An unstructured collection of bytes, e.g., raw binary image."
12046 )]
12047 pub struct Unstructured {
12048 pub value: ::heapless::Vec<u8, 256>,
12054 }
12055 impl ::canadensis_encoding::DataType for Unstructured {
12056 const EXTENT_BYTES: Option<u32> = None;
12058 }
12059 impl ::canadensis_encoding::Message for Unstructured {}
12060 impl Unstructured {}
12061 impl ::canadensis_encoding::Serialize for Unstructured {
12062 fn size_bits(&self) -> usize {
12063 16 + (self.value).len() * 8 + 0
12064 }
12065 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12066 cursor.write_aligned_u16((self.value).len() as u16);
12067 cursor.write_bytes(&(self.value)[..]);
12068 }
12069 }
12070 impl ::canadensis_encoding::Deserialize for Unstructured {
12071 fn deserialize(
12072 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12073 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12074 where
12075 Self: Sized,
12076 {
12077 Ok(Unstructured {
12078 value: {
12079 let length = cursor.read_u16() as _;
12080 if length <= 256 {
12081 let mut elements = ::heapless::Vec::new();
12082 for _ in 0..length {
12083 let _ = elements.push(cursor.read_u8() as _);
12084 }
12085 elements
12086 } else {
12087 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
12088 }
12089 },
12090 })
12091 }
12092 }
12093 }
12094 }
12095 pub mod register {
12096 pub mod access_1_0 {
12097 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
12098 pub const SERVICE: ::canadensis_core::ServiceId =
12099 ::canadensis_core::ServiceId::from_truncating(384);
12100
12101 #[cfg_attr(
12106 not(doctest),
12107 doc = " Registers are strongly-typed named values used to store the configuration parameters of a node.\n This service is used to write and read a register.\n\n\n READ/WRITE BEHAVIORS\n\n The write operation is performed first, unless skipped by sending an empty value in the request.\n The server may attempt to convert the type of the supplied value to the correct type if there is a type mismatch\n (e.g. uint8 may be converted to uint16); however, servers are not required to perform implicit type conversion,\n and the rules of such conversion are not explicitly specified, so this behavior should not be relied upon.\n\n On the next step the register will be read regardless of the outcome of the write operation. As such, if the write\n operation could not be performed (e.g. due to a type mismatch or any other issue), the register will retain its old\n value. By evaluating the response the caller can determine whether the register was written successfully.\n\n The write-read sequence is not guaranteed to be atomic, meaning that external influences may cause the register to\n change its value between the write and the subsequent read operation. The caller is responsible for handling that\n case properly.\n\n The timestamp provided in the response corresponds to the time when the register was read. The timestamp may\n be empty if the server does not support timestamping or its clock is not (yet) synchronized with the network.\n\n If only read is desired, but not write, the caller shall provide a value of type 'empty'. That will signal the server\n that the write operation shall be skipped, and it will proceed to read the register immediately.\n\n If the requested register does not exist, the write operation will have no effect and the returned value will be\n empty. Existing registers should not return 'empty' when read since that would make them indistinguishable from\n nonexistent registers.\n\n\n REGISTER DEFINITION REQUIREMENTS\n\n Registers shall never change their type or flags as long as the server is running. Meaning that:\n - Mutability and persistence flags cannot change their states.\n - Read operations shall always return values of the same type and same dimensionality.\n The dimensionality requirement does not apply to inherently variable-length values such as strings and\n unstructured chunks.\n\n Register name should contain only:\n - Lowercase ASCII alphanumeric characters (a-z, 0-9)\n - Full stop (.)\n - Low line (underscore) (_)\n With the following limitations/recommendations:\n - The name shall not begin with a decimal digit (0-9).\n - The name shall neither begin nor end with a full stop.\n - A low line shall not be followed by a non-alphanumeric character.\n - The name should contain at least one full stop character.\n Other patterns and ASCII characters are reserved for special function registers (introduced below).\n\n\n ENVIRONMENT VARIABLES\n\n This section applies only to software nodes executed in a high-level operating system that supports environment\n variables or an equivalent mechanism.\n\n When a software node is launched, it is usually necessary to provide some of its configuration information early,\n particularly that which is related to Cyphal networking, before the node is started. Environment variables offer\n a convenient way of addressing this. Software nodes that support the register interface should evaluate the\n available environment variables during initialization and update their registers (whether they are stored in\n a persistent storage or in memory) accoringly. This should be completed before the first register read access.\n\n A register name is mapped to an environment variable name as follows:\n - the name is upper-cased;\n - full stop characters are replaced with double low line characters.\n For example: 'motor.inductance_dq' is mapped to 'MOTOR__INDUCTANCE_DQ'.\n\n Register values are represented in environment variables as follows:\n - string: utf-8 or platform-specific\n - unstructured: as-is\n - bit, integer*, natural*, real*: space-separated decimals\n\n If an environment variable matches the name of an existing register but its value cannot be converted to the\n register's type, an error should be raised.\n\n If an environment variable does not match the name of any register, it may be ignored. However, if the implementation\n can reliably deduce the type and purpose of the register, it may create one automatically. This provision is to\n support applications where the register schema may be altered by configuration.\n\n\n SPECIAL FUNCTION REGISTERS\n\n The following optional special function register names are defined:\n - suffix '<' is used to define an immutable persistent value that contains the maximum value\n of the respective register.\n - suffix '>' is like above, used to define the minimum value of the respective register.\n - suffix '=' is like above, used to define the default value of the respective register.\n - prefix '*' is reserved for raw memory access (to be defined later).\n Examples:\n - register name \"system.parameter\"\n - maximum value is contained in the register named \"system.parameter<\" (optional)\n - minimum value is contained in the register named \"system.parameter>\" (optional)\n - default value is contained in the register named \"system.parameter=\" (optional)\n\n The type and dimensionality of the special function registers containing the minimum, maximum, and the default\n value of a register shall be the same as those of the register they relate to.\n\n If a written value exceeds the minimum/maximum specified by the respective special function registers,\n the server may either adjust the value automatically, or to retain the old value, depending on which behavior\n suits the objectives of the application better.\n The values of registers containing non-scalar numerical entities should be compared elementwise.\n\n\n STANDARD REGISTERS\n\n The following table specifies the register name patterns that are reserved by the specification for\n common functions. These conventions are not mandatory to follow, but implementers are recommended to adhere because\n they enable enhanced introspection capabilities and simplify device configuration and diagnostics.\n\n REGISTER NAME PATTERN TYPE FLAGS RECOMMENDED DEFAULT\n =====================================================================================================================\n\n uavcan.node.id natural16[1] mutable, persistent 65535 (unset/PnP)\n\n Contains the node-ID of the local node. Values above the maximum valid node-ID for the current transport\n indicate that the node-ID is not set; if plug-and-play is supported, it will be used by the node to obtain an\n automatic node-ID. Invalid values other than 65535 should be avoided for consistency.\n\n ---------------------------------------------------------------------------------------------------------------------\n\n uavcan.node.description string mutable, persistent (empty)\n\n User/integrator-defined, human-readable description of this specific node.\n This is intended for use by a system integrator and should not be set by the manufacturer of a component.\n For example: on a quad-rotor drone this might read \"motor 2\" for one of the ESC nodes.\n\n ---------------------------------------------------------------------------------------------------------------------\n\n uavcan.pub.PORT_NAME.id natural16[1] mutable, persistent 65535 (unset, invalid)\n uavcan.sub.PORT_NAME.id ditto ditto ditto\n uavcan.cln.PORT_NAME.id ditto ditto ditto\n uavcan.srv.PORT_NAME.id ditto ditto ditto\n\n Publication/subscription/client/server port-ID, respectively. These registers are configured by the system integrator\n or an autoconfiguration authority when the node is first connected to a network.\n\n The \"PORT_NAME\" defines the human-friendly name of the port, which is related to the corresponding function\n or a network service supported by the node. The name shall match the following POSIX ERE expression:\n\n [a-zA-Z_][a-zA-Z0-9_.]*\n\n The names are defined by the vendor of the node. The user/integrator is expected to understand their meaning and\n relation to the functional capabilities of the node by reading the technical documentation provided by the vendor.\n\n A port whose port-ID register is unset (invalid value) remains inactive (unused); the corresponding function may\n be disabled. For example, a register named \"uavcan.pub.measurement.id\" defines the subject-ID of a measurement\n published by this node; if the register contains an invalid value (above the maximum valid subject-ID),\n said measurement is not published.\n\n The same name is used in other similar registers defined below. Network introspection and autoconfiguration tools\n will expect to find a register of this form for every configurable port supported by the node.\n\n ---------------------------------------------------------------------------------------------------------------------\n\n uavcan.pub.PORT_NAME.type string immutable, persistent N/A\n uavcan.sub.PORT_NAME.type ditto ditto ditto\n uavcan.cln.PORT_NAME.type ditto ditto ditto\n uavcan.srv.PORT_NAME.type ditto ditto ditto\n\n Publication/subscription/client/server full data type name and dot-separated version numbers, respectively.\n These registers are set by the vendor once and typically they are to remain unchanged (hence \"immutable\").\n The \"PORT_NAME\" defines the human-friendly name of the port as specified above.\n For example, a register named \"uavcan.pub.measurement.type\" may contain \"uavcan.si.sample.angle.Quaternion.1.0\".\n\n ---------------------------------------------------------------------------------------------------------------------\n\n uavcan.diagnostic.*\n\n Prefix reserved for future use.\n\n ---------------------------------------------------------------------------------------------------------------------\n\n uavcan.can.bitrate natural32[2] implementation-defined implementation-defined\n uavcan.can.iface string mutable, persistent implementation-defined\n\n These registers are only relevant for nodes that support Cyphal/CAN.\n\n uavcan.can.bitrate defines the CAN bus bit rate: the first value is the arbitration bit rate, the second is the\n data phase bit rate. Nodes that support only Classic CAN should ignore the second value. Nodes that support CAN FD\n should initialize in the Classic CAN mode (MTU 8 bytes, BRS flag not set) if the values are equal. If CAN bitrate\n is not configurable or is always auto-detected, this register may be omitted or made immutable; otherwise it should\n be mutable and persistent.\n\n uavcan.can.iface is only relevant for software nodes or nodes that are capable of using different CAN interfaces.\n The value is a space-separated list of CAN interface names to use. The name format is implementation-defined\n (for example, \"can0\").\n\n ---------------------------------------------------------------------------------------------------------------------\n\n uavcan.udp.*\n\n Prefix reserved for future use.\n\n ---------------------------------------------------------------------------------------------------------------------#\n\n uavcan.serial.*\n\n Prefix reserved for future use.\n\n ---------------------------------------------------------------------------------------------------------------------"
12108 )]
12109 pub struct AccessRequest {
12110 #[cfg_attr(
12111 not(doctest),
12112 doc = " The name of the accessed register. Shall not be empty.\n Use the List service to obtain the list of registers on the node."
12113 )]
12114 pub name: crate::uavcan::register::name_1_0::Name,
12120 #[cfg_attr(
12121 not(doctest),
12122 doc = " Value to be written. Empty if no write is required."
12123 )]
12124 pub value: crate::uavcan::register::value_1_0::Value,
12130 }
12131 impl ::canadensis_encoding::DataType for AccessRequest {
12132 const EXTENT_BYTES: Option<u32> = None;
12134 }
12135 impl ::canadensis_encoding::Request for AccessRequest {}
12136 impl AccessRequest {}
12137 impl ::canadensis_encoding::Serialize for AccessRequest {
12138 fn size_bits(&self) -> usize {
12139 (self.name).size_bits() + (self.value).size_bits() + 0
12140 }
12141 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12142 cursor.write_composite(&self.name);
12143 cursor.write_composite(&self.value);
12144 }
12145 }
12146 impl ::canadensis_encoding::Deserialize for AccessRequest {
12147 fn deserialize(
12148 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12149 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12150 where
12151 Self: Sized,
12152 {
12153 Ok(AccessRequest {
12154 name: { cursor.read_composite()? },
12155 value: { cursor.read_composite()? },
12156 })
12157 }
12158 }
12159
12160 pub struct AccessResponse {
12165 #[cfg_attr(
12166 not(doctest),
12167 doc = " The moment of time when the register was read (not written).\n Zero if the server does not support timestamping."
12168 )]
12169 pub timestamp:
12175 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
12176 #[cfg_attr(
12177 not(doctest),
12178 doc = " Mutable means that the register can be written using this service.\n Immutable registers cannot be written, but that doesn't imply that their values are constant (unchanging)."
12179 )]
12180 pub mutable: bool,
12186 #[cfg_attr(
12187 not(doctest),
12188 doc = " Persistence means that the register retains its value permanently across power cycles or any other changes\n in the state of the server, until it is explicitly overwritten (either via Cyphal, any other interface,\n or by the device itself).\n\n The server is recommended to manage persistence automatically by committing changed register values to a\n non-volatile storage automatically as necessary. If automatic persistence management is not implemented, it\n can be controlled manually via the standard service uavcan.node.ExecuteCommand. The same service can be used\n to return the configuration to a factory-default state. Please refer to its definition for more information.\n\n Consider the following examples:\n - Configuration parameters are usually both mutable and persistent.\n - Diagnostic values are usually immutable and non-persisient.\n - Registers that trigger an activity when written are typically mutable but non-persisient.\n - Registers that contain factory-programmed values such as calibration coefficients that can't\n be changed are typically immutable but persistent."
12189 )]
12190 pub persistent: bool,
12196 #[cfg_attr(
12198 not(doctest),
12199 doc = " The value of the register when it was read (beware of race conditions).\n Registers never change their type and dimensionality while the node is running.\n Empty value means that the register does not exist (in this case the flags should be cleared/ignored).\n By comparing the returned value against the write request the caller can determine whether the register\n was written successfully, unless write was not requested.\n An empty value shall never be returned for an existing register."
12200 )]
12201 pub value: crate::uavcan::register::value_1_0::Value,
12207 }
12208 impl ::canadensis_encoding::DataType for AccessResponse {
12209 const EXTENT_BYTES: Option<u32> = None;
12211 }
12212 impl ::canadensis_encoding::Response for AccessResponse {}
12213 impl AccessResponse {}
12214 impl ::canadensis_encoding::Serialize for AccessResponse {
12215 fn size_bits(&self) -> usize {
12216 56 + 1 + 1 + 6 + (self.value).size_bits() + 0
12217 }
12218 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12219 cursor.write_composite(&self.timestamp);
12220 cursor.write_bool(self.mutable);
12221 cursor.write_bool(self.persistent);
12222 cursor.skip_6();
12223 cursor.write_composite(&self.value);
12224 }
12225 }
12226 impl ::canadensis_encoding::Deserialize for AccessResponse {
12227 fn deserialize(
12228 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12229 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12230 where
12231 Self: Sized,
12232 {
12233 Ok(AccessResponse {
12234 timestamp: { cursor.read_composite()? },
12235 mutable: { cursor.read_bool() },
12236 persistent: { cursor.read_bool() },
12237 value: {
12238 cursor.skip_6();
12239 cursor.read_composite()?
12240 },
12241 })
12242 }
12243 }
12244 }
12245 pub mod list_1_0 {
12246 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
12247 pub const SERVICE: ::canadensis_core::ServiceId =
12248 ::canadensis_core::ServiceId::from_truncating(385);
12249
12250 #[cfg_attr(
12255 not(doctest),
12256 doc = " This service allows the caller to discover the names of all registers available on the server\n by iterating the index field from zero until an empty name is returned.\n\n The ordering of the registers shall remain constant while the server is running.\n The ordering is not guaranteed to remain unchanged when the server node is restarted."
12257 )]
12258 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
12259 #[repr(C, packed)]
12260 pub struct ListRequest {
12261 pub index: u16,
12267 }
12268 impl ::canadensis_encoding::DataType for ListRequest {
12269 const EXTENT_BYTES: Option<u32> = None;
12271 }
12272 impl ::canadensis_encoding::Request for ListRequest {}
12273 impl ListRequest {}
12274 impl ::canadensis_encoding::Serialize for ListRequest {
12275 fn size_bits(&self) -> usize {
12276 16
12277 }
12278 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12279 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
12280 }
12281 }
12282 impl ::canadensis_encoding::Deserialize for ListRequest {
12283 fn deserialize(
12284 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12285 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12286 where
12287 Self: Sized,
12288 {
12289 Ok(Self::deserialize_zero_copy(cursor))
12290 }
12291 }
12292 #[test]
12293 fn test_layout() {
12294 assert_eq!(::core::mem::size_of::<ListRequest>() * 8, 16);
12295 assert_eq!(::core::mem::offset_of!(ListRequest, index) * 8, 0);
12296 }
12297
12298 pub struct ListResponse {
12303 #[cfg_attr(
12304 not(doctest),
12305 doc = " Empty name in response means that the index is out of bounds, i.e., discovery is finished."
12306 )]
12307 pub name: crate::uavcan::register::name_1_0::Name,
12313 }
12314 impl ::canadensis_encoding::DataType for ListResponse {
12315 const EXTENT_BYTES: Option<u32> = None;
12317 }
12318 impl ::canadensis_encoding::Response for ListResponse {}
12319 impl ListResponse {}
12320 impl ::canadensis_encoding::Serialize for ListResponse {
12321 fn size_bits(&self) -> usize {
12322 (self.name).size_bits() + 0
12323 }
12324 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12325 cursor.write_composite(&self.name);
12326 }
12327 }
12328 impl ::canadensis_encoding::Deserialize for ListResponse {
12329 fn deserialize(
12330 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12331 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12332 where
12333 Self: Sized,
12334 {
12335 Ok(ListResponse {
12336 name: { cursor.read_composite()? },
12337 })
12338 }
12339 }
12340 }
12341 pub mod name_1_0 {
12342 #[cfg_attr(not(doctest), doc = " An UTF8-encoded register name.")]
12347 pub struct Name {
12348 pub name: ::heapless::Vec<u8, 255>,
12354 }
12355 impl ::canadensis_encoding::DataType for Name {
12356 const EXTENT_BYTES: Option<u32> = None;
12358 }
12359 impl ::canadensis_encoding::Message for Name {}
12360 impl Name {}
12361 impl ::canadensis_encoding::Serialize for Name {
12362 fn size_bits(&self) -> usize {
12363 8 + (self.name).len() * 8 + 0
12364 }
12365 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12366 cursor.write_aligned_u8((self.name).len() as u8);
12367 cursor.write_bytes(&(self.name)[..]);
12368 }
12369 }
12370 impl ::canadensis_encoding::Deserialize for Name {
12371 fn deserialize(
12372 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12373 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12374 where
12375 Self: Sized,
12376 {
12377 Ok(Name {
12378 name: {
12379 let length = cursor.read_u8() as _;
12380 if length <= 255 {
12381 let mut elements = ::heapless::Vec::new();
12382 for _ in 0..length {
12383 let _ = elements.push(cursor.read_u8() as _);
12384 }
12385 elements
12386 } else {
12387 return Err(::canadensis_encoding::DeserializeError::ArrayLength);
12388 }
12389 },
12390 })
12391 }
12392 }
12393 }
12394 pub mod value_1_0 {
12395 #[cfg_attr(
12400 not(doctest),
12401 doc = " This union contains all possible value types supported by the register protocol.\n Numeric types can be either scalars or arrays; the former is a special case of the latter."
12402 )]
12403 pub enum Value {
12404 #[cfg_attr(not(doctest), doc = " Tag 0 Used to represent an undefined value")]
12405 Empty(crate::uavcan::primitive::empty_1_0::Empty),
12408 #[cfg_attr(not(doctest), doc = " Tag 1 UTF-8 encoded text")]
12409 String(crate::uavcan::primitive::string_1_0::String),
12412 #[cfg_attr(not(doctest), doc = " Tag 2 Raw unstructured binary image")]
12413 Unstructured(crate::uavcan::primitive::unstructured_1_0::Unstructured),
12416 #[cfg_attr(not(doctest), doc = " Tag 3 Bit array")]
12417 Bit(crate::uavcan::primitive::array::bit_1_0::Bit),
12420 #[cfg_attr(not(doctest), doc = " Tag 4")]
12421 Integer64(crate::uavcan::primitive::array::integer64_1_0::Integer64),
12424 #[cfg_attr(not(doctest), doc = " Tag 5")]
12425 Integer32(crate::uavcan::primitive::array::integer32_1_0::Integer32),
12428 #[cfg_attr(not(doctest), doc = " Tag 6")]
12429 Integer16(crate::uavcan::primitive::array::integer16_1_0::Integer16),
12432 #[cfg_attr(not(doctest), doc = " Tag 7")]
12433 Integer8(crate::uavcan::primitive::array::integer8_1_0::Integer8),
12436 #[cfg_attr(not(doctest), doc = " Tag 8")]
12437 Natural64(crate::uavcan::primitive::array::natural64_1_0::Natural64),
12440 #[cfg_attr(not(doctest), doc = " Tag 9")]
12441 Natural32(crate::uavcan::primitive::array::natural32_1_0::Natural32),
12444 #[cfg_attr(not(doctest), doc = " Tag 10")]
12445 Natural16(crate::uavcan::primitive::array::natural16_1_0::Natural16),
12448 #[cfg_attr(not(doctest), doc = " Tag 11")]
12449 Natural8(crate::uavcan::primitive::array::natural8_1_0::Natural8),
12452 #[cfg_attr(
12453 not(doctest),
12454 doc = " Tag 12 Exactly representable integers: [-2**53, +2**53]"
12455 )]
12456 Real64(crate::uavcan::primitive::array::real64_1_0::Real64),
12459 #[cfg_attr(
12460 not(doctest),
12461 doc = " Tag 13 Exactly representable integers: [-16777216, +16777216]"
12462 )]
12463 Real32(crate::uavcan::primitive::array::real32_1_0::Real32),
12466 #[cfg_attr(
12467 not(doctest),
12468 doc = " Tag 14 Exactly representable integers: [-2048, +2048]\n Empty and the tag\n 258 bytes per field max and the tag"
12469 )]
12470 Real16(crate::uavcan::primitive::array::real16_1_0::Real16),
12473 }
12474 impl ::canadensis_encoding::DataType for Value {
12475 const EXTENT_BYTES: Option<u32> = None;
12477 }
12478 impl ::canadensis_encoding::Message for Value {}
12479 impl Value {}
12480 impl ::canadensis_encoding::Serialize for Value {
12481 fn size_bits(&self) -> usize {
12482 8 + match self {
12483 Value::Empty(inner) => 0,
12484 Value::String(inner) => (inner).size_bits(),
12485 Value::Unstructured(inner) => (inner).size_bits(),
12486 Value::Bit(inner) => (inner).size_bits(),
12487 Value::Integer64(inner) => (inner).size_bits(),
12488 Value::Integer32(inner) => (inner).size_bits(),
12489 Value::Integer16(inner) => (inner).size_bits(),
12490 Value::Integer8(inner) => (inner).size_bits(),
12491 Value::Natural64(inner) => (inner).size_bits(),
12492 Value::Natural32(inner) => (inner).size_bits(),
12493 Value::Natural16(inner) => (inner).size_bits(),
12494 Value::Natural8(inner) => (inner).size_bits(),
12495 Value::Real64(inner) => (inner).size_bits(),
12496 Value::Real32(inner) => (inner).size_bits(),
12497 Value::Real16(inner) => (inner).size_bits(),
12498 }
12499 }
12500 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12501 match self {
12502 Value::Empty(inner) => {
12503 cursor.write_aligned_u8(0);
12504 cursor.write_composite(inner);
12505 }
12506 Value::String(inner) => {
12507 cursor.write_aligned_u8(1);
12508 cursor.write_composite(inner);
12509 }
12510 Value::Unstructured(inner) => {
12511 cursor.write_aligned_u8(2);
12512 cursor.write_composite(inner);
12513 }
12514 Value::Bit(inner) => {
12515 cursor.write_aligned_u8(3);
12516 cursor.write_composite(inner);
12517 }
12518 Value::Integer64(inner) => {
12519 cursor.write_aligned_u8(4);
12520 cursor.write_composite(inner);
12521 }
12522 Value::Integer32(inner) => {
12523 cursor.write_aligned_u8(5);
12524 cursor.write_composite(inner);
12525 }
12526 Value::Integer16(inner) => {
12527 cursor.write_aligned_u8(6);
12528 cursor.write_composite(inner);
12529 }
12530 Value::Integer8(inner) => {
12531 cursor.write_aligned_u8(7);
12532 cursor.write_composite(inner);
12533 }
12534 Value::Natural64(inner) => {
12535 cursor.write_aligned_u8(8);
12536 cursor.write_composite(inner);
12537 }
12538 Value::Natural32(inner) => {
12539 cursor.write_aligned_u8(9);
12540 cursor.write_composite(inner);
12541 }
12542 Value::Natural16(inner) => {
12543 cursor.write_aligned_u8(10);
12544 cursor.write_composite(inner);
12545 }
12546 Value::Natural8(inner) => {
12547 cursor.write_aligned_u8(11);
12548 cursor.write_composite(inner);
12549 }
12550 Value::Real64(inner) => {
12551 cursor.write_aligned_u8(12);
12552 cursor.write_composite(inner);
12553 }
12554 Value::Real32(inner) => {
12555 cursor.write_aligned_u8(13);
12556 cursor.write_composite(inner);
12557 }
12558 Value::Real16(inner) => {
12559 cursor.write_aligned_u8(14);
12560 cursor.write_composite(inner);
12561 }
12562 }
12563 }
12564 }
12565 impl ::canadensis_encoding::Deserialize for Value {
12566 fn deserialize(
12567 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12568 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12569 where
12570 Self: Sized,
12571 {
12572 match cursor.read_aligned_u8() as _ {
12573 0 => Ok(Value::Empty({ cursor.read_composite()? })),
12574 1 => Ok(Value::String({ cursor.read_composite()? })),
12575 2 => Ok(Value::Unstructured({ cursor.read_composite()? })),
12576 3 => Ok(Value::Bit({ cursor.read_composite()? })),
12577 4 => Ok(Value::Integer64({ cursor.read_composite()? })),
12578 5 => Ok(Value::Integer32({ cursor.read_composite()? })),
12579 6 => Ok(Value::Integer16({ cursor.read_composite()? })),
12580 7 => Ok(Value::Integer8({ cursor.read_composite()? })),
12581 8 => Ok(Value::Natural64({ cursor.read_composite()? })),
12582 9 => Ok(Value::Natural32({ cursor.read_composite()? })),
12583 10 => Ok(Value::Natural16({ cursor.read_composite()? })),
12584 11 => Ok(Value::Natural8({ cursor.read_composite()? })),
12585 12 => Ok(Value::Real64({ cursor.read_composite()? })),
12586 13 => Ok(Value::Real32({ cursor.read_composite()? })),
12587 14 => Ok(Value::Real16({ cursor.read_composite()? })),
12588 _ => Err(::canadensis_encoding::DeserializeError::UnionTag),
12589 }
12590 }
12591 }
12592 }
12593 }
12594 pub mod si {
12595 pub mod sample {
12596 pub mod acceleration {
12597 pub mod scalar_1_0 {
12598 pub struct Scalar {
12603 pub timestamp:
12609 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
12610 pub meter_per_second_per_second: f32,
12616 }
12617 impl ::canadensis_encoding::DataType for Scalar {
12618 const EXTENT_BYTES: Option<u32> = None;
12620 }
12621 impl ::canadensis_encoding::Message for Scalar {}
12622 impl Scalar {}
12623 impl ::canadensis_encoding::Serialize for Scalar {
12624 fn size_bits(&self) -> usize {
12625 88
12626 }
12627 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12628 cursor.write_composite(&self.timestamp);
12629 cursor.write_f32(self.meter_per_second_per_second);
12630 }
12631 }
12632 impl ::canadensis_encoding::Deserialize for Scalar {
12633 fn deserialize(
12634 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12635 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12636 where
12637 Self: Sized,
12638 {
12639 Ok(Scalar {
12640 timestamp: { cursor.read_composite()? },
12641 meter_per_second_per_second: { cursor.read_f32() },
12642 })
12643 }
12644 }
12645 }
12646 pub mod vector3_1_0 {
12647 pub struct Vector3 {
12652 pub timestamp:
12658 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
12659 pub meter_per_second_per_second: [f32; 3],
12665 }
12666 impl ::canadensis_encoding::DataType for Vector3 {
12667 const EXTENT_BYTES: Option<u32> = None;
12669 }
12670 impl ::canadensis_encoding::Message for Vector3 {}
12671 impl Vector3 {}
12672 impl ::canadensis_encoding::Serialize for Vector3 {
12673 fn size_bits(&self) -> usize {
12674 152
12675 }
12676 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12677 cursor.write_composite(&self.timestamp);
12678 for value in (self.meter_per_second_per_second).iter() {
12679 cursor.write_f32(*value);
12680 }
12681 }
12682 }
12683 impl ::canadensis_encoding::Deserialize for Vector3 {
12684 fn deserialize(
12685 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12686 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12687 where
12688 Self: Sized,
12689 {
12690 Ok(Vector3 {
12691 timestamp: { cursor.read_composite()? },
12692 meter_per_second_per_second: {
12693 [cursor.read_f32(), cursor.read_f32(), cursor.read_f32()]
12694 },
12695 })
12696 }
12697 }
12698 }
12699 }
12700 pub mod angle {
12701 pub mod narrow_scalar_1_0 {
12702 pub struct NarrowScalar {
12707 pub timestamp:
12713 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
12714 pub radian: ::half::f16,
12720 }
12721 impl ::canadensis_encoding::DataType for NarrowScalar {
12722 const EXTENT_BYTES: Option<u32> = None;
12724 }
12725 impl ::canadensis_encoding::Message for NarrowScalar {}
12726 impl NarrowScalar {}
12727 impl ::canadensis_encoding::Serialize for NarrowScalar {
12728 fn size_bits(&self) -> usize {
12729 72
12730 }
12731 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12732 cursor.write_composite(&self.timestamp);
12733 cursor.write_f16(self.radian);
12734 }
12735 }
12736 impl ::canadensis_encoding::Deserialize for NarrowScalar {
12737 fn deserialize(
12738 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12739 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12740 where
12741 Self: Sized,
12742 {
12743 Ok(NarrowScalar {
12744 timestamp: { cursor.read_composite()? },
12745 radian: { cursor.read_f16() },
12746 })
12747 }
12748 }
12749 }
12750 pub mod narrow_vector3_1_0 {
12751 pub struct NarrowVector3 {
12756 pub timestamp:
12762 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
12763 pub radian: [::half::f16; 3],
12769 }
12770 impl ::canadensis_encoding::DataType for NarrowVector3 {
12771 const EXTENT_BYTES: Option<u32> = None;
12773 }
12774 impl ::canadensis_encoding::Message for NarrowVector3 {}
12775 impl NarrowVector3 {}
12776 impl ::canadensis_encoding::Serialize for NarrowVector3 {
12777 fn size_bits(&self) -> usize {
12778 104
12779 }
12780 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12781 cursor.write_composite(&self.timestamp);
12782 for value in (self.radian).iter() {
12783 cursor.write_f16(*value);
12784 }
12785 }
12786 }
12787 impl ::canadensis_encoding::Deserialize for NarrowVector3 {
12788 fn deserialize(
12789 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12790 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12791 where
12792 Self: Sized,
12793 {
12794 Ok(NarrowVector3 {
12795 timestamp: { cursor.read_composite()? },
12796 radian: {
12797 [cursor.read_f16(), cursor.read_f16(), cursor.read_f16()]
12798 },
12799 })
12800 }
12801 }
12802 }
12803 pub mod quaternion_1_0 {
12804 pub struct Quaternion {
12809 pub timestamp:
12815 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
12816 pub wxyz: [f32; 4],
12822 }
12823 impl ::canadensis_encoding::DataType for Quaternion {
12824 const EXTENT_BYTES: Option<u32> = None;
12826 }
12827 impl ::canadensis_encoding::Message for Quaternion {}
12828 impl Quaternion {}
12829 impl ::canadensis_encoding::Serialize for Quaternion {
12830 fn size_bits(&self) -> usize {
12831 184
12832 }
12833 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12834 cursor.write_composite(&self.timestamp);
12835 for value in (self.wxyz).iter() {
12836 cursor.write_f32(*value);
12837 }
12838 }
12839 }
12840 impl ::canadensis_encoding::Deserialize for Quaternion {
12841 fn deserialize(
12842 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12843 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12844 where
12845 Self: Sized,
12846 {
12847 Ok(Quaternion {
12848 timestamp: { cursor.read_composite()? },
12849 wxyz: {
12850 [
12851 cursor.read_f32(),
12852 cursor.read_f32(),
12853 cursor.read_f32(),
12854 cursor.read_f32(),
12855 ]
12856 },
12857 })
12858 }
12859 }
12860 }
12861 pub mod scalar_1_0 {
12862 pub struct Scalar {
12867 pub timestamp:
12873 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
12874 pub radian: f32,
12880 }
12881 impl ::canadensis_encoding::DataType for Scalar {
12882 const EXTENT_BYTES: Option<u32> = None;
12884 }
12885 impl ::canadensis_encoding::Message for Scalar {}
12886 impl Scalar {}
12887 impl ::canadensis_encoding::Serialize for Scalar {
12888 fn size_bits(&self) -> usize {
12889 88
12890 }
12891 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12892 cursor.write_composite(&self.timestamp);
12893 cursor.write_f32(self.radian);
12894 }
12895 }
12896 impl ::canadensis_encoding::Deserialize for Scalar {
12897 fn deserialize(
12898 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12899 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12900 where
12901 Self: Sized,
12902 {
12903 Ok(Scalar {
12904 timestamp: { cursor.read_composite()? },
12905 radian: { cursor.read_f32() },
12906 })
12907 }
12908 }
12909 }
12910 pub mod vector3_1_0 {
12911 pub struct Vector3 {
12916 pub timestamp:
12922 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
12923 pub radian: [f32; 3],
12929 }
12930 impl ::canadensis_encoding::DataType for Vector3 {
12931 const EXTENT_BYTES: Option<u32> = None;
12933 }
12934 impl ::canadensis_encoding::Message for Vector3 {}
12935 impl Vector3 {}
12936 impl ::canadensis_encoding::Serialize for Vector3 {
12937 fn size_bits(&self) -> usize {
12938 152
12939 }
12940 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12941 cursor.write_composite(&self.timestamp);
12942 for value in (self.radian).iter() {
12943 cursor.write_f32(*value);
12944 }
12945 }
12946 }
12947 impl ::canadensis_encoding::Deserialize for Vector3 {
12948 fn deserialize(
12949 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
12950 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
12951 where
12952 Self: Sized,
12953 {
12954 Ok(Vector3 {
12955 timestamp: { cursor.read_composite()? },
12956 radian: {
12957 [cursor.read_f32(), cursor.read_f32(), cursor.read_f32()]
12958 },
12959 })
12960 }
12961 }
12962 }
12963 pub mod wide_scalar_1_0 {
12964 pub struct WideScalar {
12969 pub timestamp:
12975 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
12976 pub radian: f64,
12982 }
12983 impl ::canadensis_encoding::DataType for WideScalar {
12984 const EXTENT_BYTES: Option<u32> = None;
12986 }
12987 impl ::canadensis_encoding::Message for WideScalar {}
12988 impl WideScalar {}
12989 impl ::canadensis_encoding::Serialize for WideScalar {
12990 fn size_bits(&self) -> usize {
12991 120
12992 }
12993 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
12994 cursor.write_composite(&self.timestamp);
12995 cursor.write_f64(self.radian);
12996 }
12997 }
12998 impl ::canadensis_encoding::Deserialize for WideScalar {
12999 fn deserialize(
13000 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13001 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13002 where
13003 Self: Sized,
13004 {
13005 Ok(WideScalar {
13006 timestamp: { cursor.read_composite()? },
13007 radian: { cursor.read_f64() },
13008 })
13009 }
13010 }
13011 }
13012 pub mod wide_vector3_1_0 {
13013 pub struct WideVector3 {
13018 pub timestamp:
13024 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13025 pub radian: [f64; 3],
13031 }
13032 impl ::canadensis_encoding::DataType for WideVector3 {
13033 const EXTENT_BYTES: Option<u32> = None;
13035 }
13036 impl ::canadensis_encoding::Message for WideVector3 {}
13037 impl WideVector3 {}
13038 impl ::canadensis_encoding::Serialize for WideVector3 {
13039 fn size_bits(&self) -> usize {
13040 248
13041 }
13042 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13043 cursor.write_composite(&self.timestamp);
13044 for value in (self.radian).iter() {
13045 cursor.write_f64(*value);
13046 }
13047 }
13048 }
13049 impl ::canadensis_encoding::Deserialize for WideVector3 {
13050 fn deserialize(
13051 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13052 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13053 where
13054 Self: Sized,
13055 {
13056 Ok(WideVector3 {
13057 timestamp: { cursor.read_composite()? },
13058 radian: {
13059 [cursor.read_f64(), cursor.read_f64(), cursor.read_f64()]
13060 },
13061 })
13062 }
13063 }
13064 }
13065 }
13066 pub mod angular_acceleration {
13067 pub mod scalar_1_0 {
13068 pub struct Scalar {
13073 pub timestamp:
13079 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13080 pub radian_per_second_per_second: f32,
13086 }
13087 impl ::canadensis_encoding::DataType for Scalar {
13088 const EXTENT_BYTES: Option<u32> = None;
13090 }
13091 impl ::canadensis_encoding::Message for Scalar {}
13092 impl Scalar {}
13093 impl ::canadensis_encoding::Serialize for Scalar {
13094 fn size_bits(&self) -> usize {
13095 88
13096 }
13097 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13098 cursor.write_composite(&self.timestamp);
13099 cursor.write_f32(self.radian_per_second_per_second);
13100 }
13101 }
13102 impl ::canadensis_encoding::Deserialize for Scalar {
13103 fn deserialize(
13104 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13105 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13106 where
13107 Self: Sized,
13108 {
13109 Ok(Scalar {
13110 timestamp: { cursor.read_composite()? },
13111 radian_per_second_per_second: { cursor.read_f32() },
13112 })
13113 }
13114 }
13115 }
13116 pub mod vector3_1_0 {
13117 pub struct Vector3 {
13122 pub timestamp:
13128 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13129 pub radian_per_second_per_second: [f32; 3],
13135 }
13136 impl ::canadensis_encoding::DataType for Vector3 {
13137 const EXTENT_BYTES: Option<u32> = None;
13139 }
13140 impl ::canadensis_encoding::Message for Vector3 {}
13141 impl Vector3 {}
13142 impl ::canadensis_encoding::Serialize for Vector3 {
13143 fn size_bits(&self) -> usize {
13144 152
13145 }
13146 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13147 cursor.write_composite(&self.timestamp);
13148 for value in (self.radian_per_second_per_second).iter() {
13149 cursor.write_f32(*value);
13150 }
13151 }
13152 }
13153 impl ::canadensis_encoding::Deserialize for Vector3 {
13154 fn deserialize(
13155 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13156 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13157 where
13158 Self: Sized,
13159 {
13160 Ok(Vector3 {
13161 timestamp: { cursor.read_composite()? },
13162 radian_per_second_per_second: {
13163 [cursor.read_f32(), cursor.read_f32(), cursor.read_f32()]
13164 },
13165 })
13166 }
13167 }
13168 }
13169 }
13170 pub mod angular_velocity {
13171 pub mod scalar_1_0 {
13172 pub struct Scalar {
13177 pub timestamp:
13183 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13184 pub radian_per_second: f32,
13190 }
13191 impl ::canadensis_encoding::DataType for Scalar {
13192 const EXTENT_BYTES: Option<u32> = None;
13194 }
13195 impl ::canadensis_encoding::Message for Scalar {}
13196 impl Scalar {}
13197 impl ::canadensis_encoding::Serialize for Scalar {
13198 fn size_bits(&self) -> usize {
13199 88
13200 }
13201 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13202 cursor.write_composite(&self.timestamp);
13203 cursor.write_f32(self.radian_per_second);
13204 }
13205 }
13206 impl ::canadensis_encoding::Deserialize for Scalar {
13207 fn deserialize(
13208 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13209 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13210 where
13211 Self: Sized,
13212 {
13213 Ok(Scalar {
13214 timestamp: { cursor.read_composite()? },
13215 radian_per_second: { cursor.read_f32() },
13216 })
13217 }
13218 }
13219 }
13220 pub mod vector3_1_0 {
13221 pub struct Vector3 {
13226 pub timestamp:
13232 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13233 pub radian_per_second: [f32; 3],
13239 }
13240 impl ::canadensis_encoding::DataType for Vector3 {
13241 const EXTENT_BYTES: Option<u32> = None;
13243 }
13244 impl ::canadensis_encoding::Message for Vector3 {}
13245 impl Vector3 {}
13246 impl ::canadensis_encoding::Serialize for Vector3 {
13247 fn size_bits(&self) -> usize {
13248 152
13249 }
13250 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13251 cursor.write_composite(&self.timestamp);
13252 for value in (self.radian_per_second).iter() {
13253 cursor.write_f32(*value);
13254 }
13255 }
13256 }
13257 impl ::canadensis_encoding::Deserialize for Vector3 {
13258 fn deserialize(
13259 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13260 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13261 where
13262 Self: Sized,
13263 {
13264 Ok(Vector3 {
13265 timestamp: { cursor.read_composite()? },
13266 radian_per_second: {
13267 [cursor.read_f32(), cursor.read_f32(), cursor.read_f32()]
13268 },
13269 })
13270 }
13271 }
13272 }
13273 }
13274 pub mod duration {
13275 pub mod scalar_1_0 {
13276 pub struct Scalar {
13281 pub timestamp:
13287 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13288 pub second: f32,
13294 }
13295 impl ::canadensis_encoding::DataType for Scalar {
13296 const EXTENT_BYTES: Option<u32> = None;
13298 }
13299 impl ::canadensis_encoding::Message for Scalar {}
13300 impl Scalar {}
13301 impl ::canadensis_encoding::Serialize for Scalar {
13302 fn size_bits(&self) -> usize {
13303 88
13304 }
13305 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13306 cursor.write_composite(&self.timestamp);
13307 cursor.write_f32(self.second);
13308 }
13309 }
13310 impl ::canadensis_encoding::Deserialize for Scalar {
13311 fn deserialize(
13312 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13313 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13314 where
13315 Self: Sized,
13316 {
13317 Ok(Scalar {
13318 timestamp: { cursor.read_composite()? },
13319 second: { cursor.read_f32() },
13320 })
13321 }
13322 }
13323 }
13324 pub mod wide_scalar_1_0 {
13325 pub struct WideScalar {
13330 pub timestamp:
13336 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13337 pub second: f64,
13343 }
13344 impl ::canadensis_encoding::DataType for WideScalar {
13345 const EXTENT_BYTES: Option<u32> = None;
13347 }
13348 impl ::canadensis_encoding::Message for WideScalar {}
13349 impl WideScalar {}
13350 impl ::canadensis_encoding::Serialize for WideScalar {
13351 fn size_bits(&self) -> usize {
13352 120
13353 }
13354 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13355 cursor.write_composite(&self.timestamp);
13356 cursor.write_f64(self.second);
13357 }
13358 }
13359 impl ::canadensis_encoding::Deserialize for WideScalar {
13360 fn deserialize(
13361 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13362 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13363 where
13364 Self: Sized,
13365 {
13366 Ok(WideScalar {
13367 timestamp: { cursor.read_composite()? },
13368 second: { cursor.read_f64() },
13369 })
13370 }
13371 }
13372 }
13373 }
13374 pub mod electric_charge {
13375 pub mod scalar_1_0 {
13376 pub struct Scalar {
13381 pub timestamp:
13387 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13388 pub coulomb: f32,
13394 }
13395 impl ::canadensis_encoding::DataType for Scalar {
13396 const EXTENT_BYTES: Option<u32> = None;
13398 }
13399 impl ::canadensis_encoding::Message for Scalar {}
13400 impl Scalar {}
13401 impl ::canadensis_encoding::Serialize for Scalar {
13402 fn size_bits(&self) -> usize {
13403 88
13404 }
13405 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13406 cursor.write_composite(&self.timestamp);
13407 cursor.write_f32(self.coulomb);
13408 }
13409 }
13410 impl ::canadensis_encoding::Deserialize for Scalar {
13411 fn deserialize(
13412 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13413 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13414 where
13415 Self: Sized,
13416 {
13417 Ok(Scalar {
13418 timestamp: { cursor.read_composite()? },
13419 coulomb: { cursor.read_f32() },
13420 })
13421 }
13422 }
13423 }
13424 }
13425 pub mod electric_current {
13426 pub mod scalar_1_0 {
13427 pub struct Scalar {
13432 pub timestamp:
13438 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13439 pub ampere: f32,
13445 }
13446 impl ::canadensis_encoding::DataType for Scalar {
13447 const EXTENT_BYTES: Option<u32> = None;
13449 }
13450 impl ::canadensis_encoding::Message for Scalar {}
13451 impl Scalar {}
13452 impl ::canadensis_encoding::Serialize for Scalar {
13453 fn size_bits(&self) -> usize {
13454 88
13455 }
13456 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13457 cursor.write_composite(&self.timestamp);
13458 cursor.write_f32(self.ampere);
13459 }
13460 }
13461 impl ::canadensis_encoding::Deserialize for Scalar {
13462 fn deserialize(
13463 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13464 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13465 where
13466 Self: Sized,
13467 {
13468 Ok(Scalar {
13469 timestamp: { cursor.read_composite()? },
13470 ampere: { cursor.read_f32() },
13471 })
13472 }
13473 }
13474 }
13475 }
13476 pub mod energy {
13477 pub mod scalar_1_0 {
13478 pub struct Scalar {
13483 pub timestamp:
13489 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13490 pub joule: f32,
13496 }
13497 impl ::canadensis_encoding::DataType for Scalar {
13498 const EXTENT_BYTES: Option<u32> = None;
13500 }
13501 impl ::canadensis_encoding::Message for Scalar {}
13502 impl Scalar {}
13503 impl ::canadensis_encoding::Serialize for Scalar {
13504 fn size_bits(&self) -> usize {
13505 88
13506 }
13507 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13508 cursor.write_composite(&self.timestamp);
13509 cursor.write_f32(self.joule);
13510 }
13511 }
13512 impl ::canadensis_encoding::Deserialize for Scalar {
13513 fn deserialize(
13514 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13515 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13516 where
13517 Self: Sized,
13518 {
13519 Ok(Scalar {
13520 timestamp: { cursor.read_composite()? },
13521 joule: { cursor.read_f32() },
13522 })
13523 }
13524 }
13525 }
13526 }
13527 pub mod force {
13528 pub mod scalar_1_0 {
13529 pub struct Scalar {
13534 pub timestamp:
13540 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13541 pub newton: f32,
13547 }
13548 impl ::canadensis_encoding::DataType for Scalar {
13549 const EXTENT_BYTES: Option<u32> = None;
13551 }
13552 impl ::canadensis_encoding::Message for Scalar {}
13553 impl Scalar {}
13554 impl ::canadensis_encoding::Serialize for Scalar {
13555 fn size_bits(&self) -> usize {
13556 88
13557 }
13558 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13559 cursor.write_composite(&self.timestamp);
13560 cursor.write_f32(self.newton);
13561 }
13562 }
13563 impl ::canadensis_encoding::Deserialize for Scalar {
13564 fn deserialize(
13565 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13566 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13567 where
13568 Self: Sized,
13569 {
13570 Ok(Scalar {
13571 timestamp: { cursor.read_composite()? },
13572 newton: { cursor.read_f32() },
13573 })
13574 }
13575 }
13576 }
13577 pub mod vector3_1_0 {
13578 pub struct Vector3 {
13583 pub timestamp:
13589 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13590 pub newton: [f32; 3],
13596 }
13597 impl ::canadensis_encoding::DataType for Vector3 {
13598 const EXTENT_BYTES: Option<u32> = None;
13600 }
13601 impl ::canadensis_encoding::Message for Vector3 {}
13602 impl Vector3 {}
13603 impl ::canadensis_encoding::Serialize for Vector3 {
13604 fn size_bits(&self) -> usize {
13605 152
13606 }
13607 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13608 cursor.write_composite(&self.timestamp);
13609 for value in (self.newton).iter() {
13610 cursor.write_f32(*value);
13611 }
13612 }
13613 }
13614 impl ::canadensis_encoding::Deserialize for Vector3 {
13615 fn deserialize(
13616 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13617 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13618 where
13619 Self: Sized,
13620 {
13621 Ok(Vector3 {
13622 timestamp: { cursor.read_composite()? },
13623 newton: {
13624 [cursor.read_f32(), cursor.read_f32(), cursor.read_f32()]
13625 },
13626 })
13627 }
13628 }
13629 }
13630 }
13631 pub mod frequency {
13632 pub mod scalar_1_0 {
13633 pub struct Scalar {
13638 pub timestamp:
13644 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13645 pub hertz: f32,
13651 }
13652 impl ::canadensis_encoding::DataType for Scalar {
13653 const EXTENT_BYTES: Option<u32> = None;
13655 }
13656 impl ::canadensis_encoding::Message for Scalar {}
13657 impl Scalar {}
13658 impl ::canadensis_encoding::Serialize for Scalar {
13659 fn size_bits(&self) -> usize {
13660 88
13661 }
13662 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13663 cursor.write_composite(&self.timestamp);
13664 cursor.write_f32(self.hertz);
13665 }
13666 }
13667 impl ::canadensis_encoding::Deserialize for Scalar {
13668 fn deserialize(
13669 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13670 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13671 where
13672 Self: Sized,
13673 {
13674 Ok(Scalar {
13675 timestamp: { cursor.read_composite()? },
13676 hertz: { cursor.read_f32() },
13677 })
13678 }
13679 }
13680 }
13681 }
13682 pub mod length {
13683 pub mod narrow_scalar_1_0 {
13684 pub struct NarrowScalar {
13689 pub timestamp:
13695 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13696 pub meter: ::half::f16,
13702 }
13703 impl ::canadensis_encoding::DataType for NarrowScalar {
13704 const EXTENT_BYTES: Option<u32> = None;
13706 }
13707 impl ::canadensis_encoding::Message for NarrowScalar {}
13708 impl NarrowScalar {}
13709 impl ::canadensis_encoding::Serialize for NarrowScalar {
13710 fn size_bits(&self) -> usize {
13711 72
13712 }
13713 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13714 cursor.write_composite(&self.timestamp);
13715 cursor.write_f16(self.meter);
13716 }
13717 }
13718 impl ::canadensis_encoding::Deserialize for NarrowScalar {
13719 fn deserialize(
13720 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13721 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13722 where
13723 Self: Sized,
13724 {
13725 Ok(NarrowScalar {
13726 timestamp: { cursor.read_composite()? },
13727 meter: { cursor.read_f16() },
13728 })
13729 }
13730 }
13731 }
13732 pub mod narrow_vector3_1_0 {
13733 pub struct NarrowVector3 {
13738 pub timestamp:
13744 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13745 pub meter: [::half::f16; 3],
13751 }
13752 impl ::canadensis_encoding::DataType for NarrowVector3 {
13753 const EXTENT_BYTES: Option<u32> = None;
13755 }
13756 impl ::canadensis_encoding::Message for NarrowVector3 {}
13757 impl NarrowVector3 {}
13758 impl ::canadensis_encoding::Serialize for NarrowVector3 {
13759 fn size_bits(&self) -> usize {
13760 104
13761 }
13762 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13763 cursor.write_composite(&self.timestamp);
13764 for value in (self.meter).iter() {
13765 cursor.write_f16(*value);
13766 }
13767 }
13768 }
13769 impl ::canadensis_encoding::Deserialize for NarrowVector3 {
13770 fn deserialize(
13771 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13772 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13773 where
13774 Self: Sized,
13775 {
13776 Ok(NarrowVector3 {
13777 timestamp: { cursor.read_composite()? },
13778 meter: {
13779 [cursor.read_f16(), cursor.read_f16(), cursor.read_f16()]
13780 },
13781 })
13782 }
13783 }
13784 }
13785 pub mod scalar_1_0 {
13786 pub struct Scalar {
13791 pub timestamp:
13797 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13798 pub meter: f32,
13804 }
13805 impl ::canadensis_encoding::DataType for Scalar {
13806 const EXTENT_BYTES: Option<u32> = None;
13808 }
13809 impl ::canadensis_encoding::Message for Scalar {}
13810 impl Scalar {}
13811 impl ::canadensis_encoding::Serialize for Scalar {
13812 fn size_bits(&self) -> usize {
13813 88
13814 }
13815 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13816 cursor.write_composite(&self.timestamp);
13817 cursor.write_f32(self.meter);
13818 }
13819 }
13820 impl ::canadensis_encoding::Deserialize for Scalar {
13821 fn deserialize(
13822 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13823 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13824 where
13825 Self: Sized,
13826 {
13827 Ok(Scalar {
13828 timestamp: { cursor.read_composite()? },
13829 meter: { cursor.read_f32() },
13830 })
13831 }
13832 }
13833 }
13834 pub mod vector3_1_0 {
13835 pub struct Vector3 {
13840 pub timestamp:
13846 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13847 pub meter: [f32; 3],
13853 }
13854 impl ::canadensis_encoding::DataType for Vector3 {
13855 const EXTENT_BYTES: Option<u32> = None;
13857 }
13858 impl ::canadensis_encoding::Message for Vector3 {}
13859 impl Vector3 {}
13860 impl ::canadensis_encoding::Serialize for Vector3 {
13861 fn size_bits(&self) -> usize {
13862 152
13863 }
13864 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13865 cursor.write_composite(&self.timestamp);
13866 for value in (self.meter).iter() {
13867 cursor.write_f32(*value);
13868 }
13869 }
13870 }
13871 impl ::canadensis_encoding::Deserialize for Vector3 {
13872 fn deserialize(
13873 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13874 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13875 where
13876 Self: Sized,
13877 {
13878 Ok(Vector3 {
13879 timestamp: { cursor.read_composite()? },
13880 meter: {
13881 [cursor.read_f32(), cursor.read_f32(), cursor.read_f32()]
13882 },
13883 })
13884 }
13885 }
13886 }
13887 pub mod wide_scalar_1_0 {
13888 pub struct WideScalar {
13893 pub timestamp:
13899 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13900 pub meter: f64,
13906 }
13907 impl ::canadensis_encoding::DataType for WideScalar {
13908 const EXTENT_BYTES: Option<u32> = None;
13910 }
13911 impl ::canadensis_encoding::Message for WideScalar {}
13912 impl WideScalar {}
13913 impl ::canadensis_encoding::Serialize for WideScalar {
13914 fn size_bits(&self) -> usize {
13915 120
13916 }
13917 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13918 cursor.write_composite(&self.timestamp);
13919 cursor.write_f64(self.meter);
13920 }
13921 }
13922 impl ::canadensis_encoding::Deserialize for WideScalar {
13923 fn deserialize(
13924 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13925 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13926 where
13927 Self: Sized,
13928 {
13929 Ok(WideScalar {
13930 timestamp: { cursor.read_composite()? },
13931 meter: { cursor.read_f64() },
13932 })
13933 }
13934 }
13935 }
13936 pub mod wide_vector3_1_0 {
13937 pub struct WideVector3 {
13942 pub timestamp:
13948 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
13949 pub meter: [f64; 3],
13955 }
13956 impl ::canadensis_encoding::DataType for WideVector3 {
13957 const EXTENT_BYTES: Option<u32> = None;
13959 }
13960 impl ::canadensis_encoding::Message for WideVector3 {}
13961 impl WideVector3 {}
13962 impl ::canadensis_encoding::Serialize for WideVector3 {
13963 fn size_bits(&self) -> usize {
13964 248
13965 }
13966 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
13967 cursor.write_composite(&self.timestamp);
13968 for value in (self.meter).iter() {
13969 cursor.write_f64(*value);
13970 }
13971 }
13972 }
13973 impl ::canadensis_encoding::Deserialize for WideVector3 {
13974 fn deserialize(
13975 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
13976 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
13977 where
13978 Self: Sized,
13979 {
13980 Ok(WideVector3 {
13981 timestamp: { cursor.read_composite()? },
13982 meter: {
13983 [cursor.read_f64(), cursor.read_f64(), cursor.read_f64()]
13984 },
13985 })
13986 }
13987 }
13988 }
13989 }
13990 pub mod luminance {
13991 pub mod scalar_1_0 {
13992 pub struct Scalar {
13997 pub timestamp:
14003 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14004 pub candela_per_square_meter: f32,
14010 }
14011 impl ::canadensis_encoding::DataType for Scalar {
14012 const EXTENT_BYTES: Option<u32> = None;
14014 }
14015 impl ::canadensis_encoding::Message for Scalar {}
14016 impl Scalar {}
14017 impl ::canadensis_encoding::Serialize for Scalar {
14018 fn size_bits(&self) -> usize {
14019 88
14020 }
14021 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14022 cursor.write_composite(&self.timestamp);
14023 cursor.write_f32(self.candela_per_square_meter);
14024 }
14025 }
14026 impl ::canadensis_encoding::Deserialize for Scalar {
14027 fn deserialize(
14028 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14029 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14030 where
14031 Self: Sized,
14032 {
14033 Ok(Scalar {
14034 timestamp: { cursor.read_composite()? },
14035 candela_per_square_meter: { cursor.read_f32() },
14036 })
14037 }
14038 }
14039 }
14040 }
14041 pub mod magnetic_field_strength {
14042 #[allow(deprecated)]
14043 #[cfg_attr(not(test), deprecated)]
14044 pub mod scalar_1_0 {
14045 #[cfg_attr(
14050 not(doctest),
14051 doc = " Use v1.1 instead where the unit of measure is named correctly."
14052 )]
14053 #[deprecated]
14054 pub struct Scalar {
14055 pub timestamp:
14061 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14062 pub tesla: f32,
14068 }
14069 impl ::canadensis_encoding::DataType for Scalar {
14070 const EXTENT_BYTES: Option<u32> = None;
14072 }
14073 impl ::canadensis_encoding::Message for Scalar {}
14074 impl Scalar {}
14075 impl ::canadensis_encoding::Serialize for Scalar {
14076 fn size_bits(&self) -> usize {
14077 88
14078 }
14079 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14080 cursor.write_composite(&self.timestamp);
14081 cursor.write_f32(self.tesla);
14082 }
14083 }
14084 impl ::canadensis_encoding::Deserialize for Scalar {
14085 fn deserialize(
14086 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14087 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14088 where
14089 Self: Sized,
14090 {
14091 Ok(Scalar {
14092 timestamp: { cursor.read_composite()? },
14093 tesla: { cursor.read_f32() },
14094 })
14095 }
14096 }
14097 }
14098 pub mod scalar_1_1 {
14099 pub struct Scalar {
14104 pub timestamp:
14110 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14111 pub ampere_per_meter: f32,
14117 }
14118 impl ::canadensis_encoding::DataType for Scalar {
14119 const EXTENT_BYTES: Option<u32> = None;
14121 }
14122 impl ::canadensis_encoding::Message for Scalar {}
14123 impl Scalar {}
14124 impl ::canadensis_encoding::Serialize for Scalar {
14125 fn size_bits(&self) -> usize {
14126 88
14127 }
14128 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14129 cursor.write_composite(&self.timestamp);
14130 cursor.write_f32(self.ampere_per_meter);
14131 }
14132 }
14133 impl ::canadensis_encoding::Deserialize for Scalar {
14134 fn deserialize(
14135 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14136 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14137 where
14138 Self: Sized,
14139 {
14140 Ok(Scalar {
14141 timestamp: { cursor.read_composite()? },
14142 ampere_per_meter: { cursor.read_f32() },
14143 })
14144 }
14145 }
14146 }
14147 #[allow(deprecated)]
14148 #[cfg_attr(not(test), deprecated)]
14149 pub mod vector3_1_0 {
14150 #[cfg_attr(
14155 not(doctest),
14156 doc = " Use v1.1 instead where the unit of measure is named correctly."
14157 )]
14158 #[deprecated]
14159 pub struct Vector3 {
14160 pub timestamp:
14166 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14167 pub tesla: [f32; 3],
14173 }
14174 impl ::canadensis_encoding::DataType for Vector3 {
14175 const EXTENT_BYTES: Option<u32> = None;
14177 }
14178 impl ::canadensis_encoding::Message for Vector3 {}
14179 impl Vector3 {}
14180 impl ::canadensis_encoding::Serialize for Vector3 {
14181 fn size_bits(&self) -> usize {
14182 152
14183 }
14184 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14185 cursor.write_composite(&self.timestamp);
14186 for value in (self.tesla).iter() {
14187 cursor.write_f32(*value);
14188 }
14189 }
14190 }
14191 impl ::canadensis_encoding::Deserialize for Vector3 {
14192 fn deserialize(
14193 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14194 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14195 where
14196 Self: Sized,
14197 {
14198 Ok(Vector3 {
14199 timestamp: { cursor.read_composite()? },
14200 tesla: {
14201 [cursor.read_f32(), cursor.read_f32(), cursor.read_f32()]
14202 },
14203 })
14204 }
14205 }
14206 }
14207 pub mod vector3_1_1 {
14208 pub struct Vector3 {
14213 pub timestamp:
14219 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14220 pub ampere_per_meter: [f32; 3],
14226 }
14227 impl ::canadensis_encoding::DataType for Vector3 {
14228 const EXTENT_BYTES: Option<u32> = None;
14230 }
14231 impl ::canadensis_encoding::Message for Vector3 {}
14232 impl Vector3 {}
14233 impl ::canadensis_encoding::Serialize for Vector3 {
14234 fn size_bits(&self) -> usize {
14235 152
14236 }
14237 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14238 cursor.write_composite(&self.timestamp);
14239 for value in (self.ampere_per_meter).iter() {
14240 cursor.write_f32(*value);
14241 }
14242 }
14243 }
14244 impl ::canadensis_encoding::Deserialize for Vector3 {
14245 fn deserialize(
14246 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14247 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14248 where
14249 Self: Sized,
14250 {
14251 Ok(Vector3 {
14252 timestamp: { cursor.read_composite()? },
14253 ampere_per_meter: {
14254 [cursor.read_f32(), cursor.read_f32(), cursor.read_f32()]
14255 },
14256 })
14257 }
14258 }
14259 }
14260 }
14261 pub mod magnetic_flux_density {
14262 pub mod scalar_1_0 {
14263 pub struct Scalar {
14268 pub timestamp:
14274 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14275 pub tesla: f32,
14281 }
14282 impl ::canadensis_encoding::DataType for Scalar {
14283 const EXTENT_BYTES: Option<u32> = None;
14285 }
14286 impl ::canadensis_encoding::Message for Scalar {}
14287 impl Scalar {}
14288 impl ::canadensis_encoding::Serialize for Scalar {
14289 fn size_bits(&self) -> usize {
14290 88
14291 }
14292 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14293 cursor.write_composite(&self.timestamp);
14294 cursor.write_f32(self.tesla);
14295 }
14296 }
14297 impl ::canadensis_encoding::Deserialize for Scalar {
14298 fn deserialize(
14299 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14300 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14301 where
14302 Self: Sized,
14303 {
14304 Ok(Scalar {
14305 timestamp: { cursor.read_composite()? },
14306 tesla: { cursor.read_f32() },
14307 })
14308 }
14309 }
14310 }
14311 pub mod vector3_1_0 {
14312 pub struct Vector3 {
14317 pub timestamp:
14323 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14324 pub tesla: [f32; 3],
14330 }
14331 impl ::canadensis_encoding::DataType for Vector3 {
14332 const EXTENT_BYTES: Option<u32> = None;
14334 }
14335 impl ::canadensis_encoding::Message for Vector3 {}
14336 impl Vector3 {}
14337 impl ::canadensis_encoding::Serialize for Vector3 {
14338 fn size_bits(&self) -> usize {
14339 152
14340 }
14341 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14342 cursor.write_composite(&self.timestamp);
14343 for value in (self.tesla).iter() {
14344 cursor.write_f32(*value);
14345 }
14346 }
14347 }
14348 impl ::canadensis_encoding::Deserialize for Vector3 {
14349 fn deserialize(
14350 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14351 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14352 where
14353 Self: Sized,
14354 {
14355 Ok(Vector3 {
14356 timestamp: { cursor.read_composite()? },
14357 tesla: {
14358 [cursor.read_f32(), cursor.read_f32(), cursor.read_f32()]
14359 },
14360 })
14361 }
14362 }
14363 }
14364 }
14365 pub mod mass {
14366 pub mod scalar_1_0 {
14367 pub struct Scalar {
14372 pub timestamp:
14378 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14379 pub kilogram: f32,
14385 }
14386 impl ::canadensis_encoding::DataType for Scalar {
14387 const EXTENT_BYTES: Option<u32> = None;
14389 }
14390 impl ::canadensis_encoding::Message for Scalar {}
14391 impl Scalar {}
14392 impl ::canadensis_encoding::Serialize for Scalar {
14393 fn size_bits(&self) -> usize {
14394 88
14395 }
14396 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14397 cursor.write_composite(&self.timestamp);
14398 cursor.write_f32(self.kilogram);
14399 }
14400 }
14401 impl ::canadensis_encoding::Deserialize for Scalar {
14402 fn deserialize(
14403 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14404 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14405 where
14406 Self: Sized,
14407 {
14408 Ok(Scalar {
14409 timestamp: { cursor.read_composite()? },
14410 kilogram: { cursor.read_f32() },
14411 })
14412 }
14413 }
14414 }
14415 }
14416 pub mod power {
14417 pub mod scalar_1_0 {
14418 pub struct Scalar {
14423 pub timestamp:
14429 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14430 pub watt: f32,
14436 }
14437 impl ::canadensis_encoding::DataType for Scalar {
14438 const EXTENT_BYTES: Option<u32> = None;
14440 }
14441 impl ::canadensis_encoding::Message for Scalar {}
14442 impl Scalar {}
14443 impl ::canadensis_encoding::Serialize for Scalar {
14444 fn size_bits(&self) -> usize {
14445 88
14446 }
14447 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14448 cursor.write_composite(&self.timestamp);
14449 cursor.write_f32(self.watt);
14450 }
14451 }
14452 impl ::canadensis_encoding::Deserialize for Scalar {
14453 fn deserialize(
14454 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14455 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14456 where
14457 Self: Sized,
14458 {
14459 Ok(Scalar {
14460 timestamp: { cursor.read_composite()? },
14461 watt: { cursor.read_f32() },
14462 })
14463 }
14464 }
14465 }
14466 }
14467 pub mod pressure {
14468 pub mod scalar_1_0 {
14469 pub struct Scalar {
14474 pub timestamp:
14480 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14481 pub pascal: f32,
14487 }
14488 impl ::canadensis_encoding::DataType for Scalar {
14489 const EXTENT_BYTES: Option<u32> = None;
14491 }
14492 impl ::canadensis_encoding::Message for Scalar {}
14493 impl Scalar {}
14494 impl ::canadensis_encoding::Serialize for Scalar {
14495 fn size_bits(&self) -> usize {
14496 88
14497 }
14498 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14499 cursor.write_composite(&self.timestamp);
14500 cursor.write_f32(self.pascal);
14501 }
14502 }
14503 impl ::canadensis_encoding::Deserialize for Scalar {
14504 fn deserialize(
14505 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14506 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14507 where
14508 Self: Sized,
14509 {
14510 Ok(Scalar {
14511 timestamp: { cursor.read_composite()? },
14512 pascal: { cursor.read_f32() },
14513 })
14514 }
14515 }
14516 }
14517 }
14518 pub mod temperature {
14519 pub mod scalar_1_0 {
14520 pub struct Scalar {
14525 pub timestamp:
14531 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14532 pub kelvin: f32,
14538 }
14539 impl ::canadensis_encoding::DataType for Scalar {
14540 const EXTENT_BYTES: Option<u32> = None;
14542 }
14543 impl ::canadensis_encoding::Message for Scalar {}
14544 impl Scalar {}
14545 impl ::canadensis_encoding::Serialize for Scalar {
14546 fn size_bits(&self) -> usize {
14547 88
14548 }
14549 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14550 cursor.write_composite(&self.timestamp);
14551 cursor.write_f32(self.kelvin);
14552 }
14553 }
14554 impl ::canadensis_encoding::Deserialize for Scalar {
14555 fn deserialize(
14556 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14557 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14558 where
14559 Self: Sized,
14560 {
14561 Ok(Scalar {
14562 timestamp: { cursor.read_composite()? },
14563 kelvin: { cursor.read_f32() },
14564 })
14565 }
14566 }
14567 }
14568 }
14569 pub mod torque {
14570 pub mod scalar_1_0 {
14571 pub struct Scalar {
14576 pub timestamp:
14582 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14583 pub newton_meter: f32,
14589 }
14590 impl ::canadensis_encoding::DataType for Scalar {
14591 const EXTENT_BYTES: Option<u32> = None;
14593 }
14594 impl ::canadensis_encoding::Message for Scalar {}
14595 impl Scalar {}
14596 impl ::canadensis_encoding::Serialize for Scalar {
14597 fn size_bits(&self) -> usize {
14598 88
14599 }
14600 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14601 cursor.write_composite(&self.timestamp);
14602 cursor.write_f32(self.newton_meter);
14603 }
14604 }
14605 impl ::canadensis_encoding::Deserialize for Scalar {
14606 fn deserialize(
14607 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14608 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14609 where
14610 Self: Sized,
14611 {
14612 Ok(Scalar {
14613 timestamp: { cursor.read_composite()? },
14614 newton_meter: { cursor.read_f32() },
14615 })
14616 }
14617 }
14618 }
14619 pub mod vector3_1_0 {
14620 pub struct Vector3 {
14625 pub timestamp:
14631 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14632 pub newton_meter: [f32; 3],
14638 }
14639 impl ::canadensis_encoding::DataType for Vector3 {
14640 const EXTENT_BYTES: Option<u32> = None;
14642 }
14643 impl ::canadensis_encoding::Message for Vector3 {}
14644 impl Vector3 {}
14645 impl ::canadensis_encoding::Serialize for Vector3 {
14646 fn size_bits(&self) -> usize {
14647 152
14648 }
14649 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14650 cursor.write_composite(&self.timestamp);
14651 for value in (self.newton_meter).iter() {
14652 cursor.write_f32(*value);
14653 }
14654 }
14655 }
14656 impl ::canadensis_encoding::Deserialize for Vector3 {
14657 fn deserialize(
14658 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14659 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14660 where
14661 Self: Sized,
14662 {
14663 Ok(Vector3 {
14664 timestamp: { cursor.read_composite()? },
14665 newton_meter: {
14666 [cursor.read_f32(), cursor.read_f32(), cursor.read_f32()]
14667 },
14668 })
14669 }
14670 }
14671 }
14672 }
14673 pub mod velocity {
14674 pub mod scalar_1_0 {
14675 pub struct Scalar {
14680 pub timestamp:
14686 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14687 pub meter_per_second: f32,
14693 }
14694 impl ::canadensis_encoding::DataType for Scalar {
14695 const EXTENT_BYTES: Option<u32> = None;
14697 }
14698 impl ::canadensis_encoding::Message for Scalar {}
14699 impl Scalar {}
14700 impl ::canadensis_encoding::Serialize for Scalar {
14701 fn size_bits(&self) -> usize {
14702 88
14703 }
14704 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14705 cursor.write_composite(&self.timestamp);
14706 cursor.write_f32(self.meter_per_second);
14707 }
14708 }
14709 impl ::canadensis_encoding::Deserialize for Scalar {
14710 fn deserialize(
14711 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14712 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14713 where
14714 Self: Sized,
14715 {
14716 Ok(Scalar {
14717 timestamp: { cursor.read_composite()? },
14718 meter_per_second: { cursor.read_f32() },
14719 })
14720 }
14721 }
14722 }
14723 pub mod vector3_1_0 {
14724 pub struct Vector3 {
14729 pub timestamp:
14735 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14736 pub meter_per_second: [f32; 3],
14742 }
14743 impl ::canadensis_encoding::DataType for Vector3 {
14744 const EXTENT_BYTES: Option<u32> = None;
14746 }
14747 impl ::canadensis_encoding::Message for Vector3 {}
14748 impl Vector3 {}
14749 impl ::canadensis_encoding::Serialize for Vector3 {
14750 fn size_bits(&self) -> usize {
14751 152
14752 }
14753 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14754 cursor.write_composite(&self.timestamp);
14755 for value in (self.meter_per_second).iter() {
14756 cursor.write_f32(*value);
14757 }
14758 }
14759 }
14760 impl ::canadensis_encoding::Deserialize for Vector3 {
14761 fn deserialize(
14762 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14763 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14764 where
14765 Self: Sized,
14766 {
14767 Ok(Vector3 {
14768 timestamp: { cursor.read_composite()? },
14769 meter_per_second: {
14770 [cursor.read_f32(), cursor.read_f32(), cursor.read_f32()]
14771 },
14772 })
14773 }
14774 }
14775 }
14776 }
14777 pub mod voltage {
14778 pub mod scalar_1_0 {
14779 pub struct Scalar {
14784 pub timestamp:
14790 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14791 pub volt: f32,
14797 }
14798 impl ::canadensis_encoding::DataType for Scalar {
14799 const EXTENT_BYTES: Option<u32> = None;
14801 }
14802 impl ::canadensis_encoding::Message for Scalar {}
14803 impl Scalar {}
14804 impl ::canadensis_encoding::Serialize for Scalar {
14805 fn size_bits(&self) -> usize {
14806 88
14807 }
14808 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14809 cursor.write_composite(&self.timestamp);
14810 cursor.write_f32(self.volt);
14811 }
14812 }
14813 impl ::canadensis_encoding::Deserialize for Scalar {
14814 fn deserialize(
14815 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14816 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14817 where
14818 Self: Sized,
14819 {
14820 Ok(Scalar {
14821 timestamp: { cursor.read_composite()? },
14822 volt: { cursor.read_f32() },
14823 })
14824 }
14825 }
14826 }
14827 }
14828 pub mod volume {
14829 pub mod scalar_1_0 {
14830 pub struct Scalar {
14835 pub timestamp:
14841 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14842 pub cubic_meter: f32,
14848 }
14849 impl ::canadensis_encoding::DataType for Scalar {
14850 const EXTENT_BYTES: Option<u32> = None;
14852 }
14853 impl ::canadensis_encoding::Message for Scalar {}
14854 impl Scalar {}
14855 impl ::canadensis_encoding::Serialize for Scalar {
14856 fn size_bits(&self) -> usize {
14857 88
14858 }
14859 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14860 cursor.write_composite(&self.timestamp);
14861 cursor.write_f32(self.cubic_meter);
14862 }
14863 }
14864 impl ::canadensis_encoding::Deserialize for Scalar {
14865 fn deserialize(
14866 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14867 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14868 where
14869 Self: Sized,
14870 {
14871 Ok(Scalar {
14872 timestamp: { cursor.read_composite()? },
14873 cubic_meter: { cursor.read_f32() },
14874 })
14875 }
14876 }
14877 }
14878 }
14879 pub mod volumetric_flow_rate {
14880 pub mod scalar_1_0 {
14881 pub struct Scalar {
14886 pub timestamp:
14892 crate::uavcan::time::synchronized_timestamp_1_0::SynchronizedTimestamp,
14893 pub cubic_meter_per_second: f32,
14899 }
14900 impl ::canadensis_encoding::DataType for Scalar {
14901 const EXTENT_BYTES: Option<u32> = None;
14903 }
14904 impl ::canadensis_encoding::Message for Scalar {}
14905 impl Scalar {}
14906 impl ::canadensis_encoding::Serialize for Scalar {
14907 fn size_bits(&self) -> usize {
14908 88
14909 }
14910 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14911 cursor.write_composite(&self.timestamp);
14912 cursor.write_f32(self.cubic_meter_per_second);
14913 }
14914 }
14915 impl ::canadensis_encoding::Deserialize for Scalar {
14916 fn deserialize(
14917 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14918 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14919 where
14920 Self: Sized,
14921 {
14922 Ok(Scalar {
14923 timestamp: { cursor.read_composite()? },
14924 cubic_meter_per_second: { cursor.read_f32() },
14925 })
14926 }
14927 }
14928 }
14929 }
14930 }
14931 pub mod unit {
14932 pub mod acceleration {
14933 pub mod scalar_1_0 {
14934 #[derive(
14939 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
14940 )]
14941 #[repr(C, packed)]
14942 pub struct Scalar {
14943 pub meter_per_second_per_second: f32,
14949 }
14950 impl ::canadensis_encoding::DataType for Scalar {
14951 const EXTENT_BYTES: Option<u32> = None;
14953 }
14954 impl ::canadensis_encoding::Message for Scalar {}
14955 impl Scalar {}
14956 impl ::canadensis_encoding::Serialize for Scalar {
14957 fn size_bits(&self) -> usize {
14958 32
14959 }
14960 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
14961 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
14962 }
14963 }
14964 impl ::canadensis_encoding::Deserialize for Scalar {
14965 fn deserialize(
14966 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
14967 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
14968 where
14969 Self: Sized,
14970 {
14971 Ok(Self::deserialize_zero_copy(cursor))
14972 }
14973 }
14974 #[test]
14975 fn test_layout() {
14976 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
14977 assert_eq!(
14978 ::core::mem::offset_of!(Scalar, meter_per_second_per_second) * 8,
14979 0
14980 );
14981 }
14982 }
14983 pub mod vector3_1_0 {
14984 #[derive(
14989 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
14990 )]
14991 #[repr(C, packed)]
14992 pub struct Vector3 {
14993 pub meter_per_second_per_second: [f32; 3],
14999 }
15000 impl ::canadensis_encoding::DataType for Vector3 {
15001 const EXTENT_BYTES: Option<u32> = None;
15003 }
15004 impl ::canadensis_encoding::Message for Vector3 {}
15005 impl Vector3 {}
15006 impl ::canadensis_encoding::Serialize for Vector3 {
15007 fn size_bits(&self) -> usize {
15008 96
15009 }
15010 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15011 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15012 }
15013 }
15014 impl ::canadensis_encoding::Deserialize for Vector3 {
15015 fn deserialize(
15016 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15017 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15018 where
15019 Self: Sized,
15020 {
15021 Ok(Self::deserialize_zero_copy(cursor))
15022 }
15023 }
15024 #[test]
15025 fn test_layout() {
15026 assert_eq!(::core::mem::size_of::<Vector3>() * 8, 96);
15027 assert_eq!(
15028 ::core::mem::offset_of!(Vector3, meter_per_second_per_second) * 8,
15029 0
15030 );
15031 }
15032 }
15033 }
15034 pub mod angle {
15035 pub mod narrow_scalar_1_0 {
15036 #[derive(
15041 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15042 )]
15043 #[repr(C, packed)]
15044 pub struct NarrowScalar {
15045 pub radian: ::half::f16,
15051 }
15052 impl ::canadensis_encoding::DataType for NarrowScalar {
15053 const EXTENT_BYTES: Option<u32> = None;
15055 }
15056 impl ::canadensis_encoding::Message for NarrowScalar {}
15057 impl NarrowScalar {}
15058 impl ::canadensis_encoding::Serialize for NarrowScalar {
15059 fn size_bits(&self) -> usize {
15060 16
15061 }
15062 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15063 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15064 }
15065 }
15066 impl ::canadensis_encoding::Deserialize for NarrowScalar {
15067 fn deserialize(
15068 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15069 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15070 where
15071 Self: Sized,
15072 {
15073 Ok(Self::deserialize_zero_copy(cursor))
15074 }
15075 }
15076 #[test]
15077 fn test_layout() {
15078 assert_eq!(::core::mem::size_of::<NarrowScalar>() * 8, 16);
15079 assert_eq!(::core::mem::offset_of!(NarrowScalar, radian) * 8, 0);
15080 }
15081 }
15082 pub mod narrow_vector3_1_0 {
15083 #[derive(
15088 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15089 )]
15090 #[repr(C, packed)]
15091 pub struct NarrowVector3 {
15092 pub radian: [::half::f16; 3],
15098 }
15099 impl ::canadensis_encoding::DataType for NarrowVector3 {
15100 const EXTENT_BYTES: Option<u32> = None;
15102 }
15103 impl ::canadensis_encoding::Message for NarrowVector3 {}
15104 impl NarrowVector3 {}
15105 impl ::canadensis_encoding::Serialize for NarrowVector3 {
15106 fn size_bits(&self) -> usize {
15107 48
15108 }
15109 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15110 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15111 }
15112 }
15113 impl ::canadensis_encoding::Deserialize for NarrowVector3 {
15114 fn deserialize(
15115 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15116 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15117 where
15118 Self: Sized,
15119 {
15120 Ok(Self::deserialize_zero_copy(cursor))
15121 }
15122 }
15123 #[test]
15124 fn test_layout() {
15125 assert_eq!(::core::mem::size_of::<NarrowVector3>() * 8, 48);
15126 assert_eq!(::core::mem::offset_of!(NarrowVector3, radian) * 8, 0);
15127 }
15128 }
15129 pub mod quaternion_1_0 {
15130 #[derive(
15135 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15136 )]
15137 #[repr(C, packed)]
15138 pub struct Quaternion {
15139 pub wxyz: [f32; 4],
15145 }
15146 impl ::canadensis_encoding::DataType for Quaternion {
15147 const EXTENT_BYTES: Option<u32> = None;
15149 }
15150 impl ::canadensis_encoding::Message for Quaternion {}
15151 impl Quaternion {}
15152 impl ::canadensis_encoding::Serialize for Quaternion {
15153 fn size_bits(&self) -> usize {
15154 128
15155 }
15156 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15157 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15158 }
15159 }
15160 impl ::canadensis_encoding::Deserialize for Quaternion {
15161 fn deserialize(
15162 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15163 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15164 where
15165 Self: Sized,
15166 {
15167 Ok(Self::deserialize_zero_copy(cursor))
15168 }
15169 }
15170 #[test]
15171 fn test_layout() {
15172 assert_eq!(::core::mem::size_of::<Quaternion>() * 8, 128);
15173 assert_eq!(::core::mem::offset_of!(Quaternion, wxyz) * 8, 0);
15174 }
15175 }
15176 pub mod scalar_1_0 {
15177 #[derive(
15182 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15183 )]
15184 #[repr(C, packed)]
15185 pub struct Scalar {
15186 pub radian: f32,
15192 }
15193 impl ::canadensis_encoding::DataType for Scalar {
15194 const EXTENT_BYTES: Option<u32> = None;
15196 }
15197 impl ::canadensis_encoding::Message for Scalar {}
15198 impl Scalar {}
15199 impl ::canadensis_encoding::Serialize for Scalar {
15200 fn size_bits(&self) -> usize {
15201 32
15202 }
15203 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15204 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15205 }
15206 }
15207 impl ::canadensis_encoding::Deserialize for Scalar {
15208 fn deserialize(
15209 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15210 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15211 where
15212 Self: Sized,
15213 {
15214 Ok(Self::deserialize_zero_copy(cursor))
15215 }
15216 }
15217 #[test]
15218 fn test_layout() {
15219 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
15220 assert_eq!(::core::mem::offset_of!(Scalar, radian) * 8, 0);
15221 }
15222 }
15223 pub mod vector3_1_0 {
15224 #[derive(
15229 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15230 )]
15231 #[repr(C, packed)]
15232 pub struct Vector3 {
15233 pub radian: [f32; 3],
15239 }
15240 impl ::canadensis_encoding::DataType for Vector3 {
15241 const EXTENT_BYTES: Option<u32> = None;
15243 }
15244 impl ::canadensis_encoding::Message for Vector3 {}
15245 impl Vector3 {}
15246 impl ::canadensis_encoding::Serialize for Vector3 {
15247 fn size_bits(&self) -> usize {
15248 96
15249 }
15250 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15251 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15252 }
15253 }
15254 impl ::canadensis_encoding::Deserialize for Vector3 {
15255 fn deserialize(
15256 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15257 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15258 where
15259 Self: Sized,
15260 {
15261 Ok(Self::deserialize_zero_copy(cursor))
15262 }
15263 }
15264 #[test]
15265 fn test_layout() {
15266 assert_eq!(::core::mem::size_of::<Vector3>() * 8, 96);
15267 assert_eq!(::core::mem::offset_of!(Vector3, radian) * 8, 0);
15268 }
15269 }
15270 pub mod wide_scalar_1_0 {
15271 #[derive(
15276 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15277 )]
15278 #[repr(C, packed)]
15279 pub struct WideScalar {
15280 pub radian: f64,
15286 }
15287 impl ::canadensis_encoding::DataType for WideScalar {
15288 const EXTENT_BYTES: Option<u32> = None;
15290 }
15291 impl ::canadensis_encoding::Message for WideScalar {}
15292 impl WideScalar {}
15293 impl ::canadensis_encoding::Serialize for WideScalar {
15294 fn size_bits(&self) -> usize {
15295 64
15296 }
15297 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15298 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15299 }
15300 }
15301 impl ::canadensis_encoding::Deserialize for WideScalar {
15302 fn deserialize(
15303 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15304 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15305 where
15306 Self: Sized,
15307 {
15308 Ok(Self::deserialize_zero_copy(cursor))
15309 }
15310 }
15311 #[test]
15312 fn test_layout() {
15313 assert_eq!(::core::mem::size_of::<WideScalar>() * 8, 64);
15314 assert_eq!(::core::mem::offset_of!(WideScalar, radian) * 8, 0);
15315 }
15316 }
15317 pub mod wide_vector3_1_0 {
15318 #[derive(
15323 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15324 )]
15325 #[repr(C, packed)]
15326 pub struct WideVector3 {
15327 pub radian: [f64; 3],
15333 }
15334 impl ::canadensis_encoding::DataType for WideVector3 {
15335 const EXTENT_BYTES: Option<u32> = None;
15337 }
15338 impl ::canadensis_encoding::Message for WideVector3 {}
15339 impl WideVector3 {}
15340 impl ::canadensis_encoding::Serialize for WideVector3 {
15341 fn size_bits(&self) -> usize {
15342 192
15343 }
15344 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15345 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15346 }
15347 }
15348 impl ::canadensis_encoding::Deserialize for WideVector3 {
15349 fn deserialize(
15350 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15351 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15352 where
15353 Self: Sized,
15354 {
15355 Ok(Self::deserialize_zero_copy(cursor))
15356 }
15357 }
15358 #[test]
15359 fn test_layout() {
15360 assert_eq!(::core::mem::size_of::<WideVector3>() * 8, 192);
15361 assert_eq!(::core::mem::offset_of!(WideVector3, radian) * 8, 0);
15362 }
15363 }
15364 }
15365 pub mod angular_acceleration {
15366 pub mod scalar_1_0 {
15367 #[derive(
15372 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15373 )]
15374 #[repr(C, packed)]
15375 pub struct Scalar {
15376 pub radian_per_second_per_second: f32,
15382 }
15383 impl ::canadensis_encoding::DataType for Scalar {
15384 const EXTENT_BYTES: Option<u32> = None;
15386 }
15387 impl ::canadensis_encoding::Message for Scalar {}
15388 impl Scalar {}
15389 impl ::canadensis_encoding::Serialize for Scalar {
15390 fn size_bits(&self) -> usize {
15391 32
15392 }
15393 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15394 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15395 }
15396 }
15397 impl ::canadensis_encoding::Deserialize for Scalar {
15398 fn deserialize(
15399 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15400 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15401 where
15402 Self: Sized,
15403 {
15404 Ok(Self::deserialize_zero_copy(cursor))
15405 }
15406 }
15407 #[test]
15408 fn test_layout() {
15409 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
15410 assert_eq!(
15411 ::core::mem::offset_of!(Scalar, radian_per_second_per_second) * 8,
15412 0
15413 );
15414 }
15415 }
15416 pub mod vector3_1_0 {
15417 #[derive(
15422 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15423 )]
15424 #[repr(C, packed)]
15425 pub struct Vector3 {
15426 pub radian_per_second_per_second: [f32; 3],
15432 }
15433 impl ::canadensis_encoding::DataType for Vector3 {
15434 const EXTENT_BYTES: Option<u32> = None;
15436 }
15437 impl ::canadensis_encoding::Message for Vector3 {}
15438 impl Vector3 {}
15439 impl ::canadensis_encoding::Serialize for Vector3 {
15440 fn size_bits(&self) -> usize {
15441 96
15442 }
15443 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15444 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15445 }
15446 }
15447 impl ::canadensis_encoding::Deserialize for Vector3 {
15448 fn deserialize(
15449 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15450 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15451 where
15452 Self: Sized,
15453 {
15454 Ok(Self::deserialize_zero_copy(cursor))
15455 }
15456 }
15457 #[test]
15458 fn test_layout() {
15459 assert_eq!(::core::mem::size_of::<Vector3>() * 8, 96);
15460 assert_eq!(
15461 ::core::mem::offset_of!(Vector3, radian_per_second_per_second) * 8,
15462 0
15463 );
15464 }
15465 }
15466 }
15467 pub mod angular_velocity {
15468 pub mod scalar_1_0 {
15469 #[derive(
15474 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15475 )]
15476 #[repr(C, packed)]
15477 pub struct Scalar {
15478 pub radian_per_second: f32,
15484 }
15485 impl ::canadensis_encoding::DataType for Scalar {
15486 const EXTENT_BYTES: Option<u32> = None;
15488 }
15489 impl ::canadensis_encoding::Message for Scalar {}
15490 impl Scalar {}
15491 impl ::canadensis_encoding::Serialize for Scalar {
15492 fn size_bits(&self) -> usize {
15493 32
15494 }
15495 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15496 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15497 }
15498 }
15499 impl ::canadensis_encoding::Deserialize for Scalar {
15500 fn deserialize(
15501 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15502 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15503 where
15504 Self: Sized,
15505 {
15506 Ok(Self::deserialize_zero_copy(cursor))
15507 }
15508 }
15509 #[test]
15510 fn test_layout() {
15511 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
15512 assert_eq!(::core::mem::offset_of!(Scalar, radian_per_second) * 8, 0);
15513 }
15514 }
15515 pub mod vector3_1_0 {
15516 #[derive(
15521 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15522 )]
15523 #[repr(C, packed)]
15524 pub struct Vector3 {
15525 pub radian_per_second: [f32; 3],
15531 }
15532 impl ::canadensis_encoding::DataType for Vector3 {
15533 const EXTENT_BYTES: Option<u32> = None;
15535 }
15536 impl ::canadensis_encoding::Message for Vector3 {}
15537 impl Vector3 {}
15538 impl ::canadensis_encoding::Serialize for Vector3 {
15539 fn size_bits(&self) -> usize {
15540 96
15541 }
15542 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15543 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15544 }
15545 }
15546 impl ::canadensis_encoding::Deserialize for Vector3 {
15547 fn deserialize(
15548 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15549 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15550 where
15551 Self: Sized,
15552 {
15553 Ok(Self::deserialize_zero_copy(cursor))
15554 }
15555 }
15556 #[test]
15557 fn test_layout() {
15558 assert_eq!(::core::mem::size_of::<Vector3>() * 8, 96);
15559 assert_eq!(::core::mem::offset_of!(Vector3, radian_per_second) * 8, 0);
15560 }
15561 }
15562 }
15563 pub mod duration {
15564 pub mod scalar_1_0 {
15565 #[derive(
15570 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15571 )]
15572 #[repr(C, packed)]
15573 pub struct Scalar {
15574 pub second: f32,
15580 }
15581 impl ::canadensis_encoding::DataType for Scalar {
15582 const EXTENT_BYTES: Option<u32> = None;
15584 }
15585 impl ::canadensis_encoding::Message for Scalar {}
15586 impl Scalar {}
15587 impl ::canadensis_encoding::Serialize for Scalar {
15588 fn size_bits(&self) -> usize {
15589 32
15590 }
15591 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15592 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15593 }
15594 }
15595 impl ::canadensis_encoding::Deserialize for Scalar {
15596 fn deserialize(
15597 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15598 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15599 where
15600 Self: Sized,
15601 {
15602 Ok(Self::deserialize_zero_copy(cursor))
15603 }
15604 }
15605 #[test]
15606 fn test_layout() {
15607 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
15608 assert_eq!(::core::mem::offset_of!(Scalar, second) * 8, 0);
15609 }
15610 }
15611 pub mod wide_scalar_1_0 {
15612 #[derive(
15617 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15618 )]
15619 #[repr(C, packed)]
15620 pub struct WideScalar {
15621 pub second: f64,
15627 }
15628 impl ::canadensis_encoding::DataType for WideScalar {
15629 const EXTENT_BYTES: Option<u32> = None;
15631 }
15632 impl ::canadensis_encoding::Message for WideScalar {}
15633 impl WideScalar {}
15634 impl ::canadensis_encoding::Serialize for WideScalar {
15635 fn size_bits(&self) -> usize {
15636 64
15637 }
15638 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15639 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15640 }
15641 }
15642 impl ::canadensis_encoding::Deserialize for WideScalar {
15643 fn deserialize(
15644 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15645 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15646 where
15647 Self: Sized,
15648 {
15649 Ok(Self::deserialize_zero_copy(cursor))
15650 }
15651 }
15652 #[test]
15653 fn test_layout() {
15654 assert_eq!(::core::mem::size_of::<WideScalar>() * 8, 64);
15655 assert_eq!(::core::mem::offset_of!(WideScalar, second) * 8, 0);
15656 }
15657 }
15658 }
15659 pub mod electric_charge {
15660 pub mod scalar_1_0 {
15661 #[derive(
15666 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15667 )]
15668 #[repr(C, packed)]
15669 pub struct Scalar {
15670 pub coulomb: f32,
15676 }
15677 impl ::canadensis_encoding::DataType for Scalar {
15678 const EXTENT_BYTES: Option<u32> = None;
15680 }
15681 impl ::canadensis_encoding::Message for Scalar {}
15682 impl Scalar {}
15683 impl ::canadensis_encoding::Serialize for Scalar {
15684 fn size_bits(&self) -> usize {
15685 32
15686 }
15687 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15688 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15689 }
15690 }
15691 impl ::canadensis_encoding::Deserialize for Scalar {
15692 fn deserialize(
15693 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15694 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15695 where
15696 Self: Sized,
15697 {
15698 Ok(Self::deserialize_zero_copy(cursor))
15699 }
15700 }
15701 #[test]
15702 fn test_layout() {
15703 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
15704 assert_eq!(::core::mem::offset_of!(Scalar, coulomb) * 8, 0);
15705 }
15706 }
15707 }
15708 pub mod electric_current {
15709 pub mod scalar_1_0 {
15710 #[derive(
15715 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15716 )]
15717 #[repr(C, packed)]
15718 pub struct Scalar {
15719 pub ampere: f32,
15725 }
15726 impl ::canadensis_encoding::DataType for Scalar {
15727 const EXTENT_BYTES: Option<u32> = None;
15729 }
15730 impl ::canadensis_encoding::Message for Scalar {}
15731 impl Scalar {}
15732 impl ::canadensis_encoding::Serialize for Scalar {
15733 fn size_bits(&self) -> usize {
15734 32
15735 }
15736 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15737 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15738 }
15739 }
15740 impl ::canadensis_encoding::Deserialize for Scalar {
15741 fn deserialize(
15742 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15743 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15744 where
15745 Self: Sized,
15746 {
15747 Ok(Self::deserialize_zero_copy(cursor))
15748 }
15749 }
15750 #[test]
15751 fn test_layout() {
15752 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
15753 assert_eq!(::core::mem::offset_of!(Scalar, ampere) * 8, 0);
15754 }
15755 }
15756 }
15757 pub mod energy {
15758 pub mod scalar_1_0 {
15759 #[derive(
15764 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15765 )]
15766 #[repr(C, packed)]
15767 pub struct Scalar {
15768 pub joule: f32,
15774 }
15775 impl ::canadensis_encoding::DataType for Scalar {
15776 const EXTENT_BYTES: Option<u32> = None;
15778 }
15779 impl ::canadensis_encoding::Message for Scalar {}
15780 impl Scalar {}
15781 impl ::canadensis_encoding::Serialize for Scalar {
15782 fn size_bits(&self) -> usize {
15783 32
15784 }
15785 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15786 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15787 }
15788 }
15789 impl ::canadensis_encoding::Deserialize for Scalar {
15790 fn deserialize(
15791 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15792 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15793 where
15794 Self: Sized,
15795 {
15796 Ok(Self::deserialize_zero_copy(cursor))
15797 }
15798 }
15799 #[test]
15800 fn test_layout() {
15801 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
15802 assert_eq!(::core::mem::offset_of!(Scalar, joule) * 8, 0);
15803 }
15804 }
15805 }
15806 pub mod force {
15807 pub mod scalar_1_0 {
15808 #[derive(
15813 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15814 )]
15815 #[repr(C, packed)]
15816 pub struct Scalar {
15817 pub newton: f32,
15823 }
15824 impl ::canadensis_encoding::DataType for Scalar {
15825 const EXTENT_BYTES: Option<u32> = None;
15827 }
15828 impl ::canadensis_encoding::Message for Scalar {}
15829 impl Scalar {}
15830 impl ::canadensis_encoding::Serialize for Scalar {
15831 fn size_bits(&self) -> usize {
15832 32
15833 }
15834 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15835 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15836 }
15837 }
15838 impl ::canadensis_encoding::Deserialize for Scalar {
15839 fn deserialize(
15840 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15841 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15842 where
15843 Self: Sized,
15844 {
15845 Ok(Self::deserialize_zero_copy(cursor))
15846 }
15847 }
15848 #[test]
15849 fn test_layout() {
15850 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
15851 assert_eq!(::core::mem::offset_of!(Scalar, newton) * 8, 0);
15852 }
15853 }
15854 pub mod vector3_1_0 {
15855 #[derive(
15860 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15861 )]
15862 #[repr(C, packed)]
15863 pub struct Vector3 {
15864 pub newton: [f32; 3],
15870 }
15871 impl ::canadensis_encoding::DataType for Vector3 {
15872 const EXTENT_BYTES: Option<u32> = None;
15874 }
15875 impl ::canadensis_encoding::Message for Vector3 {}
15876 impl Vector3 {}
15877 impl ::canadensis_encoding::Serialize for Vector3 {
15878 fn size_bits(&self) -> usize {
15879 96
15880 }
15881 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15882 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15883 }
15884 }
15885 impl ::canadensis_encoding::Deserialize for Vector3 {
15886 fn deserialize(
15887 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15888 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15889 where
15890 Self: Sized,
15891 {
15892 Ok(Self::deserialize_zero_copy(cursor))
15893 }
15894 }
15895 #[test]
15896 fn test_layout() {
15897 assert_eq!(::core::mem::size_of::<Vector3>() * 8, 96);
15898 assert_eq!(::core::mem::offset_of!(Vector3, newton) * 8, 0);
15899 }
15900 }
15901 }
15902 pub mod frequency {
15903 pub mod scalar_1_0 {
15904 #[derive(
15909 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15910 )]
15911 #[repr(C, packed)]
15912 pub struct Scalar {
15913 pub hertz: f32,
15919 }
15920 impl ::canadensis_encoding::DataType for Scalar {
15921 const EXTENT_BYTES: Option<u32> = None;
15923 }
15924 impl ::canadensis_encoding::Message for Scalar {}
15925 impl Scalar {}
15926 impl ::canadensis_encoding::Serialize for Scalar {
15927 fn size_bits(&self) -> usize {
15928 32
15929 }
15930 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15931 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15932 }
15933 }
15934 impl ::canadensis_encoding::Deserialize for Scalar {
15935 fn deserialize(
15936 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15937 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15938 where
15939 Self: Sized,
15940 {
15941 Ok(Self::deserialize_zero_copy(cursor))
15942 }
15943 }
15944 #[test]
15945 fn test_layout() {
15946 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
15947 assert_eq!(::core::mem::offset_of!(Scalar, hertz) * 8, 0);
15948 }
15949 }
15950 }
15951 pub mod length {
15952 pub mod narrow_scalar_1_0 {
15953 #[derive(
15958 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
15959 )]
15960 #[repr(C, packed)]
15961 pub struct NarrowScalar {
15962 pub meter: ::half::f16,
15968 }
15969 impl ::canadensis_encoding::DataType for NarrowScalar {
15970 const EXTENT_BYTES: Option<u32> = None;
15972 }
15973 impl ::canadensis_encoding::Message for NarrowScalar {}
15974 impl NarrowScalar {}
15975 impl ::canadensis_encoding::Serialize for NarrowScalar {
15976 fn size_bits(&self) -> usize {
15977 16
15978 }
15979 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
15980 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
15981 }
15982 }
15983 impl ::canadensis_encoding::Deserialize for NarrowScalar {
15984 fn deserialize(
15985 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
15986 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
15987 where
15988 Self: Sized,
15989 {
15990 Ok(Self::deserialize_zero_copy(cursor))
15991 }
15992 }
15993 #[test]
15994 fn test_layout() {
15995 assert_eq!(::core::mem::size_of::<NarrowScalar>() * 8, 16);
15996 assert_eq!(::core::mem::offset_of!(NarrowScalar, meter) * 8, 0);
15997 }
15998 }
15999 pub mod narrow_vector3_1_0 {
16000 #[derive(
16005 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16006 )]
16007 #[repr(C, packed)]
16008 pub struct NarrowVector3 {
16009 pub meter: [::half::f16; 3],
16015 }
16016 impl ::canadensis_encoding::DataType for NarrowVector3 {
16017 const EXTENT_BYTES: Option<u32> = None;
16019 }
16020 impl ::canadensis_encoding::Message for NarrowVector3 {}
16021 impl NarrowVector3 {}
16022 impl ::canadensis_encoding::Serialize for NarrowVector3 {
16023 fn size_bits(&self) -> usize {
16024 48
16025 }
16026 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16027 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16028 }
16029 }
16030 impl ::canadensis_encoding::Deserialize for NarrowVector3 {
16031 fn deserialize(
16032 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16033 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16034 where
16035 Self: Sized,
16036 {
16037 Ok(Self::deserialize_zero_copy(cursor))
16038 }
16039 }
16040 #[test]
16041 fn test_layout() {
16042 assert_eq!(::core::mem::size_of::<NarrowVector3>() * 8, 48);
16043 assert_eq!(::core::mem::offset_of!(NarrowVector3, meter) * 8, 0);
16044 }
16045 }
16046 pub mod scalar_1_0 {
16047 #[derive(
16052 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16053 )]
16054 #[repr(C, packed)]
16055 pub struct Scalar {
16056 pub meter: f32,
16062 }
16063 impl ::canadensis_encoding::DataType for Scalar {
16064 const EXTENT_BYTES: Option<u32> = None;
16066 }
16067 impl ::canadensis_encoding::Message for Scalar {}
16068 impl Scalar {}
16069 impl ::canadensis_encoding::Serialize for Scalar {
16070 fn size_bits(&self) -> usize {
16071 32
16072 }
16073 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16074 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16075 }
16076 }
16077 impl ::canadensis_encoding::Deserialize for Scalar {
16078 fn deserialize(
16079 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16080 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16081 where
16082 Self: Sized,
16083 {
16084 Ok(Self::deserialize_zero_copy(cursor))
16085 }
16086 }
16087 #[test]
16088 fn test_layout() {
16089 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
16090 assert_eq!(::core::mem::offset_of!(Scalar, meter) * 8, 0);
16091 }
16092 }
16093 pub mod vector3_1_0 {
16094 #[derive(
16099 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16100 )]
16101 #[repr(C, packed)]
16102 pub struct Vector3 {
16103 pub meter: [f32; 3],
16109 }
16110 impl ::canadensis_encoding::DataType for Vector3 {
16111 const EXTENT_BYTES: Option<u32> = None;
16113 }
16114 impl ::canadensis_encoding::Message for Vector3 {}
16115 impl Vector3 {}
16116 impl ::canadensis_encoding::Serialize for Vector3 {
16117 fn size_bits(&self) -> usize {
16118 96
16119 }
16120 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16121 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16122 }
16123 }
16124 impl ::canadensis_encoding::Deserialize for Vector3 {
16125 fn deserialize(
16126 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16127 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16128 where
16129 Self: Sized,
16130 {
16131 Ok(Self::deserialize_zero_copy(cursor))
16132 }
16133 }
16134 #[test]
16135 fn test_layout() {
16136 assert_eq!(::core::mem::size_of::<Vector3>() * 8, 96);
16137 assert_eq!(::core::mem::offset_of!(Vector3, meter) * 8, 0);
16138 }
16139 }
16140 pub mod wide_scalar_1_0 {
16141 #[derive(
16146 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16147 )]
16148 #[repr(C, packed)]
16149 pub struct WideScalar {
16150 pub meter: f64,
16156 }
16157 impl ::canadensis_encoding::DataType for WideScalar {
16158 const EXTENT_BYTES: Option<u32> = None;
16160 }
16161 impl ::canadensis_encoding::Message for WideScalar {}
16162 impl WideScalar {}
16163 impl ::canadensis_encoding::Serialize for WideScalar {
16164 fn size_bits(&self) -> usize {
16165 64
16166 }
16167 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16168 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16169 }
16170 }
16171 impl ::canadensis_encoding::Deserialize for WideScalar {
16172 fn deserialize(
16173 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16174 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16175 where
16176 Self: Sized,
16177 {
16178 Ok(Self::deserialize_zero_copy(cursor))
16179 }
16180 }
16181 #[test]
16182 fn test_layout() {
16183 assert_eq!(::core::mem::size_of::<WideScalar>() * 8, 64);
16184 assert_eq!(::core::mem::offset_of!(WideScalar, meter) * 8, 0);
16185 }
16186 }
16187 pub mod wide_vector3_1_0 {
16188 #[derive(
16193 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16194 )]
16195 #[repr(C, packed)]
16196 pub struct WideVector3 {
16197 pub meter: [f64; 3],
16203 }
16204 impl ::canadensis_encoding::DataType for WideVector3 {
16205 const EXTENT_BYTES: Option<u32> = None;
16207 }
16208 impl ::canadensis_encoding::Message for WideVector3 {}
16209 impl WideVector3 {}
16210 impl ::canadensis_encoding::Serialize for WideVector3 {
16211 fn size_bits(&self) -> usize {
16212 192
16213 }
16214 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16215 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16216 }
16217 }
16218 impl ::canadensis_encoding::Deserialize for WideVector3 {
16219 fn deserialize(
16220 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16221 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16222 where
16223 Self: Sized,
16224 {
16225 Ok(Self::deserialize_zero_copy(cursor))
16226 }
16227 }
16228 #[test]
16229 fn test_layout() {
16230 assert_eq!(::core::mem::size_of::<WideVector3>() * 8, 192);
16231 assert_eq!(::core::mem::offset_of!(WideVector3, meter) * 8, 0);
16232 }
16233 }
16234 }
16235 pub mod luminance {
16236 pub mod scalar_1_0 {
16237 #[derive(
16242 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16243 )]
16244 #[repr(C, packed)]
16245 pub struct Scalar {
16246 pub candela_per_square_meter: f32,
16252 }
16253 impl ::canadensis_encoding::DataType for Scalar {
16254 const EXTENT_BYTES: Option<u32> = None;
16256 }
16257 impl ::canadensis_encoding::Message for Scalar {}
16258 impl Scalar {}
16259 impl ::canadensis_encoding::Serialize for Scalar {
16260 fn size_bits(&self) -> usize {
16261 32
16262 }
16263 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16264 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16265 }
16266 }
16267 impl ::canadensis_encoding::Deserialize for Scalar {
16268 fn deserialize(
16269 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16270 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16271 where
16272 Self: Sized,
16273 {
16274 Ok(Self::deserialize_zero_copy(cursor))
16275 }
16276 }
16277 #[test]
16278 fn test_layout() {
16279 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
16280 assert_eq!(
16281 ::core::mem::offset_of!(Scalar, candela_per_square_meter) * 8,
16282 0
16283 );
16284 }
16285 }
16286 }
16287 pub mod magnetic_field_strength {
16288 #[allow(deprecated)]
16289 #[cfg_attr(not(test), deprecated)]
16290 pub mod scalar_1_0 {
16291 #[cfg_attr(
16296 not(doctest),
16297 doc = " Use v1.1 instead where the unit of measure is named correctly."
16298 )]
16299 #[derive(
16300 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16301 )]
16302 #[repr(C, packed)]
16303 #[deprecated]
16304 pub struct Scalar {
16305 pub tesla: f32,
16311 }
16312 impl ::canadensis_encoding::DataType for Scalar {
16313 const EXTENT_BYTES: Option<u32> = None;
16315 }
16316 impl ::canadensis_encoding::Message for Scalar {}
16317 impl Scalar {}
16318 impl ::canadensis_encoding::Serialize for Scalar {
16319 fn size_bits(&self) -> usize {
16320 32
16321 }
16322 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16323 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16324 }
16325 }
16326 impl ::canadensis_encoding::Deserialize for Scalar {
16327 fn deserialize(
16328 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16329 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16330 where
16331 Self: Sized,
16332 {
16333 Ok(Self::deserialize_zero_copy(cursor))
16334 }
16335 }
16336 #[test]
16337 fn test_layout() {
16338 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
16339 assert_eq!(::core::mem::offset_of!(Scalar, tesla) * 8, 0);
16340 }
16341 }
16342 pub mod scalar_1_1 {
16343 #[derive(
16348 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16349 )]
16350 #[repr(C, packed)]
16351 pub struct Scalar {
16352 pub ampere_per_meter: f32,
16358 }
16359 impl ::canadensis_encoding::DataType for Scalar {
16360 const EXTENT_BYTES: Option<u32> = None;
16362 }
16363 impl ::canadensis_encoding::Message for Scalar {}
16364 impl Scalar {}
16365 impl ::canadensis_encoding::Serialize for Scalar {
16366 fn size_bits(&self) -> usize {
16367 32
16368 }
16369 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16370 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16371 }
16372 }
16373 impl ::canadensis_encoding::Deserialize for Scalar {
16374 fn deserialize(
16375 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16376 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16377 where
16378 Self: Sized,
16379 {
16380 Ok(Self::deserialize_zero_copy(cursor))
16381 }
16382 }
16383 #[test]
16384 fn test_layout() {
16385 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
16386 assert_eq!(::core::mem::offset_of!(Scalar, ampere_per_meter) * 8, 0);
16387 }
16388 }
16389 #[allow(deprecated)]
16390 #[cfg_attr(not(test), deprecated)]
16391 pub mod vector3_1_0 {
16392 #[cfg_attr(
16397 not(doctest),
16398 doc = " Use v1.1 instead where the unit of measure is named correctly."
16399 )]
16400 #[derive(
16401 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16402 )]
16403 #[repr(C, packed)]
16404 #[deprecated]
16405 pub struct Vector3 {
16406 pub tesla: [f32; 3],
16412 }
16413 impl ::canadensis_encoding::DataType for Vector3 {
16414 const EXTENT_BYTES: Option<u32> = None;
16416 }
16417 impl ::canadensis_encoding::Message for Vector3 {}
16418 impl Vector3 {}
16419 impl ::canadensis_encoding::Serialize for Vector3 {
16420 fn size_bits(&self) -> usize {
16421 96
16422 }
16423 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16424 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16425 }
16426 }
16427 impl ::canadensis_encoding::Deserialize for Vector3 {
16428 fn deserialize(
16429 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16430 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16431 where
16432 Self: Sized,
16433 {
16434 Ok(Self::deserialize_zero_copy(cursor))
16435 }
16436 }
16437 #[test]
16438 fn test_layout() {
16439 assert_eq!(::core::mem::size_of::<Vector3>() * 8, 96);
16440 assert_eq!(::core::mem::offset_of!(Vector3, tesla) * 8, 0);
16441 }
16442 }
16443 pub mod vector3_1_1 {
16444 #[derive(
16449 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16450 )]
16451 #[repr(C, packed)]
16452 pub struct Vector3 {
16453 pub ampere_per_meter: [f32; 3],
16459 }
16460 impl ::canadensis_encoding::DataType for Vector3 {
16461 const EXTENT_BYTES: Option<u32> = None;
16463 }
16464 impl ::canadensis_encoding::Message for Vector3 {}
16465 impl Vector3 {}
16466 impl ::canadensis_encoding::Serialize for Vector3 {
16467 fn size_bits(&self) -> usize {
16468 96
16469 }
16470 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16471 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16472 }
16473 }
16474 impl ::canadensis_encoding::Deserialize for Vector3 {
16475 fn deserialize(
16476 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16477 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16478 where
16479 Self: Sized,
16480 {
16481 Ok(Self::deserialize_zero_copy(cursor))
16482 }
16483 }
16484 #[test]
16485 fn test_layout() {
16486 assert_eq!(::core::mem::size_of::<Vector3>() * 8, 96);
16487 assert_eq!(::core::mem::offset_of!(Vector3, ampere_per_meter) * 8, 0);
16488 }
16489 }
16490 }
16491 pub mod magnetic_flux_density {
16492 pub mod scalar_1_0 {
16493 #[derive(
16498 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16499 )]
16500 #[repr(C, packed)]
16501 pub struct Scalar {
16502 pub tesla: f32,
16508 }
16509 impl ::canadensis_encoding::DataType for Scalar {
16510 const EXTENT_BYTES: Option<u32> = None;
16512 }
16513 impl ::canadensis_encoding::Message for Scalar {}
16514 impl Scalar {}
16515 impl ::canadensis_encoding::Serialize for Scalar {
16516 fn size_bits(&self) -> usize {
16517 32
16518 }
16519 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16520 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16521 }
16522 }
16523 impl ::canadensis_encoding::Deserialize for Scalar {
16524 fn deserialize(
16525 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16526 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16527 where
16528 Self: Sized,
16529 {
16530 Ok(Self::deserialize_zero_copy(cursor))
16531 }
16532 }
16533 #[test]
16534 fn test_layout() {
16535 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
16536 assert_eq!(::core::mem::offset_of!(Scalar, tesla) * 8, 0);
16537 }
16538 }
16539 pub mod vector3_1_0 {
16540 #[derive(
16545 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16546 )]
16547 #[repr(C, packed)]
16548 pub struct Vector3 {
16549 pub tesla: [f32; 3],
16555 }
16556 impl ::canadensis_encoding::DataType for Vector3 {
16557 const EXTENT_BYTES: Option<u32> = None;
16559 }
16560 impl ::canadensis_encoding::Message for Vector3 {}
16561 impl Vector3 {}
16562 impl ::canadensis_encoding::Serialize for Vector3 {
16563 fn size_bits(&self) -> usize {
16564 96
16565 }
16566 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16567 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16568 }
16569 }
16570 impl ::canadensis_encoding::Deserialize for Vector3 {
16571 fn deserialize(
16572 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16573 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16574 where
16575 Self: Sized,
16576 {
16577 Ok(Self::deserialize_zero_copy(cursor))
16578 }
16579 }
16580 #[test]
16581 fn test_layout() {
16582 assert_eq!(::core::mem::size_of::<Vector3>() * 8, 96);
16583 assert_eq!(::core::mem::offset_of!(Vector3, tesla) * 8, 0);
16584 }
16585 }
16586 }
16587 pub mod mass {
16588 pub mod scalar_1_0 {
16589 #[derive(
16594 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16595 )]
16596 #[repr(C, packed)]
16597 pub struct Scalar {
16598 pub kilogram: f32,
16604 }
16605 impl ::canadensis_encoding::DataType for Scalar {
16606 const EXTENT_BYTES: Option<u32> = None;
16608 }
16609 impl ::canadensis_encoding::Message for Scalar {}
16610 impl Scalar {}
16611 impl ::canadensis_encoding::Serialize for Scalar {
16612 fn size_bits(&self) -> usize {
16613 32
16614 }
16615 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16616 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16617 }
16618 }
16619 impl ::canadensis_encoding::Deserialize for Scalar {
16620 fn deserialize(
16621 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16622 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16623 where
16624 Self: Sized,
16625 {
16626 Ok(Self::deserialize_zero_copy(cursor))
16627 }
16628 }
16629 #[test]
16630 fn test_layout() {
16631 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
16632 assert_eq!(::core::mem::offset_of!(Scalar, kilogram) * 8, 0);
16633 }
16634 }
16635 }
16636 pub mod power {
16637 pub mod scalar_1_0 {
16638 #[derive(
16643 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16644 )]
16645 #[repr(C, packed)]
16646 pub struct Scalar {
16647 pub watt: f32,
16653 }
16654 impl ::canadensis_encoding::DataType for Scalar {
16655 const EXTENT_BYTES: Option<u32> = None;
16657 }
16658 impl ::canadensis_encoding::Message for Scalar {}
16659 impl Scalar {}
16660 impl ::canadensis_encoding::Serialize for Scalar {
16661 fn size_bits(&self) -> usize {
16662 32
16663 }
16664 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16665 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16666 }
16667 }
16668 impl ::canadensis_encoding::Deserialize for Scalar {
16669 fn deserialize(
16670 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16671 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16672 where
16673 Self: Sized,
16674 {
16675 Ok(Self::deserialize_zero_copy(cursor))
16676 }
16677 }
16678 #[test]
16679 fn test_layout() {
16680 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
16681 assert_eq!(::core::mem::offset_of!(Scalar, watt) * 8, 0);
16682 }
16683 }
16684 }
16685 pub mod pressure {
16686 pub mod scalar_1_0 {
16687 #[derive(
16692 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16693 )]
16694 #[repr(C, packed)]
16695 pub struct Scalar {
16696 pub pascal: f32,
16702 }
16703 impl ::canadensis_encoding::DataType for Scalar {
16704 const EXTENT_BYTES: Option<u32> = None;
16706 }
16707 impl ::canadensis_encoding::Message for Scalar {}
16708 impl Scalar {}
16709 impl ::canadensis_encoding::Serialize for Scalar {
16710 fn size_bits(&self) -> usize {
16711 32
16712 }
16713 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16714 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16715 }
16716 }
16717 impl ::canadensis_encoding::Deserialize for Scalar {
16718 fn deserialize(
16719 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16720 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16721 where
16722 Self: Sized,
16723 {
16724 Ok(Self::deserialize_zero_copy(cursor))
16725 }
16726 }
16727 #[test]
16728 fn test_layout() {
16729 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
16730 assert_eq!(::core::mem::offset_of!(Scalar, pascal) * 8, 0);
16731 }
16732 }
16733 }
16734 pub mod temperature {
16735 pub mod scalar_1_0 {
16736 #[derive(
16741 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16742 )]
16743 #[repr(C, packed)]
16744 pub struct Scalar {
16745 pub kelvin: f32,
16751 }
16752 impl ::canadensis_encoding::DataType for Scalar {
16753 const EXTENT_BYTES: Option<u32> = None;
16755 }
16756 impl ::canadensis_encoding::Message for Scalar {}
16757 impl Scalar {}
16758 impl ::canadensis_encoding::Serialize for Scalar {
16759 fn size_bits(&self) -> usize {
16760 32
16761 }
16762 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16763 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16764 }
16765 }
16766 impl ::canadensis_encoding::Deserialize for Scalar {
16767 fn deserialize(
16768 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16769 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16770 where
16771 Self: Sized,
16772 {
16773 Ok(Self::deserialize_zero_copy(cursor))
16774 }
16775 }
16776 #[test]
16777 fn test_layout() {
16778 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
16779 assert_eq!(::core::mem::offset_of!(Scalar, kelvin) * 8, 0);
16780 }
16781 }
16782 }
16783 pub mod torque {
16784 pub mod scalar_1_0 {
16785 #[derive(
16790 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16791 )]
16792 #[repr(C, packed)]
16793 pub struct Scalar {
16794 pub newton_meter: f32,
16800 }
16801 impl ::canadensis_encoding::DataType for Scalar {
16802 const EXTENT_BYTES: Option<u32> = None;
16804 }
16805 impl ::canadensis_encoding::Message for Scalar {}
16806 impl Scalar {}
16807 impl ::canadensis_encoding::Serialize for Scalar {
16808 fn size_bits(&self) -> usize {
16809 32
16810 }
16811 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16812 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16813 }
16814 }
16815 impl ::canadensis_encoding::Deserialize for Scalar {
16816 fn deserialize(
16817 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16818 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16819 where
16820 Self: Sized,
16821 {
16822 Ok(Self::deserialize_zero_copy(cursor))
16823 }
16824 }
16825 #[test]
16826 fn test_layout() {
16827 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
16828 assert_eq!(::core::mem::offset_of!(Scalar, newton_meter) * 8, 0);
16829 }
16830 }
16831 pub mod vector3_1_0 {
16832 #[derive(
16837 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16838 )]
16839 #[repr(C, packed)]
16840 pub struct Vector3 {
16841 pub newton_meter: [f32; 3],
16847 }
16848 impl ::canadensis_encoding::DataType for Vector3 {
16849 const EXTENT_BYTES: Option<u32> = None;
16851 }
16852 impl ::canadensis_encoding::Message for Vector3 {}
16853 impl Vector3 {}
16854 impl ::canadensis_encoding::Serialize for Vector3 {
16855 fn size_bits(&self) -> usize {
16856 96
16857 }
16858 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16859 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16860 }
16861 }
16862 impl ::canadensis_encoding::Deserialize for Vector3 {
16863 fn deserialize(
16864 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16865 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16866 where
16867 Self: Sized,
16868 {
16869 Ok(Self::deserialize_zero_copy(cursor))
16870 }
16871 }
16872 #[test]
16873 fn test_layout() {
16874 assert_eq!(::core::mem::size_of::<Vector3>() * 8, 96);
16875 assert_eq!(::core::mem::offset_of!(Vector3, newton_meter) * 8, 0);
16876 }
16877 }
16878 }
16879 pub mod velocity {
16880 pub mod scalar_1_0 {
16881 #[derive(
16886 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16887 )]
16888 #[repr(C, packed)]
16889 pub struct Scalar {
16890 pub meter_per_second: f32,
16896 }
16897 impl ::canadensis_encoding::DataType for Scalar {
16898 const EXTENT_BYTES: Option<u32> = None;
16900 }
16901 impl ::canadensis_encoding::Message for Scalar {}
16902 impl Scalar {}
16903 impl ::canadensis_encoding::Serialize for Scalar {
16904 fn size_bits(&self) -> usize {
16905 32
16906 }
16907 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16908 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16909 }
16910 }
16911 impl ::canadensis_encoding::Deserialize for Scalar {
16912 fn deserialize(
16913 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16914 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16915 where
16916 Self: Sized,
16917 {
16918 Ok(Self::deserialize_zero_copy(cursor))
16919 }
16920 }
16921 #[test]
16922 fn test_layout() {
16923 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
16924 assert_eq!(::core::mem::offset_of!(Scalar, meter_per_second) * 8, 0);
16925 }
16926 }
16927 pub mod vector3_1_0 {
16928 #[derive(
16933 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16934 )]
16935 #[repr(C, packed)]
16936 pub struct Vector3 {
16937 pub meter_per_second: [f32; 3],
16943 }
16944 impl ::canadensis_encoding::DataType for Vector3 {
16945 const EXTENT_BYTES: Option<u32> = None;
16947 }
16948 impl ::canadensis_encoding::Message for Vector3 {}
16949 impl Vector3 {}
16950 impl ::canadensis_encoding::Serialize for Vector3 {
16951 fn size_bits(&self) -> usize {
16952 96
16953 }
16954 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
16955 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
16956 }
16957 }
16958 impl ::canadensis_encoding::Deserialize for Vector3 {
16959 fn deserialize(
16960 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
16961 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
16962 where
16963 Self: Sized,
16964 {
16965 Ok(Self::deserialize_zero_copy(cursor))
16966 }
16967 }
16968 #[test]
16969 fn test_layout() {
16970 assert_eq!(::core::mem::size_of::<Vector3>() * 8, 96);
16971 assert_eq!(::core::mem::offset_of!(Vector3, meter_per_second) * 8, 0);
16972 }
16973 }
16974 }
16975 pub mod voltage {
16976 pub mod scalar_1_0 {
16977 #[derive(
16982 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
16983 )]
16984 #[repr(C, packed)]
16985 pub struct Scalar {
16986 pub volt: f32,
16992 }
16993 impl ::canadensis_encoding::DataType for Scalar {
16994 const EXTENT_BYTES: Option<u32> = None;
16996 }
16997 impl ::canadensis_encoding::Message for Scalar {}
16998 impl Scalar {}
16999 impl ::canadensis_encoding::Serialize for Scalar {
17000 fn size_bits(&self) -> usize {
17001 32
17002 }
17003 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
17004 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
17005 }
17006 }
17007 impl ::canadensis_encoding::Deserialize for Scalar {
17008 fn deserialize(
17009 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
17010 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
17011 where
17012 Self: Sized,
17013 {
17014 Ok(Self::deserialize_zero_copy(cursor))
17015 }
17016 }
17017 #[test]
17018 fn test_layout() {
17019 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
17020 assert_eq!(::core::mem::offset_of!(Scalar, volt) * 8, 0);
17021 }
17022 }
17023 }
17024 pub mod volume {
17025 pub mod scalar_1_0 {
17026 #[derive(
17031 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
17032 )]
17033 #[repr(C, packed)]
17034 pub struct Scalar {
17035 pub cubic_meter: f32,
17041 }
17042 impl ::canadensis_encoding::DataType for Scalar {
17043 const EXTENT_BYTES: Option<u32> = None;
17045 }
17046 impl ::canadensis_encoding::Message for Scalar {}
17047 impl Scalar {}
17048 impl ::canadensis_encoding::Serialize for Scalar {
17049 fn size_bits(&self) -> usize {
17050 32
17051 }
17052 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
17053 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
17054 }
17055 }
17056 impl ::canadensis_encoding::Deserialize for Scalar {
17057 fn deserialize(
17058 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
17059 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
17060 where
17061 Self: Sized,
17062 {
17063 Ok(Self::deserialize_zero_copy(cursor))
17064 }
17065 }
17066 #[test]
17067 fn test_layout() {
17068 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
17069 assert_eq!(::core::mem::offset_of!(Scalar, cubic_meter) * 8, 0);
17070 }
17071 }
17072 }
17073 pub mod volumetric_flow_rate {
17074 pub mod scalar_1_0 {
17075 #[derive(
17080 ::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable,
17081 )]
17082 #[repr(C, packed)]
17083 pub struct Scalar {
17084 pub cubic_meter_per_second: f32,
17090 }
17091 impl ::canadensis_encoding::DataType for Scalar {
17092 const EXTENT_BYTES: Option<u32> = None;
17094 }
17095 impl ::canadensis_encoding::Message for Scalar {}
17096 impl Scalar {}
17097 impl ::canadensis_encoding::Serialize for Scalar {
17098 fn size_bits(&self) -> usize {
17099 32
17100 }
17101 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
17102 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
17103 }
17104 }
17105 impl ::canadensis_encoding::Deserialize for Scalar {
17106 fn deserialize(
17107 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
17108 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
17109 where
17110 Self: Sized,
17111 {
17112 Ok(Self::deserialize_zero_copy(cursor))
17113 }
17114 }
17115 #[test]
17116 fn test_layout() {
17117 assert_eq!(::core::mem::size_of::<Scalar>() * 8, 32);
17118 assert_eq!(
17119 ::core::mem::offset_of!(Scalar, cubic_meter_per_second) * 8,
17120 0
17121 );
17122 }
17123 }
17124 }
17125 }
17126 }
17127 pub mod time {
17128 pub mod get_synchronization_master_info_0_1 {
17129 #[cfg_attr(not(doctest), doc = "The fixed ID of this service")]
17130 pub const SERVICE: ::canadensis_core::ServiceId =
17131 ::canadensis_core::ServiceId::from_truncating(510);
17132
17133 #[cfg_attr(
17138 not(doctest),
17139 doc = " Every node that acts as a time synchronization master, or is capable of acting as such,\n should support this service.\n Its objective is to provide information about which time system is currently used in the network.\n\n Once a time system is chosen, it cannot be changed as long as at least one node on the network is running.\n In other words, the time system cannot be changed while the network is operating.\n An implication of this is that if there are redundant time synchronization masters, they all shall\n use the same time system always."
17140 )]
17141 #[derive(::zerocopy::IntoBytes, ::zerocopy::FromBytes, ::zerocopy::Immutable)]
17142 #[repr(C, packed)]
17143 pub struct GetSynchronizationMasterInfoRequest {}
17144 impl ::canadensis_encoding::DataType for GetSynchronizationMasterInfoRequest {
17145 const EXTENT_BYTES: Option<u32> = Some(48);
17147 }
17148 impl ::canadensis_encoding::Request for GetSynchronizationMasterInfoRequest {}
17149 impl GetSynchronizationMasterInfoRequest {}
17150 impl ::canadensis_encoding::Serialize for GetSynchronizationMasterInfoRequest {
17151 fn size_bits(&self) -> usize {
17152 0
17153 }
17154 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
17155 cursor.write_aligned_bytes(::zerocopy::IntoBytes::as_bytes(self));
17156 }
17157 }
17158 impl ::canadensis_encoding::Deserialize for GetSynchronizationMasterInfoRequest {
17159 fn deserialize(
17160 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
17161 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
17162 where
17163 Self: Sized,
17164 {
17165 Ok(Self::deserialize_zero_copy(cursor))
17166 }
17167 }
17168 #[test]
17169 fn test_layout() {
17170 assert_eq!(
17171 ::core::mem::size_of::<GetSynchronizationMasterInfoRequest>() * 8,
17172 0
17173 );
17174 }
17175
17176 pub struct GetSynchronizationMasterInfoResponse {
17181 #[cfg_attr(
17182 not(doctest),
17183 doc = " [second^2]\n Error variance, in second^2, of the time value reported by this master.\n This value is allowed to change freely while the master is running.\n For example, if the master's own clock is synchronized with a GNSS, the error variance is expected to increase\n as signal reception deteriorates. If the signal is lost, this value is expected to grow steadily, the rate of\n growth would be dependent on the quality of the time keeping hardware available locally (bad hardware yields\n faster growth). Once the signal is regained, this value would drop back to nominal."
17184 )]
17185 pub error_variance: f32,
17191 #[cfg_attr(
17192 not(doctest),
17193 doc = " Time system currently in use by the master.\n Cannot be changed while the network is operating."
17194 )]
17195 pub time_system: crate::uavcan::time::time_system_0_1::TimeSystem,
17201 #[cfg_attr(
17202 not(doctest),
17203 doc = " Actual information about TAI provided by this master, if supported.\n The fields in this data type are optional."
17204 )]
17205 pub tai_info: crate::uavcan::time::tai_info_0_1::TAIInfo,
17211 }
17212 impl ::canadensis_encoding::DataType for GetSynchronizationMasterInfoResponse {
17213 const EXTENT_BYTES: Option<u32> = Some(192);
17215 }
17216 impl ::canadensis_encoding::Response for GetSynchronizationMasterInfoResponse {}
17217 impl GetSynchronizationMasterInfoResponse {}
17218 impl ::canadensis_encoding::Serialize for GetSynchronizationMasterInfoResponse {
17219 fn size_bits(&self) -> usize {
17220 56
17221 }
17222 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
17223 cursor.write_f32(self.error_variance);
17224 cursor.write_composite(&self.time_system);
17225 cursor.write_composite(&self.tai_info);
17226 }
17227 }
17228 impl ::canadensis_encoding::Deserialize for GetSynchronizationMasterInfoResponse {
17229 fn deserialize(
17230 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
17231 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
17232 where
17233 Self: Sized,
17234 {
17235 Ok(GetSynchronizationMasterInfoResponse {
17236 error_variance: { cursor.read_f32() },
17237 time_system: { cursor.read_composite()? },
17238 tai_info: { cursor.read_composite()? },
17239 })
17240 }
17241 }
17242 }
17243 pub mod synchronization_1_0 {
17244 #[cfg_attr(not(doctest), doc = "The fixed subject ID for this message type")]
17245 pub const SUBJECT: ::canadensis_core::SubjectId =
17246 ::canadensis_core::SubjectId::from_truncating(7168);
17247
17248 #[cfg_attr(
17253 not(doctest),
17254 doc = " Network-wide time synchronization message.\n Any node that publishes timestamped data should use this time reference.\n\n The time synchronization algorithm is based on the work\n \"Implementing a Distributed High-Resolution Real-Time Clock using the CAN-Bus\" by M. Gergeleit and H. Streich.\n The general idea of the algorithm is to have one or more nodes that periodically publish a message of this type\n containing the exact timestamp of the PREVIOUS transmission of this message.\n A node that publishes this message periodically is referred to as a \"time synchronization master\",\n whereas nodes that synchronize their clocks with the master are referred to as \"time synchronization slaves\".\n\n Once a time base is chosen, it cannot be changed as long as at least one node on the network is running.\n In other words, the time base cannot be changed while the network is operating.\n An implication of this is that if there are redundant time synchronization masters, they all shall\n use the same time base.\n\n The resolution is dependent on the transport and its physical layer, but generally it can be assumed\n to be close to one bit time but not better than one microsecond (e.g., for a 500 kbps CAN bus,\n the resolution is two microseconds). The maximum accuracy is achievable only if the transport layer\n supports precise timestamping in hardware; otherwise, the accuracy may be degraded.\n\n This algorithm allows the slaves to precisely estimate the difference (i.e., phase error) between their\n local time and the master clock they are synchronized with. The algorithm for clock rate adjustment\n is entirely implementation-defined (for example, a simple phase-locked loop or a PID rate controller can be used).\n\n The network can accommodate more than one time synchronization master for purposes of increased reliability:\n if one master fails, the others will continue to provide the network with accurate and consistent time information.\n The risk of undesirable transients while the masters are swapped is mitigated by the requirement that all masters\n use the same time base at all times, as described above.\n\n The master with the lowest node-ID is called the \"dominant master\". The current dominant master ceases to be one\n if its last synchronization message was published more than 3X seconds ago, where X is the time interval\n between the last and the previous messages published by it. In this case, the master with the next-higher node-ID\n will take over as the new dominant master. The current dominant master will be displaced immediately as soon as\n the first message from a new master with a lower node-ID is seen on the bus.\n\n In the presence of multiple masters, they all publish their time synchronization messages concurrently at all times.\n The slaves shall listen to the master with the lowest node-ID and ignore the messages published by masters with\n higher node-ID values.\n\n Currently, there is a work underway to develop and validate a highly robust fault-operational time synchronization\n algorithm where the slaves select the median time base among all available masters rather than using only the\n one with the lowest node-ID value. Follow the work at https://forum.opencyphal.org. When complete, this algorithm\n will be added in a backward-compatible way as an option for high-reliability systems.\n\n For networks with redundant transports, the timestamp value published on different interfaces is likely to be\n different, since different transports are generally not expected to be synchronized. Synchronization slaves\n are allowed to use any of the available redundant interfaces for synchronization at their discretion.\n\n The following pseudocode shows the logic of a time synchronization master. This example assumes that the master\n does not need to synchronize its own clock with other masters on the bus, which is the case if the current master\n is the only master, or if all masters synchronize their clocks with a robust external source, e.g., a GNSS system.\n If several masters need to synchronize their clock through the bus, their logic will be extended with the\n slave-side behavior explained later.\n\n // State variables\n transfer_id := 0;\n previous_tx_timestamp_per_iface[NUM_IFACES] := {0};\n\n // This function publishes a message with a specified transfer-ID using only one transport interface.\n function publishMessage(transfer_id, iface_index, msg);\n\n // This callback is invoked when the transport layer completes the transmission of a time sync message.\n // Observe that the time sync message is always a single-frame message by virtue of its small size.\n // The tx_timestamp argument contains the exact timestamp when the transport frame was delivered to the bus.\n function messageTxTimestampCallback(iface_index, tx_timestamp)\n {\n previous_tx_timestamp_per_iface[iface_index] := tx_timestamp;\n }\n\n // Publishes messages of type uavcan.time.Synchronization to each available transport interface.\n // It is assumed that this function is invoked with a fixed frequency not lower than 1 hertz.\n function publishTimeSync()\n {\n for (i := 0; i < NUM_IFACES; i++)\n {\n message := uavcan.time.Synchronization();\n message.previous_transmission_timestamp_usec := previous_tx_timestamp_per_iface[i];\n previous_tx_timestamp_per_iface[i] := 0;\n publishMessage(transfer_id, i, message);\n }\n transfer_id++; // Overflow shall be handled correctly\n }\n\n (end of the master-side logic pseudocode)\n The following pseudocode describes the logic of a time synchronization slave.\n\n // State variables:\n previous_rx_real_timestamp := 0; // This clock is being synchronized\n previous_rx_monotonic_timestamp := 0; // Monotonic time -- doesn't leap or change rate\n previous_transfer_id := 0;\n state := STATE_UPDATE; // Variants: STATE_UPDATE, STATE_ADJUST\n master_node_id := -1; // Invalid value\n iface_index := -1; // Invalid value\n\n // This function adjusts the local clock by the specified amount\n function adjustLocalTime(phase_error);\n\n function adjust(message)\n {\n // Clock adjustment will be performed every second message\n local_time_phase_error := previous_rx_real_timestamp - msg.previous_transmission_timestamp_microsecond;\n adjustLocalTime(local_time_phase_error);\n state := STATE_UPDATE;\n }\n\n function update(message)\n {\n // A message is assumed to have two timestamps:\n // Real - sampled from the clock that is being synchronized\n // Monotonic - clock that never leaps and never changes rate\n previous_rx_real_timestamp := message.rx_real_timestamp;\n previous_rx_monotonic_timestamp := message.rx_monotonic_timestamp;\n master_node_id := message.source_node_id;\n iface_index := message.iface_index;\n previous_transfer_id := message.transfer_id;\n state := STATE_ADJUST;\n }\n\n // Accepts the message of type uavcan.time.Synchronization\n function handleReceivedTimeSyncMessage(message)\n {\n time_since_previous_msg := message.monotonic_timestamp - previous_rx_monotonic_timestamp;\n\n needs_init := (master_node_id < 0) or (iface_index < 0);\n switch_master := message.source_node_id < master_node_id;\n\n // The value publisher_timeout is computed as described in the specification (3x interval)\n publisher_timed_out := time_since_previous_msg > publisher_timeout;\n\n if (needs_init or switch_master or publisher_timed_out)\n {\n update(message);\n }\n else if ((message.iface_index == iface_index) and (message.source_node_id == master_node_id))\n {\n // Revert the state to STATE_UPDATE if needed\n if (state == STATE_ADJUST)\n {\n msg_invalid := message.previous_transmission_timestamp_microsecond == 0;\n // Overflow shall be handled correctly\n wrong_tid := message.transfer_id != (previous_transfer_id + 1);\n wrong_timing := time_since_previous_msg > MAX_PUBLICATION_PERIOD;\n if (msg_invalid or wrong_tid or wrong_timing)\n {\n state := STATE_UPDATE;\n }\n }\n // Handle the current state\n if (state == STATE_ADJUST)\n {\n adjust(message);\n }\n else\n {\n update(message);\n }\n } // else ignore\n }\n\n (end of the slave-side logic pseudocode)"
17255 )]
17256 pub struct Synchronization {
17257 #[cfg_attr(
17258 not(doctest),
17259 doc = " The time when the PREVIOUS message was transmitted from the current publisher, in microseconds.\n If this message is published for the first time, or if the previous transmission was more than\n one second ago, this field shall be zero."
17260 )]
17261 pub previous_transmission_timestamp_microsecond: u64,
17267 }
17268 impl ::canadensis_encoding::DataType for Synchronization {
17269 const EXTENT_BYTES: Option<u32> = None;
17271 }
17272 impl ::canadensis_encoding::Message for Synchronization {}
17273 impl Synchronization {
17274 #[cfg_attr(
17275 not(doctest),
17276 doc = " [second]\n Publication period limits.\n A master should not change its publication period while running."
17277 )]
17278 pub const MAX_PUBLICATION_PERIOD: u8 = 1;
17279 #[cfg_attr(
17280 not(doctest),
17281 doc = " Synchronization slaves should normally switch to a new master if the current master was silent\n for thrice the interval between the reception of the last two messages published by it.\n For example, imagine that the last message was received at the time X, and the previous message\n was received at the time (X - 0.5 seconds); the period is 0.5 seconds, and therefore the publisher\n timeout is (0.5 seconds * 3) = 1.5 seconds. If there was no message from the current master in\n this amount of time, all slaves will synchronize with another master with the next-higher node-ID."
17282 )]
17283 pub const PUBLISHER_TIMEOUT_PERIOD_MULTIPLIER: u8 = 3;
17284 }
17285 impl ::canadensis_encoding::Serialize for Synchronization {
17286 fn size_bits(&self) -> usize {
17287 56
17288 }
17289 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
17290 cursor.write_u56(self.previous_transmission_timestamp_microsecond);
17291 }
17292 }
17293 impl ::canadensis_encoding::Deserialize for Synchronization {
17294 fn deserialize(
17295 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
17296 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
17297 where
17298 Self: Sized,
17299 {
17300 Ok(Synchronization {
17301 previous_transmission_timestamp_microsecond: { cursor.read_u56() as _ },
17302 })
17303 }
17304 }
17305 }
17306 pub mod synchronized_timestamp_1_0 {
17307 #[cfg_attr(
17312 not(doctest),
17313 doc = " Nested data type used for representing a network-wide synchronized timestamp with microsecond resolution.\n This data type is highly recommended for use both in standard and vendor-specific messages alike."
17314 )]
17315 pub struct SynchronizedTimestamp {
17316 #[cfg_attr(
17317 not(doctest),
17318 doc = " The number of microseconds that have passed since some arbitrary moment in the past.\n The moment of origin (i.e., the time base) is defined per-application. The current time base in use\n can be requested from the time synchronization master, see the corresponding service definition.\n\n This value is to never overflow. The value is 56-bit wide because:\n\n - 2^56 microseconds is about 2285 years, which is plenty. A 64-bit microsecond counter would be\n unnecessarily wide and its overflow interval of 585 thousand years induces a mild existential crisis.\n\n - Classic-CAN (not FD) transports carry up to 7 bytes of payload per frame.\n Time sync messages shall use single-frame transfers, which means that the value can't be wider than 56 bits."
17319 )]
17320 pub microsecond: u64,
17326 }
17327 impl ::canadensis_encoding::DataType for SynchronizedTimestamp {
17328 const EXTENT_BYTES: Option<u32> = None;
17330 }
17331 impl ::canadensis_encoding::Message for SynchronizedTimestamp {}
17332 impl SynchronizedTimestamp {
17333 #[cfg_attr(not(doctest), doc = " Zero means that the time is not known.")]
17334 pub const UNKNOWN: u64 = 0;
17335 }
17336 impl ::canadensis_encoding::Serialize for SynchronizedTimestamp {
17337 fn size_bits(&self) -> usize {
17338 56
17339 }
17340 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
17341 cursor.write_u56(self.microsecond);
17342 }
17343 }
17344 impl ::canadensis_encoding::Deserialize for SynchronizedTimestamp {
17345 fn deserialize(
17346 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
17347 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
17348 where
17349 Self: Sized,
17350 {
17351 Ok(SynchronizedTimestamp {
17352 microsecond: { cursor.read_u56() as _ },
17353 })
17354 }
17355 }
17356 }
17357 pub mod tai_info_0_1 {
17358 #[cfg_attr(
17363 not(doctest),
17364 doc = " This data types defines constants and runtime values pertaining to the International Atomic Time, also known as TAI.\n See https://en.wikipedia.org/wiki/International_Atomic_Time.\n\n The relationship between the three major time systems -- TAI, GPS, and UTC -- is as follows:\n\n TAI = GPS + 19 seconds\n TAI = UTC + LS + 10 seconds\n\n Where \"LS\" is the current number of leap seconds: https://en.wikipedia.org/wiki/Leap_second.\n\n Cyphal applications should only rely on TAI whenever a global time system is needed.\n GPS time is strongly discouraged for reasons of consistency across different positioning systems and applications."
17365 )]
17366 pub struct TAIInfo {
17367 #[cfg_attr(
17368 not(doctest),
17369 doc = " The current difference between TAI and UTC, if known. If unknown, set to zero.\n\n This value may change states between known and unknown while the master is running,\n depending on its ability to obtain robust values from external sources.\n\n This value may change twice a year, possibly while the system is running; https://en.wikipedia.org/wiki/Leap_second.\n Since the rotation of Earth is decelerating, this value may only be positive. Do not use outside Earth.\n\n For reference, here is the full list of recorded TAI-UTC difference values, valid at the time of writing:\n\n Date | TAI-UTC difference [second]\n ----------|-----------------------------\n Jan 1972 | 10\n Jul 1972 | 11\n Jan 1973 | 12\n Jan 1974 | 13\n Jan 1975 | 14\n Jan 1976 | 15\n Jan 1977 | 16\n Jan 1978 | 17\n Jan 1979 | 18\n Jan 1980 | 19\n Jul 1981 | 20\n Jul 1982 | 21\n Jul 1983 | 22\n Jul 1985 | 23\n Jan 1988 | 24\n Jan 1990 | 25\n Jan 1991 | 26\n Jul 1992 | 27\n Jul 1993 | 28\n Jul 1994 | 29\n Jan 1996 | 30\n Jul 1997 | 31\n Jan 1999 | 32\n Jan 2006 | 33\n Jan 2009 | 34\n Jul 2012 | 35\n Jul 2015 | 36\n Jan 2017 | 37\n\n As of 2020, the future of the leap second and the relation between UTC and TAI remains uncertain."
17370 )]
17371 pub difference_tai_minus_utc: u16,
17377 }
17378 impl ::canadensis_encoding::DataType for TAIInfo {
17379 const EXTENT_BYTES: Option<u32> = None;
17381 }
17382 impl ::canadensis_encoding::Message for TAIInfo {}
17383 impl TAIInfo {
17384 #[cfg_attr(
17385 not(doctest),
17386 doc = " [second]\n The fixed difference, in seconds, between TAI and GPS time. Does not change ever.\n Systems that use GPS time as a reference should convert that to TAI by adding this difference."
17387 )]
17388 pub const DIFFERENCE_TAI_MINUS_GPS: u8 = 19;
17389 pub const DIFFERENCE_TAI_MINUS_UTC_UNKNOWN: u16 = 0;
17390 }
17391 impl ::canadensis_encoding::Serialize for TAIInfo {
17392 fn size_bits(&self) -> usize {
17393 16
17394 }
17395 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
17396 cursor.write_u10(self.difference_tai_minus_utc);
17397 }
17398 }
17399 impl ::canadensis_encoding::Deserialize for TAIInfo {
17400 fn deserialize(
17401 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
17402 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
17403 where
17404 Self: Sized,
17405 {
17406 Ok(TAIInfo {
17407 difference_tai_minus_utc: { cursor.read_u10() as _ },
17408 })
17409 }
17410 }
17411 }
17412 pub mod time_system_0_1 {
17413 #[cfg_attr(
17418 not(doctest),
17419 doc = " Time system enumeration.\n The time system shall be the same for all masters in the network.\n It cannot be changed while the network is running."
17420 )]
17421 pub struct TimeSystem {
17422 pub value: u8,
17428 }
17429 impl ::canadensis_encoding::DataType for TimeSystem {
17430 const EXTENT_BYTES: Option<u32> = None;
17432 }
17433 impl ::canadensis_encoding::Message for TimeSystem {}
17434 impl TimeSystem {
17435 #[cfg_attr(
17436 not(doctest),
17437 doc = " Monotonic time since boot.\n Monotonic time is a time reference that doesn't change rate or make leaps."
17438 )]
17439 pub const MONOTONIC_SINCE_BOOT: u8 = 0;
17440 #[cfg_attr(
17441 not(doctest),
17442 doc = " International Atomic Time; https://en.wikipedia.org/wiki/International_Atomic_Time.\n The timestamp value contains the number of microseconds elapsed since 1970-01-01T00:00:00Z TAI.\n TAI is always a fixed integer number of seconds ahead of GPS time.\n Systems that use GPS time as a reference should convert that to TAI by adding the fixed difference.\n GPS time is not supported for reasons of consistency across different positioning systems and applications."
17443 )]
17444 pub const TAI: u8 = 1;
17445 #[cfg_attr(
17446 not(doctest),
17447 doc = " Application-specific time system of unknown properties."
17448 )]
17449 pub const APPLICATION_SPECIFIC: u8 = 15;
17450 }
17451 impl ::canadensis_encoding::Serialize for TimeSystem {
17452 fn size_bits(&self) -> usize {
17453 8
17454 }
17455 fn serialize(&self, cursor: &mut ::canadensis_encoding::WriteCursor<'_>) {
17456 cursor.write_u4(self.value);
17457 }
17458 }
17459 impl ::canadensis_encoding::Deserialize for TimeSystem {
17460 fn deserialize(
17461 cursor: &mut ::canadensis_encoding::ReadCursor<'_>,
17462 ) -> ::core::result::Result<Self, ::canadensis_encoding::DeserializeError>
17463 where
17464 Self: Sized,
17465 {
17466 Ok(TimeSystem {
17467 value: { cursor.read_u4() as _ },
17468 })
17469 }
17470 }
17471 }
17472 }
17473}