OPAL  Version 3.14.3
t140.h
Go to the documentation of this file.
1 /*
2  * t140.h
3  *
4  * Declarations for implementation of T.140 Protocol for Multimedia Application Text Conversation
5  *
6  * Open Phone Abstraction Library (OPAL)
7  *
8  * Copyright (c) 2008 Post Increment
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Open Phone Abstraction Library.
21  *
22  * The Initial Developer of the Original Code is Post Increment
23  *
24  * Contributor(s): ______________________________________.
25  *
26  * $Revision: 28208 $
27  * $Author: rjongbloed $
28  * $Date: 2012-08-17 11:54:46 +1000 (Fri, 17 Aug 2012) $
29  */
30 
31 #ifndef OPAL_IM_T140_H
32 #define OPAL_IM_T140_H
33 
34 
35 #include <rtp/rtp.h>
36 
37 
40 class T140String : public PBYTEArray
41 {
42  public:
43  enum {
45  UTF_NEWLINE = 0x2028,
46  };
47 
48  T140String();
49  T140String(const BYTE * data, PINDEX len);
50  T140String(const PBYTEArray & bytes);
51  T140String(const char * chars);
52  T140String(const PString & str);
53 
54  PINDEX GetLength() const { return length; }
55 
56  PINDEX GetUTFLen(WORD c);
57  PINDEX GetUTF(const BYTE * ptr, PINDEX len, WORD & ch);
58  PINDEX GetUTF(PINDEX pos, WORD & ch);
59 
60  PINDEX AppendUnicode16(WORD c);
61  PINDEX AppendUTF(const BYTE * utf, PINDEX utfLen);
62 
63  bool AsString(PString & str);
64 
65  protected:
66  PINDEX SetUTF(BYTE * ptr, WORD c);
67  PINDEX length;
68 };
69 
70 
74 {
75  public:
77  OpalT140RTPFrame(const PString & contentType);
78  OpalT140RTPFrame(const PString & contentType, const T140String & content);
79  OpalT140RTPFrame(const BYTE * data, PINDEX len, PBoolean dynamic = true);
80  OpalT140RTPFrame(const RTP_DataFrame & frame);
81 
82  void SetContentType(const PString & contentType);
83  PString GetContentType() const;
84 
85  void SetContent(const T140String & text);
86  bool GetContent(T140String & text) const;
87  bool GetContent(PString & str) const;
88 
89  PString AsString() const { return PString((const char *)GetPayloadPtr(), GetPayloadSize()); }
90 };
91 
92 
93 #endif // OPAL_IM_T140_H