// setConfiguration call from iBroker when configComplete is called. // which is called when qtplatz fire 'extentionInstalled()' bool iProxy::initialConfiguration( const adportable::Configuration& c ) { config_ = c; std::string nsname = config_.attribute( "ns_name" ); name_ = adportable::string::convert( config_.name() ); if ( config_.attribute( "type" ) == "object_reference" ) { // CORBA Object if ( ! nsname.empty() ) { Broker::Manager_var bmgr = adcontroller::manager_i::instance()->impl().getBrokerManager(); if ( CORBA::is_nil( bmgr ) ) throw std::runtime_error( "iProxy::init_object_ref -- can't get Broker::Manager reference" ); try { CORBA::Object_var obj = bmgr->find_object( nsname.c_str() ); if ( ! CORBA::is_nil( obj.in() ) ) { impl_ = Instrument::Session::_narrow( obj ); if ( ! CORBA::is_nil( impl_ ) ) { if ( impl_->echo( "hello" ) ) objref_ = true; } } } catch ( CORBA::Exception& ex ) { adportable::debug(__FILE__, __LINE__) << "adcontroller::iproxy::setConfiguration '" << nsname << "' " << ex._info().c_str(); } } } else { adportable::debug(__FILE__, __LINE__) << "iProxy::setConfiguration -- object '" << nsname << "' not registerd"; } return objref_; }
void orb_i::actionConnect() { if ( CORBA::is_nil( session_.in() ) ) { Broker::Manager_var broker = OrbConnection::instance()->brokerManager(); if ( ! CORBA::is_nil( broker ) ) { using namespace acewrapper::constants; CORBA::Object_var obj = broker->find_object( adcontroller::manager::_name() ); ::ControlServer::Manager_var manager = ::ControlServer::Manager::_narrow( obj ); if ( !CORBA::is_nil( manager ) ) { session_ = manager->getSession( "acquire" ); if ( !CORBA::is_nil( session_.in() ) ) { receiver_i_.reset( new receiver_i ); receiver_i_->assign_message( [this] ( ::Receiver::eINSTEVENT code, uint32_t value ){ emit onReceiverMessage( static_cast<unsigned long>(code), value ); }); receiver_i_->assign_log( [this] ( const ::EventLog::LogMessage& log ){ handle_receiver_log( log ); } ); receiver_i_->assign_shutdown( [this](){ handle_receiver_shutdown(); } ); receiver_i_->assign_debug_print( [this]( int32_t pri, int32_t cat, std::string text ){ handle_receiver_debug_print( pri, cat, text ); } ); connect( this, &orb_i::onReceiverMessage, this, &orb_i::handle_controller_message ); if ( session_->connect( receiver_i_->_this(), "acquire" ) ) { MainWindow::instance()->handleInstState( adicontroller::Instrument::eStandBy ); } if ( session_->status() <= ControlServer::eConfigured ) session_->initialize(); // Master signal observer observer_ = session_->getObserver(); if ( !CORBA::is_nil( observer_.in() ) ) { if ( !sink_ ) { sink_.reset( new adinterface::ObserverEvents_i ); sink_->assignConfigChanged( [=] ( uint32_t oid, SignalObserver::eConfigStatus st ){ handle_observer_config_changed( oid, st ); } ); sink_->assignUpdateData( [=] ( uint32_t oid, int32_t pos ){ handle_observer_update_data( oid, pos ); } ); sink_->assignMethodChanged( [=] ( uint32_t oid, int32_t pos ){ handle_observer_method_changed( oid, pos ); } ); sink_->assignEvent( [=] ( uint32_t oid, int32_t pos, int32_t ev ){ handle_observer_event( oid, pos, ev ); } ); observer_->connect( sink_->_this(), SignalObserver::Frequent, "acquireplugin" ); } // connect to 1st layer siblings ( := top shadow(cache) observer for each instrument ) SignalObserver::Observers_var siblings = observer_->getSiblings(); size_t nsize = siblings->length(); for ( CORBA::ULong i = 0; i < nsize; ++i ) { SignalObserver::Observer_var var = SignalObserver::Observer::_duplicate( siblings[ i ] ); impl_->populate( var ); } } } document::instance()->actionInitRun(); } } } if ( ! CORBA::is_nil( session_ ) ) { MainWindow::instance()->handleInstState( adicontroller::Instrument::eStandBy ); document::instance()->fsmStop(); } }