OPAL  Version 3.18.8
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 
27 #ifndef OPAL_IM_T140_H
28 #define OPAL_IM_T140_H
29 
30 
31 #include <rtp/rtp.h>
32 
33 
36 class T140String : public PBYTEArray
37 {
38  public:
39  enum {
41  UTF_NEWLINE = 0x2028,
42  };
43 
44  T140String();
45  T140String(const BYTE * data, PINDEX len);
46  T140String(const PBYTEArray & bytes);
47  T140String(const char * chars);
48  T140String(const PString & str);
49 
50  PINDEX GetLength() const { return length; }
51 
52  PINDEX GetUTFLen(WORD c);
53  PINDEX GetUTF(const BYTE * ptr, PINDEX len, WORD & ch);
54  PINDEX GetUTF(PINDEX pos, WORD & ch);
55 
56  PINDEX AppendUnicode16(WORD c);
57  PINDEX AppendUTF(const BYTE * utf, PINDEX utfLen);
58 
59  bool AsString(PString & str);
60 
61  protected:
62  PINDEX SetUTF(BYTE * ptr, WORD c);
63  PINDEX length;
64 };
65 
66 
70 {
71  public:
73  OpalT140RTPFrame(const PString & contentType);
74  OpalT140RTPFrame(const PString & contentType, const T140String & content);
75  OpalT140RTPFrame(const BYTE * data, PINDEX len, PBoolean dynamic = true);
76  OpalT140RTPFrame(const RTP_DataFrame & frame);
77 
78  void SetContentType(const PString & contentType);
79  PString GetContentType() const;
80 
81  void SetContent(const T140String & text);
82  bool GetContent(T140String & text) const;
83  bool GetContent(PString & str) const;
84 
85  PString AsString() const { return PString((const char *)GetPayloadPtr(), GetPayloadSize()); }
86 };
87 
88 
89 #endif // OPAL_IM_T140_H
PINDEX GetUTF(const BYTE *ptr, PINDEX len, WORD &ch)
void SetContent(const T140String &text)
bool AsString(PString &str)
Definition: t140.h:69
Definition: t140.h:40
PINDEX AppendUTF(const BYTE *utf, PINDEX utfLen)
Definition: rtp.h:540
PINDEX GetPayloadSize() const
Definition: rtp.h:683
PINDEX length
Definition: t140.h:63
PINDEX GetLength() const
Definition: t140.h:50
BYTE * GetPayloadPtr() const
Definition: rtp.h:686
bool GetContent(T140String &text) const
PINDEX AppendUnicode16(WORD c)
PString GetContentType() const
PINDEX SetUTF(BYTE *ptr, WORD c)
Definition: t140.h:41
Definition: t140.h:36
PString AsString() const
Definition: t140.h:85
void SetContentType(const PString &contentType)
PINDEX GetUTFLen(WORD c)