Пример #1
0
void portConnect(PortService_ptr p1, PortService_var p2)
{
	string subs_type = "new";
	string period = "";

	coil::UUID_Generator *m_uuid = new coil::UUID_Generator();
	coil::UUID* m_generateUUID = m_uuid->generateUUID(0, 0);
	
	std::string m_uuidstr = m_generateUUID->to_string();

	

	//p1->disconnect_all();
	//p2->disconnect_all();

	string ConnectName = m_uuidstr;
	
	

	string ConnectIDName = "_id_" + m_uuidstr;
	


/*
http://www17.atpages.jp/~aitech/wiki/?OpenRTM%2FControl%2Fconnect
のソースコード70〜78行目
*/

	RTC::ConnectorProfile prof;
	prof.connector_id = ConnectIDName.c_str();
	prof.name = CORBA::string_dup(ConnectName.c_str());
	prof.ports.length(2);
	prof.ports[0] = p1;
	prof.ports[1] = p2;


    CORBA_SeqUtil::push_back(prof.properties,NVUtil::newNV("dataport.interface_type", "corba_cdr"));
    CORBA_SeqUtil::push_back(prof.properties,NVUtil::newNV("dataport.dataflow_type","push"));
    if(subs_type=="flush")
        CORBA_SeqUtil::push_back(prof.properties,NVUtil::newNV("dataport.subscription_type","flush"));
    else if(subs_type=="new")
        CORBA_SeqUtil::push_back(prof.properties,NVUtil::newNV("dataport.subscription_type","new"));
    else if(subs_type=="periodic"){
        CORBA_SeqUtil::push_back(prof.properties,NVUtil::newNV("dataport.subscription_type","periodic"));
        CORBA_SeqUtil::push_back(prof.properties,NVUtil::newNV("dataport.push_rate",period.c_str()));
    }

/*ここまで*/

    RTC::ReturnCode_t ret;



    ret = p1->connect(prof);


	delete m_uuid;
	delete m_generateUUID;
}
Пример #2
0
void portConnect(PortService_ptr p1, PortService_var p2)
{
	string subs_type = "flush";
	string period = "";

	p1->disconnect_all();
	p2->disconnect_all();

	string ConnectName = "_";
	ConnectName += p1->get_port_profile()->name;
	ConnectName += "_";
	ConnectName += p2->get_port_profile()->name;

	string ConnectIDName = "_id_";
	ConnectIDName += p1->get_port_profile()->name;
	ConnectIDName += "_";
	ConnectIDName += p2->get_port_profile()->name;


/*
http://www17.atpages.jp/~aitech/wiki/?OpenRTM%2FControl%2Fconnect
のソースコード70〜78行目
*/

	RTC::ConnectorProfile prof;
	prof.connector_id = ConnectIDName.c_str();
	prof.name = CORBA::string_dup(ConnectName.c_str());
	prof.ports.length(2);
	prof.ports[0] = p1;
	prof.ports[1] = p2;


    CORBA_SeqUtil::push_back(prof.properties,NVUtil::newNV("dataport.interface_type", "corba_cdr"));
    CORBA_SeqUtil::push_back(prof.properties,NVUtil::newNV("dataport.dataflow_type","push"));
    if(subs_type=="flush")
        CORBA_SeqUtil::push_back(prof.properties,NVUtil::newNV("dataport.subscription_type","flush"));
    else if(subs_type=="new")
        CORBA_SeqUtil::push_back(prof.properties,NVUtil::newNV("dataport.subscription_type","new"));
    else if(subs_type=="periodic"){
        CORBA_SeqUtil::push_back(prof.properties,NVUtil::newNV("dataport.subscription_type","periodic"));
        CORBA_SeqUtil::push_back(prof.properties,NVUtil::newNV("dataport.push_rate",period.c_str()));
    }

/*ここまで*/

    RTC::ReturnCode_t ret;



    ret = p1->connect(prof);

}