#include <vblasterlid.h>
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 |
Classes | |
class | ByteQueue |
OpalVoipBlasterDevice::OpalVoipBlasterDevice | ( | ) |
Create a new, closed, device for a VoipBlaster device.
OpalVoipBlasterDevice::~OpalVoipBlasterDevice | ( | ) |
Destroy line interface device. This calls Close() on the device.
virtual BOOL OpalVoipBlasterDevice::Open | ( | const PString & | device | ) | [virtual] |
Open the VoIPBlaster device.
device | Device identifier name. |
Implements OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::Close | ( | ) | [virtual] |
Close the VoIPBlaster device.
Reimplemented from OpalLineInterfaceDevice.
virtual PString OpalVoipBlasterDevice::GetName | ( | ) | const [virtual] |
Get the device name.
Implements OpalLineInterfaceDevice.
virtual unsigned OpalVoipBlasterDevice::GetLineCount | ( | ) | [inline, virtual] |
Get the total number of lines supported by this device.
Implements OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::IsLineTerminal | ( | unsigned | ) | [inline, virtual] |
Get the type of the line.
Reimplemented from 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::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).
line | Number of line |
Implements 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.
line | Number of line |
newState | New state to set |
Implements OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::IsLineRinging | ( | unsigned | line, | |
DWORD * | cadence = NULL | |||
) | [virtual] |
Determine if line is ringing.
line | Number of line |
cadence | Cadence of incoming ring |
Reimplemented from 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.
line | Number of line |
cadence | Cadence bit map for ring pattern |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::IsLineDisconnected | ( | unsigned | line, | |
BOOL | checkForWink = TRUE | |||
) | [virtual] |
Determine if line has been disconnected from a call.
line | Number of line |
Reimplemented from OpalLineInterfaceDevice.
BOOL OpalVoipBlasterDevice::SetLineToLineDirect | ( | unsigned | line1, | |
unsigned | line2, | |||
BOOL | connect | |||
) | [virtual] |
Directly connect the two lines.
line1 | Number of first line |
line2 | Number of second line |
connect | Flag for connect/disconnect |
Reimplemented from OpalLineInterfaceDevice.
BOOL OpalVoipBlasterDevice::IsLineToLineDirect | ( | unsigned | line1, | |
unsigned | line2 | |||
) | [virtual] |
Determine if the two lines are directly connected.
line1 | Number of first line |
line2 | Number of second line |
Reimplemented from OpalLineInterfaceDevice.
virtual OpalMediaFormat::List OpalVoipBlasterDevice::GetMediaFormats | ( | ) | const [virtual] |
Get the media formats this device is capable of using.
Implements OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::SetReadFormat | ( | unsigned | line, | |
const OpalMediaFormat & | mediaFormat | |||
) | [virtual] |
Set the VoIPBlaster codec for reading.
line | Number of line |
mediaFormat | Codec type |
Implements OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::SetWriteFormat | ( | unsigned | line, | |
const OpalMediaFormat & | mediaFormat | |||
) | [virtual] |
Set the VoIPBlaster codec for writing.
line | Number of line |
mediaFormat | Codec type |
Implements OpalLineInterfaceDevice.
virtual OpalMediaFormat OpalVoipBlasterDevice::GetReadFormat | ( | unsigned | line | ) | [virtual] |
Get the media format (codec) for reading on the specified line.
line | Number of line |
Implements OpalLineInterfaceDevice.
virtual OpalMediaFormat OpalVoipBlasterDevice::GetWriteFormat | ( | unsigned | line | ) | [virtual] |
Get the media format (codec) for writing on the specified line.
line | Number of line |
Implements 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.
line | Number of line |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::StopRawCodec | ( | unsigned | line | ) | [virtual] |
Stop the raw PCM mode codec.
line | Number of line |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::StopReadCodec | ( | unsigned | line | ) | [virtual] |
virtual BOOL OpalVoipBlasterDevice::StopWriteCodec | ( | unsigned | line | ) | [virtual] |
virtual PINDEX OpalVoipBlasterDevice::GetReadFrameSize | ( | unsigned | line | ) | [virtual] |
Get the read frame size in bytes. All calls to ReadFrame() will return this number of bytes.
line | Number of line |
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 PINDEX OpalVoipBlasterDevice::GetWriteFrameSize | ( | unsigned | line | ) | [virtual] |
Get the write frame size in bytes. All calls to WriteFrame() must be this number of bytes.
line | Number of line |
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::ReadFrame | ( | unsigned | line, | |
void * | buf, | |||
PINDEX & | count | |||
) | [virtual] |
Low level read of a frame from the device.
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::WriteFrame | ( | unsigned | line, | |
const void * | buf, | |||
PINDEX | count, | |||
PINDEX & | written | |||
) | [virtual] |
Low level write frame to the device.
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.
virtual unsigned OpalVoipBlasterDevice::GetAverageSignalLevel | ( | unsigned | line, | |
BOOL | playback | |||
) | [virtual] |
Get average signal level in last frame.
line | Number of line |
playback | Get average playback or record level. |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::EnableAudio | ( | unsigned | line, | |
BOOL | enable = TRUE | |||
) | [virtual] |
Enable audio for the line.
line | Number of line |
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.
line | Number of line |
volume | Volume level from 0 to 100% |
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.
line | Number of line |
volume | Volume level from 0 to 100% |
Reimplemented from 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.
line | Number of line |
volume | Volume level from 0 to 100% |
Reimplemented from 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.
line | Number of line |
volume | Volume level from 0 to 100% |
Reimplemented from OpalLineInterfaceDevice.
AECLevels OpalVoipBlasterDevice::GetAEC | ( | unsigned | line | ) | [virtual] |
Set acoustic echo cancellation.
line | Number of line |
Reimplemented from OpalLineInterfaceDevice.
BOOL OpalVoipBlasterDevice::SetAEC | ( | unsigned | line, | |
AECLevels | level | |||
) | [virtual] |
Set acoustic echo cancellation.
line | Number of line |
level | AEC level |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::GetVAD | ( | unsigned | line | ) | [virtual] |
Get voice activity detection. Note, not all devices, or selected codecs, may support this function.
line | Number of line |
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.
line | Number of line |
enable | Flag for enabling VAD |
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 ('').
line | Number of line |
idString | ID string returned |
full | Get full information in idString |
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.
line | Number of line |
idString | ID string to use |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::SendCallerIDOnCallWaiting | ( | unsigned | line, | |
const PString & | idString | |||
) | [virtual] |
Send Caller ID during call
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
line | Number of line |
Reimplemented from OpalLineInterfaceDevice.
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.
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 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.
line | Number of line |
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().
line | Number of line |
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().
line | Number of line |
removeTones | Flag for removing DTMF tones. |
Reimplemented from OpalLineInterfaceDevice.
virtual unsigned OpalVoipBlasterDevice::IsToneDetected | ( | unsigned | line | ) | [virtual] |
See if a tone is detected.
line | Number of line |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::PlayTone | ( | unsigned | line, | |
CallProgressTones | tone | |||
) | [virtual] |
Play a tone.
line | Number of line |
tone | Tone to be played |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::IsTonePlaying | ( | unsigned | line | ) | [virtual] |
Determine if a tone is still playing
line | Number of line |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalVoipBlasterDevice::StopTone | ( | unsigned | line | ) | [virtual] |
virtual BOOL OpalVoipBlasterDevice::HasHookFlash | ( | unsigned | line | ) | [virtual] |
Return TRUE if a hook flash has been detected
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.
country | COuntry code for device |
Reimplemented from OpalLineInterfaceDevice.
virtual DWORD OpalVoipBlasterDevice::GetSerialNumber | ( | ) | [virtual] |
Get the serial number for the VoIPBlaster card.
static PStringArray OpalVoipBlasterDevice::GetDeviceNames | ( | ) | [static] |
Get all the VoIPBlaster devices.
OpalVoipBlasterDevice::PDECLARE_NOTIFIER | ( | PThread | , | |
OpalVoipBlasterDevice | , | |||
StatusHandler | ||||
) |
entry point for status handler thread
void OpalVoipBlasterDevice::HandleStatus | ( | int | status | ) | [protected] |
PThread* OpalVoipBlasterDevice::statusThread [protected] |
BOOL OpalVoipBlasterDevice::statusRunning [protected] |
BOOL OpalVoipBlasterDevice::hookState [protected] |
BOOL OpalVoipBlasterDevice::headset [protected] |
BOOL OpalVoipBlasterDevice::ringOn [protected] |
BOOL OpalVoipBlasterDevice::firstTime [protected] |
ByteQueue OpalVoipBlasterDevice::dtmfQueue [protected] |
PAdaptiveDelay OpalVoipBlasterDevice::writeDelay [protected] |
PAdaptiveDelay OpalVoipBlasterDevice::readDelay [protected] |
PString OpalVoipBlasterDevice::deviceName [protected] |
PMutex OpalVoipBlasterDevice::readMutex [protected] |
PMutex OpalVoipBlasterDevice::writeMutex [protected] |
BOOL OpalVoipBlasterDevice::readStopped [protected] |
BOOL OpalVoipBlasterDevice::writeStopped [protected] |
PINDEX OpalVoipBlasterDevice::readFrameSize [protected] |
PINDEX OpalVoipBlasterDevice::writeFrameSize [protected] |
PINDEX OpalVoipBlasterDevice::readCodecType [protected] |
PINDEX OpalVoipBlasterDevice::writeCodecType [protected] |
BOOL OpalVoipBlasterDevice::lastHookStatus [protected] |
PMutex OpalVoipBlasterDevice::vbMutex [protected] |
VoipBlasterInterface OpalVoipBlasterDevice::vBlaster [protected] |