Yate
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends
SignallingCircuit Class Reference

Abstract data circuit used by signalling. More...

#include <yatesig.h>

Inheritance diagram for SignallingCircuit:
RefObject GenObject

List of all members.

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())
SignallingCircuitGroup * group ()
SignallingCircuitSpan * span ()
const SignallingCircuitGroup * group () const
const SignallingCircuitSpan * span () 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)
SignallingCircuitEvent * getEvent (const Time &when)
virtual bool sendEvent (SignallingCircuitEvent::Type type, NamedList *params=0)

Static Public Member Functions

static const char * lookupType (int type)
static const char * lookupStatus (int status)

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 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

enum LockFlags

Lock circuit flags

enum Status

Status of the circuit

enum Type

Type of the circuit hardware or transport


Constructor & Destructor Documentation

virtual ~SignallingCircuit ( ) [virtual]

Destructor. Clear event list

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

Constructor

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

Constructor


Member Function Documentation

void addEvent ( SignallingCircuitEvent *  event)

Add an event to the queue This method is thread safe

Parameters:
eventThe event to enqueue
bool available ( ) const [inline]

Get the available status of the circuit

Returns:
True if the circuit is available for use
virtual void clearEvents ( ) [protected, virtual]

Clear event queue This method is thread safe

unsigned int code ( ) const [inline]

Get the group-local code of this circuit

Returns:
Identification code within group
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
bool connected ( ) const [inline]

Get the connected status of the circuit

Returns:
True if the circuit is connected (in use)
bool disable ( ) [inline]

Disable this circuit for maintenance

Returns:
True if the circuit was changed from Idle to Reserved
bool disconnect ( ) [inline]

Disconnect (set state to Reserved) this circuit if connected

Returns:
True if the circuit was changed from Connected to Reserved
void eventTerminated ( SignallingCircuitEvent *  event) [protected]

Event termination notification

Parameters:
eventThe terminated event
virtual bool getBoolParam ( const String &  param,
bool  defValue = false 
) const [inline, virtual]

Get boolean circuit parameter

Parameters:
paramThe parameter to get
defValueThe default returned value
Returns:
Value from circuit, devValue if the parameter doesn't exist
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
virtual int getIntParam ( const String &  param,
int  defValue = 0 
) const [inline, virtual]

Get integer circuit parameter

Parameters:
paramThe parameter to get
defValueThe default returned value
Returns:
Value from circuit, devValue if the parameter doesn't exist
virtual bool getParam ( const String &  param,
String &  value 
) const [inline, virtual]

Get circuit parameter

Parameters:
paramThe parameter to get
valueThe value of the parameter
Returns:
True on success. False if the parameter doesn't exist
virtual bool getParams ( NamedList &  params,
const String &  category = String::empty() 
) [inline, virtual]

Get circuit parameters

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

Get the group of circuits this one belongs to

Returns:
Pointer to circuit group
const SignallingCircuitGroup* group ( ) const [inline]

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

Returns:
Pointer to const circuit group
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
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
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
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
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
bool reserve ( ) [inline]

Reserve this circuit for later use

Returns:
True if the circuit was changed from Idle to Reserved
void resetLock ( int  flags) [inline]

Reset the given lock flags of this circuit

Parameters:
flagsThe lock flags to reset
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
void setLock ( int  flags) [inline]

Set the given lock flags of this circuit

Parameters:
flagsThe lock flags to set
virtual bool setParam ( const String &  param,
const String &  value 
) [inline, virtual]

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
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
SignallingCircuitSpan* span ( ) [inline]

Get the circuit span this one belongs to

Returns:
Pointer to circuit span
const SignallingCircuitSpan* span ( ) const [inline]

Get the circuit span this one belongs to - const version

Returns:
Pointer to const circuit span
virtual bool status ( Status  newStat,
bool  sync = false 
) [inline, virtual]

Initiate a status transition

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

Referenced by SignallingCircuitGroup::release().

Status status ( ) const [inline]

Get the status of this circuit

Returns:
Enumerated status of circuit
Type type ( ) const [inline]

Get the type of this circuit

Returns:
Enumerated type of circuit
virtual bool updateFormat ( const char *  format,
int  direction 
) [inline, virtual]

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)

Member Data Documentation

Mutex m_mutex [protected]

Circuit operations mutex

Reimplemented from RefObject.

const TokenDict s_lockNames[] [static]

Keep the lock flags names


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