lidpluginmgr.h
Go to the documentation of this file.
/*
* lidpluginmgr.h
*
* Line Interface Device plugins manager
*
* Open Phone Abstraction Library (OPAL)
* Formally known as the Open H323 project.
*
* Copyright (C) 2005 Post Increment
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Open Phone Abstraction Library.
*
* The Initial Developer of the Original Code is Post Increment
*
* Contributor(s): ______________________________________.
*
* $Revision: 24178 $
* $Author: rjongbloed $
* $Date: 2010-04-05 19:10:56 -0500 (Mon, 05 Apr 2010) $
*/
#ifndef OPAL_LIDS_LIDPLUGINMGR_H
#define OPAL_LIDS_LIDPLUGINMGR_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <opal/buildopts.h>
#include <ptlib/pluginmgr.h>
#include <ptlib/sound.h>
#include <lids/lidplugin.h>
#include <lids/lid.h>
class OpalPluginLIDRegistration : public OpalLIDRegistration
{
public:
OpalPluginLIDRegistration(const PluginLID_Definition & definition);
OpalLineInterfaceDevice * Create(void * param) const;
private:
PluginLID_Definition m_definition;
};
class OpalPluginLIDManager : public PPluginModuleManager
{
PCLASSINFO(OpalPluginLIDManager, PPluginModuleManager);
public:
OpalPluginLIDManager(PPluginManager * pluginMgr = NULL);
~OpalPluginLIDManager();
virtual void OnLoadPlugin(PDynaLink & dll, INT code);
virtual void OnShutdown();
protected:
PList<OpalPluginLIDRegistration> m_registrations;
};
class OpalPluginLID : public OpalLineInterfaceDevice
{
PCLASSINFO(OpalPluginLID, OpalLineInterfaceDevice);
public:
OpalPluginLID(const PluginLID_Definition & definition);
~OpalPluginLID();
virtual PBoolean Open(
const PString & device
);
virtual PBoolean Close();
virtual PString GetDeviceType() const;
virtual PString GetDeviceName() const;
virtual PStringArray GetAllNames() const;
virtual PString GetDescription() const;
virtual unsigned GetLineCount() const;
virtual PBoolean IsLineTerminal(
unsigned line
);
virtual PBoolean IsLinePresent(
unsigned line,
PBoolean force = false
);
virtual PBoolean IsLineOffHook(
unsigned line
);
virtual PBoolean SetLineOffHook(
unsigned line,
PBoolean newState = true
);
virtual PBoolean HookFlash(
unsigned line,
unsigned flashTime = 200
);
virtual PBoolean HasHookFlash(unsigned line);
virtual PBoolean IsLineRinging(
unsigned line,
DWORD * cadence = NULL
);
virtual PBoolean RingLine(
unsigned line,
PINDEX nCadence,
const unsigned * pattern = NULL,
unsigned frequency = 400
);
virtual PBoolean SetLineConnected(
unsigned line
);
virtual PBoolean IsLineConnected(
unsigned line
);
virtual PBoolean IsLineDisconnected(
unsigned line,
PBoolean checkForWink = true
);
virtual PBoolean SetLineToLineDirect(
unsigned line1,
unsigned line2,
PBoolean connect
);
virtual PBoolean IsLineToLineDirect(
unsigned line1,
unsigned line2
);
virtual OpalMediaFormatList GetMediaFormats() const;
virtual PBoolean SetReadFormat(
unsigned line,
const OpalMediaFormat & mediaFormat
);
virtual PBoolean SetWriteFormat(
unsigned line,
const OpalMediaFormat & mediaFormat
);
virtual OpalMediaFormat GetReadFormat(
unsigned line
);
virtual OpalMediaFormat GetWriteFormat(
unsigned line
);
virtual PBoolean StopReading(
unsigned line
);
virtual PBoolean StopWriting(
unsigned line
);
virtual PBoolean SetReadFrameSize(
unsigned line,
PINDEX frameSize
);
virtual PBoolean SetWriteFrameSize(
unsigned line,
PINDEX frameSize
);
virtual PINDEX GetReadFrameSize(
unsigned line
);
virtual PINDEX GetWriteFrameSize(
unsigned line
);
virtual PBoolean ReadFrame(
unsigned line,
void * buf,
PINDEX & count
);
virtual PBoolean WriteFrame(
unsigned line,
const void * buf,
PINDEX count,
PINDEX & written
);
virtual unsigned GetAverageSignalLevel(
unsigned line,
PBoolean playback
);
virtual PBoolean EnableAudio(
unsigned line,
PBoolean enable = true
);
virtual PBoolean IsAudioEnabled(
unsigned line
) const;
virtual PBoolean SetRecordVolume(
unsigned line,
unsigned volume
);
virtual PBoolean SetPlayVolume(
unsigned line,
unsigned volume
);
virtual PBoolean GetRecordVolume(
unsigned line,
unsigned & volume
);
virtual PBoolean GetPlayVolume(
unsigned line,
unsigned & volume
);
virtual AECLevels GetAEC(
unsigned line
) const;
virtual PBoolean SetAEC(
unsigned line,
AECLevels level
);
virtual PBoolean GetVAD(
unsigned line
) const;
virtual PBoolean SetVAD(
unsigned line,
PBoolean enable
);
virtual PBoolean GetCallerID(
unsigned line,
PString & idString,
PBoolean full = false
);
virtual PBoolean SetCallerID(
unsigned line,
const PString & idString
);
virtual PBoolean SendVisualMessageWaitingIndicator(
unsigned line,
PBoolean on
);
virtual PBoolean PlayDTMF(
unsigned line,
const char * digits,
DWORD onTime = DefaultDTMFOnTime,
DWORD offTime = DefaultDTMFOffTime
);
virtual char ReadDTMF(
unsigned line
);
virtual PBoolean GetRemoveDTMF(
unsigned line
);
virtual PBoolean SetRemoveDTMF(
unsigned line,
PBoolean removeTones
);
virtual CallProgressTones IsToneDetected(
unsigned line
);
virtual CallProgressTones WaitForToneDetect(
unsigned line,
unsigned timeout = 3000
);
virtual PBoolean WaitForTone(
unsigned line,
CallProgressTones tone,
unsigned timeout = 3000
);
virtual bool SetToneParameters(
unsigned line,
CallProgressTones tone,
unsigned frequency1,
unsigned frequency2,
ToneMixingModes mode,
PINDEX numCadences,
const unsigned * onTimes,
const unsigned * offTimes
);
virtual PBoolean PlayTone(
unsigned line,
CallProgressTones tone
);
virtual PBoolean IsTonePlaying(
unsigned line
);
virtual PBoolean StopTone(
unsigned line
);
virtual CallProgressTones DialOut(
unsigned line,
const PString & number,
const DialParams & params = DialParams()
);
virtual unsigned GetWinkDuration(
unsigned line
);
virtual PBoolean SetWinkDuration(
unsigned line,
unsigned winkDuration
);
virtual PBoolean SetCountryCode(
T35CountryCodes country
);
virtual PStringList GetCountryCodeNameList() const;
protected:
PDECLARE_NOTIFIER(PThread, OpalPluginLID, TonePlayer);
bool StartTonePlayerThread(int tone);
void StopTonePlayerThread();
#if PTRACING
bool BadContext() const;
bool BadFunction(void * fnPtr, const char * fnName) const;
PluginLID_Errors CheckError(PluginLID_Errors error, const char * fnName) const;
#endif
const PluginLID_Definition & m_definition;
void * m_context;
PString m_deviceName;
PSoundChannel m_recorder;
PSoundChannel m_player;
PThread * m_tonePlayer;
PSyncPoint m_stopTone;
bool m_lockOutTones;
};
PFACTORY_LOAD(OpalPluginLIDManager);
#endif // OPAL_LIDS_LIDPLUGINMGR_H
OpalPluginLID::Close
virtual PBoolean Close()
lidplugin.h
OpalPluginLIDManager
Definition: lidpluginmgr.h:60
OpalPluginLID::SetRecordVolume
virtual PBoolean SetRecordVolume(unsigned line, unsigned volume)
OpalPluginLID::GetCountryCodeNameList
virtual PStringList GetCountryCodeNameList() const
OpalPluginLID::m_lockOutTones
bool m_lockOutTones
Definition: lidpluginmgr.h:662
OpalPluginLID::SetCallerID
virtual PBoolean SetCallerID(unsigned line, const PString &idString)
OpalPluginLID::~OpalPluginLID
~OpalPluginLID()
OpalPluginLID::PlayTone
virtual PBoolean PlayTone(unsigned line, CallProgressTones tone)
OpalPluginLID
Definition: lidpluginmgr.h:76
OpalLineInterfaceDevice::T35CountryCodes
T35CountryCodes
Definition: lid.h:747
OpalPluginLID::GetWriteFormat
virtual OpalMediaFormat GetWriteFormat(unsigned line)
OpalPluginLID::GetDeviceType
virtual PString GetDeviceType() const
OpalPluginLID::OpalPluginLID
OpalPluginLID(const PluginLID_Definition &definition)
OpalPluginLID::RingLine
virtual PBoolean RingLine(unsigned line, PINDEX nCadence, const unsigned *pattern=NULL, unsigned frequency=400)
buildopts.h
OpalPluginLID::GetDescription
virtual PString GetDescription() const
OpalPluginLID::SetPlayVolume
virtual PBoolean SetPlayVolume(unsigned line, unsigned volume)
OpalPluginLID::ReadDTMF
virtual char ReadDTMF(unsigned line)
OpalPluginLID::IsLineTerminal
virtual PBoolean IsLineTerminal(unsigned line)
lid.h
OpalPluginLIDManager::OpalPluginLIDManager
OpalPluginLIDManager(PPluginManager *pluginMgr=NULL)
OpalPluginLID::GetCallerID
virtual PBoolean GetCallerID(unsigned line, PString &idString, PBoolean full=false)
OpalLineInterfaceDevice::DefaultDTMFOffTime
Definition: lid.h:540
OpalPluginLIDRegistration::Create
OpalLineInterfaceDevice * Create(void *param) const
OpalPluginLID::m_definition
const PluginLID_Definition & m_definition
Definition: lidpluginmgr.h:654
OpalPluginLID::GetLineCount
virtual unsigned GetLineCount() const
OpalPluginLID::IsTonePlaying
virtual PBoolean IsTonePlaying(unsigned line)
OpalLineInterfaceDevice::AECLevels
AECLevels
Definition: lid.h:444
OpalPluginLID::StopTonePlayerThread
void StopTonePlayerThread()
OpalPluginLID::SetCountryCode
virtual PBoolean SetCountryCode(T35CountryCodes country)
OpalPluginLID::SetWriteFormat
virtual PBoolean SetWriteFormat(unsigned line, const OpalMediaFormat &mediaFormat)
OpalPluginLID::IsLineToLineDirect
virtual PBoolean IsLineToLineDirect(unsigned line1, unsigned line2)
OpalPluginLID::m_player
PSoundChannel m_player
Definition: lidpluginmgr.h:659
OpalMediaFormatList
Definition: mediafmt.h:72
OpalPluginLID::GetVAD
virtual PBoolean GetVAD(unsigned line) const
OpalPluginLID::SetWinkDuration
virtual PBoolean SetWinkDuration(unsigned line, unsigned winkDuration)
OpalPluginLID::IsLineRinging
virtual PBoolean IsLineRinging(unsigned line, DWORD *cadence=NULL)
OpalPluginLID::SendVisualMessageWaitingIndicator
virtual PBoolean SendVisualMessageWaitingIndicator(unsigned line, PBoolean on)
OpalPluginLID::m_tonePlayer
PThread * m_tonePlayer
Definition: lidpluginmgr.h:660
OpalPluginLID::GetMediaFormats
virtual OpalMediaFormatList GetMediaFormats() const
OpalMediaFormat
Definition: mediafmt.h:724
OpalPluginLID::PDECLARE_NOTIFIER
PDECLARE_NOTIFIER(PThread, OpalPluginLID, TonePlayer)
OpalPluginLID::SetVAD
virtual PBoolean SetVAD(unsigned line, PBoolean enable)
OpalPluginLID::GetAverageSignalLevel
virtual unsigned GetAverageSignalLevel(unsigned line, PBoolean playback)
OpalPluginLID::SetReadFrameSize
virtual PBoolean SetReadFrameSize(unsigned line, PINDEX frameSize)
OpalPluginLID::GetAllNames
virtual PStringArray GetAllNames() const
OpalPluginLID::SetLineToLineDirect
virtual PBoolean SetLineToLineDirect(unsigned line1, unsigned line2, PBoolean connect)
OpalPluginLID::GetAEC
virtual AECLevels GetAEC(unsigned line) const
OpalPluginLID::StartTonePlayerThread
bool StartTonePlayerThread(int tone)
PluginLID_Errors
PluginLID_Errors
Definition: lidplugin.h:75
OpalPluginLIDManager::m_registrations
PList< OpalPluginLIDRegistration > m_registrations
Definition: lidpluginmgr.h:71
OpalPluginLID::HasHookFlash
virtual PBoolean HasHookFlash(unsigned line)
OpalPluginLID::IsLineConnected
virtual PBoolean IsLineConnected(unsigned line)
OpalPluginLID::GetPlayVolume
virtual PBoolean GetPlayVolume(unsigned line, unsigned &volume)
OpalPluginLID::IsToneDetected
virtual CallProgressTones IsToneDetected(unsigned line)
OpalPluginLID::m_stopTone
PSyncPoint m_stopTone
Definition: lidpluginmgr.h:661
OpalPluginLID::m_deviceName
PString m_deviceName
Definition: lidpluginmgr.h:656
OpalPluginLIDManager::~OpalPluginLIDManager
~OpalPluginLIDManager()
OpalPluginLID::GetDeviceName
virtual PString GetDeviceName() const
OpalPluginLID::GetWinkDuration
virtual unsigned GetWinkDuration(unsigned line)
OpalPluginLID::GetRecordVolume
virtual PBoolean GetRecordVolume(unsigned line, unsigned &volume)
OpalPluginLID::ReadFrame
virtual PBoolean ReadFrame(unsigned line, void *buf, PINDEX &count)
OpalPluginLIDManager::OnShutdown
virtual void OnShutdown()
OpalLineInterfaceDevice::DefaultDTMFOnTime
Definition: lid.h:539
OpalLineInterfaceDevice::DialParams
Definition: lid.h:689
OpalPluginLIDManager::OnLoadPlugin
virtual void OnLoadPlugin(PDynaLink &dll, INT code)
OpalPluginLID::WriteFrame
virtual PBoolean WriteFrame(unsigned line, const void *buf, PINDEX count, PINDEX &written)
OpalPluginLID::SetAEC
virtual PBoolean SetAEC(unsigned line, AECLevels level)
OpalLineInterfaceDevice
Definition: lid.h:51
OpalPluginLID::GetRemoveDTMF
virtual PBoolean GetRemoveDTMF(unsigned line)
OpalPluginLID::Open
virtual PBoolean Open(const PString &device)
OpalPluginLID::SetWriteFrameSize
virtual PBoolean SetWriteFrameSize(unsigned line, PINDEX frameSize)
OpalPluginLID::SetLineConnected
virtual PBoolean SetLineConnected(unsigned line)
OpalPluginLID::IsLineOffHook
virtual PBoolean IsLineOffHook(unsigned line)
OpalPluginLID::GetWriteFrameSize
virtual PINDEX GetWriteFrameSize(unsigned line)
OpalLIDRegistration
Definition: lid.h:1398
OpalPluginLID::WaitForToneDetect
virtual CallProgressTones WaitForToneDetect(unsigned line, unsigned timeout=3000)
OpalPluginLID::SetToneParameters
virtual bool SetToneParameters(unsigned line, CallProgressTones tone, unsigned frequency1, unsigned frequency2, ToneMixingModes mode, PINDEX numCadences, const unsigned *onTimes, const unsigned *offTimes)
OpalLineInterfaceDevice::CallProgressTones
CallProgressTones
Definition: lid.h:584
OpalPluginLIDRegistration
Definition: lidpluginmgr.h:48
OpalPluginLID::SetRemoveDTMF
virtual PBoolean SetRemoveDTMF(unsigned line, PBoolean removeTones)
OpalPluginLID::WaitForTone
virtual PBoolean WaitForTone(unsigned line, CallProgressTones tone, unsigned timeout=3000)
OpalPluginLID::HookFlash
virtual PBoolean HookFlash(unsigned line, unsigned flashTime=200)
OpalPluginLID::GetReadFrameSize
virtual PINDEX GetReadFrameSize(unsigned line)
OpalPluginLID::m_context
void * m_context
Definition: lidpluginmgr.h:655
PluginLID_Definition
Definition: lidplugin.h:121
OpalLineInterfaceDevice::ToneMixingModes
ToneMixingModes
Definition: lid.h:648
OpalPluginLID::SetLineOffHook
virtual PBoolean SetLineOffHook(unsigned line, PBoolean newState=true)
OpalPluginLID::GetReadFormat
virtual OpalMediaFormat GetReadFormat(unsigned line)
OpalPluginLID::StopTone
virtual PBoolean StopTone(unsigned line)
OpalPluginLID::IsLinePresent
virtual PBoolean IsLinePresent(unsigned line, PBoolean force=false)
OpalPluginLID::PlayDTMF
virtual PBoolean PlayDTMF(unsigned line, const char *digits, DWORD onTime=DefaultDTMFOnTime, DWORD offTime=DefaultDTMFOffTime)
OpalPluginLID::SetReadFormat
virtual PBoolean SetReadFormat(unsigned line, const OpalMediaFormat &mediaFormat)
OpalPluginLID::StopReading
virtual PBoolean StopReading(unsigned line)
OpalPluginLIDRegistration::OpalPluginLIDRegistration
OpalPluginLIDRegistration(const PluginLID_Definition &definition)
OpalPluginLID::StopWriting
virtual PBoolean StopWriting(unsigned line)
OpalPluginLID::DialOut
virtual CallProgressTones DialOut(unsigned line, const PString &number, const DialParams &params=DialParams())
OpalPluginLID::IsLineDisconnected
virtual PBoolean IsLineDisconnected(unsigned line, PBoolean checkForWink=true)
PFACTORY_LOAD
PFACTORY_LOAD(OpalPluginLIDManager)
OpalPluginLID::EnableAudio
virtual PBoolean EnableAudio(unsigned line, PBoolean enable=true)
OpalPluginLID::m_recorder
PSoundChannel m_recorder
Definition: lidpluginmgr.h:658
OpalPluginLID::IsAudioEnabled
virtual PBoolean IsAudioEnabled(unsigned line) const