adamdunkels | 8e5d990 | 2003-10-14 11:23:04 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file |
| 3 | * Interface for the Contiki shell. |
| 4 | * \author Adam Dunkels <adam@dunkels.com> |
| 5 | * |
| 6 | * Some of the functions declared in this file must be implemented as |
| 7 | * a shell back-end in the architecture specific files of a Contiki |
| 8 | * port. |
| 9 | */ |
| 10 | |
| 11 | |
adamdunkels | be17526 | 2003-08-21 22:24:29 +0000 | [diff] [blame] | 12 | /* |
| 13 | * Copyright (c) 2003, Adam Dunkels. |
| 14 | * All rights reserved. |
| 15 | * |
| 16 | * Redistribution and use in source and binary forms, with or without |
| 17 | * modification, are permitted provided that the following conditions |
| 18 | * are met: |
| 19 | * 1. Redistributions of source code must retain the above copyright |
| 20 | * notice, this list of conditions and the following disclaimer. |
| 21 | * 2. Redistributions in binary form must reproduce the above copyright |
| 22 | * notice, this list of conditions and the following disclaimer in the |
| 23 | * documentation and/or other materials provided with the distribution. |
| 24 | * 3. The name of the author may not be used to endorse or promote |
| 25 | * products derived from this software without specific prior |
| 26 | * written permission. |
| 27 | * |
| 28 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS |
| 29 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 30 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 31 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 32 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
| 34 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 35 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 36 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 37 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 38 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 39 | * |
| 40 | * This file is part of the Contiki desktop OS. |
| 41 | * |
adamdunkels | 30c70da | 2004-08-20 21:37:39 +0000 | [diff] [blame] | 42 | * $Id: shell.h,v 1.4 2004/08/20 21:37:39 adamdunkels Exp $ |
adamdunkels | be17526 | 2003-08-21 22:24:29 +0000 | [diff] [blame] | 43 | * |
| 44 | */ |
| 45 | #ifndef __SHELL_H__ |
| 46 | #define __SHELL_H__ |
| 47 | |
adamdunkels | 8e5d990 | 2003-10-14 11:23:04 +0000 | [diff] [blame] | 48 | /** |
adamdunkels | 7d3a28f | 2003-11-27 15:51:51 +0000 | [diff] [blame] | 49 | * Initialize the shell. |
| 50 | * |
| 51 | * Called when the shell front-end process starts. This function may |
| 52 | * be used to start listening for signals. |
| 53 | */ |
| 54 | void shell_init(void); |
| 55 | |
| 56 | /** |
| 57 | * Start the shell back-end. |
adamdunkels | 8e5d990 | 2003-10-14 11:23:04 +0000 | [diff] [blame] | 58 | * |
| 59 | * Called by the front-end when a new shell is started. |
| 60 | */ |
adamdunkels | 7d3a28f | 2003-11-27 15:51:51 +0000 | [diff] [blame] | 61 | void shell_start(void); |
adamdunkels | 8e5d990 | 2003-10-14 11:23:04 +0000 | [diff] [blame] | 62 | |
| 63 | /** |
adamdunkels | 30c70da | 2004-08-20 21:37:39 +0000 | [diff] [blame] | 64 | * The shell event handler. |
adamdunkels | 8e5d990 | 2003-10-14 11:23:04 +0000 | [diff] [blame] | 65 | * |
adamdunkels | 30c70da | 2004-08-20 21:37:39 +0000 | [diff] [blame] | 66 | * This function will be called when an event is received. |
adamdunkels | 8e5d990 | 2003-10-14 11:23:04 +0000 | [diff] [blame] | 67 | */ |
adamdunkels | 30c70da | 2004-08-20 21:37:39 +0000 | [diff] [blame] | 68 | void shell_eventhandler(ek_event_t ev, ek_data_t data); |
adamdunkels | 8e5d990 | 2003-10-14 11:23:04 +0000 | [diff] [blame] | 69 | |
| 70 | /** |
| 71 | * Process a shell command. |
| 72 | * |
| 73 | * This function will be called by the shell GUI / telnet server whan |
| 74 | * a command has been entered that should be processed by the shell |
| 75 | * back-end. |
| 76 | * |
| 77 | * \param command The command to be processed. |
| 78 | */ |
adamdunkels | be17526 | 2003-08-21 22:24:29 +0000 | [diff] [blame] | 79 | void shell_input(char *command); |
| 80 | |
adamdunkels | 8e5d990 | 2003-10-14 11:23:04 +0000 | [diff] [blame] | 81 | /** |
| 82 | * Quit the shell. |
| 83 | * |
| 84 | */ |
adamdunkels | be17526 | 2003-08-21 22:24:29 +0000 | [diff] [blame] | 85 | void shell_quit(char *); |
adamdunkels | 8e5d990 | 2003-10-14 11:23:04 +0000 | [diff] [blame] | 86 | |
| 87 | |
| 88 | /** |
| 89 | * Print a string to the shell window. |
| 90 | * |
| 91 | * This function is implemented by the shell GUI / telnet server and |
| 92 | * can be called by the shell back-end to output a string in the |
| 93 | * shell window. The string is automatically appended with a linebreak. |
| 94 | * |
| 95 | * \param str1 The first half of the string to be output. |
| 96 | * \param str2 The second half of the string to be output. |
| 97 | */ |
Adrien Destugues | 69a6e72 | 2017-06-03 10:17:17 +0200 | [diff] [blame^] | 98 | void shell_output(const char *str1, const char *str2); |
adamdunkels | be17526 | 2003-08-21 22:24:29 +0000 | [diff] [blame] | 99 | |
adamdunkels | 8e5d990 | 2003-10-14 11:23:04 +0000 | [diff] [blame] | 100 | /** |
| 101 | * Print a prompt to the shell window. |
| 102 | * |
| 103 | * This function can be used by the shell back-end to print out a |
| 104 | * prompt to the shell window. |
| 105 | * |
| 106 | * \param prompt The prompt to be printed. |
| 107 | * |
| 108 | */ |
| 109 | void shell_prompt(char *prompt); |
adamdunkels | be17526 | 2003-08-21 22:24:29 +0000 | [diff] [blame] | 110 | |
| 111 | #endif /* __SHELL_H__ */ |
adamdunkels | 8e5d990 | 2003-10-14 11:23:04 +0000 | [diff] [blame] | 112 | |
| 113 | |
| 114 | |