pub struct EntityStatePDU {Show 14 fields
pub pdu_header_record: PDUHeaderRecord,
pub entity_id_record: EntityIDRecord,
pub force_id_field: ForceID,
pub number_of_articulation_parameters_field: u8,
pub entity_type_record: EntityTypeRecord,
pub alternative_entity_type_record: EntityTypeRecord,
pub entity_linear_velocity_record: LinearVelocityRecord,
pub entity_location_record: WorldCoordinateRecord,
pub entity_orientation_record: EulerAnglesRecord,
pub entity_appearance_record: EntityAppearanceRecord,
pub dead_reckoning_parameters_record: DeadReckoningParametersRecord,
pub entity_marking_record: EntityMarkingRecord,
pub entity_capabilities_record: EntityCapabilitiesRecord,
pub articulation_parameter_record: f32,
}Expand description
Entity State PDU as defined in IEEE 1278.1 standard. Used to communicate the state of an entity during the simulation.
Fields§
§pdu_header_record: PDUHeaderRecord§entity_id_record: EntityIDRecord§force_id_field: ForceID§number_of_articulation_parameters_field: u8§entity_type_record: EntityTypeRecord§alternative_entity_type_record: EntityTypeRecord§entity_linear_velocity_record: LinearVelocityRecord§entity_location_record: WorldCoordinateRecord§entity_orientation_record: EulerAnglesRecord§entity_appearance_record: EntityAppearanceRecord§dead_reckoning_parameters_record: DeadReckoningParametersRecord§entity_marking_record: EntityMarkingRecord§entity_capabilities_record: EntityCapabilitiesRecord§articulation_parameter_record: f32Implementations§
Source§impl EntityStatePDU
impl EntityStatePDU
Sourcepub fn default() -> Self
pub fn default() -> Self
Provides a function to create a default EntityStatePDU. The provided PDU represents a simple munition used for testing.
Examples found in repository?
examples/broadcast_pdus.rs (line 45)
18fn main() {
19 let src_addr = format!("192.168.1.134:{}", SRC_PORT);
20 println!("binding to {} for sending", src_addr.as_str());
21 let socket = UdpSocket::bind(src_addr).expect("bind should succeed");
22
23 socket.set_broadcast(true).expect("set_broadcast to true should succeed");
24
25 // Send FirePDU
26 let data_to_send = FirePDU::default();
27 println!("broadcasting data: {:?}", data_to_send);
28 let mut buffer = BytesMut::new();
29 PDU::serialise(&data_to_send, &mut buffer);
30 socket
31 .send_to(&buffer, format!("255.255.255.255:{}", SRC_PORT))
32 .expect("couldn't send data");
33
34 // Send EventReportPDU
35 let data_to_send = EventReportPDU::default();
36 println!("broadcasting data: {:?}", data_to_send);
37 let mut buffer = BytesMut::new();
38 PDU::serialise(&data_to_send, &mut buffer);
39 socket
40 .send_to(&buffer, format!("255.255.255.255:{}", SRC_PORT))
41 .expect("couldn't send data");
42
43
44 // Send EntityStatePDU
45 let data_to_send = EntityStatePDU::default();
46 println!("broadcasting data: {:?}", data_to_send);
47 let mut buffer = BytesMut::new();
48 PDU::serialise(&data_to_send, &mut buffer);
49 socket
50 .send_to(&buffer, format!("255.255.255.255:{}", SRC_PORT))
51 .expect("couldn't send data");
52
53 // Send DetonationPDU
54 let data_to_send = DetonationPDU::default();
55 println!("broadcasting data: {:?}", data_to_send);
56 let mut buffer = BytesMut::new();
57 PDU::serialise(&data_to_send, &mut buffer);
58 socket
59 .send_to(&buffer, format!("255.255.255.255:{}", SRC_PORT))
60 .expect("couldn't send data");
61}Trait Implementations§
Source§impl Clone for EntityStatePDU
impl Clone for EntityStatePDU
Source§fn clone(&self) -> EntityStatePDU
fn clone(&self) -> EntityStatePDU
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EntityStatePDU
impl Debug for EntityStatePDU
Source§impl PDU for EntityStatePDU
impl PDU for EntityStatePDU
Source§fn deserialise(buffer: BytesMut) -> Result<EntityStatePDU, DISError>
fn deserialise(buffer: BytesMut) -> Result<EntityStatePDU, DISError>
Creates an EntityStatePDU from a BytesMut struct.
Source§fn serialise(&self, buf: &mut BytesMut)
fn serialise(&self, buf: &mut BytesMut)
Fills a BytesMut struct with a EntityStatePDU serialised into binary. This buffer is then ready to be sent via UDP to the simluation network.
fn as_any(&self) -> &dyn Any
Source§fn deserialise_without_header(
buffer: BytesMut,
pdu_header: PDUHeaderRecord,
) -> Result<Self, DISError>where
Self: Sized,
fn deserialise_without_header(
buffer: BytesMut,
pdu_header: PDUHeaderRecord,
) -> Result<Self, DISError>where
Self: Sized,
Creates a PDU from a BytesMut struct.
Auto Trait Implementations§
impl Freeze for EntityStatePDU
impl RefUnwindSafe for EntityStatePDU
impl Send for EntityStatePDU
impl Sync for EntityStatePDU
impl Unpin for EntityStatePDU
impl UnwindSafe for EntityStatePDU
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more