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: 19427 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-02-09 03:23:08 +0000 (Sat, 09 Feb 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 
00203     virtual PBoolean IsLineDisconnected(
00204       unsigned line,   
00205       PBoolean checkForWink = PTrue
00206     );
00207 
00208 
00211     virtual PBoolean SetLineToLineDirect(
00212       unsigned line1,   
00213       unsigned line2,   
00214       PBoolean connect      
00215     );
00216 
00219     virtual PBoolean IsLineToLineDirect(
00220       unsigned line1,   
00221       unsigned line2    
00222     );
00223 
00224 
00227     virtual OpalMediaFormatList GetMediaFormats() const = 0;
00228 
00231     virtual PBoolean SetReadFormat(
00232       unsigned line,    
00233       const OpalMediaFormat & mediaFormat   
00234     ) = 0;
00235 
00238     virtual PBoolean SetWriteFormat(
00239       unsigned line,    
00240       const OpalMediaFormat & mediaFormat   
00241     ) = 0;
00242 
00245     virtual OpalMediaFormat GetReadFormat(
00246       unsigned line    
00247     ) = 0;
00248 
00251     virtual OpalMediaFormat GetWriteFormat(
00252       unsigned line    
00253     ) = 0;
00254 
00257     virtual PBoolean StopReading(
00258       unsigned line   
00259     );
00260 
00263     virtual PBoolean StopWriting(
00264       unsigned line   
00265     );
00266 
00271     virtual PBoolean SetReadFrameSize(
00272       unsigned line,    
00273       PINDEX frameSize  
00274     ) = 0;
00275 
00280     virtual PBoolean SetWriteFrameSize(
00281       unsigned line,    
00282       PINDEX frameSize  
00283     ) = 0;
00284 
00288     virtual PINDEX GetReadFrameSize(
00289       unsigned line   
00290     ) = 0;
00291 
00295     virtual PINDEX GetWriteFrameSize(
00296       unsigned line   
00297     ) = 0;
00298 
00301     virtual PBoolean ReadFrame(
00302       unsigned line,    
00303       void * buf,       
00304       PINDEX & count    
00305     ) = 0;
00306 
00309     virtual PBoolean WriteFrame(
00310       unsigned line,    
00311       const void * buf, 
00312       PINDEX count,     
00313       PINDEX & written  
00314     ) = 0;
00315 
00319     virtual PBoolean ReadBlock(
00320       unsigned line,    
00321       void * buf,   
00322       PINDEX count  
00323     );
00324 
00327     virtual PBoolean WriteBlock(
00328       unsigned line,    
00329       const void * buf, 
00330       PINDEX count      
00331     );
00332 
00333 
00336     virtual unsigned GetAverageSignalLevel(
00337       unsigned line,  
00338       PBoolean playback   
00339     );
00340 
00341 
00344     virtual PBoolean EnableAudio(
00345       unsigned line,      
00346       PBoolean enable = PTrue
00347     );
00348 
00351     PBoolean DisableAudio(
00352       unsigned line   
00353     ) { return EnableAudio(line, PFalse); }
00354 
00357     virtual PBoolean IsAudioEnabled(
00358       unsigned line      
00359     ) const;
00360 
00361 
00362     enum {
00363       MaxVolume = 100
00364     };
00365 
00370     virtual PBoolean SetRecordVolume(
00371       unsigned line,    
00372       unsigned volume   
00373     );
00374 
00379     virtual PBoolean SetPlayVolume(
00380       unsigned line,    
00381       unsigned volume   
00382     );
00383 
00388     virtual PBoolean GetRecordVolume(
00389       unsigned line,      
00390       unsigned & volume   
00391     );
00392 
00397     virtual PBoolean GetPlayVolume(
00398       unsigned line,      
00399       unsigned & volume   
00400     );
00401 
00402 
00403     enum AECLevels {
00404       AECOff,
00405       AECLow,
00406       AECMedium,
00407       AECHigh,
00408       AECAuto,
00409       AECAGC,
00410       AECError
00411     };
00412 
00416     virtual AECLevels GetAEC(
00417       unsigned line    
00418     );
00419 
00423     virtual PBoolean SetAEC(
00424       unsigned line,    
00425       AECLevels level   
00426     );
00427 
00431     virtual PBoolean GetVAD(
00432       unsigned line    
00433     );
00434 
00438     virtual PBoolean SetVAD(
00439       unsigned line,    
00440       PBoolean enable       
00441     );
00442 
00443 
00451     virtual PBoolean GetCallerID(
00452       unsigned line,      
00453       PString & idString, 
00454       PBoolean full = PFalse   
00455     );
00456 
00465     virtual PBoolean SetCallerID(
00466       unsigned line,            
00467       const PString & idString  
00468     );
00469 
00478     virtual PBoolean SendCallerIDOnCallWaiting(
00479       unsigned line,            
00480       const PString & idString  
00481     );
00482 
00485     virtual PBoolean SendVisualMessageWaitingIndicator(
00486       unsigned line,            
00487       PBoolean on
00488     );
00489 
00490 
00491     enum {
00492       DefaultDTMFOnTime = 180,
00493       DefaultDTMFOffTime = 120
00494     };
00495 
00499     virtual PBoolean PlayDTMF(
00500       unsigned line,            
00501       const char * digits,      
00502       DWORD onTime = DefaultDTMFOnTime,  
00503       DWORD offTime = DefaultDTMFOffTime 
00504     );
00505 
00515     virtual char ReadDTMF(
00516       unsigned line   
00517     );
00518 
00523     virtual PBoolean GetRemoveDTMF(
00524       unsigned line   
00525     );
00526 
00531     virtual PBoolean SetRemoveDTMF(
00532       unsigned line,     
00533       PBoolean removeTones   
00534     );
00535 
00536 
00537     enum CallProgressTones {
00538       NoTone = -1, // indicates no tones
00539       DialTone,    // Dial tone
00540       RingTone,    // Ring indication tone
00541       BusyTone,    // Line engaged tone
00542       CongestionTone,// aka fast busy tone
00543       ClearTone,   // Call failed/disconnected tone (often same as busy tone)
00544       MwiTone,     // Message Waiting Tone
00545       CNGTone,     // Fax CNG tone
00546       NumTones
00547     };
00548 
00551     virtual CallProgressTones IsToneDetected(
00552       unsigned line   
00553     );
00554 
00557     virtual CallProgressTones WaitForToneDetect(
00558       unsigned line,          
00559       unsigned timeout = 3000 
00560     );
00561 
00564     virtual PBoolean WaitForTone(
00565       unsigned line,          
00566       CallProgressTones tone, 
00567       unsigned timeout = 3000 
00568     );
00569 
00587     virtual PBoolean SetToneFilter(
00588       unsigned line,              
00589       CallProgressTones tone,     
00590       const PString & description 
00591     );
00592 
00595     virtual PBoolean SetToneFilterParameters(
00596       unsigned line,            
00597       CallProgressTones tone,   
00598       unsigned lowFrequency,    
00599       unsigned highFrequency,   
00600       PINDEX numCadences,       
00601       const unsigned * onTimes, 
00602       const unsigned * offTimes 
00603     );
00604 
00607     virtual PBoolean PlayTone(
00608       unsigned line,          
00609       CallProgressTones tone  
00610     );
00611 
00614     virtual PBoolean IsTonePlaying(
00615       unsigned line   
00616     );
00617 
00620     virtual PBoolean StopTone(
00621       unsigned line   
00622     );
00623 
00624 
00625     enum { DIAL_TONE_TIMEOUT = 10000 };
00626 
00642     virtual CallProgressTones DialOut(
00643       unsigned line,                
00644       const PString & number,       
00645       PBoolean requireTones = PFalse,    
00646       unsigned uiDialDelay = 0      
00647     );
00648 
00649 
00653     virtual unsigned GetWinkDuration(
00654       unsigned line    
00655     );
00656 
00660     virtual PBoolean SetWinkDuration(
00661       unsigned line,        
00662       unsigned winkDuration 
00663     );
00664 
00665 
00666     enum T35CountryCodes {
00667       Japan, Albania, Algeria, AmericanSamoa, Germany, Anguilla, AntiguaAndBarbuda,
00668       Argentina, Ascension, Australia, Austria, Bahamas, Bahrain, Bangladesh,
00669       Barbados, Belgium, Belize, Benin, Bermudas, Bhutan, Bolivia, Botswana,
00670       Brazil, BritishAntarcticTerritory, BritishIndianOceanTerritory, 
00671       BritishVirginIslands, BruneiDarussalam, Bulgaria, Myanmar, Burundi,
00672       Byelorussia, Cameroon, Canada, CapeVerde, CaymanIslands,
00673       CentralAfricanRepublic, Chad, Chile, China, Colombia, Comoros, Congo,
00674       CookIslands, CostaRica, Cuba, Cyprus, Czechoslovakia, Cambodia,
00675       DemocraticPeoplesRepublicOfKorea, Denmark, Djibouti, DominicanRepublic,
00676       Dominica, Ecuador, Egypt, ElSalvador, EquatorialGuinea, Ethiopia,
00677       FalklandIslands, Fiji, Finland, France, FrenchPolynesia,
00678       FrenchSouthernAndAntarcticLands, Gabon, Gambia, Germany2, Angola, Ghana,
00679       Gibraltar, Greece, Grenada, Guam, Guatemala, Guernsey, Guinea, GuineaBissau,
00680       Guayana, Haiti, Honduras, Hongkong, Hungary, Iceland, India, Indonesia,
00681       Iran, Iraq, Ireland, Israel, Italy, CotedIvoire, Jamaica, Afghanistan,
00682       Jersey, Jordan, Kenya, Kiribati, KoreaRepublic, Kuwait, Lao, Lebanon,
00683       Lesotho, Liberia, Libya, Liechtenstein, Luxemborg, Macao, Madagascar,
00684       Malaysia, Malawi, Maldives, Mali, Malta, Mauritania, Mauritius, Mexico,
00685       Monaco, Mongolia, Montserrat, Morocco, Mozambique, Nauru, Nepal,
00686       Netherlands, NetherlandsAntilles, NewCaledonia, NewZealand, Nicaragua,
00687       Niger, Nigeria, Norway, Oman, Pakistan, Panama, PapuaNewGuinea, Paraguay,
00688       Peru, Philippines, Poland, Portugal, PuertoRico, Qatar, Romania, Rwanda,
00689       SaintKittsAndNevis, SaintCroix, SaintHelenaAndAscension, SaintLucia,
00690       SanMarino, SaintThomas, SaoTomeAndPrincipe, SaintVicentAndTheGrenadines,
00691       SaudiArabia, Senegal, Seychelles, SierraLeone, Singapore, SolomonIslands,
00692       Somalia, SouthAfrica, Spain, SriLanka, Sudan, Suriname, Swaziland, Sweden,
00693       Switzerland, Syria, Tanzania, Thailand, Togo, Tonga, TrinidadAndTobago,
00694       Tunisia, Turkey, TurksAndCaicosIslands, Tuvalu, Uganda, Ukraine,
00695       UnitedArabEmirates, UnitedKingdom, UnitedStates, BurkinaFaso, Uruguay,
00696       USSR, Vanuatu, VaticanCityState, Venezuela, VietNam, WallisAndFutuna,
00697       WesternSamoa, Yemen, Yemen2, Yugoslavia, Zaire, Zambia, Zimbabwe,
00698       NumCountryCodes,
00699       UnknownCountry = -1
00700     };
00701 
00704     T35CountryCodes GetCountryCode() const { return countryCode; }
00705 
00708     PString GetCountryCodeName() const;
00709 
00712     static PString GetCountryCodeName(T35CountryCodes code);
00713     static T35CountryCodes GetCountryCode(const PString & name);
00714 
00720     virtual PBoolean SetCountryCode(
00721       T35CountryCodes country   
00722     );
00723 
00726     virtual PBoolean SetCountryCodeName(
00727       const PString & countryName   
00728     );
00729 
00732     virtual PStringList GetCountryCodeNameList() const;
00733 
00734 
00737     virtual PBoolean PlayAudio(
00738       unsigned line,            
00739       const PString & filename  
00740     );
00741     
00744     virtual PBoolean StopAudio(
00745       unsigned line   
00746     );
00747 
00748 
00752     virtual PBoolean RecordAudioStart(
00753       unsigned line,            
00754       const PString & filename  
00755     );
00756     
00761     virtual PBoolean RecordAudioStop(
00762       unsigned line            
00763     );
00764     
00765 
00768     int GetErrorNumber() const { return osError; }
00769 
00772     PString GetErrorText() const;
00773 
00774     virtual void PrintOn(
00775       ostream & strm
00776     ) const;
00777 
00780     static OpalLineInterfaceDevice * Create(
00781       const PString & type,     
00782       void * parameters = NULL  
00783     );
00784 
00787     static PStringList GetAllTypes();
00788 
00793     static PStringList GetAllDevices();
00794 
00795         
00796   protected:
00797     int    getOsHandle() const {return os_handle;};
00798     void   setOsHandle(int os_handleToSet) {os_handle = os_handleToSet;};
00799     
00800     int    getOsError() const {return osError;};
00801     void   setOsError(int osErrorToSet) {osError = osErrorToSet;};
00802     
00803     const PBYTEArray& getReadDeblockingBuffer(){return m_readDeblockingBuffer;};
00804     const PBYTEArray& getWriteDeblockingBuffer(){return m_writeDeblockingBuffer;};
00805     PINDEX getReadDeblockingOffset() const {return m_readDeblockingOffset;};
00806     void   setReadDeblockingOffset(PINDEX readDeblockingOffset) {m_readDeblockingOffset = readDeblockingOffset;};
00807     
00808     PINDEX getWriteDeblockingOffset() const {return m_writeDeblockingOffset;};
00809     void   setWriteDeblockingOffset(PINDEX writeDeblockingOffset) {m_writeDeblockingOffset = writeDeblockingOffset;};
00810     
00811     unsigned int getDialToneTimeout() const {return m_uiDialToneTimeout;};
00812     void   setDialToneTimeout(unsigned int uiDialToneTimeout) {m_uiDialToneTimeout = uiDialToneTimeout;};
00813         
00814     int               os_handle;
00815     mutable int       osError;
00816     T35CountryCodes   countryCode;
00817     PBYTEArray        m_readDeblockingBuffer, m_writeDeblockingBuffer;
00818     PINDEX            m_readDeblockingOffset, m_writeDeblockingOffset;
00819     unsigned int      m_uiDialToneTimeout;
00820     std::vector<bool> m_LineAudioEnabled;
00821     PString           m_callProgressTones[NumTones];
00822 #if PTRACING
00823     friend ostream & operator<<(ostream & o, CallProgressTones t);
00824 #endif
00825 };
00826 
00827 
00828 PLIST(OpalLIDList, OpalLineInterfaceDevice);
00829 
00830 
00831 
00834 class OpalLine : public PObject
00835 {
00836     PCLASSINFO(OpalLine, PObject);
00837   public:
00842     OpalLine(
00843       OpalLineInterfaceDevice & device, 
00844       unsigned lineNumber,              
00845       const char * description = NULL   
00846     );
00848 
00855     void PrintOn(
00856       ostream & strm    
00857     ) const;
00859 
00868     virtual PBoolean IsTerminal() { return device.IsLineTerminal(lineNumber); }
00869 
00870 
00873     virtual PBoolean IsPresent(
00874       PBoolean force = PFalse  
00875     ) { return device.IsLinePresent(lineNumber, force); }
00876 
00877 
00883     virtual PBoolean IsOffHook() { return device.IsLineOffHook(lineNumber); }
00884 
00890     virtual PBoolean SetOffHook() { return device.SetLineOffHook(lineNumber, PTrue); }
00891 
00895     virtual PBoolean SetOnHook() { return device.SetLineOffHook(lineNumber, PFalse); }
00896 
00900     virtual PBoolean HookFlash(
00901       unsigned flashTime = 200    
00902     ) { return device.HookFlash(lineNumber, flashTime); }
00903 
00906     virtual PBoolean HasHookFlash() { return device.HasHookFlash(lineNumber); }
00907 
00908 
00919     virtual PBoolean IsRinging(
00920       DWORD * cadence = NULL  
00921     ) { return device.IsLineRinging(lineNumber, cadence); }
00922 
00926     virtual unsigned GetRingCount(
00927       DWORD * cadence = NULL  
00928     );
00929 
00947     virtual PBoolean Ring(
00948       PINDEX nCadence,                 
00949       const unsigned * pattern = NULL, 
00950       unsigned frequency = 400         
00951     ) { return device.RingLine(lineNumber, nCadence, pattern, frequency); }
00952 
00953 
00957     virtual PBoolean IsDisconnected() { return device.IsLineDisconnected(lineNumber); }
00958 
00961     virtual PBoolean SetReadFormat(
00962       const OpalMediaFormat & mediaFormat   
00963     ) { return device.SetReadFormat(lineNumber, mediaFormat); }
00964 
00967     virtual PBoolean SetWriteFormat(
00968       const OpalMediaFormat & mediaFormat   
00969     ) { return device.SetWriteFormat(lineNumber, mediaFormat); }
00970 
00973     virtual OpalMediaFormat GetReadFormat() { return device.GetReadFormat(lineNumber); }
00974 
00977     virtual OpalMediaFormat GetWriteFormat() { return device.GetWriteFormat(lineNumber); }
00978 
00981     virtual PBoolean StopReading() { return device.StopReading(lineNumber); }
00982 
00985     virtual PBoolean StopWriting() { return device.StopWriting(lineNumber); }
00986 
00991     virtual PBoolean SetReadFrameSize(
00992       PINDEX frameSize  
00993     ) { return device.SetReadFrameSize(lineNumber, frameSize); }
00994 
00999     virtual PBoolean SetWriteFrameSize(
01000       PINDEX frameSize  
01001     ) { return device.SetWriteFrameSize(lineNumber, frameSize); }
01002 
01006     virtual PINDEX GetReadFrameSize() { return device.GetReadFrameSize(lineNumber); }
01007 
01011     virtual PINDEX GetWriteFrameSize() { return device.GetWriteFrameSize(lineNumber); }
01012 
01015     virtual PBoolean ReadFrame(
01016       void * buf,       
01017       PINDEX & count    
01018     ) { return device.ReadFrame(lineNumber, buf, count); }
01019 
01022     virtual PBoolean WriteFrame(
01023       const void * buf, 
01024       PINDEX count,     
01025       PINDEX & written  
01026     ) { return device.WriteFrame(lineNumber, buf, count, written); }
01027 
01031     virtual PBoolean ReadBlock(
01032       void * buf,   
01033       PINDEX count  
01034     ) { return device.ReadBlock(lineNumber, buf, count); }
01035 
01038     virtual PBoolean WriteBlock(
01039       const void * buf, 
01040       PINDEX count      
01041     ) { return device.WriteBlock(lineNumber, buf, count); }
01042 
01043 
01046     virtual unsigned GetAverageSignalLevel(
01047       PBoolean playback   
01048     ) { return device.GetAverageSignalLevel(lineNumber, playback); }
01049 
01050 
01053     virtual PBoolean EnableAudio(
01054       PBoolean enable = PTrue
01055     ) { return device.EnableAudio(lineNumber, enable); }
01056 
01059     PBoolean DisableAudio() { return EnableAudio(PFalse); }
01060 
01063     virtual PBoolean IsAudioEnabled() const { return device.IsAudioEnabled(lineNumber); }
01064 
01065 
01070     virtual PBoolean SetRecordVolume(
01071       unsigned volume   
01072     ) { return device.SetRecordVolume(lineNumber, volume); }
01073 
01078     virtual PBoolean SetPlayVolume(
01079       unsigned volume   
01080     ) { return device.SetPlayVolume(lineNumber, volume); }
01081 
01086     virtual PBoolean GetRecordVolume(
01087       unsigned & volume   
01088     ) { return device.GetRecordVolume(lineNumber, volume); }
01089 
01094     virtual PBoolean GetPlayVolume(
01095       unsigned & volume   
01096     ) { return device.GetPlayVolume(lineNumber, volume); }
01097 
01098 
01102     virtual OpalLineInterfaceDevice::AECLevels GetAEC() { return device.GetAEC(lineNumber); }
01103 
01107     virtual PBoolean SetAEC(
01108       OpalLineInterfaceDevice::AECLevels level  
01109     ) { return device.SetAEC(lineNumber, level); }
01110 
01111 
01115     virtual PBoolean GetVAD() { return device.GetVAD(lineNumber); }
01116 
01120     virtual PBoolean SetVAD(
01121       PBoolean enable       
01122     ) { return device.SetVAD(lineNumber, enable); }
01123 
01124 
01132     virtual PBoolean GetCallerID(
01133       PString & idString, 
01134       PBoolean full = PFalse   
01135     ) { return device.GetCallerID(lineNumber, idString, full); }
01136 
01145     virtual PBoolean SetCallerID(
01146       const PString & idString  
01147     ) { return device.SetCallerID(lineNumber, idString); }
01148 
01157     virtual PBoolean SendCallerIDOnCallWaiting(
01158       const PString & idString  
01159     ) { return device.SendCallerIDOnCallWaiting(lineNumber, idString); }
01160 
01163     virtual PBoolean SendVisualMessageWaitingIndicator(
01164       PBoolean on
01165     ) { return device.SendVisualMessageWaitingIndicator(lineNumber, on); }
01166 
01167 
01171     virtual PBoolean PlayDTMF(
01172       const char * digits,      
01173       DWORD onTime = OpalLineInterfaceDevice::DefaultDTMFOnTime,  
01174       DWORD offTime = OpalLineInterfaceDevice::DefaultDTMFOffTime 
01175     ) { return device.PlayDTMF(lineNumber, digits, onTime, offTime); }
01176 
01186     virtual char ReadDTMF() { return device.ReadDTMF(lineNumber); }
01187 
01192     virtual PBoolean GetRemoveDTMF() { return device.GetRemoveDTMF(lineNumber); }
01193 
01198     virtual PBoolean SetRemoveDTMF(
01199       PBoolean removeTones   
01200     ) { return device.SetRemoveDTMF(lineNumber, removeTones); }
01201 
01202 
01205     virtual unsigned IsToneDetected() { return device.IsToneDetected(lineNumber); }
01206 
01209     virtual OpalLineInterfaceDevice::CallProgressTones WaitForToneDetect(
01210       unsigned timeout = 3000 
01211     ) { return device.WaitForToneDetect(lineNumber, timeout); }
01212 
01215     virtual PBoolean WaitForTone(
01216       OpalLineInterfaceDevice::CallProgressTones tone, 
01217       unsigned timeout = 3000 
01218     ) { return device.WaitForTone(lineNumber, tone, timeout); }
01219 
01222     virtual PBoolean PlayTone(
01223       OpalLineInterfaceDevice::CallProgressTones tone  
01224     ) { return device.PlayTone(lineNumber, tone); }
01225 
01228     virtual PBoolean IsTonePlaying() { return device.IsTonePlaying(lineNumber); }
01229 
01232     virtual PBoolean StopTone() { return device.StopTone(lineNumber); }
01233 
01234 
01250     virtual OpalLineInterfaceDevice::CallProgressTones DialOut(
01251       const PString & number,       
01252       PBoolean requireTones = PFalse,    
01253       unsigned uiDialDelay = 0      
01254     ) { return device.DialOut(lineNumber, number, requireTones, uiDialDelay); }
01256 
01261     OpalLineInterfaceDevice & GetDevice() const { return device; }
01262 
01265     unsigned GetLineNumber() const { return lineNumber; }
01266 
01269     PString GetToken() const { return token; }
01270 
01273     PString GetDescription() const { return description; }
01275 
01276   protected:
01277     OpalLineInterfaceDevice & device;
01278     unsigned                  lineNumber;
01279     PString                   token;
01280     PString                   description;
01281     unsigned                  ringCount;
01282     PTimeInterval             ringTick;
01283     PTimeInterval             ringStoppedTime;
01284     PTimeInterval             ringInterCadenceTime;
01285 };
01286 
01287 
01288 PLIST(OpalLineList, OpalLine);
01289 
01290 
01297 class OpalLIDRegistration : public PCaselessString
01298 {
01299     PCLASSINFO(OpalLIDRegistration, PCaselessString);
01300   public:
01305     OpalLIDRegistration(
01306       const char * name  
01307     );
01308 
01311     ~OpalLIDRegistration();
01313 
01318     virtual OpalLineInterfaceDevice * Create(
01319       void * parameters   
01320     ) const = 0;
01322 
01323   protected:
01324     OpalLIDRegistration * link;
01325     bool                  duplicate;
01326 
01327   friend class OpalLineInterfaceDevice;
01328 };
01329 
01330 
01331 #define OPAL_REGISTER_LID_FUNCTION(cls, type, param) \
01332 static class cls##_Registration : public OpalLIDRegistration { \
01333   public: \
01334     cls##_Registration() : OpalLIDRegistration(type) { } \
01335     OpalLineInterfaceDevice * Create(void * param) const; \
01336 } instance_##cls##_Registration; \
01337 OpalLineInterfaceDevice * cls##_Registration::Create(void * param) const
01338 
01339 #ifndef OPAL_NO_PARAM
01340 #define OPAL_NO_PARAM
01341 #endif
01342 
01343 #define OPAL_REGISTER_LID(cls, type) \
01344   OPAL_REGISTER_LID_FUNCTION(cls, type, OPAL_NO_PARAM) \
01345   { return new cls; }
01346 
01347 #define OPAL_REGISTER_LID_PARAM(cls, type) \
01348   OPAL_REGISTER_LID_FUNCTION(cls, type, parameter) \
01349   { return new cls(parameter); }
01350 
01351 
01352 #endif // __OPAL_LID_H
01353 
01354 
01355 // End of File ///////////////////////////////////////////////////////////////

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