cas: Added propertyEventMask support
Allows server tools to send DBE_PROPERTY events to clients. New functionality not tested, but fairly trivial and doesn't break existing server tools.
This commit is contained in:
@@ -3,9 +3,8 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/*
|
||||
* $Revision-Id$
|
||||
@@ -15,8 +14,8 @@
|
||||
* 505 665 1831
|
||||
*/
|
||||
|
||||
#include "dbMapper.h" // ait to dbr types
|
||||
#include "gddAppTable.h" // EPICS application type table
|
||||
#include "dbMapper.h" // ait to dbr types
|
||||
#include "gddAppTable.h" // EPICS application type table
|
||||
#include "fdManager.h"
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
@@ -37,67 +36,67 @@ caServer::caServer ()
|
||||
|
||||
caServer::~caServer()
|
||||
{
|
||||
if (this->pCAS) {
|
||||
delete this->pCAS;
|
||||
if (this->pCAS) {
|
||||
delete this->pCAS;
|
||||
this->pCAS = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pvExistReturn caServer::pvExistTest ( const casCtx & ctx,
|
||||
const caNetAddr & /* clientAddress */, const char * pPVAliasName )
|
||||
const caNetAddr & /* clientAddress */, const char * pPVAliasName )
|
||||
{
|
||||
return this->pvExistTest ( ctx, pPVAliasName );
|
||||
}
|
||||
|
||||
pvExistReturn caServer::pvExistTest ( const casCtx &, const char * )
|
||||
{
|
||||
return pverDoesNotExistHere;
|
||||
return pverDoesNotExistHere;
|
||||
}
|
||||
|
||||
pvCreateReturn caServer::createPV ( const casCtx &, const char * )
|
||||
{
|
||||
return S_casApp_pvNotFound;
|
||||
return S_casApp_pvNotFound;
|
||||
}
|
||||
|
||||
pvAttachReturn caServer::pvAttach ( const casCtx &ctx, const char *pAliasName )
|
||||
{
|
||||
// remain backwards compatible (call deprecated routine)
|
||||
return this->createPV ( ctx, pAliasName );
|
||||
// remain backwards compatible (call deprecated routine)
|
||||
return this->createPV ( ctx, pAliasName );
|
||||
}
|
||||
|
||||
casEventMask caServer::registerEvent (const char *pName) // X aCC 361
|
||||
casEventMask caServer::registerEvent (const char *pName)
|
||||
{
|
||||
if (this->pCAS) {
|
||||
return this->pCAS->registerEvent(pName);
|
||||
}
|
||||
else {
|
||||
casEventMask emptyMask;
|
||||
printf("caServer:: no server internals attached\n");
|
||||
return emptyMask;
|
||||
}
|
||||
if (this->pCAS) {
|
||||
return this->pCAS->registerEvent(pName);
|
||||
}
|
||||
else {
|
||||
casEventMask emptyMask;
|
||||
printf("caServer:: no server internals attached\n");
|
||||
return emptyMask;
|
||||
}
|
||||
}
|
||||
|
||||
void caServer::show(unsigned level) const
|
||||
{
|
||||
if (this->pCAS) {
|
||||
this->pCAS->show(level);
|
||||
}
|
||||
else {
|
||||
printf("caServer:: no server internals attached\n");
|
||||
}
|
||||
if (this->pCAS) {
|
||||
this->pCAS->show(level);
|
||||
}
|
||||
else {
|
||||
printf("caServer:: no server internals attached\n");
|
||||
}
|
||||
}
|
||||
|
||||
void caServer::setDebugLevel (unsigned level)
|
||||
{
|
||||
if (pCAS) {
|
||||
this->pCAS->setDebugLevel(level);
|
||||
}
|
||||
else {
|
||||
printf("caServer:: no server internals attached\n");
|
||||
}
|
||||
if (pCAS) {
|
||||
this->pCAS->setDebugLevel(level);
|
||||
}
|
||||
else {
|
||||
printf("caServer:: no server internals attached\n");
|
||||
}
|
||||
}
|
||||
|
||||
unsigned caServer::getDebugLevel () const // X aCC 361
|
||||
unsigned caServer::getDebugLevel () const
|
||||
{
|
||||
if (pCAS) {
|
||||
return this->pCAS->getDebugLevel();
|
||||
@@ -108,7 +107,7 @@ unsigned caServer::getDebugLevel () const // X aCC 361
|
||||
}
|
||||
}
|
||||
|
||||
casEventMask caServer::valueEventMask () const // X aCC 361
|
||||
casEventMask caServer::valueEventMask () const
|
||||
{
|
||||
if (pCAS) {
|
||||
return this->pCAS->valueEventMask();
|
||||
@@ -119,7 +118,7 @@ casEventMask caServer::valueEventMask () const // X aCC 361
|
||||
}
|
||||
}
|
||||
|
||||
casEventMask caServer::logEventMask () const // X aCC 361
|
||||
casEventMask caServer::logEventMask () const
|
||||
{
|
||||
if (pCAS) {
|
||||
return this->pCAS->logEventMask();
|
||||
@@ -130,7 +129,7 @@ casEventMask caServer::logEventMask () const // X aCC 361
|
||||
}
|
||||
}
|
||||
|
||||
casEventMask caServer::alarmEventMask () const // X aCC 361
|
||||
casEventMask caServer::alarmEventMask () const
|
||||
{
|
||||
if ( pCAS ) {
|
||||
return this->pCAS->alarmEventMask ();
|
||||
@@ -141,12 +140,23 @@ casEventMask caServer::alarmEventMask () const // X aCC 361
|
||||
}
|
||||
}
|
||||
|
||||
casEventMask caServer::propertyEventMask () const
|
||||
{
|
||||
if (pCAS) {
|
||||
return this->pCAS->propertyEventMask();
|
||||
}
|
||||
else {
|
||||
printf("caServer:: no server internals attached\n");
|
||||
return casEventMask();
|
||||
}
|
||||
}
|
||||
|
||||
class epicsTimer & caServer::createTimer ()
|
||||
{
|
||||
return fileDescriptorManager.createTimer ();
|
||||
}
|
||||
|
||||
unsigned caServer::subscriptionEventsProcessed () const // X aCC 361
|
||||
unsigned caServer::subscriptionEventsProcessed () const
|
||||
{
|
||||
if ( pCAS ) {
|
||||
return this->pCAS->subscriptionEventsProcessed ();
|
||||
@@ -156,7 +166,7 @@ unsigned caServer::subscriptionEventsProcessed () const // X aCC 361
|
||||
}
|
||||
}
|
||||
|
||||
unsigned caServer::subscriptionEventsPosted () const // X aCC 361
|
||||
unsigned caServer::subscriptionEventsPosted () const
|
||||
{
|
||||
if ( pCAS ) {
|
||||
return this->pCAS->subscriptionEventsPosted ();
|
||||
|
||||
@@ -47,22 +47,23 @@ caServerI::caServerI ( caServer & tool ) :
|
||||
nEventsPosted ( 0u ),
|
||||
ioInProgressCount ( 0u )
|
||||
{
|
||||
assert ( & adapter != NULL );
|
||||
assert ( & adapter != NULL );
|
||||
|
||||
// create predefined event types
|
||||
this->valueEvent = registerEvent ( "value" );
|
||||
this->logEvent = registerEvent ( "log" );
|
||||
this->alarmEvent = registerEvent ( "alarm" );
|
||||
this->logEvent = registerEvent ( "log" );
|
||||
this->alarmEvent = registerEvent ( "alarm" );
|
||||
this->propertyEvent = registerEvent ( "property" );
|
||||
|
||||
this->locateInterfaces ();
|
||||
|
||||
if (this->intfList.count()==0u) {
|
||||
errMessage (S_cas_noInterface,
|
||||
if (this->intfList.count()==0u) {
|
||||
errMessage (S_cas_noInterface,
|
||||
"- CA server internals init unable to continue");
|
||||
throw S_cas_noInterface;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
caServerI::~caServerI()
|
||||
@@ -70,22 +71,22 @@ caServerI::~caServerI()
|
||||
delete & this->beaconAnomalyGov;
|
||||
delete & this->beaconTmr;
|
||||
|
||||
// delete all clients
|
||||
// delete all clients
|
||||
while ( casStrmClient * pClient = this->clientList.get() ) {
|
||||
delete pClient;
|
||||
}
|
||||
delete pClient;
|
||||
}
|
||||
|
||||
casIntfOS *pIF;
|
||||
while ( ( pIF = this->intfList.get() ) ) {
|
||||
delete pIF;
|
||||
}
|
||||
casIntfOS *pIF;
|
||||
while ( ( pIF = this->intfList.get() ) ) {
|
||||
delete pIF;
|
||||
}
|
||||
}
|
||||
|
||||
void caServerI::destroyClient ( casStrmClient & client )
|
||||
{
|
||||
{
|
||||
epicsGuard < epicsMutex > locker ( this->mutex );
|
||||
this->clientList.remove ( client );
|
||||
this->clientList.remove ( client );
|
||||
}
|
||||
delete & client;
|
||||
}
|
||||
@@ -143,11 +144,11 @@ caStatus caServerI::attachInterface ( const caNetAddr & addrIn,
|
||||
void caServerI::sendBeacon ( ca_uint32_t beaconNo )
|
||||
{
|
||||
epicsGuard < epicsMutex > locker ( this->mutex );
|
||||
tsDLIter < casIntfOS > iter = this->intfList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
iter->sendBeacon ( beaconNo );
|
||||
iter++;
|
||||
}
|
||||
tsDLIter < casIntfOS > iter = this->intfList.firstIter ();
|
||||
while ( iter.valid () ) {
|
||||
iter->sendBeacon ( beaconNo );
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
void caServerI::generateBeaconAnomaly ()
|
||||
@@ -259,11 +260,11 @@ void caServerI::casMonitorDestroy ( casMonitor & cm )
|
||||
}
|
||||
|
||||
//
|
||||
// caServerI::dumpMsg()
|
||||
// caServerI::dumpMsg()
|
||||
//
|
||||
// Debug aid - print the header part of a message.
|
||||
// Debug aid - print the header part of a message.
|
||||
//
|
||||
// dp arg allowed to be null
|
||||
// dp arg allowed to be null
|
||||
//
|
||||
//
|
||||
void caServerI::dumpMsg ( const char * pHostName, const char * pUserName,
|
||||
|
||||
@@ -44,23 +44,24 @@ caStatus convertContainerMemberToAtomic ( class gdd & dd,
|
||||
aitUint32 appType, aitUint32 elemCount );
|
||||
|
||||
class caServerI :
|
||||
public caServerIO,
|
||||
public ioBlockedList,
|
||||
public casEventRegistry {
|
||||
public caServerIO,
|
||||
public ioBlockedList,
|
||||
public casEventRegistry {
|
||||
public:
|
||||
caServerI ( caServer &tool );
|
||||
~caServerI ();
|
||||
bool roomForNewChannel() const;
|
||||
unsigned getDebugLevel() const { return debugLevel; }
|
||||
inline void setDebugLevel ( unsigned debugLevelIn );
|
||||
void show ( unsigned level ) const;
|
||||
caServerI ( caServer &tool );
|
||||
~caServerI ();
|
||||
bool roomForNewChannel() const;
|
||||
unsigned getDebugLevel() const { return debugLevel; }
|
||||
inline void setDebugLevel ( unsigned debugLevelIn );
|
||||
void show ( unsigned level ) const;
|
||||
void destroyMonitor ( casMonitor & );
|
||||
caServer * getAdapter ();
|
||||
caServer * operator -> ();
|
||||
void connectCB ( casIntfOS & );
|
||||
casEventMask valueEventMask () const; // DBE_VALUE registerEvent("value")
|
||||
casEventMask logEventMask () const; // DBE_LOG registerEvent("log")
|
||||
casEventMask alarmEventMask () const; // DBE_ALARM registerEvent("alarm")
|
||||
caServer * getAdapter ();
|
||||
caServer * operator -> ();
|
||||
void connectCB ( casIntfOS & );
|
||||
casEventMask valueEventMask () const; // DBE_VALUE registerEvent("value")
|
||||
casEventMask logEventMask () const; // DBE_LOG registerEvent("log")
|
||||
casEventMask alarmEventMask () const; // DBE_ALARM registerEvent("alarm")
|
||||
casEventMask propertyEventMask () const; // DBE_PROPERTY registerEvent("property")
|
||||
unsigned subscriptionEventsProcessed () const;
|
||||
void incrEventsProcessedCounter ();
|
||||
unsigned subscriptionEventsPosted () const;
|
||||
@@ -82,29 +83,30 @@ public:
|
||||
private:
|
||||
clientBufMemoryManager clientBufMemMgr;
|
||||
tsFreeList < casMonitor, 1024 > casMonitorFreeList;
|
||||
tsDLList < casStrmClient > clientList;
|
||||
tsDLList < casStrmClient > clientList;
|
||||
tsDLList < casIntfOS > intfList;
|
||||
mutable epicsMutex mutex;
|
||||
mutable epicsMutex diagnosticCountersMutex;
|
||||
caServer & adapter;
|
||||
mutable epicsMutex mutex;
|
||||
mutable epicsMutex diagnosticCountersMutex;
|
||||
caServer & adapter;
|
||||
beaconTimer & beaconTmr;
|
||||
beaconAnomalyGovernor & beaconAnomalyGov;
|
||||
unsigned debugLevel;
|
||||
unsigned debugLevel;
|
||||
unsigned nEventsProcessed;
|
||||
unsigned nEventsPosted;
|
||||
unsigned ioInProgressCount;
|
||||
|
||||
casEventMask valueEvent; // DBE_VALUE registerEvent("value")
|
||||
casEventMask logEvent; // DBE_LOG registerEvent("log")
|
||||
casEventMask alarmEvent; // DBE_ALARM registerEvent("alarm")
|
||||
casEventMask logEvent; // DBE_LOG registerEvent("log")
|
||||
casEventMask alarmEvent; // DBE_ALARM registerEvent("alarm")
|
||||
casEventMask propertyEvent; // DBE_PROPERTY registerEvent("property")
|
||||
|
||||
caStatus attachInterface ( const caNetAddr & addr, bool autoBeaconAddr,
|
||||
bool addConfigAddr );
|
||||
caStatus attachInterface ( const caNetAddr & addr, bool autoBeaconAddr,
|
||||
bool addConfigAddr );
|
||||
|
||||
void sendBeacon ( ca_uint32_t beaconNo );
|
||||
|
||||
caServerI ( const caServerI & );
|
||||
caServerI & operator = ( const caServerI & );
|
||||
caServerI ( const caServerI & );
|
||||
caServerI & operator = ( const caServerI & );
|
||||
|
||||
friend class beaconAnomalyGovernor;
|
||||
friend class beaconTimer;
|
||||
@@ -113,17 +115,17 @@ private:
|
||||
|
||||
inline caServer * caServerI::getAdapter()
|
||||
{
|
||||
return & this->adapter;
|
||||
return & this->adapter;
|
||||
}
|
||||
|
||||
inline caServer * caServerI::operator -> ()
|
||||
{
|
||||
return this->getAdapter();
|
||||
return this->getAdapter();
|
||||
}
|
||||
|
||||
inline void caServerI::setDebugLevel(unsigned debugLevelIn)
|
||||
{
|
||||
this->debugLevel = debugLevelIn;
|
||||
this->debugLevel = debugLevelIn;
|
||||
}
|
||||
|
||||
inline casEventMask caServerI::valueEventMask() const
|
||||
@@ -141,6 +143,11 @@ inline casEventMask caServerI::alarmEventMask() const
|
||||
return this->alarmEvent;
|
||||
}
|
||||
|
||||
inline casEventMask caServerI::propertyEventMask() const
|
||||
{
|
||||
return this->propertyEvent;
|
||||
}
|
||||
|
||||
inline bool caServerI :: ioIsPending () const
|
||||
{
|
||||
return ( ioInProgressCount > 0u );
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -245,6 +245,7 @@ public:
|
||||
epicsShareFunc casEventMask valueEventMask () const; // DBE_VALUE
|
||||
epicsShareFunc casEventMask logEventMask () const; // DBE_LOG
|
||||
epicsShareFunc casEventMask alarmEventMask () const; // DBE_ALARM
|
||||
epicsShareFunc casEventMask propertyEventMask () const; // DBE_PROPERTY
|
||||
|
||||
epicsShareFunc void setDebugLevel ( unsigned level );
|
||||
epicsShareFunc unsigned getDebugLevel () const;
|
||||
|
||||
Reference in New Issue
Block a user