Modify flora license version.
[platform/core/messaging/msg-service.git] / plugin / sms_plugin / include / SmsPluginSimMsg.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_SIMMSG_H
18 #define SMS_PLUGIN_SIMMSG_H
19
20
21 /*==================================================================================================
22                                          INCLUDE FILES
23 ==================================================================================================*/
24 #include "MsgMutex.h"
25
26 #include "MsgStorageTypes.h"
27 #include "SmsPluginTypes.h"
28 #include "MsgInternalTypes.h"
29
30 extern "C"
31 {
32         #include <tapi_common.h>
33         #include <TelSms.h>
34         #include <TapiUtility.h>
35         #include <ITapiNetText.h>
36 }
37
38 /*==================================================================================================
39                                      CLASS DEFINITIONS
40 ==================================================================================================*/
41 class SmsPluginSimMsg
42 {
43 public:
44         static SmsPluginSimMsg* instance();
45
46         void initSimMessage();
47         msg_error_t saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList);
48         msg_error_t saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInfo);
49         void deleteSimMessage(msg_sim_id_t SimMsgId);
50         void getSimMessageList(MSG_SIM_MSG_INFO_LIST_S **ppSimMsgList);
51         void setReadStatus(msg_sim_id_t SimMsgId);
52         bool checkSimMsgFull(unsigned int SegCnt);
53
54         void setSimMsgCntEvent(const MSG_SIM_COUNT_S *pSimMsgCnt);
55         void setSimMsgEvent(const MSG_MESSAGE_INFO_S *pMsgInfo, bool bSuccess);
56         void setSaveSimMsgEvent(int simMsgId, int result);
57         void setSaveClass2MsgEvent(int simMsgId, int result);
58         void setSimEvent(msg_sim_id_t SimId, bool bResult);
59
60         void setSmsData(const char *sca, const char *szData, int msgLength);
61
62 private:
63         SmsPluginSimMsg();
64         ~SmsPluginSimMsg();
65
66         void getSimMsgCount(MSG_SIM_COUNT_S *pSimMsgCnt);
67         bool getSimMsg(msg_sim_id_t SimMsgId, MSG_MESSAGE_INFO_S* pMsgInfo);
68
69         void setSmsOptions(SMS_DELIVER_S *pDeliver);
70         void convertTimeStamp(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_DELIVER_S *pDeliver);
71
72         bool getSimMsgCntEvent(MSG_SIM_COUNT_S *pSimMsgCnt);
73         bool getSimMsgEvent(MSG_MESSAGE_INFO_S *pMsgInfo);
74         bool getSimEvent(msg_sim_id_t *pSimId);
75
76         static SmsPluginSimMsg* pInstance;
77
78         msg_sim_id_t                            simMsgId;
79
80         MSG_SIM_COUNT_S                 simMsgCnt;
81
82         MSG_MESSAGE_INFO_S              simMsgInfo;
83
84         unsigned int                            usedCnt;
85         unsigned int                            totalCnt;
86
87         bool                                            bTapiResult;
88
89         SMS_DATA_INFO_S                 simMsgDataInfo;
90
91         Mutex mx;
92         CndVar cv;
93 };
94
95 #endif //SMS_PLUGIN_SIMMSG_H
96