class OpalLineInterfaceDevice: public PObject

Line Interface Device abstraction.

Inheritance:


Public Methods

[more] OpalLineInterfaceDevice ()
Construct a new line interface device
[more]virtual BOOL Open ( const PString & device )
Open the line interface device.
[more]virtual BOOL IsOpen () const
Determine if the line interface device is open
[more]virtual BOOL Close ()
Close the line interface device
[more]virtual PString GetName () const
Determine the type of line interface device.
[more]virtual unsigned GetLineCount ()
Get the total number of lines supported by this device
[more]virtual BOOL IsLineTerminal ( unsigned line )
Get the type of the line.
[more]virtual BOOL IsLinePresent ( unsigned line, BOOL force = FALSE )
Determine if a physical line is present on the logical line.
[more]virtual BOOL IsLineOffHook ( unsigned line )
Determine if line is currently off hook.
[more]virtual BOOL SetLineOffHook ( unsigned line, BOOL newState = TRUE )
Set the hook state of the line.
[more]virtual BOOL SetLineOnHook ( unsigned line )
Set the hook state of the line.
[more]virtual BOOL HookFlash ( unsigned line, unsigned flashTime = 200 )
Set the hook state off then straight back on again.
[more]virtual BOOL HasHookFlash (unsigned line)
Return TRUE if a hook flash has been detected
[more]virtual BOOL IsLineRinging ( unsigned line, DWORD * cadence = NULL )
Determine if line is ringing.
[more]virtual BOOL RingLine ( unsigned line, DWORD cadence )
Begin ringing local phone set with specified cadence.
[more]virtual BOOL IsLineDisconnected ( unsigned line, BOOL checkForWink = TRUE )
Determine if line has been disconnected from a call.
[more]virtual BOOL SetLineToLineDirect ( unsigned line1, unsigned line2, BOOL connect )
Directly connect the two lines.
[more]virtual BOOL IsLineToLineDirect ( unsigned line1, unsigned line2 )
Determine if the two lines are directly connected.
[more]virtual OpalMediaFormat::List GetMediaFormats () const
Get the media formats this device is capable of using
[more]virtual BOOL SetReadFormat ( unsigned line, const OpalMediaFormat & mediaFormat )
Set the media format (codec) for reading on the specified line.
[more]virtual BOOL SetWriteFormat ( unsigned line, const OpalMediaFormat & mediaFormat )
Set the media format (codec) for writing on the specified line.
[more]virtual OpalMediaFormat GetReadFormat ( unsigned line )
Get the media format (codec) for reading on the specified line.
[more]virtual OpalMediaFormat GetWriteFormat ( unsigned line )
Get the media format (codec) for writing on the specified line.
[more]virtual BOOL SetReadCodec ( unsigned line, RTP_DataFrame::PayloadTypes codec )
Set the line codec for reading.
[more]virtual BOOL SetWriteCodec ( unsigned line, RTP_DataFrame::PayloadTypes codec )
Set the line codec for writing.
[more]virtual BOOL SetRawCodec ( unsigned line )
Set the line codec for reading/writing raw PCM data.
[more]virtual BOOL StopReadCodec ( unsigned line )
Stop the read codec.
[more]virtual BOOL StopWriteCodec ( unsigned line )
Stop the write codec.
[more]virtual BOOL StopRawCodec ( unsigned line )
Stop the raw PCM mode codec.
[more]virtual BOOL SetReadFrameSize ( unsigned line, PINDEX frameSize )
Set the read frame size in bytes.
[more]virtual BOOL SetWriteFrameSize ( unsigned line, PINDEX frameSize )
Set the write frame size in bytes.
[more]virtual PINDEX GetReadFrameSize ( unsigned line )
Get the read frame size in bytes.
[more]virtual PINDEX GetWriteFrameSize ( unsigned line )
Get the write frame size in bytes.
[more]virtual BOOL ReadFrame ( unsigned line, void * buf, PINDEX & count )
Low level read of a frame from the device.
[more]virtual BOOL WriteFrame ( unsigned line, const void * buf, PINDEX count, PINDEX & written )
Low level write frame to the device.
[more]virtual BOOL ReadBlock ( unsigned line, void * buf, PINDEX count )
High level read of audio data from the device.
[more]virtual BOOL WriteBlock ( unsigned line, const void * buf, PINDEX count )
High level write audio data to the device.
[more]virtual unsigned GetAverageSignalLevel ( unsigned line, BOOL playback )
Get average signal level in last frame.
[more]virtual BOOL EnableAudio ( unsigned line, BOOL enable = TRUE )
Enable audio for the line.
[more]BOOL DisableAudio ( unsigned line )
Disable audio for the line.
[more]virtual BOOL SetRecordVolume ( unsigned line, unsigned volume )
Set volume level for recording.
[more]virtual BOOL SetPlayVolume ( unsigned line, unsigned volume )
Set volume level for playing.
[more]virtual BOOL GetRecordVolume ( unsigned line, unsigned & volume )
Get volume level for recording.
[more]virtual BOOL GetPlayVolume ( unsigned line, unsigned & volume )
Set volume level for playing.
[more]virtual AECLevels GetAEC ( unsigned line )
Get acoustic echo cancellation.
[more]virtual BOOL SetAEC ( unsigned line, AECLevels level )
Set acoustic echo cancellation.
[more]virtual BOOL GetVAD ( unsigned line )
Get voice activity detection.
[more]virtual BOOL SetVAD ( unsigned line, BOOL enable )
Set voice activity detection.
[more]virtual BOOL GetCallerID ( unsigned line, PString & idString, BOOL full = FALSE )
Get Caller ID from the last incoming ring.
[more]virtual BOOL SetCallerID ( unsigned line, const PString & idString )
Set Caller ID for use in next RingLine() call.
[more]virtual BOOL SendCallerIDOnCallWaiting ( unsigned line, const PString & idString )
Send a Caller ID on call waiting command The full data of the caller ID string consists of the number field, the time/date and the name field separated by tabs ('\t').
[more]virtual BOOL SendVisualMessageWaitingIndicator ( unsigned line, BOOL on )
Send a Visual Message Waiting Indicator
[more]virtual BOOL PlayDTMF ( unsigned line, const char * digits, DWORD onTime = DefaultDTMFOnTime, DWORD offTime = DefaultDTMFOffTime )
Play a DTMF digit.
[more]virtual char ReadDTMF ( unsigned line )
Read a DTMF digit detected.
[more]virtual BOOL GetRemoveDTMF ( unsigned line )
Get DTMF removal mode.
[more]virtual BOOL SetRemoveDTMF ( unsigned line, BOOL removeTones )
Set DTMF removal mode.
[more]virtual unsigned IsToneDetected ( unsigned line )
See if any tone is detected.
[more]virtual unsigned WaitForToneDetect ( unsigned line, unsigned timeout = 3000 )
See if any tone is detected.
[more]virtual BOOL WaitForTone ( unsigned line, CallProgressTones tone, unsigned timeout = 3000 )
See if a specific tone is detected.
[more]virtual BOOL SetToneFilter ( unsigned line, CallProgressTones tone, const PString & description )
Set a tones filter information.
[more]virtual BOOL SetToneFilterParameters ( unsigned line, CallProgressTones tone, unsigned lowFrequency, unsigned highFrequency, PINDEX numCadences, const unsigned * onTimes, const unsigned * offTimes )
Set a tones filter information.
[more]virtual BOOL PlayTone ( unsigned line, CallProgressTones tone )
Play a tone.
[more]virtual BOOL IsTonePlaying ( unsigned line )
Determine if a tone is still playing
[more]virtual BOOL StopTone ( unsigned line )
Stop playing a tone.
[more]virtual CallProgressTones DialOut ( unsigned line, const PString & number, BOOL requireTones = FALSE )
Dial a number on network line.
[more]T35CountryCodes GetCountryCode () const
Get the country code set for the device
[more]PString GetCountryCodeName () const
Get the country code set for the device as a string
[more]static PString GetCountryCodeName (T35CountryCodes code)
Get the country code set for the device as a string
[more]virtual BOOL SetCountryCode ( T35CountryCodes country )
Set the country code set for the device.
[more]virtual BOOL SetCountryCodeName ( const PString & countryName )
Set the country code set for the device.
[more]virtual PStringList GetCountryCodeNameList () const
Get the list of countries actually supported by the device
[more]int GetErrorNumber () const
Return number for last error
[more]PString GetErrorText () const
Return text for last error


Documentation

Line Interface Device abstraction. Note all functions in this device abstraction are assumed to be thread atomic.
o OpalLineInterfaceDevice()
Construct a new line interface device

ovirtual BOOL Open( const PString & device )
Open the line interface device.
Parameters:
device - Device identifier name.

ovirtual BOOL IsOpen() const
Determine if the line interface device is open

ovirtual BOOL Close()
Close the line interface device

ovirtual PString GetName() const
Determine the type of line interface device. This is a string indication of the card type for user interface display purposes or device specific control. The device should be as detailed as possible eg "Quicknet LineJACK".

ovirtual unsigned GetLineCount()
Get the total number of lines supported by this device

ovirtual BOOL IsLineTerminal( unsigned line )
Get the type of the line. A "terminal" line is one where a call may terminate. For example a POTS line with a standard telephone handset on it would be a terminal line. The alternative is a "network" line, that is one connected to switched network eg the standard PSTN.
Parameters:
line - Number of line

ovirtual BOOL IsLinePresent( unsigned line, BOOL force = FALSE )
Determine if a physical line is present on the logical line.
Parameters:
line - Number of line
force - Force test, do not optimise

ovirtual BOOL IsLineOffHook( unsigned line )
Determine if line is currently off hook. This function implies that the state is debounced and that a return value of TRUE indicates that the phone is really off hook. That is hook flashes and winks are masked out.
Parameters:
line - Number of line

ovirtual BOOL SetLineOffHook( unsigned line, BOOL newState = TRUE )
Set the hook state of the line. Note that not be possible on a given line, for example a POTS line with a standard telephone handset. The hook state is determined by external hardware and cannot be changed by the software.
Parameters:
line - Number of line
newState - New state to set

ovirtual BOOL SetLineOnHook( unsigned line )
Set the hook state of the line. This is the complement of SetLineOffHook().
Parameters:
line - Number of line

ovirtual BOOL HookFlash( unsigned line, unsigned flashTime = 200 )
Set the hook state off then straight back on again. This will only operate if the line is currently off hook.
Parameters:
line - Number of line
flashTime - Time for hook flash in milliseconds

ovirtual BOOL HasHookFlash(unsigned line)
Return TRUE if a hook flash has been detected

ovirtual BOOL IsLineRinging( unsigned line, DWORD * cadence = NULL )
Determine if line is ringing. This function implies that the state is "debounced" and that a return value of TRUE indicates that the phone is still ringing and it is not simply a pause in the ring cadence.

If cadence is not NULL then it is set with the bit pattern for the incoming ringing. Note that in this case the funtion may take a full sequence to return. If it is NULL it can be assumed that the function will return quickly.

Parameters:
line - Number of line
cadence - Cadence of incoming ring

ovirtual BOOL RingLine( unsigned line, DWORD cadence )
Begin ringing local phone set with specified cadence. If cadence is zero then stops ringing.

Note that not be possible on a given line, for example on a PSTN line the ring state is determined by external hardware and cannot be changed by the software.

Also note that the cadence may be ignored by particular hardware driver so that only the zero or non-zero values are significant.

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

ovirtual BOOL IsLineDisconnected( unsigned line, BOOL checkForWink = TRUE )
Determine if line has been disconnected from a call. This uses the hardware (and country) dependent means for determining
Parameters:
line - Number of line

ovirtual BOOL SetLineToLineDirect( unsigned line1, unsigned line2, BOOL connect )
Directly connect the two lines.
Parameters:
line1 - Number of first line
line2 - Number of second line
connect - Flag for connect/disconnect

ovirtual BOOL IsLineToLineDirect( unsigned line1, unsigned line2 )
Determine if the two lines are directly connected.
Parameters:
line1 - Number of first line
line2 - Number of second line

ovirtual OpalMediaFormat::List GetMediaFormats() const
Get the media formats this device is capable of using

ovirtual BOOL SetReadFormat( unsigned line, const OpalMediaFormat & mediaFormat )
Set the media format (codec) for reading on the specified line.
Parameters:
line - Number of line
mediaFormat - Codec type

ovirtual BOOL SetWriteFormat( unsigned line, const OpalMediaFormat & mediaFormat )
Set the media format (codec) for writing on the specified line.
Parameters:
line - Number of line
mediaFormat - Codec type

ovirtual OpalMediaFormat GetReadFormat( unsigned line )
Get the media format (codec) for reading on the specified line.
Parameters:
line - Number of line

ovirtual OpalMediaFormat GetWriteFormat( unsigned line )
Get the media format (codec) for writing on the specified line.
Parameters:
line - Number of line

ovirtual BOOL SetReadCodec( unsigned line, RTP_DataFrame::PayloadTypes codec )
Set the line codec for reading. Note this function is now deprecated as it could not distinguish between some codec subtypes (eg G.729 and G.729B) or non standard formats. Use the SetReadFormat function instead.

The default behaviour now finds the first OpalMediaFormat with the payload type and uses that.

Parameters:
line - Number of line
codec - Codec type

ovirtual BOOL SetWriteCodec( unsigned line, RTP_DataFrame::PayloadTypes codec )
Set the line codec for writing. Note this function is now deprecated as it could not distinguish between some codec subtypes (eg G.729 and G.729B) or non standard formats. Use the SetReadFormat function instead.
Parameters:
line - Number of line
codec - Codec type

ovirtual BOOL SetRawCodec( unsigned line )
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

ovirtual BOOL StopReadCodec( unsigned line )
Stop the read codec.
Parameters:
line - Number of line

ovirtual BOOL StopWriteCodec( unsigned line )
Stop the write codec.
Parameters:
line - Number of line

ovirtual BOOL StopRawCodec( unsigned line )
Stop the raw PCM mode codec.
Parameters:
line - Number of line

ovirtual BOOL SetReadFrameSize( unsigned line, PINDEX frameSize )
Set the read frame size in bytes. Note that a LID may ignore this value so always use GetReadFrameSize() for I/O.
Parameters:
line - Number of line
frameSize - New frame size

ovirtual BOOL SetWriteFrameSize( unsigned line, PINDEX frameSize )
Set the write frame size in bytes. Note that a LID may ignore this value so always use GetReadFrameSize() for I/O.
Parameters:
line - Number of line
frameSize - New frame size

ovirtual PINDEX GetReadFrameSize( unsigned line )
Get the read frame size in bytes. All calls to ReadFrame() will return this number of bytes.
Parameters:
line - Number of line

ovirtual PINDEX GetWriteFrameSize( unsigned line )
Get the write frame size in bytes. All calls to WriteFrame() must be this number of bytes.
Parameters:
line - Number of line

ovirtual BOOL ReadFrame( unsigned line, void * buf, PINDEX & count )
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()

ovirtual BOOL WriteFrame( unsigned line, const void * buf, PINDEX count, PINDEX & written )
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()

ovirtual BOOL ReadBlock( unsigned line, void * buf, PINDEX count )
High level read of audio data from the device. This version will allow non-integral number of frames to be read.
Parameters:
line - Number of line
buf - Pointer to a block of memory to receive the read bytes.
count - Count of bytes to read.

ovirtual BOOL WriteBlock( unsigned line, const void * buf, PINDEX count )
High level write audio data to the device.
Parameters:
line - Number of line
buf - Pointer to a block of memory to write.
count - Count of bytes to write.

ovirtual unsigned GetAverageSignalLevel( unsigned line, BOOL playback )
Get average signal level in last frame.
Parameters:
line - Number of line
playback - Get average playback or record level.

ovirtual BOOL EnableAudio( unsigned line, BOOL enable = TRUE )
Enable audio for the line.
Parameters:
line - Number of line

oBOOL DisableAudio( unsigned line )
Disable audio for the line.
Parameters:
line - Number of line

ovirtual BOOL SetRecordVolume( unsigned line, unsigned volume )
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%

ovirtual BOOL SetPlayVolume( unsigned line, unsigned volume )
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%

ovirtual BOOL GetRecordVolume( unsigned line, unsigned & volume )
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%

ovirtual BOOL GetPlayVolume( unsigned line, unsigned & volume )
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%

ovirtual AECLevels GetAEC( unsigned line )
Get acoustic echo cancellation. Note, not all devices may support this function.
Parameters:
line - Number of line

ovirtual BOOL SetAEC( unsigned line, AECLevels level )
Set acoustic echo cancellation. Note, not all devices may support this function.
Parameters:
line - Number of line
level - AEC level

ovirtual BOOL GetVAD( unsigned line )
Get voice activity detection. Note, not all devices, or selected codecs, may support this function.
Parameters:
line - Number of line

ovirtual BOOL SetVAD( unsigned line, BOOL enable )
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

ovirtual BOOL GetCallerID( unsigned line, PString & idString, BOOL full = FALSE )
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 ('\t').

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

ovirtual BOOL SetCallerID( unsigned line, const PString & idString )
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 ('\t').

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

ovirtual BOOL SendCallerIDOnCallWaiting( unsigned line, const PString & idString )
Send a Caller ID on call waiting command The full data of the caller ID string consists of the number field, the time/date and the name field separated by tabs ('\t').

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

ovirtual BOOL SendVisualMessageWaitingIndicator( unsigned line, BOOL on )
Send a Visual Message Waiting Indicator
Parameters:
line - Number of line

ovirtual BOOL PlayDTMF( unsigned line, const char * digits, DWORD onTime = DefaultDTMFOnTime, DWORD offTime = DefaultDTMFOffTime )
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

ovirtual char ReadDTMF( unsigned line )
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. Characters E through P indicate the following tones:

E = 800 F = 1000 G = 1250 H = 950 I = 1100 J = 1400 K = 1500 L = 1600 M = 1800 N = 2100 O = 1300 P = 2450

Parameters:
line - Number of line

ovirtual BOOL GetRemoveDTMF( unsigned line )
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

ovirtual BOOL SetRemoveDTMF( unsigned line, BOOL removeTones )
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.

ovirtual unsigned IsToneDetected( unsigned line )
See if any tone is detected.
Parameters:
line - Number of line

ovirtual unsigned WaitForToneDetect( unsigned line, unsigned timeout = 3000 )
See if any tone is detected.
Parameters:
line - Number of line
timeout - Milliseconds to wait for

ovirtual BOOL WaitForTone( unsigned line, CallProgressTones tone, unsigned timeout = 3000 )
See if a specific tone is detected.
Parameters:
line - Number of line
tone - Tone to wait for
timeout - Milliseconds to wait for

ovirtual BOOL SetToneFilter( unsigned line, CallProgressTones tone, const PString & description )
Set a tones filter information. The description string is of the form frequence ':' cadence where frequency is either frequency low '-' high and cadence is mintime ontime '-' offtime ontime '-' offtime '-' ontime '-' offtime examples: 300:0.25 300Hz for minimum 250ms 1100:0.4-0.4 1100Hz with cadence 400ms on, 400ms off 900-1300:1.5 900Hz to 1300Hz for minimum of 1.5 seconds 425:0.4-0.2-0.4-2 425Hz with cadence 400ms on, 400ms off, 400ms on, 2 seconds off
Parameters:
line - Number of line
tone - Tone filter to change
description - Description of filter parameters

ovirtual BOOL SetToneFilterParameters( unsigned line, CallProgressTones tone, unsigned lowFrequency, unsigned highFrequency, PINDEX numCadences, const unsigned * onTimes, const unsigned * offTimes )
Set a tones filter information.
Parameters:
line - Number of line
tone - Tone filter to change
lowFrequency - Low frequency
highFrequency - High frequency
numCadences - Number of cadence times
onTimes - Cadence ON times
offTimes - Cadence OFF times

ovirtual BOOL PlayTone( unsigned line, CallProgressTones tone )
Play a tone.
Parameters:
line - Number of line
tone - Tone to be played

ovirtual BOOL IsTonePlaying( unsigned line )
Determine if a tone is still playing
Parameters:
line - Number of line

ovirtual BOOL StopTone( unsigned line )
Stop playing a tone.
Parameters:
line - Number of line

ovirtual CallProgressTones DialOut( unsigned line, const PString & number, BOOL requireTones = FALSE )
Dial a number on network line. The takes the line off hook, waits for dial tone, and transmits the specified number as DTMF tones.

If the requireTones flag is TRUE the call is aborted of the call progress tones are not detected. Otherwise the call proceeds with short delays while it tries to detect the call progress tones.

The return code indicates the following: DialTone No dial tone detected RingTone Dial was successful BusyTone The remote phone was busy ClearTone Dial failed (usually means rang out) NoTone There was an internal error making the call

Parameters:
line - Number of line
number - Number to dial
requireTones - Require dial/ring tone to be detected

oT35CountryCodes GetCountryCode() const
Get the country code set for the device

oPString GetCountryCodeName() const
Get the country code set for the device as a string

ostatic PString GetCountryCodeName(T35CountryCodes code)
Get the country code set for the device as a string

ovirtual BOOL SetCountryCode( T35CountryCodes country )
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

ovirtual BOOL SetCountryCodeName( const PString & countryName )
Set the country code set for the device.
Parameters:
countryName - COuntry code for device

ovirtual PStringList GetCountryCodeNameList() const
Get the list of countries actually supported by the device

oint GetErrorNumber() const
Return number for last error

oPString GetErrorText() const
Return text for last error


Direct child classes:
OpalVpbDevice
OpalIxJDevice

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.