blob: cddbe4bcc6bced0f5a8aeddc1b74774d3ca19faf [file] [log] [blame]
adamdunkels8e5d9902003-10-14 11:23:04 +00001/**
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
adamdunkelsbe175262003-08-21 22:24:29 +000012/*
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 *
adamdunkels30c70da2004-08-20 21:37:39 +000042 * $Id: shell.h,v 1.4 2004/08/20 21:37:39 adamdunkels Exp $
adamdunkelsbe175262003-08-21 22:24:29 +000043 *
44 */
45#ifndef __SHELL_H__
46#define __SHELL_H__
47
adamdunkels8e5d9902003-10-14 11:23:04 +000048/**
adamdunkels7d3a28f2003-11-27 15:51:51 +000049 * 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 */
54void shell_init(void);
55
56/**
57 * Start the shell back-end.
adamdunkels8e5d9902003-10-14 11:23:04 +000058 *
59 * Called by the front-end when a new shell is started.
60 */
adamdunkels7d3a28f2003-11-27 15:51:51 +000061void shell_start(void);
adamdunkels8e5d9902003-10-14 11:23:04 +000062
63/**
adamdunkels30c70da2004-08-20 21:37:39 +000064 * The shell event handler.
adamdunkels8e5d9902003-10-14 11:23:04 +000065 *
adamdunkels30c70da2004-08-20 21:37:39 +000066 * This function will be called when an event is received.
adamdunkels8e5d9902003-10-14 11:23:04 +000067 */
adamdunkels30c70da2004-08-20 21:37:39 +000068void shell_eventhandler(ek_event_t ev, ek_data_t data);
adamdunkels8e5d9902003-10-14 11:23:04 +000069
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 */
adamdunkelsbe175262003-08-21 22:24:29 +000079void shell_input(char *command);
80
adamdunkels8e5d9902003-10-14 11:23:04 +000081/**
82 * Quit the shell.
83 *
84 */
adamdunkelsbe175262003-08-21 22:24:29 +000085void shell_quit(char *);
adamdunkels8e5d9902003-10-14 11:23:04 +000086
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 Destugues69a6e722017-06-03 10:17:17 +020098void shell_output(const char *str1, const char *str2);
adamdunkelsbe175262003-08-21 22:24:29 +000099
adamdunkels8e5d9902003-10-14 11:23:04 +0000100/**
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 */
109void shell_prompt(char *prompt);
adamdunkelsbe175262003-08-21 22:24:29 +0000110
111#endif /* __SHELL_H__ */
adamdunkels8e5d9902003-10-14 11:23:04 +0000112
113
114