xous-core/services/rkyv-test-client/src/main.rs
Sean Cross 0f455a9a02 rkyv-test-client: use new double_string call
Signed-off-by: Sean Cross <sean@xobs.io>
2021-03-26 12:16:26 +08:00

34 lines
1.1 KiB
Rust

#![cfg_attr(target_os = "none", no_std)]
#![cfg_attr(target_os = "none", no_main)]
fn print_log_messages(log_message: &str, prefix: &str) {
log::info!(
"Got a message hook! Message: [{}], prefix: [{}]",
log_message,
prefix
);
}
#[xous::xous_main]
fn rkyv_test_client() -> ! {
log_server::init_wait().unwrap();
log::info!(
"Hello, world! This is the client, PID {}",
xous::current_pid().unwrap().get()
);
let ticktimer_server_id = xous::SID::from_bytes(b"ticktimer-server").unwrap();
let ticktimer_conn = xous::connect(ticktimer_server_id).unwrap();
rkyv_test_server::hook_log_messages(print_log_messages);
let mut idx = 0;
let double_src = xous::String::<256>::from_str("12345678");
loop {
log::info!("2 + {} = {}", idx, rkyv_test_server::add(2, idx).unwrap());
ticktimer_server::sleep_ms(ticktimer_conn, 500).ok();
rkyv_test_server::log_message("prefix", "Hi there");
log::info!("Doubling string {}", double_src);
log::info!("Doubled string: {}", rkyv_test_server::double_string(&double_src));
idx += 1;
}
}