RTC::ReturnCode_t ImageViewer::onActivated(RTC::UniqueId ec_id) { PortServiceList* portlist; portlist = this->get_ports(); connection_check = new bool [portlist->length()]; for(unsigned int i=0; i<portlist->length(); ++i) { PortService_ptr port; port = (*portlist)[i]; if(port->get_port_profile()->connector_profiles.length()!=0) connection_check[i]=true; else connection_check[i]=false; } //サービスポート接続状態のチェック if(connection_check[1]) { //連続画像取得モードに設定 if(m_capture_frame_num == 0) { std::cout << "start continuous image streaming." << std::endl; RTC_INFO(("Send command of \"start continuous\" via CameraCaptureService.")); m_CameraCaptureService->start_continuous(); } //1shotキャプチャモードに設定 else if(m_capture_frame_num == 1) { std::cout << "take one frame." << std::endl; RTC_INFO(("Send command of \"take one frame\" via CameraCaptureService.")); m_CameraCaptureService->take_one_frame(); } //指定枚数キャプチャモードに設定 else if(m_capture_frame_num > 1) { std::cout << "take multi frames (" << m_capture_frame_num << " frames)." << std::endl; RTC_INFO(("Send command of \"take multi frames\" via CameraCaptureService.")); m_CameraCaptureService->take_multi_frames(m_capture_frame_num); } else { std::cerr << "Please set capture_frame_num to more than 0" << std::endl; RTC_ERROR(("Configuration Param <frames_num> should be over 0. [%d]",m_capture_frame_num)); return RTC::RTC_ERROR; } } std::cout << "Start image view" << std::endl; std::cout << "If you want to take a 1 shot image as image file, please push s on Captured Image Window!" << std::endl; return RTC::RTC_OK; }
void MyModuleInit(RTC::Manager* manager) { RGB2GrayInit(manager); RTC::RtcBase* comp; // Create a component comp = manager->createComponent("RGB2Gray"); // Example // The following procedure is examples how handle RT-Components. // These should not be in this function. // Get the component's object reference RTC::RTObject_var rtobj; rtobj = RTC::RTObject::_narrow(manager->getPOA()->servant_to_reference(comp)); // Get the port list of the component PortServiceList* portlist; portlist = rtobj->get_ports(); // getting port profiles std::cout << "Number of Ports: "; std::cout << portlist->length() << std::endl << std::endl; for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i) { PortService_ptr port; port = (*portlist)[i]; std::cout << "Port" << i << " (name): "; std::cout << port->get_port_profile()->name << std::endl; RTC::PortInterfaceProfileList iflist; iflist = port->get_port_profile()->interfaces; std::cout << "---interfaces---" << std::endl; for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i) { std::cout << "I/F name: "; std::cout << iflist[i].instance_name << std::endl; std::cout << "I/F type: "; std::cout << iflist[i].type_name << std::endl; const char* pol; pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED"; std::cout << "Polarity: " << pol << std::endl; } std::cout << "---properties---" << std::endl; NVUtil::dump(port->get_port_profile()->properties); std::cout << "----------------" << std::endl << std::endl; } return; }