OpenH323 1.18.0
|
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.4 2005/11/30 13:05:01 csoutheren 00027 * Changed tags for Doxygen 00028 * 00029 * Revision 1.3 2002/09/16 01:14:15 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 1.2 2002/09/03 06:19:37 robertj 00034 * Normalised the multi-include header prevention ifdef/define symbol. 00035 * 00036 * Revision 1.1 2002/01/23 05:06:23 robertj 00037 * Added RFC2833 support as separate class 00038 * 00039 */ 00040 00041 #ifndef __OPAL_RFC2833_H 00042 #define __OPAL_RFC2833_H 00043 00044 #ifdef P_USE_PRAGMA 00045 #pragma interface 00046 #endif 00047 00048 00049 #include "rtp.h" 00050 00051 00053 00054 class OpalRFC2833Info : public PObject { 00055 PCLASSINFO(OpalRFC2833Info, PObject); 00056 public: 00057 OpalRFC2833Info( 00058 char tone, 00059 unsigned duration = 0, 00060 unsigned timestamp = 0 00061 ); 00062 00063 char GetTone() const { return tone; } 00064 unsigned GetDuration() const { return duration; } 00065 unsigned GetTimestamp() const { return timestamp; } 00066 BOOL IsToneStart() const { return duration == 0; } 00067 00068 protected: 00069 char tone; 00070 unsigned duration; 00071 unsigned timestamp; 00072 }; 00073 00074 00075 class OpalRFC2833 : public PObject { 00076 PCLASSINFO(OpalRFC2833, PObject); 00077 public: 00078 OpalRFC2833( 00079 const PNotifier & receiveNotifier 00080 ); 00081 00082 virtual BOOL SendTone( 00083 char tone, 00084 unsigned duration 00085 ); 00086 00087 virtual BOOL BeginTransmit( 00088 char tone 00089 ); 00090 virtual BOOL EndTransmit(); 00091 00092 virtual void OnStartReceive( 00093 char tone 00094 ); 00095 virtual void OnEndReceive( 00096 char tone, 00097 unsigned duration, 00098 unsigned timestamp 00099 ); 00100 00101 RTP_DataFrame::PayloadTypes GetPayloadType() const { return payloadType; } 00102 00103 void SetPayloadType( 00104 RTP_DataFrame::PayloadTypes type 00105 ) { payloadType = type; } 00106 00107 const PNotifier & GetReceiveHandler() const { return receiveHandler; } 00108 const PNotifier & GetTransmitHandler() const { return transmitHandler; } 00109 00110 protected: 00111 PDECLARE_NOTIFIER(RTP_DataFrame, OpalRFC2833, ReceivedPacket); 00112 PDECLARE_NOTIFIER(RTP_DataFrame, OpalRFC2833, TransmitPacket); 00113 PDECLARE_NOTIFIER(PTimer, OpalRFC2833, ReceiveTimeout); 00114 PDECLARE_NOTIFIER(PTimer, OpalRFC2833, TransmitEnded); 00115 00116 RTP_DataFrame::PayloadTypes payloadType; 00117 00118 PMutex mutex; 00119 00120 PNotifier receiveNotifier; 00121 BOOL receiveComplete; 00122 BYTE receivedTone; 00123 unsigned receivedDuration; 00124 unsigned receiveTimestamp; 00125 PTimer receiveTimer; 00126 PNotifier receiveHandler; 00127 00128 enum { 00129 TransmitIdle, 00130 TransmitActive, 00131 TransmitEnding 00132 } transmitState; 00133 BYTE transmitCode; 00134 unsigned transmitTimestamp; 00135 PTimer transmitTimer; 00136 PNotifier transmitHandler; 00137 }; 00138 00139 00140 #endif // __OPAL_RFC2833_H 00141 00142