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  * $Log: lidpluginmgr.h,v $
00028  * Revision 2.3  2006/11/05 05:04:46  rjongbloed
00029  * Improved the terminal LID line ringing, epecially for country emulation.
00030  *
00031  * Revision 2.2  2006/10/22 12:08:51  rjongbloed
00032  * Major change so that sound card based LIDs, eg USB handsets. are handled in
00033  *   common code so not requiring lots of duplication.
00034  *
00035  * Revision 2.1  2006/10/02 13:30:50  rjongbloed
00036  * Added LID plug ins
00037  *
00038  */
00039 
00040 #ifndef __LIDPLUGINMGR_H
00041 #define __LIDPLUGINMGR_H
00042 
00043 #ifdef P_USE_PRAGMA
00044 #pragma interface
00045 #endif
00046 
00047 #include <ptlib/pluginmgr.h>
00048 #include <ptlib/sound.h>
00049 #include <lids/lidplugin.h>
00050 #include <lids/lid.h>
00051 
00052 
00053 
00054 class OpalPluginLIDRegistration : public OpalLIDRegistration
00055 {
00056   public:
00057     OpalPluginLIDRegistration(const PluginLID_Definition & definition);
00058 
00059     OpalLineInterfaceDevice * Create(void * param) const;
00060 
00061   private:
00062     PluginLID_Definition m_definition;
00063 };
00064 
00065 
00066 class OpalPluginLIDManager : public PPluginModuleManager
00067 {
00068   PCLASSINFO(OpalPluginLIDManager, PPluginModuleManager);
00069   public:
00070     OpalPluginLIDManager(PPluginManager * pluginMgr = NULL);
00071     ~OpalPluginLIDManager();
00072 
00073     virtual void OnLoadPlugin(PDynaLink & dll, INT code);
00074     virtual void OnShutdown();
00075 
00076   protected:
00077     PList<OpalPluginLIDRegistration> m_registrations;
00078 };
00079 
00080 
00081 
00082 class OpalPluginLID : public OpalLineInterfaceDevice
00083 {
00084   PCLASSINFO(OpalPluginLID, OpalLineInterfaceDevice);
00085   public:
00086     OpalPluginLID(const PluginLID_Definition & definition);
00087     ~OpalPluginLID();
00088 
00091     virtual BOOL Open(
00092       const PString & device      
00093     );
00094 
00097     virtual BOOL Close();
00098 
00102     virtual PString GetDeviceType() const;
00103 
00108     virtual PString GetDeviceName() const;
00109 
00112     virtual PStringArray GetAllNames() const;
00113 
00119     virtual PString GetDescription() const;
00120 
00123     virtual unsigned GetLineCount();
00124 
00131     virtual BOOL IsLineTerminal(
00132       unsigned line   
00133     );
00134 
00135 
00138     virtual BOOL IsLinePresent(
00139       unsigned line,      
00140       BOOL force = FALSE  
00141     );
00142 
00143 
00149     virtual BOOL IsLineOffHook(
00150       unsigned line   
00151     );
00152 
00158     virtual BOOL SetLineOffHook(
00159       unsigned line,        
00160       BOOL newState = TRUE  
00161     );
00162 
00166     virtual BOOL HookFlash(
00167       unsigned line,              
00168       unsigned flashTime = 200    
00169     );
00170 
00173     virtual BOOL HasHookFlash(unsigned line);
00174 
00175 
00186     virtual BOOL IsLineRinging(
00187       unsigned line,          
00188       DWORD * cadence = NULL  
00189     );
00190 
00205     virtual BOOL RingLine(
00206       unsigned line,                   
00207       PINDEX nCadence,                 
00208       const unsigned * pattern = NULL, 
00209       unsigned frequency = 400         
00210     );
00211 
00212 
00219     virtual BOOL IsLineDisconnected(
00220       unsigned line,   
00221       BOOL checkForWink = TRUE
00222     );
00223 
00224 
00227     virtual BOOL SetLineToLineDirect(
00228       unsigned line1,   
00229       unsigned line2,   
00230       BOOL connect      
00231     );
00232 
00235     virtual BOOL IsLineToLineDirect(
00236       unsigned line1,   
00237       unsigned line2    
00238     );
00239 
00240 
00243     virtual OpalMediaFormatList GetMediaFormats() const;
00244 
00247     virtual BOOL SetReadFormat(
00248       unsigned line,    
00249       const OpalMediaFormat & mediaFormat   
00250     );
00251 
00254     virtual BOOL SetWriteFormat(
00255       unsigned line,    
00256       const OpalMediaFormat & mediaFormat   
00257     );
00258 
00261     virtual OpalMediaFormat GetReadFormat(
00262       unsigned line    
00263     );
00264 
00267     virtual OpalMediaFormat GetWriteFormat(
00268       unsigned line    
00269     );
00270 
00273     virtual BOOL StopReading(
00274       unsigned line   
00275     );
00276 
00279     virtual BOOL StopWriting(
00280       unsigned line   
00281     );
00282 
00287     virtual BOOL SetReadFrameSize(
00288       unsigned line,    
00289       PINDEX frameSize  
00290     );
00291 
00296     virtual BOOL SetWriteFrameSize(
00297       unsigned line,    
00298       PINDEX frameSize  
00299     );
00300 
00304     virtual PINDEX GetReadFrameSize(
00305       unsigned line   
00306     );
00307 
00311     virtual PINDEX GetWriteFrameSize(
00312       unsigned line   
00313     );
00314 
00317     virtual BOOL ReadFrame(
00318       unsigned line,    
00319       void * buf,       
00320       PINDEX & count    
00321     );
00322 
00325     virtual BOOL WriteFrame(
00326       unsigned line,    
00327       const void * buf, 
00328       PINDEX count,     
00329       PINDEX & written  
00330     );
00331 
00332 
00335     virtual unsigned GetAverageSignalLevel(
00336       unsigned line,  
00337       BOOL playback   
00338     );
00339 
00340 
00343     virtual BOOL EnableAudio(
00344       unsigned line,      
00345       BOOL enable = TRUE
00346     );
00347 
00350     virtual BOOL IsAudioEnabled(
00351       unsigned line      
00352     );
00353 
00354 
00359     virtual BOOL SetRecordVolume(
00360       unsigned line,    
00361       unsigned volume   
00362     );
00363 
00368     virtual BOOL SetPlayVolume(
00369       unsigned line,    
00370       unsigned volume   
00371     );
00372 
00377     virtual BOOL GetRecordVolume(
00378       unsigned line,      
00379       unsigned & volume   
00380     );
00381 
00386     virtual BOOL GetPlayVolume(
00387       unsigned line,      
00388       unsigned & volume   
00389     );
00390 
00391 
00395     virtual AECLevels GetAEC(
00396       unsigned line    
00397     );
00398 
00402     virtual BOOL SetAEC(
00403       unsigned line,    
00404       AECLevels level   
00405     );
00406 
00410     virtual BOOL GetVAD(
00411       unsigned line    
00412     );
00413 
00417     virtual BOOL SetVAD(
00418       unsigned line,    
00419       BOOL enable       
00420     );
00421 
00422 
00430     virtual BOOL GetCallerID(
00431       unsigned line,      
00432       PString & idString, 
00433       BOOL full = FALSE   
00434     );
00435 
00444     virtual BOOL SetCallerID(
00445       unsigned line,            
00446       const PString & idString  
00447     );
00448 
00457     virtual BOOL SendCallerIDOnCallWaiting(
00458       unsigned line,            
00459       const PString & idString  
00460     );
00461 
00464     virtual BOOL SendVisualMessageWaitingIndicator(
00465       unsigned line,            
00466       BOOL on
00467     );
00468 
00469 
00473     virtual BOOL PlayDTMF(
00474       unsigned line,            
00475       const char * digits,      
00476       DWORD onTime = DefaultDTMFOnTime,  
00477       DWORD offTime = DefaultDTMFOffTime 
00478     );
00479 
00489     virtual char ReadDTMF(
00490       unsigned line   
00491     );
00492 
00497     virtual BOOL GetRemoveDTMF(
00498       unsigned line   
00499     );
00500 
00505     virtual BOOL SetRemoveDTMF(
00506       unsigned line,     
00507       BOOL removeTones   
00508     );
00509 
00510 
00513     virtual CallProgressTones IsToneDetected(
00514       unsigned line   
00515     );
00516 
00519     virtual CallProgressTones WaitForToneDetect(
00520       unsigned line,          
00521       unsigned timeout = 3000 
00522     );
00523 
00526     virtual BOOL WaitForTone(
00527       unsigned line,          
00528       CallProgressTones tone, 
00529       unsigned timeout = 3000 
00530     );
00531 
00534     virtual BOOL SetToneFilterParameters(
00535       unsigned line,            
00536       CallProgressTones tone,   
00537       unsigned lowFrequency,    
00538       unsigned highFrequency,   
00539       PINDEX numCadences,       
00540       const unsigned * onTimes, 
00541       const unsigned * offTimes 
00542     );
00543 
00546     virtual BOOL PlayTone(
00547       unsigned line,          
00548       CallProgressTones tone  
00549     );
00550 
00553     virtual BOOL IsTonePlaying(
00554       unsigned line   
00555     );
00556 
00559     virtual BOOL StopTone(
00560       unsigned line   
00561     );
00562 
00563 
00579     virtual CallProgressTones DialOut(
00580       unsigned line,                
00581       const PString & number,       
00582       BOOL requireTones = FALSE,    
00583       unsigned uiDialDelay = 0      
00584     );
00585 
00586 
00590     virtual unsigned GetWinkDuration(
00591       unsigned line    
00592     );
00593 
00597     virtual BOOL SetWinkDuration(
00598       unsigned line,        
00599       unsigned winkDuration 
00600     );
00601 
00607     virtual BOOL SetCountryCode(
00608       T35CountryCodes country   
00609     );
00610 
00613     virtual PStringList GetCountryCodeNameList() const;
00614 
00615 
00616 
00617   protected:
00618     PDECLARE_NOTIFIER(PThread, OpalPluginLID, TonePlayer);
00619 
00620 #if PTRACING
00621     bool BadContext() const;
00622     bool BadFunction(void * fnPtr, const char * fnName) const;
00623     PluginLID_Errors CheckError(PluginLID_Errors error, const char * fnName) const;
00624 #endif
00625 
00626     const PluginLID_Definition & m_definition;
00627     void                       * m_context;
00628     PString                      m_deviceName;
00629 
00630     PSoundChannel                m_recorder;
00631     PSoundChannel                m_player;
00632     PThread                    * m_tonePlayer;
00633     PSyncPoint                   m_stopTone;
00634 };
00635 
00636 
00637 #endif // __LIDPLUGINMGR_H

Generated on Fri Mar 7 06:33:38 2008 for OPAL by  doxygen 1.5.1