anyKode Marilou
ContentsIndexHome
Example
//Sample from Samples/Devices/LCD

#include "Modacpp.h"
#include "conio.h"

#define DEFAULT_MODASERVER    "localhost"
#define DEFAULT_PHXNAME       "/"

using namespace ModaCPP;

int main(int argc, char* argv[])
{
//take a look at commandline arguments:
// /server:[my server ip]
// /robot:/myrobot
CommandLine::ProcessCommandLine(argc,argv);

xkode::lib::String Server;
xkode::lib::String Phx;

if(CommandLine::ExistsValue("/server"))    Server=CommandLine::GetArgumentValue("/server");
else                                       Server=DEFAULT_MODASERVER;

if(CommandLine::ExistsValue("/robot"))    Phx=CommandLine::GetArgumentValue("/robot");
else                                      Phx=DEFAULT_PHXNAME;

//Try connect to MODA server
ModaCPP::Connection *connection=new ModaCPP::Connection(true);
if(connection->Connect(Server))
    {
    _cprintf("Connection ok to moda server %s\r\n",Server.GetData());
    //Find the robot/world
    ModaCPP::RobotPHX *phx=connection->QueryRobotPHX(Phx);
    if(phx)
        {

        (...) Do something

        delete phx;
        }
    else
        {
        _cprintf("phx %s not found\r\n",Phx.GetData());
        }
    }
else
    {
    _cprintf("Unable to connect to moda server\r\n");
    }
//Disconnect & delete
connection->Disconnect();
delete connection;
_getch();
return 0;
}


Usage: MyApplication.exe /robot:/myrobotphx /server:192.168.1.1 /myargument
Documentation v4.7 (18/01/2015), Copyright (c) 2015 anyKode. All rights reserved.