rfc2833.h

Go to the documentation of this file.
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 2.5  2005/11/30 13:35:26  csoutheren
00027  * Changed tags for Doxygen
00028  *
00029  * Revision 2.4  2002/09/16 02:52:33  robertj
00030  * Added #define so can select if #pragma interface/implementation is used on
00031  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00032  *
00033  * Revision 2.3  2002/09/04 06:01:46  robertj
00034  * Updated to OpenH323 v1.9.6
00035  *
00036  * Revision 2.2  2002/02/19 07:34:44  robertj
00037  * Added OpalRFC2833 as a OpalMediaFormat variable.
00038  *
00039  * Revision 2.1  2002/01/22 05:35:28  robertj
00040  * Added RFC2833 support
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/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 OpalRFC2833Proto : public PObject {
00079     PCLASSINFO(OpalRFC2833Proto, PObject);
00080   public:
00081     OpalRFC2833Proto(
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, OpalRFC2833Proto, ReceivedPacket);
00115     PDECLARE_NOTIFIER(RTP_DataFrame, OpalRFC2833Proto, TransmitPacket);
00116     PDECLARE_NOTIFIER(PTimer, OpalRFC2833Proto, ReceiveTimeout);
00117     PDECLARE_NOTIFIER(PTimer, OpalRFC2833Proto, 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 Mon Sep 25 16:20:10 2006 for OPAL by  doxygen 1.4.7