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, Connected
}
enum  LockFlags {
  LockLocalHWFail = 0x0001, LockLocalMaint = 0x0002, LockLocalHWFailChg = 0x0010, LockLocalMaintChg = 0x0020,
  LockRemoteHWFail = 0x0100, LockRemoteMaint = 0x0200, LockRemoteHWFailChg = 0x1000, LockRemoteMaintChg = 0x2000,
  LockLocal = LockLocalHWFail | LockLocalMaint, LockRemote = LockRemoteHWFail | LockRemoteMaint, LockLocked = LockLocal | LockRemote, 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)

Static Public Member Functions

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

Static Public Attributes

static 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:
event The 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:
format Optional 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:
event The terminated event
virtual bool getBoolParam ( const String param,
bool  defValue = false 
) const [inline, virtual]

Get boolean circuit parameter

Parameters:
param The parameter to get
defValue The 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:
when The 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:
param The parameter to get
defValue The 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:
param The parameter to get
value The 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:
params Parameter list to fill from the circuit
category Optional category used to select desired parameters
Returns:
True if handled
const SignallingCircuitGroup* group (  )  const [inline]

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

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

Get the group of circuits this one belongs to

Returns:
Pointer to circuit group
bool hwLock ( bool  set,
bool  remote,
bool  changed = false,
bool  setChanged = false 
)

Set/reset HW failure lock flag

Parameters:
set True to set, false to reset the flag
remote True to use remote side of the circuit, false to use the local one
changed Set/reset changed flag. If false the changed flag won't be affected
setChanged The 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:
flags The 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:
status Circuit status used to retrive 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:
type Circuit type used to retrive 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:
set True to set, false to reset the flag
remote True to use remote side of the circuit, false to use the local one
changed Set/reset changed flag. If false the changed flag won't be affected
setChanged The 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:
flags The lock flags to reset
virtual bool sendEvent ( SignallingCircuitEvent::Type  type,
NamedList params = 0 
) [virtual]

Send an event through this circuit

Parameters:
type The type of the event to send
params Optional event parameters
Returns:
True on success
void setLock ( int  flags  )  [inline]

Set the given lock flags of this circuit

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

Set circuit data or trigger some action

Parameters:
param The data to update or the action to trigger
value The 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:
params Parameter list to set in the circuit
Returns:
True if all parameters were succesfully set
const SignallingCircuitSpan* span (  )  const [inline]

Get the circuit span this one belongs to - const version

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

Get the circuit span this one belongs to

Returns:
Pointer to circuit span
Status status (  )  const [inline]

Get the status of this circuit

Returns:
Enumerated status of circuit
virtual bool status ( Status  newStat,
bool  sync = false 
) [inline, virtual]

Initiate a status transition

Parameters:
newStat Desired new status
sync Synchronous status change requested
Returns:
True if status change has been initiated

Referenced by SignallingCircuitGroup::release().

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:
format The new data format
direction The 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

TokenDict s_lockNames[] [static]

Keep the lock flags names


The documentation for this class was generated from the following file:
Generated on Thu Apr 8 18:22:40 2010 for Yate by  doxygen 1.6.3