diff --git a/src/cas/generic/casChannel.cc b/src/cas/generic/casChannel.cc index e695d4aab..07b77f98a 100644 --- a/src/cas/generic/casChannel.cc +++ b/src/cas/generic/casChannel.cc @@ -71,6 +71,25 @@ bool casChannel::confirmationRequested () const return false; } +caStatus casChannel::beginTransaction () +{ + return S_casApp_success; +} + +void casChannel::endTransaction () +{ +} + +caStatus casChannel::read ( const casCtx & ctx, gdd & prototype ) +{ + return ctx.getPV()->read ( ctx, prototype ); +} + +caStatus casChannel::write ( const casCtx & ctx, const gdd & value ) +{ + return ctx.getPV()->write ( ctx, value ); +} + void casChannel::show ( unsigned level ) const { if ( level > 2u ) { diff --git a/src/cas/generic/casChannelI.cc b/src/cas/generic/casChannelI.cc index 5b6b262b2..5104ae2a6 100644 --- a/src/cas/generic/casChannelI.cc +++ b/src/cas/generic/casChannelI.cc @@ -79,3 +79,24 @@ caStatus casChannelI::cbFunc ( return stat; } +caStatus casChannelI::read ( const casCtx & ctx, gdd & prototype ) +{ + caStatus status = this->chan.beginTransaction (); + if ( status != S_casApp_success ) { + return status; + } + status = this->chan.read ( ctx, prototype ); + this->chan.endTransaction (); + return status; +} + +caStatus casChannelI::write ( const casCtx & ctx, const gdd & value ) +{ + caStatus status = this->chan.beginTransaction (); + if ( status != S_casApp_success ) { + return status; + } + status = this->chan.write ( ctx, value ); + this->chan.endTransaction (); + return status; +} diff --git a/src/cas/generic/casChannelI.h b/src/cas/generic/casChannelI.h index e06feaca3..8bde7ec48 100644 --- a/src/cas/generic/casChannelI.h +++ b/src/cas/generic/casChannelI.h @@ -52,6 +52,8 @@ public: bool readAccess () const; bool writeAccess () const; bool confirmationRequested () const; + caStatus read ( const casCtx & ctx, gdd & prototype ); + caStatus write ( const casCtx & ctx, const gdd & value ); void show ( unsigned level ) const; private: tsDLList < casAsyncIOI > ioList; diff --git a/src/cas/generic/casStrmClient.cc b/src/cas/generic/casStrmClient.cc index 467ec4be8..5f1438b8c 100644 --- a/src/cas/generic/casStrmClient.cc +++ b/src/cas/generic/casStrmClient.cc @@ -815,7 +815,8 @@ caStatus casStrmClient::monitorResponse ( if ( completionStatus == S_cas_noRead ) { return monitorFailureResponse ( guard, msg, ECA_NORDACCESS ); } - else if ( completionStatus == S_cas_noMemory ) { + else if ( completionStatus == S_cas_noMemory || + completionStatus == S_casApp_noMemory ) { return monitorFailureResponse ( guard, msg, ECA_ALLOCMEM ); } else if ( completionStatus == S_cas_badType ) { @@ -1337,7 +1338,7 @@ caStatus casStrmClient::createChanResponse ( if ( this->userStartedAsyncIO ) { if ( status != S_casApp_asyncCompletion ) { fprintf ( stderr, - "Application returned %d from casPV::read()" + "Application returned %d from casChannel::read()" " - expected S_casApp_asyncCompletion\n", status); } status = S_cas_success; @@ -1353,7 +1354,7 @@ caStatus casStrmClient::createChanResponse ( } else if ( status == S_casApp_postponeAsyncIO ) { errlogPrintf ( "The server library does not currently support postponment of " ); - errlogPrintf ( "string table cache update of casPV::read()." ); + errlogPrintf ( "string table cache update of casChannel::read()." ); errlogPrintf ( "To postpone this request please postpone the PC attach IO request." ); errlogPrintf ( "String table cache update did not occur." ); status = enumPostponedCreateChanResponse ( @@ -1945,7 +1946,7 @@ caStatus casStrmClient::write() if ( this->userStartedAsyncIO ) { if (status!=S_casApp_asyncCompletion) { fprintf(stderr, -"Application returned %d from casPV::write() - expected S_casApp_asyncCompletion\n", +"Application returned %d from casChannel::write() - expected S_casApp_asyncCompletion\n", status); status = S_casApp_asyncCompletion; } @@ -1953,7 +1954,7 @@ caStatus casStrmClient::write() else if ( status == S_casApp_asyncCompletion ) { status = S_cas_badParameter; errMessage ( status, - "- expected asynch IO creation from casPV::write()" ); + "- expected asynch IO creation from casChannel::write()" ); } return status; @@ -2010,7 +2011,7 @@ caStatus casStrmClient::writeScalarData () // // call the server tool's virtual function // - status = this->ctx.getPV()->write ( this->ctx, *pDD ); + status = this->ctx.getChannel()->write ( this->ctx, *pDD ); } // @@ -2099,7 +2100,7 @@ caStatus casStrmClient::writeArrayData() // // call the server tool's virtual function // - status = this->ctx.getPV()->write ( this->ctx, *pDD ); + status = this->ctx.getChannel()->write ( this->ctx, *pDD ); } else { status = S_cas_noConvert; @@ -2134,7 +2135,7 @@ caStatus casStrmClient::read ( const gdd * & pDescRet ) // // call the server tool's virtual function // - status = this->ctx.getPV()->read ( this->ctx, * pDD ); + status = this->ctx.getChannel()->read ( this->ctx, * pDD ); // // prevent problems when they initiate @@ -2144,7 +2145,7 @@ caStatus casStrmClient::read ( const gdd * & pDescRet ) if ( this->userStartedAsyncIO ) { if ( status != S_casApp_asyncCompletion ) { fprintf(stderr, -"Application returned %d from casPV::read() - expected S_casApp_asyncCompletion\n", +"Application returned %d from casChannel::read() - expected S_casApp_asyncCompletion\n", status); status = S_casApp_asyncCompletion; } @@ -2152,7 +2153,7 @@ caStatus casStrmClient::read ( const gdd * & pDescRet ) else if ( status == S_casApp_asyncCompletion ) { status = S_cas_badParameter; errMessage(status, - "- expected asynch IO creation from casPV::read()"); + "- expected asynch IO creation from casChannel::read()"); } if ( status == S_casApp_success ) { diff --git a/src/cas/generic/casdef.h b/src/cas/generic/casdef.h index 96ae491cc..f93279aab 100644 --- a/src/cas/generic/casdef.h +++ b/src/cas/generic/casdef.h @@ -571,6 +571,34 @@ public: // for confirmation prior writing to this PV epicsShareFunc virtual bool confirmationRequested () const; + // + // If this function is not provided in the derived class then casPV::beginTransaction() + // is called - see casPV::beginTransaction() for additional comments. + // + epicsShareFunc virtual caStatus beginTransaction (); + + // + // If this function is not provided in the derived class then casPV::endTransaction() + // is called - see casPV::endTransaction() for additional comments. + // + epicsShareFunc virtual void endTransaction (); + + // + // read + // + // If this function is not provided in the derived class then casPV::read() + // is called - see casPV::read() for additional comments. + // + epicsShareFunc virtual caStatus read (const casCtx &ctx, gdd &prototype); + + // + // write + // + // If this function is not provided in the derived class then casPV::write() + // is called - see casPV::write() for additional comments. + // + epicsShareFunc virtual caStatus write (const casCtx &ctx, const gdd &value); + // // This is called for each channel in the server if // caServer::show() is called and the level is high