Modify flora license version.
[platform/core/messaging/msg-service.git] / plugin / sms_plugin / include / SmsPluginConcatHandler.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_CONCAT_HANDLER_H
18 #define SMS_PLUGIN_CONCAT_HANDLER_H
19
20
21 /*==================================================================================================
22                                          INCLUDE FILES
23 ==================================================================================================*/
24 #include <string>
25 #include <map>
26 #include <vector>
27
28 using namespace std;
29
30 #include "MsgTextConvert.h"
31 #include "SmsPluginTypes.h"
32
33
34 /*==================================================================================================
35                                          VARIABLES AND DEFINES
36 ==================================================================================================*/
37 #define MAX_CONCAT_LIST 10
38
39 struct CONCAT_DATA_S
40 {
41         int     length;
42         char data[MAX_USER_DATA_LEN+1];
43 };
44
45 typedef map<unsigned char, CONCAT_DATA_S> concatDataMap;
46
47 typedef struct _SMS_CONCAT_MSG_S
48 {
49         unsigned short          msgRef;
50         unsigned char           totalSeg;
51         unsigned char           seqNum;
52
53         SMS_TIMESTAMP_S timeStamp;
54         SMS_ADDRESS_S   originAddress;
55         SMS_DCS_S               dcs;
56         bool                            bRead;
57 } SMS_CONCAT_MSG_S;
58
59 typedef struct _SMS_CONCAT_INFO_S
60 {
61         unsigned short          msgRef;
62         unsigned char           totalSeg;
63         unsigned char           segCnt;
64
65         SMS_TIMESTAMP_S timeStamp;
66         SMS_ADDRESS_S   originAddress;
67         SMS_DCS_S               dcs;
68         bool                            bRead;
69
70         unsigned int            totalSize;
71         concatDataMap   data;
72 } SMS_CONCAT_INFO_S;
73
74 typedef struct _SMS_SIM_ID_S
75 {
76         unsigned short          msgRef;
77         msg_sim_id_t            simId;
78 } SMS_SIM_ID_S;
79
80
81 /*==================================================================================================
82                                      CLASS DEFINITIONS
83 ==================================================================================================*/
84 class SmsPluginConcatHandler
85 {
86 public:
87         static SmsPluginConcatHandler* instance();
88
89         bool IsConcatMsg(SMS_USERDATA_S *pUserData);
90         void handleConcatMsg(SMS_TPDU_S *pTpdu);
91 //      void handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t SimMsgId, bool bRead);
92
93 //      void handleBrokenMsg();
94
95 private:
96         SmsPluginConcatHandler();
97         virtual ~SmsPluginConcatHandler();
98
99         static SmsPluginConcatHandler* pInstance;
100
101         unsigned char checkConcatMsg(SMS_CONCAT_MSG_S *pConcatMsg, SMS_USERDATA_S *pUserData);
102         int makeConcatUserData(unsigned short MsgRef, char **ppTotalData);
103
104         void convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo);
105 //      void convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pConcatMsg, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo);
106
107         void removeFromConcatList(unsigned short MsgRef);
108
109 //      void addToSimIdList(unsigned short MsgRef, msg_sim_id_t SimMsgId);
110 //      void removeFromSimIdList(unsigned short MsgRef);
111
112         vector<SMS_CONCAT_INFO_S> concatList;
113 //      vector<SMS_SIM_ID_S> simIdList;
114
115         MsgTextConvert textCvt;
116 };
117
118 #endif //SMS_PLUGIN_CONCAT_HANDLER_H