Exemple #1
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() ) );
            }
        }
Exemple #2
0
void
orb_i::handle_update_data( unsigned long objId, long pos )
{
    ACE_UNUSED_ARG( pos );

    try {
        std::lock_guard< std::mutex > lock( task_->mutex_ );
        
        if ( observerMap_.find( objId ) == observerMap_.end() ) {
            SignalObserver::Observer_var tgt = observer_->findObserver( objId, true );
            if ( CORBA::is_nil( tgt.in() ) )
                return;

            CORBA::String_var name = tgt->dataInterpreterClsid();
            if ( auto spectrometer = adcontrols::MassSpectrometerBroker::make_massspectrometer( name.in() ))  {

                SignalObserver::Description_var desc = tgt->getDescription();
                observerMap_[ objId ] = std::make_tuple( tgt, desc, adportable::utf::to_wstring( name.in() ), false, spectrometer );
                npos_map_[ objId ] = pos;
            } else {
                ADTRACE() << "receive data from unavilable spectrometer: " << name.in();
                return;
            }
        }
    } catch ( ... ) {
        ADDEBUG() << boost::current_exception_diagnostic_information();
    }
    try {
        long& npos = npos_map_[ objId ];

        if ( pos < npos )
            return;

        auto it = observerMap_.find( objId );
        SignalObserver::Observer_ptr tgt = std::get<0>( it->second ).in();
        SignalObserver::Description_var& desc = std::get<1>( it->second );
        auto spectrometer = std::get<4>( it->second );
        CORBA::String_var name = tgt->dataInterpreterClsid();

        auto interpreter = adcontrols::DataInterpreterBroker::make_datainterpreter( name.in() );
        if ( !interpreter )
            return;
        const adcontrols::DataInterpreter& dataInterpreter = *interpreter; //spectrometer->getDataInterpreter();

        if ( desc->trace_method == SignalObserver::eTRACE_SPECTRA ) {

            // ADDEBUG() << "handle_updae_data( " << objId << ", " << pos << ") npos=" << npos;
            
            if ( !std::get<3>( it->second ) )
                std::get<3>( it->second ) = readCalibrations( it->second );

            try {
                SignalObserver::DataReadBuffer_var rb;
                while ( tgt->readData( npos, rb ) && npos <= pos ) {
                    ADDEBUG() << "\treadData( " << npos << " ) " << rb->pos;
                    ++npos;
                    impl_->readMassSpectra( rb, *spectrometer, dataInterpreter, objId );
                }
                emit onUpdateUIData( objId, pos );
            } catch ( CORBA::Exception& ex ) {
                ADTRACE() << "handle_update_data got an corba exception: " << ex._info().c_str();
            } catch ( ... ) {
                ADTRACE() << boost::current_exception_diagnostic_information();
            }

        } else if ( desc->trace_method == SignalObserver::eTRACE_TRACE ) {
            try {
                SignalObserver::DataReadBuffer_var rb;
                while ( tgt->readData( npos, rb ) ) {
                    npos = rb->pos + rb->ndata;
					impl_->readTrace( desc, rb, dataInterpreter, objId );
                    emit onUpdateUIData( objId, pos );
                    return;
                }
            } catch ( CORBA::Exception& ex ) {
                ADTRACE() << "handle_update_data got an corba exception: " << ex._info().c_str();
            }
        }
    } catch ( ... ) {
        ADDEBUG() << boost::current_exception_diagnostic_information();
    }
}