updated to match service API changes
This commit is contained in:
@@ -44,7 +44,7 @@ public:
|
||||
class dbPutNotifyBlocker : public dbBaseIO {
|
||||
public:
|
||||
dbPutNotifyBlocker ( dbChannelIO &chanIn );
|
||||
void initiatePutNotify ( epicsMutex &mutex, cacNotify ¬ify, struct dbAddr &addr,
|
||||
void initiatePutNotify ( epicsMutex &mutex, cacWriteNotify ¬ify, struct dbAddr &addr,
|
||||
unsigned type, unsigned long count, const void *pValue );
|
||||
void cancel ();
|
||||
void completion ();
|
||||
@@ -58,7 +58,7 @@ private:
|
||||
putNotify pn;
|
||||
epicsEvent block;
|
||||
dbChannelIO &chan;
|
||||
cacNotify *pNotify;
|
||||
cacWriteNotify *pNotify;
|
||||
dbSubscriptionIO * isSubscription ();
|
||||
static tsFreeList < dbPutNotifyBlocker > freeList;
|
||||
static epicsMutex freeListMutex;
|
||||
@@ -70,7 +70,7 @@ extern "C" void dbSubscriptionEventCallback ( void *pPrivate, struct dbAddr *pad
|
||||
|
||||
class dbSubscriptionIO : public tsDLNode <dbSubscriptionIO>, public dbBaseIO {
|
||||
public:
|
||||
dbSubscriptionIO ( dbServiceIO &, dbChannelIO &, struct dbAddr &, cacDataNotify &,
|
||||
dbSubscriptionIO ( dbServiceIO &, dbChannelIO &, struct dbAddr &, cacStateNotify &,
|
||||
unsigned type, unsigned long count, unsigned mask, cacChannel::ioid * );
|
||||
void destroy ();
|
||||
void show ( unsigned level ) const;
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
protected:
|
||||
virtual ~dbSubscriptionIO ();
|
||||
private:
|
||||
cacDataNotify ¬ify;
|
||||
cacStateNotify ¬ify;
|
||||
dbChannelIO &chan;
|
||||
dbEventSubscription es;
|
||||
unsigned type;
|
||||
@@ -108,7 +108,9 @@ public:
|
||||
const dbAddr &addr, dbServiceIO &serviceIO );
|
||||
void destroy ();
|
||||
void callReadNotify ( unsigned type, unsigned long count,
|
||||
const struct db_field_log *pfl, cacDataNotify ¬ify );
|
||||
cacReadNotify ¬ify );
|
||||
void callStateNotify ( unsigned type, unsigned long count,
|
||||
const struct db_field_log *pfl, cacStateNotify ¬ify );
|
||||
void putNotifyCompletion ( dbPutNotifyBlocker & );
|
||||
void show ( unsigned level ) const;
|
||||
void * operator new ( size_t size);
|
||||
@@ -121,13 +123,13 @@ private:
|
||||
const char *pName () const;
|
||||
void initiateConnect ();
|
||||
ioStatus read ( unsigned type, unsigned long count,
|
||||
cacDataNotify &, ioid * );
|
||||
cacReadNotify &, ioid * );
|
||||
void write ( unsigned type, unsigned long count,
|
||||
const void *pvalue );
|
||||
ioStatus write ( unsigned type, unsigned long count,
|
||||
const void *pvalue, cacNotify &, ioid * );
|
||||
const void *pvalue, cacWriteNotify &, ioid * );
|
||||
void subscribe ( unsigned type, unsigned long count,
|
||||
unsigned mask, cacDataNotify ¬ify, ioid * );
|
||||
unsigned mask, cacStateNotify ¬ify, ioid * );
|
||||
void ioCancel ( const ioid & );
|
||||
void ioShow ( const ioid &, unsigned level ) const;
|
||||
short nativeType () const;
|
||||
@@ -143,11 +145,13 @@ public:
|
||||
virtual ~dbServiceIO ();
|
||||
cacChannel *createChannel ( const char *pName, cacChannelNotify & );
|
||||
void callReadNotify ( struct dbAddr &addr, unsigned type, unsigned long count,
|
||||
const struct db_field_log *pfl, cacDataNotify ¬ify );
|
||||
cacReadNotify ¬ify );
|
||||
void callStateNotify ( struct dbAddr &addr, unsigned type, unsigned long count,
|
||||
const struct db_field_log *pfl, cacStateNotify ¬ify );
|
||||
dbEventSubscription subscribe ( struct dbAddr &addr, dbChannelIO &chan,
|
||||
dbSubscriptionIO &subscr, unsigned mask, cacChannel::ioid * );
|
||||
void initiatePutNotify ( dbChannelIO &, struct dbAddr &, unsigned type,
|
||||
unsigned long count, const void *pValue, cacNotify ¬ify,
|
||||
unsigned long count, const void *pValue, cacWriteNotify ¬ify,
|
||||
cacChannel::ioid *pId );
|
||||
void putNotifyCompletion ( dbPutNotifyBlocker & );
|
||||
void show ( unsigned level ) const;
|
||||
|
||||
@@ -43,7 +43,7 @@ dbChannelIO::dbChannelIO ( cacChannelNotify ¬ify,
|
||||
|
||||
void dbChannelIO::initiateConnect ()
|
||||
{
|
||||
this->notify ().connectNotify ( *this );
|
||||
this->notify ().connectNotify ();
|
||||
}
|
||||
|
||||
dbChannelIO::~dbChannelIO ()
|
||||
@@ -52,10 +52,10 @@ dbChannelIO::~dbChannelIO ()
|
||||
}
|
||||
|
||||
cacChannel::ioStatus dbChannelIO::read ( unsigned type,
|
||||
unsigned long count, cacDataNotify ¬ify, ioid * )
|
||||
unsigned long count, cacReadNotify ¬ify, ioid * )
|
||||
{
|
||||
this->serviceIO.callReadNotify ( this->addr,
|
||||
type, count, 0, notify );
|
||||
type, count, notify );
|
||||
return iosSynch;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ void dbChannelIO::write ( unsigned type, unsigned long count, const void *pValue
|
||||
}
|
||||
|
||||
cacChannel::ioStatus dbChannelIO::write ( unsigned type, unsigned long count,
|
||||
const void *pValue, cacNotify ¬ify, ioid *pId )
|
||||
const void *pValue, cacWriteNotify ¬ify, ioid *pId )
|
||||
{
|
||||
if ( count > LONG_MAX ) {
|
||||
throw outOfBounds();
|
||||
@@ -89,7 +89,7 @@ void dbChannelIO::putNotifyCompletion ( dbPutNotifyBlocker &blocker )
|
||||
}
|
||||
|
||||
void dbChannelIO::subscribe ( unsigned type, unsigned long count,
|
||||
unsigned mask, cacDataNotify ¬ify, ioid *pId )
|
||||
unsigned mask, cacStateNotify ¬ify, ioid *pId )
|
||||
{
|
||||
if ( type > INT_MAX ) {
|
||||
throw cacChannel::badType();
|
||||
|
||||
@@ -55,7 +55,14 @@ inline short dbChannelIO::nativeType () const
|
||||
}
|
||||
|
||||
inline void dbChannelIO::callReadNotify ( unsigned type, unsigned long count,
|
||||
const struct db_field_log *pfl, cacDataNotify ¬ify )
|
||||
cacReadNotify ¬ify )
|
||||
{
|
||||
this->serviceIO.callReadNotify ( this->addr, type, count, pfl, notify );
|
||||
this->serviceIO.callReadNotify ( this->addr, type, count, notify );
|
||||
}
|
||||
|
||||
inline void dbChannelIO::callStateNotify ( unsigned type, unsigned long count,
|
||||
const struct db_field_log *pfl, cacStateNotify ¬ify )
|
||||
{
|
||||
this->serviceIO.callStateNotify ( this->addr, type, count, pfl, notify );
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ void dbPutNotifyBlocker::completion ()
|
||||
this->block.signal ();
|
||||
}
|
||||
|
||||
void dbPutNotifyBlocker::initiatePutNotify ( epicsMutex &mutex, cacNotify ¬ify,
|
||||
void dbPutNotifyBlocker::initiatePutNotify ( epicsMutex &mutex, cacWriteNotify ¬ify,
|
||||
struct dbAddr &addr, unsigned type, unsigned long count,
|
||||
const void *pValue )
|
||||
{
|
||||
|
||||
@@ -82,9 +82,57 @@ cacChannel *dbServiceIO::createChannel (
|
||||
}
|
||||
|
||||
void dbServiceIO::callReadNotify ( struct dbAddr &addr,
|
||||
unsigned type, unsigned long count,
|
||||
cacReadNotify ¬ify )
|
||||
{
|
||||
unsigned long size = dbr_size_n ( type, count );
|
||||
|
||||
if ( type > INT_MAX ) {
|
||||
notify.exception ( ECA_BADTYPE,
|
||||
"type code out of range (high side)",
|
||||
type, count );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( count > INT_MAX ) {
|
||||
notify.exception ( ECA_BADCOUNT,
|
||||
"element count out of range (high side)",
|
||||
type, count);
|
||||
return;
|
||||
}
|
||||
|
||||
epicsAutoMutex locker ( this->mutex );
|
||||
|
||||
if ( this->eventCallbackCacheSize < size) {
|
||||
if ( this->pEventCallbackCache ) {
|
||||
delete [] this->pEventCallbackCache;
|
||||
}
|
||||
this->pEventCallbackCache = new char [size];
|
||||
if ( ! this->pEventCallbackCache ) {
|
||||
this->eventCallbackCacheSize = 0ul;
|
||||
notify.exception ( ECA_ALLOCMEM,
|
||||
"unable to allocate callback cache",
|
||||
type, count );
|
||||
return;
|
||||
}
|
||||
this->eventCallbackCacheSize = size;
|
||||
}
|
||||
int status = db_get_field ( &addr, static_cast <int> ( type ),
|
||||
this->pEventCallbackCache, static_cast <int> ( count ), 0 );
|
||||
if ( status ) {
|
||||
notify.exception ( ECA_GETFAIL,
|
||||
"db_get_field() completed unsuccessfuly",
|
||||
type, count);
|
||||
}
|
||||
else {
|
||||
notify.completion ( type, count, this->pEventCallbackCache );
|
||||
}
|
||||
}
|
||||
|
||||
void dbServiceIO::callStateNotify ( struct dbAddr &addr,
|
||||
unsigned type, unsigned long count,
|
||||
const struct db_field_log *pfl,
|
||||
cacDataNotify ¬ify )
|
||||
cacStateNotify ¬ify )
|
||||
{
|
||||
unsigned long size = dbr_size_n ( type, count );
|
||||
|
||||
@@ -127,7 +175,7 @@ void dbServiceIO::callReadNotify ( struct dbAddr &addr,
|
||||
type, count);
|
||||
}
|
||||
else {
|
||||
notify.completion ( type, count, this->pEventCallbackCache );
|
||||
notify.current ( type, count, this->pEventCallbackCache );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +246,7 @@ dbEventSubscription dbServiceIO::subscribe ( struct dbAddr &addr, dbChannelIO &c
|
||||
|
||||
void dbServiceIO::initiatePutNotify ( dbChannelIO &chan, struct dbAddr &addr,
|
||||
unsigned type, unsigned long count, const void *pValue,
|
||||
cacNotify ¬ify, cacChannel::ioid *pId )
|
||||
cacWriteNotify ¬ify, cacChannel::ioid *pId )
|
||||
{
|
||||
epicsAutoMutex locker ( this->mutex );
|
||||
if ( ! chan.dbServicePrivateListOfIO::pBlocker ) {
|
||||
|
||||
@@ -33,7 +33,7 @@ tsFreeList < dbSubscriptionIO > dbSubscriptionIO::freeList;
|
||||
epicsMutex dbSubscriptionIO::freeListMutex;
|
||||
|
||||
dbSubscriptionIO::dbSubscriptionIO ( dbServiceIO &serviceIO, dbChannelIO &chanIO,
|
||||
dbAddr &addr, cacDataNotify ¬ifyIn,
|
||||
dbAddr &addr, cacStateNotify ¬ifyIn,
|
||||
unsigned typeIn, unsigned long countIn, unsigned maskIn,
|
||||
cacChannel::ioid * pId ) :
|
||||
notify ( notifyIn ), chan ( chanIO ), es ( 0 ),
|
||||
@@ -73,7 +73,7 @@ extern "C" void dbSubscriptionEventCallback ( void *pPrivate, struct dbAddr * /*
|
||||
int /* eventsRemaining */, struct db_field_log *pfl )
|
||||
{
|
||||
dbSubscriptionIO *pIO = static_cast < dbSubscriptionIO * > ( pPrivate );
|
||||
pIO->chan.callReadNotify ( pIO->type, pIO->count, pfl, pIO->notify );
|
||||
pIO->chan.callStateNotify ( pIO->type, pIO->count, pfl, pIO->notify );
|
||||
}
|
||||
|
||||
void dbSubscriptionIO::show ( unsigned level ) const
|
||||
|
||||
Reference in New Issue
Block a user