Display device info
This commit is contained in:
22
src/main.rs
22
src/main.rs
@@ -88,6 +88,23 @@ fn to_ascii_debug(bytes: &Vec<u8>) -> String {
|
||||
return out;
|
||||
}
|
||||
|
||||
fn to_bytewise_debug(bytes: &Vec<u8>) -> String {
|
||||
let mut out = String::new();
|
||||
|
||||
for b in bytes {
|
||||
out += &hex::encode(&[b.clone()]);
|
||||
out += " ";
|
||||
|
||||
if b.is_ascii_graphic() {
|
||||
out += &b.escape_ascii().to_string();
|
||||
}
|
||||
out += "\n";
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
fn find_begin_of_improv_packet(buffer: &Vec<u8>) -> Result<usize, String> {
|
||||
|
||||
let mut improv_header_char: usize = 0;
|
||||
@@ -186,9 +203,10 @@ async fn main() -> Result<()>{
|
||||
let improv_packet_end = improv_packet_offset + 10 + <u8 as Into<usize>>::into(buffer[improv_packet_offset+8]);
|
||||
let raw_packet = RawPacket::try_from_bytes(&buffer[improv_packet_offset..improv_packet_end].to_vec()).unwrap();
|
||||
|
||||
|
||||
if let ImprovPacket::RPCResult(rpc_result) = ImprovPacket::try_from_raw_packet(&raw_packet).unwrap() {
|
||||
println!("Received RPCResult");
|
||||
for r in rpc_result.results {
|
||||
println!("{}", &r);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user