Skip to content

Commit

Permalink
Merge branch 'wlp' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
tomiy-0x62 committed Jan 23, 2025
2 parents 7ac0681 + fc282b2 commit fa7e008
Show file tree
Hide file tree
Showing 22 changed files with 1,319 additions and 201 deletions.
2 changes: 1 addition & 1 deletion docs/ImpleNote.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ note about UmberDDS implementation
| netwok | network utils |

## Module Oraganization
![UmberDDS_modules](https://github.com/user-attachments/assets/7b6d5f56-d296-4083-b505-9f4165fec1b7)
![UmberDDS_modules](https://github.com/user-attachments/assets/76621ab4-bf78-42a8-8792-bc08c0dfdde5)


## architecture description
Expand Down
15 changes: 12 additions & 3 deletions docs/UmberDDS_modules.drawio
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<mxfile host="Electron" modified="2024-10-28T09:47:26.343Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.4.8 Chrome/124.0.6367.207 Electron/30.0.6 Safari/537.36" etag="4LMNmfeJbXiRV376Yefx" version="24.4.8" type="device">
<mxfile host="Electron" modified="2025-01-23T08:23:31.782Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.4.8 Chrome/124.0.6367.207 Electron/30.0.6 Safari/537.36" etag="Qj96oFwRv8mI3q96goGv" version="24.4.8" type="device">
<diagram name="Page-1" id="-fP_LIbSd6yxelAOJSjp">
<mxGraphModel dx="2924" dy="2330" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<mxGraphModel dx="2035" dy="1803" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
Expand Down Expand Up @@ -188,7 +188,7 @@
<mxCell id="iw7bkt_WirvSa25fS6zJ-61" value="&lt;font style=&quot;font-size: 20px;&quot;&gt;ser_reader_hb_timer&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="870" y="920" width="200" height="30" as="geometry" />
</mxCell>
<mxCell id="iw7bkt_WirvSa25fS6zJ-63" value="&lt;font style=&quot;font-size: 20px;&quot;&gt;ser_writer_nack_timer&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxCell id="iw7bkt_WirvSa25fS6zJ-63" value="&lt;font style=&quot;font-size: 20px;&quot;&gt;set_writer_nack_timer&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="810" y="610" width="200" height="30" as="geometry" />
</mxCell>
<mxCell id="iw7bkt_WirvSa25fS6zJ-64" value="" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;strokeWidth=3;dashed=1;edgeStyle=orthogonalEdgeStyle;curved=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fillColor=#e51400;strokeColor=#B20000;" parent="1" source="iw7bkt_WirvSa25fS6zJ-31" target="iw7bkt_WirvSa25fS6zJ-20" edge="1">
Expand Down Expand Up @@ -523,6 +523,15 @@
<mxCell id="wV1MeeOjmb5BiqbG29lt-44" value="&lt;font style=&quot;font-size: 14px;&quot;&gt;DATA, HEARTBEAT, etc.&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="880" y="700" width="170" height="20" as="geometry" />
</mxCell>
<mxCell id="Q6VQ9ecxNFoYZTvgYiWM-1" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.75;exitY=1;exitDx=0;exitDy=0;strokeWidth=3;dashed=1;fillColor=#e51400;strokeColor=#B20000;entryX=0.378;entryY=0.062;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="1050" y="560" as="sourcePoint" />
<mxPoint x="1083" y="612" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="Q6VQ9ecxNFoYZTvgYiWM-2" value="&lt;font style=&quot;font-size: 14px;&quot;&gt;wlp_timer_timer&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="1000" y="610" width="145" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
Expand Down
2 changes: 1 addition & 1 deletion docs/UmberDDS_modules.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 44 additions & 4 deletions examples/shapes_demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,28 @@ fn main() {
DATAWRITER => {
while let Ok(dwc) = datawriter.try_recv() {
match dwc {
DataWriterStatusChanged::PublicationMatched(guid) => {
println!("PublicationMatched, guid: {:?}", guid);
DataWriterStatusChanged::PublicationMatched(state) => {
match state.current_count_change {
1 => {
println!(
"PublicationMatched, guid: {:?}",
state.guid
);
}
-1 => {
println!(
"PublicationUnmatched, guid: {:?}",
state.guid
);
}
_ => unreachable!(),
}
}
DataWriterStatusChanged::OfferedIncompatibleQos => {
println!("OfferedIncompatibleQos");
}
DataWriterStatusChanged::LivelinessLost => {
println!("LivelinessLost");
}
_ => (),
}
Expand Down Expand Up @@ -152,8 +172,28 @@ fn main() {
println!("received: {:?}", shape);
}
}
DataReaderStatusChanged::SubscriptionMatched(guid) => {
println!("SubscriptionMatched, guid: {:?}", guid);
DataReaderStatusChanged::SubscriptionMatched(state) => {
match state.current_count_change {
1 => {
println!(
"SubscriptionMatched, guid: {:?}",
state.guid
);
}
-1 => {
println!(
"SubscriptionUnmatched, guid: {:?}",
state.guid
);
}
_ => unreachable!(),
}
}
DataReaderStatusChanged::RequestedIncompatibleQos => {
println!("RequestedIncompatibleQos");
}
DataReaderStatusChanged::LivelinessChanged => {
println!("LivelinessChanged");
}
_ => (), // TODO
}
Expand Down
8 changes: 4 additions & 4 deletions examples/shapes_demo_for_autotest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ fn main() {
std::process::exit(0);
}
}
DataReaderStatusChanged::SubscriptionMatched(guid) => {
println!("SubscriptionMatched, guid: {:?}", guid);
DataReaderStatusChanged::SubscriptionMatched(state) => {
println!("SubscriptionMatched, guid: {:?}", state.guid);
}
_ => (),
}
Expand All @@ -216,8 +216,8 @@ fn main() {
if let Some(dw) = &datawriter {
while let Ok(w) = dw.try_recv() {
match w {
DataWriterStatusChanged::PublicationMatched(guid) => {
println!("PublicationMatched, guid: {:?}", guid);
DataWriterStatusChanged::PublicationMatched(state) => {
println!("PublicationMatched, guid: {:?}", state.guid);
}
_ => (),
}
Expand Down
27 changes: 20 additions & 7 deletions src/dds/datawriter.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
use crate::dds::{publisher::Publisher, qos::DataWriterQosPolicies, topic::Topic};
use crate::dds::{
publisher::Publisher,
qos::{policy::LivelinessQosKind, DataWriterQosPolicies},
topic::Topic,
};
use crate::discovery::structure::data::ParticipantMessageKind;
use crate::message::submessage::element::{RepresentationIdentifier, SerializedPayload};
use crate::rtps::writer::*;
use core::marker::PhantomData;
Expand Down Expand Up @@ -48,9 +53,7 @@ impl<D: Serialize> DataWriter<D> {
pub fn write(&self, data: D) {
let serialized_payload =
SerializedPayload::new_from_cdr_data(data, RepresentationIdentifier::CDR_LE);
let writer_cmd = WriterCmd {
serialized_payload: Some(serialized_payload),
};
let writer_cmd = WriterCmd::WriteData(Some(serialized_payload));
self.writer_command_sender
.send(writer_cmd)
.expect("couldn't send message");
Expand All @@ -59,14 +62,24 @@ impl<D: Serialize> DataWriter<D> {
pub(crate) fn write_builtin_data(&self, data: D) {
let serialized_payload =
SerializedPayload::new_from_cdr_data(data, RepresentationIdentifier::PL_CDR_LE);
let writer_cmd = WriterCmd {
serialized_payload: Some(serialized_payload),
};
let writer_cmd = WriterCmd::WriteData(Some(serialized_payload));
self.writer_command_sender
.send(writer_cmd)
.expect("couldn't send message");
}

pub fn assert_liveliness(&self) {
if let LivelinessQosKind::ManualByParticipant = self.qos.liveliness.kind {
let writer_cmd = WriterCmd::AssertLiveliness((
ParticipantMessageKind::MANUAL_LIVELINESS_UPDATE,
Vec::new(),
));
self.writer_command_sender
.send(writer_cmd)
.expect("couldn't send message");
}
}

/// get DataWriterStatusChanged
///
/// This method is non_blocking, so if failed to get DataReaderStatusChanged, this method returns Err.
Expand Down
Loading

0 comments on commit fa7e008

Please sign in to comment.