/*! @file
 *
 * @author: Marco De Pascale
 * @version: 0.1
 * @date: 2017.02.01
 **/

#include<config.h>
#include<Nice/App/Application.h>
#include<Nice/App/ConfigClient.h>
#include<Basda/Mocca/XServiceWorkerInterface.h>
#include<Basda/Mocca/Constant.h>

class Move : public Nice::Application
{
    public:
        /**
         * @brief That method introduce the user how to start the application.
         *        It will be shown every time when the user called the application
         *        on a wrong way.
         */
        virtual int usage(int);

        /**
         * @brief The run method will be started through the main method.
         *        It keeps the motor control implementation.
         */
        virtual int run(int argc, char* argv[]);

        /**
         * @brief A call back method in order to terminate the application.
         */
        virtual void interruptCallback(int _sig);
};

int Move::usage(int _ret)
{
    std::cerr << "Usage: " << appName() << " --CONNECT:Endpoint=[..]\n";
    std::cerr
            << "Options:\n"
            "-h, --help                                       Show this message.\n"
            "-v, --version                                    Display version.\n"
            "\n"
            "\n"
            "--CONNECT:Endpoint=[NAME=NODENAME,...]          NAME=NODENAME  - name of the service\n"
            "                                                PORT=intval    - tcp port of the service\n"
            "                                                HOST=string    - tcp host address of the service\n"
            "                                                MULTICAST=true - resolve service by multicast\n"
            "\n"
            "Examples:\n"
            "\n";
    std::cerr << appName()
              << " --CONNECT:Endpoint=[NAME=svc,HOST=host,PORT=4711]\n";
    std::cerr << appName() << " --CONNECT:Endpoint=[NAME=svc,PORT=4711]\n";
    std::cerr << appName() << " --CONNECT:Endpoint=[NAME=svc,MULTICAST=1]\n"
              "\n"
              "Hints:\n"
              " Don't put spaces in commandline arguments or use quotes\n"
              " NO: --CONNECT:Endpoint=[NAME=svc, PORT=4711]\n"
              " OK: --CONNECT:Endpoint=\"[NAME=svc, PORT=4711]\"\n"
              "\n"
              "\n";
    return _ret;
}

