diff --git a/src/ca/access.cpp b/src/ca/access.cpp index dae79addd..b882fac60 100644 --- a/src/ca/access.cpp +++ b/src/ca/access.cpp @@ -762,16 +762,21 @@ extern "C" epicsShareFunc unsigned epicsShareAPI ca_write_access (chid pChan) /* * ca_name () */ -extern "C" epicsShareFunc const char * epicsShareAPI ca_name (chid pChan) +extern "C" epicsShareFunc const char * epicsShareAPI ca_name ( chid pChan ) { return pChan->pName (); } -extern "C" epicsShareFunc unsigned epicsShareAPI ca_search_attempts (chid pChan) +extern "C" epicsShareFunc unsigned epicsShareAPI ca_search_attempts ( chid pChan ) { return pChan->searchAttempts (); } +extern "C" epicsShareFunc double epicsShareAPI ca_beacon_period ( chid pChan ) +{ + return pChan->beaconPeriod (); +} + /* * ca_get_ioc_connection_count() * diff --git a/src/ca/bhe.cpp b/src/ca/bhe.cpp index 8b2bffe44..584c902a5 100644 --- a/src/ca/bhe.cpp +++ b/src/ca/bhe.cpp @@ -12,6 +12,7 @@ #include "iocinf.h" #include "bhe_IL.h" +#include "tcpiiu_IL.h" tsFreeList < class bhe, 1024 > bhe::freeList; @@ -34,7 +35,7 @@ bhe::~bhe () * * updates beacon period, and looks for beacon anomalies */ -bool bhe::updateBeaconPeriod ( osiTime programBeginTime ) +bool bhe::updatePeriod ( osiTime programBeginTime ) { double currentPeriod; bool netChange = false; @@ -167,3 +168,9 @@ void bhe::destroy () delete this; } +double bhe::period () const +{ + return this->averagePeriod; +} + + diff --git a/src/ca/cacChannel.cpp b/src/ca/cacChannel.cpp index 6663c2139..234f8de59 100644 --- a/src/ca/cacChannel.cpp +++ b/src/ca/cacChannel.cpp @@ -15,6 +15,8 @@ * 505 665 1831 */ +#include + #include "iocinf.h" cacChannel::cacChannel () : pChannelIO (0) @@ -197,6 +199,17 @@ unsigned cacChannel::searchAttempts () const } } +double cacChannel::beaconPeriod () const +{ + cacChannelIO *pIO = this->pChannelIO; + if ( pIO ) { + return pIO->beaconPeriod (); + } + else { + return - DBL_MAX; + } +} + bool cacChannel::ca_v42_ok () const { cacChannelIO *pIO = this->pChannelIO; diff --git a/src/ca/cacChannelIO.cpp b/src/ca/cacChannelIO.cpp index 9d6823312..9df75bd07 100644 --- a/src/ca/cacChannelIO.cpp +++ b/src/ca/cacChannelIO.cpp @@ -11,6 +11,8 @@ * Author: Jeff Hill */ +#include + #include "iocinf.h" cacChannelIO::cacChannelIO ( cacChannel &chanIn ) : @@ -74,6 +76,11 @@ unsigned cacChannelIO::searchAttempts () const return 0u; } +double cacChannelIO::beaconPeriod () const +{ + return - DBL_MAX; +} + bool cacChannelIO::ca_v42_ok () const { return true; diff --git a/src/ca/cacIO.h b/src/ca/cacIO.h index 0d5b1597f..71a4be32e 100644 --- a/src/ca/cacIO.h +++ b/src/ca/cacIO.h @@ -71,6 +71,7 @@ public: bool writeAccess () const; const char *pName () const; unsigned searchAttempts () const; + double beaconPeriod () const; bool ca_v42_ok () const; bool connected () const; caar accessRights () const; @@ -130,6 +131,7 @@ private: virtual channel_state state () const; // defaults to always connected virtual caar accessRights () const; // defaults to unrestricted access virtual unsigned searchAttempts () const; // defaults to zero + virtual double beaconPeriod () const; // defaults to negative DBL_MAX virtual bool ca_v42_ok () const; // defaults to true virtual bool connected () const; // defaults to true virtual unsigned readSequence () const; // defaults to always zero diff --git a/src/ca/cadef.h b/src/ca/cadef.h index f03876f81..513dae70b 100644 --- a/src/ca/cadef.h +++ b/src/ca/cadef.h @@ -931,7 +931,7 @@ epicsShareFunc int epicsShareAPI ca_replace_printf_handler ( */ epicsShareFunc unsigned epicsShareAPI ca_get_ioc_connection_count (void); epicsShareFunc unsigned epicsShareAPI ca_search_attempts (chid chan); - +epicsShareFunc double epicsShareAPI ca_beacon_period (chid chan); /* * used when an auxillary thread needs to join a CA client context started diff --git a/src/ca/casw.cpp b/src/ca/casw.cpp index 7a8d2f7a7..39ae04920 100644 --- a/src/ca/casw.cpp +++ b/src/ca/casw.cpp @@ -153,7 +153,7 @@ int main ( int argc, char **argv ) */ bhe *pBHE = beaconTable.lookup ( ina ); if ( pBHE ) { - netChange = pBHE->updateBeaconPeriod ( programBeginTime ); + netChange = pBHE->updatePeriod ( programBeginTime ); } else { /* diff --git a/src/ca/nciu.cpp b/src/ca/nciu.cpp index aa9508703..d53d4931f 100644 --- a/src/ca/nciu.cpp +++ b/src/ca/nciu.cpp @@ -484,6 +484,11 @@ unsigned nciu::searchAttempts () const return this->retry; } +double nciu::beaconPeriod () const +{ + return this->piiu->beaconPeriod (); +} + int nciu::createChannelRequest () { int status = this->piiu->createChannelRequest ( *this ); diff --git a/src/ca/netiiu.cpp b/src/ca/netiiu.cpp index 2dcb16b5d..9c64a6ca0 100644 --- a/src/ca/netiiu.cpp +++ b/src/ca/netiiu.cpp @@ -11,6 +11,7 @@ */ #include +#include #include "iocinf.h" #include "netiiu_IL.h" @@ -263,4 +264,9 @@ void netiiu::uninstallIO ( baseNMIU &io ) { epicsAutoMutex autoMutex ( this->mutex ); io.channel ().tcpiiuPrivateListOfIO::eventq.remove ( io ); -} \ No newline at end of file +} + +double netiiu::beaconPeriod () const +{ + return - DBL_MAX; +}