ADApp/pvaDriverSrc/pvaDriver.cpp
pvaDriver::pvaDriver (const char *portName, const char *pvName,
        int maxBuffers, size_t maxMemory, int priority, int stackSize)

    : ADDriver(portName, 1, NUM_PVA_DRIVER_PARAMS, maxBuffers, maxMemory, 0, 0, ASYN_CANBLOCK, 1,
            priority, stackSize),
      m_pvName(pvName), m_request(DEFAULT_REQUEST),
      m_priority(ChannelProvider::PRIORITY_DEFAULT),
      m_channel(),
      m_thisPtr(tr1::shared_ptr<pvaDriver>(this))
{
    int status = asynSuccess;
    const char *functionName = "pvaDriver";

    lock();
    createParam(PVAOverrunCounterString,     asynParamInt32, &PVAOverrunCounter);
    createParam(PVAPvNameString,             asynParamOctet, &PVAPvName);
    createParam(PVAPvConnectionStatusString, asynParamInt32, &PVAPvConnectionStatus);

    /* Set some default values for parameters */
    status =  setStringParam (ADManufacturer, "PVAccess driver");
    status |= setStringParam (ADModel, "Basic PVAccess driver");
    status |= setIntegerParam(ADMaxSizeX, 0);
    status |= setIntegerParam(ADMaxSizeY, 0);
    status |= setIntegerParam(ADMinX, 0);
    status |= setIntegerParam(ADMinY, 0);
    status |= setIntegerParam(ADBinX, 1);
    status |= setIntegerParam(ADBinY, 1);
    status |= setIntegerParam(ADReverseX, 0);
    status |= setIntegerParam(ADReverseY, 0);
    status |= setIntegerParam(ADSizeX, 0);
    status |= setIntegerParam(ADSizeY, 0);
    status |= setIntegerParam(NDArraySizeX, 0);
    status |= setIntegerParam(NDArraySizeY, 0);
    status |= setIntegerParam(NDArraySize, 0);
    status |= setIntegerParam(NDDataType, 0);
    status |= setIntegerParam(PVAOverrunCounter, 0);
    status |= setStringParam (PVAPvName, pvName);
    status |= setIntegerParam(PVAPvConnectionStatus, 0);

    if(status)
        asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
                "%s::%s unable to set driver parameters\n",
                driverName, functionName);

    try
    {
        ClientFactory::start();
        m_provider = getChannelProviderRegistry()->getProvider("pva");
        m_pvRequest = CreateRequest::create()->createRequest(m_request);
        connectPv();
    }
    catch (exception &ex)
    {
        asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
                "%s::%s exception initializing monitor: %s\n",
                driverName, functionName, ex.what());
    }
    unlock();
}
/* Constructor for pvaDriver; most parameters are simply passed to
 * ADDriver::ADDriver. Sets reasonable default values for parameters defined in
 * asynNDArrayDriver and ADDriver.
 *
 * The method init must be called after creating an instance.
 *
 * \param[in] portName The name of the asyn port driver to be created.
 * \param[in] pvName The v4 NTNDArray PV to be monitored
 * \param[in] maxBuffers The maximum number of NDArray buffers that the
 *            NDArrayPool for this driver is allowed to allocate. Set this to -1
 *            to allow an unlimited number of buffers.
 * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for
 *            this driver is allowed to allocate. Set this to -1 to allow an
 *            unlimited amount of memory.
 * \param[in] priority The thread priority for the asyn port driver thread if
 *            ASYN_CANBLOCK is set in asynFlags.
 * \param[in] stackSize The stack size for the asyn port driver thread if
 *            ASYN_CANBLOCK is set in asynFlags.
 */
Constructor for pvaDriver; most parameters are simply passed to
ADDriver::ADDriver. Sets reasonable default values for parameters defined in
asynNDArrayDriver and ADDriver.

The method init must be called after creating an instance.

\param[in] portName The name of the asyn port driver to be created.
\param[in] pvName The v4 NTNDArray PV to be monitored
\param[in] maxBuffers The maximum number of NDArray buffers that the
NDArrayPool for this driver is allowed to allocate. Set this to -1
to allow an unlimited number of buffers.
\param[in] maxMemory The maximum amount of memory that the NDArrayPool for
this driver is allowed to allocate. Set this to -1 to allow an
unlimited amount of memory.
\param[in] priority The thread priority for the asyn port driver thread if
ASYN_CANBLOCK is set in asynFlags.
\param[in] stackSize The stack size for the asyn port driver thread if
ASYN_CANBLOCK is set in asynFlags.
Constructor for pvaDriver ; most parameters are simply passed to ADDriver :: ADDriver . Sets reasonable default values for parameters defined in asynNDArrayDriver and ADDriver . The method init must be called after creating an instance . \ param [ in ] portName The name of the asyn port driver to be created . \ param [ in ] pvName The v4 NTNDArray PV to be monitored \ param [ in ] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is allowed to allocate . Set this to - 1 to allow an unlimited number of buffers . \ param [ in ] maxMemory The maximum amount of memory that the NDArrayPool for this driver is allowed to allocate . Set this to - 1 to allow an unlimited amount of memory . \ param [ in ] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags . \ param [ in ] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags .
pvaDriver::pvaDriver (const char *portName, const char *pvName,
        int maxBuffers, size_t maxMemory, int priority, int stackSize)
    : ADDriver(portName, 1, NUM_PVA_DRIVER_PARAMS, maxBuffers, maxMemory, 0, 0, ASYN_CANBLOCK, 1,
            priority, stackSize),
      m_pvName(pvName), m_request(DEFAULT_REQUEST),
      m_priority(ChannelProvider::PRIORITY_DEFAULT),
      m_channel(),
      m_thisPtr(tr1::shared_ptr<pvaDriver>(this))
{
    int status = asynSuccess;
    const char *functionName = "pvaDriver";
    lock();
    createParam(PVAOverrunCounterString,     asynParamInt32, &PVAOverrunCounter);
    createParam(PVAPvNameString,             asynParamOctet, &PVAPvName);
    createParam(PVAPvConnectionStatusString, asynParamInt32, &PVAPvConnectionStatus);
    status =  setStringParam (ADManufacturer, "PVAccess driver");
    status |= setStringParam (ADModel, "Basic PVAccess driver");
    status |= setIntegerParam(ADMaxSizeX, 0);
    status |= setIntegerParam(ADMaxSizeY, 0);
    status |= setIntegerParam(ADMinX, 0);
    status |= setIntegerParam(ADMinY, 0);
    status |= setIntegerParam(ADBinX, 1);
    status |= setIntegerParam(ADBinY, 1);
    status |= setIntegerParam(ADReverseX, 0);
    status |= setIntegerParam(ADReverseY, 0);
    status |= setIntegerParam(ADSizeX, 0);
    status |= setIntegerParam(ADSizeY, 0);
    status |= setIntegerParam(NDArraySizeX, 0);
    status |= setIntegerParam(NDArraySizeY, 0);
    status |= setIntegerParam(NDArraySize, 0);
    status |= setIntegerParam(NDDataType, 0);
    status |= setIntegerParam(PVAOverrunCounter, 0);
    status |= setStringParam (PVAPvName, pvName);
    status |= setIntegerParam(PVAPvConnectionStatus, 0);
    if(status)
        asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
                "%s::%s unable to set driver parameters\n",
                driverName, functionName);
    try
    {
        ClientFactory::start();
        m_provider = getChannelProviderRegistry()->getProvider("pva");
        m_pvRequest = CreateRequest::create()->createRequest(m_request);
        connectPv();
    }
    catch (exception &ex)
    {
        asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
                "%s::%s exception initializing monitor: %s\n",
                driverName, functionName, ex.what());
    }
    unlock();
}
pvaDriver :: pvaDriver ( const char * portName , const char * pvName , int maxBuffers , size_t maxMemory , int priority , int stackSize ) : ADDriver ( portName , 1 , NUM_PVA_DRIVER_PARAMS , maxBuffers , maxMemory , 0 , 0 , ASYN_CANBLOCK , 1 , priority , stackSize ) , m_pvName ( pvName ) , m_request ( DEFAULT_REQUEST ) , m_priority ( ChannelProvider :: PRIORITY_DEFAULT ) , m_channel ( ) , m_thisPtr ( tr1 :: shared_ptr < pvaDriver > ( this ) ) { int status = asynSuccess ; const char * functionName = " " ; lock ( ) ; createParam ( PVAOverrunCounterString , asynParamInt32 , & PVAOverrunCounter ) ; createParam ( PVAPvNameString , asynParamOctet , & PVAPvName ) ; createParam ( PVAPvConnectionStatusString , asynParamInt32 , & PVAPvConnectionStatus ) ; status = setStringParam ( ADManufacturer , " " ) ; status |= setStringParam ( ADModel , " " ) ; status |= setIntegerParam ( ADMaxSizeX , 0 ) ; status |= setIntegerParam ( ADMaxSizeY , 0 ) ; status |= setIntegerParam ( ADMinX , 0 ) ; status |= setIntegerParam ( ADMinY , 0 ) ; status |= setIntegerParam ( ADBinX , 1 ) ; status |= setIntegerParam ( ADBinY , 1 ) ; status |= setIntegerParam ( ADReverseX , 0 ) ; status |= setIntegerParam ( ADReverseY , 0 ) ; status |= setIntegerParam ( ADSizeX , 0 ) ; status |= setIntegerParam ( ADSizeY , 0 ) ; status |= setIntegerParam ( NDArraySizeX , 0 ) ; status |= setIntegerParam ( NDArraySizeY , 0 ) ; status |= setIntegerParam ( NDArraySize , 0 ) ; status |= setIntegerParam ( NDDataType , 0 ) ; status |= setIntegerParam ( PVAOverrunCounter , 0 ) ; status |= setStringParam ( PVAPvName , pvName ) ; status |= setIntegerParam ( PVAPvConnectionStatus , 0 ) ; if ( status ) asynPrint ( pasynUserSelf , ASYN_TRACE_ERROR , " \n " , driverName , functionName ) ; try { ClientFactory :: start ( ) ; m_provider = getChannelProviderRegistry ( ) -> getProvider ( " " ) ; m_pvRequest = CreateRequest :: create ( ) -> createRequest ( m_request ) ; connectPv ( ) ; } catch ( exception & ex ) { asynPrint ( pasynUserSelf , ASYN_TRACE_ERROR , " \n " , driverName , functionName , ex . what ( ) ) ; } unlock ( ) ; }
Constructor for pvaDriver; most parameters are simply passed to
 ADDriver::ADDriver.
Constructor for pvaDriver ; most parameters are simply passed to ADDriver :: ADDriver .
/* Set some default values for parameters */