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: 19427 $
00028  * $Author: rjongbloed $
00029  * $Date: 2008-02-09 03:23:08 +0000 (Sat, 09 Feb 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 
00211     virtual PBoolean IsLineDisconnected(
00212       unsigned line,   
00213       PBoolean checkForWink = PTrue
00214     );
00215 
00216 
00219     virtual PBoolean SetLineToLineDirect(
00220       unsigned line1,   
00221       unsigned line2,   
00222       PBoolean connect      
00223     );
00224 
00227     virtual PBoolean IsLineToLineDirect(
00228       unsigned line1,   
00229       unsigned line2    
00230     );
00231 
00232 
00235     virtual OpalMediaFormatList GetMediaFormats() const;
00236 
00239     virtual PBoolean SetReadFormat(
00240       unsigned line,    
00241       const OpalMediaFormat & mediaFormat   
00242     );
00243 
00246     virtual PBoolean SetWriteFormat(
00247       unsigned line,    
00248       const OpalMediaFormat & mediaFormat   
00249     );
00250 
00253     virtual OpalMediaFormat GetReadFormat(
00254       unsigned line    
00255     );
00256 
00259     virtual OpalMediaFormat GetWriteFormat(
00260       unsigned line    
00261     );
00262 
00265     virtual PBoolean StopReading(
00266       unsigned line   
00267     );
00268 
00271     virtual PBoolean StopWriting(
00272       unsigned line   
00273     );
00274 
00279     virtual PBoolean SetReadFrameSize(
00280       unsigned line,    
00281       PINDEX frameSize  
00282     );
00283 
00288     virtual PBoolean SetWriteFrameSize(
00289       unsigned line,    
00290       PINDEX frameSize  
00291     );
00292 
00296     virtual PINDEX GetReadFrameSize(
00297       unsigned line   
00298     );
00299 
00303     virtual PINDEX GetWriteFrameSize(
00304       unsigned line   
00305     );
00306 
00309     virtual PBoolean ReadFrame(
00310       unsigned line,    
00311       void * buf,       
00312       PINDEX & count    
00313     );
00314 
00317     virtual PBoolean WriteFrame(
00318       unsigned line,    
00319       const void * buf, 
00320       PINDEX count,     
00321       PINDEX & written  
00322     );
00323 
00324 
00327     virtual unsigned GetAverageSignalLevel(
00328       unsigned line,  
00329       PBoolean playback   
00330     );
00331 
00332 
00335     virtual PBoolean EnableAudio(
00336       unsigned line,      
00337       PBoolean enable = PTrue
00338     );
00339 
00342     virtual PBoolean IsAudioEnabled(
00343       unsigned line      
00344     ) const;
00345 
00346 
00351     virtual PBoolean SetRecordVolume(
00352       unsigned line,    
00353       unsigned volume   
00354     );
00355 
00360     virtual PBoolean SetPlayVolume(
00361       unsigned line,    
00362       unsigned volume   
00363     );
00364 
00369     virtual PBoolean GetRecordVolume(
00370       unsigned line,      
00371       unsigned & volume   
00372     );
00373 
00378     virtual PBoolean GetPlayVolume(
00379       unsigned line,      
00380       unsigned & volume   
00381     );
00382 
00383 
00387     virtual AECLevels GetAEC(
00388       unsigned line    
00389     );
00390 
00394     virtual PBoolean SetAEC(
00395       unsigned line,    
00396       AECLevels level   
00397     );
00398 
00402     virtual PBoolean GetVAD(
00403       unsigned line    
00404     );
00405 
00409     virtual PBoolean SetVAD(
00410       unsigned line,    
00411       PBoolean enable       
00412     );
00413 
00414 
00422     virtual PBoolean GetCallerID(
00423       unsigned line,      
00424       PString & idString, 
00425       PBoolean full = PFalse   
00426     );
00427 
00436     virtual PBoolean SetCallerID(
00437       unsigned line,            
00438       const PString & idString  
00439     );
00440 
00449     virtual PBoolean SendCallerIDOnCallWaiting(
00450       unsigned line,            
00451       const PString & idString  
00452     );
00453 
00456     virtual PBoolean SendVisualMessageWaitingIndicator(
00457       unsigned line,            
00458       PBoolean on
00459     );
00460 
00461 
00465     virtual PBoolean PlayDTMF(
00466       unsigned line,            
00467       const char * digits,      
00468       DWORD onTime = DefaultDTMFOnTime,  
00469       DWORD offTime = DefaultDTMFOffTime 
00470     );
00471 
00481     virtual char ReadDTMF(
00482       unsigned line   
00483     );
00484 
00489     virtual PBoolean GetRemoveDTMF(
00490       unsigned line   
00491     );
00492 
00497     virtual PBoolean SetRemoveDTMF(
00498       unsigned line,     
00499       PBoolean removeTones   
00500     );
00501 
00502 
00505     virtual CallProgressTones IsToneDetected(
00506       unsigned line   
00507     );
00508 
00511     virtual CallProgressTones WaitForToneDetect(
00512       unsigned line,          
00513       unsigned timeout = 3000 
00514     );
00515 
00518     virtual PBoolean WaitForTone(
00519       unsigned line,          
00520       CallProgressTones tone, 
00521       unsigned timeout = 3000 
00522     );
00523 
00526     virtual PBoolean SetToneFilterParameters(
00527       unsigned line,            
00528       CallProgressTones tone,   
00529       unsigned lowFrequency,    
00530       unsigned highFrequency,   
00531       PINDEX numCadences,       
00532       const unsigned * onTimes, 
00533       const unsigned * offTimes 
00534     );
00535 
00538     virtual PBoolean PlayTone(
00539       unsigned line,          
00540       CallProgressTones tone  
00541     );
00542 
00545     virtual PBoolean IsTonePlaying(
00546       unsigned line   
00547     );
00548 
00551     virtual PBoolean StopTone(
00552       unsigned line   
00553     );
00554 
00555 
00571     virtual CallProgressTones DialOut(
00572       unsigned line,                
00573       const PString & number,       
00574       PBoolean requireTones = PFalse,    
00575       unsigned uiDialDelay = 0      
00576     );
00577 
00578 
00582     virtual unsigned GetWinkDuration(
00583       unsigned line    
00584     );
00585 
00589     virtual PBoolean SetWinkDuration(
00590       unsigned line,        
00591       unsigned winkDuration 
00592     );
00593 
00599     virtual PBoolean SetCountryCode(
00600       T35CountryCodes country   
00601     );
00602 
00605     virtual PStringList GetCountryCodeNameList() const;
00606 
00607 
00608 
00609   protected:
00610     PDECLARE_NOTIFIER(PThread, OpalPluginLID, TonePlayer);
00611 
00612 #if PTRACING
00613     bool BadContext() const;
00614     bool BadFunction(void * fnPtr, const char * fnName) const;
00615     PluginLID_Errors CheckError(PluginLID_Errors error, const char * fnName) const;
00616 #endif
00617 
00618     const PluginLID_Definition & m_definition;
00619     void                       * m_context;
00620     PString                      m_deviceName;
00621 
00622     PSoundChannel                m_recorder;
00623     PSoundChannel                m_player;
00624     PThread                    * m_tonePlayer;
00625     PSyncPoint                   m_stopTone;
00626     bool                         m_lockOutTones;
00627 };
00628 
00629 
00630 #endif // __LIDPLUGINMGR_H

Generated on Fri Mar 7 07:36:36 2008 for OPAL by  doxygen 1.5.1