00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280 #ifndef __OPAL_LID_H
00281 #define __OPAL_LID_H
00282
00283 #ifdef P_USE_PRAGMA
00284 #pragma interface
00285 #endif
00286
00287
00288 #include <opal/mediafmt.h>
00289
00290
00292
00296 class OpalLineInterfaceDevice : public PObject
00297 {
00298 PCLASSINFO(OpalLineInterfaceDevice, PObject);
00299
00300 public:
00303 OpalLineInterfaceDevice();
00304
00307 virtual BOOL Open(
00308 const PString & device
00309 ) = 0;
00310
00313 virtual BOOL IsOpen() const;
00314
00317 virtual BOOL Close();
00318
00322 virtual PString GetDeviceType() const = 0;
00323
00328 virtual PString GetDeviceName() const = 0;
00329
00332 virtual PStringArray GetAllNames() const = 0;
00333
00339 virtual PString GetDescription() const = 0;
00340
00343 virtual unsigned GetLineCount() = 0;
00344
00351 virtual BOOL IsLineTerminal(
00352 unsigned line
00353 ) = 0;
00354
00355
00358 virtual BOOL IsLinePresent(
00359 unsigned line,
00360 BOOL force = FALSE
00361 );
00362
00363
00369 virtual BOOL IsLineOffHook(
00370 unsigned line
00371 ) = 0;
00372
00378 virtual BOOL SetLineOffHook(
00379 unsigned line,
00380 BOOL newState = TRUE
00381 ) = 0;
00382
00386 virtual BOOL SetLineOnHook(
00387 unsigned line
00388 ) { return SetLineOffHook(line, FALSE); }
00389
00393 virtual BOOL HookFlash(
00394 unsigned line,
00395 unsigned flashTime = 200
00396 );
00397
00400 virtual BOOL HasHookFlash(unsigned line);
00401
00402
00413 virtual BOOL IsLineRinging(
00414 unsigned line,
00415 DWORD * cadence = NULL
00416 );
00417
00435 virtual BOOL RingLine(
00436 unsigned line,
00437 PINDEX nCadence,
00438 const unsigned * pattern = NULL,
00439 unsigned frequency = 400
00440 );
00441
00442
00449 virtual BOOL IsLineDisconnected(
00450 unsigned line,
00451 BOOL checkForWink = TRUE
00452 );
00453
00454
00457 virtual BOOL SetLineToLineDirect(
00458 unsigned line1,
00459 unsigned line2,
00460 BOOL connect
00461 );
00462
00465 virtual BOOL IsLineToLineDirect(
00466 unsigned line1,
00467 unsigned line2
00468 );
00469
00470
00473 virtual OpalMediaFormatList GetMediaFormats() const = 0;
00474
00477 virtual BOOL SetReadFormat(
00478 unsigned line,
00479 const OpalMediaFormat & mediaFormat
00480 ) = 0;
00481
00484 virtual BOOL SetWriteFormat(
00485 unsigned line,
00486 const OpalMediaFormat & mediaFormat
00487 ) = 0;
00488
00491 virtual OpalMediaFormat GetReadFormat(
00492 unsigned line
00493 ) = 0;
00494
00497 virtual OpalMediaFormat GetWriteFormat(
00498 unsigned line
00499 ) = 0;
00500
00503 virtual BOOL StopReading(
00504 unsigned line
00505 );
00506
00509 virtual BOOL StopWriting(
00510 unsigned line
00511 );
00512
00517 virtual BOOL SetReadFrameSize(
00518 unsigned line,
00519 PINDEX frameSize
00520 ) = 0;
00521
00526 virtual BOOL SetWriteFrameSize(
00527 unsigned line,
00528 PINDEX frameSize
00529 ) = 0;
00530
00534 virtual PINDEX GetReadFrameSize(
00535 unsigned line
00536 ) = 0;
00537
00541 virtual PINDEX GetWriteFrameSize(
00542 unsigned line
00543 ) = 0;
00544
00547 virtual BOOL ReadFrame(
00548 unsigned line,
00549 void * buf,
00550 PINDEX & count
00551 ) = 0;
00552
00555 virtual BOOL WriteFrame(
00556 unsigned line,
00557 const void * buf,
00558 PINDEX count,
00559 PINDEX & written
00560 ) = 0;
00561
00565 virtual BOOL ReadBlock(
00566 unsigned line,
00567 void * buf,
00568 PINDEX count
00569 );
00570
00573 virtual BOOL WriteBlock(
00574 unsigned line,
00575 const void * buf,
00576 PINDEX count
00577 );
00578
00579
00582 virtual unsigned GetAverageSignalLevel(
00583 unsigned line,
00584 BOOL playback
00585 );
00586
00587
00590 virtual BOOL EnableAudio(
00591 unsigned line,
00592 BOOL enable = TRUE
00593 );
00594
00597 BOOL DisableAudio(
00598 unsigned line
00599 ) { return EnableAudio(line, FALSE); }
00600
00603 virtual BOOL IsAudioEnabled(
00604 unsigned line
00605 );
00606
00607
00608 enum {
00609 MaxVolume = 100
00610 };
00611
00616 virtual BOOL SetRecordVolume(
00617 unsigned line,
00618 unsigned volume
00619 );
00620
00625 virtual BOOL SetPlayVolume(
00626 unsigned line,
00627 unsigned volume
00628 );
00629
00634 virtual BOOL GetRecordVolume(
00635 unsigned line,
00636 unsigned & volume
00637 );
00638
00643 virtual BOOL GetPlayVolume(
00644 unsigned line,
00645 unsigned & volume
00646 );
00647
00648
00649 enum AECLevels {
00650 AECOff,
00651 AECLow,
00652 AECMedium,
00653 AECHigh,
00654 AECAuto,
00655 AECAGC,
00656 AECError
00657 };
00658
00662 virtual AECLevels GetAEC(
00663 unsigned line
00664 );
00665
00669 virtual BOOL SetAEC(
00670 unsigned line,
00671 AECLevels level
00672 );
00673
00677 virtual BOOL GetVAD(
00678 unsigned line
00679 );
00680
00684 virtual BOOL SetVAD(
00685 unsigned line,
00686 BOOL enable
00687 );
00688
00689
00697 virtual BOOL GetCallerID(
00698 unsigned line,
00699 PString & idString,
00700 BOOL full = FALSE
00701 );
00702
00711 virtual BOOL SetCallerID(
00712 unsigned line,
00713 const PString & idString
00714 );
00715
00724 virtual BOOL SendCallerIDOnCallWaiting(
00725 unsigned line,
00726 const PString & idString
00727 );
00728
00731 virtual BOOL SendVisualMessageWaitingIndicator(
00732 unsigned line,
00733 BOOL on
00734 );
00735
00736
00737 enum {
00738 DefaultDTMFOnTime = 180,
00739 DefaultDTMFOffTime = 120
00740 };
00741
00745 virtual BOOL PlayDTMF(
00746 unsigned line,
00747 const char * digits,
00748 DWORD onTime = DefaultDTMFOnTime,
00749 DWORD offTime = DefaultDTMFOffTime
00750 );
00751
00761 virtual char ReadDTMF(
00762 unsigned line
00763 );
00764
00769 virtual BOOL GetRemoveDTMF(
00770 unsigned line
00771 );
00772
00777 virtual BOOL SetRemoveDTMF(
00778 unsigned line,
00779 BOOL removeTones
00780 );
00781
00782
00783 enum CallProgressTones {
00784 NoTone = -1,
00785 DialTone,
00786 RingTone,
00787 BusyTone,
00788 CongestionTone,
00789 ClearTone,
00790 MwiTone,
00791 CNGTone,
00792 NumTones
00793 };
00794
00797 virtual CallProgressTones IsToneDetected(
00798 unsigned line
00799 );
00800
00803 virtual CallProgressTones WaitForToneDetect(
00804 unsigned line,
00805 unsigned timeout = 3000
00806 );
00807
00810 virtual BOOL WaitForTone(
00811 unsigned line,
00812 CallProgressTones tone,
00813 unsigned timeout = 3000
00814 );
00815
00833 virtual BOOL SetToneFilter(
00834 unsigned line,
00835 CallProgressTones tone,
00836 const PString & description
00837 );
00838
00841 virtual BOOL SetToneFilterParameters(
00842 unsigned line,
00843 CallProgressTones tone,
00844 unsigned lowFrequency,
00845 unsigned highFrequency,
00846 PINDEX numCadences,
00847 const unsigned * onTimes,
00848 const unsigned * offTimes
00849 );
00850
00853 virtual BOOL PlayTone(
00854 unsigned line,
00855 CallProgressTones tone
00856 );
00857
00860 virtual BOOL IsTonePlaying(
00861 unsigned line
00862 );
00863
00866 virtual BOOL StopTone(
00867 unsigned line
00868 );
00869
00870
00871 enum { DIAL_TONE_TIMEOUT = 10000 };
00872
00888 virtual CallProgressTones DialOut(
00889 unsigned line,
00890 const PString & number,
00891 BOOL requireTones = FALSE,
00892 unsigned uiDialDelay = 0
00893 );
00894
00895
00899 virtual unsigned GetWinkDuration(
00900 unsigned line
00901 );
00902
00906 virtual BOOL SetWinkDuration(
00907 unsigned line,
00908 unsigned winkDuration
00909 );
00910
00911
00912 enum T35CountryCodes {
00913 Japan, Albania, Algeria, AmericanSamoa, Germany, Anguilla, AntiguaAndBarbuda,
00914 Argentina, Ascension, Australia, Austria, Bahamas, Bahrain, Bangladesh,
00915 Barbados, Belgium, Belize, Benin, Bermudas, Bhutan, Bolivia, Botswana,
00916 Brazil, BritishAntarcticTerritory, BritishIndianOceanTerritory,
00917 BritishVirginIslands, BruneiDarussalam, Bulgaria, Myanmar, Burundi,
00918 Byelorussia, Cameroon, Canada, CapeVerde, CaymanIslands,
00919 CentralAfricanRepublic, Chad, Chile, China, Colombia, Comoros, Congo,
00920 CookIslands, CostaRica, Cuba, Cyprus, Czechoslovakia, Cambodia,
00921 DemocraticPeoplesRepublicOfKorea, Denmark, Djibouti, DominicanRepublic,
00922 Dominica, Ecuador, Egypt, ElSalvador, EquatorialGuinea, Ethiopia,
00923 FalklandIslands, Fiji, Finland, France, FrenchPolynesia,
00924 FrenchSouthernAndAntarcticLands, Gabon, Gambia, Germany2, Angola, Ghana,
00925 Gibraltar, Greece, Grenada, Guam, Guatemala, Guernsey, Guinea, GuineaBissau,
00926 Guayana, Haiti, Honduras, Hongkong, Hungary, Iceland, India, Indonesia,
00927 Iran, Iraq, Ireland, Israel, Italy, CotedIvoire, Jamaica, Afghanistan,
00928 Jersey, Jordan, Kenya, Kiribati, KoreaRepublic, Kuwait, Lao, Lebanon,
00929 Lesotho, Liberia, Libya, Liechtenstein, Luxemborg, Macao, Madagascar,
00930 Malaysia, Malawi, Maldives, Mali, Malta, Mauritania, Mauritius, Mexico,
00931 Monaco, Mongolia, Montserrat, Morocco, Mozambique, Nauru, Nepal,
00932 Netherlands, NetherlandsAntilles, NewCaledonia, NewZealand, Nicaragua,
00933 Niger, Nigeria, Norway, Oman, Pakistan, Panama, PapuaNewGuinea, Paraguay,
00934 Peru, Philippines, Poland, Portugal, PuertoRico, Qatar, Romania, Rwanda,
00935 SaintKittsAndNevis, SaintCroix, SaintHelenaAndAscension, SaintLucia,
00936 SanMarino, SaintThomas, SaoTomeAndPrincipe, SaintVicentAndTheGrenadines,
00937 SaudiArabia, Senegal, Seychelles, SierraLeone, Singapore, SolomonIslands,
00938 Somalia, SouthAfrica, Spain, SriLanka, Sudan, Suriname, Swaziland, Sweden,
00939 Switzerland, Syria, Tanzania, Thailand, Togo, Tonga, TrinidadAndTobago,
00940 Tunisia, Turkey, TurksAndCaicosIslands, Tuvalu, Uganda, Ukraine,
00941 UnitedArabEmirates, UnitedKingdom, UnitedStates, BurkinaFaso, Uruguay,
00942 USSR, Vanuatu, VaticanCityState, Venezuela, VietNam, WallisAndFutuna,
00943 WesternSamoa, Yemen, Yemen2, Yugoslavia, Zaire, Zambia, Zimbabwe,
00944 NumCountryCodes,
00945 UnknownCountry = -1
00946 };
00947
00950 T35CountryCodes GetCountryCode() const { return countryCode; }
00951
00954 PString GetCountryCodeName() const;
00955
00958 static PString GetCountryCodeName(T35CountryCodes code);
00959 static T35CountryCodes GetCountryCode(const PString & name);
00960
00966 virtual BOOL SetCountryCode(
00967 T35CountryCodes country
00968 );
00969
00972 virtual BOOL SetCountryCodeName(
00973 const PString & countryName
00974 );
00975
00978 virtual PStringList GetCountryCodeNameList() const;
00979
00980
00983 virtual BOOL PlayAudio(
00984 unsigned line,
00985 const PString & filename
00986 );
00987
00990 virtual BOOL StopAudio(
00991 unsigned line
00992 );
00993
00994
00998 virtual BOOL RecordAudioStart(
00999 unsigned line,
01000 const PString & filename
01001 );
01002
01007 virtual BOOL RecordAudioStop(
01008 unsigned line
01009 );
01010
01011
01014 int GetErrorNumber() const { return osError; }
01015
01018 PString GetErrorText() const;
01019
01020 virtual void PrintOn(
01021 ostream & strm
01022 ) const;
01023
01026 static OpalLineInterfaceDevice * Create(
01027 const PString & type,
01028 void * parameters = NULL
01029 );
01030
01033 static PStringList GetAllTypes();
01034
01039 static PStringList GetAllDevices();
01040
01041
01042 protected:
01043 int getOsHandle() const {return os_handle;};
01044 void setOsHandle(int os_handleToSet) {os_handle = os_handleToSet;};
01045
01046 int getOsError() const {return osError;};
01047 void setOsError(int osErrorToSet) {osError = osErrorToSet;};
01048
01049 const PBYTEArray& getReadDeblockingBuffer(){return m_readDeblockingBuffer;};
01050 const PBYTEArray& getWriteDeblockingBuffer(){return m_writeDeblockingBuffer;};
01051 PINDEX getReadDeblockingOffset() const {return m_readDeblockingOffset;};
01052 void setReadDeblockingOffset(PINDEX readDeblockingOffset) {m_readDeblockingOffset = readDeblockingOffset;};
01053
01054 PINDEX getWriteDeblockingOffset() const {return m_writeDeblockingOffset;};
01055 void setWriteDeblockingOffset(PINDEX writeDeblockingOffset) {m_writeDeblockingOffset = writeDeblockingOffset;};
01056
01057 unsigned int getDialToneTimeout() const {return m_uiDialToneTimeout;};
01058 void setDialToneTimeout(unsigned int uiDialToneTimeout) {m_uiDialToneTimeout = uiDialToneTimeout;};
01059
01060 int os_handle;
01061 mutable int osError;
01062 T35CountryCodes countryCode;
01063 PBYTEArray m_readDeblockingBuffer, m_writeDeblockingBuffer;
01064 PINDEX m_readDeblockingOffset, m_writeDeblockingOffset;
01065 unsigned int m_uiDialToneTimeout;
01066 std::vector<bool> m_LineAudioEnabled;
01067 PString m_callProgressTones[NumTones];
01068 #if PTRACING
01069 friend ostream & operator<<(ostream & o, CallProgressTones t);
01070 #endif
01071 };
01072
01073
01074 PLIST(OpalLIDList, OpalLineInterfaceDevice);
01075
01076
01077
01080 class OpalLine : public PObject
01081 {
01082 PCLASSINFO(OpalLine, PObject);
01083 public:
01088 OpalLine(
01089 OpalLineInterfaceDevice & device,
01090 unsigned lineNumber,
01091 const char * description = NULL
01092 );
01094
01101 void PrintOn(
01102 ostream & strm
01103 ) const;
01105
01114 virtual BOOL IsTerminal() { return device.IsLineTerminal(lineNumber); }
01115
01116
01119 virtual BOOL IsPresent(
01120 BOOL force = FALSE
01121 ) { return device.IsLinePresent(lineNumber, force); }
01122
01123
01129 virtual BOOL IsOffHook() { return device.IsLineOffHook(lineNumber); }
01130
01136 virtual BOOL SetOffHook() { return device.SetLineOffHook(lineNumber, TRUE); }
01137
01141 virtual BOOL SetOnHook() { return device.SetLineOffHook(lineNumber, FALSE); }
01142
01146 virtual BOOL HookFlash(
01147 unsigned flashTime = 200
01148 ) { return device.HookFlash(lineNumber, flashTime); }
01149
01152 virtual BOOL HasHookFlash() { return device.HasHookFlash(lineNumber); }
01153
01154
01165 virtual BOOL IsRinging(
01166 DWORD * cadence = NULL
01167 ) { return device.IsLineRinging(lineNumber, cadence); }
01168
01172 virtual unsigned GetRingCount(
01173 DWORD * cadence = NULL
01174 );
01175
01193 virtual BOOL Ring(
01194 PINDEX nCadence,
01195 const unsigned * pattern = NULL,
01196 unsigned frequency = 400
01197 ) { return device.RingLine(lineNumber, nCadence, pattern, frequency); }
01198
01199
01203 virtual BOOL IsDisconnected() { return device.IsLineDisconnected(lineNumber); }
01204
01207 virtual BOOL SetReadFormat(
01208 const OpalMediaFormat & mediaFormat
01209 ) { return device.SetReadFormat(lineNumber, mediaFormat); }
01210
01213 virtual BOOL SetWriteFormat(
01214 const OpalMediaFormat & mediaFormat
01215 ) { return device.SetWriteFormat(lineNumber, mediaFormat); }
01216
01219 virtual OpalMediaFormat GetReadFormat() { return device.GetReadFormat(lineNumber); }
01220
01223 virtual OpalMediaFormat GetWriteFormat() { return device.GetWriteFormat(lineNumber); }
01224
01227 virtual BOOL StopReading() { return device.StopReading(lineNumber); }
01228
01231 virtual BOOL StopWriting() { return device.StopWriting(lineNumber); }
01232
01237 virtual BOOL SetReadFrameSize(
01238 PINDEX frameSize
01239 ) { return device.SetReadFrameSize(lineNumber, frameSize); }
01240
01245 virtual BOOL SetWriteFrameSize(
01246 PINDEX frameSize
01247 ) { return device.SetWriteFrameSize(lineNumber, frameSize); }
01248
01252 virtual PINDEX GetReadFrameSize() { return device.GetReadFrameSize(lineNumber); }
01253
01257 virtual PINDEX GetWriteFrameSize() { return device.GetWriteFrameSize(lineNumber); }
01258
01261 virtual BOOL ReadFrame(
01262 void * buf,
01263 PINDEX & count
01264 ) { return device.ReadFrame(lineNumber, buf, count); }
01265
01268 virtual BOOL WriteFrame(
01269 const void * buf,
01270 PINDEX count,
01271 PINDEX & written
01272 ) { return device.WriteFrame(lineNumber, buf, count, written); }
01273
01277 virtual BOOL ReadBlock(
01278 void * buf,
01279 PINDEX count
01280 ) { return device.ReadBlock(lineNumber, buf, count); }
01281
01284 virtual BOOL WriteBlock(
01285 const void * buf,
01286 PINDEX count
01287 ) { return device.WriteBlock(lineNumber, buf, count); }
01288
01289
01292 virtual unsigned GetAverageSignalLevel(
01293 BOOL playback
01294 ) { return device.GetAverageSignalLevel(lineNumber, playback); }
01295
01296
01299 virtual BOOL EnableAudio(
01300 BOOL enable = TRUE
01301 ) { return device.EnableAudio(lineNumber, enable); }
01302
01305 BOOL DisableAudio() { return EnableAudio(FALSE); }
01306
01309 virtual BOOL IsAudioEnabled() { return device.IsAudioEnabled(lineNumber); }
01310
01311
01316 virtual BOOL SetRecordVolume(
01317 unsigned volume
01318 ) { return device.SetRecordVolume(lineNumber, volume); }
01319
01324 virtual BOOL SetPlayVolume(
01325 unsigned volume
01326 ) { return device.SetPlayVolume(lineNumber, volume); }
01327
01332 virtual BOOL GetRecordVolume(
01333 unsigned & volume
01334 ) { return device.GetRecordVolume(lineNumber, volume); }
01335
01340 virtual BOOL GetPlayVolume(
01341 unsigned & volume
01342 ) { return device.GetPlayVolume(lineNumber, volume); }
01343
01344
01348 virtual OpalLineInterfaceDevice::AECLevels GetAEC() { return device.GetAEC(lineNumber); }
01349
01353 virtual BOOL SetAEC(
01354 OpalLineInterfaceDevice::AECLevels level
01355 ) { return device.SetAEC(lineNumber, level); }
01356
01357
01361 virtual BOOL GetVAD() { return device.GetVAD(lineNumber); }
01362
01366 virtual BOOL SetVAD(
01367 BOOL enable
01368 ) { return device.SetVAD(lineNumber, enable); }
01369
01370
01378 virtual BOOL GetCallerID(
01379 PString & idString,
01380 BOOL full = FALSE
01381 ) { return device.GetCallerID(lineNumber, idString, full); }
01382
01391 virtual BOOL SetCallerID(
01392 const PString & idString
01393 ) { return device.SetCallerID(lineNumber, idString); }
01394
01403 virtual BOOL SendCallerIDOnCallWaiting(
01404 const PString & idString
01405 ) { return device.SendCallerIDOnCallWaiting(lineNumber, idString); }
01406
01409 virtual BOOL SendVisualMessageWaitingIndicator(
01410 BOOL on
01411 ) { return device.SendVisualMessageWaitingIndicator(lineNumber, on); }
01412
01413
01417 virtual BOOL PlayDTMF(
01418 const char * digits,
01419 DWORD onTime = OpalLineInterfaceDevice::DefaultDTMFOnTime,
01420 DWORD offTime = OpalLineInterfaceDevice::DefaultDTMFOffTime
01421 ) { return device.PlayDTMF(lineNumber, digits, onTime, offTime); }
01422
01432 virtual char ReadDTMF() { return device.ReadDTMF(lineNumber); }
01433
01438 virtual BOOL GetRemoveDTMF() { return device.GetRemoveDTMF(lineNumber); }
01439
01444 virtual BOOL SetRemoveDTMF(
01445 BOOL removeTones
01446 ) { return device.SetRemoveDTMF(lineNumber, removeTones); }
01447
01448
01451 virtual unsigned IsToneDetected() { return device.IsToneDetected(lineNumber); }
01452
01455 virtual OpalLineInterfaceDevice::CallProgressTones WaitForToneDetect(
01456 unsigned timeout = 3000
01457 ) { return device.WaitForToneDetect(lineNumber, timeout); }
01458
01461 virtual BOOL WaitForTone(
01462 OpalLineInterfaceDevice::CallProgressTones tone,
01463 unsigned timeout = 3000
01464 ) { return device.WaitForTone(lineNumber, tone, timeout); }
01465
01468 virtual BOOL PlayTone(
01469 OpalLineInterfaceDevice::CallProgressTones tone
01470 ) { return device.PlayTone(lineNumber, tone); }
01471
01474 virtual BOOL IsTonePlaying() { return device.IsTonePlaying(lineNumber); }
01475
01478 virtual BOOL StopTone() { return device.StopTone(lineNumber); }
01479
01480
01496 virtual OpalLineInterfaceDevice::CallProgressTones DialOut(
01497 const PString & number,
01498 BOOL requireTones = FALSE,
01499 unsigned uiDialDelay = 0
01500 ) { return device.DialOut(lineNumber, number, requireTones, uiDialDelay); }
01502
01507 OpalLineInterfaceDevice & GetDevice() const { return device; }
01508
01511 unsigned GetLineNumber() const { return lineNumber; }
01512
01515 PString GetToken() const { return token; }
01516
01519 PString GetDescription() const { return description; }
01521
01522 protected:
01523 OpalLineInterfaceDevice & device;
01524 unsigned lineNumber;
01525 PString token;
01526 PString description;
01527 unsigned ringCount;
01528 PTimeInterval ringTick;
01529 PTimeInterval ringStoppedTime;
01530 PTimeInterval ringInterCadenceTime;
01531 };
01532
01533
01534 PLIST(OpalLineList, OpalLine);
01535
01536
01543 class OpalLIDRegistration : public PCaselessString
01544 {
01545 PCLASSINFO(OpalLIDRegistration, PCaselessString);
01546 public:
01551 OpalLIDRegistration(
01552 const char * name
01553 );
01554
01557 ~OpalLIDRegistration();
01559
01564 virtual OpalLineInterfaceDevice * Create(
01565 void * parameters
01566 ) const = 0;
01568
01569 protected:
01570 OpalLIDRegistration * link;
01571 bool duplicate;
01572
01573 friend class OpalLineInterfaceDevice;
01574 };
01575
01576
01577 #define OPAL_REGISTER_LID_FUNCTION(cls, type, param) \
01578 static class cls##_Registration : public OpalLIDRegistration { \
01579 public: \
01580 cls##_Registration() : OpalLIDRegistration(type) { } \
01581 OpalLineInterfaceDevice * Create(void * param) const; \
01582 } instance_##cls##_Registration; \
01583 OpalLineInterfaceDevice * cls##_Registration::Create(void * param) const
01584
01585 #ifndef OPAL_NO_PARAM
01586 #define OPAL_NO_PARAM
01587 #endif
01588
01589 #define OPAL_REGISTER_LID(cls, type) \
01590 OPAL_REGISTER_LID_FUNCTION(cls, type, OPAL_NO_PARAM) \
01591 { return new cls; }
01592
01593 #define OPAL_REGISTER_LID_PARAM(cls, type) \
01594 OPAL_REGISTER_LID_FUNCTION(cls, type, parameter) \
01595 { return new cls(parameter); }
01596
01597
01598 #endif // __OPAL_LID_H
01599
01600
01601