//Sample from samples/devices/camera
#include "stdafx.h"
#include "Modacpp.h"
#include "conio.h"
#define MODASERVER "localhost"
int main(int argc, char* argv[])
{
ModaCPP::Connection *connection=new ModaCPP::Connection(true);
//Try connect to MODA server
if(connection->Connect(MODASERVER))
{
_cprintf("Connection ok to moda server\r\n");
//Find the robot
ModaCPP::RobotPHX *phx=connection->QueryRobotPHX("/");
if(phx)
{
_cprintf("phx found\r\n");
ModaCPP::DeviceCamera *pCamera=phx->QueryDeviceCamera("viewpoint0/camera");
if(pCamera)
{
_cprintf("camera found\r\n");
ModaCPP::Image theimage;
while(!_kbhit())
{
pCamera->GetNextImage(&theimage);
if(theimage.IsValid())
{
theimage.DoHorizontalFlip();
theimage.Display(0,0);
}
connection->Sleep(20);
}
}
}
else
{
_cprintf("robot not found\r\n");
}
}
else
{
_cprintf("Unable to connect to moda server\r\n");
}
//Disconnect & delete
connection->Disconnect();
delete connection;
_getch();
return 0;
}