xous-core/services/shellchat
bunnie 02b2e4a6e7 deprecate request_focus api and make initial focus setting within the GAM
request_focus is "dangerous" because any random server could
request a UX context to pop up. There is a checked version
that requires a GAM token that should be used, but, this leaves
the question of how does the initial app that's supposed to be
focused gets set.

A small mod to the UxRegistration call is made to check for
the name of the default focus app, and when it is seen, a thread
is fired off to request focus for that app. That allows us
to deprecate this otherwise dangerous call.
2022-01-25 00:55:14 +08:00
..
src deprecate request_focus api and make initial focus setting within the GAM 2022-01-25 00:55:14 +08:00
Cargo.toml update wlan status to a binary version with more detailed output 2022-01-14 02:23:57 +08:00
README.md link in some READMEs so that rustdoc pulls them in 2021-08-01 16:08:27 +08:00
shellchat_screen1.png fix errant dot from screenshot tool 2021-03-11 23:07:05 +08:00

Shell Chat

screenshot

shellchat is a baseline demo application for Xous. It uses a chat-client style interface (stacking bubbles of text, with user input right-aligned and shell feedback left-aligned) to facilitate interactions with the hardware. It implements the basic envisioned structure of a Xous application, namely:

  • Text input comes via the ime-frontend
  • Graphical output is rendered via the gam

Other facilities for handling system-level messages, such as menu configurations and network events, have yet to be implemented. However, they will likely end up with a demo in this application first.

To make your own command, copy the ver.rs template (for an example with argument parsing), or snag the very simple echo template below, and put it in the services/shellchat/src/cmds/ directory:

use crate::{ShellCmdApi, CommonEnv};
use xous_ipc::String;

#[derive(Debug)]
pub struct Echo {
}

impl<'a> ShellCmdApi<'a> for Echo {
    cmd_api!(echo); // inserts boilerplate for command API

    fn process(&mut self, args: String::<1024>, _env: &mut CommonEnv) -> Result<Option<String::<1024>>, xous::Error> {
        Ok(Some(rest))
    }
}

The "verb" is the name of your command, and it is the argument to the cmd_api!() macro.

process() is your "main" function, and args is a string which contains the rest of the line that was typed into the chat, minus the verb used to identify your command (the arguments, as they may be, but not tokenized or parsed in any way). env contains some items in a common environment, for example, connections to the GAM, LLIO server or other resources required by your implementation.

Once you've added your command to the directory, go to the cmds.rs file, and follow the four-step instructions embedded within the file, starting around line 40.

Things to Keep in Mind

  • Xous is currently nostd
  • When you're done adding your command, you should be able to do a cargo xtask run and it will fire up an emulated environment, like the one above
  • Type...very...slowly...when using the emulated environment.