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 channelCreated(const epics::pvData::Status& status, Channel::shared_pointer const & channel)
 {
     if (!status.isSuccess())
     {
         std::cout << "channelCreated(" << status << ", "
                   << (channel ? channel->getChannelName() : "(0)") << ")" << std::endl;
     }
 }
 virtual void monitorConnect(const epics::pvData::Status& status,
 		Monitor::shared_pointer const & /*monitor*/, StructureConstPtr const & structure)
 {
     std::cout << "monitorConnect(" << status << ")" << std::endl;
     if (status.isSuccess() && structure)
     {
         std::cout << *structure << std::endl;
     }
 }
 virtual void getArrayDone(const epics::pvData::Status& status, ChannelArray::shared_pointer const &,
     PVArray::shared_pointer const & pvArray)
 {
     std::cout << "getArrayDone(" << status << ")" << std::endl;
     if (status.isSuccess())
     {
         std::cout << *pvArray << std::endl;
     }
 }
 virtual void channelGetConnect(const epics::pvData::Status& status,ChannelGet::shared_pointer const & /*channelGet*/,
                                epics::pvData::Structure::const_shared_pointer const & pvStructure)
 {
     std::cout << "channelGetConnect(" << status << ")" << std::endl;
     if (status.isSuccess())
     {
         std::cout << *pvStructure << std::endl;
     }
 }
 virtual void putGetDone(const epics::pvData::Status& status, ChannelPutGet::shared_pointer const &,
     PVStructure::shared_pointer const & putData, BitSet::shared_pointer const & /*bitSet*/)
 {
     std::cout << "putGetDone(" << status << ")" << std::endl;
     if (status.isSuccess())
     {
         std::cout << *putData << std::endl;
     }
 }
 virtual void requestDone(const epics::pvData::Status& status, ChannelRPC::shared_pointer const &,
     epics::pvData::PVStructure::shared_pointer const & pvResponse)
 {
     std::cout << "requestDone(" << status << ")" << std::endl;
     if (status.isSuccess())
     {
         std::cout << *pvResponse << 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;
        }
    }
 virtual void channelArrayConnect(const epics::pvData::Status& status,ChannelArray::shared_pointer const & /*channelArray*/,
                                  epics::pvData::Array::const_shared_pointer const & array)
 {
     std::cout << "channelArrayConnect(" << status << ")" << std::endl;
     if (status.isSuccess())
     {
         std::cout << array << std::endl;
     }
     
 }
Example #11
0
    virtual void channelCreated(const epics::pvData::Status& status,
                                pva::Channel::shared_pointer const & channel)
    {
        if (status.isSuccess())
        {

        }
        else
            std::cout << "failed to create channel: " << status << std::endl;
    }
 virtual void getDone(const epics::pvData::Status& status, epics::pvData::FieldConstPtr const & field)
 {
     std::cout << "getDone(" << status << ", ";
     if (status.isSuccess() && field)
     {
         std::cout << *field;
     }
     else
         std::cout << "(0)";
     std::cout << ")" << std::endl;
 }
Example #13
0
void TestChannelMonitorRequester::monitorConnect(pvd::Status const & status,
                                                 pvd::MonitorPtr const & monitor,
                                                 pvd::StructureConstPtr const & structure)
{
    testDiag("monitorConnect %p %d", monitor.get(), (int)status.isSuccess());
    Guard G(lock);
    connectStatus = status;
    dtype = structure;
    connected = true;
    wait.trigger();
}
Example #14
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 #15
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;
    }
}
Example #16
0
 virtual void channelGetConnect(
     const epics::pvData::Status& status,
     pva::ChannelGet::shared_pointer const & channelGet,
     epics::pvData::Structure::const_shared_pointer const & structure)
 {
     if (status.isSuccess())
     {
         std::cout << "issuing channel get" << std::endl;
         channelGet->get();
     }
     else
         std::cout << "failed to create channel get: " << status << std::endl;
 }
Example #17
0
void  MonitorRequesterImpl::monitorConnect(const epics::pvData::Status& status, Monitor::shared_pointer const & monitor, StructureConstPtr const & /*structure*/)
{
    qDebug() << "monitorConnect";
    if (status.isSuccess()) {
        Status startStatus = monitor->start();
        // show error
        if (!startStatus.isSuccess()) {
            std::cerr << "[" << m_channelName << "] channel monitor start: " << startStatus.toString() << std::endl;
        }

    } else {
        std::cerr << "monitorConnect(" << status.toString() << ")" << std::endl;
    }
}
Example #18
0
    virtual void getDone(
        const epics::pvData::Status& status,
        pva::ChannelGet::shared_pointer const & channelGet,
        epics::pvData::PVStructure::shared_pointer const & pvStructure,
        epics::pvData::BitSet::shared_pointer const & bitSet)
    {
        if (status.isSuccess())
        {
            std::cout << *pvStructure << std::endl;
        }
        else
            std::cout << "failed to get: " << status << 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 #20
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 #22
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();
        }
    }
Example #23
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 #24
0
    virtual void monitorConnect(const epics::pvData::Status& status, Monitor::shared_pointer const & monitor, StructureConstPtr const & /*structure*/)
    {
        if (status.isSuccess())
        {
            /*
            string str;
            structure->toString(&str);
            std::cout << str << std::endl;
            */

            Status startStatus = monitor->start();
            // show error
            // TODO and exit
            if (!startStatus.isSuccess())
            {
                std::cerr << "[" << m_channelName << "] channel monitor start: " << startStatus << std::endl;
            }

        }
        else
        {
            std::cerr << "monitorConnect(" << status << ")" << std::endl;
        }
    }