Example #1
0
    virtual void getDone(const epics::pvData::Status& status,
                         ChannelGet::shared_pointer const & /*channelGet*/,
                         epics::pvData::PVStructure::shared_pointer const & pvStructure,
                         epics::pvData::BitSet::shared_pointer const & bitSet)
    {
        if (status.isSuccess())
        {
            // show warning
            if (!status.isOK())
            {
                std::cerr << "[" << m_channelName << "] channel get: " << status << std::endl;
            }

            // access smart pointers
            {
                Lock lock(m_pointerMutex);

                m_pvStructure = pvStructure;
                m_bitSet = bitSet;

                m_done = true;

            }
        }
        else
        {
            std::cerr << "[" << m_channelName << "] failed to get: " << status << std::endl;
        }

        m_event.signal();
    }
Example #2
0
void ChannelPutRequesterImpl::channelPutConnect(const epics::pvData::Status& status,
                                                        ChannelPut::shared_pointer const & channelPut,
                                                        epics::pvData::PVStructure::shared_pointer const & pvStructure,
                                                        epics::pvData::BitSet::shared_pointer const & bitSet)
{
    if (status.isSuccess()) {
        // show warning
        if (!status.isOK()) {
            std::cerr << "[" << m_channelName << "] channel put create: " << status.toString() << std::endl;
        }

        // assign smart pointers
        {
            Lock lock(m_pointerMutex);
            m_channelPut = channelPut;
            m_pvStructure = pvStructure;
            m_bitSet = bitSet;
        }

        // we always put all
        m_bitSet->set(0);

        // get immediately old value
        channelPut->get();
    } else {
        std::cerr << "[" << m_channelName << "] failed to create channel put: " << status.toString() << std::endl;
    }
}
    virtual void getDone(const epics::pvData::Status& status,
                         ChannelGet::shared_pointer const & /*channelGet*/,
                         epics::pvData::PVStructure::shared_pointer const & /*pvStructure*/,
                         epics::pvData::BitSet::shared_pointer const & /*bitSet*/)
    {
        if (status.isSuccess())
        {
            // show warning
            if (!status.isOK())
            {
                std::cout << "[" << m_channelName << "] channel get: " << status << std::endl;
            }

            channelCount++;
            if (channelCount == channels)
            {
                iterationCount++;
                channelCount = 0;
            }

            if (iterationCount == iterations)
            {
                epicsTimeStamp endTime;
                epicsTimeGetCurrent(&endTime);

                double duration = epicsTime(endTime) - epicsTime(startTime);
                double getPerSec = iterations*channels/duration;
                double gbit = getPerSec*arraySize*sizeof(double)*8/(1000*1000*1000); // * bits / giga; NO, it's really 1000 and not 1024
                if (verbose)
                    printf("%5.6f seconds, %.3f (x %d = %.3f) gets/s, data throughput %5.3f Gbits/s\n",
                           duration, iterations/duration, channels, getPerSec, gbit);
                sum += getPerSec;

                iterationCount = 0;
                epicsTimeGetCurrent(&startTime);

                runCount++;
                if (runs == 0 || runCount < runs)
                    get_all();
                else
                {
                    printf("%d %d %d %d %.3f\n", channels, arraySize, iterations, runs, sum/runs);
        
                    Lock guard(waitLoopPtrMutex);
                    waitLoopEvent->signal();	// all done
                }
            }
            else if (channelCount == 0)
            {
                get_all();
            }
        }
        else
        {
            std::cout << "[" << m_channelName << "] failed to get: " << status << std::endl;
        }
    }
Example #4
0
void ChannelRequesterImpl::channelCreated(const epics::pvData::Status& status, Channel::shared_pointer const & channel)
{
    qDebug() << "ChannelRequesterImpl channelCreated";
    if (status.isSuccess()) {
        // show warning
        if (!status.isOK()) {
             std::cout << "[" << channel->getChannelName() << "] channel create: " << status.toString()  << std::endl;
        }
    } else {
         std::cout << "[" << channel->getChannelName() << "] failed to create a channel: " << status.toString()  << std::endl;
    }
}
Example #5
0
void ChannelPutRequesterImpl::putDone(const epics::pvData::Status& status)
{
    if (status.isSuccess()) {
        // show warning
        if (!status.isOK()) {
            std::cerr << "[" << m_channelName << "] channel put: " << status.toString() << std::endl;
        }
        m_event->signal();
    } else {
        std::cerr << "[" << m_channelName << "] failed to get: " << status.toString() << std::endl;
    }
}
 virtual void channelCreated(const epics::pvData::Status& status,
                             Channel::shared_pointer const & channel)
 {
     if (status.isSuccess())
     {
         // show warning
         if (!status.isOK())
         {
             std::cout << "[" << channel->getChannelName() << "] channel create: " << status << std::endl;
         }
     }
     else
     {
         std::cout << "[" << channel->getChannelName() << "] failed to create a channel: " << status << std::endl;
     }
 }
Example #7
0
void GetFieldRequesterImpl::getDone(const epics::pvData::Status& status, epics::pvData::FieldConstPtr const & field)
{
    qDebug() << "GetFieldRequesterImpl getDone";
    if (status.isSuccess()) {
        // show warning
        if (!status.isOK()) {
            std::cerr << "[" << m_channel->getChannelName() << "] getField create: " << status.toString() << std::endl;
        }
        // assign smart pointers
        {
            Lock lock(m_pointerMutex);
            m_field = field;
        }
    } else {
        // do not complain about missing field
        //std::cerr << "[" << m_channel->getChannelName() << "] failed to get channel introspection data: " << status.toString() << std::endl;
    }
    m_event.signal();
}
    virtual void monitorConnect(const epics::pvData::Status& status,
                                Monitor::shared_pointer const & /*monitor*/,
                                epics::pvData::Structure::const_shared_pointer const & /*structure*/)
    {
        if (status.isSuccess())
        {
            // show warning
            if (!status.isOK())
            {
                std::cout << "[" << m_channelName << "] channel monitor create: " << status << std::endl;
            }

            m_connectionEvent.signal();
        }
        else
        {
            std::cout << "[" << m_channelName << "] failed to create channel monitor: " << status << std::endl;
        }
    }
Example #9
0
void ChannelPutRequesterImpl::getDone(const epics::pvData::Status& status)
{
     qDebug() << "ChannelPutRequesterImpl getDone";
    if (status.isSuccess()) {
        // show warning
        if (!status.isOK()) {
            std::cerr << "[" << m_channelName << "] channel get: " << status.toString() << std::endl;
        }

        // access smart pointers
        Lock lock(m_pointerMutex);
        {
            PVField::shared_pointer value = m_pvStructure->getSubField("value");
        }
        m_event->signal();
    } else {
        std::cerr << "[" << m_channelName << "] failed to get: " << status.toString() << std::endl;
    }

}
Example #10
0
    virtual void channelGetConnect(const epics::pvData::Status& status, ChannelGet::shared_pointer const & channelGet,
                                   epics::pvData::Structure::const_shared_pointer const & /*structure*/)
    {
        if (status.isSuccess())
        {
            // show warning
            if (!status.isOK())
            {
                std::cerr << "[" << m_channelName << "] channel get create: " << status << std::endl;
            }

            channelGet->lastRequest();
            channelGet->get();
        }
        else
        {
            std::cerr << "[" << m_channelName << "] failed to create channel get: " << status << std::endl;
            m_event.signal();
        }
    }