Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated fix for changed fields #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pvAccess/monitorFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void MonitorLocal::dataPut(PVRecordFieldPtr const & pvRecordField)
}
// If this record field is the master field, and the master field was not
// requested, we do not proceed with copy
bool isMasterField = pvRecordField->getPVRecord()->getPVStructure()->getFieldOffset()==0;
bool isMasterField = pvRecordField->getPVRecord()->getPVStructure()->getFieldOffset()==0 && pvRecordField->getFullFieldName().empty();
if (isMasterField && !pvCopy->isMasterFieldRequested()) {
return;
}
Expand Down
90 changes: 89 additions & 1 deletion test/src/testChannelMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,99 @@ static void test()
status = monitor->stop();
testOk1(status.isOK());

// Test request for the first field in the structure
request = "id";
pvRequest = CreateRequest::create()->createRequest(request);
cmRequesterImpl = TR1::shared_ptr<ChannelMonitorRequesterImpl>(new ChannelMonitorRequesterImpl(channel->getChannelName()));
monitor = channel->createMonitor(cmRequesterImpl, pvRequest);
monitorConnected = cmRequesterImpl->waitUntilConnected(1.0);
testOk1(monitorConnected);
status = monitor->start();
testOk1(status.isOK());
epicsThreadSleep(1);

// Set id, x
{
pvRecord->beginGroupPut();
PVIntPtr id = pvStructure->getSubField<PVInt>("id");
id->put(5);
PVIntPtr x = pvStructure->getSubField<PVInt>("x");
x->put(5);
pvRecord->endGroupPut();
}
epicsThreadSleep(1);

// Changed set for (id) requested, (id) changed: 0 set
changedSet = cmRequesterImpl->getLastReceivedBitSet();
testOk1(changedSet->get(0));

status = monitor->stop();
testOk1(status.isOK());

// Test request for one of the middle fields in the structure
request = "y";
pvRequest = CreateRequest::create()->createRequest(request);
cmRequesterImpl = TR1::shared_ptr<ChannelMonitorRequesterImpl>(new ChannelMonitorRequesterImpl(channel->getChannelName()));
monitor = channel->createMonitor(cmRequesterImpl, pvRequest);
monitorConnected = cmRequesterImpl->waitUntilConnected(1.0);
testOk1(monitorConnected);
status = monitor->start();
testOk1(status.isOK());
epicsThreadSleep(1);

// Set id, y
{
pvRecord->beginGroupPut();
PVIntPtr id = pvStructure->getSubField<PVInt>("id");
id->put(6);
PVIntPtr y = pvStructure->getSubField<PVInt>("y");
y->put(6);
pvRecord->endGroupPut();
}
epicsThreadSleep(1);

// Changed set for (y) requested, (y) changed: 0 set
changedSet = cmRequesterImpl->getLastReceivedBitSet();
testOk1(changedSet->get(0));

status = monitor->stop();
testOk1(status.isOK());

// Test request for more fields in the structure
request = "x,y,z";
pvRequest = CreateRequest::create()->createRequest(request);
cmRequesterImpl = TR1::shared_ptr<ChannelMonitorRequesterImpl>(new ChannelMonitorRequesterImpl(channel->getChannelName()));
monitor = channel->createMonitor(cmRequesterImpl, pvRequest);
monitorConnected = cmRequesterImpl->waitUntilConnected(1.0);
testOk1(monitorConnected);
status = monitor->start();
testOk1(status.isOK());
epicsThreadSleep(1);

// Set id, x, y
{
pvRecord->beginGroupPut();
PVIntPtr id = pvStructure->getSubField<PVInt>("id");
id->put(7);
PVIntPtr x = pvStructure->getSubField<PVInt>("x");
x->put(7);
PVIntPtr y = pvStructure->getSubField<PVInt>("y");
y->put(7);
pvRecord->endGroupPut();
}
epicsThreadSleep(1);

// Changed set for (x,y,z) requested, (x,y) changed: 1,2 set, 3 unset
changedSet = cmRequesterImpl->getLastReceivedBitSet();
testOk1(!changedSet->get(0) && changedSet->get(1) && changedSet->get(2) && !changedSet->get(3));

status = monitor->stop();
testOk1(status.isOK());
}

MAIN(testChannelMonitor)
{
testPlan(16);
testPlan(28);
test();
return 0;
}
Loading