Example #1
0
int main (int argc, char* argv[]) {
	int status;
	Ice::CommunicatorPtr ic;

	try {
		ic = Ice::initialize(argc, argv);

		// Contact to Encoders
		Ice::ObjectPrx Encoders = ic->propertyToProxy("automata.Encoders.Proxy");
		if (Encoders == 0)
			throw "Could not create proxy with Encoders";
		Encodersprx = jderobot::EncodersPrx::checkedCast(Encoders);
		if (Encodersprx == 0)
			throw "Invalid proxy automata.Encoders.Proxy";
		std::cout << "Encoders connected" << std::endl;

		// Contact to Motors
		Ice::ObjectPrx Motors = ic->propertyToProxy("automata.Motors.Proxy");
		if (Motors == 0)
			throw "Could not create proxy with Motors";
		Motorsprx = jderobot::MotorsPrx::checkedCast(Motors);
		if (Motorsprx == 0)
			throw "Invalid proxy automata.Motors.Proxy";
		std::cout << "Motors connected" << std::endl;

		automatagui = new AutomataGui(argc, argv);
		displayAutomataGui = showAutomataGui();
		pthread_create(&thr_sub_1, NULL, &subautomata_1, NULL);

		pthread_join(thr_sub_1, NULL);
		if (displayAutomataGui)
			pthread_join(thr_automatagui, NULL);

	} catch ( const Ice::Exception& ex ) {
		std::cerr << ex << std::endl;
		status = 1;
	} catch ( const char* msg ) {
		std::cerr << msg << std::endl;
		status = 1;
	}

	if (ic)
		ic->destroy();

	return status;
}
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
    communicator->getProperties()->setProperty("Ice.Warn.Dispatch", "0");

    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    
    adapter->addServantLocator(new ServantLocatorAMDI(""), "");
    adapter->addServantLocator(new ServantLocatorAMDI("category"), "category");
    adapter->add(new TestAMDI, communicator->stringToIdentity("asm"));
    adapter->add(new TestActivationI, communicator->stringToIdentity("test/activation"));
    adapter->activate();
    TEST_READY
    adapter->waitForDeactivate();
    return EXIT_SUCCESS;
}
Example #3
0
int main(int argc, char** argv) {
    int status;

    cameraview::colorTuner viewer;
    Ice::CommunicatorPtr ic;

    try {
        ic = EasyIce::initialize(argc,argv);
        Ice::ObjectPrx base = ic->propertyToProxy("Cameraview.Camera.Proxy");
        if (0==base)
            throw "Could not create proxy";

        /*cast to CameraPrx*/
        jderobot::CameraPrx cprx = jderobot::CameraPrx::checkedCast(base);
        if (0==cprx)
            throw "Invalid proxy";

        while(viewer.isVisible()) {
            jderobot::ImageDataPtr data = cprx->getImageData(colorspaces::ImageRGB8::FORMAT_RGB8.get()->name);



            cv::Mat image = cv::Mat(cv::Size(data->description->width,data->description->height),CV_8UC3,&(data->pixelData[0]));


            colorspaces::Image::FormatPtr fmt = colorspaces::Image::Format::searchFormat(data->description->format);
            if (!fmt)
                throw "Format not supported";

            viewer.display(image);
            image.release();

        }

    } catch (const Ice::Exception& ex) {
        std::cerr << ex << std::endl;
        status = 1;
    } catch (const char* msg) {
        std::cerr << msg << std::endl;
        status = 1;
    }

    if (ic)
        ic->destroy();
    return status;
}
int
main(int argc, char* argv[])
{
    int status;
    Ice::CommunicatorPtr communicator;

    try
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
#ifdef ICE_CPP11
        Ice::DispatcherPtr dispatcher = new Dispatcher();
        initData.dispatcher = Ice::newDispatcher(
            [=](const Ice::DispatcherCallPtr& call, const Ice::ConnectionPtr& conn)
                {
                    dispatcher->dispatch(call, conn);
                });
#else
        initData.dispatcher = new Dispatcher();
#endif
        communicator = Ice::initialize(argc, argv, initData);
        status = run(argc, argv, communicator);
    }
    catch(const Ice::Exception& ex)
    {
        cerr << ex << endl;
        status = EXIT_FAILURE;
    }

    if(communicator)
    {
        try
        {
            communicator->destroy();
        }
        catch(const Ice::Exception& ex)
        {
            cerr << ex << endl;
            status = EXIT_FAILURE;
        }
    }

    Dispatcher::terminate();
    return status;
}
Example #5
0
int
main(int argc, char* argv[])
{
    int status = 0;
    int count=0;
    Ice::CommunicatorPtr ic;
    GUI gui(argc, argv);

    try {
        ic = Ice::initialize(argc, argv);
        Ice::ObjectPrx base = ic->stringToProxy("AirportInterface:default -p 10000");

        if (!base)
                  throw "Invalid base";

        ATCDisplay::AirportInterfacePrx airportsim = ATCDisplay::AirportInterfacePrx::checkedCast(base);

        if (!airportsim)
            throw "Invalid proxy";

        int milisec = 100; // length of time to sleep, in miliseconds
        struct timespec req;
        req.tv_sec = 0;
        req.tv_nsec = milisec * 1000000L;

        //while(1)
        //std::cout<<airportsim->getPoints()<<std::endl;

        gui.init(airportsim);
        gui.run();




    } catch (const Ice::Exception& ex) {
        cerr << ex << endl;
        status = 1;
    } catch (const char* msg) {
        cerr << msg << endl;
        status = 1;
    }
    if (ic)
        ic->destroy();
    return status;
}
Example #6
0
int
main(int argc, char* argv[])
{
#ifdef ICE_STATIC_LIBS
    Ice::registerIceSSL();
#endif
    int status;
    Ice::CommunicatorPtr communicator;

    try
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
        initData.properties->setProperty("Ice.Warn.Dispatch", "0");
        initData.properties->setProperty("Ice.Warn.Connections", "0");
        initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
        initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max
        initData.properties->setProperty("TestAdapter2.Endpoints", "default -p 12011");
        initData.properties->setProperty("TestAdapter2.MessageSizeMax", "0");
        initData.properties->setProperty("TestAdapter3.Endpoints", "default -p 12012");
        initData.properties->setProperty("TestAdapter3.MessageSizeMax", "1");
        communicator = Ice::initialize(argc, argv, initData);
        status = run(argc, argv, communicator);
    }
    catch(const Ice::Exception& ex)
    {
        cerr << ex << endl;
        status = EXIT_FAILURE;
    }

    if(communicator)
    {
        try
        {
            communicator->destroy();
        }
        catch(const Ice::Exception& ex)
        {
            cerr << ex << endl;
            status = EXIT_FAILURE;
        }
    }

    return status;
}
// ######################################################################
void PrimaryMotorCortexI::init(Ice::CommunicatorPtr ic, Ice::ObjectAdapterPtr adapter)
{
  Ice::ObjectPtr pmcPtr = this;
  itsObjectPrx = adapter->add(pmcPtr,
      ic->stringToIdentity("PrimaryMotorCortex"));

  IceStorm::TopicPrx topicPrx;
  itsTopicsSubscriptions.push_back(SimEventsUtils::TopicInfo("ActionMessageTopic", topicPrx));
  SimEventsUtils::initSimEvents(ic, itsObjectPrx, itsTopicsSubscriptions);

  Ice::ObjectPrx base = ic->stringToProxy(
      "IRobotService:default -p 10000 -h roomba");
  itsRobot = Robots::IRobotPrx::checkedCast(base);

  if(!itsRobot) LFATAL("Invalid Robot Proxy");
  itsRobot->sendStart();
  itsRobot->setMode(Robots::SafeMode);
}
Example #8
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPtr& observer)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(ICE_MAKE_SHARED(MetricsI), Ice::stringToIdentity("metrics"));
    //adapter->activate(); // Don't activate OA to ensure collocation is used.

    communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1));
    Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter");
    controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller"));
    //controllerAdapter->activate(); // Don't activate OA to ensure collocation is used.

    MetricsPrxPtr allTests(const Ice::CommunicatorPtr&, const CommunicatorObserverIPtr&);
    MetricsPrxPtr metrics = allTests(communicator, observer);
    metrics->shutdown();
    return EXIT_SUCCESS;
}
Example #9
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    Ice::ObjectFactoryPtr factory = new MyObjectFactory;
    communicator->addObjectFactory(factory, "::Test::B");
    communicator->addObjectFactory(factory, "::Test::C");
    communicator->addObjectFactory(factory, "::Test::D");
    communicator->addObjectFactory(factory, "::Test::E");
    communicator->addObjectFactory(factory, "::Test::F");
    communicator->addObjectFactory(factory, "::Test::I");
    communicator->addObjectFactory(factory, "::Test::J");
    communicator->addObjectFactory(factory, "::Test::H");

    InitialPrx allTests(const Ice::CommunicatorPtr&);
    InitialPrx initial = allTests(communicator);
    initial->shutdown();
    return EXIT_SUCCESS;
}
Example #10
0
void MainWindow::setSpeeds(Ice::CommunicatorPtr ic){

 	Ice::PropertiesPtr prop = ic->getProperties();

	this->max_x = std::atof( prop->getPropertyWithDefault("UAVViewer.Xmax", "0.3").c_str() );
	this->max_y = std::atof( prop->getPropertyWithDefault("UAVViewer.Ymax", "0.3").c_str() );
	this->max_z = std::atof( prop->getPropertyWithDefault("UAVViewer.Zmax", "0.3").c_str() );
	this->max_yaw = std::atof( prop->getPropertyWithDefault("UAVViewer.Yawmax", "0.3").c_str() );
}
Example #11
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    Ice::ObjectPtr d = ICE_MAKE_SHARED(DI);
    adapter->add(d, Ice::stringToIdentity("d"));
    adapter->addFacet(d, Ice::stringToIdentity("d"), "facetABCD");
    Ice::ObjectPtr f = ICE_MAKE_SHARED(FI);
    adapter->addFacet(f, Ice::stringToIdentity("d"), "facetEF");
    Ice::ObjectPtr h = ICE_MAKE_SHARED(HI, communicator);
    adapter->addFacet(h, Ice::stringToIdentity("d"), "facetGH");

    GPrxPtr allTests(const Ice::CommunicatorPtr&);
    allTests(communicator);

    return EXIT_SUCCESS;
}
Example #12
0
    Glacier2::RouterPrx const client::getRouter(const Ice::CommunicatorPtr& comm) const {

        Ice::RouterPrx prx = comm->getDefaultRouter();
        if ( ! prx ) {
            throw omero::ClientError(__FILE__,__LINE__,"No default router found.");
        }

        Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(prx);
        if ( ! router ) {
            throw ClientError(__FILE__, __LINE__, "Error obtaining Glacier2 router");
        }

        // For whatever reason, we have to set the context
        // on the router context here as well.
        router = Glacier2::RouterPrx::uncheckedCast(router->ice_context(comm->getImplicitContext()->getContext()));

        return router;
    }
Example #13
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
    communicator->getProperties()->setProperty("TestAdapter.ACM.Timeout", "0");
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    Ice::Identity id = Ice::stringToIdentity("communicator");
    adapter->add(ICE_MAKE_SHARED(RemoteCommunicatorI), id);
    adapter->activate();

    TEST_READY

    // Disable ready print for further adapters.
    communicator->getProperties()->setProperty("Ice.PrintAdapterReady", "0");

    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}
Example #14
0
void MyUtil::initialize() {
  ServiceI& service = ServiceI::instance();
  service.getAdapter()->add(&FeedFocusInvertI::instance(), service.createIdentity(
      "M", ""));
  Ice::CommunicatorPtr communicator = service.getCommunicator();

  int mod = communicator->getProperties()->getPropertyAsInt( "FeedFocusInvert.Mod");
  int interval = communicator->getProperties()->getPropertyAsIntWithDefault( "FeedFocusInvert.Interval", 5);
  xce::serverstate::ServerStateSubscriber::instance().initialize( "ControllerFeedFocusInvertR", &FeedFocusInvertI::instance(), mod, interval,
      new XceFeedChannel());
  //register 2 controller
  xce::feed::serverstate::FeedServerStateSubscriber::instance().initialize( "ControllerFeedFocusInvertR", &FeedFocusInvertI::instance(), mod, interval,
      new XceFeedControllerChannel());
  MCE_INFO("MyUtil::initialize. mod:" << mod << " interval:" << interval);


  TaskManager::instance().scheduleRepeated(&FeedFocusInvertStatTimer::instance());
}
Example #15
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(ICE_MAKE_SHARED(MetricsI), Ice::stringToIdentity("metrics"));
    adapter->activate();

    communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", "default -p 12011");
    Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter");
    controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller"));
    controllerAdapter->activate();

    TEST_READY
    communicator->waitForShutdown();

    return EXIT_SUCCESS;
}
Example #16
0
Thread_control::Thread_control(Ice::CommunicatorPtr ic, KobukiManager* kobuki_manager)
{
    this->ic = ic;
    prop = ic->getProperties();

    this->kobuki_manager = kobuki_manager;
    initMotors();
    initEncoders();
}
Example #17
0
int
main(int argc, char* argv[])
{
#ifdef ICE_STATIC_LIBS
    Ice::registerIceSSL();
#endif
    int status;
    Ice::CommunicatorPtr communicator;

    try
    {
        //
        // In this test, we need a longer server idle time, otherwise
        // our test servers may time out before they are used in the
        // test.
        //
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
        initData.properties->setProperty("Ice.ServerIdleTime", "120"); // Two minutes.

        communicator = Ice::initialize(argc, argv, initData);
        status = run(argc, argv, communicator);
    }
    catch(const Ice::Exception& ex)
    {
        cerr << ex << endl;
        status = EXIT_FAILURE;
    }

    if(communicator)
    {
        try
        {
            communicator->destroy();
        }
        catch(const Ice::Exception& ex)
        {
            cerr << ex << endl;
            status = EXIT_FAILURE;
        }
    }

    return status;
}
Example #18
0
int main(int argc, char **argv) {
    Ice::CommunicatorPtr ic;
    jderobot::cameraClient* camRGB;

    try {
        ic = EasyIce::initialize(argc, argv);
        Ice::ObjectPrx base = ic->propertyToProxy("Cameraview.Camera.Proxy");
        Ice::PropertiesPtr prop = ic->getProperties();

        if (0==base)
            throw "Could not create Proxy\n";

        camRGB = new jderobot::cameraClient(ic, "Cameraview.Camera.");

        if (camRGB == NULL) {
            throw "Invalid Proxy";
        } else {
            camRGB->start();
            std::cout << "Using ICE camera server..";
            cv::Mat rgb;

            while(1) {
                camRGB->getImage(rgb);
                if (rgb.rows==0 || rgb.cols==0) continue;
                imshow("frame:ICE", rgb);
                waitKey(33);
            }
        }
    } catch (const char* msg) {

    }

    ros::init(argc, argv, "listener");

    ros::NodeHandle n,nh;
    image_transport::ImageTransport it(nh);
    image_transport::Subscriber camera_sub = it.subscribe("cameratopic", 1000, cameracallback);

    ros::Subscriber sub = n.subscribe("chatter", 1001, chatterCallback);

    ros::spin();

    return 0;
}
Example #19
0
int main(int argc, char ** argv){
	vector<string> names;

	if(argc == 1){
		cout << "useage:" << endl;
		cout << "1. Dump all instances : " << argv[0] << " " << DUMPALL << endl;
		cout << "2. Dump specified instances,combine instances by space : " << argv[0] << " instance1 [...]" << endl;
		cout << "\nexample:" << endl;
		cout << argv[0] << " vipmember user_config buddycore_friend_a" << endl;
		return 0;
	} else if (argc >= 2) {
		string name = argv[1];
		if(name == DUMPALL) {
			names.push_back("");
		} else {
			for(int i=1; i<argc; i++) {
				names.push_back(argv[i]);
			}
		}
	} else {
		cout << "Argument error" << endl;
		return 0;
	}

	MyUtil::OceChannel channel;
	Ice::CommunicatorPtr ic = channel.getCommunicator();
	DbDescriptorPrx proxy = DbDescriptorPrx::checkedCast(ic->stringToProxy("DCS@DbDescriptor"));
	cout << "dumping..." << endl;
	for(vector<string>::iterator iv = names.begin(); iv < names.end(); iv++){
		if((*iv) == ""){
			DbInstanceSeq instances = proxy->getDbInstances();
			cout << "Instances size = " << instances.size() << endl;
			for(DbInstanceSeq::iterator it = instances.begin(); it != instances.end(); it++){
				dumpObserver(proxy, (*it)->name);	
			}
		} else {
			dumpObserver(proxy, (*iv));
		}
	}

	ic->destroy();
	cout << "done." << endl;
	return 0;
}
Example #20
0
TraceLevels::TraceLevels(const Ice::CommunicatorPtr& communicator, const string& prefix) :
    admin(0),
    adminCat("Admin"),
    application(0),
    applicationCat("Application"),
    node(0),
    nodeCat("Node"),
    replica(0),
    replicaCat("Replica"),
    server(0),
    serverCat("Server"),
    adapter(0),
    adapterCat("Adapter"),
    object(0),
    objectCat("Object"),
    activator(0),
    activatorCat("Activator"),
    patch(0),
    patchCat("Patch"),
    locator(0),
    locatorCat("Locator"),
    session(0),
    sessionCat("Session"),
    discovery(0),
    discoveryCat("Discovery"),
    logger(communicator->getLogger())
{
    Ice::PropertiesPtr properties = communicator->getProperties();

    string keyBase = prefix + ".Trace.";
    const_cast<int&>(admin) = properties->getPropertyAsInt(keyBase + adminCat);
    const_cast<int&>(application) = properties->getPropertyAsInt(keyBase + applicationCat);
    const_cast<int&>(node) = properties->getPropertyAsInt(keyBase + nodeCat);
    const_cast<int&>(replica) = properties->getPropertyAsInt(keyBase + replicaCat);
    const_cast<int&>(server) = properties->getPropertyAsInt(keyBase + serverCat);
    const_cast<int&>(adapter) = properties->getPropertyAsInt(keyBase + adapterCat);
    const_cast<int&>(object) = properties->getPropertyAsInt(keyBase + objectCat);
    const_cast<int&>(activator) = properties->getPropertyAsInt(keyBase + activatorCat);
    const_cast<int&>(patch) = properties->getPropertyAsInt(keyBase + patchCat);
    const_cast<int&>(locator) = properties->getPropertyAsInt(keyBase + locatorCat);
    const_cast<int&>(session) = properties->getPropertyAsInt(keyBase + sessionCat);
    const_cast<int&>(discovery) = properties->getPropertyAsInt(keyBase + discoveryCat);
}
Example #21
0
int
main(int argc, char* argv[])
{
    int status;
    Ice::CommunicatorPtr communicator;

    try
    {
        //
        // In this test, we need at least two threads in the
        // client side thread pool for nested AMI.
        //
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
        initData.properties->setProperty("Ice.ThreadPool.Client.Size", "2");
        initData.properties->setProperty("Ice.ThreadPool.Client.SizeWarn", "0");

        initData.properties->setProperty("Ice.BatchAutoFlushSize", "100");

        communicator = Ice::initialize(argc, argv, initData);
        status = run(argc, argv, communicator, initData);
    }
    catch(const Ice::Exception& ex)
    {
        cerr << ex << endl;
        status = EXIT_FAILURE;
    }

    if(communicator)
    {
        try
        {
            communicator->destroy();
        }
        catch(const Ice::Exception& ex)
        {
            cerr << ex << endl;
            status = EXIT_FAILURE;
        }
    }

    return status;
}
Example #22
0
void exitApplication(int s){

	killed=true;

	if (interface1 != NULL)
		delete interface1;

	ic->shutdown();
	exit(0);
}
Example #23
0
int main(int argc,char *argv[])
{
	//建立通信器  
	ic = Ice::initialize(argc, argv);  
	//获得Ice对象代理,SimplePrinter-对象标识符,default -p 10000-协议与端口  
	Ice::ObjectPrx base = ic->stringToProxy("MyIceCore:default -p 10000");  
	//向下转换  
	CoreBasePrx co = CoreBasePrx::checkedCast(base);  
	if (!co) throw "Invalid proxy";  
	//调用操作  
	co->PrintMsg("Hello World!");  
	int iSum = co->add(98,2);
	cout << iSum <<endl;
	int iSub = co->sub(87,7);
	cout<<iSub<<endl;
	ic->destroy(); // 清理资源

	return 0;
}
Example #24
0
int
main(int argc, char* argv[])

#endif
{
    Ice::StringSeq args = Ice::argsToStringSeq(argc, argv);
    assert(args.size() > 0);
    const string appName = args[0];
    Ice::CommunicatorPtr communicator;
    int status = EXIT_SUCCESS;
    try
    {
        communicator = Ice::initialize(args);
        status = run(args, communicator);
    }
    catch(const FreezeScript::FailureException& ex)
    {
        string reason = ex.reason();
        cerr << appName << ": " << reason;
        if(reason[reason.size() - 1] != '\n')
        {
            cerr << endl;
        }
        return EXIT_FAILURE;
    }
    catch(const std::exception& ex)
    {
        cerr << appName << ": " << ex.what() << endl;
        status = EXIT_FAILURE;
    }
    catch(...)
    {
        cerr << appName << ": unknown error" << endl;
        return EXIT_FAILURE;
    }

    if(communicator)
    {
        communicator->destroy();
    }

    return status;
}
Example #25
0
cameraClient::cameraClient(Ice::CommunicatorPtr ic, std::string prefix) {

	this->prefix=prefix;
	Ice::PropertiesPtr prop;
	prop = ic->getProperties();
	Ice::ObjectPrx baseCamera;
	this->refreshRate=0;
	this->mImageFormat.empty();
	this->newData=false;

	int fps=prop->getPropertyAsIntWithDefault(prefix+"Fps",30);
	this->cycle=(float)(1/(float)fps)*1000000;
	try{
		baseCamera = ic->propertyToProxy(prefix+"Proxy");
		if (0==baseCamera){
			throw prefix + "Could not create proxy with Camera";
		}
		else {
			this->prx= jderobot::CameraPrx::checkedCast(baseCamera);
			if (0==this->prx)
				throw "Invalid " + prefix + ".Proxy";
		}
	}catch (const Ice::Exception& ex) {
		std::cerr << ex << std::endl;
	}
	catch (const char* msg) {
		std::cerr << msg << std::endl;
		LOG(FATAL) << prefix + " Not camera provided";
	}


	//check if default format is defined
	std::string definedFormat=prop->getProperty(prefix+"ImageFormat");
	this->mImageFormat = CameraUtils::negotiateDefaultFormat(this->prx,definedFormat);


	jderobot::ImageDataPtr data = this->prx->getImageData(this->mImageFormat);

	this->size=cv::Size(data->description->width,data->description->height);
	_done=false;
	this->pauseStatus=false;
}
Example #26
0
Pose3dIceClient::Pose3dIceClient(Ice::CommunicatorPtr ic, std::string prefix) {

	this->prefix=prefix;
	Ice::PropertiesPtr prop;
	prop = ic->getProperties();

	int fps=prop->getPropertyAsIntWithDefault(prefix+".Fps",30);
	this->cycle=(float)(1/(float)fps)*1000000;


	Ice::ObjectPrx basePose = ic->propertyToProxy(prefix+".Proxy");

	if (0==basePose){
		this->on = false;
		std::cout << prefix + ".Proxy configuration not specified" <<std::endl;

	}
	else {

		try{
			this->prx = jderobot::Pose3DPrx::checkedCast(basePose);

			if (0 == this->prx){
				this->on = false;
	 	   		std::cout <<"Invalid proxy "+ prefix + ".Proxy" <<std::endl;
	 		}else{
	 			this->on = true;
	 			std::cout << prefix + " connected" << std::endl;
	 		}

		
		}catch (const Ice::ConnectionRefusedException& e) {
			std::cout << prefix +" inactive" << std::endl;
		}
		catch (const Ice::Exception& ex) {
			std::cerr << ex << std::endl;
		}
	}

	this->pauseStatus=false;

}
Example #27
0
int
main(int argc, char** argv)
{
#ifdef ICE_STATIC_LIBS
    Ice::registerPluginFactory("IceSSL", createIceSSL, true);
#endif
    int status;
    Ice::CommunicatorPtr communicator;

    try
    {
        IceUtil::setProcessStringConverter(new Test::StringConverterI);
        IceUtil::setProcessWstringConverter(new Test::WstringConverterI);
        
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
        initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010");
        
        communicator = Ice::initialize(argc, argv, initData);
        status = run(argc, argv, communicator);
    }
    catch(const Ice::Exception& ex)
    {
        cerr << ex << endl;
        status = EXIT_FAILURE;
    }

    if(communicator)
    {
        try
        {
            communicator->destroy();
        }
        catch(const Ice::Exception& ex)
        {
            cerr << ex << endl;
            status = EXIT_FAILURE;
        }
    }

    return status;
}
Example #28
0
void
SessionHelperI::connectFailed()
{
    Ice::CommunicatorPtr communicator;
    {
        IceUtil::Mutex::Lock sync(_mutex);
        communicator = _communicator;
    }

    if(communicator)
    {
        try
        {
            communicator->destroy();
        }
        catch(...)
        {
        }
    }
}
Example #29
0
RemoteObjectAdapterPrx
RemoteCommunicatorI::createObjectAdapter(const string& name, const string& endpts, const Current& current)
{
    string endpoints = endpts;
    if(endpoints.find("-p") == string::npos)
    {
        // Use a fixed port if none is specified (bug 2896)
        ostringstream os;
        os << endpoints << " -h \""
           << (current.adapter->getCommunicator()->getProperties()->getPropertyWithDefault(
                                                                                    "Ice.Default.Host", "127.0.0.1"))
           << "\" -p " << _nextPort++;
        endpoints = os.str();
    }
    
    Ice::CommunicatorPtr com = current.adapter->getCommunicator();
    com->getProperties()->setProperty(name + ".ThreadPool.Size", "1");
    ObjectAdapterPtr adapter = com->createObjectAdapterWithEndpoints(name, endpoints);
    return RemoteObjectAdapterPrx::uncheckedCast(current.adapter->addWithUUID(new RemoteObjectAdapterI(adapter)));
}
Example #30
0
int
main(int argc, char* argv[])
{
    int status;
    Ice::CommunicatorPtr communicator;

    try
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
        //initData.properties->setProperty("Ice.ThreadPool.Server.Size", "1");
        //initData.properties->setProperty("Ice.ThreadPool.Server.SizeMax", "1");
        initData.properties->setProperty("Ice.Admin.Endpoints", "tcp");
        initData.properties->setProperty("Ice.Admin.InstanceName", "server");
        initData.properties->setProperty("Ice.Warn.Connections", "0");
        initData.properties->setProperty("Ice.Warn.Dispatch", "0");
        initData.properties->setProperty("Ice.MessageSizeMax", "50000");
        communicator = Ice::initialize(argc, argv, initData);
        status = run(argc, argv, communicator);
    }
    catch(const Ice::Exception& ex)
    {
        cerr << ex << endl;
        status = EXIT_FAILURE;
    }

    if(communicator)
    {
        try
        {
            communicator->destroy();
        }
        catch(const Ice::Exception& ex)
        {
            cerr << ex << endl;
            status = EXIT_FAILURE;
        }
    }

    return status;
}