OPAL Version 3.10.2
|
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: 24178 $ 00030 * $Author: rjongbloed $ 00031 * $Date: 2010-04-05 19:10:56 -0500 (Mon, 05 Apr 2010) $ 00032 */ 00033 00034 #ifndef OPAL_LIDS_LID_H 00035 #define OPAL_LIDS_LID_H 00036 00037 #ifdef P_USE_PRAGMA 00038 #pragma interface 00039 #endif 00040 00041 #include <opal/buildopts.h> 00042 00043 #include <opal/mediafmt.h> 00044 00045 00047 00051 class OpalLineInterfaceDevice : public PObject 00052 { 00053 PCLASSINFO(OpalLineInterfaceDevice, PObject); 00054 00055 public: 00058 OpalLineInterfaceDevice(); 00059 00062 virtual PBoolean Open( 00063 const PString & device 00064 ) = 0; 00065 00068 virtual PBoolean IsOpen() const; 00069 00072 virtual PBoolean Close(); 00073 00077 virtual PString GetDeviceType() const = 0; 00078 00083 virtual PString GetDeviceName() const = 0; 00084 00087 virtual PStringArray GetAllNames() const = 0; 00088 00094 virtual PString GetDescription() const = 0; 00095 00098 virtual unsigned GetLineCount() const = 0; 00099 00106 virtual PBoolean IsLineTerminal( 00107 unsigned line 00108 ) = 0; 00109 00110 00113 virtual PBoolean IsLinePresent( 00114 unsigned line, 00115 PBoolean force = false 00116 ); 00117 00118 00124 virtual PBoolean IsLineOffHook( 00125 unsigned line 00126 ) = 0; 00127 00133 virtual PBoolean SetLineOffHook( 00134 unsigned line, 00135 PBoolean newState = true 00136 ) = 0; 00137 00141 virtual PBoolean SetLineOnHook( 00142 unsigned line 00143 ) { return SetLineOffHook(line, false); } 00144 00148 virtual PBoolean HookFlash( 00149 unsigned line, 00150 unsigned flashTime = 200 00151 ); 00152 00155 virtual PBoolean HasHookFlash(unsigned line); 00156 00157 00168 virtual PBoolean IsLineRinging( 00169 unsigned line, 00170 DWORD * cadence = NULL 00171 ); 00172 00190 virtual PBoolean RingLine( 00191 unsigned line, 00192 PINDEX nCadence, 00193 const unsigned * pattern = NULL, 00194 unsigned frequency = 400 00195 ); 00196 00197 00208 virtual PBoolean SetLineConnected( 00209 unsigned line 00210 ); 00211 00222 virtual PBoolean IsLineConnected( 00223 unsigned line 00224 ); 00225 00226 00238 virtual PBoolean IsLineDisconnected( 00239 unsigned line, 00240 PBoolean checkForWink = true 00241 ); 00242 00243 00246 virtual PBoolean SetLineToLineDirect( 00247 unsigned line1, 00248 unsigned line2, 00249 PBoolean connect 00250 ); 00251 00254 virtual PBoolean IsLineToLineDirect( 00255 unsigned line1, 00256 unsigned line2 00257 ); 00258 00259 00262 virtual OpalMediaFormatList GetMediaFormats() const = 0; 00263 00266 virtual PBoolean SetReadFormat( 00267 unsigned line, 00268 const OpalMediaFormat & mediaFormat 00269 ) = 0; 00270 00273 virtual PBoolean SetWriteFormat( 00274 unsigned line, 00275 const OpalMediaFormat & mediaFormat 00276 ) = 0; 00277 00280 virtual OpalMediaFormat GetReadFormat( 00281 unsigned line 00282 ) = 0; 00283 00286 virtual OpalMediaFormat GetWriteFormat( 00287 unsigned line 00288 ) = 0; 00289 00292 virtual PBoolean StopReading( 00293 unsigned line 00294 ); 00295 00298 virtual PBoolean StopWriting( 00299 unsigned line 00300 ); 00301 00306 virtual bool UsesRTP() const; 00307 00312 virtual PBoolean SetReadFrameSize( 00313 unsigned line, 00314 PINDEX frameSize 00315 ); 00316 00321 virtual PBoolean SetWriteFrameSize( 00322 unsigned line, 00323 PINDEX frameSize 00324 ); 00325 00329 virtual PINDEX GetReadFrameSize( 00330 unsigned line 00331 ); 00332 00336 virtual PINDEX GetWriteFrameSize( 00337 unsigned line 00338 ); 00339 00342 virtual PBoolean ReadFrame( 00343 unsigned line, 00344 void * buf, 00345 PINDEX & count 00346 ) = 0; 00347 00350 virtual PBoolean WriteFrame( 00351 unsigned line, 00352 const void * buf, 00353 PINDEX count, 00354 PINDEX & written 00355 ) = 0; 00356 00360 virtual PBoolean ReadBlock( 00361 unsigned line, 00362 void * buf, 00363 PINDEX count 00364 ); 00365 00368 virtual PBoolean WriteBlock( 00369 unsigned line, 00370 const void * buf, 00371 PINDEX count 00372 ); 00373 00374 00377 virtual unsigned GetAverageSignalLevel( 00378 unsigned line, 00379 PBoolean playback 00380 ); 00381 00382 00385 virtual PBoolean EnableAudio( 00386 unsigned line, 00387 PBoolean enable = true 00388 ); 00389 00392 PBoolean DisableAudio( 00393 unsigned line 00394 ) { return EnableAudio(line, false); } 00395 00398 virtual PBoolean IsAudioEnabled( 00399 unsigned line 00400 ) const; 00401 00402 00403 enum { 00404 MaxVolume = 100 00405 }; 00406 00411 virtual PBoolean SetRecordVolume( 00412 unsigned line, 00413 unsigned volume 00414 ); 00415 00420 virtual PBoolean SetPlayVolume( 00421 unsigned line, 00422 unsigned volume 00423 ); 00424 00429 virtual PBoolean GetRecordVolume( 00430 unsigned line, 00431 unsigned & volume 00432 ); 00433 00438 virtual PBoolean GetPlayVolume( 00439 unsigned line, 00440 unsigned & volume 00441 ); 00442 00443 00444 enum AECLevels { 00445 AECOff, 00446 AECLow, 00447 AECMedium, 00448 AECHigh, 00449 AECAuto, 00450 AECAGC, 00451 AECError 00452 }; 00453 00457 virtual AECLevels GetAEC( 00458 unsigned line 00459 ) const; 00460 00464 virtual PBoolean SetAEC( 00465 unsigned line, 00466 AECLevels level 00467 ); 00468 00472 virtual PBoolean GetVAD( 00473 unsigned line 00474 ) const; 00475 00479 virtual PBoolean SetVAD( 00480 unsigned line, 00481 PBoolean enable 00482 ); 00483 00484 00498 virtual PBoolean GetCallerID( 00499 unsigned line, 00500 PString & idString, 00501 PBoolean full = false 00502 ); 00503 00525 virtual PBoolean SetCallerID( 00526 unsigned line, 00527 const PString & idString 00528 ); 00529 00532 virtual PBoolean SendVisualMessageWaitingIndicator( 00533 unsigned line, 00534 PBoolean on 00535 ); 00536 00537 00538 enum { 00539 DefaultDTMFOnTime = 150, 00540 DefaultDTMFOffTime = 50 00541 }; 00542 00546 virtual PBoolean PlayDTMF( 00547 unsigned line, 00548 const char * digits, 00549 DWORD onTime = DefaultDTMFOnTime, 00550 DWORD offTime = DefaultDTMFOffTime 00551 ); 00552 00562 virtual char ReadDTMF( 00563 unsigned line 00564 ); 00565 00570 virtual PBoolean GetRemoveDTMF( 00571 unsigned line 00572 ); 00573 00578 virtual PBoolean SetRemoveDTMF( 00579 unsigned line, 00580 PBoolean removeTones 00581 ); 00582 00583 00584 enum CallProgressTones { 00585 NoTone = -1, // indicates no tones 00586 DialTone, // Dial tone 00587 RingTone, // Ring indication tone 00588 BusyTone, // Line engaged tone 00589 CongestionTone,// aka fast busy tone 00590 ClearTone, // Call failed/disconnected tone (often same as busy tone) 00591 MwiTone, // Message Waiting Tone 00592 RoutingTone, // Call is being routed (not normal for PSTN, but VoIP can take a while) 00593 CNGTone, // Fax CNG tone 00594 CEDTone, // Fax CED tone 00595 UserDefinedTone, 00596 NumTones 00597 }; 00598 00601 virtual CallProgressTones IsToneDetected( 00602 unsigned line 00603 ); 00604 00607 virtual CallProgressTones WaitForToneDetect( 00608 unsigned line, 00609 unsigned timeout = 3000 00610 ); 00611 00614 virtual PBoolean WaitForTone( 00615 unsigned line, 00616 CallProgressTones tone, 00617 unsigned timeout = 3000 00618 ); 00619 00642 virtual bool SetToneDescription( 00643 unsigned line, 00644 CallProgressTones tone, 00645 const PString & description 00646 ); 00647 00648 enum ToneMixingModes { 00649 SimpleTone, 00650 AddedTone, 00651 ModulatedTone 00652 }; 00653 00657 virtual bool SetToneParameters( 00658 unsigned line, 00659 CallProgressTones tone, 00660 unsigned frequency1, 00661 unsigned frequency2, 00662 ToneMixingModes mode, 00663 PINDEX numCadences, 00664 const unsigned * onTimes, 00665 const unsigned * offTimes 00666 ); 00667 00670 virtual PBoolean PlayTone( 00671 unsigned line, 00672 CallProgressTones tone 00673 ); 00674 00677 virtual PBoolean IsTonePlaying( 00678 unsigned line 00679 ); 00680 00683 virtual PBoolean StopTone( 00684 unsigned line 00685 ); 00686 00687 00689 struct DialParams { 00690 DialParams() 00691 : m_requireTones(false) 00692 , m_dialToneTimeout(2500) 00693 , m_dialStartDelay(500) 00694 , m_dialDigitTime(DefaultDTMFOnTime) 00695 , m_dialInterDigitTime(DefaultDTMFOffTime) 00696 , m_progressTimeout(5000) 00697 , m_commaDelay(2000) 00698 { } 00699 00700 bool m_requireTones; 00701 unsigned m_dialToneTimeout; 00702 unsigned m_dialStartDelay; 00703 unsigned m_dialDigitTime; 00704 unsigned m_dialInterDigitTime; 00705 unsigned m_progressTimeout; 00706 unsigned m_commaDelay; 00707 }; 00708 00724 virtual CallProgressTones DialOut( 00725 unsigned line, 00726 const PString & number, 00727 const DialParams & params = DialParams() 00728 ); 00729 00730 00734 virtual unsigned GetWinkDuration( 00735 unsigned line 00736 ); 00737 00741 virtual PBoolean SetWinkDuration( 00742 unsigned line, 00743 unsigned winkDuration 00744 ); 00745 00746 00747 enum T35CountryCodes { 00748 Japan, Albania, Algeria, AmericanSamoa, Germany, Anguilla, AntiguaAndBarbuda, 00749 Argentina, Ascension, Australia, Austria, Bahamas, Bahrain, Bangladesh, 00750 Barbados, Belgium, Belize, Benin, Bermudas, Bhutan, Bolivia, Botswana, 00751 Brazil, BritishAntarcticTerritory, BritishIndianOceanTerritory, 00752 BritishVirginIslands, BruneiDarussalam, Bulgaria, Myanmar, Burundi, 00753 Byelorussia, Cameroon, Canada, CapeVerde, CaymanIslands, 00754 CentralAfricanRepublic, Chad, Chile, China, Colombia, Comoros, Congo, 00755 CookIslands, CostaRica, Cuba, Cyprus, Czechoslovakia, Cambodia, 00756 DemocraticPeoplesRepublicOfKorea, Denmark, Djibouti, DominicanRepublic, 00757 Dominica, Ecuador, Egypt, ElSalvador, EquatorialGuinea, Ethiopia, 00758 FalklandIslands, Fiji, Finland, France, FrenchPolynesia, 00759 FrenchSouthernAndAntarcticLands, Gabon, Gambia, Germany2, Angola, Ghana, 00760 Gibraltar, Greece, Grenada, Guam, Guatemala, Guernsey, Guinea, GuineaBissau, 00761 Guayana, Haiti, Honduras, Hongkong, Hungary, Iceland, India, Indonesia, 00762 Iran, Iraq, Ireland, Israel, Italy, CotedIvoire, Jamaica, Afghanistan, 00763 Jersey, Jordan, Kenya, Kiribati, KoreaRepublic, Kuwait, Lao, Lebanon, 00764 Lesotho, Liberia, Libya, Liechtenstein, Luxemborg, Macao, Madagascar, 00765 Malaysia, Malawi, Maldives, Mali, Malta, Mauritania, Mauritius, Mexico, 00766 Monaco, Mongolia, Montserrat, Morocco, Mozambique, Nauru, Nepal, 00767 Netherlands, NetherlandsAntilles, NewCaledonia, NewZealand, Nicaragua, 00768 Niger, Nigeria, Norway, Oman, Pakistan, Panama, PapuaNewGuinea, Paraguay, 00769 Peru, Philippines, Poland, Portugal, PuertoRico, Qatar, Romania, Rwanda, 00770 SaintKittsAndNevis, SaintCroix, SaintHelenaAndAscension, SaintLucia, 00771 SanMarino, SaintThomas, SaoTomeAndPrincipe, SaintVicentAndTheGrenadines, 00772 SaudiArabia, Senegal, Seychelles, SierraLeone, Singapore, SolomonIslands, 00773 Somalia, SouthAfrica, Spain, SriLanka, Sudan, Suriname, Swaziland, Sweden, 00774 Switzerland, Syria, Tanzania, Thailand, Togo, Tonga, TrinidadAndTobago, 00775 Tunisia, Turkey, TurksAndCaicosIslands, Tuvalu, Uganda, Ukraine, 00776 UnitedArabEmirates, UnitedKingdom, UnitedStates, BurkinaFaso, Uruguay, 00777 USSR, Vanuatu, VaticanCityState, Venezuela, VietNam, WallisAndFutuna, 00778 WesternSamoa, Yemen, Yemen2, Yugoslavia, Zaire, Zambia, Zimbabwe, 00779 NumCountryCodes, 00780 UnknownCountry = -1 00781 }; 00782 00785 T35CountryCodes GetCountryCode() const { return countryCode; } 00786 00789 PString GetCountryCodeName() const; 00790 00793 static PString GetCountryCodeName(T35CountryCodes code); 00794 static T35CountryCodes GetCountryCode(const PString & name); 00795 00801 virtual PBoolean SetCountryCode( 00802 T35CountryCodes country 00803 ); 00804 00807 virtual PBoolean SetCountryCodeName( 00808 const PString & countryName 00809 ); 00810 00813 virtual PStringList GetCountryCodeNameList() const; 00814 00815 00818 virtual PBoolean PlayAudio( 00819 unsigned line, 00820 const PString & filename 00821 ); 00822 00825 virtual PBoolean StopAudio( 00826 unsigned line 00827 ); 00828 00829 00833 virtual PBoolean RecordAudioStart( 00834 unsigned line, 00835 const PString & filename 00836 ); 00837 00842 virtual PBoolean RecordAudioStop( 00843 unsigned line 00844 ); 00845 00846 00849 int GetErrorNumber() const { return osError; } 00850 00853 PString GetErrorText() const; 00854 00855 virtual void PrintOn( 00856 ostream & strm 00857 ) const; 00858 00861 static OpalLineInterfaceDevice * Create( 00862 const PString & type, 00863 void * parameters = NULL 00864 ); 00865 00870 static OpalLineInterfaceDevice * CreateAndOpen( 00871 const PString & descriptor, 00872 void * parameters = NULL 00873 ); 00874 00877 static PStringList GetAllTypes(); 00878 00883 static PStringList GetAllDevices(); 00884 00885 00886 protected: 00887 int os_handle; 00888 mutable int osError; 00889 T35CountryCodes countryCode; 00890 PBYTEArray m_readDeblockingBuffer, m_writeDeblockingBuffer; 00891 PINDEX m_readDeblockingOffset, m_writeDeblockingOffset; 00892 std::vector<bool> m_LineAudioEnabled; 00893 PString m_callProgressTones[NumTones]; 00894 #if PTRACING 00895 friend ostream & operator<<(ostream & o, CallProgressTones t); 00896 #endif 00897 }; 00898 00899 00900 PLIST(OpalLIDList, OpalLineInterfaceDevice); 00901 00902 00903 00906 class OpalLine : public PObject 00907 { 00908 PCLASSINFO(OpalLine, PObject); 00909 public: 00914 OpalLine( 00915 OpalLineInterfaceDevice & device, 00916 unsigned lineNumber, 00917 const char * userToken = NULL 00918 ); 00920 00927 void PrintOn( 00928 ostream & strm 00929 ) const; 00931 00940 virtual PBoolean IsTerminal() { return device.IsLineTerminal(lineNumber); } 00941 00942 00945 virtual PBoolean IsPresent( 00946 PBoolean force = false 00947 ) { return device.IsLinePresent(lineNumber, force); } 00948 00949 00955 virtual PBoolean IsOffHook() { return device.IsLineOffHook(lineNumber); } 00956 00962 virtual PBoolean SetOffHook() { return device.SetLineOffHook(lineNumber, true); } 00963 00967 virtual PBoolean SetOnHook() { return device.SetLineOffHook(lineNumber, false); } 00968 00972 virtual PBoolean HookFlash( 00973 unsigned flashTime = 200 00974 ) { return device.HookFlash(lineNumber, flashTime); } 00975 00978 virtual PBoolean HasHookFlash() { return device.HasHookFlash(lineNumber); } 00979 00980 00991 virtual PBoolean IsRinging( 00992 DWORD * cadence = NULL 00993 ); 00994 00998 virtual unsigned GetRingCount( 00999 DWORD * cadence = NULL 01000 ); 01001 01019 virtual PBoolean Ring( 01020 PINDEX nCadence, 01021 const unsigned * pattern = NULL, 01022 unsigned frequency = 400 01023 ) { return device.RingLine(lineNumber, nCadence, pattern, frequency); } 01024 01025 01036 virtual PBoolean SetConnected() { return device.SetLineConnected(lineNumber); } 01037 01045 virtual PBoolean IsConnected() { return device.IsLineConnected(lineNumber); } 01046 01047 01051 virtual PBoolean IsDisconnected() { return device.IsLineDisconnected(lineNumber); } 01052 01055 virtual PBoolean SetReadFormat( 01056 const OpalMediaFormat & mediaFormat 01057 ) { return device.SetReadFormat(lineNumber, mediaFormat); } 01058 01061 virtual PBoolean SetWriteFormat( 01062 const OpalMediaFormat & mediaFormat 01063 ) { return device.SetWriteFormat(lineNumber, mediaFormat); } 01064 01067 virtual OpalMediaFormat GetReadFormat() { return device.GetReadFormat(lineNumber); } 01068 01071 virtual OpalMediaFormat GetWriteFormat() { return device.GetWriteFormat(lineNumber); } 01072 01075 virtual PBoolean StopReading() { return device.StopReading(lineNumber); } 01076 01079 virtual PBoolean StopWriting() { return device.StopWriting(lineNumber); } 01080 01085 virtual PBoolean SetReadFrameSize( 01086 PINDEX frameSize 01087 ) { return device.SetReadFrameSize(lineNumber, frameSize); } 01088 01093 virtual PBoolean SetWriteFrameSize( 01094 PINDEX frameSize 01095 ) { return device.SetWriteFrameSize(lineNumber, frameSize); } 01096 01100 virtual PINDEX GetReadFrameSize() { return device.GetReadFrameSize(lineNumber); } 01101 01105 virtual PINDEX GetWriteFrameSize() { return device.GetWriteFrameSize(lineNumber); } 01106 01109 virtual PBoolean ReadFrame( 01110 void * buf, 01111 PINDEX & count 01112 ) { return device.ReadFrame(lineNumber, buf, count); } 01113 01116 virtual PBoolean WriteFrame( 01117 const void * buf, 01118 PINDEX count, 01119 PINDEX & written 01120 ) { return device.WriteFrame(lineNumber, buf, count, written); } 01121 01125 virtual PBoolean ReadBlock( 01126 void * buf, 01127 PINDEX count 01128 ) { return device.ReadBlock(lineNumber, buf, count); } 01129 01132 virtual PBoolean WriteBlock( 01133 const void * buf, 01134 PINDEX count 01135 ) { return device.WriteBlock(lineNumber, buf, count); } 01136 01137 01140 virtual unsigned GetAverageSignalLevel( 01141 PBoolean playback 01142 ) { return device.GetAverageSignalLevel(lineNumber, playback); } 01143 01144 01147 virtual PBoolean EnableAudio( 01148 PBoolean enable = true 01149 ) { return device.EnableAudio(lineNumber, enable); } 01150 01153 PBoolean DisableAudio() { return EnableAudio(false); } 01154 01157 virtual PBoolean IsAudioEnabled() const { return device.IsAudioEnabled(lineNumber); } 01158 01159 01164 virtual PBoolean SetRecordVolume( 01165 unsigned volume 01166 ) { return device.SetRecordVolume(lineNumber, volume); } 01167 01172 virtual PBoolean SetPlayVolume( 01173 unsigned volume 01174 ) { return device.SetPlayVolume(lineNumber, volume); } 01175 01180 virtual PBoolean GetRecordVolume( 01181 unsigned & volume 01182 ) { return device.GetRecordVolume(lineNumber, volume); } 01183 01188 virtual PBoolean GetPlayVolume( 01189 unsigned & volume 01190 ) { return device.GetPlayVolume(lineNumber, volume); } 01191 01192 01196 virtual OpalLineInterfaceDevice::AECLevels GetAEC() const { return device.GetAEC(lineNumber); } 01197 01201 virtual PBoolean SetAEC( 01202 OpalLineInterfaceDevice::AECLevels level 01203 ) { return device.SetAEC(lineNumber, level); } 01204 01205 01209 virtual PBoolean GetVAD() const { return device.GetVAD(lineNumber); } 01210 01214 virtual PBoolean SetVAD( 01215 PBoolean enable 01216 ) { return device.SetVAD(lineNumber, enable); } 01217 01218 01232 virtual PBoolean GetCallerID( 01233 PString & idString, 01234 PBoolean full = false 01235 ) { return device.GetCallerID(lineNumber, idString, full); } 01236 01258 virtual PBoolean SetCallerID( 01259 const PString & idString 01260 ) { return device.SetCallerID(lineNumber, idString); } 01261 01264 virtual PBoolean SendVisualMessageWaitingIndicator( 01265 PBoolean on 01266 ) { return device.SendVisualMessageWaitingIndicator(lineNumber, on); } 01267 01268 01272 virtual PBoolean PlayDTMF( 01273 const char * digits, 01274 DWORD onTime = OpalLineInterfaceDevice::DefaultDTMFOnTime, 01275 DWORD offTime = OpalLineInterfaceDevice::DefaultDTMFOffTime 01276 ) { return device.PlayDTMF(lineNumber, digits, onTime, offTime); } 01277 01287 virtual char ReadDTMF() { return device.ReadDTMF(lineNumber); } 01288 01293 virtual PBoolean GetRemoveDTMF() { return device.GetRemoveDTMF(lineNumber); } 01294 01299 virtual PBoolean SetRemoveDTMF( 01300 PBoolean removeTones 01301 ) { return device.SetRemoveDTMF(lineNumber, removeTones); } 01302 01303 01306 virtual OpalLineInterfaceDevice::CallProgressTones IsToneDetected() { return device.IsToneDetected(lineNumber); } 01307 01310 virtual OpalLineInterfaceDevice::CallProgressTones WaitForToneDetect( 01311 unsigned timeout = 3000 01312 ) { return device.WaitForToneDetect(lineNumber, timeout); } 01313 01316 virtual PBoolean WaitForTone( 01317 OpalLineInterfaceDevice::CallProgressTones tone, 01318 unsigned timeout = 3000 01319 ) { return device.WaitForTone(lineNumber, tone, timeout); } 01320 01323 virtual PBoolean PlayTone( 01324 OpalLineInterfaceDevice::CallProgressTones tone 01325 ) { return device.PlayTone(lineNumber, tone); } 01326 01329 virtual PBoolean IsTonePlaying() { return device.IsTonePlaying(lineNumber); } 01330 01333 virtual PBoolean StopTone() { return device.StopTone(lineNumber); } 01334 01335 01351 virtual OpalLineInterfaceDevice::CallProgressTones DialOut( 01352 const PString & number, 01353 const OpalLineInterfaceDevice::DialParams & params = OpalLineInterfaceDevice::DialParams() 01354 ) { return device.DialOut(lineNumber, number, params); } 01356 01361 OpalLineInterfaceDevice & GetDevice() const { return device; } 01362 01365 unsigned GetLineNumber() const { return lineNumber; } 01366 01369 PString GetToken() const { return token; } 01370 01373 void SetToken(const PString & t) { token = t; } 01375 01376 protected: 01377 OpalLineInterfaceDevice & device; 01378 unsigned lineNumber; 01379 PString token; 01380 PTimeInterval ringStoppedTime; 01381 PTimeInterval ringInterCadenceTime; 01382 01383 PTimeInterval ringTick; 01384 unsigned ringCount; 01385 bool lastRingState; 01386 }; 01387 01388 01389 PLIST(OpalLineList, OpalLine); 01390 01391 01398 class OpalLIDRegistration : public PCaselessString 01399 { 01400 PCLASSINFO(OpalLIDRegistration, PCaselessString); 01401 public: 01406 OpalLIDRegistration( 01407 const char * name 01408 ); 01409 01412 ~OpalLIDRegistration(); 01414 01419 virtual OpalLineInterfaceDevice * Create( 01420 void * parameters 01421 ) const = 0; 01423 01424 protected: 01425 OpalLIDRegistration * link; 01426 bool duplicate; 01427 01428 friend class OpalLineInterfaceDevice; 01429 }; 01430 01431 01432 #define OPAL_REGISTER_LID_FUNCTION(cls, type, param) \ 01433 static class cls##_Registration : public OpalLIDRegistration { \ 01434 public: \ 01435 cls##_Registration() : OpalLIDRegistration(type) { } \ 01436 OpalLineInterfaceDevice * Create(void * param) const; \ 01437 } instance_##cls##_Registration; \ 01438 OpalLineInterfaceDevice * cls##_Registration::Create(void * param) const 01439 01440 #ifndef OPAL_NO_PARAM 01441 #define OPAL_NO_PARAM 01442 #endif 01443 01444 #define OPAL_REGISTER_LID(cls, type) \ 01445 OPAL_REGISTER_LID_FUNCTION(cls, type, OPAL_NO_PARAM) \ 01446 { return new cls; } 01447 01448 #define OPAL_REGISTER_LID_PARAM(cls, type) \ 01449 OPAL_REGISTER_LID_FUNCTION(cls, type, parameter) \ 01450 { return new cls(parameter); } 01451 01452 01453 #endif // OPAL_LIDS_LID_H 01454 01455 01456 // End of File ///////////////////////////////////////////////////////////////