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  * $Log: lid.h,v $
00030  * Revision 2.11  2005/11/30 13:35:26  csoutheren
00031  * Changed tags for Doxygen
00032  *
00033  * Revision 2.10  2004/10/06 13:03:41  rjongbloed
00034  * Added "configure" support for known LIDs
00035  * Changed LID GetName() function to be normalised against the GetAllNames()
00036  *   return values and fixed the pre-factory registration system.
00037  * Added a GetDescription() function to do what the previous GetName() did.
00038  *
00039  * Revision 2.9  2004/02/19 10:46:44  rjongbloed
00040  * Merged OpenH323 version 1.13.1 changes.
00041  *
00042  * Revision 2.8  2003/03/24 07:18:29  robertj
00043  * Added registration system for LIDs so can work with various LID types by
00044  *   name instead of class instance.
00045  *
00046  * Revision 2.7  2002/11/10 11:33:17  robertj
00047  * Updated to OpenH323 v1.10.3
00048  *
00049  * Revision 2.6  2002/09/16 02:52:34  robertj
00050  * Added #define so can select if #pragma interface/implementation is used on
00051  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00052  *
00053  * Revision 2.5  2002/09/04 06:01:47  robertj
00054  * Updated to OpenH323 v1.9.6
00055  *
00056  * Revision 2.4  2002/07/01 04:56:30  robertj
00057  * Updated to OpenH323 v1.9.1
00058  *
00059  * Revision 2.3  2002/02/11 09:32:12  robertj
00060  * Updated to openH323 v1.8.0
00061  *
00062  * Revision 2.2  2001/08/17 01:10:48  robertj
00063  * Added ability to add whole LID's to LID endpoint.
00064  *
00065  * Revision 2.1  2001/08/01 05:18:51  robertj
00066  * Made OpalMediaFormatList class global to help with documentation.
00067  *
00068  * Revision 2.0  2001/07/27 15:48:24  robertj
00069  * Conversion of OpenH323 to Open Phone Abstraction Library (OPAL)
00070  *
00071  * Revision 1.56  2003/04/29 08:29:13  robertj
00072  * Cleaned up documentation for new wink duration functions.
00073  *
00074  * Revision 1.55  2003/04/28 01:47:52  dereks
00075  * Add ability to set/get wink duration for ixj device.
00076  *
00077  * Revision 1.54  2003/03/05 06:26:40  robertj
00078  * Added function to play a WAV file to LID, thanks Pietro Ravasio
00079  *
00080  * Revision 1.53  2002/11/05 04:26:48  robertj
00081  * Imported RingLine() by array from OPAL.
00082  *
00083  * Revision 1.52  2002/10/29 00:46:04  dereks
00084  * Fix typo in comments.
00085  *
00086  * Revision 1.51  2002/09/16 01:14:15  robertj
00087  * Added #define so can select if #pragma interface/implementation is used on
00088  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00089  *
00090  * Revision 1.50  2002/09/03 06:19:37  robertj
00091  * Normalised the multi-include header prevention ifdef/define symbol.
00092  *
00093  * Revision 1.49  2002/08/05 10:03:47  robertj
00094  * Cosmetic changes to normalise the usage of pragma interface/implementation.
00095  *
00096  * Revision 1.48  2002/06/27 08:52:53  robertj
00097  * Fixed typo and naming convention for Cisco G.723.1 annex A capability.
00098  *
00099  * Revision 1.47  2002/06/26 05:45:41  robertj
00100  * Added capability for Cisco IOS non-standard name for G.723.1 Annex A so
00101  *   can now utilise SID frames with Cisco gateways.
00102  *
00103  * Revision 1.46  2002/06/25 08:30:08  robertj
00104  * Changes to differentiate between stright G.723.1 and G.723.1 Annex A using
00105  *   the OLC dataType silenceSuppression field so does not send SID frames
00106  *   to receiver codecs that do not understand them.
00107  *
00108  * Revision 1.45  2002/05/09 06:26:30  robertj
00109  * Added fuction to get the current audio enable state for line in device.
00110  * Changed IxJ EnableAudio() semantics so is exclusive, no direct switching
00111  *   from PSTN to POTS and vice versa without disabling the old one first.
00112  *
00113  * Revision 1.44  2002/01/23 01:58:25  robertj
00114  * Added function to determine if codecs raw data channel is native format.
00115  *
00116  * Revision 1.43  2001/07/19 05:54:27  robertj
00117  * Updated interface to xJACK drivers to utilise cadence and filter functions
00118  *   for dial tone, busy tone and ringback tone detection.
00119  *
00120  * Revision 1.42  2001/05/22 00:31:41  robertj
00121  * Changed to allow optional wink detection for line disconnect
00122  *
00123  * Revision 1.41  2001/03/29 23:42:34  robertj
00124  * Added ability to get average signal level for both receive and transmit.
00125  * Changed silence detection to use G.723.1 SID frames as indicator of
00126  *   silence instead of using the average energy and adaptive threshold.
00127  *
00128  * Revision 1.40  2001/02/13 05:02:39  craigs
00129  * Extended PlayDTMF to allow generation of additional simple tones
00130  *
00131  * Revision 1.39  2001/02/09 05:16:24  robertj
00132  * Added #pragma interface for GNU C++.
00133  *
00134  * Revision 1.38  2001/01/25 07:27:14  robertj
00135  * Major changes to add more flexible OpalMediaFormat class to normalise
00136  *   all information about media types, especially codecs.
00137  *
00138  * Revision 1.37  2001/01/24 05:34:49  robertj
00139  * Altered volume control range to be percentage, ie 100 is max volume.
00140  *
00141  * Revision 1.36  2001/01/11 05:39:44  robertj
00142  * Fixed usage of G.723.1 CNG 1 byte frames.
00143  *
00144  * Revision 1.35  2000/12/19 06:38:57  robertj
00145  * Fixed missing virtual on IsTonePlaying() function.
00146  *
00147  * Revision 1.34  2000/12/17 22:08:20  craigs
00148  * Changed GetCountryCodeList to return PStringList
00149  *
00150  * Revision 1.33  2000/12/11 01:23:32  craigs
00151  * Added extra routines to allow country string manipulation
00152  *
00153  * Revision 1.32  2000/11/30 08:48:35  robertj
00154  * Added functions to enable/disable Voice Activity Detection in LID's
00155  *
00156  * Revision 1.31  2000/11/26 23:12:18  craigs
00157  * Added hook flash detection API
00158  *
00159  * Revision 1.30  2000/11/24 10:46:12  robertj
00160  * Added a raw PCM dta mode for generating/detecting standard tones.
00161  * Modified the ReadFrame/WriteFrame functions to allow for variable length codecs.
00162  *
00163  * Revision 1.29  2000/11/20 03:15:13  craigs
00164  * Changed tone detection API slightly to allow detection of multiple
00165  * simultaneous tones
00166  * Added fax CNG tone to tone list
00167  *
00168  * Revision 1.28  2000/11/06 02:00:18  eokerson
00169  * Added support for AGC on ixj devices under Linux.
00170  *
00171  * Revision 1.27  2000/11/03 06:22:48  robertj
00172  * Added flag to IsLinePresent() to force slow test, guarenteeing correct value.
00173  *
00174  * Revision 1.26  2000/10/13 02:24:06  robertj
00175  * Moved frame reblocking code from LID channel to LID itself and added
00176  *    ReadBlock/WriteBlock functions to allow non integral frame sizes.
00177  *
00178  * Revision 1.25  2000/09/25 22:31:19  craigs
00179  * Added G.723.1 frame erasure capability
00180  *
00181  * Revision 1.24  2000/09/23 07:20:28  robertj
00182  * Fixed problem with being able to distinguish between sw and hw codecs in LID channel.
00183  *
00184  * Revision 1.23  2000/09/22 01:35:03  robertj
00185  * Added support for handling LID's that only do symmetric codecs.
00186  *
00187  * Revision 1.22  2000/08/31 13:14:40  craigs
00188  * Added functions to LID
00189  * More bulletproofing to Linux driver
00190  *
00191  * Revision 1.21  2000/08/30 23:24:24  robertj
00192  * Renamed string version of SetCountrCode() to SetCountryCodeName() to avoid
00193  *    C++ masking ancestor overloaded function when overriding numeric version.
00194  *
00195  * Revision 1.20  2000/08/18 04:17:48  robertj
00196  * Added Auto setting to AEC enum.
00197  *
00198  * Revision 1.19  2000/06/19 00:32:13  robertj
00199  * Changed functionf or adding all lid capabilities to not assume it is to an endpoint.
00200  *
00201  * Revision 1.18  2000/06/01 07:52:19  robertj
00202  * Changed some LID capability code back again so does not unneedfully break existing API.
00203  *
00204  * Revision 1.17  2000/05/30 10:19:17  robertj
00205  * Added function to add capabilities given a LID.
00206  * Improved LID capabilities so cannot create one that is not explicitly supported.
00207  *
00208  * Revision 1.16  2000/05/24 06:42:18  craigs
00209  * Added calls to get volume settings
00210  *
00211  * Revision 1.15  2000/05/10 04:05:26  robertj
00212  * Changed capabilities so has a function to get name of codec, instead of relying on PrintOn.
00213  *
00214  * Revision 1.14  2000/05/02 04:32:24  robertj
00215  * Fixed copyright notice comment.
00216  *
00217  * Revision 1.13  2000/04/14 17:18:25  robertj
00218  * Fixed problem with error reporting from LID hardware.
00219  *
00220  * Revision 1.12  2000/04/10 17:44:52  robertj
00221  * Added higher level "DialOut" function for PSTN lines.
00222  * Added hook flash function.
00223  *
00224  * Revision 1.11  2000/04/05 18:04:12  robertj
00225  * Changed caller ID code for better portability.
00226  *
00227  * Revision 1.10  2000/03/30 23:10:50  robertj
00228  * Fixed error in comments regarding GetFramerate() function.
00229  *
00230  * Revision 1.9  2000/03/29 20:54:19  robertj
00231  * Added function on LID to get available codecs.
00232  * Changed codec to use number of frames rather than number of bytes.
00233  *
00234  * Revision 1.8  2000/03/23 23:36:48  robertj
00235  * Added more calling tone detection functionality.
00236  *
00237  * Revision 1.7  2000/03/23 02:43:15  robertj
00238  * Fixed default DTMF timing.
00239  *
00240  * Revision 1.6  2000/03/22 17:18:49  robertj
00241  * Changed default DTMF tone string times.
00242  *
00243  * Revision 1.5  2000/03/21 03:06:48  robertj
00244  * Changes to make RTP TX of exact numbers of frames in some codecs.
00245  *
00246  * Revision 1.4  2000/01/13 12:39:29  robertj
00247  * Added string based country codes to LID.
00248  *
00249  * Revision 1.3  2000/01/13 04:03:45  robertj
00250  * Added video transmission
00251  *
00252  * Revision 1.2  2000/01/07 08:28:09  robertj
00253  * Additions and changes to line interface device base class.
00254  *
00255  * Revision 1.1  1999/12/23 23:02:35  robertj
00256  * File reorganision for separating RTP from H.323 and creation of LID for VPB support.
00257  *
00258  */
00259 
00260 #ifndef __OPAL_LID_H
00261 #define __OPAL_LID_H
00262 
00263 #ifdef P_USE_PRAGMA
00264 #pragma interface
00265 #endif
00266 
00267 
00268 #include <opal/mediafmt.h>
00269 
00270 
00272 
00276 class OpalLineInterfaceDevice : public PObject
00277 {
00278   PCLASSINFO(OpalLineInterfaceDevice, PObject);
00279 
00280   public:
00283     OpalLineInterfaceDevice();
00284 
00287     virtual BOOL Open(
00288       const PString & device      
00289     ) = 0;
00290 
00293     virtual BOOL IsOpen() const;
00294 
00297     virtual BOOL Close();
00298 
00302     virtual PString GetDeviceType() const = 0;
00303 
00308     virtual PString GetDeviceName() const = 0;
00309 
00312     virtual PStringArray GetAllNames() const = 0;
00313 
00319     virtual PString GetDescription() const = 0;
00320 
00323     virtual unsigned GetLineCount() = 0;
00324 
00331     virtual BOOL IsLineTerminal(
00332       unsigned line   
00333     );
00334 
00335 
00338     virtual BOOL IsLinePresent(
00339       unsigned line,      
00340       BOOL force = FALSE  
00341     );
00342 
00343 
00349     virtual BOOL IsLineOffHook(
00350       unsigned line   
00351     ) = 0;
00352 
00358     virtual BOOL SetLineOffHook(
00359       unsigned line,        
00360       BOOL newState = TRUE  
00361     ) = 0;
00362 
00366     virtual BOOL SetLineOnHook(
00367       unsigned line        
00368     ) { return SetLineOffHook(line, FALSE); }
00369 
00373     virtual BOOL HookFlash(
00374       unsigned line,              
00375       unsigned flashTime = 200    
00376     );
00377 
00380     virtual BOOL HasHookFlash(unsigned line);
00381 
00382 
00393     virtual BOOL IsLineRinging(
00394       unsigned line,          
00395       DWORD * cadence = NULL  
00396     );
00397 
00408     virtual BOOL RingLine(
00409       unsigned line,    
00410       DWORD cadence     
00411     );
00412 
00427     virtual BOOL RingLine(
00428       unsigned line,     
00429       PINDEX nCadence,   
00430       unsigned * pattern 
00431     );
00432 
00433 
00440     virtual BOOL IsLineDisconnected(
00441       unsigned line,   
00442       BOOL checkForWink = TRUE
00443     );
00444 
00445 
00448     virtual BOOL SetLineToLineDirect(
00449       unsigned line1,   
00450       unsigned line2,   
00451       BOOL connect      
00452     );
00453 
00456     virtual BOOL IsLineToLineDirect(
00457       unsigned line1,   
00458       unsigned line2    
00459     );
00460 
00461 
00464     virtual OpalMediaFormatList GetMediaFormats() const = 0;
00465 
00468     virtual BOOL SetReadFormat(
00469       unsigned line,    
00470       const OpalMediaFormat & mediaFormat   
00471     ) = 0;
00472 
00475     virtual BOOL SetWriteFormat(
00476       unsigned line,    
00477       const OpalMediaFormat & mediaFormat   
00478     ) = 0;
00479 
00482     virtual OpalMediaFormat GetReadFormat(
00483       unsigned line    
00484     ) = 0;
00485 
00488     virtual OpalMediaFormat GetWriteFormat(
00489       unsigned line    
00490     ) = 0;
00491 
00500     virtual BOOL SetReadCodec(
00501       unsigned line,    
00502       RTP_DataFrame::PayloadTypes codec   
00503     );
00504 
00510     virtual BOOL SetWriteCodec(
00511       unsigned line,    
00512       RTP_DataFrame::PayloadTypes codec   
00513     );
00514 
00525     virtual BOOL SetRawCodec(
00526       unsigned line    
00527     );
00528 
00531     virtual BOOL StopReadCodec(
00532       unsigned line   
00533     );
00534 
00537     virtual BOOL StopWriteCodec(
00538       unsigned line   
00539     );
00540 
00543     virtual BOOL StopRawCodec(
00544       unsigned line   
00545     );
00546 
00551     virtual BOOL SetReadFrameSize(
00552       unsigned line,    
00553       PINDEX frameSize  
00554     );
00555 
00560     virtual BOOL SetWriteFrameSize(
00561       unsigned line,    
00562       PINDEX frameSize  
00563     );
00564 
00568     virtual PINDEX GetReadFrameSize(
00569       unsigned line   
00570     ) = 0;
00571 
00575     virtual PINDEX GetWriteFrameSize(
00576       unsigned line   
00577     ) = 0;
00578 
00581     virtual BOOL ReadFrame(
00582       unsigned line,    
00583       void * buf,       
00584       PINDEX & count    
00585     ) = 0;
00586 
00589     virtual BOOL WriteFrame(
00590       unsigned line,    
00591       const void * buf, 
00592       PINDEX count,     
00593       PINDEX & written  
00594     ) = 0;
00595 
00599     virtual BOOL ReadBlock(
00600       unsigned line,    
00601       void * buf,   
00602       PINDEX count  
00603     );
00604 
00607     virtual BOOL WriteBlock(
00608       unsigned line,    
00609       const void * buf, 
00610       PINDEX count      
00611     );
00612 
00613 
00616     virtual unsigned GetAverageSignalLevel(
00617       unsigned line,  
00618       BOOL playback   
00619     );
00620 
00621 
00624     virtual BOOL EnableAudio(
00625       unsigned line,      
00626       BOOL enable = TRUE
00627     );
00628 
00631     BOOL DisableAudio(
00632       unsigned line   
00633     ) { return EnableAudio(line, FALSE); }
00634 
00637     virtual BOOL IsAudioEnabled(
00638       unsigned line      
00639     );
00640 
00641 
00642     enum {
00643       MaxVolume = 100
00644     };
00645 
00650     virtual BOOL SetRecordVolume(
00651       unsigned line,    
00652       unsigned volume   
00653     );
00654 
00659     virtual BOOL SetPlayVolume(
00660       unsigned line,    
00661       unsigned volume   
00662     );
00663 
00668     virtual BOOL GetRecordVolume(
00669       unsigned line,      
00670       unsigned & volume   
00671     );
00672 
00677     virtual BOOL GetPlayVolume(
00678       unsigned line,      
00679       unsigned & volume   
00680     );
00681 
00682 
00683     enum AECLevels {
00684       AECOff,
00685       AECLow,
00686       AECMedium,
00687       AECHigh,
00688       AECAuto,
00689       AECAGC,
00690       AECError
00691     };
00692 
00696     virtual AECLevels GetAEC(
00697       unsigned line    
00698     );
00699 
00703     virtual BOOL SetAEC(
00704       unsigned line,    
00705       AECLevels level   
00706     );
00707 
00711     virtual unsigned GetWinkDuration(
00712       unsigned line    
00713     );
00714 
00718     virtual BOOL SetWinkDuration(
00719       unsigned line,        
00720       unsigned winkDuration 
00721     );
00722 
00726     virtual BOOL GetVAD(
00727       unsigned line    
00728     );
00729 
00733     virtual BOOL SetVAD(
00734       unsigned line,    
00735       BOOL enable       
00736     );
00737 
00738 
00746     virtual BOOL GetCallerID(
00747       unsigned line,      
00748       PString & idString, 
00749       BOOL full = FALSE   
00750     );
00751 
00760     virtual BOOL SetCallerID(
00761       unsigned line,            
00762       const PString & idString  
00763     );
00764 
00773     virtual BOOL SendCallerIDOnCallWaiting(
00774       unsigned line,            
00775       const PString & idString  
00776     );
00777 
00780     virtual BOOL SendVisualMessageWaitingIndicator(
00781       unsigned line,            
00782       BOOL on
00783     );
00784 
00785 
00786     enum {
00787       DefaultDTMFOnTime = 180,
00788       DefaultDTMFOffTime = 120
00789     };
00790 
00794     virtual BOOL PlayDTMF(
00795       unsigned line,            
00796       const char * digits,      
00797       DWORD onTime = DefaultDTMFOnTime,  
00798       DWORD offTime = DefaultDTMFOffTime 
00799     );
00800 
00810     virtual char ReadDTMF(
00811       unsigned line   
00812     );
00813 
00818     virtual BOOL GetRemoveDTMF(
00819       unsigned line   
00820     );
00821 
00826     virtual BOOL SetRemoveDTMF(
00827       unsigned line,     
00828       BOOL removeTones   
00829     );
00830 
00831 
00832     enum CallProgressTones {
00833       NoTone    = 0x00,   // indicates no tones
00834       DialTone  = 0x01,   // Dial tone
00835       RingTone  = 0x02,   // Ring indication tone
00836       BusyTone  = 0x04,   // Line engaged tone
00837       ClearTone = 0x08,   // Call failed/cleared tone (often same as busy tone)
00838       CNGTone   = 0x10,   // Fax CNG tone
00839       AllTones  = 0x1f
00840     };
00841 
00844     virtual unsigned IsToneDetected(
00845       unsigned line   
00846     );
00847 
00850     virtual unsigned WaitForToneDetect(
00851       unsigned line,          
00852       unsigned timeout = 3000 
00853     );
00854 
00857     virtual BOOL WaitForTone(
00858       unsigned line,          
00859       CallProgressTones tone, 
00860       unsigned timeout = 3000 
00861     );
00862 
00880     virtual BOOL SetToneFilter(
00881       unsigned line,              
00882       CallProgressTones tone,     
00883       const PString & description 
00884     );
00885 
00888     virtual BOOL SetToneFilterParameters(
00889       unsigned line,            
00890       CallProgressTones tone,   
00891       unsigned lowFrequency,    
00892       unsigned highFrequency,   
00893       PINDEX numCadences,       
00894       const unsigned * onTimes, 
00895       const unsigned * offTimes 
00896     );
00897 
00900     virtual BOOL PlayTone(
00901       unsigned line,          
00902       CallProgressTones tone  
00903     );
00904 
00907     virtual BOOL IsTonePlaying(
00908       unsigned line   
00909     );
00910 
00913     virtual BOOL StopTone(
00914       unsigned line   
00915     );
00916 
00919     virtual BOOL PlayAudio(
00920       unsigned line,            
00921       const PString & filename  
00922     );
00923     
00926     virtual BOOL StopAudio(
00927       unsigned line   
00928     );
00929 
00930 
00946     virtual CallProgressTones DialOut(
00947       unsigned line,                
00948       const PString & number,       
00949       BOOL requireTones = FALSE     
00950     );
00951 
00952 
00953     enum T35CountryCodes {
00954       Japan, Albania, Algeria, AmericanSamoa, Germany, Anguilla, AntiguaAndBarbuda,
00955       Argentina, Ascension, Australia, Austria, Bahamas, Bahrain, Bangladesh,
00956       Barbados, Belgium, Belize, Benin, Bermudas, Bhutan, Bolivia, Botswana,
00957       Brazil, BritishAntarcticTerritory, BritishIndianOceanTerritory, 
00958       BritishVirginIslands, BruneiDarussalam, Bulgaria, Myanmar, Burundi,
00959       Byelorussia, Cameroon, Canada, CapeVerde, CaymanIslands,
00960       CentralAfricanRepublic, Chad, Chile, China, Colombia, Comoros, Congo,
00961       CookIslands, CostaRica, Cuba, Cyprus, Czechoslovakia, Cambodia,
00962       DemocraticPeoplesRepublicOfKorea, Denmark, Djibouti, DominicanRepublic,
00963       Dominica, Ecuador, Egypt, ElSalvador, EquatorialGuinea, Ethiopia,
00964       FalklandIslands, Fiji, Finland, France, FrenchPolynesia,
00965       FrenchSouthernAndAntarcticLands, Gabon, Gambia, Germany2, Angola, Ghana,
00966       Gibraltar, Greece, Grenada, Guam, Guatemala, Guernsey, Guinea, GuineaBissau,
00967       Guayana, Haiti, Honduras, Hongkong, Hungary, Iceland, India, Indonesia,
00968       Iran, Iraq, Ireland, Israel, Italy, CotedIvoire, Jamaica, Afghanistan,
00969       Jersey, Jordan, Kenya, Kiribati, KoreaRepublic, Kuwait, Lao, Lebanon,
00970       Lesotho, Liberia, Libya, Liechtenstein, Luxemborg, Macao, Madagascar,
00971       Malaysia, Malawi, Maldives, Mali, Malta, Mauritania, Mauritius, Mexico,
00972       Monaco, Mongolia, Montserrat, Morocco, Mozambique, Nauru, Nepal,
00973       Netherlands, NetherlandsAntilles, NewCaledonia, NewZealand, Nicaragua,
00974       Niger, Nigeria, Norway, Oman, Pakistan, Panama, PapuaNewGuinea, Paraguay,
00975       Peru, Philippines, Poland, Portugal, PuertoRico, Qatar, Romania, Rwanda,
00976       SaintKittsAndNevis, SaintCroix, SaintHelenaAndAscension, SaintLucia,
00977       SanMarino, SaintThomas, SaoTomeAndPrincipe, SaintVicentAndTheGrenadines,
00978       SaudiArabia, Senegal, Seychelles, SierraLeone, Singapore, SolomonIslands,
00979       Somalia, SouthAfrica, Spain, SriLanka, Sudan, Suriname, Swaziland, Sweden,
00980       Switzerland, Syria, Tanzania, Thailand, Togo, Tonga, TrinidadAndTobago,
00981       Tunisia, Turkey, TurksAndCaicosIslands, Tuvalu, Uganda, Ukraine,
00982       UnitedArabEmirates, UnitedKingdom, UnitedStates, BurkinaFaso, Uruguay,
00983       USSR, Vanuatu, VaticanCityState, Venezuela, VietNam, WallisAndFutuna,
00984       WesternSamoa, Yemen, Yemen2, Yugoslavia, Zaire, Zambia, Zimbabwe,
00985       NumCountryCodes,
00986       UnknownCountry = -1
00987     };
00988 
00991     T35CountryCodes GetCountryCode() const { return countryCode; }
00992 
00995     PString GetCountryCodeName() const;
00996 
00999     static PString GetCountryCodeName(T35CountryCodes code);
01000     static T35CountryCodes GetCountryCode(const PString & name);
01001 
01007     virtual BOOL SetCountryCode(
01008       T35CountryCodes country   
01009     );
01010 
01013     virtual BOOL SetCountryCodeName(
01014       const PString & countryName   
01015     );
01016 
01019     virtual PStringList GetCountryCodeNameList() const;
01020 
01021 
01024     int GetErrorNumber() const { return osError; }
01025 
01028     PString GetErrorText() const;
01029 
01030     virtual void PrintOn(
01031       ostream & strm
01032     ) const;
01033 
01036     static OpalLineInterfaceDevice * Create(
01037       const PString & type,     
01038       void * parameters = NULL  
01039     );
01040 
01043     static PStringList GetAllTypes();
01044 
01049     static PStringList GetAllDevices();
01050 
01051   protected:
01052     int             os_handle;
01053     int             osError;
01054     T35CountryCodes countryCode;
01055     PBYTEArray      readDeblockingBuffer, writeDeblockingBuffer;
01056     PINDEX          readDeblockingOffset, writeDeblockingOffset;
01057 
01058 #if PTRACING
01059     friend ostream & operator<<(ostream & o, CallProgressTones t);
01060 #endif
01061 };
01062 
01063 
01064 PLIST(OpalLIDList, OpalLineInterfaceDevice);
01065 
01066 
01067 
01070 class OpalLine : public PObject
01071 {
01072     PCLASSINFO(OpalLine, PObject);
01073   public:
01078     OpalLine(
01079       OpalLineInterfaceDevice & device, 
01080       unsigned lineNumber,              
01081       const char * description = NULL   
01082     );
01084 
01091     void PrintOn(
01092       ostream & strm    
01093     ) const;
01095 
01104     virtual BOOL IsTerminal() { return device.IsLineTerminal(lineNumber); }
01105 
01106 
01109     virtual BOOL IsPresent(
01110       BOOL force = FALSE  
01111     ) { return device.IsLinePresent(lineNumber, force); }
01112 
01113 
01119     virtual BOOL IsOffHook() { return device.IsLineOffHook(lineNumber); }
01120 
01126     virtual BOOL SetOffHook(
01127       BOOL newState = TRUE  
01128     ) { return device.SetLineOffHook(lineNumber, newState); }
01129 
01133     virtual BOOL SetOnHook() { return SetOffHook(FALSE); }
01134 
01138     virtual BOOL HookFlash(
01139       unsigned flashTime = 200    
01140     ) { return device.HookFlash(lineNumber, flashTime); }
01141 
01144     virtual BOOL HasHookFlash() { return device.HasHookFlash(lineNumber); }
01145 
01146 
01157     virtual BOOL IsRinging(
01158       DWORD * cadence = NULL  
01159     ) { return device.IsLineRinging(lineNumber, cadence); }
01160 
01164     virtual unsigned GetRingCount(
01165       DWORD * cadence = NULL  
01166     );
01167 
01178     virtual BOOL Ring(
01179       DWORD cadence     
01180     ) { return device.RingLine(lineNumber, cadence); }
01181 
01196     virtual BOOL Ring(
01197       PINDEX nCadence,   
01198       unsigned * pattern 
01199     ) { return device.RingLine(lineNumber, nCadence, pattern); }
01200 
01201 
01205     virtual BOOL IsDisconnected() { return device.IsLineDisconnected(lineNumber); }
01206 
01209     virtual BOOL SetReadFormat(
01210       const OpalMediaFormat & mediaFormat   
01211     ) { return device.SetReadFormat(lineNumber, mediaFormat); }
01212 
01215     virtual BOOL SetWriteFormat(
01216       const OpalMediaFormat & mediaFormat   
01217     ) { return device.SetWriteFormat(lineNumber, mediaFormat); }
01218 
01221     virtual OpalMediaFormat GetReadFormat() { return device.GetReadFormat(lineNumber); }
01222 
01225     virtual OpalMediaFormat GetWriteFormat() { return device.GetWriteFormat(lineNumber); }
01226 
01237     virtual BOOL SetRawCodec() { return device.SetRawCodec(lineNumber); }
01238 
01241     virtual BOOL StopReadCodec() { return device.StopReadCodec(lineNumber); }
01242 
01245     virtual BOOL StopWriteCodec() { return device.StopWriteCodec(lineNumber); }
01246 
01249     virtual BOOL StopRawCodec() { return device.StopRawCodec(lineNumber); }
01250 
01255     virtual BOOL SetReadFrameSize(
01256       PINDEX frameSize  
01257     ) { return device.SetReadFrameSize(lineNumber, frameSize); }
01258 
01263     virtual BOOL SetWriteFrameSize(
01264       PINDEX frameSize  
01265     ) { return device.SetWriteFrameSize(lineNumber, frameSize); }
01266 
01270     virtual PINDEX GetReadFrameSize() { return device.GetReadFrameSize(lineNumber); }
01271 
01275     virtual PINDEX GetWriteFrameSize() { return device.GetWriteFrameSize(lineNumber); }
01276 
01279     virtual BOOL ReadFrame(
01280       void * buf,       
01281       PINDEX & count    
01282     ) { return device.ReadFrame(lineNumber, buf, count); }
01283 
01286     virtual BOOL WriteFrame(
01287       const void * buf, 
01288       PINDEX count,     
01289       PINDEX & written  
01290     ) { return device.WriteFrame(lineNumber, buf, count, written); }
01291 
01295     virtual BOOL ReadBlock(
01296       void * buf,   
01297       PINDEX count  
01298     ) { return device.ReadBlock(lineNumber, buf, count); }
01299 
01302     virtual BOOL WriteBlock(
01303       const void * buf, 
01304       PINDEX count      
01305     ) { return device.WriteBlock(lineNumber, buf, count); }
01306 
01307 
01310     virtual unsigned GetAverageSignalLevel(
01311       BOOL playback   
01312     ) { return device.GetAverageSignalLevel(lineNumber, playback); }
01313 
01314 
01317     virtual BOOL EnableAudio(
01318       BOOL enable = TRUE
01319     ) { return device.EnableAudio(lineNumber, enable); }
01320 
01323     BOOL DisableAudio() { return EnableAudio(FALSE); }
01324 
01327     virtual BOOL IsAudioEnabled() { return device.IsAudioEnabled(lineNumber); }
01328 
01329 
01334     virtual BOOL SetRecordVolume(
01335       unsigned volume   
01336     ) { return device.SetRecordVolume(lineNumber, volume); }
01337 
01342     virtual BOOL SetPlayVolume(
01343       unsigned volume   
01344     ) { return device.SetPlayVolume(lineNumber, volume); }
01345 
01350     virtual BOOL GetRecordVolume(
01351       unsigned & volume   
01352     ) { return device.GetRecordVolume(lineNumber, volume); }
01353 
01358     virtual BOOL GetPlayVolume(
01359       unsigned & volume   
01360     ) { return device.GetPlayVolume(lineNumber, volume); }
01361 
01362 
01366     virtual OpalLineInterfaceDevice::AECLevels GetAEC() { return device.GetAEC(lineNumber); }
01367 
01371     virtual BOOL SetAEC(
01372       OpalLineInterfaceDevice::AECLevels level  
01373     ) { return device.SetAEC(lineNumber, level); }
01374 
01375 
01379     virtual BOOL GetVAD() { return device.GetVAD(lineNumber); }
01380 
01384     virtual BOOL SetVAD(
01385       BOOL enable       
01386     ) { return device.SetVAD(lineNumber, enable); }
01387 
01388 
01396     virtual BOOL GetCallerID(
01397       PString & idString, 
01398       BOOL full = FALSE   
01399     ) { return device.GetCallerID(lineNumber, idString, full); }
01400 
01409     virtual BOOL SetCallerID(
01410       const PString & idString  
01411     ) { return device.SetCallerID(lineNumber, idString); }
01412 
01421     virtual BOOL SendCallerIDOnCallWaiting(
01422       const PString & idString  
01423     ) { return device.SendCallerIDOnCallWaiting(lineNumber, idString); }
01424 
01427     virtual BOOL SendVisualMessageWaitingIndicator(
01428       BOOL on
01429     ) { return device.SendVisualMessageWaitingIndicator(lineNumber, on); }
01430 
01431 
01435     virtual BOOL PlayDTMF(
01436       const char * digits,      
01437       DWORD onTime = OpalLineInterfaceDevice::DefaultDTMFOnTime,  
01438       DWORD offTime = OpalLineInterfaceDevice::DefaultDTMFOffTime 
01439     ) { return device.PlayDTMF(lineNumber, digits, onTime, offTime); }
01440 
01450     virtual char ReadDTMF() { return device.ReadDTMF(lineNumber); }
01451 
01456     virtual BOOL GetRemoveDTMF() { return device.GetRemoveDTMF(lineNumber); }
01457 
01462     virtual BOOL SetRemoveDTMF(
01463       BOOL removeTones   
01464     ) { return device.SetRemoveDTMF(lineNumber, removeTones); }
01465 
01466 
01469     virtual unsigned IsToneDetected() { return device.IsToneDetected(lineNumber); }
01470 
01473     virtual unsigned WaitForToneDetect(
01474       unsigned timeout = 3000 
01475     ) { return device.WaitForToneDetect(lineNumber, timeout); }
01476 
01479     virtual BOOL WaitForTone(
01480       OpalLineInterfaceDevice::CallProgressTones tone, 
01481       unsigned timeout = 3000 
01482     ) { return device.WaitForTone(lineNumber, tone, timeout); }
01483 
01486     virtual BOOL PlayTone(
01487       OpalLineInterfaceDevice::CallProgressTones tone  
01488     ) { return device.PlayTone(lineNumber, tone); }
01489 
01492     virtual BOOL IsTonePlaying() { return device.IsTonePlaying(lineNumber); }
01493 
01496     virtual BOOL StopTone() { return device.StopTone(lineNumber); }
01497 
01498 
01514     virtual OpalLineInterfaceDevice::CallProgressTones DialOut(
01515       const PString & number,       
01516       BOOL requireTones = FALSE     
01517     ) { return device.DialOut(lineNumber, number, requireTones); }
01519 
01524     OpalLineInterfaceDevice & GetDevice() const { return device; }
01525 
01528     unsigned GetLineNumber() const { return lineNumber; }
01529 
01532     PString GetToken() const { return token; }
01533 
01536     PString GetDescription() const { return description; }
01538 
01539   protected:
01540     OpalLineInterfaceDevice & device;
01541     unsigned                  lineNumber;
01542     PString                   token;
01543     PString                   description;
01544     unsigned                  ringCount;
01545     PTimeInterval             ringTick;
01546     PTimeInterval             ringStoppedTime;
01547     PTimeInterval             ringInterCadenceTime;
01548 };
01549 
01550 
01551 PLIST(OpalLineList, OpalLine);
01552 
01553 
01560 class OpalLIDRegistration : public PCaselessString
01561 {
01562     PCLASSINFO(OpalLIDRegistration, PCaselessString);
01563   public:
01568     OpalLIDRegistration(
01569       const char * name  
01570     );
01572 
01577     virtual OpalLineInterfaceDevice * Create(
01578       void * parameters   
01579     ) const = 0;
01581 
01582   protected:
01583     OpalLIDRegistration * link;
01584 
01585   friend class OpalLineInterfaceDevice;
01586 };
01587 
01588 
01589 #define OPAL_REGISTER_LID_FUNCTION(cls, type, param) \
01590 static class cls##_Registration : public OpalLIDRegistration { \
01591   public: \
01592     cls##_Registration() : OpalLIDRegistration(type) { } \
01593     OpalLineInterfaceDevice * Create(void * param) const; \
01594 } instance_##cls##_Registration; \
01595 OpalLineInterfaceDevice * cls##_Registration::Create(void * param) const
01596 
01597 #ifndef OPAL_NO_PARAM
01598 #define OPAL_NO_PARAM
01599 #endif
01600 
01601 #define OPAL_REGISTER_LID(cls, type) \
01602   OPAL_REGISTER_LID_FUNCTION(cls, type, OPAL_NO_PARAM) \
01603   { return new cls; }
01604 
01605 #define OPAL_REGISTER_LID_PARAM(cls, type) \
01606   OPAL_REGISTER_LID_FUNCTION(cls, type, parameter) \
01607   { return new cls(parameter); }
01608 
01609 
01610 #endif // __OPAL_LID_H
01611 
01612 
01613 // End of File ///////////////////////////////////////////////////////////////

Generated on Mon Sep 25 16:20:07 2006 for OPAL by  doxygen 1.4.7