D:/Storage/CVS_Head/h323plus/include/rfc2833.h

00001 /*
00002  * rfc2833.h
00003  *
00004  * Open Phone Abstraction Library (OPAL)
00005  * Formally known as the Open H323 project.
00006  *
00007  * Copyright (c) 2001 Equivalence Pty. Ltd.
00008  *
00009  * The contents of this file are subject to the Mozilla Public License
00010  * Version 1.0 (the "License"); you may not use this file except in
00011  * compliance with the License. You may obtain a copy of the License at
00012  * http://www.mozilla.org/MPL/
00013  *
00014  * Software distributed under the License is distributed on an "AS IS"
00015  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00016  * the License for the specific language governing rights and limitations
00017  * under the License.
00018  *
00019  * The Original Code is Open Phone Abstraction Library.
00020  *
00021  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00022  *
00023  * Contributor(s): ______________________________________.
00024  *
00025  * $Log: rfc2833.h,v $
00026  * Revision 1.1  2007/08/06 20:50:50  shorne
00027  * First commit of h323plus
00028  *
00029  * Revision 1.4  2005/11/30 13:05:01  csoutheren
00030  * Changed tags for Doxygen
00031  *
00032  * Revision 1.3  2002/09/16 01:14:15  robertj
00033  * Added #define so can select if #pragma interface/implementation is used on
00034  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00035  *
00036  * Revision 1.2  2002/09/03 06:19:37  robertj
00037  * Normalised the multi-include header prevention ifdef/define symbol.
00038  *
00039  * Revision 1.1  2002/01/23 05:06:23  robertj
00040  * Added RFC2833 support as separate class
00041  *
00042  */
00043 
00044 #ifndef __OPAL_RFC2833_H
00045 #define __OPAL_RFC2833_H
00046 
00047 #ifdef P_USE_PRAGMA
00048 #pragma interface
00049 #endif
00050 
00051 
00052 #include "rtp.h"
00053 
00054 
00056 
00057 class OpalRFC2833Info : public PObject {
00058     PCLASSINFO(OpalRFC2833Info, PObject);
00059   public:
00060     OpalRFC2833Info(
00061       char tone,
00062       unsigned duration = 0,
00063       unsigned timestamp = 0
00064     );
00065 
00066     char GetTone() const { return tone; }
00067     unsigned GetDuration() const { return duration; }
00068     unsigned GetTimestamp() const { return timestamp; }
00069     BOOL IsToneStart() const { return duration == 0; }
00070 
00071   protected:
00072     char     tone;
00073     unsigned duration;
00074     unsigned timestamp;
00075 };
00076 
00077 
00078 class OpalRFC2833 : public PObject {
00079     PCLASSINFO(OpalRFC2833, PObject);
00080   public:
00081     OpalRFC2833(
00082       const PNotifier & receiveNotifier
00083     );
00084 
00085     virtual BOOL SendTone(
00086       char tone,              
00087       unsigned duration       
00088     );
00089 
00090     virtual BOOL BeginTransmit(
00091       char tone  
00092     );
00093     virtual BOOL EndTransmit();
00094 
00095     virtual void OnStartReceive(
00096       char tone
00097     );
00098     virtual void OnEndReceive(
00099       char tone,
00100       unsigned duration,
00101       unsigned timestamp
00102     );
00103 
00104     RTP_DataFrame::PayloadTypes GetPayloadType() const { return payloadType; }
00105 
00106     void SetPayloadType(
00107       RTP_DataFrame::PayloadTypes type 
00108     ) { payloadType = type; }
00109 
00110     const PNotifier & GetReceiveHandler() const { return receiveHandler; }
00111     const PNotifier & GetTransmitHandler() const { return transmitHandler; }
00112 
00113   protected:
00114     PDECLARE_NOTIFIER(RTP_DataFrame, OpalRFC2833, ReceivedPacket);
00115     PDECLARE_NOTIFIER(RTP_DataFrame, OpalRFC2833, TransmitPacket);
00116     PDECLARE_NOTIFIER(PTimer, OpalRFC2833, ReceiveTimeout);
00117     PDECLARE_NOTIFIER(PTimer, OpalRFC2833, TransmitEnded);
00118 
00119     RTP_DataFrame::PayloadTypes payloadType;
00120 
00121     PMutex mutex;
00122 
00123     PNotifier receiveNotifier;
00124     BOOL      receiveComplete;
00125     BYTE      receivedTone;
00126     unsigned  receivedDuration;
00127     unsigned  receiveTimestamp;
00128     PTimer    receiveTimer;
00129     PNotifier receiveHandler;
00130 
00131     enum {
00132       TransmitIdle,
00133       TransmitActive,
00134       TransmitEnding
00135     }         transmitState;
00136     BYTE      transmitCode;
00137     unsigned  transmitTimestamp;
00138     PTimer    transmitTimer;
00139     PNotifier transmitHandler;
00140 };
00141 
00142 
00143 #endif // __OPAL_RFC2833_H
00144 
00145 

Generated on Thu Oct 25 13:42:36 2007 for h323plus by  doxygen 1.5.2