-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.rs
More file actions
28 lines (20 loc) · 806 Bytes
/
main.rs
File metadata and controls
28 lines (20 loc) · 806 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
27
28
use std::sync::Arc;
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);
let wrapped = BytesMessage(Arc::from(buffer));
publisher.send(&wrapped);
println!("Sent buffer filled with {}", counter);
std::thread::sleep(std::time::Duration::from_millis(500));
}
Ecal::finalize();
}