예제 #1
0
void
SampleProcessor::populate_calibration( SignalObserver::Observer * parent )
{
    SignalObserver::Observers_var vec = parent->getSiblings();

    if ( ( vec.ptr() != 0 ) && ( vec->length() > 0 ) ) {
        
        for ( CORBA::ULong i = 0; i < vec->length(); ++i ) {
            
            SignalObserver::Observer_ptr observer = vec[ i ];
            unsigned long objId = observer->objId();
            CORBA::WString_var dataClass;
            SignalObserver::octet_array_var data;
            CORBA::ULong idx = 0;
            while ( observer->readCalibration( idx++, data, dataClass ) ) {
                adfs::stmt sql( fs_->db() );
                sql.prepare( "INSERT INTO Calibration VALUES(:objid,:dataClass,:data,0)" );
                sql.bind( 1 ) = objId;
                sql.bind( 2 ) = std::wstring( dataClass.in() );
                sql.bind( 3 ) = adfs::blob( data->length(), reinterpret_cast< const int8_t *>( data->get_buffer() ) );
                if ( sql.step() == adfs::sqlite_done )
                    sql.commit();
                else
                    sql.reset();
            }
        }
        for ( CORBA::ULong i = 0; i < vec->length(); ++i )
            populate_calibration( vec[ i ] );
    }
    
}
예제 #2
0
        void populate( SignalObserver::Observer_var& observer )   {
            SignalObserver::Description_var topLevelDesc = observer->getDescription();
                
            std::string topLevelName = topLevelDesc->trace_display_name.in();
			//traceBox_->addItem( QString::fromStdString( topLevelName ) );
            //todo: set name on MainWindow's traceBox_
            
            SignalObserver::Observers_var children = observer->getSiblings();
            for ( CORBA::ULong i = 0; i < children->length(); ++i ) {
                SignalObserver::Description_var secondLevelDesc = children[i]->getDescription();
                CORBA::String_var secondLevelName = children[i]->getDescription()->trace_display_name.in();
				//traceBox_->addItem( QString( "   %1" ).arg( secondLevelName.in() ) );
            }
        }
예제 #3
0
void
orb_i::actionSnapshot()
{
    if ( CORBA::is_nil( observer_ ) )
        return;
    SignalObserver::Observers_var siblings = observer_->getSiblings();
    for ( CORBA::ULong  i = 0; i < siblings->length(); ++i ) {
        SignalObserver::Description_var desc = siblings[i]->getDescription();
        if ( desc->trace_method == SignalObserver::eTRACE_SPECTRA ) {
            CORBA::ULongLong first, second;
            siblings[i]->uptime_range( first, second );
            double m1 = double(second) / 60.0e6;
            double m0 = double(second - 1000) / 60.0e6;  // 1s before
//			pThis_->selectRange( m0, m1, 0, 0 );
        }
    }
}
예제 #4
0
void
SampleProcessor::populate_descriptions( signalobserver::Observer * parent )
{
#if 0
    SignalObserver::Observers_var vec = parent->getSiblings();

    unsigned long pobjId = parent->objId();

    if ( ( vec.ptr() != 0 ) && ( vec->length() > 0 ) ) {
        
        for ( CORBA::ULong i = 0; i < vec->length(); ++i ) {
            
            SignalObserver::Observer_ptr observer = vec[ i ];
            
            unsigned long objId = observer->objId();
            
			CORBA::WString_var clsid = observer->dataInterpreterClsid();
			SignalObserver::Description_var desc = observer->getDescription();
			CORBA::WString_var trace_id = desc->trace_id.in();
			CORBA::WString_var trace_display_name = desc->trace_display_name.in();
			CORBA::WString_var axis_x_label = desc->axis_x_label.in();
			CORBA::WString_var axis_y_label = desc->axis_y_label.in();

            adutils::AcquiredConf::insert( fs_->db()
                                           , objId
                                           , pobjId
                                           , std::wstring( clsid.in() )
                                           , uint64_t( desc->trace_method )
                                           , uint64_t( desc->spectrometer )
                                           , std::wstring( trace_id.in() )
                                           , std::wstring( trace_display_name.in() )
                                           , std::wstring( axis_x_label.in() )
                                           , std::wstring( axis_y_label.in() )
                                           , uint64_t( desc->axis_x_decimals )
                                           , uint64_t( desc->axis_y_decimals ) );
        }

        for ( CORBA::ULong i = 0; i < vec->length(); ++i )
            populate_descriptions( vec[ i ] );

    }
#endif
}
예제 #5
0
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();
    }
}