diff --git a/services/ime-frontend/src/api.rs b/services/ime-frontend/src/api.rs index d64b8b6f6..e69de29bb 100644 --- a/services/ime-frontend/src/api.rs +++ b/services/ime-frontend/src/api.rs @@ -1,44 +0,0 @@ -use xous::{Message, ScalarMessage}; - -use graphics_server::Gid; - -#[allow(dead_code)] -#[derive(Debug, rkyv::Archive, rkyv::Unarchive)] -pub enum Opcode { - /// informs me where my input canvas is - SetInputCanvas(Gid), - - /// informs me where my prediction canvas is - SetPredictionCanvas(Gid), - - /// set prediction server. Must be a String of the name of a server that is loaded in the system. - SetPredictionServer(xous::String<256>), -} - -impl core::convert::TryFrom<& Message> for Opcode { - type Error = &'static str; - fn try_from(message: & Message) -> Result { - match message { - Message::Scalar(m) => match m.id { - 0 => Ok(Opcode::SetInputCanvas(Gid::new([m.arg1 as _, m.arg2 as _, m.arg3 as _, m.arg4 as _]))), - 1 => Ok(Opcode::SetPredictionCanvas(Gid::new([m.arg1 as _, m.arg2 as _, m.arg3 as _, m.arg4 as _]))), - _ => Err("IMEF api: unknown Scalar ID"), - }, - _ => Err("IMEF api: unhandled message type"), - } - } -} - -impl Into for Opcode { - fn into(self) -> Message { - match self { - Opcode::SetInputCanvas(gid) => Message::Scalar(ScalarMessage { - id: 0, arg1: gid.gid()[0] as _, arg2: gid.gid()[1] as _, arg3: gid.gid()[2] as _, arg4: gid.gid()[3] as _ - }), - Opcode::SetPredictionCanvas(gid) => Message::Scalar(ScalarMessage { - id: 0, arg1: gid.gid()[0] as _, arg2: gid.gid()[1] as _, arg3: gid.gid()[2] as _, arg4: gid.gid()[3] as _ - }), - _ => panic!("IMEF api: Opcode type not handled by into()"), - } - } -}