Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

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

Generated on Mon Sep 26 15:44:50 2005 for OpenH323 by  doxygen 1.4.4