Yate
SignallingCircuit Class Reference

Abstract data circuit used by signalling. More...

#include <yatesig.h>

Inheritance diagram for SignallingCircuit:
RefObject GenObject

Public Types

enum  Type {
  Unknown = 0 , Local , TDM , RTP ,
  IAX
}
 
enum  Status {
  Missing = 0 , Disabled , Idle , Reserved ,
  Starting , Stopping , Special , Connected
}
 
enum  LockFlags {
  LockLocalHWFail = 0x0001 , LockLocalMaint = 0x0002 , LockingHWFail = 0x0004 , LockingMaint = 0x0008 ,
  LockLocalHWFailChg = 0x0010 , LockLocalMaintChg = 0x0020 , Resetting = 0x0040 , LockRemoteHWFail = 0x0100 ,
  LockRemoteMaint = 0x0200 , LockRemoteHWFailChg = 0x1000 , LockRemoteMaintChg = 0x2000 , LockLocal = LockLocalHWFail | LockLocalMaint ,
  LockRemote = LockRemoteHWFail | LockRemoteMaint , LockLocked = LockLocal | LockRemote , LockBusy = LockingHWFail | LockingMaint | Resetting , LockLockedBusy = LockLocked | LockBusy ,
  LockLocalChg = LockLocalHWFailChg | LockLocalMaintChg , LockRemoteChg = LockRemoteHWFailChg | LockRemoteMaintChg , LockChanged = LockLocalChg | LockRemoteChg
}
 

Public Member Functions

virtual ~SignallingCircuit ()
 
virtual bool status (Status newStat, bool sync=false)
 
Type type () const
 
Status status () const
 
int locked (int flags=-1) const
 
void setLock (int flags)
 
void resetLock (int flags)
 
virtual bool updateFormat (const char *format, int direction)
 
virtual bool setParam (const String &param, const String &value)
 
virtual bool setParams (const NamedList &params)
 
virtual bool getParam (const String &param, String &value) const
 
virtual bool getBoolParam (const String &param, bool defValue=false) const
 
virtual int getIntParam (const String &param, int defValue=0) const
 
virtual bool getParams (NamedList &params, const String &category=String::empty())
 
SignallingCircuitGroupgroup ()
 
SignallingCircuitSpanspan ()
 
const SignallingCircuitGroupgroup () const
 
const SignallingCircuitSpanspan () const
 
unsigned int code () const
 
bool available () const
 
bool connected () const
 
bool reserve ()
 
bool connect (const char *format=0)
 
bool disconnect ()
 
bool disable ()
 
bool hwLock (bool set, bool remote, bool changed=false, bool setChanged=false)
 
bool maintLock (bool set, bool remote, bool changed=false, bool setChanged=false)
 
void addEvent (SignallingCircuitEvent *event)
 
SignallingCircuitEventgetEvent (const Time &when)
 
virtual bool sendEvent (SignallingCircuitEvent::Type type, NamedList *params=0)
 
- Public Member Functions inherited from RefObject
 RefObject ()
 
virtual ~RefObject ()
 
virtual void * getObject (const String &name) const
 
virtual bool alive () const
 
bool ref ()
 
bool deref ()
 
int refcount () const
 
virtual void destruct ()
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual const StringtoString () const
 
virtual const StringtraceId () const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 

Static Public Member Functions

static const char * lookupType (int type)
 
static const char * lookupStatus (int status)
 
- Static Public Member Functions inherited from RefObject
static bool alive (const RefObject *obj)
 
static bool efficientIncDec ()
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 

Static Public Attributes

static const TokenDict s_lockNames []
 

Protected Member Functions

 SignallingCircuit (Type type, unsigned int code, SignallingCircuitGroup *group=0, SignallingCircuitSpan *span=0)
 
 SignallingCircuit (Type type, unsigned int code, Status status, SignallingCircuitGroup *group=0, SignallingCircuitSpan *span=0)
 
virtual void clearEvents ()
 
void eventTerminated (SignallingCircuitEvent *event)
 
- Protected Member Functions inherited from RefObject
virtual void zeroRefs ()
 
bool resurrect ()
 
virtual void destroyed ()
 

Protected Attributes

Mutex m_mutex
 

Friends

class SignallingCircuitGroup
 
class SignallingCircuitEvent
 

Detailed Description

Abstract data circuit used by signalling.

Interface to an abstract voice/data circuit referenced by signalling

Member Enumeration Documentation

◆ LockFlags

enum LockFlags

Lock circuit flags

◆ Status

enum Status

Status of the circuit

◆ Type

enum Type

Type of the circuit hardware or transport

Constructor & Destructor Documentation

◆ ~SignallingCircuit()

virtual ~SignallingCircuit ( )
virtual

Destructor. Clear event list

◆ SignallingCircuit() [1/2]

SignallingCircuit ( Type type,
unsigned int code,
SignallingCircuitGroup * group = 0,
SignallingCircuitSpan * span = 0 )
protected

Constructor

References code(), group(), span(), and type().

◆ SignallingCircuit() [2/2]

SignallingCircuit ( Type type,
unsigned int code,
Status status,
SignallingCircuitGroup * group = 0,
SignallingCircuitSpan * span = 0 )
protected

Constructor

References code(), group(), span(), status(), and type().

Member Function Documentation

◆ addEvent()

void addEvent ( SignallingCircuitEvent * event)

Add an event to the queue This method is thread safe

Parameters
eventThe event to enqueue

◆ available()

bool available ( ) const
inline

Get the available status of the circuit

Returns
True if the circuit is available for use

Referenced by reserve().

◆ clearEvents()

virtual void clearEvents ( )
protectedvirtual

Clear event queue This method is thread safe

◆ code()

unsigned int code ( ) const
inline

Get the group-local code of this circuit

Returns
Identification code within group

Referenced by SignallingCircuit(), and SignallingCircuit().

◆ connect()

bool connect ( const char * format = 0)
inline

Connect this circuit

Parameters
formatOptional data format to update for both directions
Returns
True if the circuit state was changed to Connected

References status(), and updateFormat().

◆ connected()

bool connected ( ) const
inline

Get the connected status of the circuit

Returns
True if the circuit is connected (in use)

◆ disable()

bool disable ( )
inline

Disable this circuit for maintenance

Returns
True if the circuit was changed from Idle to Reserved

References status().

◆ disconnect()

bool disconnect ( )
inline

Disconnect (set state to Reserved) this circuit if connected

Returns
True if the circuit was changed from Connected to Reserved

References status().

◆ eventTerminated()

void eventTerminated ( SignallingCircuitEvent * event)
protected

Event termination notification

Parameters
eventThe terminated event

◆ getBoolParam()

virtual bool getBoolParam ( const String & param,
bool defValue = false ) const
inlinevirtual

Get boolean circuit parameter

Parameters
paramThe parameter to get
defValueThe default returned value
Returns
Value from circuit, devValue if the parameter doesn't exist

◆ getEvent()

SignallingCircuitEvent * getEvent ( const Time & when)

Get an event from queue This method is thread safe

Parameters
whenThe current time
Returns
SignallingCircuitEvent pointer or 0 if no events

◆ getIntParam()

virtual int getIntParam ( const String & param,
int defValue = 0 ) const
inlinevirtual

Get integer circuit parameter

Parameters
paramThe parameter to get
defValueThe default returned value
Returns
Value from circuit, devValue if the parameter doesn't exist

◆ getParam()

virtual bool getParam ( const String & param,
String & value ) const
inlinevirtual

Get circuit parameter

Parameters
paramThe parameter to get
valueThe value of the parameter
Returns
True on success. False if the parameter doesn't exist

◆ getParams()

virtual bool getParams ( NamedList & params,
const String & category = String::empty() )
inlinevirtual

Get circuit parameters

Parameters
paramsParameter list to fill from the circuit
categoryOptional category used to select desired parameters
Returns
True if handled

References String::empty().

◆ group() [1/2]

SignallingCircuitGroup * group ( )
inline

Get the group of circuits this one belongs to

Returns
Pointer to circuit group

Referenced by SignallingCircuit(), and SignallingCircuit().

◆ group() [2/2]

const SignallingCircuitGroup * group ( ) const
inline

Get the group of circuits this one belongs to - const version

Returns
Pointer to const circuit group

◆ hwLock()

bool hwLock ( bool set,
bool remote,
bool changed = false,
bool setChanged = false )

Set/reset HW failure lock flag

Parameters
setTrue to set, false to reset the flag
remoteTrue to use remote side of the circuit, false to use the local one
changedSet/reset changed flag. If false the changed flag won't be affected
setChangedThe value of the changed flag. gnored if changed is false
Returns
True if the flag's state changed

◆ locked()

int locked ( int flags = -1) const
inline

Check if the given lock flags are set

Parameters
flagsThe lock flags to check. -1 to check all flags
Returns
The lock flags of this circuit masked by the given flags

◆ lookupStatus()

static const char * lookupStatus ( int status)
static

Get the text associated with a circuit status

Parameters
statusCircuit status used to retrieve the text
Returns
Pointer to the string associated with the given circuit status

References status().

◆ lookupType()

static const char * lookupType ( int type)
static

Get the text associated with a circuit type

Parameters
typeCircuit type used to retrieve the text
Returns
Pointer to the string associated with the given circuit type

References type().

◆ maintLock()

bool maintLock ( bool set,
bool remote,
bool changed = false,
bool setChanged = false )

Set/reset maintenance lock flag

Parameters
setTrue to set, false to reset the flag
remoteTrue to use remote side of the circuit, false to use the local one
changedSet/reset changed flag. If false the changed flag won't be affected
setChangedThe value of the changed flag. gnored if changed is false
Returns
True if the flag's state changed

◆ reserve()

bool reserve ( )
inline

Reserve this circuit for later use

Returns
True if the circuit was changed from Idle to Reserved

References available(), and status().

◆ resetLock()

void resetLock ( int flags)
inline

Reset the given lock flags of this circuit

Parameters
flagsThe lock flags to reset

◆ sendEvent()

virtual bool sendEvent ( SignallingCircuitEvent::Type type,
NamedList * params = 0 )
virtual

Send an event through this circuit

Parameters
typeThe type of the event to send
paramsOptional event parameters
Returns
True on success

References type().

◆ setLock()

void setLock ( int flags)
inline

Set the given lock flags of this circuit

Parameters
flagsThe lock flags to set

◆ setParam()

virtual bool setParam ( const String & param,
const String & value )
inlinevirtual

Set circuit data or trigger some action

Parameters
paramThe data to update or the action to trigger
valueThe data value or action parameter
Returns
True on success

◆ setParams()

virtual bool setParams ( const NamedList & params)
virtual

Set circuit data from a list of parameters

Parameters
paramsParameter list to set in the circuit
Returns
True if all parameters were successfully set

◆ span() [1/2]

SignallingCircuitSpan * span ( )
inline

Get the circuit span this one belongs to

Returns
Pointer to circuit span

Referenced by SignallingCircuit(), and SignallingCircuit().

◆ span() [2/2]

const SignallingCircuitSpan * span ( ) const
inline

Get the circuit span this one belongs to - const version

Returns
Pointer to const circuit span

◆ status() [1/2]

Status status ( ) const
inline

Get the status of this circuit

Returns
Enumerated status of circuit

◆ status() [2/2]

virtual bool status ( Status newStat,
bool sync = false )
inlinevirtual

Initiate a status transition

Parameters
newStatDesired new status
syncSynchronous status change requested
Returns
True if status change has been initiated

Referenced by connect(), disable(), disconnect(), lookupStatus(), SignallingCircuitGroup::release(), reserve(), and SignallingCircuit().

◆ type()

Type type ( ) const
inline

Get the type of this circuit

Returns
Enumerated type of circuit

Referenced by lookupType(), sendEvent(), SignallingCircuit(), and SignallingCircuit().

◆ updateFormat()

virtual bool updateFormat ( const char * format,
int direction )
inlinevirtual

Set the format of the data transported through this circuit

Parameters
formatThe new data format
directionThe direction to be updated. -1 means to the lower layer, 1 from the lower layer, 0 both directions
Returns
True if the operation succeedded (format changed)

Referenced by connect().

Member Data Documentation

◆ m_mutex

Mutex m_mutex
protected

Circuit operations mutex

◆ s_lockNames

const TokenDict s_lockNames[]
static

Keep the lock flags names


The documentation for this class was generated from the following file: