Skip to content

Commit

Permalink
Upgrade to ADCore R3-0
Browse files Browse the repository at this point in the history
Fix the plugin constructor arguments to the super constructor by
removing numParams and adding maxThreads.  (These ADCore changes were
introduced in R3-0 in commit 3af87bd.)

Fix the super call in processCallbacks to call NDPluginDriver's
beginProcessCallbacks method since processCallbacks in NDPluginDriver
was renamed to beginProcessCallbacks.  (This ADCore change was
introduced in R3-0 in commit 3af87bd.)

Call start() in adPythonPluginConfigure, and rename the start variable
in processCallbacks to startTime to avoid shadowing the start method.
(The start method was added in ADCore in R2-5 in commit b1a2f13.)
  • Loading branch information
jlmuir committed Sep 14, 2018
1 parent a030175 commit 1523c32
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions adPythonApp/src/adPythonPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ adPythonPlugin::adPythonPlugin(const char *portNameArg, const char *filename,
const char *NDArrayPort, int NDArrayAddr, int maxBuffers,
size_t maxMemory, int priority, int stackSize)
: NDPluginDriver(portNameArg, queueSize, blockingCallbacks,
NDArrayPort, NDArrayAddr, 1, NUM_ADPYTHONPLUGIN_PARAMS,
NDArrayPort, NDArrayAddr, 1,
maxBuffers, maxMemory,
asynGenericPointerMask|asynFloat64ArrayMask,
asynGenericPointerMask|asynFloat64ArrayMask,
ASYN_MULTIDEVICE, 1, priority, stackSize)
ASYN_MULTIDEVICE, 1, priority, stackSize, 1)
{
// Initialise some params
this->pInstance = NULL;
Expand Down Expand Up @@ -131,7 +131,7 @@ void adPythonPlugin::initThreads()
*/
void adPythonPlugin::processCallbacks(NDArray *pArray) {
// First call the base class method
NDPluginDriver::processCallbacks(pArray);
NDPluginDriver::beginProcessCallbacks(pArray);

// Make sure we are in a good state, otherwise do nothing
if (this->pluginState != GOOD) return;
Expand All @@ -148,8 +148,8 @@ void adPythonPlugin::processCallbacks(NDArray *pArray) {
this->lock();

// Store the time at the beginning of processing for profiling
epicsTimeStamp start, end;
epicsTimeGetCurrent(&start);
epicsTimeStamp startTime, endTime;
epicsTimeGetCurrent(&startTime);

// Update the attribute dict
this->updateAttrDict(pArray);
Expand Down Expand Up @@ -177,8 +177,8 @@ void adPythonPlugin::processCallbacks(NDArray *pArray) {
this->updateAttrList(pArray);

// timestamp
epicsTimeGetCurrent(&end);
setDoubleParam(adPythonTime, epicsTimeDiffInSeconds(&end, &start)*1000);
epicsTimeGetCurrent(&endTime);
setDoubleParam(adPythonTime, epicsTimeDiffInSeconds(&endTime, &startTime)*1000);
callParamCallbacks();

// release GIL and dict Mutex
Expand Down Expand Up @@ -848,6 +848,7 @@ static int adPythonPluginConfigure(const char *portNameArg, const char *filename
NDArrayPort, NDArrayAddr, maxBuffers, maxMemory,
priority, stackSize);
adp->initThreads();
adp->start();
return(asynSuccess);
}

Expand Down

0 comments on commit 1523c32

Please sign in to comment.