update for Lab
This commit is contained in:
parent
cf7d3a9846
commit
2a144f3420
3 changed files with 13 additions and 6 deletions
|
@ -35,22 +35,29 @@ pub struct Tracker;
|
|||
|
||||
impl FromWorld for Tracker {
|
||||
fn from_world(world: &mut World) -> Self {
|
||||
|
||||
info!("Test here!");
|
||||
|
||||
let (sender, receiver): (_, Receiver<PoseReport>) = channel();
|
||||
|
||||
std::thread::spawn(move || {
|
||||
let addr: SocketAddr = "127.0.0.1:3883".parse().unwrap();
|
||||
|
||||
// 212.201.64.122 | 127.0.0.1
|
||||
let addr: SocketAddr = "212.201.64.122:3883".parse().unwrap();
|
||||
let mut stream = TcpStream::connect(addr).unwrap();
|
||||
stream.set_nodelay(true).unwrap();
|
||||
|
||||
|
||||
// We first write our cookie, then read and check the server's cookie, before the loop.
|
||||
write_cookie(&mut stream, CookieData::from(MAGIC_DATA)).unwrap();
|
||||
let cookie_buf = read_cookie(&mut stream).unwrap();
|
||||
let mut cookie_buf = Bytes::from(&cookie_buf[..]);
|
||||
|
||||
|
||||
CookieData::unbuffer_ref(&mut cookie_buf)
|
||||
.and_then(|msg| check_ver_nonfile_compatible(msg.version))
|
||||
.unwrap();
|
||||
|
||||
|
||||
// Not actually doing anything with the messages here, just receiving them and printing them.
|
||||
loop {
|
||||
let mut buf = BytesMut::new();
|
||||
|
@ -84,7 +91,7 @@ impl FromWorld for Tracker {
|
|||
|
||||
match result {
|
||||
|
||||
Ok(result) => { eprintln!("Ok! {:?}",result.body);},
|
||||
Ok(result) => { eprintln!("Pose from tracker {:?}",result.body);},
|
||||
Err(_) => {}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue