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: 20940 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-09-12 10:05:45 +0000 (Fri, 12 Sep 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     ) const;
00459 
00463     virtual PBoolean SetAEC(
00464       unsigned line,    
00465       AECLevels level   
00466     );
00467 
00471     virtual PBoolean GetVAD(
00472       unsigned line    
00473     ) const;
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 = 150,
00539       DefaultDTMFOffTime = 50
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 
00686     struct DialParams {
00687       DialParams()
00688         : m_requireTones(false)
00689         , m_dialToneTimeout(2500)
00690         , m_dialStartDelay(500)
00691         , m_dialDigitTime(DefaultDTMFOnTime)
00692         , m_dialInterDigitTime(DefaultDTMFOffTime)
00693         , m_progressTimeout(5000)
00694         , m_commaDelay(2000)
00695       { }
00696 
00697       bool     m_requireTones;      
00698       unsigned m_dialToneTimeout;   
00699       unsigned m_dialStartDelay;    
00700       unsigned m_dialDigitTime;     
00701       unsigned m_dialInterDigitTime;
00702       unsigned m_progressTimeout;   
00703       unsigned m_commaDelay;        
00704     };
00705 
00721     virtual CallProgressTones DialOut(
00722       unsigned line,                
00723       const PString & number,       
00724       const DialParams & params = DialParams() 
00725     );
00726 
00727 
00731     virtual unsigned GetWinkDuration(
00732       unsigned line    
00733     );
00734 
00738     virtual PBoolean SetWinkDuration(
00739       unsigned line,        
00740       unsigned winkDuration 
00741     );
00742 
00743 
00744     enum T35CountryCodes {
00745       Japan, Albania, Algeria, AmericanSamoa, Germany, Anguilla, AntiguaAndBarbuda,
00746       Argentina, Ascension, Australia, Austria, Bahamas, Bahrain, Bangladesh,
00747       Barbados, Belgium, Belize, Benin, Bermudas, Bhutan, Bolivia, Botswana,
00748       Brazil, BritishAntarcticTerritory, BritishIndianOceanTerritory, 
00749       BritishVirginIslands, BruneiDarussalam, Bulgaria, Myanmar, Burundi,
00750       Byelorussia, Cameroon, Canada, CapeVerde, CaymanIslands,
00751       CentralAfricanRepublic, Chad, Chile, China, Colombia, Comoros, Congo,
00752       CookIslands, CostaRica, Cuba, Cyprus, Czechoslovakia, Cambodia,
00753       DemocraticPeoplesRepublicOfKorea, Denmark, Djibouti, DominicanRepublic,
00754       Dominica, Ecuador, Egypt, ElSalvador, EquatorialGuinea, Ethiopia,
00755       FalklandIslands, Fiji, Finland, France, FrenchPolynesia,
00756       FrenchSouthernAndAntarcticLands, Gabon, Gambia, Germany2, Angola, Ghana,
00757       Gibraltar, Greece, Grenada, Guam, Guatemala, Guernsey, Guinea, GuineaBissau,
00758       Guayana, Haiti, Honduras, Hongkong, Hungary, Iceland, India, Indonesia,
00759       Iran, Iraq, Ireland, Israel, Italy, CotedIvoire, Jamaica, Afghanistan,
00760       Jersey, Jordan, Kenya, Kiribati, KoreaRepublic, Kuwait, Lao, Lebanon,
00761       Lesotho, Liberia, Libya, Liechtenstein, Luxemborg, Macao, Madagascar,
00762       Malaysia, Malawi, Maldives, Mali, Malta, Mauritania, Mauritius, Mexico,
00763       Monaco, Mongolia, Montserrat, Morocco, Mozambique, Nauru, Nepal,
00764       Netherlands, NetherlandsAntilles, NewCaledonia, NewZealand, Nicaragua,
00765       Niger, Nigeria, Norway, Oman, Pakistan, Panama, PapuaNewGuinea, Paraguay,
00766       Peru, Philippines, Poland, Portugal, PuertoRico, Qatar, Romania, Rwanda,
00767       SaintKittsAndNevis, SaintCroix, SaintHelenaAndAscension, SaintLucia,
00768       SanMarino, SaintThomas, SaoTomeAndPrincipe, SaintVicentAndTheGrenadines,
00769       SaudiArabia, Senegal, Seychelles, SierraLeone, Singapore, SolomonIslands,
00770       Somalia, SouthAfrica, Spain, SriLanka, Sudan, Suriname, Swaziland, Sweden,
00771       Switzerland, Syria, Tanzania, Thailand, Togo, Tonga, TrinidadAndTobago,
00772       Tunisia, Turkey, TurksAndCaicosIslands, Tuvalu, Uganda, Ukraine,
00773       UnitedArabEmirates, UnitedKingdom, UnitedStates, BurkinaFaso, Uruguay,
00774       USSR, Vanuatu, VaticanCityState, Venezuela, VietNam, WallisAndFutuna,
00775       WesternSamoa, Yemen, Yemen2, Yugoslavia, Zaire, Zambia, Zimbabwe,
00776       NumCountryCodes,
00777       UnknownCountry = -1
00778     };
00779 
00782     T35CountryCodes GetCountryCode() const { return countryCode; }
00783 
00786     PString GetCountryCodeName() const;
00787 
00790     static PString GetCountryCodeName(T35CountryCodes code);
00791     static T35CountryCodes GetCountryCode(const PString & name);
00792 
00798     virtual PBoolean SetCountryCode(
00799       T35CountryCodes country   
00800     );
00801 
00804     virtual PBoolean SetCountryCodeName(
00805       const PString & countryName   
00806     );
00807 
00810     virtual PStringList GetCountryCodeNameList() const;
00811 
00812 
00815     virtual PBoolean PlayAudio(
00816       unsigned line,            
00817       const PString & filename  
00818     );
00819     
00822     virtual PBoolean StopAudio(
00823       unsigned line   
00824     );
00825 
00826 
00830     virtual PBoolean RecordAudioStart(
00831       unsigned line,            
00832       const PString & filename  
00833     );
00834     
00839     virtual PBoolean RecordAudioStop(
00840       unsigned line            
00841     );
00842     
00843 
00846     int GetErrorNumber() const { return osError; }
00847 
00850     PString GetErrorText() const;
00851 
00852     virtual void PrintOn(
00853       ostream & strm
00854     ) const;
00855 
00858     static OpalLineInterfaceDevice * Create(
00859       const PString & type,     
00860       void * parameters = NULL  
00861     );
00862 
00867     static OpalLineInterfaceDevice * CreateAndOpen(
00868       const PString & descriptor,     
00869       void * parameters = NULL  
00870     );
00871 
00874     static PStringList GetAllTypes();
00875 
00880     static PStringList GetAllDevices();
00881 
00882         
00883   protected:
00884     int               os_handle;
00885     mutable int       osError;
00886     T35CountryCodes   countryCode;
00887     PBYTEArray        m_readDeblockingBuffer, m_writeDeblockingBuffer;
00888     PINDEX            m_readDeblockingOffset, m_writeDeblockingOffset;
00889     std::vector<bool> m_LineAudioEnabled;
00890     PString           m_callProgressTones[NumTones];
00891 #if PTRACING
00892     friend ostream & operator<<(ostream & o, CallProgressTones t);
00893 #endif
00894 };
00895 
00896 
00897 PLIST(OpalLIDList, OpalLineInterfaceDevice);
00898 
00899 
00900 
00903 class OpalLine : public PObject
00904 {
00905     PCLASSINFO(OpalLine, PObject);
00906   public:
00911     OpalLine(
00912       OpalLineInterfaceDevice & device, 
00913       unsigned lineNumber,              
00914       const char * userToken = NULL     
00915     );
00917 
00924     void PrintOn(
00925       ostream & strm    
00926     ) const;
00928 
00937     virtual PBoolean IsTerminal() { return device.IsLineTerminal(lineNumber); }
00938 
00939 
00942     virtual PBoolean IsPresent(
00943       PBoolean force = PFalse  
00944     ) { return device.IsLinePresent(lineNumber, force); }
00945 
00946 
00952     virtual PBoolean IsOffHook() { return device.IsLineOffHook(lineNumber); }
00953 
00959     virtual PBoolean SetOffHook() { return device.SetLineOffHook(lineNumber, PTrue); }
00960 
00964     virtual PBoolean SetOnHook() { return device.SetLineOffHook(lineNumber, PFalse); }
00965 
00969     virtual PBoolean HookFlash(
00970       unsigned flashTime = 200    
00971     ) { return device.HookFlash(lineNumber, flashTime); }
00972 
00975     virtual PBoolean HasHookFlash() { return device.HasHookFlash(lineNumber); }
00976 
00977 
00988     virtual PBoolean IsRinging(
00989       DWORD * cadence = NULL  
00990     );
00991 
00995     virtual unsigned GetRingCount(
00996       DWORD * cadence = NULL  
00997     );
00998 
01016     virtual PBoolean Ring(
01017       PINDEX nCadence,                 
01018       const unsigned * pattern = NULL, 
01019       unsigned frequency = 400         
01020     ) { return device.RingLine(lineNumber, nCadence, pattern, frequency); }
01021 
01022 
01033     virtual PBoolean SetConnected() { return device.SetLineConnected(lineNumber); }
01034 
01042     virtual PBoolean IsConnected() { return device.IsLineConnected(lineNumber); }
01043 
01044 
01048     virtual PBoolean IsDisconnected() { return device.IsLineDisconnected(lineNumber); }
01049 
01052     virtual PBoolean SetReadFormat(
01053       const OpalMediaFormat & mediaFormat   
01054     ) { return device.SetReadFormat(lineNumber, mediaFormat); }
01055 
01058     virtual PBoolean SetWriteFormat(
01059       const OpalMediaFormat & mediaFormat   
01060     ) { return device.SetWriteFormat(lineNumber, mediaFormat); }
01061 
01064     virtual OpalMediaFormat GetReadFormat() { return device.GetReadFormat(lineNumber); }
01065 
01068     virtual OpalMediaFormat GetWriteFormat() { return device.GetWriteFormat(lineNumber); }
01069 
01072     virtual PBoolean StopReading() { return device.StopReading(lineNumber); }
01073 
01076     virtual PBoolean StopWriting() { return device.StopWriting(lineNumber); }
01077 
01082     virtual PBoolean SetReadFrameSize(
01083       PINDEX frameSize  
01084     ) { return device.SetReadFrameSize(lineNumber, frameSize); }
01085 
01090     virtual PBoolean SetWriteFrameSize(
01091       PINDEX frameSize  
01092     ) { return device.SetWriteFrameSize(lineNumber, frameSize); }
01093 
01097     virtual PINDEX GetReadFrameSize() { return device.GetReadFrameSize(lineNumber); }
01098 
01102     virtual PINDEX GetWriteFrameSize() { return device.GetWriteFrameSize(lineNumber); }
01103 
01106     virtual PBoolean ReadFrame(
01107       void * buf,       
01108       PINDEX & count    
01109     ) { return device.ReadFrame(lineNumber, buf, count); }
01110 
01113     virtual PBoolean WriteFrame(
01114       const void * buf, 
01115       PINDEX count,     
01116       PINDEX & written  
01117     ) { return device.WriteFrame(lineNumber, buf, count, written); }
01118 
01122     virtual PBoolean ReadBlock(
01123       void * buf,   
01124       PINDEX count  
01125     ) { return device.ReadBlock(lineNumber, buf, count); }
01126 
01129     virtual PBoolean WriteBlock(
01130       const void * buf, 
01131       PINDEX count      
01132     ) { return device.WriteBlock(lineNumber, buf, count); }
01133 
01134 
01137     virtual unsigned GetAverageSignalLevel(
01138       PBoolean playback   
01139     ) { return device.GetAverageSignalLevel(lineNumber, playback); }
01140 
01141 
01144     virtual PBoolean EnableAudio(
01145       PBoolean enable = PTrue
01146     ) { return device.EnableAudio(lineNumber, enable); }
01147 
01150     PBoolean DisableAudio() { return EnableAudio(PFalse); }
01151 
01154     virtual PBoolean IsAudioEnabled() const { return device.IsAudioEnabled(lineNumber); }
01155 
01156 
01161     virtual PBoolean SetRecordVolume(
01162       unsigned volume   
01163     ) { return device.SetRecordVolume(lineNumber, volume); }
01164 
01169     virtual PBoolean SetPlayVolume(
01170       unsigned volume   
01171     ) { return device.SetPlayVolume(lineNumber, volume); }
01172 
01177     virtual PBoolean GetRecordVolume(
01178       unsigned & volume   
01179     ) { return device.GetRecordVolume(lineNumber, volume); }
01180 
01185     virtual PBoolean GetPlayVolume(
01186       unsigned & volume   
01187     ) { return device.GetPlayVolume(lineNumber, volume); }
01188 
01189 
01193     virtual OpalLineInterfaceDevice::AECLevels GetAEC() const { return device.GetAEC(lineNumber); }
01194 
01198     virtual PBoolean SetAEC(
01199       OpalLineInterfaceDevice::AECLevels level  
01200     ) { return device.SetAEC(lineNumber, level); }
01201 
01202 
01206     virtual PBoolean GetVAD() const { return device.GetVAD(lineNumber); }
01207 
01211     virtual PBoolean SetVAD(
01212       PBoolean enable       
01213     ) { return device.SetVAD(lineNumber, enable); }
01214 
01215 
01229     virtual PBoolean GetCallerID(
01230       PString & idString, 
01231       PBoolean full = PFalse   
01232     ) { return device.GetCallerID(lineNumber, idString, full); }
01233 
01255     virtual PBoolean SetCallerID(
01256       const PString & idString  
01257     ) { return device.SetCallerID(lineNumber, idString); }
01258 
01261     virtual PBoolean SendVisualMessageWaitingIndicator(
01262       PBoolean on
01263     ) { return device.SendVisualMessageWaitingIndicator(lineNumber, on); }
01264 
01265 
01269     virtual PBoolean PlayDTMF(
01270       const char * digits,      
01271       DWORD onTime = OpalLineInterfaceDevice::DefaultDTMFOnTime,  
01272       DWORD offTime = OpalLineInterfaceDevice::DefaultDTMFOffTime 
01273     ) { return device.PlayDTMF(lineNumber, digits, onTime, offTime); }
01274 
01284     virtual char ReadDTMF() { return device.ReadDTMF(lineNumber); }
01285 
01290     virtual PBoolean GetRemoveDTMF() { return device.GetRemoveDTMF(lineNumber); }
01291 
01296     virtual PBoolean SetRemoveDTMF(
01297       PBoolean removeTones   
01298     ) { return device.SetRemoveDTMF(lineNumber, removeTones); }
01299 
01300 
01303     virtual OpalLineInterfaceDevice::CallProgressTones IsToneDetected() { return device.IsToneDetected(lineNumber); }
01304 
01307     virtual OpalLineInterfaceDevice::CallProgressTones WaitForToneDetect(
01308       unsigned timeout = 3000 
01309     ) { return device.WaitForToneDetect(lineNumber, timeout); }
01310 
01313     virtual PBoolean WaitForTone(
01314       OpalLineInterfaceDevice::CallProgressTones tone, 
01315       unsigned timeout = 3000 
01316     ) { return device.WaitForTone(lineNumber, tone, timeout); }
01317 
01320     virtual PBoolean PlayTone(
01321       OpalLineInterfaceDevice::CallProgressTones tone  
01322     ) { return device.PlayTone(lineNumber, tone); }
01323 
01326     virtual PBoolean IsTonePlaying() { return device.IsTonePlaying(lineNumber); }
01327 
01330     virtual PBoolean StopTone() { return device.StopTone(lineNumber); }
01331 
01332 
01348     virtual OpalLineInterfaceDevice::CallProgressTones DialOut(
01349       const PString & number,       
01350       const OpalLineInterfaceDevice::DialParams & params = OpalLineInterfaceDevice::DialParams() 
01351     ) { return device.DialOut(lineNumber, number, params); }
01353 
01358     OpalLineInterfaceDevice & GetDevice() const { return device; }
01359 
01362     unsigned GetLineNumber() const { return lineNumber; }
01363 
01366     PString GetToken() const { return token; }
01367 
01370     void SetToken(const PString & t) { token = t; }
01372 
01373   protected:
01374     OpalLineInterfaceDevice & device;
01375     unsigned                  lineNumber;
01376     PString                   token;
01377     PTimeInterval             ringStoppedTime;
01378     PTimeInterval             ringInterCadenceTime;
01379 
01380     PTimeInterval             ringTick;
01381     unsigned                  ringCount;
01382     bool                      lastRingState;
01383 };
01384 
01385 
01386 PLIST(OpalLineList, OpalLine);
01387 
01388 
01395 class OpalLIDRegistration : public PCaselessString
01396 {
01397     PCLASSINFO(OpalLIDRegistration, PCaselessString);
01398   public:
01403     OpalLIDRegistration(
01404       const char * name  
01405     );
01406 
01409     ~OpalLIDRegistration();
01411 
01416     virtual OpalLineInterfaceDevice * Create(
01417       void * parameters   
01418     ) const = 0;
01420 
01421   protected:
01422     OpalLIDRegistration * link;
01423     bool                  duplicate;
01424 
01425   friend class OpalLineInterfaceDevice;
01426 };
01427 
01428 
01429 #define OPAL_REGISTER_LID_FUNCTION(cls, type, param) \
01430 static class cls##_Registration : public OpalLIDRegistration { \
01431   public: \
01432     cls##_Registration() : OpalLIDRegistration(type) { } \
01433     OpalLineInterfaceDevice * Create(void * param) const; \
01434 } instance_##cls##_Registration; \
01435 OpalLineInterfaceDevice * cls##_Registration::Create(void * param) const
01436 
01437 #ifndef OPAL_NO_PARAM
01438 #define OPAL_NO_PARAM
01439 #endif
01440 
01441 #define OPAL_REGISTER_LID(cls, type) \
01442   OPAL_REGISTER_LID_FUNCTION(cls, type, OPAL_NO_PARAM) \
01443   { return new cls; }
01444 
01445 #define OPAL_REGISTER_LID_PARAM(cls, type) \
01446   OPAL_REGISTER_LID_FUNCTION(cls, type, parameter) \
01447   { return new cls(parameter); }
01448 
01449 
01450 #endif // __OPAL_LID_H
01451 
01452 
01453 // End of File ///////////////////////////////////////////////////////////////

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