set badge names from desktop client
This commit is contained in:
parent
8f2510588f
commit
0d5fb05abe
1 changed files with 38 additions and 45 deletions
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
use common::Request;
|
||||
use postcard::{to_allocvec, to_vec};
|
||||
use postcard::to_allocvec;
|
||||
use tokio::{io::{AsyncReadExt, AsyncWriteExt}, net::TcpStream};
|
||||
use anyhow::Result;
|
||||
|
||||
|
|
@ -12,16 +12,20 @@ async fn main() -> Result<()>{
|
|||
|
||||
let req = Request::RecentBadge;
|
||||
conn.write_all(&to_allocvec(&req)?).await?;
|
||||
conn.flush().await?;
|
||||
|
||||
let badge = conn.read_u64().await?;
|
||||
println!("read: {badge}");
|
||||
|
||||
if badge != 0 {
|
||||
let req = Request::SetBadge(common::Name::Evan, badge);
|
||||
conn.write_all(&to_allocvec(&req)?).await?;
|
||||
conn.flush().await?;
|
||||
}
|
||||
|
||||
let req = Request::SetVolume(23);
|
||||
println!("{:?}", to_allocvec(&req).unwrap());
|
||||
conn.write_all(&to_allocvec(&req)?).await?;
|
||||
conn.flush().await?;
|
||||
|
||||
let mut buf = String::new();
|
||||
conn.read_to_string(&mut buf).await?;
|
||||
println!("recv: {}", buf.trim());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue