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-2000 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  * $Log: lid.h,v $
00030  * Revision 1.58  2005/11/30 13:05:01  csoutheren
00031  * Changed tags for Doxygen
00032  *
00033  * Revision 1.57  2005/07/03 13:59:43  shorne
00034  * Add LID type identifier (for Plugin LID support)
00035  *
00036  * Revision 1.56  2003/04/29 08:29:13  robertj
00037  * Cleaned up documentation for new wink duration functions.
00038  *
00039  * Revision 1.55  2003/04/28 01:47:52  dereks
00040  * Add ability to set/get wink duration for ixj device.
00041  *
00042  * Revision 1.54  2003/03/05 06:26:40  robertj
00043  * Added function to play a WAV file to LID, thanks Pietro Ravasio
00044  *
00045  * Revision 1.53  2002/11/05 04:26:48  robertj
00046  * Imported RingLine() by array from OPAL.
00047  *
00048  * Revision 1.52  2002/10/29 00:46:04  dereks
00049  * Fix typo in comments.
00050  *
00051  * Revision 1.51  2002/09/16 01:14:15  robertj
00052  * Added #define so can select if #pragma interface/implementation is used on
00053  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00054  *
00055  * Revision 1.50  2002/09/03 06:19:37  robertj
00056  * Normalised the multi-include header prevention ifdef/define symbol.
00057  *
00058  * Revision 1.49  2002/08/05 10:03:47  robertj
00059  * Cosmetic changes to normalise the usage of pragma interface/implementation.
00060  *
00061  * Revision 1.48  2002/06/27 08:52:53  robertj
00062  * Fixed typo and naming convention for Cisco G.723.1 annex A capability.
00063  *
00064  * Revision 1.47  2002/06/26 05:45:41  robertj
00065  * Added capability for Cisco IOS non-standard name for G.723.1 Annex A so
00066  *   can now utilise SID frames with Cisco gateways.
00067  *
00068  * Revision 1.46  2002/06/25 08:30:08  robertj
00069  * Changes to differentiate between stright G.723.1 and G.723.1 Annex A using
00070  *   the OLC dataType silenceSuppression field so does not send SID frames
00071  *   to receiver codecs that do not understand them.
00072  *
00073  * Revision 1.45  2002/05/09 06:26:30  robertj
00074  * Added fuction to get the current audio enable state for line in device.
00075  * Changed IxJ EnableAudio() semantics so is exclusive, no direct switching
00076  *   from PSTN to POTS and vice versa without disabling the old one first.
00077  *
00078  * Revision 1.44  2002/01/23 01:58:25  robertj
00079  * Added function to determine if codecs raw data channel is native format.
00080  *
00081  * Revision 1.43  2001/07/19 05:54:27  robertj
00082  * Updated interface to xJACK drivers to utilise cadence and filter functions
00083  *   for dial tone, busy tone and ringback tone detection.
00084  *
00085  * Revision 1.42  2001/05/22 00:31:41  robertj
00086  * Changed to allow optional wink detection for line disconnect
00087  *
00088  * Revision 1.41  2001/03/29 23:42:34  robertj
00089  * Added ability to get average signal level for both receive and transmit.
00090  * Changed silence detection to use G.723.1 SID frames as indicator of
00091  *   silence instead of using the average energy and adaptive threshold.
00092  *
00093  * Revision 1.40  2001/02/13 05:02:39  craigs
00094  * Extended PlayDTMF to allow generation of additional simple tones
00095  *
00096  * Revision 1.39  2001/02/09 05:16:24  robertj
00097  * Added #pragma interface for GNU C++.
00098  *
00099  * Revision 1.38  2001/01/25 07:27:14  robertj
00100  * Major changes to add more flexible OpalMediaFormat class to normalise
00101  *   all information about media types, especially codecs.
00102  *
00103  * Revision 1.37  2001/01/24 05:34:49  robertj
00104  * Altered volume control range to be percentage, ie 100 is max volume.
00105  *
00106  * Revision 1.36  2001/01/11 05:39:44  robertj
00107  * Fixed usage of G.723.1 CNG 1 byte frames.
00108  *
00109  * Revision 1.35  2000/12/19 06:38:57  robertj
00110  * Fixed missing virtual on IsTonePlaying() function.
00111  *
00112  * Revision 1.34  2000/12/17 22:08:20  craigs
00113  * Changed GetCountryCodeList to return PStringList
00114  *
00115  * Revision 1.33  2000/12/11 01:23:32  craigs
00116  * Added extra routines to allow country string manipulation
00117  *
00118  * Revision 1.32  2000/11/30 08:48:35  robertj
00119  * Added functions to enable/disable Voice Activity Detection in LID's
00120  *
00121  * Revision 1.31  2000/11/26 23:12:18  craigs
00122  * Added hook flash detection API
00123  *
00124  * Revision 1.30  2000/11/24 10:46:12  robertj
00125  * Added a raw PCM dta mode for generating/detecting standard tones.
00126  * Modified the ReadFrame/WriteFrame functions to allow for variable length codecs.
00127  *
00128  * Revision 1.29  2000/11/20 03:15:13  craigs
00129  * Changed tone detection API slightly to allow detection of multiple
00130  * simultaneous tones
00131  * Added fax CNG tone to tone list
00132  *
00133  * Revision 1.28  2000/11/06 02:00:18  eokerson
00134  * Added support for AGC on ixj devices under Linux.
00135  *
00136  * Revision 1.27  2000/11/03 06:22:48  robertj
00137  * Added flag to IsLinePresent() to force slow test, guarenteeing correct value.
00138  *
00139  * Revision 1.26  2000/10/13 02:24:06  robertj
00140  * Moved frame reblocking code from LID channel to LID itself and added
00141  *    ReadBlock/WriteBlock functions to allow non integral frame sizes.
00142  *
00143  * Revision 1.25  2000/09/25 22:31:19  craigs
00144  * Added G.723.1 frame erasure capability
00145  *
00146  * Revision 1.24  2000/09/23 07:20:28  robertj
00147  * Fixed problem with being able to distinguish between sw and hw codecs in LID channel.
00148  *
00149  * Revision 1.23  2000/09/22 01:35:03  robertj
00150  * Added support for handling LID's that only do symmetric codecs.
00151  *
00152  * Revision 1.22  2000/08/31 13:14:40  craigs
00153  * Added functions to LID
00154  * More bulletproofing to Linux driver
00155  *
00156  * Revision 1.21  2000/08/30 23:24:24  robertj
00157  * Renamed string version of SetCountrCode() to SetCountryCodeName() to avoid
00158  *    C++ masking ancestor overloaded function when overriding numeric version.
00159  *
00160  * Revision 1.20  2000/08/18 04:17:48  robertj
00161  * Added Auto setting to AEC enum.
00162  *
00163  * Revision 1.19  2000/06/19 00:32:13  robertj
00164  * Changed functionf or adding all lid capabilities to not assume it is to an endpoint.
00165  *
00166  * Revision 1.18  2000/06/01 07:52:19  robertj
00167  * Changed some LID capability code back again so does not unneedfully break existing API.
00168  *
00169  * Revision 1.17  2000/05/30 10:19:17  robertj
00170  * Added function to add capabilities given a LID.
00171  * Improved LID capabilities so cannot create one that is not explicitly supported.
00172  *
00173  * Revision 1.16  2000/05/24 06:42:18  craigs
00174  * Added calls to get volume settings
00175  *
00176  * Revision 1.15  2000/05/10 04:05:26  robertj
00177  * Changed capabilities so has a function to get name of codec, instead of relying on PrintOn.
00178  *
00179  * Revision 1.14  2000/05/02 04:32:24  robertj
00180  * Fixed copyright notice comment.
00181  *
00182  * Revision 1.13  2000/04/14 17:18:25  robertj
00183  * Fixed problem with error reporting from LID hardware.
00184  *
00185  * Revision 1.12  2000/04/10 17:44:52  robertj
00186  * Added higher level "DialOut" function for PSTN lines.
00187  * Added hook flash function.
00188  *
00189  * Revision 1.11  2000/04/05 18:04:12  robertj
00190  * Changed caller ID code for better portability.
00191  *
00192  * Revision 1.10  2000/03/30 23:10:50  robertj
00193  * Fixed error in comments regarding GetFramerate() function.
00194  *
00195  * Revision 1.9  2000/03/29 20:54:19  robertj
00196  * Added function on LID to get available codecs.
00197  * Changed codec to use number of frames rather than number of bytes.
00198  *
00199  * Revision 1.8  2000/03/23 23:36:48  robertj
00200  * Added more calling tone detection functionality.
00201  *
00202  * Revision 1.7  2000/03/23 02:43:15  robertj
00203  * Fixed default DTMF timing.
00204  *
00205  * Revision 1.6  2000/03/22 17:18:49  robertj
00206  * Changed default DTMF tone string times.
00207  *
00208  * Revision 1.5  2000/03/21 03:06:48  robertj
00209  * Changes to make RTP TX of exact numbers of frames in some codecs.
00210  *
00211  * Revision 1.4  2000/01/13 12:39:29  robertj
00212  * Added string based country codes to LID.
00213  *
00214  * Revision 1.3  2000/01/13 04:03:45  robertj
00215  * Added video transmission
00216  *
00217  * Revision 1.2  2000/01/07 08:28:09  robertj
00218  * Additions and changes to line interface device base class.
00219  *
00220  * Revision 1.1  1999/12/23 23:02:35  robertj
00221  * File reorganision for separating RTP from H.323 and creation of LID for VPB support.
00222  *
00223  */
00224 
00225 #ifndef __OPAL_LID_H
00226 #define __OPAL_LID_H
00227 
00228 #ifdef P_USE_PRAGMA
00229 #pragma interface
00230 #endif
00231 
00232 
00233 #include "codecs.h"
00234 #include "h323caps.h"
00235 
00236 
00238 
00242 class OpalLineInterfaceDevice : public PObject
00243 {
00244   PCLASSINFO(OpalLineInterfaceDevice, PObject);
00245 
00246   public:
00249     OpalLineInterfaceDevice();
00250 
00253     virtual BOOL Open(
00254       const PString & device      
00255     ) = 0;
00256 
00259     virtual BOOL IsOpen() const;
00260 
00263     virtual BOOL Close();
00264 
00270     virtual PString GetName() const = 0;
00271 
00274     virtual unsigned GetLineCount() = 0;
00275 
00282     virtual BOOL IsLineTerminal(
00283       unsigned line   
00284     );
00285 
00286 
00289     virtual BOOL IsLinePresent(
00290       unsigned line,      
00291       BOOL force = FALSE  
00292     );
00293 
00294 
00300     virtual BOOL IsLineOffHook(
00301       unsigned line   
00302     ) = 0;
00303 
00309     virtual BOOL SetLineOffHook(
00310       unsigned line,        
00311       BOOL newState = TRUE  
00312     ) = 0;
00313 
00317     virtual BOOL SetLineOnHook(
00318       unsigned line        
00319     ) { return SetLineOffHook(line, FALSE); }
00320 
00324     virtual BOOL HookFlash(
00325       unsigned line,              
00326       unsigned flashTime = 200    
00327     );
00328 
00331     virtual BOOL HasHookFlash(unsigned line);
00332 
00333 
00344     virtual BOOL IsLineRinging(
00345       unsigned line,          
00346       DWORD * cadence = NULL  
00347     );
00348 
00359     virtual BOOL RingLine(
00360       unsigned line,    
00361       DWORD cadence     
00362     );
00363 
00378     virtual BOOL RingLine(
00379       unsigned line,     
00380       PINDEX nCadence,   
00381       unsigned * pattern 
00382     );
00383 
00384 
00388     virtual BOOL IsLineDisconnected(
00389       unsigned line,   
00390       BOOL checkForWink = TRUE
00391     );
00392 
00393 
00396     virtual BOOL SetLineToLineDirect(
00397       unsigned line1,   
00398       unsigned line2,   
00399       BOOL connect      
00400     );
00401 
00404     virtual BOOL IsLineToLineDirect(
00405       unsigned line1,   
00406       unsigned line2    
00407     );
00408 
00409 
00412     virtual OpalMediaFormat::List GetMediaFormats() const = 0;
00413 
00416     virtual BOOL SetReadFormat(
00417       unsigned line,    
00418       const OpalMediaFormat & mediaFormat   
00419     ) = 0;
00420 
00423     virtual BOOL SetWriteFormat(
00424       unsigned line,    
00425       const OpalMediaFormat & mediaFormat   
00426     ) = 0;
00427 
00430     virtual OpalMediaFormat GetReadFormat(
00431       unsigned line    
00432     ) = 0;
00433 
00436     virtual OpalMediaFormat GetWriteFormat(
00437       unsigned line    
00438     ) = 0;
00439 
00448     virtual BOOL SetReadCodec(
00449       unsigned line,    
00450       RTP_DataFrame::PayloadTypes codec   
00451     );
00452 
00458     virtual BOOL SetWriteCodec(
00459       unsigned line,    
00460       RTP_DataFrame::PayloadTypes codec   
00461     );
00462 
00473     virtual BOOL SetRawCodec(
00474       unsigned line    
00475     );
00476 
00479     virtual BOOL StopReadCodec(
00480       unsigned line   
00481     );
00482 
00485     virtual BOOL StopWriteCodec(
00486       unsigned line   
00487     );
00488 
00491     virtual BOOL StopRawCodec(
00492       unsigned line   
00493     );
00494 
00499     virtual BOOL SetReadFrameSize(
00500       unsigned line,    
00501       PINDEX frameSize  
00502     );
00503 
00508     virtual BOOL SetWriteFrameSize(
00509       unsigned line,    
00510       PINDEX frameSize  
00511     );
00512 
00516     virtual PINDEX GetReadFrameSize(
00517       unsigned line   
00518     ) = 0;
00519 
00523     virtual PINDEX GetWriteFrameSize(
00524       unsigned line   
00525     ) = 0;
00526 
00529     virtual BOOL ReadFrame(
00530       unsigned line,    
00531       void * buf,       
00532       PINDEX & count    
00533     ) = 0;
00534 
00537     virtual BOOL WriteFrame(
00538       unsigned line,    
00539       const void * buf, 
00540       PINDEX count,     
00541       PINDEX & written  
00542     ) = 0;
00543 
00547     virtual BOOL ReadBlock(
00548       unsigned line,    
00549       void * buf,   
00550       PINDEX count  
00551     );
00552 
00555     virtual BOOL WriteBlock(
00556       unsigned line,    
00557       const void * buf, 
00558       PINDEX count      
00559     );
00560 
00561 
00564     virtual unsigned GetAverageSignalLevel(
00565       unsigned line,  
00566       BOOL playback   
00567     );
00568 
00569 
00572     virtual BOOL EnableAudio(
00573       unsigned line,      
00574       BOOL enable = TRUE
00575     );
00576 
00579     BOOL DisableAudio(
00580       unsigned line   
00581     ) { return EnableAudio(line, FALSE); }
00582 
00585     virtual BOOL IsAudioEnabled(
00586       unsigned line      
00587     );
00588 
00589 
00590     enum {
00591       MaxVolume = 100
00592     };
00593 
00598     virtual BOOL SetRecordVolume(
00599       unsigned line,    
00600       unsigned volume   
00601     );
00602 
00607     virtual BOOL SetPlayVolume(
00608       unsigned line,    
00609       unsigned volume   
00610     );
00611 
00616     virtual BOOL GetRecordVolume(
00617       unsigned line,      
00618       unsigned & volume   
00619     );
00620 
00625     virtual BOOL GetPlayVolume(
00626       unsigned line,      
00627       unsigned & volume   
00628     );
00629 
00630 
00631     enum AECLevels {
00632       AECOff,
00633       AECLow,
00634       AECMedium,
00635       AECHigh,
00636       AECAuto,
00637       AECAGC,
00638       AECError
00639     };
00640 
00644     virtual AECLevels GetAEC(
00645       unsigned line    
00646     );
00647 
00651     virtual BOOL SetAEC(
00652       unsigned line,    
00653       AECLevels level   
00654     );
00655 
00659     virtual unsigned GetWinkDuration(
00660       unsigned line    
00661     );
00662 
00666     virtual BOOL SetWinkDuration(
00667       unsigned line,        
00668       unsigned winkDuration 
00669     );
00670 
00674     virtual BOOL GetVAD(
00675       unsigned line    
00676     );
00677 
00681     virtual BOOL SetVAD(
00682       unsigned line,    
00683       BOOL enable       
00684     );
00685 
00686 
00694     virtual BOOL GetCallerID(
00695       unsigned line,      
00696       PString & idString, 
00697       BOOL full = FALSE   
00698     );
00699 
00708     virtual BOOL SetCallerID(
00709       unsigned line,            
00710       const PString & idString  
00711     );
00712 
00721     virtual BOOL SendCallerIDOnCallWaiting(
00722       unsigned line,            
00723       const PString & idString  
00724     );
00725 
00728     virtual BOOL SendVisualMessageWaitingIndicator(
00729       unsigned line,            
00730       BOOL on
00731     );
00732 
00733 
00734     enum {
00735       DefaultDTMFOnTime = 180,
00736       DefaultDTMFOffTime = 120
00737     };
00738 
00742     virtual BOOL PlayDTMF(
00743       unsigned line,            
00744       const char * digits,      
00745       DWORD onTime = DefaultDTMFOnTime,  
00746       DWORD offTime = DefaultDTMFOffTime 
00747     );
00748 
00758     virtual char ReadDTMF(
00759       unsigned line   
00760     );
00761 
00766     virtual BOOL GetRemoveDTMF(
00767       unsigned line   
00768     );
00769 
00774     virtual BOOL SetRemoveDTMF(
00775       unsigned line,     
00776       BOOL removeTones   
00777     );
00778 
00779 
00780     enum CallProgressTones {
00781       NoTone    = 0x00,   // indicates no tones
00782       DialTone  = 0x01,   // Dial tone
00783       RingTone  = 0x02,   // Ring indication tone
00784       BusyTone  = 0x04,   // Line engaged tone
00785       ClearTone = 0x08,   // Call failed/cleared tone (often same as busy tone)
00786       CNGTone   = 0x10,   // Fax CNG tone
00787       AllTones  = 0x1f
00788     };
00789 
00792     virtual unsigned IsToneDetected(
00793       unsigned line   
00794     );
00795 
00798     virtual unsigned WaitForToneDetect(
00799       unsigned line,          
00800       unsigned timeout = 3000 
00801     );
00802 
00805     virtual BOOL WaitForTone(
00806       unsigned line,          
00807       CallProgressTones tone, 
00808       unsigned timeout = 3000 
00809     );
00810 
00828     virtual BOOL SetToneFilter(
00829       unsigned line,              
00830       CallProgressTones tone,     
00831       const PString & description 
00832     );
00833 
00836     virtual BOOL SetToneFilterParameters(
00837       unsigned line,            
00838       CallProgressTones tone,   
00839       unsigned lowFrequency,    
00840       unsigned highFrequency,   
00841       PINDEX numCadences,       
00842       const unsigned * onTimes, 
00843       const unsigned * offTimes 
00844     );
00845 
00848     virtual BOOL PlayTone(
00849       unsigned line,          
00850       CallProgressTones tone  
00851     );
00852 
00855     virtual BOOL IsTonePlaying(
00856       unsigned line   
00857     );
00858 
00861     virtual BOOL StopTone(
00862       unsigned line   
00863     );
00864 
00867     virtual BOOL PlayAudio(
00868       unsigned line,            
00869       const PString & filename  
00870     );
00871     
00874     virtual BOOL StopAudio(
00875       unsigned line   
00876     );
00877 
00878 
00894     virtual CallProgressTones DialOut(
00895       unsigned line,                
00896       const PString & number,       
00897       BOOL requireTones = FALSE     
00898     );
00899 
00900 
00901     enum T35CountryCodes {
00902       Japan, Albania, Algeria, AmericanSamoa, Germany, Anguilla, AntiguaAndBarbuda,
00903       Argentina, Ascension, Australia, Austria, Bahamas, Bahrain, Bangladesh,
00904       Barbados, Belgium, Belize, Benin, Bermudas, Bhutan, Bolivia, Botswana,
00905       Brazil, BritishAntarcticTerritory, BritishIndianOceanTerritory, 
00906       BritishVirginIslands, BruneiDarussalam, Bulgaria, Myanmar, Burundi,
00907       Byelorussia, Cameroon, Canada, CapeVerde, CaymanIslands,
00908       CentralAfricanRepublic, Chad, Chile, China, Colombia, Comoros, Congo,
00909       CookIslands, CostaRica, Cuba, Cyprus, Czechoslovakia, Cambodia,
00910       DemocraticPeoplesRepublicOfKorea, Denmark, Djibouti, DominicanRepublic,
00911       Dominica, Ecuador, Egypt, ElSalvador, EquatorialGuinea, Ethiopia,
00912       FalklandIslands, Fiji, Finland, France, FrenchPolynesia,
00913       FrenchSouthernAndAntarcticLands, Gabon, Gambia, Germany2, Angola, Ghana,
00914       Gibraltar, Greece, Grenada, Guam, Guatemala, Guernsey, Guinea, GuineaBissau,
00915       Guayana, Haiti, Honduras, Hongkong, Hungary, Iceland, India, Indonesia,
00916       Iran, Iraq, Ireland, Israel, Italy, CotedIvoire, Jamaica, Afghanistan,
00917       Jersey, Jordan, Kenya, Kiribati, KoreaRepublic, Kuwait, Lao, Lebanon,
00918       Lesotho, Liberia, Libya, Liechtenstein, Luxemborg, Macao, Madagascar,
00919       Malaysia, Malawi, Maldives, Mali, Malta, Mauritania, Mauritius, Mexico,
00920       Monaco, Mongolia, Montserrat, Morocco, Mozambique, Nauru, Nepal,
00921       Netherlands, NetherlandsAntilles, NewCaledonia, NewZealand, Nicaragua,
00922       Niger, Nigeria, Norway, Oman, Pakistan, Panama, PapuaNewGuinea, Paraguay,
00923       Peru, Philippines, Poland, Portugal, PuertoRico, Qatar, Romania, Rwanda,
00924       SaintKittsAndNevis, SaintCroix, SaintHelenaAndAscension, SaintLucia,
00925       SanMarino, SaintThomas, SaoTomeAndPrincipe, SaintVicentAndTheGrenadines,
00926       SaudiArabia, Senegal, Seychelles, SierraLeone, Singapore, SolomonIslands,
00927       Somalia, SouthAfrica, Spain, SriLanka, Sudan, Suriname, Swaziland, Sweden,
00928       Switzerland, Syria, Tanzania, Thailand, Togo, Tonga, TrinidadAndTobago,
00929       Tunisia, Turkey, TurksAndCaicosIslands, Tuvalu, Uganda, Ukraine,
00930       UnitedArabEmirates, UnitedKingdom, UnitedStates, BurkinaFaso, Uruguay,
00931       USSR, Vanuatu, VaticanCityState, Venezuela, VietNam, WallisAndFutuna,
00932       WesternSamoa, Yemen, Yemen2, Yugoslavia, Zaire, Zambia, Zimbabwe,
00933       NumCountryCodes,
00934       UnknownCountry = -1
00935     };
00936 
00939     T35CountryCodes GetCountryCode() const { return countryCode; }
00940 
00943     PString GetCountryCodeName() const;
00944 
00947     static PString GetCountryCodeName(T35CountryCodes code);
00948     static T35CountryCodes GetCountryCode(const PString & name);
00949 
00955     virtual BOOL SetCountryCode(
00956       T35CountryCodes country   
00957     );
00958 
00961     virtual BOOL SetCountryCodeName(
00962       const PString & countryName   
00963     );
00964 
00967     virtual PStringList GetCountryCodeNameList() const;
00968 
00969 
00972     int GetErrorNumber() const { return osError; }
00973 
00976     PString GetErrorText() const;
00977 
00978     virtual void PrintOn(
00979       ostream & strm
00980     ) const;
00981 
00984         enum DeviceType{
00985                 POTSLine,          // Behaves as a normal Phone 
00986                 Gateway,                   // Behaves as a gateway
00987                 CellEmulate                // Behaves as like a CellPhone
00988                 
00989         };
00990 
00993         virtual OpalLineInterfaceDevice::DeviceType GetDeviceType() { return POTSLine; };
00994 
00995   protected:
00996     int             os_handle;
00997     int             osError;
00998     T35CountryCodes countryCode;
00999     PBYTEArray      readDeblockingBuffer, writeDeblockingBuffer;
01000     PINDEX          readDeblockingOffset, writeDeblockingOffset;
01001 
01002 #if PTRACING
01003     friend ostream & operator<<(ostream & o, CallProgressTones t);
01004 #endif
01005 };
01006 
01007 
01010 class OpalLineChannel : public PChannel
01011 {
01012   PCLASSINFO(OpalLineChannel, PChannel);
01013 
01014   public:
01017     OpalLineChannel(
01018       OpalLineInterfaceDevice & device, 
01019       unsigned line,                    
01020       const H323AudioCodec & codec      
01021     );
01022     ~OpalLineChannel();
01023 
01026     PString GetName() const;
01027 
01030     BOOL Close();
01031 
01044     virtual BOOL Read(
01045       void * buf,   
01046       PINDEX len    
01047     );
01048 
01060     virtual BOOL Write(
01061       const void * buf, 
01062       PINDEX len        
01063     );
01064 
01065 
01068     OpalLineInterfaceDevice & GetDevice() const { return device; }
01069 
01072     unsigned GetLineNumber() const { return lineNumber; }
01073 
01074 
01075   protected:
01076     OpalLineInterfaceDevice &   device;
01077     unsigned                    lineNumber;
01078     BOOL                        reading;
01079     BOOL                        useDeblocking;
01080 };
01081 
01082 
01083 
01084 
01085 
01088 class H323_LIDCapability : public H323AudioCapability
01089 {
01090   PCLASSINFO(H323_LIDCapability, H323AudioCapability);
01091 
01092   public:
01097     H323_LIDCapability(
01098       const OpalMediaFormat & mediaFormat   
01099     );
01101 
01106     Comparison Compare(const PObject & obj) const;
01107 
01110     virtual PObject * Clone() const;
01111 
01114     virtual PString GetFormatName() const;
01116 
01124     virtual unsigned GetSubType() const;
01126 
01131     virtual H323Codec * CreateCodec(
01132       H323Codec::Direction direction  
01133     ) const;
01134 
01137     BOOL IsValid() const;
01138 
01141     static void AddAllCapabilities(
01142       const OpalLineInterfaceDevice & device, 
01143       H323Capabilities & capabilities,        
01144       PINDEX descriptorNum,   
01145       PINDEX simultaneous     
01146     );
01148 
01158     virtual BOOL OnSendingPDU(
01159       H245_AudioCapability & pdu,  
01160       unsigned packetSize          
01161     ) const;
01162 
01170     virtual BOOL OnReceivedPDU(
01171       const H245_AudioCapability & pdu,  
01172       unsigned & packetSize              
01173     );
01175 
01176   protected:
01177     OpalMediaFormat mediaFormat;
01178     PINDEX codecTableIndex;
01179 };
01180 
01181 
01184 class H323_CiscoG7231aLIDCapability : public H323NonStandardAudioCapability
01185 {
01186   PCLASSINFO(H323_CiscoG7231aLIDCapability, H323NonStandardAudioCapability);
01187 
01188   public:
01193     H323_CiscoG7231aLIDCapability();
01195 
01200     virtual PObject * Clone() const;
01202 
01207     virtual H323Codec * CreateCodec(
01208       H323Codec::Direction direction  
01209     ) const;
01211 
01216     virtual PString GetFormatName() const;
01218 };
01219 
01220 
01224 class H323_LIDCodec : public H323AudioCodec
01225 {
01226   PCLASSINFO(H323_LIDCodec, H323AudioCodec);
01227 
01228   public:
01231     H323_LIDCodec(
01232       const char * mediaFormat,   
01233       Direction direction,        
01234       unsigned numFrames,         
01235       PINDEX codecTableIndex      
01236     );
01237 
01254     virtual BOOL Read(
01255       BYTE * buffer,            
01256       unsigned & length,        
01257       RTP_DataFrame & rtpFrame  
01258     );
01259 
01272     virtual BOOL Write(
01273       const BYTE * buffer,          
01274       unsigned length,              
01275       const RTP_DataFrame & frame,  
01276       unsigned & written            
01277     );
01278 
01285     virtual BOOL IsRawDataChannelNative() const;
01286 
01293     virtual BOOL DetectSilence();
01294 
01299     virtual unsigned GetAverageSignalLevel();
01300 
01301 
01302     PINDEX GetCodecTableIndex() const { return codecTableIndex; }
01303 
01304   protected:
01305     PINDEX codecTableIndex;
01306     unsigned packetSize;
01307     unsigned missedCount;
01308     BYTE     lastSID[4];
01309     BOOL     lastFrameWasSignal;
01310 };
01311 
01312 
01313 #endif // __OPAL_LID_H
01314 
01315 
01316 // End of File ///////////////////////////////////////////////////////////////

Generated on Fri Nov 17 03:03:32 2006 for OpenH323 by  doxygen 1.5.1