-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.rs
More file actions
26 lines (18 loc) · 744 Bytes
/
main.rs
File metadata and controls
26 lines (18 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use rustecal::{Ecal, EcalComponents, TypedPublisher};
use rustecal_types_bytes::BytesMessage;
fn main() {
Ecal::initialize(Some("blob send rust"), EcalComponents::DEFAULT)
.expect("eCAL initialization failed");
let publisher = TypedPublisher::<BytesMessage>::new("blob")
.expect("Failed to create publisher");
let mut counter: u8 = 0;
while Ecal::ok() {
// Fill 1024-byte buffer with the current counter value
let buffer = vec![counter; 1024];
counter = counter.wrapping_add(1);
publisher.send(&BytesMessage(buffer));
println!("Sent buffer filled with {}", counter);
std::thread::sleep(std::time::Duration::from_millis(100));
}
Ecal::finalize();
}