#include <opalusbdevice.h>
Public Types | |
enum | { POTSLine, PSTNLine, NumLines } |
Public Member Functions | |
OpalUSBDevice () | |
OpalUSBDevice (PluginHID_Definition *hid) | |
~OpalUSBDevice () | |
virtual BOOL | Open (const PString &device) |
virtual BOOL | IsOpen () const |
virtual BOOL | Close () |
virtual PString | GetName () const |
virtual BOOL | IsLineTerminal (unsigned line) |
virtual BOOL | IsLinePresent (unsigned line, BOOL force=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) |
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 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) |
virtual BOOL | PlayDTMF (unsigned line, const char *digits, DWORD onTime=DefaultDTMFOnTime, DWORD offTime=DefaultDTMFOffTime) |
virtual char | ReadDTMF (unsigned line) |
virtual BOOL | PlayTone (unsigned line, CallProgressTones tone) |
virtual BOOL | IsTonePlaying (unsigned line) |
virtual BOOL | StopTone (unsigned line) |
virtual BOOL | GetCallerID (unsigned line, PString &idString, BOOL full=FALSE) |
virtual BOOL | SetCallerID (unsigned line, const PString &idString) |
virtual unsigned | GetLineCount () |
virtual OpalMediaFormat::List | GetMediaFormats () const |
virtual BOOL | SetReadFormat (unsigned line, const OpalMediaFormat &mediaFormat) |
virtual | SetWriteFormat (unsigned line, const OpalMediaFormat &mediaFormat) |
virtual OpalMediaFormat | GetReadFormat (unsigned line) |
virtual OpalMediaFormat | GetWriteFormat (unsigned line) |
virtual BOOL | StopReadCodec (unsigned line) |
virtual BOOL | StopWriteCodec (unsigned line) |
virtual OpalLineInterfaceDevice::DeviceType | GetDeviceType () |
Public Attributes | |
PString | soundDev |
BOOL | exitTone |
Sound DeviceName. | |
Protected Member Functions | |
void | InterpretInput (unsigned int ret) |
Exit Tone Thread Flag. | |
BOOL | CreateSoundDevice (BOOL IsEncoder, const PString &device, PINDEX rate=8000, PINDEX samples=1) |
unsigned int | InvokeMessage (unsigned msg, unsigned val=0) |
PDECLARE_NOTIFIER (PThread, OpalUSBDevice, Monitor) | |
Poll wait. | |
PDECLARE_NOTIFIER (PThread, OpalUSBDevice, TonePlay) | |
Tone Thread. | |
Protected Attributes | |
OpalMediaFormat | MediaFormat |
PluginHID_Definition * | HID |
PThread * | MonitorThread |
HID Definition from the Plugin. | |
PSyncPoint | monitorTickle |
Monitor Thread. | |
BOOL | exitFlag |
Declaration of the Thread. | |
BOOL | PluggedIn |
Exit Thread Monitor Flag. | |
unsigned int | InputData |
Device plugged in. | |
PString | digitbuffer |
Data sent to the USB Phone. | |
BOOL | OffHookState |
Digit Buffer from USB Phone. | |
BOOL | isRinging |
Hook state. | |
BOOL | useSound |
Whether the device is ringing. | |
PSoundChannel * | RecSound |
Flag to specify is Regular Sound device. | |
PSoundChannel * | PlaySound |
Sound Record Channel. | |
PINDEX | soundChannelBuffers |
Sound Play Channel. | |
PINDEX | vol |
Sound Channel Buffers. | |
BOOL | useTones |
Current Speaker volume. | |
CallProgressTones | CurTone |
Tones required. | |
PThread * | ToneThread |
Current Tone to Play. | |
PMutex | vbMutex |
Declaration of the ToneThread. | |
BOOL | hasPSTN |
Mute. | |
BOOL | isCell |
Classes | |
class | SoundTones |
OpalUSBDevice::OpalUSBDevice | ( | ) |
Create a new, closed, device for a USB Hardware device.
OpalUSBDevice::OpalUSBDevice | ( | PluginHID_Definition * | hid | ) |
OpalUSBDevice::~OpalUSBDevice | ( | ) | [inline] |
virtual BOOL OpalUSBDevice::Open | ( | const PString & | device | ) | [virtual] |
Open and detect USB device.
device | Device identifier name. |
Implements OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::IsOpen | ( | ) | const [virtual] |
Determine if the line interface device is plugged in.
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::Close | ( | ) | [virtual] |
Close the USB device.
Reimplemented from OpalLineInterfaceDevice.
virtual PString OpalUSBDevice::GetName | ( | ) | const [virtual] |
Get the device name.
Implements OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::IsLineTerminal | ( | unsigned | line | ) | [virtual] |
Get the type of the line.
line | Number of line |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::IsLinePresent | ( | unsigned | line, | |
BOOL | force = FALSE | |||
) | [virtual] |
Determine if a physical line is present on the logical line.
force | Number of line Force test, do not optimise |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::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 OpalUSBDevice::SetLineOffHook | ( | unsigned | line, | |
BOOL | newState = TRUE | |||
) | [virtual] |
Set the state of the line. Note that not be possible on a given line.
newState | Number of line New state to set |
Implements OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::IsLineRinging | ( | unsigned | line, | |
DWORD * | cadence = NULL | |||
) | [virtual] |
Determine if line is ringing.
cadence | Number of line Cadence of incoming ring |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::RingLine | ( | unsigned | line, | |
DWORD | cadence | |||
) | [virtual] |
Begin ringing local phone set with specified cadence. If cadence is zero then stops ringing.
cadence | Number of line Cadence bit map for ring pattern |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::IsLineDisconnected | ( | unsigned | line, | |
BOOL | checkForWink = TRUE | |||
) | [virtual] |
Determine if line has been disconnected from a call.
checkForWink | Number of line |
Reimplemented from OpalLineInterfaceDevice.
virtual PINDEX OpalUSBDevice::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 OpalUSBDevice::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 OpalUSBDevice::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 OpalUSBDevice::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 OpalUSBDevice::ReadFrame | ( | unsigned | line, | |
void * | buf, | |||
PINDEX & | count | |||
) | [virtual] |
Low level read of a frame from the device.
buf | Number of line |
count | Pointer to a block of memory to receive data. Number of bytes read, <= GetReadFrameSize() |
Implements OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::WriteFrame | ( | unsigned | line, | |
const void * | buf, | |||
PINDEX | count, | |||
PINDEX & | written | |||
) | [virtual] |
Low level write frame to the device.
buf | Number of line |
count | Pointer to a block of memory to write. |
written | Number of bytes to write, <= GetWriteFrameSize() Number of bytes written, <= GetWriteFrameSize() |
Implements OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::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.
volume | Number of line Volume level from 0 to 100% |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::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.
volume | Number of line Volume level from 0 to 100% |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::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.
volume | Number of line Volume level from 0 to 100% |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::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.
volume | Number of line Volume level from 0 to 100% |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::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.
digits | Number of line |
onTime | DTMF digits to be played |
offTime | Number of milliseconds to play each DTMF digit Number of milliseconds between digits |
Reimplemented from OpalLineInterfaceDevice.
virtual char OpalUSBDevice::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 OpalUSBDevice::PlayTone | ( | unsigned | line, | |
CallProgressTones | tone | |||
) | [virtual] |
Play a tone.
tone | Number of line Tone to be played |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::IsTonePlaying | ( | unsigned | line | ) | [virtual] |
Determine if a tone is still playing
line | Number of line |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::StopTone | ( | unsigned | line | ) | [virtual] |
virtual BOOL OpalUSBDevice::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 ('').
idString | Number of line |
full | ID string returned Get full information in idString |
Reimplemented from OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::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.
idString | Number of line ID string to use |
Reimplemented from OpalLineInterfaceDevice.
virtual unsigned OpalUSBDevice::GetLineCount | ( | ) | [virtual] |
Get Line Count. At resent this returns 0
Implements OpalLineInterfaceDevice.
virtual OpalMediaFormat::List OpalUSBDevice::GetMediaFormats | ( | ) | const [virtual] |
GetMedia Formats
Implements OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::SetReadFormat | ( | unsigned | line, | |
const OpalMediaFormat & | mediaFormat | |||
) | [virtual] |
Set Read Frame size
Implements OpalLineInterfaceDevice.
virtual OpalUSBDevice::SetWriteFormat | ( | unsigned | line, | |
const OpalMediaFormat & | mediaFormat | |||
) | [virtual] |
Set write Frame size
Implements OpalLineInterfaceDevice.
virtual OpalMediaFormat OpalUSBDevice::GetReadFormat | ( | unsigned | line | ) | [virtual] |
Get the Read format
Implements OpalLineInterfaceDevice.
virtual OpalMediaFormat OpalUSBDevice::GetWriteFormat | ( | unsigned | line | ) | [virtual] |
Get the Write Format
Implements OpalLineInterfaceDevice.
virtual BOOL OpalUSBDevice::StopReadCodec | ( | unsigned | line | ) | [virtual] |
virtual BOOL OpalUSBDevice::StopWriteCodec | ( | unsigned | line | ) | [virtual] |
virtual OpalLineInterfaceDevice::DeviceType OpalUSBDevice::GetDeviceType | ( | ) | [virtual] |
Get Device Type
Reimplemented from OpalLineInterfaceDevice.
void OpalUSBDevice::InterpretInput | ( | unsigned int | ret | ) | [protected] |
Exit Tone Thread Flag.
Interpret input received from the HID
BOOL OpalUSBDevice::CreateSoundDevice | ( | BOOL | IsEncoder, | |
const PString & | device, | |||
PINDEX | rate = 8000 , |
|||
PINDEX | samples = 1 | |||
) | [protected] |
unsigned int OpalUSBDevice::InvokeMessage | ( | unsigned | msg, | |
unsigned | val = 0 | |||
) | [protected] |
OpalUSBDevice::PDECLARE_NOTIFIER | ( | PThread | , | |
OpalUSBDevice | , | |||
Monitor | ||||
) | [protected] |
Poll wait.
OpalUSBDevice::PDECLARE_NOTIFIER | ( | PThread | , | |
OpalUSBDevice | , | |||
TonePlay | ||||
) | [protected] |
Tone Thread.
PString OpalUSBDevice::soundDev |
Sound DeviceName.
OpalMediaFormat OpalUSBDevice::MediaFormat [protected] |
PluginHID_Definition* OpalUSBDevice::HID [protected] |
PThread* OpalUSBDevice::MonitorThread [protected] |
HID Definition from the Plugin.
PSyncPoint OpalUSBDevice::monitorTickle [protected] |
Monitor Thread.
BOOL OpalUSBDevice::exitFlag [protected] |
Declaration of the Thread.
BOOL OpalUSBDevice::PluggedIn [protected] |
Exit Thread Monitor Flag.
unsigned int OpalUSBDevice::InputData [protected] |
Device plugged in.
PString OpalUSBDevice::digitbuffer [protected] |
Data sent to the USB Phone.
BOOL OpalUSBDevice::OffHookState [protected] |
Digit Buffer from USB Phone.
BOOL OpalUSBDevice::isRinging [protected] |
Hook state.
BOOL OpalUSBDevice::useSound [protected] |
Whether the device is ringing.
PSoundChannel* OpalUSBDevice::RecSound [protected] |
Flag to specify is Regular Sound device.
PSoundChannel* OpalUSBDevice::PlaySound [protected] |
Sound Record Channel.
PINDEX OpalUSBDevice::soundChannelBuffers [protected] |
Sound Play Channel.
PINDEX OpalUSBDevice::vol [protected] |
Sound Channel Buffers.
BOOL OpalUSBDevice::useTones [protected] |
Current Speaker volume.
CallProgressTones OpalUSBDevice::CurTone [protected] |
Tones required.
PThread* OpalUSBDevice::ToneThread [protected] |
Current Tone to Play.
PMutex OpalUSBDevice::vbMutex [protected] |
Declaration of the ToneThread.
BOOL OpalUSBDevice::hasPSTN [protected] |
Mute.
BOOL OpalUSBDevice::isCell [protected] |