lidpluginmgr.h

Go to the documentation of this file.
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: 20660 $
00028  * $Author: rjongbloed $
00029  * $Date: 2008-08-13 01:58:41 +0000 (Wed, 13 Aug 2008) $
00030  */
00031 
00032 #ifndef __LIDPLUGINMGR_H
00033 #define __LIDPLUGINMGR_H
00034 
00035 #ifdef P_USE_PRAGMA
00036 #pragma interface
00037 #endif
00038 
00039 #include <ptlib/pluginmgr.h>
00040 #include <ptlib/sound.h>
00041 #include <lids/lidplugin.h>
00042 #include <lids/lid.h>
00043 
00044 
00045 
00046 class OpalPluginLIDRegistration : public OpalLIDRegistration
00047 {
00048   public:
00049     OpalPluginLIDRegistration(const PluginLID_Definition & definition);
00050 
00051     OpalLineInterfaceDevice * Create(void * param) const;
00052 
00053   private:
00054     PluginLID_Definition m_definition;
00055 };
00056 
00057 
00058 class OpalPluginLIDManager : public PPluginModuleManager
00059 {
00060   PCLASSINFO(OpalPluginLIDManager, PPluginModuleManager);
00061   public:
00062     OpalPluginLIDManager(PPluginManager * pluginMgr = NULL);
00063     ~OpalPluginLIDManager();
00064 
00065     virtual void OnLoadPlugin(PDynaLink & dll, INT code);
00066     virtual void OnShutdown();
00067 
00068   protected:
00069     PList<OpalPluginLIDRegistration> m_registrations;
00070 };
00071 
00072 
00073 
00074 class OpalPluginLID : public OpalLineInterfaceDevice
00075 {
00076   PCLASSINFO(OpalPluginLID, OpalLineInterfaceDevice);
00077   public:
00078     OpalPluginLID(const PluginLID_Definition & definition);
00079     ~OpalPluginLID();
00080 
00083     virtual PBoolean Open(
00084       const PString & device      
00085     );
00086 
00089     virtual PBoolean Close();
00090 
00094     virtual PString GetDeviceType() const;
00095 
00100     virtual PString GetDeviceName() const;
00101 
00104     virtual PStringArray GetAllNames() const;
00105 
00111     virtual PString GetDescription() const;
00112 
00115     virtual unsigned GetLineCount() const;
00116 
00123     virtual PBoolean IsLineTerminal(
00124       unsigned line   
00125     );
00126 
00127 
00130     virtual PBoolean IsLinePresent(
00131       unsigned line,      
00132       PBoolean force = PFalse  
00133     );
00134 
00135 
00141     virtual PBoolean IsLineOffHook(
00142       unsigned line   
00143     );
00144 
00150     virtual PBoolean SetLineOffHook(
00151       unsigned line,        
00152       PBoolean newState = PTrue  
00153     );
00154 
00158     virtual PBoolean HookFlash(
00159       unsigned line,              
00160       unsigned flashTime = 200    
00161     );
00162 
00165     virtual PBoolean HasHookFlash(unsigned line);
00166 
00167 
00178     virtual PBoolean IsLineRinging(
00179       unsigned line,          
00180       DWORD * cadence = NULL  
00181     );
00182 
00197     virtual PBoolean RingLine(
00198       unsigned line,                   
00199       PINDEX nCadence,                 
00200       const unsigned * pattern = NULL, 
00201       unsigned frequency = 400         
00202     );
00203 
00204 
00215     virtual PBoolean SetLineConnected(
00216       unsigned line   
00217     );
00218 
00226     virtual PBoolean IsLineConnected(
00227       unsigned line   
00228     );
00229 
00230 
00237     virtual PBoolean IsLineDisconnected(
00238       unsigned line,   
00239       PBoolean checkForWink = PTrue
00240     );
00241 
00242 
00245     virtual PBoolean SetLineToLineDirect(
00246       unsigned line1,   
00247       unsigned line2,   
00248       PBoolean connect      
00249     );
00250 
00253     virtual PBoolean IsLineToLineDirect(
00254       unsigned line1,   
00255       unsigned line2    
00256     );
00257 
00258 
00261     virtual OpalMediaFormatList GetMediaFormats() const;
00262 
00265     virtual PBoolean SetReadFormat(
00266       unsigned line,    
00267       const OpalMediaFormat & mediaFormat   
00268     );
00269 
00272     virtual PBoolean SetWriteFormat(
00273       unsigned line,    
00274       const OpalMediaFormat & mediaFormat   
00275     );
00276 
00279     virtual OpalMediaFormat GetReadFormat(
00280       unsigned line    
00281     );
00282 
00285     virtual OpalMediaFormat GetWriteFormat(
00286       unsigned line    
00287     );
00288 
00291     virtual PBoolean StopReading(
00292       unsigned line   
00293     );
00294 
00297     virtual PBoolean StopWriting(
00298       unsigned line   
00299     );
00300 
00305     virtual PBoolean SetReadFrameSize(
00306       unsigned line,    
00307       PINDEX frameSize  
00308     );
00309 
00314     virtual PBoolean SetWriteFrameSize(
00315       unsigned line,    
00316       PINDEX frameSize  
00317     );
00318 
00322     virtual PINDEX GetReadFrameSize(
00323       unsigned line   
00324     );
00325 
00329     virtual PINDEX GetWriteFrameSize(
00330       unsigned line   
00331     );
00332 
00335     virtual PBoolean ReadFrame(
00336       unsigned line,    
00337       void * buf,       
00338       PINDEX & count    
00339     );
00340 
00343     virtual PBoolean WriteFrame(
00344       unsigned line,    
00345       const void * buf, 
00346       PINDEX count,     
00347       PINDEX & written  
00348     );
00349 
00350 
00353     virtual unsigned GetAverageSignalLevel(
00354       unsigned line,  
00355       PBoolean playback   
00356     );
00357 
00358 
00361     virtual PBoolean EnableAudio(
00362       unsigned line,      
00363       PBoolean enable = PTrue
00364     );
00365 
00368     virtual PBoolean IsAudioEnabled(
00369       unsigned line      
00370     ) const;
00371 
00372 
00377     virtual PBoolean SetRecordVolume(
00378       unsigned line,    
00379       unsigned volume   
00380     );
00381 
00386     virtual PBoolean SetPlayVolume(
00387       unsigned line,    
00388       unsigned volume   
00389     );
00390 
00395     virtual PBoolean GetRecordVolume(
00396       unsigned line,      
00397       unsigned & volume   
00398     );
00399 
00404     virtual PBoolean GetPlayVolume(
00405       unsigned line,      
00406       unsigned & volume   
00407     );
00408 
00409 
00413     virtual AECLevels GetAEC(
00414       unsigned line    
00415     ) const;
00416 
00420     virtual PBoolean SetAEC(
00421       unsigned line,    
00422       AECLevels level   
00423     );
00424 
00428     virtual PBoolean GetVAD(
00429       unsigned line    
00430     ) const;
00431 
00435     virtual PBoolean SetVAD(
00436       unsigned line,    
00437       PBoolean enable       
00438     );
00439 
00440 
00454     virtual PBoolean GetCallerID(
00455       unsigned line,      
00456       PString & idString, 
00457       PBoolean full = PFalse   
00458     );
00459 
00481     virtual PBoolean SetCallerID(
00482       unsigned line,            
00483       const PString & idString  
00484     );
00485 
00488     virtual PBoolean SendVisualMessageWaitingIndicator(
00489       unsigned line,            
00490       PBoolean on
00491     );
00492 
00493 
00497     virtual PBoolean PlayDTMF(
00498       unsigned line,            
00499       const char * digits,      
00500       DWORD onTime = DefaultDTMFOnTime,  
00501       DWORD offTime = DefaultDTMFOffTime 
00502     );
00503 
00513     virtual char ReadDTMF(
00514       unsigned line   
00515     );
00516 
00521     virtual PBoolean GetRemoveDTMF(
00522       unsigned line   
00523     );
00524 
00529     virtual PBoolean SetRemoveDTMF(
00530       unsigned line,     
00531       PBoolean removeTones   
00532     );
00533 
00534 
00537     virtual CallProgressTones IsToneDetected(
00538       unsigned line   
00539     );
00540 
00543     virtual CallProgressTones WaitForToneDetect(
00544       unsigned line,          
00545       unsigned timeout = 3000 
00546     );
00547 
00550     virtual PBoolean WaitForTone(
00551       unsigned line,          
00552       CallProgressTones tone, 
00553       unsigned timeout = 3000 
00554     );
00555 
00558     virtual bool SetToneParameters(
00559       unsigned line,            
00560       CallProgressTones tone,   
00561       unsigned frequency1,      
00562       unsigned frequency2,      
00563       ToneMixingModes mode,     
00564       PINDEX numCadences,       
00565       const unsigned * onTimes, 
00566       const unsigned * offTimes 
00567     );
00568 
00571     virtual PBoolean PlayTone(
00572       unsigned line,          
00573       CallProgressTones tone  
00574     );
00575 
00578     virtual PBoolean IsTonePlaying(
00579       unsigned line   
00580     );
00581 
00584     virtual PBoolean StopTone(
00585       unsigned line   
00586     );
00587 
00588 
00604     virtual CallProgressTones DialOut(
00605       unsigned line,                
00606       const PString & number,       
00607       const DialParams & params = DialParams() 
00608     );
00609 
00610 
00614     virtual unsigned GetWinkDuration(
00615       unsigned line    
00616     );
00617 
00621     virtual PBoolean SetWinkDuration(
00622       unsigned line,        
00623       unsigned winkDuration 
00624     );
00625 
00631     virtual PBoolean SetCountryCode(
00632       T35CountryCodes country   
00633     );
00634 
00637     virtual PStringList GetCountryCodeNameList() const;
00638 
00639 
00640 
00641   protected:
00642     PDECLARE_NOTIFIER(PThread, OpalPluginLID, TonePlayer);
00643     bool StartTonePlayerThread(int tone);
00644     void StopTonePlayerThread();
00645 
00646 #if PTRACING
00647     bool BadContext() const;
00648     bool BadFunction(void * fnPtr, const char * fnName) const;
00649     PluginLID_Errors CheckError(PluginLID_Errors error, const char * fnName) const;
00650 #endif
00651 
00652     const PluginLID_Definition & m_definition;
00653     void                       * m_context;
00654     PString                      m_deviceName;
00655 
00656     PSoundChannel                m_recorder;
00657     PSoundChannel                m_player;
00658     PThread                    * m_tonePlayer;
00659     PSyncPoint                   m_stopTone;
00660     bool                         m_lockOutTones;
00661 };
00662 
00663 
00664 #endif // __LIDPLUGINMGR_H

Generated on Mon Sep 15 11:49:12 2008 for OPAL by  doxygen 1.5.1