73094fc234b3187eaf704218e83473de07650134
[framework/messaging/msg-service.git] / plugin / sms_plugin / include / SmsPluginSimMsg.h
1  /*
2   * Copyright 2012  Samsung Electronics Co., Ltd
3   *
4   * Licensed under the Flora License, Version 1.0 (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://www.tizenopensource.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 #ifndef _TAPI_NETTEXT_H_
33         #include "ITapiNetText.h"
34         #include "ITapiSim.h"
35 #endif
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 setSimEvent(MSG_SIM_ID_T SimId, bool bResult);
57
58 private:
59         SmsPluginSimMsg();
60         ~SmsPluginSimMsg();
61
62         void getSimMsgCount(MSG_SIM_COUNT_S *pSimMsgCnt);
63         bool getSimMsg(MSG_SIM_ID_T SimMsgId, MSG_MESSAGE_INFO_S* pMsgInfo);
64
65         void setSmsOptions(SMS_DELIVER_S *pDeliver);
66         void convertTimeStamp(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_DELIVER_S *pDeliver);
67
68         bool getSimMsgCntEvent(MSG_SIM_COUNT_S *pSimMsgCnt);
69         bool getSimMsgEvent(MSG_MESSAGE_INFO_S *pMsgInfo);
70         bool getSimEvent(MSG_SIM_ID_T *pSimId);
71
72         static SmsPluginSimMsg* pInstance;
73
74         MSG_SIM_ID_T                    simMsgId;
75
76         MSG_SIM_COUNT_S                 simMsgCnt;
77
78         MSG_MESSAGE_INFO_S              simMsgInfo;
79
80         unsigned int                            usedCnt;
81         unsigned int                            totalCnt;
82
83         bool                                            bTapiResult;
84         bool                                            bClass2Msg;
85
86         Mutex mx;
87         CndVar cv;
88 };
89
90 #endif //SMS_PLUGIN_SIMMSG_H
91