ardupilot/libraries/doc/html/menu_8h_source.html

93 lines
9.7 KiB
HTML
Raw Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>ArduPilot Libraries: /home/jgoppert/Projects/ap/libraries/AP_Common/include/menu.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.1 -->
<div class="navigation" id="top">
<div class="tabs">
<ul class="tablist">
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
<div class="header">
<div class="headertitle">
<h1>/home/jgoppert/Projects/ap/libraries/AP_Common/include/menu.h</h1> </div>
</div>
<div class="contents">
<a href="menu_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-</span>
<a name="l00002"></a>00002
<a name="l00015"></a>00015
<a name="l00016"></a>00016 <span class="preprocessor">#ifndef __AP_COMMON_MENU_H</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span><span class="preprocessor">#define __AP_COMMON_MENU_H</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span>
<a name="l00019"></a><a class="code" href="menu_8h.html#a7bc4df209e0261ea6ab5303dd8405705">00019</a> <span class="preprocessor">#define MENU_COMMANDLINE_MAX 32 ///&lt; maximum input line length</span>
<a name="l00020"></a><a class="code" href="menu_8h.html#a78a3dfeac59b72f430d58683a06644fe">00020</a> <span class="preprocessor"></span><span class="preprocessor">#define MENU_ARGS_MAX 4 ///&lt; maximum number of arguments</span>
<a name="l00021"></a><a class="code" href="menu_8h.html#acad44891e2415450762891bd2ca7027d">00021</a> <span class="preprocessor"></span><span class="preprocessor">#define MENU_COMMAND_MAX 14 ///&lt; maximum size of a command name</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span>
<a name="l00024"></a><a class="code" href="class_menu.html">00024</a> <span class="keyword">class </span><a class="code" href="class_menu.html" title="Class defining and handling one menu tree.">Menu</a> {
<a name="l00025"></a>00025 <span class="keyword">public</span>:
<a name="l00035"></a><a class="code" href="struct_menu_1_1arg.html">00035</a> <span class="keyword">struct </span><a class="code" href="struct_menu_1_1arg.html">arg</a> {
<a name="l00036"></a><a class="code" href="struct_menu_1_1arg.html#ad5a8d057d82e7300c34b648c796c8df4">00036</a> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="struct_menu_1_1arg.html#ad5a8d057d82e7300c34b648c796c8df4" title="string form of the argument">str</a>;
<a name="l00037"></a><a class="code" href="struct_menu_1_1arg.html#ad6913164599db6376da758a0f1a9ee1c">00037</a> <span class="keywordtype">long</span> <a class="code" href="struct_menu_1_1arg.html#ad6913164599db6376da758a0f1a9ee1c" title="integer form of the argument (if a number)">i</a>;
<a name="l00038"></a><a class="code" href="struct_menu_1_1arg.html#aee33499a1cd6a4edfe5c5b8e6cf42766">00038</a> <span class="keywordtype">float</span> <a class="code" href="struct_menu_1_1arg.html#aee33499a1cd6a4edfe5c5b8e6cf42766" title="floating point form of the argument (if a number)">f</a>;
<a name="l00039"></a>00039 };
<a name="l00040"></a>00040
<a name="l00055"></a><a class="code" href="class_menu.html#aaa251c33ec1cf26ad33095565f0a1125">00055</a> <span class="keyword">typedef</span> int8_t (*<a class="code" href="class_menu.html#aaa251c33ec1cf26ad33095565f0a1125">func</a>)(uint8_t argc, <span class="keyword">const</span> <span class="keyword">struct </span><a class="code" href="struct_menu_1_1arg.html">arg</a> *argv);
<a name="l00056"></a>00056
<a name="l00064"></a><a class="code" href="class_menu.html#aea382e744aa7299bad3866062084c9df">00064</a> <span class="keyword">typedef</span> bool (*<a class="code" href="class_menu.html#aea382e744aa7299bad3866062084c9df">preprompt</a>)(void);
<a name="l00065"></a>00065
<a name="l00068"></a><a class="code" href="struct_menu_1_1command.html">00068</a> <span class="keyword">struct </span><a class="code" href="struct_menu_1_1command.html">command</a> {
<a name="l00072"></a><a class="code" href="struct_menu_1_1command.html#a89d8d8dd0d80e71f396fbc3862cec49d">00072</a> <span class="keyword">const</span> <span class="keywordtype">char</span> <a class="code" href="struct_menu_1_1command.html">command</a>[MENU_COMMAND_MAX];
<a name="l00073"></a>00073
<a name="l00085"></a><a class="code" href="struct_menu_1_1command.html#a5177fbbe6d2f048c136c687fda235ef9">00085</a> int8_t (*<a class="code" href="struct_menu_1_1command.html#a5177fbbe6d2f048c136c687fda235ef9" title="callback function">func</a>)(uint8_t argc, <span class="keyword">const</span> <span class="keyword">struct </span><a class="code" href="struct_menu_1_1arg.html">arg</a> *argv);
<a name="l00086"></a>00086 };
<a name="l00087"></a>00087
<a name="l00097"></a>00097 <a class="code" href="class_menu.html#ac6862dec531cc9b42410390985a1c731">Menu</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *prompt, <span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="struct_menu_1_1command.html">command</a> *commands, uint8_t entries, <a class="code" href="class_menu.html#aea382e744aa7299bad3866062084c9df">preprompt</a> ppfunc = 0);
<a name="l00098"></a>00098
<a name="l00100"></a>00100 <span class="keywordtype">void</span> <a class="code" href="class_menu.html#a8424e0886499d6901c1d2406c568709c" title="menu runner">run</a>(<span class="keywordtype">void</span>);
<a name="l00101"></a>00101
<a name="l00102"></a>00102 <span class="keyword">private</span>:
<a name="l00105"></a>00105 <span class="keywordtype">void</span> _help(<span class="keywordtype">void</span>);
<a name="l00106"></a>00106
<a name="l00112"></a>00112 int8_t _call(uint8_t n, uint8_t argc);
<a name="l00113"></a>00113
<a name="l00114"></a>00114 <span class="keyword">const</span> <span class="keywordtype">char</span> *_prompt;
<a name="l00115"></a>00115 <span class="keyword">const</span> <a class="code" href="struct_menu_1_1command.html">command</a> *_commands;
<a name="l00116"></a>00116 <span class="keyword">const</span> uint8_t _entries;
<a name="l00117"></a>00117 <span class="keyword">const</span> <a class="code" href="class_menu.html#aea382e744aa7299bad3866062084c9df">preprompt</a> _ppfunc;
<a name="l00118"></a>00118
<a name="l00119"></a>00119 <span class="keyword">static</span> <span class="keywordtype">char</span> _inbuf[MENU_COMMANDLINE_MAX];
<a name="l00120"></a>00120 <span class="keyword">static</span> <a class="code" href="struct_menu_1_1arg.html">arg</a> _argv[<a class="code" href="menu_8h.html#a78a3dfeac59b72f430d58683a06644fe" title="maximum number of arguments">MENU_ARGS_MAX</a> + 1];
<a name="l00121"></a>00121 };
<a name="l00122"></a>00122
<a name="l00133"></a><a class="code" href="menu_8h.html#a4f51e7c63dcc5b0801b0a2fcb89eca74">00133</a> <span class="preprocessor">#define MENU(name, prompt, commands) \</span>
<a name="l00134"></a>00134 <span class="preprocessor"> static const char __menu_name__ ##name[] PROGMEM = prompt; \</span>
<a name="l00135"></a>00135 <span class="preprocessor"> static Menu name(__menu_name__ ##name, commands, sizeof(commands) / sizeof(commands[0]))</span>
<a name="l00136"></a>00136 <span class="preprocessor"></span>
<a name="l00137"></a><a class="code" href="menu_8h.html#a986e3d5cdca86e424132a321f0a1fa35">00137</a> <span class="preprocessor">#define MENU2(name, prompt, commands, preprompt) \</span>
<a name="l00138"></a>00138 <span class="preprocessor"> static const char __menu_name__ ##name[] PROGMEM = prompt; \</span>
<a name="l00139"></a>00139 <span class="preprocessor"> static Menu name(__menu_name__ ##name, commands, sizeof(commands) / sizeof(commands[0]), preprompt)</span>
<a name="l00140"></a>00140 <span class="preprocessor"></span>
<a name="l00141"></a>00141 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 26 2010 19:58:33 for ArduPilot Libraries by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>