Modify flora license version.
[platform/core/messaging/msg-service.git] / plugin / sms_plugin / include / SmsPluginUDCodec.h
1 /*
2 * Copyright 2012-2013  Samsung Electronics Co., Ltd
3 *
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
7 *
8 *    http://floralicense.org/license/
9 *
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.
15 */
16
17 #ifndef SMS_PLUGIN_UDCODEC_H
18 #define SMS_PLUGIN_UDCODEC_H
19
20
21 /*==================================================================================================
22                                          INCLUDE FILES
23 ==================================================================================================*/
24 #include "SmsPluginTypes.h"
25
26
27 /*==================================================================================================
28                                      CLASS DEFINITIONS
29 ==================================================================================================*/
30 class SmsPluginUDCodec
31 {
32 public:
33         SmsPluginUDCodec();
34         virtual ~SmsPluginUDCodec();
35
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);
39
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);
42
43 private:
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);
47
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);
51
52         static int encodeHeader(const SMS_UDH_S header, char *pEncodeHeader);
53         static int decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeader);
54 };
55
56 #endif
57