OPAL Version 3.10.2
|
00001 /* 00002 * lidpluginmgr.h 00003 * 00004 * Line Interface Device plugins manager 00005 * 00006 * Open Phone Abstraction Library (OPAL) 00007 * Formally known as the Open H323 project. 00008 * 00009 * Copyright (C) 2005 Post Increment 00010 * 00011 * The contents of this file are subject to the Mozilla Public License 00012 * Version 1.0 (the "License"); you may not use this file except in 00013 * compliance with the License. You may obtain a copy of the License at 00014 * http://www.mozilla.org/MPL/ 00015 * 00016 * Software distributed under the License is distributed on an "AS IS" 00017 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00018 * the License for the specific language governing rights and limitations 00019 * under the License. 00020 * 00021 * The Original Code is Open Phone Abstraction Library. 00022 * 00023 * The Initial Developer of the Original Code is Post Increment 00024 * 00025 * Contributor(s): ______________________________________. 00026 * 00027 * $Revision: 24178 $ 00028 * $Author: rjongbloed $ 00029 * $Date: 2010-04-05 19:10:56 -0500 (Mon, 05 Apr 2010) $ 00030 */ 00031 00032 #ifndef OPAL_LIDS_LIDPLUGINMGR_H 00033 #define OPAL_LIDS_LIDPLUGINMGR_H 00034 00035 #ifdef P_USE_PRAGMA 00036 #pragma interface 00037 #endif 00038 00039 #include <opal/buildopts.h> 00040 00041 #include <ptlib/pluginmgr.h> 00042 #include <ptlib/sound.h> 00043 #include <lids/lidplugin.h> 00044 #include <lids/lid.h> 00045 00046 00047 00048 class OpalPluginLIDRegistration : public OpalLIDRegistration 00049 { 00050 public: 00051 OpalPluginLIDRegistration(const PluginLID_Definition & definition); 00052 00053 OpalLineInterfaceDevice * Create(void * param) const; 00054 00055 private: 00056 PluginLID_Definition m_definition; 00057 }; 00058 00059 00060 class OpalPluginLIDManager : public PPluginModuleManager 00061 { 00062 PCLASSINFO(OpalPluginLIDManager, PPluginModuleManager); 00063 public: 00064 OpalPluginLIDManager(PPluginManager * pluginMgr = NULL); 00065 ~OpalPluginLIDManager(); 00066 00067 virtual void OnLoadPlugin(PDynaLink & dll, INT code); 00068 virtual void OnShutdown(); 00069 00070 protected: 00071 PList<OpalPluginLIDRegistration> m_registrations; 00072 }; 00073 00074 00075 00076 class OpalPluginLID : public OpalLineInterfaceDevice 00077 { 00078 PCLASSINFO(OpalPluginLID, OpalLineInterfaceDevice); 00079 public: 00080 OpalPluginLID(const PluginLID_Definition & definition); 00081 ~OpalPluginLID(); 00082 00085 virtual PBoolean Open( 00086 const PString & device 00087 ); 00088 00091 virtual PBoolean Close(); 00092 00096 virtual PString GetDeviceType() const; 00097 00102 virtual PString GetDeviceName() const; 00103 00106 virtual PStringArray GetAllNames() const; 00107 00113 virtual PString GetDescription() const; 00114 00117 virtual unsigned GetLineCount() const; 00118 00125 virtual PBoolean IsLineTerminal( 00126 unsigned line 00127 ); 00128 00129 00132 virtual PBoolean IsLinePresent( 00133 unsigned line, 00134 PBoolean force = false 00135 ); 00136 00137 00143 virtual PBoolean IsLineOffHook( 00144 unsigned line 00145 ); 00146 00152 virtual PBoolean SetLineOffHook( 00153 unsigned line, 00154 PBoolean newState = true 00155 ); 00156 00160 virtual PBoolean HookFlash( 00161 unsigned line, 00162 unsigned flashTime = 200 00163 ); 00164 00167 virtual PBoolean HasHookFlash(unsigned line); 00168 00169 00180 virtual PBoolean IsLineRinging( 00181 unsigned line, 00182 DWORD * cadence = NULL 00183 ); 00184 00199 virtual PBoolean RingLine( 00200 unsigned line, 00201 PINDEX nCadence, 00202 const unsigned * pattern = NULL, 00203 unsigned frequency = 400 00204 ); 00205 00206 00217 virtual PBoolean SetLineConnected( 00218 unsigned line 00219 ); 00220 00228 virtual PBoolean IsLineConnected( 00229 unsigned line 00230 ); 00231 00232 00239 virtual PBoolean IsLineDisconnected( 00240 unsigned line, 00241 PBoolean checkForWink = true 00242 ); 00243 00244 00247 virtual PBoolean SetLineToLineDirect( 00248 unsigned line1, 00249 unsigned line2, 00250 PBoolean connect 00251 ); 00252 00255 virtual PBoolean IsLineToLineDirect( 00256 unsigned line1, 00257 unsigned line2 00258 ); 00259 00260 00263 virtual OpalMediaFormatList GetMediaFormats() const; 00264 00267 virtual PBoolean SetReadFormat( 00268 unsigned line, 00269 const OpalMediaFormat & mediaFormat 00270 ); 00271 00274 virtual PBoolean SetWriteFormat( 00275 unsigned line, 00276 const OpalMediaFormat & mediaFormat 00277 ); 00278 00281 virtual OpalMediaFormat GetReadFormat( 00282 unsigned line 00283 ); 00284 00287 virtual OpalMediaFormat GetWriteFormat( 00288 unsigned line 00289 ); 00290 00293 virtual PBoolean StopReading( 00294 unsigned line 00295 ); 00296 00299 virtual PBoolean StopWriting( 00300 unsigned line 00301 ); 00302 00307 virtual PBoolean SetReadFrameSize( 00308 unsigned line, 00309 PINDEX frameSize 00310 ); 00311 00316 virtual PBoolean SetWriteFrameSize( 00317 unsigned line, 00318 PINDEX frameSize 00319 ); 00320 00324 virtual PINDEX GetReadFrameSize( 00325 unsigned line 00326 ); 00327 00331 virtual PINDEX GetWriteFrameSize( 00332 unsigned line 00333 ); 00334 00337 virtual PBoolean ReadFrame( 00338 unsigned line, 00339 void * buf, 00340 PINDEX & count 00341 ); 00342 00345 virtual PBoolean WriteFrame( 00346 unsigned line, 00347 const void * buf, 00348 PINDEX count, 00349 PINDEX & written 00350 ); 00351 00352 00355 virtual unsigned GetAverageSignalLevel( 00356 unsigned line, 00357 PBoolean playback 00358 ); 00359 00360 00363 virtual PBoolean EnableAudio( 00364 unsigned line, 00365 PBoolean enable = true 00366 ); 00367 00370 virtual PBoolean IsAudioEnabled( 00371 unsigned line 00372 ) const; 00373 00374 00379 virtual PBoolean SetRecordVolume( 00380 unsigned line, 00381 unsigned volume 00382 ); 00383 00388 virtual PBoolean SetPlayVolume( 00389 unsigned line, 00390 unsigned volume 00391 ); 00392 00397 virtual PBoolean GetRecordVolume( 00398 unsigned line, 00399 unsigned & volume 00400 ); 00401 00406 virtual PBoolean GetPlayVolume( 00407 unsigned line, 00408 unsigned & volume 00409 ); 00410 00411 00415 virtual AECLevels GetAEC( 00416 unsigned line 00417 ) const; 00418 00422 virtual PBoolean SetAEC( 00423 unsigned line, 00424 AECLevels level 00425 ); 00426 00430 virtual PBoolean GetVAD( 00431 unsigned line 00432 ) const; 00433 00437 virtual PBoolean SetVAD( 00438 unsigned line, 00439 PBoolean enable 00440 ); 00441 00442 00456 virtual PBoolean GetCallerID( 00457 unsigned line, 00458 PString & idString, 00459 PBoolean full = false 00460 ); 00461 00483 virtual PBoolean SetCallerID( 00484 unsigned line, 00485 const PString & idString 00486 ); 00487 00490 virtual PBoolean SendVisualMessageWaitingIndicator( 00491 unsigned line, 00492 PBoolean on 00493 ); 00494 00495 00499 virtual PBoolean PlayDTMF( 00500 unsigned line, 00501 const char * digits, 00502 DWORD onTime = DefaultDTMFOnTime, 00503 DWORD offTime = DefaultDTMFOffTime 00504 ); 00505 00515 virtual char ReadDTMF( 00516 unsigned line 00517 ); 00518 00523 virtual PBoolean GetRemoveDTMF( 00524 unsigned line 00525 ); 00526 00531 virtual PBoolean SetRemoveDTMF( 00532 unsigned line, 00533 PBoolean removeTones 00534 ); 00535 00536 00539 virtual CallProgressTones IsToneDetected( 00540 unsigned line 00541 ); 00542 00545 virtual CallProgressTones WaitForToneDetect( 00546 unsigned line, 00547 unsigned timeout = 3000 00548 ); 00549 00552 virtual PBoolean WaitForTone( 00553 unsigned line, 00554 CallProgressTones tone, 00555 unsigned timeout = 3000 00556 ); 00557 00560 virtual bool SetToneParameters( 00561 unsigned line, 00562 CallProgressTones tone, 00563 unsigned frequency1, 00564 unsigned frequency2, 00565 ToneMixingModes mode, 00566 PINDEX numCadences, 00567 const unsigned * onTimes, 00568 const unsigned * offTimes 00569 ); 00570 00573 virtual PBoolean PlayTone( 00574 unsigned line, 00575 CallProgressTones tone 00576 ); 00577 00580 virtual PBoolean IsTonePlaying( 00581 unsigned line 00582 ); 00583 00586 virtual PBoolean StopTone( 00587 unsigned line 00588 ); 00589 00590 00606 virtual CallProgressTones DialOut( 00607 unsigned line, 00608 const PString & number, 00609 const DialParams & params = DialParams() 00610 ); 00611 00612 00616 virtual unsigned GetWinkDuration( 00617 unsigned line 00618 ); 00619 00623 virtual PBoolean SetWinkDuration( 00624 unsigned line, 00625 unsigned winkDuration 00626 ); 00627 00633 virtual PBoolean SetCountryCode( 00634 T35CountryCodes country 00635 ); 00636 00639 virtual PStringList GetCountryCodeNameList() const; 00640 00641 00642 00643 protected: 00644 PDECLARE_NOTIFIER(PThread, OpalPluginLID, TonePlayer); 00645 bool StartTonePlayerThread(int tone); 00646 void StopTonePlayerThread(); 00647 00648 #if PTRACING 00649 bool BadContext() const; 00650 bool BadFunction(void * fnPtr, const char * fnName) const; 00651 PluginLID_Errors CheckError(PluginLID_Errors error, const char * fnName) const; 00652 #endif 00653 00654 const PluginLID_Definition & m_definition; 00655 void * m_context; 00656 PString m_deviceName; 00657 00658 PSoundChannel m_recorder; 00659 PSoundChannel m_player; 00660 PThread * m_tonePlayer; 00661 PSyncPoint m_stopTone; 00662 bool m_lockOutTones; 00663 }; 00664 00665 00666 PFACTORY_LOAD(OpalPluginLIDManager); 00667 00668 00669 #endif // OPAL_LIDS_LIDPLUGINMGR_H