lid.h

Go to the documentation of this file.
00001 /*
00002  * lid.h
00003  *
00004  * Line Interface Device
00005  *
00006  * Open Phone Abstraction Library
00007  *
00008  * Copyright (c) 1999-2001 Equivalence Pty. Ltd.
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Open H323 Library.
00021  *
00022  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00023  *
00024  * Portions of this code were written with the assisance of funding from 
00025  * Quicknet Technologies, Inc. http://www.quicknet.net.
00026  * 
00027  * Contributor(s): ______________________________________.
00028  *
00029  * $Revision: 20080 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-04-23 01:00:33 +0000 (Wed, 23 Apr 2008) $
00032  */
00033 
00034 #ifndef __OPAL_LID_H
00035 #define __OPAL_LID_H
00036 
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040 
00041 
00042 #include <opal/mediafmt.h>
00043 
00044 
00046 
00050 class OpalLineInterfaceDevice : public PObject
00051 {
00052   PCLASSINFO(OpalLineInterfaceDevice, PObject);
00053 
00054   public:
00057     OpalLineInterfaceDevice();
00058 
00061     virtual PBoolean Open(
00062       const PString & device      
00063     ) = 0;
00064 
00067     virtual PBoolean IsOpen() const;
00068 
00071     virtual PBoolean Close();
00072 
00076     virtual PString GetDeviceType() const = 0;
00077 
00082     virtual PString GetDeviceName() const = 0;
00083 
00086     virtual PStringArray GetAllNames() const = 0;
00087 
00093     virtual PString GetDescription() const = 0;
00094 
00097     virtual unsigned GetLineCount() const = 0;
00098 
00105     virtual PBoolean IsLineTerminal(
00106       unsigned line   
00107     ) = 0;
00108 
00109 
00112     virtual PBoolean IsLinePresent(
00113       unsigned line,      
00114       PBoolean force = PFalse  
00115     );
00116 
00117 
00123     virtual PBoolean IsLineOffHook(
00124       unsigned line   
00125     ) = 0;
00126 
00132     virtual PBoolean SetLineOffHook(
00133       unsigned line,        
00134       PBoolean newState = PTrue  
00135     ) = 0;
00136 
00140     virtual PBoolean SetLineOnHook(
00141       unsigned line        
00142     ) { return SetLineOffHook(line, PFalse); }
00143 
00147     virtual PBoolean HookFlash(
00148       unsigned line,              
00149       unsigned flashTime = 200    
00150     );
00151 
00154     virtual PBoolean HasHookFlash(unsigned line);
00155 
00156 
00167     virtual PBoolean IsLineRinging(
00168       unsigned line,          
00169       DWORD * cadence = NULL  
00170     );
00171 
00189     virtual PBoolean RingLine(
00190       unsigned line,                   
00191       PINDEX nCadence,                 
00192       const unsigned * pattern = NULL, 
00193       unsigned frequency = 400         
00194     );
00195 
00196 
00207     virtual PBoolean SetLineConnected(
00208       unsigned line   
00209     );
00210 
00221     virtual PBoolean IsLineConnected(
00222       unsigned line   
00223     );
00224 
00225 
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 = 0;
00262 
00265     virtual PBoolean SetReadFormat(
00266       unsigned line,    
00267       const OpalMediaFormat & mediaFormat   
00268     ) = 0;
00269 
00272     virtual PBoolean SetWriteFormat(
00273       unsigned line,    
00274       const OpalMediaFormat & mediaFormat   
00275     ) = 0;
00276 
00279     virtual OpalMediaFormat GetReadFormat(
00280       unsigned line    
00281     ) = 0;
00282 
00285     virtual OpalMediaFormat GetWriteFormat(
00286       unsigned line    
00287     ) = 0;
00288 
00291     virtual PBoolean StopReading(
00292       unsigned line   
00293     );
00294 
00297     virtual PBoolean StopWriting(
00298       unsigned line   
00299     );
00300 
00305     virtual bool UsesRTP() const;
00306 
00311     virtual PBoolean SetReadFrameSize(
00312       unsigned line,    
00313       PINDEX frameSize  
00314     );
00315 
00320     virtual PBoolean SetWriteFrameSize(
00321       unsigned line,    
00322       PINDEX frameSize  
00323     );
00324 
00328     virtual PINDEX GetReadFrameSize(
00329       unsigned line   
00330     );
00331 
00335     virtual PINDEX GetWriteFrameSize(
00336       unsigned line   
00337     );
00338 
00341     virtual PBoolean ReadFrame(
00342       unsigned line,    
00343       void * buf,       
00344       PINDEX & count    
00345     ) = 0;
00346 
00349     virtual PBoolean WriteFrame(
00350       unsigned line,    
00351       const void * buf, 
00352       PINDEX count,     
00353       PINDEX & written  
00354     ) = 0;
00355 
00359     virtual PBoolean ReadBlock(
00360       unsigned line,    
00361       void * buf,   
00362       PINDEX count  
00363     );
00364 
00367     virtual PBoolean WriteBlock(
00368       unsigned line,    
00369       const void * buf, 
00370       PINDEX count      
00371     );
00372 
00373 
00376     virtual unsigned GetAverageSignalLevel(
00377       unsigned line,  
00378       PBoolean playback   
00379     );
00380 
00381 
00384     virtual PBoolean EnableAudio(
00385       unsigned line,      
00386       PBoolean enable = PTrue
00387     );
00388 
00391     PBoolean DisableAudio(
00392       unsigned line   
00393     ) { return EnableAudio(line, PFalse); }
00394 
00397     virtual PBoolean IsAudioEnabled(
00398       unsigned line      
00399     ) const;
00400 
00401 
00402     enum {
00403       MaxVolume = 100
00404     };
00405 
00410     virtual PBoolean SetRecordVolume(
00411       unsigned line,    
00412       unsigned volume   
00413     );
00414 
00419     virtual PBoolean SetPlayVolume(
00420       unsigned line,    
00421       unsigned volume   
00422     );
00423 
00428     virtual PBoolean GetRecordVolume(
00429       unsigned line,      
00430       unsigned & volume   
00431     );
00432 
00437     virtual PBoolean GetPlayVolume(
00438       unsigned line,      
00439       unsigned & volume   
00440     );
00441 
00442 
00443     enum AECLevels {
00444       AECOff,
00445       AECLow,
00446       AECMedium,
00447       AECHigh,
00448       AECAuto,
00449       AECAGC,
00450       AECError
00451     };
00452 
00456     virtual AECLevels GetAEC(
00457       unsigned line    
00458     );
00459 
00463     virtual PBoolean SetAEC(
00464       unsigned line,    
00465       AECLevels level   
00466     );
00467 
00471     virtual PBoolean GetVAD(
00472       unsigned line    
00473     );
00474 
00478     virtual PBoolean SetVAD(
00479       unsigned line,    
00480       PBoolean enable       
00481     );
00482 
00483 
00497     virtual PBoolean GetCallerID(
00498       unsigned line,      
00499       PString & idString, 
00500       PBoolean full = PFalse   
00501     );
00502 
00524     virtual PBoolean SetCallerID(
00525       unsigned line,            
00526       const PString & idString  
00527     );
00528 
00531     virtual PBoolean SendVisualMessageWaitingIndicator(
00532       unsigned line,            
00533       PBoolean on
00534     );
00535 
00536 
00537     enum {
00538       DefaultDTMFOnTime = 180,
00539       DefaultDTMFOffTime = 120
00540     };
00541 
00545     virtual PBoolean PlayDTMF(
00546       unsigned line,            
00547       const char * digits,      
00548       DWORD onTime = DefaultDTMFOnTime,  
00549       DWORD offTime = DefaultDTMFOffTime 
00550     );
00551 
00561     virtual char ReadDTMF(
00562       unsigned line   
00563     );
00564 
00569     virtual PBoolean GetRemoveDTMF(
00570       unsigned line   
00571     );
00572 
00577     virtual PBoolean SetRemoveDTMF(
00578       unsigned line,     
00579       PBoolean removeTones   
00580     );
00581 
00582 
00583     enum CallProgressTones {
00584       NoTone = -1, // indicates no tones
00585       DialTone,    // Dial tone
00586       RingTone,    // Ring indication tone
00587       BusyTone,    // Line engaged tone
00588       CongestionTone,// aka fast busy tone
00589       ClearTone,   // Call failed/disconnected tone (often same as busy tone)
00590       MwiTone,     // Message Waiting Tone
00591       CNGTone,     // Fax CNG tone
00592       CEDTone,     // Fax CED tone
00593       NumTones
00594     };
00595 
00598     virtual CallProgressTones IsToneDetected(
00599       unsigned line   
00600     );
00601 
00604     virtual CallProgressTones WaitForToneDetect(
00605       unsigned line,          
00606       unsigned timeout = 3000 
00607     );
00608 
00611     virtual PBoolean WaitForTone(
00612       unsigned line,          
00613       CallProgressTones tone, 
00614       unsigned timeout = 3000 
00615     );
00616 
00639     virtual bool SetToneDescription(
00640       unsigned line,              
00641       CallProgressTones tone,     
00642       const PString & description 
00643     );
00644 
00645     enum ToneMixingModes {
00646       SimpleTone,
00647       AddedTone,
00648       ModulatedTone
00649     };
00650 
00654     virtual bool SetToneParameters(
00655       unsigned line,            
00656       CallProgressTones tone,   
00657       unsigned frequency1,      
00658       unsigned frequency2,      
00659       ToneMixingModes mode,     
00660       PINDEX numCadences,       
00661       const unsigned * onTimes, 
00662       const unsigned * offTimes 
00663     );
00664 
00667     virtual PBoolean PlayTone(
00668       unsigned line,          
00669       CallProgressTones tone  
00670     );
00671 
00674     virtual PBoolean IsTonePlaying(
00675       unsigned line   
00676     );
00677 
00680     virtual PBoolean StopTone(
00681       unsigned line   
00682     );
00683 
00684 
00685     enum { DIAL_TONE_TIMEOUT = 10000 };
00686 
00702     virtual CallProgressTones DialOut(
00703       unsigned line,                
00704       const PString & number,       
00705       PBoolean requireTones = PFalse,    
00706       unsigned uiDialDelay = 0      
00707     );
00708 
00709 
00713     virtual unsigned GetWinkDuration(
00714       unsigned line    
00715     );
00716 
00720     virtual PBoolean SetWinkDuration(
00721       unsigned line,        
00722       unsigned winkDuration 
00723     );
00724 
00725 
00726     enum T35CountryCodes {
00727       Japan, Albania, Algeria, AmericanSamoa, Germany, Anguilla, AntiguaAndBarbuda,
00728       Argentina, Ascension, Australia, Austria, Bahamas, Bahrain, Bangladesh,
00729       Barbados, Belgium, Belize, Benin, Bermudas, Bhutan, Bolivia, Botswana,
00730       Brazil, BritishAntarcticTerritory, BritishIndianOceanTerritory, 
00731       BritishVirginIslands, BruneiDarussalam, Bulgaria, Myanmar, Burundi,
00732       Byelorussia, Cameroon, Canada, CapeVerde, CaymanIslands,
00733       CentralAfricanRepublic, Chad, Chile, China, Colombia, Comoros, Congo,
00734       CookIslands, CostaRica, Cuba, Cyprus, Czechoslovakia, Cambodia,
00735       DemocraticPeoplesRepublicOfKorea, Denmark, Djibouti, DominicanRepublic,
00736       Dominica, Ecuador, Egypt, ElSalvador, EquatorialGuinea, Ethiopia,
00737       FalklandIslands, Fiji, Finland, France, FrenchPolynesia,
00738       FrenchSouthernAndAntarcticLands, Gabon, Gambia, Germany2, Angola, Ghana,
00739       Gibraltar, Greece, Grenada, Guam, Guatemala, Guernsey, Guinea, GuineaBissau,
00740       Guayana, Haiti, Honduras, Hongkong, Hungary, Iceland, India, Indonesia,
00741       Iran, Iraq, Ireland, Israel, Italy, CotedIvoire, Jamaica, Afghanistan,
00742       Jersey, Jordan, Kenya, Kiribati, KoreaRepublic, Kuwait, Lao, Lebanon,
00743       Lesotho, Liberia, Libya, Liechtenstein, Luxemborg, Macao, Madagascar,
00744       Malaysia, Malawi, Maldives, Mali, Malta, Mauritania, Mauritius, Mexico,
00745       Monaco, Mongolia, Montserrat, Morocco, Mozambique, Nauru, Nepal,
00746       Netherlands, NetherlandsAntilles, NewCaledonia, NewZealand, Nicaragua,
00747       Niger, Nigeria, Norway, Oman, Pakistan, Panama, PapuaNewGuinea, Paraguay,
00748       Peru, Philippines, Poland, Portugal, PuertoRico, Qatar, Romania, Rwanda,
00749       SaintKittsAndNevis, SaintCroix, SaintHelenaAndAscension, SaintLucia,
00750       SanMarino, SaintThomas, SaoTomeAndPrincipe, SaintVicentAndTheGrenadines,
00751       SaudiArabia, Senegal, Seychelles, SierraLeone, Singapore, SolomonIslands,
00752       Somalia, SouthAfrica, Spain, SriLanka, Sudan, Suriname, Swaziland, Sweden,
00753       Switzerland, Syria, Tanzania, Thailand, Togo, Tonga, TrinidadAndTobago,
00754       Tunisia, Turkey, TurksAndCaicosIslands, Tuvalu, Uganda, Ukraine,
00755       UnitedArabEmirates, UnitedKingdom, UnitedStates, BurkinaFaso, Uruguay,
00756       USSR, Vanuatu, VaticanCityState, Venezuela, VietNam, WallisAndFutuna,
00757       WesternSamoa, Yemen, Yemen2, Yugoslavia, Zaire, Zambia, Zimbabwe,
00758       NumCountryCodes,
00759       UnknownCountry = -1
00760     };
00761 
00764     T35CountryCodes GetCountryCode() const { return countryCode; }
00765 
00768     PString GetCountryCodeName() const;
00769 
00772     static PString GetCountryCodeName(T35CountryCodes code);
00773     static T35CountryCodes GetCountryCode(const PString & name);
00774 
00780     virtual PBoolean SetCountryCode(
00781       T35CountryCodes country   
00782     );
00783 
00786     virtual PBoolean SetCountryCodeName(
00787       const PString & countryName   
00788     );
00789 
00792     virtual PStringList GetCountryCodeNameList() const;
00793 
00794 
00797     virtual PBoolean PlayAudio(
00798       unsigned line,            
00799       const PString & filename  
00800     );
00801     
00804     virtual PBoolean StopAudio(
00805       unsigned line   
00806     );
00807 
00808 
00812     virtual PBoolean RecordAudioStart(
00813       unsigned line,            
00814       const PString & filename  
00815     );
00816     
00821     virtual PBoolean RecordAudioStop(
00822       unsigned line            
00823     );
00824     
00825 
00828     int GetErrorNumber() const { return osError; }
00829 
00832     PString GetErrorText() const;
00833 
00834     virtual void PrintOn(
00835       ostream & strm
00836     ) const;
00837 
00840     static OpalLineInterfaceDevice * Create(
00841       const PString & type,     
00842       void * parameters = NULL  
00843     );
00844 
00847     static PStringList GetAllTypes();
00848 
00853     static PStringList GetAllDevices();
00854 
00855         
00856   protected:
00857     int    getOsHandle() const {return os_handle;};
00858     void   setOsHandle(int os_handleToSet) {os_handle = os_handleToSet;};
00859     
00860     int    getOsError() const {return osError;};
00861     void   setOsError(int osErrorToSet) {osError = osErrorToSet;};
00862     
00863     const PBYTEArray& getReadDeblockingBuffer(){return m_readDeblockingBuffer;};
00864     const PBYTEArray& getWriteDeblockingBuffer(){return m_writeDeblockingBuffer;};
00865     PINDEX getReadDeblockingOffset() const {return m_readDeblockingOffset;};
00866     void   setReadDeblockingOffset(PINDEX readDeblockingOffset) {m_readDeblockingOffset = readDeblockingOffset;};
00867     
00868     PINDEX getWriteDeblockingOffset() const {return m_writeDeblockingOffset;};
00869     void   setWriteDeblockingOffset(PINDEX writeDeblockingOffset) {m_writeDeblockingOffset = writeDeblockingOffset;};
00870     
00871     unsigned int getDialToneTimeout() const {return m_uiDialToneTimeout;};
00872     void   setDialToneTimeout(unsigned int uiDialToneTimeout) {m_uiDialToneTimeout = uiDialToneTimeout;};
00873         
00874     int               os_handle;
00875     mutable int       osError;
00876     T35CountryCodes   countryCode;
00877     PBYTEArray        m_readDeblockingBuffer, m_writeDeblockingBuffer;
00878     PINDEX            m_readDeblockingOffset, m_writeDeblockingOffset;
00879     unsigned int      m_uiDialToneTimeout;
00880     std::vector<bool> m_LineAudioEnabled;
00881     PString           m_callProgressTones[NumTones];
00882 #if PTRACING
00883     friend ostream & operator<<(ostream & o, CallProgressTones t);
00884 #endif
00885 };
00886 
00887 
00888 PLIST(OpalLIDList, OpalLineInterfaceDevice);
00889 
00890 
00891 
00894 class OpalLine : public PObject
00895 {
00896     PCLASSINFO(OpalLine, PObject);
00897   public:
00902     OpalLine(
00903       OpalLineInterfaceDevice & device, 
00904       unsigned lineNumber,              
00905       const char * userToken = NULL     
00906     );
00908 
00915     void PrintOn(
00916       ostream & strm    
00917     ) const;
00919 
00928     virtual PBoolean IsTerminal() { return device.IsLineTerminal(lineNumber); }
00929 
00930 
00933     virtual PBoolean IsPresent(
00934       PBoolean force = PFalse  
00935     ) { return device.IsLinePresent(lineNumber, force); }
00936 
00937 
00943     virtual PBoolean IsOffHook() { return device.IsLineOffHook(lineNumber); }
00944 
00950     virtual PBoolean SetOffHook() { return device.SetLineOffHook(lineNumber, PTrue); }
00951 
00955     virtual PBoolean SetOnHook() { return device.SetLineOffHook(lineNumber, PFalse); }
00956 
00960     virtual PBoolean HookFlash(
00961       unsigned flashTime = 200    
00962     ) { return device.HookFlash(lineNumber, flashTime); }
00963 
00966     virtual PBoolean HasHookFlash() { return device.HasHookFlash(lineNumber); }
00967 
00968 
00979     virtual PBoolean IsRinging(
00980       DWORD * cadence = NULL  
00981     ) { return device.IsLineRinging(lineNumber, cadence); }
00982 
00986     virtual unsigned GetRingCount(
00987       DWORD * cadence = NULL  
00988     );
00989 
01007     virtual PBoolean Ring(
01008       PINDEX nCadence,                 
01009       const unsigned * pattern = NULL, 
01010       unsigned frequency = 400         
01011     ) { return device.RingLine(lineNumber, nCadence, pattern, frequency); }
01012 
01013 
01024     virtual PBoolean SetConnected() { return device.IsLineConnected(lineNumber); }
01025 
01033     virtual PBoolean IsLineConnected() { return device.IsLineConnected(lineNumber); }
01034 
01035 
01039     virtual PBoolean IsDisconnected() { return device.IsLineDisconnected(lineNumber); }
01040 
01043     virtual PBoolean SetReadFormat(
01044       const OpalMediaFormat & mediaFormat   
01045     ) { return device.SetReadFormat(lineNumber, mediaFormat); }
01046 
01049     virtual PBoolean SetWriteFormat(
01050       const OpalMediaFormat & mediaFormat   
01051     ) { return device.SetWriteFormat(lineNumber, mediaFormat); }
01052 
01055     virtual OpalMediaFormat GetReadFormat() { return device.GetReadFormat(lineNumber); }
01056 
01059     virtual OpalMediaFormat GetWriteFormat() { return device.GetWriteFormat(lineNumber); }
01060 
01063     virtual PBoolean StopReading() { return device.StopReading(lineNumber); }
01064 
01067     virtual PBoolean StopWriting() { return device.StopWriting(lineNumber); }
01068 
01073     virtual PBoolean SetReadFrameSize(
01074       PINDEX frameSize  
01075     ) { return device.SetReadFrameSize(lineNumber, frameSize); }
01076 
01081     virtual PBoolean SetWriteFrameSize(
01082       PINDEX frameSize  
01083     ) { return device.SetWriteFrameSize(lineNumber, frameSize); }
01084 
01088     virtual PINDEX GetReadFrameSize() { return device.GetReadFrameSize(lineNumber); }
01089 
01093     virtual PINDEX GetWriteFrameSize() { return device.GetWriteFrameSize(lineNumber); }
01094 
01097     virtual PBoolean ReadFrame(
01098       void * buf,       
01099       PINDEX & count    
01100     ) { return device.ReadFrame(lineNumber, buf, count); }
01101 
01104     virtual PBoolean WriteFrame(
01105       const void * buf, 
01106       PINDEX count,     
01107       PINDEX & written  
01108     ) { return device.WriteFrame(lineNumber, buf, count, written); }
01109 
01113     virtual PBoolean ReadBlock(
01114       void * buf,   
01115       PINDEX count  
01116     ) { return device.ReadBlock(lineNumber, buf, count); }
01117 
01120     virtual PBoolean WriteBlock(
01121       const void * buf, 
01122       PINDEX count      
01123     ) { return device.WriteBlock(lineNumber, buf, count); }
01124 
01125 
01128     virtual unsigned GetAverageSignalLevel(
01129       PBoolean playback   
01130     ) { return device.GetAverageSignalLevel(lineNumber, playback); }
01131 
01132 
01135     virtual PBoolean EnableAudio(
01136       PBoolean enable = PTrue
01137     ) { return device.EnableAudio(lineNumber, enable); }
01138 
01141     PBoolean DisableAudio() { return EnableAudio(PFalse); }
01142 
01145     virtual PBoolean IsAudioEnabled() const { return device.IsAudioEnabled(lineNumber); }
01146 
01147 
01152     virtual PBoolean SetRecordVolume(
01153       unsigned volume   
01154     ) { return device.SetRecordVolume(lineNumber, volume); }
01155 
01160     virtual PBoolean SetPlayVolume(
01161       unsigned volume   
01162     ) { return device.SetPlayVolume(lineNumber, volume); }
01163 
01168     virtual PBoolean GetRecordVolume(
01169       unsigned & volume   
01170     ) { return device.GetRecordVolume(lineNumber, volume); }
01171 
01176     virtual PBoolean GetPlayVolume(
01177       unsigned & volume   
01178     ) { return device.GetPlayVolume(lineNumber, volume); }
01179 
01180 
01184     virtual OpalLineInterfaceDevice::AECLevels GetAEC() { return device.GetAEC(lineNumber); }
01185 
01189     virtual PBoolean SetAEC(
01190       OpalLineInterfaceDevice::AECLevels level  
01191     ) { return device.SetAEC(lineNumber, level); }
01192 
01193 
01197     virtual PBoolean GetVAD() { return device.GetVAD(lineNumber); }
01198 
01202     virtual PBoolean SetVAD(
01203       PBoolean enable       
01204     ) { return device.SetVAD(lineNumber, enable); }
01205 
01206 
01220     virtual PBoolean GetCallerID(
01221       PString & idString, 
01222       PBoolean full = PFalse   
01223     ) { return device.GetCallerID(lineNumber, idString, full); }
01224 
01246     virtual PBoolean SetCallerID(
01247       const PString & idString  
01248     ) { return device.SetCallerID(lineNumber, idString); }
01249 
01252     virtual PBoolean SendVisualMessageWaitingIndicator(
01253       PBoolean on
01254     ) { return device.SendVisualMessageWaitingIndicator(lineNumber, on); }
01255 
01256 
01260     virtual PBoolean PlayDTMF(
01261       const char * digits,      
01262       DWORD onTime = OpalLineInterfaceDevice::DefaultDTMFOnTime,  
01263       DWORD offTime = OpalLineInterfaceDevice::DefaultDTMFOffTime 
01264     ) { return device.PlayDTMF(lineNumber, digits, onTime, offTime); }
01265 
01275     virtual char ReadDTMF() { return device.ReadDTMF(lineNumber); }
01276 
01281     virtual PBoolean GetRemoveDTMF() { return device.GetRemoveDTMF(lineNumber); }
01282 
01287     virtual PBoolean SetRemoveDTMF(
01288       PBoolean removeTones   
01289     ) { return device.SetRemoveDTMF(lineNumber, removeTones); }
01290 
01291 
01294     virtual OpalLineInterfaceDevice::CallProgressTones IsToneDetected() { return device.IsToneDetected(lineNumber); }
01295 
01298     virtual OpalLineInterfaceDevice::CallProgressTones WaitForToneDetect(
01299       unsigned timeout = 3000 
01300     ) { return device.WaitForToneDetect(lineNumber, timeout); }
01301 
01304     virtual PBoolean WaitForTone(
01305       OpalLineInterfaceDevice::CallProgressTones tone, 
01306       unsigned timeout = 3000 
01307     ) { return device.WaitForTone(lineNumber, tone, timeout); }
01308 
01311     virtual PBoolean PlayTone(
01312       OpalLineInterfaceDevice::CallProgressTones tone  
01313     ) { return device.PlayTone(lineNumber, tone); }
01314 
01317     virtual PBoolean IsTonePlaying() { return device.IsTonePlaying(lineNumber); }
01318 
01321     virtual PBoolean StopTone() { return device.StopTone(lineNumber); }
01322 
01323 
01339     virtual OpalLineInterfaceDevice::CallProgressTones DialOut(
01340       const PString & number,       
01341       PBoolean requireTones = PFalse,    
01342       unsigned uiDialDelay = 0      
01343     ) { return device.DialOut(lineNumber, number, requireTones, uiDialDelay); }
01345 
01350     OpalLineInterfaceDevice & GetDevice() const { return device; }
01351 
01354     unsigned GetLineNumber() const { return lineNumber; }
01355 
01358     PString GetToken() const { return token; }
01359 
01362     void SetToken(const PString & t) { token = t; }
01364 
01365   protected:
01366     OpalLineInterfaceDevice & device;
01367     unsigned                  lineNumber;
01368     PString                   token;
01369     unsigned                  ringCount;
01370     PTimeInterval             ringTick;
01371     PTimeInterval             ringStoppedTime;
01372     PTimeInterval             ringInterCadenceTime;
01373 };
01374 
01375 
01376 PLIST(OpalLineList, OpalLine);
01377 
01378 
01385 class OpalLIDRegistration : public PCaselessString
01386 {
01387     PCLASSINFO(OpalLIDRegistration, PCaselessString);
01388   public:
01393     OpalLIDRegistration(
01394       const char * name  
01395     );
01396 
01399     ~OpalLIDRegistration();
01401 
01406     virtual OpalLineInterfaceDevice * Create(
01407       void * parameters   
01408     ) const = 0;
01410 
01411   protected:
01412     OpalLIDRegistration * link;
01413     bool                  duplicate;
01414 
01415   friend class OpalLineInterfaceDevice;
01416 };
01417 
01418 
01419 #define OPAL_REGISTER_LID_FUNCTION(cls, type, param) \
01420 static class cls##_Registration : public OpalLIDRegistration { \
01421   public: \
01422     cls##_Registration() : OpalLIDRegistration(type) { } \
01423     OpalLineInterfaceDevice * Create(void * param) const; \
01424 } instance_##cls##_Registration; \
01425 OpalLineInterfaceDevice * cls##_Registration::Create(void * param) const
01426 
01427 #ifndef OPAL_NO_PARAM
01428 #define OPAL_NO_PARAM
01429 #endif
01430 
01431 #define OPAL_REGISTER_LID(cls, type) \
01432   OPAL_REGISTER_LID_FUNCTION(cls, type, OPAL_NO_PARAM) \
01433   { return new cls; }
01434 
01435 #define OPAL_REGISTER_LID_PARAM(cls, type) \
01436   OPAL_REGISTER_LID_FUNCTION(cls, type, parameter) \
01437   { return new cls(parameter); }
01438 
01439 
01440 #endif // __OPAL_LID_H
01441 
01442 
01443 // End of File ///////////////////////////////////////////////////////////////

Generated on Wed May 7 00:56:00 2008 for OPAL by  doxygen 1.5.1