# t140.h

Go to the documentation of this file.

    00001 /*
    00002  * t140.h
    00003  *
    00004  * Declarations for implementation of T.140 Protocol for Multimedia Application Text Conversation
    00005  *
    00006  * Open Phone Abstraction Library (OPAL)
    00007  *
    00008  * Copyright (c) 2008 Post Increment
    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 Phone Abstraction Library.
    00021  *
    00022  * The Initial Developer of the Original Code is Post Increment
    00023  *
    00024  * Contributor(s): ______________________________________.
    00025  *
    00026  * $Revision: 28208 $
    00027  * $Author: rjongbloed $
    00028  * $Date: 2012-08-16 20:54:46 -0500 (Thu, 16 Aug 2012) $
    00029  */
    00030
    00031 #ifndef OPAL_IM_T140_H
    00032 #define OPAL_IM_T140_H
    00033
    00034
    00035 #include <rtp/rtp.h>
    00036
    00037
    00040 class T140String : public PBYTEArray
    00041 {
    00042   public:
    00043     enum {
    00044       ZERO_WIDTH_NO_BREAK = 0xfeff,
    00045       UTF_NEWLINE         = 0x2028,
    00046     };
    00047
    00048     T140String();
    00049     T140String(const BYTE * data, PINDEX len);
    00050     T140String(const PBYTEArray & bytes);
    00051     T140String(const char * chars);
    00052     T140String(const PString & str);
    00053
    00054     PINDEX GetLength() const { return length; }
    00055
    00056     PINDEX GetUTFLen(WORD c);
    00057     PINDEX GetUTF(const BYTE * ptr, PINDEX len, WORD & ch);
    00058     PINDEX GetUTF(PINDEX pos, WORD & ch);
    00059
    00060     PINDEX AppendUnicode16(WORD c);
    00061     PINDEX AppendUTF(const BYTE * utf, PINDEX utfLen);
    00062
    00063     bool AsString(PString & str);
    00064
    00065   protected:
    00066     PINDEX SetUTF(BYTE * ptr, WORD c);
    00067     PINDEX length;
    00068 };
    00069
    00070
    00073 class OpalT140RTPFrame : public RTP_DataFrame
    00074 {
    00075   public:
    00076     OpalT140RTPFrame();
    00077     OpalT140RTPFrame(const PString & contentType);
    00078     OpalT140RTPFrame(const PString & contentType, const T140String & content);
    00079     OpalT140RTPFrame(const BYTE * data, PINDEX len, PBoolean dynamic = true);
    00080     OpalT140RTPFrame(const RTP_DataFrame & frame);
    00081
    00082     void SetContentType(const PString & contentType);
    00083     PString GetContentType() const;
    00084
    00085     void SetContent(const T140String & text);
    00086     bool GetContent(T140String & text) const;
    00087     bool GetContent(PString & str) const;
    00088
    00089     PString AsString() const { return PString((const char *)GetPayloadPtr(), GetPayloadSize()); }
    00090 };
    00091
    00092
    00093 #endif // OPAL_IM_T140_H