2 * Copyright 2012-2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef SMS_PLUGIN_UDCODEC_H
18 #define SMS_PLUGIN_UDCODEC_H
21 /*==================================================================================================
23 ==================================================================================================*/
24 #include "SmsPluginTypes.h"
27 /*==================================================================================================
29 ==================================================================================================*/
30 class SmsPluginUDCodec
34 virtual ~SmsPluginUDCodec();
36 static int encodeUserData(const SMS_USERDATA_S *pUserData, SMS_CODING_SCHEME_T CodingScheme, char *pEncodeData);
37 static int decodeUserData(const unsigned char *pTpdu, const int tpduLen, bool bHeaderInd, SMS_CODING_SCHEME_T CodingScheme, SMS_USERDATA_S *pUserData);
38 static int decodeUserData(const unsigned char *pTpdu, const int tpduLen, bool bHeaderInd, SMS_CODING_SCHEME_T CodingScheme, SMS_USERDATA_S *pUserData, SMS_TPUD_S *pTPUD);
40 static int pack7bitChar(const unsigned char *pUserData, int dataLen, int fillBits, char *pPackData);
41 static int unpack7bitChar(const unsigned char *pTpdu, unsigned char dataLen, int fillBits, char *pUnpackData);
44 static int encodeGSMData(const SMS_USERDATA_S *pUserData, char *pEncodeData);
45 static int encode8bitData(const SMS_USERDATA_S *pUserData, char *pEncodeData);
46 static int encodeUCS2Data(const SMS_USERDATA_S *pUserData, char *pEncodeData);
48 static int decodeGSMData(const unsigned char *pTpdu, const int tpduLen, bool bHeaderInd, SMS_USERDATA_S *pUserData, SMS_TPUD_S *pTPUD);
49 static int decode8bitData(const unsigned char *pTpdu, bool bHeaderInd, SMS_USERDATA_S *pUserData, SMS_TPUD_S *pTPUD);
50 static int decodeUCS2Data(const unsigned char *pTpdu, const int tpduLen, bool bHeaderInd, SMS_USERDATA_S *pUserData, SMS_TPUD_S *pTPUD);
52 static int encodeHeader(const SMS_UDH_S header, char *pEncodeHeader);
53 static int decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeader);