X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FMainpage.dox;h=1b7da140fdd4e93565116f5e1cf23f70f5671d00;hb=f9d24df84e9dd01127ebeabef977a22e379cb41d;hp=1d090560f5854782101620f579d46e463e6eff6a;hpb=9680ed9010b85a635d3a9131710bfed26e4c165c;p=senf.git diff --git a/Console/Mainpage.dox b/Console/Mainpage.dox index 1d09056..1b7da14 100644 --- a/Console/Mainpage.dox +++ b/Console/Mainpage.dox @@ -51,6 +51,8 @@ library. See above links for more: \code + #include + // Define callback function. void mycommand(std::ostream & os, int foo, int bar) { @@ -97,6 +99,46 @@ $ + \see \ref console_testserver for a complete example application + + \section intro_init Initialization + + To make the console accessible, it must be initialized when the program is started: + \code + #include + + int main(int argc, char * argv []) + { + // Configure console nodes, add commands ... + + // Start console server + senf::console::start(senf::INet4SocketAddress(12345u)) + .name("myserver"); + + // You need to enter the scheduler main-loop for the server to work + senf::Scheduler::instance().process(); + + // Alternatively enter the main-loop via the PPI + // senf::ppi::run(); + } + \endcode + + This will start the server on IPv4 port 12345. The servers name (as displayed in the interactive + console prompt) is set to 'myserver'. + + After launching the application, the server can be accessed at the given port: + \htmlonly +
+    bash$ telnet localhost 12345
+    Trying 127.0.0.1...
+    Connected to localhost.
+    Escape character is '^]'.
+
+    myserver:/$ exit
+    Connection closed by foreign host.
+    bash$
+    
+ \endhtmlonly \section intro_nodes The node tree @@ -595,8 +637,9 @@ \section console_memberfn Member functions - Member functions are supported like non-member functions. They must however be added through a - senf::console::ScopedDirectory instance to bind them to their instance. + Non-static member functions are supported like non-member functions (static member functions are + identical to non-members). They must however be added through a senf::console::ScopedDirectory + instance to bind them to their instance. \code class Test1 { @@ -818,7 +861,7 @@ } void senf_console_parse_argument(senf::console::ParseCommandInfo::TokensRange const & tokens, - MyClass & out) + Coordinate & out) { if (tokens.size() != 2) throw SyntaxErrorException("parameter syntax error");