OpalVoipBlasterDevice Class Reference

#include <vblasterlid.h>

Inheritance diagram for OpalVoipBlasterDevice:

OpalLineInterfaceDevice List of all members.

Public Types

 DTMFQueueSize = 10
enum  { DTMFQueueSize = 10 }

Public Member Functions

 OpalVoipBlasterDevice ()
 ~OpalVoipBlasterDevice ()
virtual BOOL Open (const PString &device)
virtual BOOL Close ()
virtual PString GetName () const
virtual unsigned GetLineCount ()
virtual BOOL IsLineTerminal (unsigned)
virtual BOOL IsLinePresent (unsigned, BOOL=FALSE)
virtual BOOL IsLineOffHook (unsigned line)
virtual BOOL SetLineOffHook (unsigned line, BOOL newState=TRUE)
virtual BOOL IsLineRinging (unsigned line, DWORD *cadence=NULL)
virtual BOOL RingLine (unsigned line, DWORD cadence)
virtual BOOL IsLineDisconnected (unsigned line, BOOL checkForWink=TRUE)
BOOL SetLineToLineDirect (unsigned line1, unsigned line2, BOOL connect)
BOOL IsLineToLineDirect (unsigned line1, unsigned line2)
virtual OpalMediaFormat::List GetMediaFormats () const
virtual BOOL SetReadFormat (unsigned line, const OpalMediaFormat &mediaFormat)
virtual BOOL SetWriteFormat (unsigned line, const OpalMediaFormat &mediaFormat)
virtual OpalMediaFormat GetReadFormat (unsigned line)
virtual OpalMediaFormat GetWriteFormat (unsigned line)
virtual BOOL SetRawCodec (unsigned line)
virtual BOOL StopRawCodec (unsigned line)
virtual BOOL StopReadCodec (unsigned line)
virtual BOOL StopWriteCodec (unsigned line)
virtual PINDEX GetReadFrameSize (unsigned line)
virtual BOOL SetReadFrameSize (unsigned, PINDEX)
virtual PINDEX GetWriteFrameSize (unsigned line)
virtual BOOL SetWriteFrameSize (unsigned, PINDEX)
virtual BOOL ReadFrame (unsigned line, void *buf, PINDEX &count)
virtual BOOL WriteFrame (unsigned line, const void *buf, PINDEX count, PINDEX &written)
virtual unsigned GetAverageSignalLevel (unsigned line, BOOL playback)
virtual BOOL EnableAudio (unsigned line, BOOL enable=TRUE)
virtual BOOL SetRecordVolume (unsigned line, unsigned volume)
virtual BOOL SetPlayVolume (unsigned line, unsigned volume)
virtual BOOL GetRecordVolume (unsigned line, unsigned &volume)
virtual BOOL GetPlayVolume (unsigned line, unsigned &volume)
AECLevels GetAEC (unsigned line)
BOOL SetAEC (unsigned line, AECLevels level)
virtual BOOL GetVAD (unsigned line)
virtual BOOL SetVAD (unsigned line, BOOL enable)
virtual BOOL GetCallerID (unsigned line, PString &idString, BOOL full=FALSE)
virtual BOOL SetCallerID (unsigned line, const PString &idString)
virtual BOOL SendCallerIDOnCallWaiting (unsigned line, const PString &idString)
virtual BOOL SendVisualMessageWaitingIndicator (unsigned line, BOOL on)
virtual BOOL PlayDTMF (unsigned line, const char *digits, DWORD onTime=DefaultDTMFOnTime, DWORD offTime=DefaultDTMFOffTime)
virtual char ReadDTMF (unsigned line)
virtual BOOL GetRemoveDTMF (unsigned line)
virtual BOOL SetRemoveDTMF (unsigned line, BOOL removeTones)
virtual unsigned IsToneDetected (unsigned line)
virtual BOOL PlayTone (unsigned line, CallProgressTones tone)
virtual BOOL IsTonePlaying (unsigned line)
virtual BOOL StopTone (unsigned line)
virtual BOOL HasHookFlash (unsigned line)
virtual BOOL SetCountryCode (T35CountryCodes country)
virtual DWORD GetSerialNumber ()
 PDECLARE_NOTIFIER (PThread, OpalVoipBlasterDevice, StatusHandler)

Static Public Member Functions

static PStringArray GetDeviceNames ()

Protected Member Functions

void HandleStatus (int status)

Protected Attributes

PThread * statusThread
BOOL statusRunning
BOOL hookState
BOOL headset
BOOL ringOn
BOOL firstTime
ByteQueue dtmfQueue
PAdaptiveDelay writeDelay
PAdaptiveDelay readDelay
PString deviceName
PMutex readMutex
PMutex writeMutex
BOOL readStopped
BOOL writeStopped
PINDEX readFrameSize
PINDEX writeFrameSize
PINDEX readCodecType
PINDEX writeCodecType
BOOL lastHookStatus
PMutex vbMutex
VoipBlasterInterface vBlaster

Classes

class  ByteQueue

Detailed Description

This class describes the VoIPBlaster line interface device.


Member Enumeration Documentation

anonymous enum

Enumerator:
DTMFQueueSize 


Constructor & Destructor Documentation

OpalVoipBlasterDevice::OpalVoipBlasterDevice (  ) 

Create a new, closed, device for a VoipBlaster device.

OpalVoipBlasterDevice::~OpalVoipBlasterDevice (  ) 

Destroy line interface device. This calls Close() on the device.


Member Function Documentation

virtual BOOL OpalVoipBlasterDevice::Close (  )  [virtual]

Close the VoIPBlaster device.

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::EnableAudio ( unsigned  line,
BOOL  enable = TRUE 
) [virtual]

Enable audio for the line.

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

AECLevels OpalVoipBlasterDevice::GetAEC ( unsigned  line  )  [virtual]

Set acoustic echo cancellation.

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

virtual unsigned OpalVoipBlasterDevice::GetAverageSignalLevel ( unsigned  line,
BOOL  playback 
) [virtual]

Get average signal level in last frame.

Parameters:
line  Number of line
playback  Get average playback or record level.

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::GetCallerID ( unsigned  line,
PString &  idString,
BOOL  full = FALSE 
) [virtual]

Get Caller ID from the last incoming ring. The idString parameter is either simply the "number" field of the caller ID data, or if full is TRUE, all of the fields in the caller ID data.

The full data of the caller ID string consists of the number field, the time/date and the name field separated by tabs ('').

Parameters:
line  Number of line
idString  ID string returned
full  Get full information in idString

Reimplemented from OpalLineInterfaceDevice.

static PStringArray OpalVoipBlasterDevice::GetDeviceNames (  )  [static]

Get all the VoIPBlaster devices.

virtual unsigned OpalVoipBlasterDevice::GetLineCount (  )  [inline, virtual]

Get the total number of lines supported by this device.

Implements OpalLineInterfaceDevice.

virtual OpalMediaFormat::List OpalVoipBlasterDevice::GetMediaFormats (  )  const [virtual]

Get the media formats this device is capable of using.

Implements OpalLineInterfaceDevice.

virtual PString OpalVoipBlasterDevice::GetName (  )  const [virtual]

Get the device name.

Implements OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::GetPlayVolume ( unsigned  line,
unsigned &  volume 
) [virtual]

Set volume level for playing. A value of 100 is the maximum volume possible for the hardware. A value of 0 is the minimum volume possible for the hardware.

Parameters:
line  Number of line
volume  Volume level from 0 to 100%

Reimplemented from OpalLineInterfaceDevice.

virtual OpalMediaFormat OpalVoipBlasterDevice::GetReadFormat ( unsigned  line  )  [virtual]

Get the media format (codec) for reading on the specified line.

Parameters:
line  Number of line

Implements OpalLineInterfaceDevice.

virtual PINDEX OpalVoipBlasterDevice::GetReadFrameSize ( unsigned  line  )  [virtual]

Get the read frame size in bytes. All calls to ReadFrame() will return this number of bytes.

Parameters:
line  Number of line

Implements OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::GetRecordVolume ( unsigned  line,
unsigned &  volume 
) [virtual]

Get volume level for recording. A value of 100 is the maximum volume possible for the hardware. A value of 0 is the minimum volume possible for the hardware.

Parameters:
line  Number of line
volume  Volume level from 0 to 100%

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::GetRemoveDTMF ( unsigned  line  )  [virtual]

Get DTMF removal mode. When set in this mode the DTMF tones detected are removed from the encoded data stream as returned by ReadFrame().

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

virtual DWORD OpalVoipBlasterDevice::GetSerialNumber (  )  [virtual]

Get the serial number for the VoIPBlaster card.

virtual BOOL OpalVoipBlasterDevice::GetVAD ( unsigned  line  )  [virtual]

Get voice activity detection. Note, not all devices, or selected codecs, may support this function.

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

virtual OpalMediaFormat OpalVoipBlasterDevice::GetWriteFormat ( unsigned  line  )  [virtual]

Get the media format (codec) for writing on the specified line.

Parameters:
line  Number of line

Implements OpalLineInterfaceDevice.

virtual PINDEX OpalVoipBlasterDevice::GetWriteFrameSize ( unsigned  line  )  [virtual]

Get the write frame size in bytes. All calls to WriteFrame() must be this number of bytes.

Parameters:
line  Number of line

Implements OpalLineInterfaceDevice.

void OpalVoipBlasterDevice::HandleStatus ( int  status  )  [protected]

virtual BOOL OpalVoipBlasterDevice::HasHookFlash ( unsigned  line  )  [virtual]

Return TRUE if a hook flash has been detected

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::IsLineDisconnected ( unsigned  line,
BOOL  checkForWink = TRUE 
) [virtual]

Determine if line has been disconnected from a call.

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::IsLineOffHook ( unsigned  line  )  [virtual]

Determine if line is currently off hook. This returns TRUE if GetLineState() is a state that implies the line is off hook (eg OffHook or LineBusy).

Parameters:
line  Number of line

Implements OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::IsLinePresent ( unsigned  ,
BOOL  = FALSE 
) [inline, virtual]

Determine if a physical line is present on the logical line.

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::IsLineRinging ( unsigned  line,
DWORD *  cadence = NULL 
) [virtual]

Determine if line is ringing.

Parameters:
line  Number of line
cadence  Cadence of incoming ring

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::IsLineTerminal ( unsigned   )  [inline, virtual]

Get the type of the line.

Reimplemented from OpalLineInterfaceDevice.

BOOL OpalVoipBlasterDevice::IsLineToLineDirect ( unsigned  line1,
unsigned  line2 
) [virtual]

Determine if the two lines are directly connected.

Parameters:
line1  Number of first line
line2  Number of second line

Reimplemented from OpalLineInterfaceDevice.

virtual unsigned OpalVoipBlasterDevice::IsToneDetected ( unsigned  line  )  [virtual]

See if a tone is detected.

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::IsTonePlaying ( unsigned  line  )  [virtual]

Determine if a tone is still playing

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::Open ( const PString &  device  )  [virtual]

Open the VoIPBlaster device.

Parameters:
device  Device identifier name.

Implements OpalLineInterfaceDevice.

OpalVoipBlasterDevice::PDECLARE_NOTIFIER ( PThread  ,
OpalVoipBlasterDevice  ,
StatusHandler   
)

entry point for status handler thread

virtual BOOL OpalVoipBlasterDevice::PlayDTMF ( unsigned  line,
const char *  digits,
DWORD  onTime = DefaultDTMFOnTime,
DWORD  offTime = DefaultDTMFOffTime 
) [virtual]

Play a DTMF digit. Any characters that are not in the set 0-9, A-D, * or # will be ignored.

Parameters:
line  Number of line
digits  DTMF digits to be played
onTime  Number of milliseconds to play each DTMF digit
offTime  Number of milliseconds between digits

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::PlayTone ( unsigned  line,
CallProgressTones  tone 
) [virtual]

Play a tone.

Parameters:
line  Number of line
tone  Tone to be played

virtual char OpalVoipBlasterDevice::ReadDTMF ( unsigned  line  )  [virtual]

Read a DTMF digit detected. This may be characters from the set 0-9, A-D, * or #. A null ('') character indicates that there are no tones in the queue.

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::ReadFrame ( unsigned  line,
void *  buf,
PINDEX &  count 
) [virtual]

Low level read of a frame from the device.

Parameters:
line  Number of line
buf  Pointer to a block of memory to receive data.
count  Number of bytes read, <= GetReadFrameSize()

Implements OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::RingLine ( unsigned  line,
DWORD  cadence 
) [virtual]

Begin ringing local phone set with specified cadence. If cadence is zero then stops ringing.

Parameters:
line  Number of line
cadence  Cadence bit map for ring pattern

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SendCallerIDOnCallWaiting ( unsigned  line,
const PString &  idString 
) [virtual]

Send Caller ID during call

Parameters:
line  Number of line
idString  ID string to use

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SendVisualMessageWaitingIndicator ( unsigned  line,
BOOL  on 
) [virtual]

Send a Visual Message Waiting Indicator

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

BOOL OpalVoipBlasterDevice::SetAEC ( unsigned  line,
AECLevels  level 
)

Set acoustic echo cancellation.

Parameters:
line  Number of line
level  AEC level

virtual BOOL OpalVoipBlasterDevice::SetCallerID ( unsigned  line,
const PString &  idString 
) [virtual]

Set Caller ID for use in next RingLine() call. The full data of the caller ID string consists of the number field, the time/date and the name field separated by tabs ('').

If the date field is missing (two consecutive tabs) then the current time and date is used. Using an empty string will clear the caller ID so that no caller ID is sent on the next RingLine() call.

Parameters:
line  Number of line
idString  ID string to use

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SetCountryCode ( T35CountryCodes  country  )  [virtual]

Set the country code set for the device. This may change the line analogue coefficients, ring detect, call disconnect detect and call progress tones to fit the countries telephone network.

Parameters:
country  COuntry code for device

virtual BOOL OpalVoipBlasterDevice::SetLineOffHook ( unsigned  line,
BOOL  newState = TRUE 
) [virtual]

Set the state of the line. Note that not be possible on a given line.

Parameters:
line  Number of line
newState  New state to set

Implements OpalLineInterfaceDevice.

BOOL OpalVoipBlasterDevice::SetLineToLineDirect ( unsigned  line1,
unsigned  line2,
BOOL  connect 
) [virtual]

Directly connect the two lines.

Parameters:
line1  Number of first line
line2  Number of second line
connect  Flag for connect/disconnect

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SetPlayVolume ( unsigned  line,
unsigned  volume 
) [virtual]

Set volume level for playing. A value of 100 is the maximum volume possible for the hardware. A value of 0 is the minimum volume possible for the hardware.

Parameters:
line  Number of line
volume  Volume level from 0 to 100%

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SetRawCodec ( unsigned  line  )  [virtual]

Set the line codec for reading/writing raw PCM data. A descendent may use this to do anything special to the device before beginning special PCM output. For example disabling AEC and set volume levels to standard values. This can then be used for generating standard tones using PCM if the driver is not capable of generating or detecting them directly.

The default behaviour simply does a SetReadCodec and SetWriteCodec for PCM data.

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SetReadFormat ( unsigned  line,
const OpalMediaFormat mediaFormat 
) [virtual]

Set the VoIPBlaster codec for reading.

Parameters:
line  Number of line
mediaFormat  Codec type

Implements OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SetReadFrameSize ( unsigned  ,
PINDEX   
) [virtual]

Set the read frame size in bytes. Note that a LID may ignore this value so always use GetReadFrameSize() for I/O.

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SetRecordVolume ( unsigned  line,
unsigned  volume 
) [virtual]

Set volume level for recording. A value of 100 is the maximum volume possible for the hardware. A value of 0 is the minimum volume possible for the hardware.

Parameters:
line  Number of line
volume  Volume level from 0 to 100%

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SetRemoveDTMF ( unsigned  line,
BOOL  removeTones 
) [virtual]

Set DTMF removal mode. When set in this mode the DTMF tones detected are removed from the encoded data stream as returned by ReadFrame().

Parameters:
line  Number of line
removeTones  Flag for removing DTMF tones.

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SetVAD ( unsigned  line,
BOOL  enable 
) [virtual]

Set voice activity detection. Note, not all devices, or selected codecs, may support this function.

Parameters:
line  Number of line
enable  Flag for enabling VAD

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SetWriteFormat ( unsigned  line,
const OpalMediaFormat mediaFormat 
) [virtual]

Set the VoIPBlaster codec for writing.

Parameters:
line  Number of line
mediaFormat  Codec type

Implements OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SetWriteFrameSize ( unsigned  ,
PINDEX   
) [virtual]

Set the write frame size in bytes. Note that a LID may ignore this value so always use GetReadFrameSize() for I/O.

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::StopRawCodec ( unsigned  line  )  [virtual]

Stop the raw PCM mode codec.

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::StopReadCodec ( unsigned  line  )  [virtual]

Stop the read codec.

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::StopTone ( unsigned  line  )  [virtual]

Stop playing a tone.

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::StopWriteCodec ( unsigned  line  )  [virtual]

Stop the write codec.

Parameters:
line  Number of line

Reimplemented from OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::WriteFrame ( unsigned  line,
const void *  buf,
PINDEX  count,
PINDEX &  written 
) [virtual]

Low level write frame to the device.

Parameters:
line  Number of line
buf  Pointer to a block of memory to write.
count  Number of bytes to write, <= GetWriteFrameSize()
written  Number of bytes written, <= GetWriteFrameSize()

Implements OpalLineInterfaceDevice.


Member Data Documentation

PString OpalVoipBlasterDevice::deviceName [protected]

ByteQueue OpalVoipBlasterDevice::dtmfQueue [protected]

BOOL OpalVoipBlasterDevice::firstTime [protected]

BOOL OpalVoipBlasterDevice::headset [protected]

BOOL OpalVoipBlasterDevice::hookState [protected]

BOOL OpalVoipBlasterDevice::lastHookStatus [protected]

PINDEX OpalVoipBlasterDevice::readCodecType [protected]

PAdaptiveDelay OpalVoipBlasterDevice::readDelay [protected]

PINDEX OpalVoipBlasterDevice::readFrameSize [protected]

PMutex OpalVoipBlasterDevice::readMutex [protected]

BOOL OpalVoipBlasterDevice::readStopped [protected]

BOOL OpalVoipBlasterDevice::ringOn [protected]

BOOL OpalVoipBlasterDevice::statusRunning [protected]

PThread* OpalVoipBlasterDevice::statusThread [protected]

VoipBlasterInterface OpalVoipBlasterDevice::vBlaster [protected]

PMutex OpalVoipBlasterDevice::vbMutex [protected]

PINDEX OpalVoipBlasterDevice::writeCodecType [protected]

PAdaptiveDelay OpalVoipBlasterDevice::writeDelay [protected]

PINDEX OpalVoipBlasterDevice::writeFrameSize [protected]

PMutex OpalVoipBlasterDevice::writeMutex [protected]

BOOL OpalVoipBlasterDevice::writeStopped [protected]


The documentation for this class was generated from the following file:
Generated on Sat Sep 23 04:16:57 2006 for OpenH323 by  doxygen 1.4.7