Skip to content
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ O.*/
.cproject
external/

ci/coverage.info
ci/coverage*.info
ci/html/
.iocsh_history

# Files produced by testing suite
invalid_points.xml
Expand Down
21 changes: 21 additions & 0 deletions ADApp/Db/NDPluginBase.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,27 @@ record(stringin, "$(P)$(R)PluginType_RBV")
field(SCAN, "I/O Intr")
}

###################################################################
# This plugin's EPICS record prefix $(P)$(R), pushed into the #
# driver at init so it can be advertised in the plugin inventory. #
###################################################################
record(stringout, "$(P)$(R)PvPrefix")
{
field(PINI, "YES")
field(DTYP, "asynOctetWrite")
field(OUT, "@asyn($(PORT),$(ADDR=0),$(TIMEOUT=1))PLUGIN_PV_PREFIX")
field(VAL, "$(P)$(R)")
# Written once at init via PINI; reject external puts thereafter
field(DISP, "1")
}

record(stringin, "$(P)$(R)PvPrefix_RBV")
{
field(DTYP, "asynOctetRead")
field(INP, "@asyn($(PORT),$(ADDR=0),$(TIMEOUT=1))PLUGIN_PV_PREFIX")
field(SCAN, "I/O Intr")
}

###################################################################
# These records control the connection of the server to #
# an NDArray driver port and address #
Expand Down
16 changes: 16 additions & 0 deletions ADApp/Db/NDPluginInventory.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#=================================================================#
# Template file: NDPluginInventory.template
# Configures the IOC-wide PVA channel that advertises all plugins.
# Load once per IOC against the NDPluginInventoryConfigure() port.
#=================================================================#

# Name of the IOC-wide PVA channel that publishes the plugin inventory
record(waveform, "$(P)PluginInventoryName_RBV")
{
field(DTYP, "asynOctetRead")
field(INP, "@asyn($(PORT),$(ADDR=0),$(TIMEOUT=1))PV_NAME")
field(FTVL, "CHAR")
field(NELM, "256")
field(SCAN, "I/O Intr")
info(Q:form, "String")
}
9 changes: 9 additions & 0 deletions ADApp/pluginSrc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ USR_CPPFLAGS += -DBUILDING_NDPlugin_API
INC += NDPluginAPI.h
INC += NDPluginDriver.h
LIB_SRCS += NDPluginDriver.cpp
ifeq ($(WITH_PLUGIN_INVENTORY), YES)
INC += NDPluginInventory.h
LIB_SRCS += NDPluginInventory.cpp
NDPluginInventory_CXXFLAGS_Linux += -std=c++11
NDPluginSupport_DBD += NDPluginInventory.dbd
USR_CXXFLAGS += -DWITH_PLUGIN_INVENTORY
endif
LIB_SRCS += throttler.cpp

NDPluginSupport_DBD += NDPluginAttribute.dbd
Expand Down Expand Up @@ -188,13 +195,15 @@ ifeq ($(WITH_PVA), YES)
DBD += NDPluginPva.dbd
INC += NDPluginPva.h
LIB_SRCS += NDPluginPva.cpp
USR_CXXFLAGS += -DWITH_PVA
endif

ifeq ($(WITH_PVXS), YES)
DBD += NDPluginPvxs.dbd
INC += NDPluginPvxs.h
LIB_SRCS += NDPluginPvxs.cpp
NDPluginPvxs_CXXFLAGS_Linux += -std=c++11
USR_CXXFLAGS += -DWITH_PVXS
endif

ifeq ($(WITH_BLOSC), YES)
Expand Down
9 changes: 5 additions & 4 deletions ADApp/pluginSrc/NDFileHDF5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2384,12 +2384,13 @@ NDFileHDF5::NDFileHDF5(const char *portName, int queueSize, int blockingCallback
}

/* Set the plugin type string */
setStringParam(NDPluginDriverPluginType, "NDFileHDF5");
/* Report the HDF5 library version through the SDK version parameter */
unsigned majnum=0, minnum=0, relnum=0;
H5get_libversion( &majnum, &minnum, &relnum );
char* plugin_type = (char*)calloc(40, sizeof(char));
epicsSnprintf(plugin_type, 40, "NDFileHDF5 ver%d.%d.%d", majnum, minnum, relnum);
//printf("plugin type and version: %s\n", plugin_type );
setStringParam(NDPluginDriverPluginType, plugin_type);
char sdk_version[40] = {0};
epicsSnprintf(sdk_version, sizeof(sdk_version), "%d.%d.%d", majnum, minnum, relnum);
setStringParam(ADSDKVersion, sdk_version);
this->supportsMultipleArrays = 1;
this->pAttributeId = NULL;
this->pFileAttributes = new NDAttributeList;
Expand Down
29 changes: 29 additions & 0 deletions ADApp/pluginSrc/NDPluginDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#include <cantProceed.h>

#include "NDPluginDriver.h"
#ifdef WITH_PLUGIN_INVENTORY
#include "NDPluginInventory.h"
#endif
#include "throttler.h"

#include <epicsExport.h>
Expand Down Expand Up @@ -142,6 +145,12 @@ NDPluginDriver::NDPluginDriver(const char *portName, int queueSize, int blocking
createParam(NDPluginDriverExecutionTimeString, asynParamFloat64, &NDPluginDriverExecutionTime);
createParam(NDPluginDriverMinCallbackTimeString, asynParamFloat64, &NDPluginDriverMinCallbackTime);
createParam(NDPluginDriverMaxByteRateString, asynParamFloat64, &NDPluginDriverMaxByteRate);
createParam(NDPluginDriverPvPrefixString, asynParamOctet, &NDPluginDriverPvPrefix);

#ifdef WITH_PLUGIN_INVENTORY
// If enabled, register this plugin in the process-wide inventory published over PVAccess.
NDPluginInventory::registerPlugin(portName);
#endif

/* Here we set the values of read-only parameters and of read/write parameters that cannot
* or should not get their values from the database. Note that values set here will override
Expand Down Expand Up @@ -195,6 +204,11 @@ NDPluginDriver::~NDPluginDriver()
if (pToThreadMsgQ_)
shutdownPortDriver();

#ifdef WITH_PLUGIN_INVENTORY
// Remove the plugin from the inventory on destruction.
NDPluginInventory::unregisterPlugin(portName);
#endif

delete throttler_;
}

Expand Down Expand Up @@ -835,6 +849,11 @@ asynStatus NDPluginDriver::writeOctet(asynUser *pasynUser, const char *value,
this->unlock();
connectToArrayPort();
this->lock();
} else if (function == NDPluginDriverPvPrefix) {
#ifdef WITH_PLUGIN_INVENTORY
// If we are using the plugin inventory then set the PV prefix in it as well
NDPluginInventory::setPvPrefix(portName, value);
#endif
} else {
/* If this parameter belongs to a base class call its method */
if (function < FIRST_NDPLUGIN_PARAM)
Expand Down Expand Up @@ -902,6 +921,16 @@ asynStatus NDPluginDriver::start(void)
assert(!this->pluginStarted_);
//static const char *functionName = "start";

#ifdef WITH_PLUGIN_INVENTORY
// The derived class is now fully constructed, so its plugin type is set.
// Register the plugin type with the plugin inventory.
char pluginType[256] = {0};
this->lock();
getStringParam(NDPluginDriverPluginType, sizeof(pluginType), pluginType);
this->unlock();
NDPluginInventory::setPluginType(portName, pluginType);
#endif

this->pluginStarted_ = true;
// If the plugin was started with BlockingCallbacks=Yes then pThreads_.size() will be 0
if (pThreads_.size() == 0) return asynSuccess;
Expand Down
2 changes: 2 additions & 0 deletions ADApp/pluginSrc/NDPluginDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class sortedListElement {
#define NDPluginDriverMinCallbackTimeString "MIN_CALLBACK_TIME" /**< (asynFloat64, r/w) Minimum time between calling processCallbacks
*to execute plugin code */
#define NDPluginDriverMaxByteRateString "MAX_BYTE_RATE" /**< (asynFloat64, r/w) Limit on byte rate output of plugin */
#define NDPluginDriverPvPrefixString "PLUGIN_PV_PREFIX" /**< (asynOctet, r/w) This plugin's EPICS record prefix $(P)$(R) */
/** Class from which actual plugin drivers are derived; derived from asynNDArrayDriver */
class NDPLUGIN_API NDPluginDriver : public asynNDArrayDriver, public epicsThreadRunable {
public:
Expand Down Expand Up @@ -107,6 +108,7 @@ class NDPLUGIN_API NDPluginDriver : public asynNDArrayDriver, public epicsThread
int NDPluginDriverExecutionTime;
int NDPluginDriverMinCallbackTime;
int NDPluginDriverMaxByteRate;
int NDPluginDriverPvPrefix;

NDArray *pPrevInputArray_;
bool throttled(NDArray *pArray);
Expand Down
Loading
Loading