//MODA C++ native code sample
#include "stdafx.h"
#include "Modacpp.h"
#include "conio.h"
#define MODASERVER "localhost"
int main(int argc, TCHAR* argv[])
{
ModaCPP::Connection *connection=new ModaCPP::Connection(true);
if(connection->Connect(MODASERVER))
{
_cprintf("Connection ok to moda server\r\n");
xkode::lib::ObjectsArray<xkode::lib::String> PHXlist=connection->GetRobotPHXsList();
_cprintf("%d PHX(s) found:\r\n",PHXlist.Count());
for(int i=0;i<PHXlist.Count();i++)
{
_cprintf("\t%s\r\n",PHXlist[i].GetData());
}
_cprintf("End of PHX enums\r\n");
//*******************************************************************************
//SAMPLE : connect to the 1 indexed robot:
//
// xkode::lib::String ChoosenRobot=PHXlist[1];
// ModaCPP::RobotPHX *pRobot=connection->QueryRobotPHX(ChoosenRobot);
//
// if(pRobot) _cprintf("Connected to %s\r\n",ChoosenRobot.GetData());
// else _cprintf("Cannot connected to %s\r\n",ChoosenRobot.GetData());
//*******************************************************************************
}
else
{
_cprintf("Unable to connect to moda server\r\n");
}
connection->Disconnect();
delete connection;
_getch();
return 0;
}