当前位置: 首页>>代码示例>>C++>>正文


C++ NetworkController类代码示例

本文整理汇总了C++中NetworkController的典型用法代码示例。如果您正苦于以下问题:C++ NetworkController类的具体用法?C++ NetworkController怎么用?C++ NetworkController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了NetworkController类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEST_F

TEST_F(NetworkControllerTest, loadObservations){
	NetworkController n;
	n.loadNetwork(TEST_DATA_PATH("Student.na"));
	n.loadNetwork(TEST_DATA_PATH("Student.sif"));
	n.loadObservations(TEST_DATA_PATH("StudentData.txt"),TEST_DATA_PATH("controlStudent.json"));
	SUCCEED();
}
开发者ID:dstoeckel,项目名称:causaltrail,代码行数:7,代码来源:NetworkControllerTest.cpp

示例2: main

int main(int argc, char** argv)
{
	if (argc<2) {
		qWarning()<<"Aufruf" << argv[0] << "server [port]";
		return 0;
	}

	QCoreApplication app(argc, argv);
    app.setApplicationName(QLatin1String("roomcontrol.curtain.client"));
    app.setApplicationVersion(QLatin1String("1.0"));
	
    curtain curtainController;
    NetworkController *nc = NetworkController::instance();
    QObject::connect(nc, SIGNAL(serverJSON(QVariantMap)),
				&curtainController, SLOT(serverJSON(QVariantMap)));
    QObject::connect(nc, SIGNAL(message(QString)),
				&curtainController, SLOT(message(QString)));
    QObject::connect(nc, SIGNAL(stateChanged()),
				&curtainController, SLOT(stateChanged()));
	
	QByteArray server(argv[1]);
	int port = argc>=3 ? QByteArray(argv[2]).toInt() : 3101;
	nc->connectToServer(server,port);
    int r = app.exec();
    delete nc;
    return r;
}
开发者ID:davidgraeff,项目名称:oldstuff,代码行数:27,代码来源:main.cpp

示例3: callbackCommand

void callbackCommand(CoapPacket &packet, IPAddress ip, int port) {
  NetworkController* networkController = getEventController()->getNetworkController();

  String params = (const char*)packet.payload;
  command(params);

  networkController->sendCoapResponse(ip, port, ++packet.messageid, NULL, 0, COAP_RESPONSE_CODE::COAP_VALID, COAP_CONTENT_TYPE::COAP_TEXT_PLAIN);
}
开发者ID:mike12345567,项目名称:robotic-firmware,代码行数:8,代码来源:NetworkController.cpp

示例4: main

int main(int argc, char* argv[])
{
    // Create all the necessary objects (calls the default constructor for each)
    TargetDetector detector;
    TargetProcessor processor;
    NetworkController networkController;
    VideoDevice camera;
	CmdLineInterface interface(argc, argv);		
	AppConfig config = interface.getConfig();
	GUIManager gui;

	if(config.getIsDevice())
    {
        camera.startCapture(config.getDeviceID());
        if(config.getIsDebug())
            std::cout << "Camera ready!\n";
    }

    //init networking
    if(config.getIsNetworking())
        networkController.startServer();

    if(!config.getIsHeadless())
        gui.init();
    if(config.getIsDebug())
	 std::cout << "Im debugging! :D\n";

    while(true)
    {
        networkController.waitForPing();

        cv::Mat image = camera.getImage();
        Target* target = detector.processImage(image);

        bool foundTarget = (target == NULL ? false : true);

        if(foundTarget)
        {
            processor.loadTarget(target);
            double distance = processor.calculateDistance();

            networkController.sendMessage("true;" +
                boost::lexical_cast<std::string> (distance));

            std::cout << "Target Found! Distance: " << distance;
        }
        else
        {
            networkController.sendMessage("false;");
        }
    }

    return 0;
}
开发者ID:ronakdev,项目名称:cv-2016,代码行数:54,代码来源:main.cpp

示例5: stream

void curtain::onInputData()
{
    QSocketNotifier* input = (QSocketNotifier*)sender();
    input->setEnabled(false);
    QTextStream stream(stdin, QIODevice::ReadOnly);
	NetworkController* nc = NetworkController::instance();
    QString cmd;
    stream >> cmd;
    if (cmd == "help") {
	qDebug() << "open, close, set, stop, debug, dirnormal, dirinverted, dirok";
    } else if (cmd == "set" && !stream.atEnd()) {
      int v; stream >> v;
		QVariantMap data;
		data.insert("type_", "execute");
		data.insert("plugin_", "curtain_udp");
		data.insert("instanceid_", "0");
		data.insert("member_", "setValue");
		data.insert("value", v);
        nc->write(data);
        qDebug() << cmd;
    } else if (cmd == "open") {
开发者ID:davidgraeff,项目名称:oldstuff,代码行数:21,代码来源:curtain.cpp

示例6: main

int main(int argc, char* argv[]) {
	NetworkController networkController;
	NetworkLayerInterface *networkIfc = &networkController;
	PresentationLayerInterface *presentationIfc = new Encryption();
	ApplicationLayerInterface *applicationIfc = new Client::Application::Client();
	
	applicationIfc->setPresentationLayer(presentationIfc);
	presentationIfc->setNetworkLayer(networkIfc);
	presentationIfc->setApplicationLayer(applicationIfc);
	networkIfc->setPresentationLayer(presentationIfc);

	string username(argv[1]);
	
	networkController.configure("127.0.0.1", 8080, username);

	thread networkThread(std::ref(networkController));
	thread chatThread(std::ref(*((Client::Application::Client*)applicationIfc)));
	chatThread.join();

	delete presentationIfc;
	delete applicationIfc;

	return 0;
}
开发者ID:MichaelE1000,项目名称:in2081_patterns,代码行数:24,代码来源:main.cpp

示例7: callbackResponse

void callbackResponse(CoapPacket &packet, IPAddress ip, int port) {
  NetworkController* networkController = getEventController()->getNetworkController();

  networkController->sendCoapResponse(ip, port, ++packet.messageid, NULL, 0, COAP_RESPONSE_CODE::COAP_VALID, COAP_CONTENT_TYPE::COAP_TEXT_PLAIN);
}
开发者ID:mike12345567,项目名称:robotic-firmware,代码行数:5,代码来源:NetworkController.cpp

示例8: main

int main(int argc, char* argv[])
{
    // Create all the necessary objects (calls the default constructor for each)
    TargetDetector detector;
    TargetProcessor processor;
    NetworkController networkController;
    VideoDevice camera;
	CmdLineInterface interface(argc, argv);
	AppConfig config = interface.getConfig();
	//GUIManager gui;

	if(config.getIsDevice()){
        camera.startCapture(config.getDeviceID());
        if(config.getIsDebug())
            std::cout << "Camera ready!\n";
    }

    //init networking
    if(config.getIsNetworking())
        networkController.startServer();

    //if(!config.getIsHeadless())
    //    gui.init();
    if(config.getIsDebug())
	 	std::cout << "Im debugging! :D\n";
    cv::Mat image;

    //debug
    int loop = 1;
    cv::namedWindow("Live Video Feed", cv::WINDOW_NORMAL);
    cv::namedWindow("General", cv::WINDOW_NORMAL);


    while(cv::waitKey(30) != 27)
    {
        Mat background(Size(1000,1000), CV_8UC1, Scalar(255, 255, 255 ));

        if(config.getIsDebug())
            std::cout << "While Loop #" << loop << std::endl;

		if(config.getIsNetworking())
        	networkController.waitForPing();

        image = camera.getImage();
        if(!image.data) // check if image is valid
        {
            if(config.getIsDebug())
                std::cout << "failed to read image" << std::endl;
            return -1;
        }

        if(config.getIsDebug())
            std::cout << "Image Read" << std::endl;
        Target* target = detector.processImage(image);

        if(config.getIsDebug())
            std::cout << "Image Processed by Target Detector" << std::endl;
        /*
        (std::cout << "Target Value:" << target << "End of Target Value\n";
        std::cout << "CR A OW: " << target-> crow;
        target -> printPoints();
        */
        bool foundTarget = false;
        if (target != NULL)
        {
            foundTarget = true;
            image = detector.getOutlinedImage();
        }
        std::cout <<"About to check the value of foundTarget" << std::endl;
        if(foundTarget)
        {


            std::cout <<"Target was found " << std::endl;

            if(config.getIsDebug())
                std::cout << "Image Being Processed" << std::endl;

            processor.loadTarget(target);

            if(config.getIsDebug())
                std::cout << "Target Loaded" << std::endl;

            double distance = processor.calculateDistance();

            if(config.getIsDebug())
                std::cout << "Distance Calculated" << std::endl;

			double azimuth = processor.calculateAzimuth();
            if(config.getIsDebug())
                std::cout << "Azimuth Calculated" << std::endl;

			double altitude = processor.calculateAltitude();
            if(config.getIsDebug())
                std::cout << "Altitude Calculated" << std::endl;

            if(config.getIsDebug())
                std::cout << "Image Processed by TargetProcessor" << std::endl;

                std::string dis = "distance: " + std::to_string(distance);
//.........这里部分代码省略.........
开发者ID:frc-team-3341,项目名称:cv-2016,代码行数:101,代码来源:cv-2016.cpp

示例9: main

int main(int argc, char* argv[])
{
    // get command line interface config options
    CmdLineInterface interface(argc, argv);
    AppConfig config = interface.getConfig();

    GUIManager gui;
    VideoDevice camera;
    LProcessor processor;
    NetworkController networkController;
    ArduinoController arduino;

    //init camera
    if(config.getIsDevice())
    {
        camera.startCapture(config.getDeviceID());
        if(config.getIsDebug())
            std::cout << "Camera ready!\n";
    }

    //init networking
    if(config.getIsNetworking())
        networkController.startServer();

    if(!config.getIsHeadless())
        gui.init();

    if (config.getHasArduino())
    {
        //16 is /dev/ttyUSB0, 24 is /dev/ttyACM0
        arduino.init(9600, 24);  //baud rate, serial port
    }
    //continuous server loop
    do
    {
        if(config.getIsNetworking())
            networkController.waitForPing();

        LDetector detector;

        cv::Mat image;
        if(config.getIsFile());
            //image = cv::imread(config.getFileName());
        //else
        //    image = camera.getImage(config.getIsDebug());

        //detector.elLoad(image);
        //detector.elSplit();
        //detector.elThresh();
        //detector.elContours(); detector.elFilter();

        bool foundL = true;
        if (detector.getLs().size() > 0)
            detector.largest2();
        else
            foundL = false;
        if (detector.getLs().size() == 0)
            foundL = false;
        if (foundL)
        {
            processor.determineL(detector.getLs());
            processor.determineAzimuth();
            processor.determineDistance();
            double azimuth = processor.getAzimuth();
            double distance = processor.getDistance();

            if(config.getIsDebug())
            {
                processor.outputData();
                std::cout << "Final distance (m): " << processor.getDistance() << std::endl;
            }

            if(!config.getIsHeadless())
            {
                int i_dist = (int) (distance * 1000.0);
                int dist_left = i_dist / 1000;
                int dist_right = i_dist % 1000;
                std::string dist_str = boost::lexical_cast<std::string>(dist_left) + "." + boost::lexical_cast<std::string>(dist_right);

                gui.setImage(detector.show());
                gui.setImageText("Distance: " + dist_str + " m");
                gui.show(config.getIsFile());
            }

            if(config.getIsNetworking())
            {
                networkController.sendMessage(boost::lexical_cast<std::string> ("true") + std::string(";")
                                              + boost::lexical_cast<std::string> (distance) + std::string(";")
                                              + boost::lexical_cast<std::string> (azimuth));
            }

        }
        else
        {
            if(config.getIsNetworking())
                networkController.sendMessage(boost::lexical_cast<std::string> ("false") + std::string(";"));
            if(!config.getIsHeadless())
            {
                gui.setImage(detector.show());
                gui.setImageText("No L's Found");
//.........这里部分代码省略.........
开发者ID:nickwn,项目名称:cv-2015-arduino,代码行数:101,代码来源:cv_2015.cpp


注:本文中的NetworkController类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。