# DahdiLineInterfaceDevice Class Reference

`#include <dahdi_ep.h>`

Inheritance diagram for DahdiLineInterfaceDevice:

[legend]
Collaboration diagram for DahdiLineInterfaceDevice:
[legend]

## Public Member Functions

| DahdiLineInterfaceDevice ()
virtual PString | GetDeviceType () const
virtual PString | GetDeviceName () const
virtual PStringArray | GetAllNames () const
virtual PString | GetDescription () const
virtual OpalMediaFormatList | GetMediaFormats () const
virtual bool | Open (const PString &device)
virtual bool | Close ()
virtual unsigned | GetLineCount () const
virtual bool | IsLineTerminal (unsigned line)
virtual bool | IsLineOffHook (unsigned line)
virtual bool | SetLineOffHook (unsigned line, bool newState=true)
virtual bool | PlayTone (unsigned line, CallProgressTones tone)
virtual bool | IsTonePlaying (unsigned line)
virtual bool | StopTone (unsigned line)
virtual char | ReadDTMF (unsigned line)
virtual PINDEX | GetReadFrameSize (unsigned line)
virtual PINDEX | GetWriteFrameSize (unsigned line)
virtual bool | SetReadFrameSize (unsigned line, PINDEX frameSize)
virtual bool | SetWriteFrameSize (unsigned line, PINDEX frameSize)
virtual bool | SetReadFormat (unsigned line, const OpalMediaFormat &mediaFormat)
virtual bool | SetWriteFormat (unsigned line, const OpalMediaFormat &mediaFormat)
virtual bool | StopReading (unsigned line)
virtual bool | StopWriting (unsigned line)
virtual OpalMediaFormat | GetReadFormat (unsigned line)
virtual OpalMediaFormat | GetWriteFormat (unsigned line)
virtual bool | EnableAudio (unsigned line, bool enable=true)
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 | IsAudioEnabled (unsigned line) const
virtual bool | IsValidLine (unsigned line) const
void | BuildPollFDs ()
void | ThreadMain ()

## Static Public Member Functions

static bool | IsDigitalSpan (dahdi_spaninfo &span)

## Static Public Attributes

static const char * | DeviceName

## Protected Types

typedef std::vector< ChannelInfo * > | ChannelInfoList

## Protected Attributes

int | m_samplesPerBlock
PMutex | m_mutex
ChannelInfoList | m_channelInfoList
PThread * | m_thread
bool | m_running
std::vector< pollfd > | m_pollFds
PMutex | m_pollListMutex
bool | m_pollListDirty

## Data Structures

struct | ChannelInfo
struct | FXSChannelInfo

## Member Typedef Documentation

typedef std::vector<ChannelInfo *> DahdiLineInterfaceDevice::ChannelInfoList `[protected]`

## Constructor & Destructor Documentation

DahdiLineInterfaceDevice::DahdiLineInterfaceDevice | ( |  | ) |

## Member Function Documentation

void DahdiLineInterfaceDevice::BuildPollFDs | ( |  | ) |

virtual bool DahdiLineInterfaceDevice::Close | ( |  | ) | `[virtual]`

Close the line interface device.

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::EnableAudio | ( | unsigned | line,
|  | bool | enable = `true` |
| ) |  |  | `[inline, virtual]`

virtual PStringArray DahdiLineInterfaceDevice::GetAllNames | ( |  | ) | const`[inline, virtual]`

Get all the possible devices that can be opened.

Implements OpalLineInterfaceDevice.

virtual PString DahdiLineInterfaceDevice::GetDescription | ( |  | ) | const`[inline, virtual]`

Get the description of the 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".

Implements OpalLineInterfaceDevice.

virtual PString DahdiLineInterfaceDevice::GetDeviceName | ( |  | ) | const`[inline, virtual]`

Get the device name, as used to open the device. Note the format of this name should be as is returned from GetAllName() and must be able to be used in a subsequent Open() call.

Implements OpalLineInterfaceDevice.

virtual PString DahdiLineInterfaceDevice::GetDeviceType | ( |  | ) | const`[inline, virtual]`

Get the device type identifier. This is as is used in the factory registration.

Implements OpalLineInterfaceDevice.

virtual unsigned DahdiLineInterfaceDevice::GetLineCount | ( |  | ) | const`[inline, virtual]`

Get the total number of lines supported by this device.

Implements OpalLineInterfaceDevice.

virtual OpalMediaFormatList DahdiLineInterfaceDevice::GetMediaFormats | ( |  | ) | const`[inline, virtual]`

Get the media formats this device is capable of using.

Implements OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::GetPlayVolume | ( | unsigned | line,
|  | unsigned & | volume |
| ) |  |  | `[inline, 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.

Reimplemented from OpalLineInterfaceDevice.

virtual OpalMediaFormat DahdiLineInterfaceDevice::GetReadFormat | ( | unsigned | line | ) | `[inline, virtual]`

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

Implements OpalLineInterfaceDevice.

virtual PINDEX DahdiLineInterfaceDevice::GetReadFrameSize | ( | unsigned | line | ) | `[inline, virtual]`

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

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::GetRecordVolume | ( | unsigned | line,
|  | unsigned & | volume |
| ) |  |  | `[inline, 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.

Reimplemented from OpalLineInterfaceDevice.

virtual OpalMediaFormat DahdiLineInterfaceDevice::GetWriteFormat | ( | unsigned | line | ) | `[inline, virtual]`

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

Implements OpalLineInterfaceDevice.

virtual PINDEX DahdiLineInterfaceDevice::GetWriteFrameSize | ( | unsigned | line | ) | `[inline, virtual]`

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

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::IsAudioEnabled | ( | unsigned | line | ) | const`[inline, virtual]`

Determine if audio for the line is enabled.

Reimplemented from OpalLineInterfaceDevice.

static bool DahdiLineInterfaceDevice::IsDigitalSpan | ( | dahdi_spaninfo & | span | ) | `[inline, static]`

virtual bool DahdiLineInterfaceDevice::IsLineOffHook | ( | unsigned | line | ) | `[inline, virtual]`

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.

Implements OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::IsLineTerminal | ( | unsigned | line | ) | `[inline, virtual]`

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.

Implements OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::IsTonePlaying | ( | unsigned | line | ) | `[inline, virtual]`

Determine if a tone is still playing

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::IsValidLine | ( | unsigned | line | ) | const`[inline, virtual]`

virtual bool DahdiLineInterfaceDevice::Open | ( | const PString & | device | ) | `[virtual]`

Open the line interface device.

Implements OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::PlayTone | ( | unsigned | line,
|  | CallProgressTones | tone |
| ) |  |  | `[inline, virtual]`

virtual char DahdiLineInterfaceDevice::ReadDTMF | ( | unsigned | line | ) | `[inline, 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. 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

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::ReadFrame | ( | unsigned | line,
|  | void * | buf,
|  | PINDEX & | count |
| ) |  |  | `[inline, virtual]`

Low level read of a frame from the device.

Implements OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::SetLineOffHook | ( | unsigned | line,
|  | bool | newState = `true` |
| ) |  |  | `[inline, virtual]`

virtual bool DahdiLineInterfaceDevice::SetPlayVolume | ( | unsigned | line,
|  | unsigned | volume |
| ) |  |  | `[inline, 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.

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::SetReadFormat | ( | unsigned | line,
|  | const OpalMediaFormat & | mediaFormat |
| ) |  |  | `[virtual]`

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

Implements OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::SetReadFrameSize | ( | unsigned | line,
|  | PINDEX | frameSize |
| ) |  |  | `[inline, 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 DahdiLineInterfaceDevice::SetRecordVolume | ( | unsigned | line,
|  | unsigned | volume |
| ) |  |  | `[inline, 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.

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::SetWriteFormat | ( | unsigned | line,
|  | const OpalMediaFormat & | mediaFormat |
| ) |  |  | `[virtual]`

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

Implements OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::SetWriteFrameSize | ( | unsigned | line,
|  | PINDEX | frameSize |
| ) |  |  | `[inline, 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 DahdiLineInterfaceDevice::StopReading | ( | unsigned | line | ) | `[virtual]`

Stop the read codec.

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::StopTone | ( | unsigned | line | ) | `[inline, virtual]`

Stop playing a tone.

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::StopWriting | ( | unsigned | line | ) | `[virtual]`

Stop the write codec.

Reimplemented from OpalLineInterfaceDevice.

void DahdiLineInterfaceDevice::ThreadMain | ( |  | ) |

virtual bool DahdiLineInterfaceDevice::WriteFrame | ( | unsigned | line,
|  | const void * | buf,
|  | PINDEX | count,
|  | PINDEX & | written |
| ) |  |  | `[inline, virtual]`

Low level write frame to the device.

Implements OpalLineInterfaceDevice.

## Field Documentation

const char* DahdiLineInterfaceDevice::DeviceName `[static]`

ChannelInfoList DahdiLineInterfaceDevice::m_channelInfoList `[protected]`

PMutex DahdiLineInterfaceDevice::m_mutex `[protected]`

std::vector<pollfd> DahdiLineInterfaceDevice::m_pollFds `[protected]`

bool DahdiLineInterfaceDevice::m_pollListDirty `[protected]`

PMutex DahdiLineInterfaceDevice::m_pollListMutex `[protected]`

bool DahdiLineInterfaceDevice::m_running `[protected]`

int DahdiLineInterfaceDevice::m_samplesPerBlock `[protected]`

PThread* DahdiLineInterfaceDevice::m_thread `[protected]`

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

- dahdi_ep.h