# 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: 21008 $
    00030  * $Author: rjongbloed $
    00031  * $Date: 2008-09-16 10:13:12 +0000 (Tue, 16 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 #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 = PFalse
    00116     );
    00117
    00118
    00124     virtual PBoolean IsLineOffHook(
    00125       unsigned line
    00126     ) = 0;
    00127
    00133     virtual PBoolean SetLineOffHook(
    00134       unsigned line,
    00135       PBoolean newState = PTrue
    00136     ) = 0;
    00137
    00141     virtual PBoolean SetLineOnHook(
    00142       unsigned line
    00143     ) { return SetLineOffHook(line, PFalse); }
    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 = PTrue
    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 = PTrue
    00388     );
    00389
    00392     PBoolean DisableAudio(
    00393       unsigned line
    00394     ) { return EnableAudio(line, PFalse); }
    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 = PFalse
    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       NumTones
    00596     };
    00597
    00600     virtual CallProgressTones IsToneDetected(
    00601       unsigned line
    00602     );
    00603
    00606     virtual CallProgressTones WaitForToneDetect(
    00607       unsigned line,
    00608       unsigned timeout = 3000
    00609     );
    00610
    00613     virtual PBoolean WaitForTone(
    00614       unsigned line,
    00615       CallProgressTones tone,
    00616       unsigned timeout = 3000
    00617     );
    00618
    00641     virtual bool SetToneDescription(
    00642       unsigned line,
    00643       CallProgressTones tone,
    00644       const PString & description
    00645     );
    00646
    00647     enum ToneMixingModes {
    00648       SimpleTone,
    00649       AddedTone,
    00650       ModulatedTone
    00651     };
    00652
    00656     virtual bool SetToneParameters(
    00657       unsigned line,
    00658       CallProgressTones tone,
    00659       unsigned frequency1,
    00660       unsigned frequency2,
    00661       ToneMixingModes mode,
    00662       PINDEX numCadences,
    00663       const unsigned * onTimes,
    00664       const unsigned * offTimes
    00665     );
    00666
    00669     virtual PBoolean PlayTone(
    00670       unsigned line,
    00671       CallProgressTones tone
    00672     );
    00673
    00676     virtual PBoolean IsTonePlaying(
    00677       unsigned line
    00678     );
    00679
    00682     virtual PBoolean StopTone(
    00683       unsigned line
    00684     );
    00685
    00686
    00688     struct DialParams {
    00689       DialParams()
    00690         : m_requireTones(false)
    00691         , m_dialToneTimeout(2500)
    00692         , m_dialStartDelay(500)
    00693         , m_dialDigitTime(DefaultDTMFOnTime)
    00694         , m_dialInterDigitTime(DefaultDTMFOffTime)
    00695         , m_progressTimeout(5000)
    00696         , m_commaDelay(2000)
    00697       { }
    00698
    00699       bool     m_requireTones;
    00700       unsigned m_dialToneTimeout;
    00701       unsigned m_dialStartDelay;
    00702       unsigned m_dialDigitTime;
    00703       unsigned m_dialInterDigitTime;
    00704       unsigned m_progressTimeout;
    00705       unsigned m_commaDelay;
    00706     };
    00707
    00723     virtual CallProgressTones DialOut(
    00724       unsigned line,
    00725       const PString & number,
    00726       const DialParams & params = DialParams()
    00727     );
    00728
    00729
    00733     virtual unsigned GetWinkDuration(
    00734       unsigned line
    00735     );
    00736
    00740     virtual PBoolean SetWinkDuration(
    00741       unsigned line,
    00742       unsigned winkDuration
    00743     );
    00744
    00745
    00746     enum T35CountryCodes {
    00747       Japan, Albania, Algeria, AmericanSamoa, Germany, Anguilla, AntiguaAndBarbuda,
    00748       Argentina, Ascension, Australia, Austria, Bahamas, Bahrain, Bangladesh,
    00749       Barbados, Belgium, Belize, Benin, Bermudas, Bhutan, Bolivia, Botswana,
    00750       Brazil, BritishAntarcticTerritory, BritishIndianOceanTerritory,
    00751       BritishVirginIslands, BruneiDarussalam, Bulgaria, Myanmar, Burundi,
    00752       Byelorussia, Cameroon, Canada, CapeVerde, CaymanIslands,
    00753       CentralAfricanRepublic, Chad, Chile, China, Colombia, Comoros, Congo,
    00754       CookIslands, CostaRica, Cuba, Cyprus, Czechoslovakia, Cambodia,
    00755       DemocraticPeoplesRepublicOfKorea, Denmark, Djibouti, DominicanRepublic,
    00756       Dominica, Ecuador, Egypt, ElSalvador, EquatorialGuinea, Ethiopia,
    00757       FalklandIslands, Fiji, Finland, France, FrenchPolynesia,
    00758       FrenchSouthernAndAntarcticLands, Gabon, Gambia, Germany2, Angola, Ghana,
    00759       Gibraltar, Greece, Grenada, Guam, Guatemala, Guernsey, Guinea, GuineaBissau,
    00760       Guayana, Haiti, Honduras, Hongkong, Hungary, Iceland, India, Indonesia,
    00761       Iran, Iraq, Ireland, Israel, Italy, CotedIvoire, Jamaica, Afghanistan,
    00762       Jersey, Jordan, Kenya, Kiribati, KoreaRepublic, Kuwait, Lao, Lebanon,
    00763       Lesotho, Liberia, Libya, Liechtenstein, Luxemborg, Macao, Madagascar,
    00764       Malaysia, Malawi, Maldives, Mali, Malta, Mauritania, Mauritius, Mexico,
    00765       Monaco, Mongolia, Montserrat, Morocco, Mozambique, Nauru, Nepal,
    00766       Netherlands, NetherlandsAntilles, NewCaledonia, NewZealand, Nicaragua,
    00767       Niger, Nigeria, Norway, Oman, Pakistan, Panama, PapuaNewGuinea, Paraguay,
    00768       Peru, Philippines, Poland, Portugal, PuertoRico, Qatar, Romania, Rwanda,
    00769       SaintKittsAndNevis, SaintCroix, SaintHelenaAndAscension, SaintLucia,
    00770       SanMarino, SaintThomas, SaoTomeAndPrincipe, SaintVicentAndTheGrenadines,
    00771       SaudiArabia, Senegal, Seychelles, SierraLeone, Singapore, SolomonIslands,
    00772       Somalia, SouthAfrica, Spain, SriLanka, Sudan, Suriname, Swaziland, Sweden,
    00773       Switzerland, Syria, Tanzania, Thailand, Togo, Tonga, TrinidadAndTobago,
    00774       Tunisia, Turkey, TurksAndCaicosIslands, Tuvalu, Uganda, Ukraine,
    00775       UnitedArabEmirates, UnitedKingdom, UnitedStates, BurkinaFaso, Uruguay,
    00776       USSR, Vanuatu, VaticanCityState, Venezuela, VietNam, WallisAndFutuna,
    00777       WesternSamoa, Yemen, Yemen2, Yugoslavia, Zaire, Zambia, Zimbabwe,
    00778       NumCountryCodes,
    00779       UnknownCountry = -1
    00780     };
    00781
    00784     T35CountryCodes GetCountryCode() const { return countryCode; }
    00785
    00788     PString GetCountryCodeName() const;
    00789
    00792     static PString GetCountryCodeName(T35CountryCodes code);
    00793     static T35CountryCodes GetCountryCode(const PString & name);
    00794
    00800     virtual PBoolean SetCountryCode(
    00801       T35CountryCodes country
    00802     );
    00803
    00806     virtual PBoolean SetCountryCodeName(
    00807       const PString & countryName
    00808     );
    00809
    00812     virtual PStringList GetCountryCodeNameList() const;
    00813
    00814
    00817     virtual PBoolean PlayAudio(
    00818       unsigned line,
    00819       const PString & filename
    00820     );
    00821
    00824     virtual PBoolean StopAudio(
    00825       unsigned line
    00826     );
    00827
    00828
    00832     virtual PBoolean RecordAudioStart(
    00833       unsigned line,
    00834       const PString & filename
    00835     );
    00836
    00841     virtual PBoolean RecordAudioStop(
    00842       unsigned line
    00843     );
    00844
    00845
    00848     int GetErrorNumber() const { return osError; }
    00849
    00852     PString GetErrorText() const;
    00853
    00854     virtual void PrintOn(
    00855       ostream & strm
    00856     ) const;
    00857
    00860     static OpalLineInterfaceDevice * Create(
    00861       const PString & type,
    00862       void * parameters = NULL
    00863     );
    00864
    00869     static OpalLineInterfaceDevice * CreateAndOpen(
    00870       const PString & descriptor,
    00871       void * parameters = NULL
    00872     );
    00873
    00876     static PStringList GetAllTypes();
    00877
    00882     static PStringList GetAllDevices();
    00883
    00884
    00885   protected:
    00886     int               os_handle;
    00887     mutable int       osError;
    00888     T35CountryCodes   countryCode;
    00889     PBYTEArray        m_readDeblockingBuffer, m_writeDeblockingBuffer;
    00890     PINDEX            m_readDeblockingOffset, m_writeDeblockingOffset;
    00891     std::vector<bool> m_LineAudioEnabled;
    00892     PString           m_callProgressTones[NumTones];
    00893 #if PTRACING
    00894     friend ostream & operator<<(ostream & o, CallProgressTones t);
    00895 #endif
    00896 };
    00897
    00898
    00899 PLIST(OpalLIDList, OpalLineInterfaceDevice);
    00900
    00901
    00902
    00905 class OpalLine : public PObject
    00906 {
    00907     PCLASSINFO(OpalLine, PObject);
    00908   public:
    00913     OpalLine(
    00914       OpalLineInterfaceDevice & device,
    00915       unsigned lineNumber,
    00916       const char * userToken = NULL
    00917     );
    00919
    00926     void PrintOn(
    00927       ostream & strm
    00928     ) const;
    00930
    00939     virtual PBoolean IsTerminal() { return device.IsLineTerminal(lineNumber); }
    00940
    00941
    00944     virtual PBoolean IsPresent(
    00945       PBoolean force = PFalse
    00946     ) { return device.IsLinePresent(lineNumber, force); }
    00947
    00948
    00954     virtual PBoolean IsOffHook() { return device.IsLineOffHook(lineNumber); }
    00955
    00961     virtual PBoolean SetOffHook() { return device.SetLineOffHook(lineNumber, PTrue); }
    00962
    00966     virtual PBoolean SetOnHook() { return device.SetLineOffHook(lineNumber, PFalse); }
    00967
    00971     virtual PBoolean HookFlash(
    00972       unsigned flashTime = 200
    00973     ) { return device.HookFlash(lineNumber, flashTime); }
    00974
    00977     virtual PBoolean HasHookFlash() { return device.HasHookFlash(lineNumber); }
    00978
    00979
    00990     virtual PBoolean IsRinging(
    00991       DWORD * cadence = NULL
    00992     );
    00993
    00997     virtual unsigned GetRingCount(
    00998       DWORD * cadence = NULL
    00999     );
    01000
    01018     virtual PBoolean Ring(
    01019       PINDEX nCadence,
    01020       const unsigned * pattern = NULL,
    01021       unsigned frequency = 400
    01022     ) { return device.RingLine(lineNumber, nCadence, pattern, frequency); }
    01023
    01024
    01035     virtual PBoolean SetConnected() { return device.SetLineConnected(lineNumber); }
    01036
    01044     virtual PBoolean IsConnected() { return device.IsLineConnected(lineNumber); }
    01045
    01046
    01050     virtual PBoolean IsDisconnected() { return device.IsLineDisconnected(lineNumber); }
    01051
    01054     virtual PBoolean SetReadFormat(
    01055       const OpalMediaFormat & mediaFormat
    01056     ) { return device.SetReadFormat(lineNumber, mediaFormat); }
    01057
    01060     virtual PBoolean SetWriteFormat(
    01061       const OpalMediaFormat & mediaFormat
    01062     ) { return device.SetWriteFormat(lineNumber, mediaFormat); }
    01063
    01066     virtual OpalMediaFormat GetReadFormat() { return device.GetReadFormat(lineNumber); }
    01067
    01070     virtual OpalMediaFormat GetWriteFormat() { return device.GetWriteFormat(lineNumber); }
    01071
    01074     virtual PBoolean StopReading() { return device.StopReading(lineNumber); }
    01075
    01078     virtual PBoolean StopWriting() { return device.StopWriting(lineNumber); }
    01079
    01084     virtual PBoolean SetReadFrameSize(
    01085       PINDEX frameSize
    01086     ) { return device.SetReadFrameSize(lineNumber, frameSize); }
    01087
    01092     virtual PBoolean SetWriteFrameSize(
    01093       PINDEX frameSize
    01094     ) { return device.SetWriteFrameSize(lineNumber, frameSize); }
    01095
    01099     virtual PINDEX GetReadFrameSize() { return device.GetReadFrameSize(lineNumber); }
    01100
    01104     virtual PINDEX GetWriteFrameSize() { return device.GetWriteFrameSize(lineNumber); }
    01105
    01108     virtual PBoolean ReadFrame(
    01109       void * buf,
    01110       PINDEX & count
    01111     ) { return device.ReadFrame(lineNumber, buf, count); }
    01112
    01115     virtual PBoolean WriteFrame(
    01116       const void * buf,
    01117       PINDEX count,
    01118       PINDEX & written
    01119     ) { return device.WriteFrame(lineNumber, buf, count, written); }
    01120
    01124     virtual PBoolean ReadBlock(
    01125       void * buf,
    01126       PINDEX count
    01127     ) { return device.ReadBlock(lineNumber, buf, count); }
    01128
    01131     virtual PBoolean WriteBlock(
    01132       const void * buf,
    01133       PINDEX count
    01134     ) { return device.WriteBlock(lineNumber, buf, count); }
    01135
    01136
    01139     virtual unsigned GetAverageSignalLevel(
    01140       PBoolean playback
    01141     ) { return device.GetAverageSignalLevel(lineNumber, playback); }
    01142
    01143
    01146     virtual PBoolean EnableAudio(
    01147       PBoolean enable = PTrue
    01148     ) { return device.EnableAudio(lineNumber, enable); }
    01149
    01152     PBoolean DisableAudio() { return EnableAudio(PFalse); }
    01153
    01156     virtual PBoolean IsAudioEnabled() const { return device.IsAudioEnabled(lineNumber); }
    01157
    01158
    01163     virtual PBoolean SetRecordVolume(
    01164       unsigned volume
    01165     ) { return device.SetRecordVolume(lineNumber, volume); }
    01166
    01171     virtual PBoolean SetPlayVolume(
    01172       unsigned volume
    01173     ) { return device.SetPlayVolume(lineNumber, volume); }
    01174
    01179     virtual PBoolean GetRecordVolume(
    01180       unsigned & volume
    01181     ) { return device.GetRecordVolume(lineNumber, volume); }
    01182
    01187     virtual PBoolean GetPlayVolume(
    01188       unsigned & volume
    01189     ) { return device.GetPlayVolume(lineNumber, volume); }
    01190
    01191
    01195     virtual OpalLineInterfaceDevice::AECLevels GetAEC() const { return device.GetAEC(lineNumber); }
    01196
    01200     virtual PBoolean SetAEC(
    01201       OpalLineInterfaceDevice::AECLevels level
    01202     ) { return device.SetAEC(lineNumber, level); }
    01203
    01204
    01208     virtual PBoolean GetVAD() const { return device.GetVAD(lineNumber); }
    01209
    01213     virtual PBoolean SetVAD(
    01214       PBoolean enable
    01215     ) { return device.SetVAD(lineNumber, enable); }
    01216
    01217
    01231     virtual PBoolean GetCallerID(
    01232       PString & idString,
    01233       PBoolean full = PFalse
    01234     ) { return device.GetCallerID(lineNumber, idString, full); }
    01235
    01257     virtual PBoolean SetCallerID(
    01258       const PString & idString
    01259     ) { return device.SetCallerID(lineNumber, idString); }
    01260
    01263     virtual PBoolean SendVisualMessageWaitingIndicator(
    01264       PBoolean on
    01265     ) { return device.SendVisualMessageWaitingIndicator(lineNumber, on); }
    01266
    01267
    01271     virtual PBoolean PlayDTMF(
    01272       const char * digits,
    01273       DWORD onTime = OpalLineInterfaceDevice::DefaultDTMFOnTime,
    01274       DWORD offTime = OpalLineInterfaceDevice::DefaultDTMFOffTime
    01275     ) { return device.PlayDTMF(lineNumber, digits, onTime, offTime); }
    01276
    01286     virtual char ReadDTMF() { return device.ReadDTMF(lineNumber); }
    01287
    01292     virtual PBoolean GetRemoveDTMF() { return device.GetRemoveDTMF(lineNumber); }
    01293
    01298     virtual PBoolean SetRemoveDTMF(
    01299       PBoolean removeTones
    01300     ) { return device.SetRemoveDTMF(lineNumber, removeTones); }
    01301
    01302
    01305     virtual OpalLineInterfaceDevice::CallProgressTones IsToneDetected() { return device.IsToneDetected(lineNumber); }
    01306
    01309     virtual OpalLineInterfaceDevice::CallProgressTones WaitForToneDetect(
    01310       unsigned timeout = 3000
    01311     ) { return device.WaitForToneDetect(lineNumber, timeout); }
    01312
    01315     virtual PBoolean WaitForTone(
    01316       OpalLineInterfaceDevice::CallProgressTones tone,
    01317       unsigned timeout = 3000
    01318     ) { return device.WaitForTone(lineNumber, tone, timeout); }
    01319
    01322     virtual PBoolean PlayTone(
    01323       OpalLineInterfaceDevice::CallProgressTones tone
    01324     ) { return device.PlayTone(lineNumber, tone); }
    01325
    01328     virtual PBoolean IsTonePlaying() { return device.IsTonePlaying(lineNumber); }
    01329
    01332     virtual PBoolean StopTone() { return device.StopTone(lineNumber); }
    01333
    01334
    01350     virtual OpalLineInterfaceDevice::CallProgressTones DialOut(
    01351       const PString & number,
    01352       const OpalLineInterfaceDevice::DialParams & params = OpalLineInterfaceDevice::DialParams()
    01353     ) { return device.DialOut(lineNumber, number, params); }
    01355
    01360     OpalLineInterfaceDevice & GetDevice() const { return device; }
    01361
    01364     unsigned GetLineNumber() const { return lineNumber; }
    01365
    01368     PString GetToken() const { return token; }
    01369
    01372     void SetToken(const PString & t) { token = t; }
    01374
    01375   protected:
    01376     OpalLineInterfaceDevice & device;
    01377     unsigned                  lineNumber;
    01378     PString                   token;
    01379     PTimeInterval             ringStoppedTime;
    01380     PTimeInterval             ringInterCadenceTime;
    01381
    01382     PTimeInterval             ringTick;
    01383     unsigned                  ringCount;
    01384     bool                      lastRingState;
    01385 };
    01386
    01387
    01388 PLIST(OpalLineList, OpalLine);
    01389
    01390
    01397 class OpalLIDRegistration : public PCaselessString
    01398 {
    01399     PCLASSINFO(OpalLIDRegistration, PCaselessString);
    01400   public:
    01405     OpalLIDRegistration(
    01406       const char * name
    01407     );
    01408
    01411     ~OpalLIDRegistration();
    01413
    01418     virtual OpalLineInterfaceDevice * Create(
    01419       void * parameters
    01420     ) const = 0;
    01422
    01423   protected:
    01424     OpalLIDRegistration * link;
    01425     bool                  duplicate;
    01426
    01427   friend class OpalLineInterfaceDevice;
    01428 };
    01429
    01430
    01431 #define OPAL_REGISTER_LID_FUNCTION(cls, type, param) \
    01432 static class cls##_Registration : public OpalLIDRegistration { \
    01433   public: \
    01434     cls##_Registration() : OpalLIDRegistration(type) { } \
    01435     OpalLineInterfaceDevice * Create(void * param) const; \
    01436 } instance_##cls##_Registration; \
    01437 OpalLineInterfaceDevice * cls##_Registration::Create(void * param) const
    01438
    01439 #ifndef OPAL_NO_PARAM
    01440 #define OPAL_NO_PARAM
    01441 #endif
    01442
    01443 #define OPAL_REGISTER_LID(cls, type) \
    01444   OPAL_REGISTER_LID_FUNCTION(cls, type, OPAL_NO_PARAM) \
    01445   { return new cls; }
    01446
    01447 #define OPAL_REGISTER_LID_PARAM(cls, type) \
    01448   OPAL_REGISTER_LID_FUNCTION(cls, type, parameter) \
    01449   { return new cls(parameter); }
    01450
    01451
    01452 #endif // __OPAL_LID_H
    01453
    01454
    01455 // End of File ///////////////////////////////////////////////////////////////