help Show this help message.
ls List recordings.
get REC_ID Retrieve recording.
+ rm REC_ID Remove recording.
clear_storage Fully erase the flash's contents.
dump_storage Dump the flash's contents.
";
Some(b"ls") => self.run_ls(logger),
Some(b"get") => self.run_get(logger, &mut args_iter),
+ Some(b"rm") => self.run_rm(logger, &mut args_iter),
Some(b"clear_storage") => self.run_clear_storage(logger),
Some(b"dump_storage") => self.run_dump_storage(logger),
self.tx_buf.flush();
}
+ fn run_rm(&mut self, logger: &mut Logger, args_iter: &mut ArgumentIter) {
+ if let Some(recording_id_s) = args_iter.next() {
+ if let Some(recording_id) = atoi16(recording_id_s) {
+ if logger.has_recording(recording_id) {
+ let result = logger.remove_recording(recording_id);
+
+ if result.is_err() {
+ self.tx_buf.write(b"rm: failed to remove recording\n");
+ }
+ } else {
+ self.tx_buf.write(b"rm: no such recording\n");
+ }
+ } else {
+ self.tx_buf.write(b"rm: invalid argument\n");
+ }
+ } else {
+ self.tx_buf.write(b"rm: missing argument\n");
+ }
+
+ self.tx_buf.flush();
+ }
+
fn run_clear_storage(&self, logger: &mut Logger) {
logger.storage.clear();
}