OpenH323 1.18.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
OpalVoipBlasterDevice Class Reference

#include <vblasterlid.h>

Inheritance diagram for OpalVoipBlasterDevice:
OpalLineInterfaceDevice

List of all members.

Classes

class  ByteQueue

Public Types

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

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:
lineNumber of line

Reimplemented from OpalLineInterfaceDevice.

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

Set acoustic echo cancellation.

Parameters:
lineNumber of line

Reimplemented from OpalLineInterfaceDevice.

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

Get average signal level in last frame.

Parameters:
lineNumber of line
playbackGet 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:
lineNumber of line
idStringID string returned
fullGet 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:
lineNumber of line
volumeVolume 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:
lineNumber 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:
lineNumber 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:
lineNumber of line
volumeVolume 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:
lineNumber 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:
lineNumber of line

Reimplemented from OpalLineInterfaceDevice.

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

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

Parameters:
lineNumber 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:
lineNumber 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:
lineNumber 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:
lineNumber 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:
lineNumber of line
cadenceCadence 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:
line1Number of first line
line2Number of second line

Reimplemented from OpalLineInterfaceDevice.

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

See if a tone is detected.

Parameters:
lineNumber of line

Reimplemented from OpalLineInterfaceDevice.

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

Determine if a tone is still playing

Parameters:
lineNumber of line

Reimplemented from OpalLineInterfaceDevice.

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

Open the VoIPBlaster device.

Parameters:
deviceDevice 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:
lineNumber of line
digitsDTMF digits to be played
onTimeNumber of milliseconds to play each DTMF digit
offTimeNumber of milliseconds between digits

Reimplemented from OpalLineInterfaceDevice.

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

Play a tone.

Parameters:
lineNumber of line
toneTone to be played

Reimplemented from OpalLineInterfaceDevice.

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 ('\0') character indicates that there are no tones in the queue.

Parameters:
lineNumber 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:
lineNumber of line
bufPointer to a block of memory to receive data.
countNumber 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:
lineNumber of line
cadenceCadence bit map for ring pattern

Reimplemented from OpalLineInterfaceDevice.

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

Send Caller ID during call

Parameters:
lineNumber of line
idStringID string to use

Reimplemented from OpalLineInterfaceDevice.

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

Send a Visual Message Waiting Indicator

Parameters:
lineNumber of line

Reimplemented from OpalLineInterfaceDevice.

BOOL OpalVoipBlasterDevice::SetAEC ( unsigned  line,
AECLevels  level 
) [virtual]

Set acoustic echo cancellation.

Parameters:
lineNumber of line
levelAEC level

Reimplemented from OpalLineInterfaceDevice.

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:
lineNumber of line
idStringID 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:
countryCOuntry code for device

Reimplemented from OpalLineInterfaceDevice.

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:
lineNumber of line
newStateNew state to set

Implements OpalLineInterfaceDevice.

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

Directly connect the two lines.

Parameters:
line1Number of first line
line2Number of second line
connectFlag 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:
lineNumber of line
volumeVolume 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:
lineNumber of line

Reimplemented from OpalLineInterfaceDevice.

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

Set the VoIPBlaster codec for reading.

Parameters:
lineNumber of line
mediaFormatCodec type

Implements OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SetReadFrameSize ( unsigned  line,
PINDEX  frameSize 
) [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:
lineNumber of line
volumeVolume 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:
lineNumber of line
removeTonesFlag 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:
lineNumber of line
enableFlag for enabling VAD

Reimplemented from OpalLineInterfaceDevice.

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

Set the VoIPBlaster codec for writing.

Parameters:
lineNumber of line
mediaFormatCodec type

Implements OpalLineInterfaceDevice.

virtual BOOL OpalVoipBlasterDevice::SetWriteFrameSize ( unsigned  line,
PINDEX  frameSize 
) [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:
lineNumber of line

Reimplemented from OpalLineInterfaceDevice.

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

Stop the read codec.

Parameters:
lineNumber of line

Reimplemented from OpalLineInterfaceDevice.

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

Stop playing a tone.

Parameters:
lineNumber of line

Reimplemented from OpalLineInterfaceDevice.

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

Stop the write codec.

Parameters:
lineNumber 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:
lineNumber of line
bufPointer to a block of memory to write.
countNumber of bytes to write, <= GetWriteFrameSize()
writtenNumber of bytes written, <= GetWriteFrameSize()

Implements OpalLineInterfaceDevice.


Member Data Documentation

PString OpalVoipBlasterDevice::deviceName [protected]
PAdaptiveDelay OpalVoipBlasterDevice::readDelay [protected]
PMutex OpalVoipBlasterDevice::vbMutex [protected]
PAdaptiveDelay OpalVoipBlasterDevice::writeDelay [protected]

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