Station API

Dependents:   GMCStation

Revision:
2:a9d1a9c92927
Parent:
1:a22e390c70b3
--- a/Station.h	Mon Dec 12 02:33:21 2011 +0000
+++ b/Station.h	Mon Dec 12 11:41:24 2011 +0000
@@ -27,25 +27,55 @@
 #include <map>
 #include <string>
 
+/**
+ * A simple command/response network interface for mbed
+ */
 class Station {
 public:
+    /**
+     * creates a Station object
+     *
+     * @param port port number
+     */
     Station(int port) : server(port) {}
 
     ~Station() {}
-    
+
+    /**
+     * adds a command handler
+     *
+     * @param command name of the command
+     * @param handler pointer to the handler of the command
+     */
     void addHandler(string command, void (*handler)(void)) {
         handlerMap.insert(pair<string, FunctionPointer>(command, FunctionPointer(handler)));
     }
-
+    
+    /**
+     * adds a command handler
+     *
+     * @param command name of the command
+     * @param tptr pointer to the object to call the handler on
+     * @param handler pointer to the handler of the command
+     */
     template <typename T> void addHandler(string command, T* tptr, void (T::*handler)(void)) {
         handlerMap.insert(pair<string, FunctionPointer>(command, FunctionPointer(tptr, handler)));
     }
 
+    /**
+     * sets the buffer for communication between caller and callee
+     *
+     * @param buf pointer to the communication buffer
+     * @param length length of the buffer
+     */
     void setBuffer(char *buf, int length) {
         this->buf = buf;
         this->length = length;
     }
 
+    /**
+     * Check for any client and handle its request. This function is expected to be called repeatedly in main loop.
+     */
     void handleClient() {
         ClientSocket client = server.accept(0);
         while (client) {