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: 22675 $ 00027 * $Author: rjongbloed $ 00028 * $Date: 2009-05-20 04:23:29 +0000 (Wed, 20 May 2009) $ 00029 */ 00030 00031 #ifndef OPAL_IM_T140_H 00032 #define OPAL_IM_T140_H 00033 00034 #include <ptlib.h> 00035 #include <opal/buildopts.h> 00036 #include <opal/mediatype.h> 00037 00038 class OpalT140MediaType : public OpalRTPAVPMediaType 00039 { 00040 public: 00041 OpalT140MediaType(); 00042 00043 static const OpalMediaType & MediaType(); 00044 00045 #if OPAL_SIP 00046 SDPMediaDescription * CreateSDPMediaDescription(const OpalTransportAddress & localAddress); 00047 #endif 00048 }; 00049 00050 00051 class T140String : public PBYTEArray 00052 { 00053 public: 00054 enum { 00055 ZERO_WIDTH_NO_BREAK = 0xfeff, 00056 UTF_NEWLINE = 0x2028, 00057 }; 00058 00059 T140String(); 00060 T140String(const BYTE * data, PINDEX len); 00061 T140String(const PBYTEArray & bytes); 00062 T140String(const char * chars); 00063 T140String(const PString & str); 00064 00065 PINDEX GetLength() const { return length; } 00066 00067 PINDEX GetUTFLen(WORD c); 00068 PINDEX GetUTF(const BYTE * ptr, PINDEX len, WORD & ch); 00069 PINDEX GetUTF(PINDEX pos, WORD & ch); 00070 00071 PINDEX AppendUnicode16(WORD c); 00072 PINDEX AppendUTF(const BYTE * utf, PINDEX utfLen); 00073 00074 protected: 00075 PINDEX SetUTF(BYTE * ptr, WORD c); 00076 PINDEX length; 00077 }; 00078 00079 #endif // OPAL_IM_T140_H