From 858235fd0a150e490dfe736ef0d88f380a36fb7d Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 28 Jun 2017 19:58:15 +0200 Subject: [PATCH] update pvinfo --- pvtoolsSrc/pvinfo.cpp | 41 +++++++++++++---------------------------- pvtoolsSrc/pvutils.cpp | 3 +-- 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/pvtoolsSrc/pvinfo.cpp b/pvtoolsSrc/pvinfo.cpp index 52b2f20..5fab058 100644 --- a/pvtoolsSrc/pvinfo.cpp +++ b/pvtoolsSrc/pvinfo.cpp @@ -186,52 +186,37 @@ int main (int argc, char *argv[]) for (int n = 0; n < nPvs; n++) { if(!providers[n]) continue; - TR1::shared_ptr channelRequesterImpl(new ChannelRequesterImpl()); - if (pvAddresses[n].empty()) - channels[n] = providers[n]->createChannel(pvNames[n], channelRequesterImpl); - else - channels[n] = providers[n]->createChannel(pvNames[n], channelRequesterImpl, - ChannelProvider::PRIORITY_DEFAULT, pvAddresses[n]); + channels[n] = providers[n]->createChannel(pvNames[n], DefaultChannelRequester::build(), + ChannelProvider::PRIORITY_DEFAULT, pvAddresses[n]); } // for now a simple iterating sync implementation, guarantees order for (int n = 0; n < nPvs; n++) { Channel::shared_pointer channel = channels[n]; - TR1::shared_ptr channelRequesterImpl = TR1::dynamic_pointer_cast(channel->getChannelRequester()); - if (channelRequesterImpl->waitUntilConnected(timeOut)) + TR1::shared_ptr getFieldRequesterImpl(new GetFieldRequesterImpl(channel)); + channel->getField(getFieldRequesterImpl, ""); + + if (getFieldRequesterImpl->waitUntilFieldGet(timeOut)) { - TR1::shared_ptr getFieldRequesterImpl(new GetFieldRequesterImpl(channel)); - channel->getField(getFieldRequesterImpl, ""); + Structure::const_shared_pointer structure = + TR1::dynamic_pointer_cast(getFieldRequesterImpl->getField()); - if (getFieldRequesterImpl->waitUntilFieldGet(timeOut)) + channel->printInfo(); + if (structure) { - Structure::const_shared_pointer structure = - TR1::dynamic_pointer_cast(getFieldRequesterImpl->getField()); - - channel->printInfo(); - if (structure) - { - std::cout << *structure << std::endl << std::endl; - } - else - { - std::cout << "(null introspection data)" << std::endl << std::endl; - } + std::cout << *structure << std::endl << std::endl; } else { - allOK = false; - channel->destroy(); - std::cerr << "[" << channel->getChannelName() << "] failed to get channel introspection data" << std::endl; + std::cout << "(null introspection data)" << std::endl << std::endl; } } else { allOK = false; - channel->destroy(); - std::cerr << "[" << channel->getChannelName() << "] connection timeout" << std::endl; + std::cerr << "[" << channel->getChannelName() << "] failed to get channel introspection data" << std::endl; } } diff --git a/pvtoolsSrc/pvutils.cpp b/pvtoolsSrc/pvutils.cpp index 25f5f78..c6db09b 100644 --- a/pvtoolsSrc/pvutils.cpp +++ b/pvtoolsSrc/pvutils.cpp @@ -524,8 +524,7 @@ void GetFieldRequesterImpl::getDone(const epics::pvData::Status& status, epics:: } else { - // do not complain about missing field - //std::cerr << "[" << m_channel->getChannelName() << "] failed to get channel introspection data: " << dump_stack_only_on_debug(status) << std::endl; + std::cerr << "[" << m_channel->getChannelName() << "] failed to get channel introspection data: " << dump_stack_only_on_debug(status) << std::endl; } m_event.signal();