Skip to content

Commit

Permalink
Merge pull request #73 from epics-base/multichannelmultiprovider
Browse files Browse the repository at this point in the history
multiChannel now allows an array of provider names
  • Loading branch information
mrkraimer committed Mar 30, 2021
2 parents 6eb977a + 9e8cc34 commit a6f5d86
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion documentation/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This document summarizes the changes to the module between releases.

## Release 4.8.0 (EPICS 7.0.4.* March 2021
## Release 4.8.0 (EPICS 7.0.5.* March 2021)

* PvaClientNTMultiData::getChannelChangeFlags is a new method. It fixes issue #66.
* Fix for issue #68. Both PvaClientArray and PvaClientField are not longer present. Neither was previously implemented.
Expand Down
12 changes: 10 additions & 2 deletions src/pv/pvaClientMultiChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,19 @@ class epicsShareClass PvaClientMultiChannel :
* @param pvaClient The interface to pvaClient.
* @param channelNames The names of the channel..
* @param providerName The name of the provider.
* This is also used for the provider for all channels
* with providerNames.size less than channelNames.size()
* @param maxNotConnected The maximum number of channels that can be disconnected.
* @param providerNames The providerName for each Channells
* @return The interface to the PvaClientMultiChannel
*/
static PvaClientMultiChannelPtr create(
PvaClientPtr const &pvaClient,
epics::pvData::shared_vector<const std::string> const & channelNames,
std::string const & providerName = "pva",
size_t maxNotConnected=0
size_t maxNotConnected=0,
epics::pvData::shared_vector<const std::string> const & providerNames
= epics::pvData::shared_vector<const std::string>()
);
/**
* @brief Destructor
Expand Down Expand Up @@ -150,15 +155,18 @@ class epicsShareClass PvaClientMultiChannel :
PvaClientPtr const &pvaClient,
epics::pvData::shared_vector<const std::string> const & channelNames,
std::string const & providerName,
size_t maxNotConnected);
size_t maxNotConnected,
epics::pvData::shared_vector<const std::string> const & providerNames);
void checkConnected();

PvaClientPtr pvaClient;
epics::pvData::shared_vector<const std::string> channelNames;
std::string providerName;
size_t maxNotConnected;
epics::pvData::shared_vector<const std::string> const & providerNames;

size_t numChannel;
size_t numProviderNames;
epics::pvData::Mutex mutex;

size_t numConnected;
Expand Down
17 changes: 13 additions & 4 deletions src/pvaClientMultiChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,28 @@ PvaClientMultiChannelPtr PvaClientMultiChannel::create(
PvaClientPtr const &pvaClient,
shared_vector<const string> const & channelNames,
string const & providerName,
size_t maxNotConnected)
size_t maxNotConnected,
shared_vector<const string> const & providerNames)
{
return PvaClientMultiChannelPtr(
new PvaClientMultiChannel(pvaClient,channelNames,providerName,maxNotConnected));
new PvaClientMultiChannel(
pvaClient,channelNames,providerName,maxNotConnected,providerNames));
}


PvaClientMultiChannel::PvaClientMultiChannel(
PvaClientPtr const &pvaClient,
shared_vector<const string> const & channelNames,
string const & providerName,
size_t maxNotConnected)
size_t maxNotConnected,
shared_vector<const string> const & providerNames)
: pvaClient(pvaClient),
channelNames(channelNames),
providerName(providerName),
maxNotConnected(maxNotConnected),
providerNames(providerNames),
numChannel(channelNames.size()),
numProviderNames(providerNames.size()),
numConnected(0),
firstConnect(true),
pvaClientChannelArray(PvaClientChannelArray(numChannel,PvaClientChannelPtr())),
Expand Down Expand Up @@ -79,7 +84,11 @@ Status PvaClientMultiChannel::connect(double timeout)
if(!firstConnect) return Status::Ok;
firstConnect = false;
for(size_t i=0; i< numChannel; ++i) {
pvaClientChannelArray[i] = pvaClient->createChannel(channelNames[i],providerName);
if(numProviderNames<=i) {
pvaClientChannelArray[i] = pvaClient->createChannel(channelNames[i],providerName);
} else {
pvaClientChannelArray[i] = pvaClient->createChannel(channelNames[i],providerNames[i]);
}
pvaClientChannelArray[i]->issueConnect();
}
Status returnStatus = Status::Ok;
Expand Down

0 comments on commit a6f5d86

Please sign in to comment.