Fix issue : fail to make thumbnail
[platform/core/messaging/msg-service.git] / plugin / sms_plugin / include / SmsPluginSimMsg.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
3  *
4  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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(struct tapi_handle *handle);
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_slot_id_t sim_idx, msg_sim_id_t SimMsgId);
50         void setReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId);
51         bool checkSimMsgFull(msg_sim_slot_id_t sim_idx, unsigned int SegCnt);
52
53         void setSimMsgCntEvent(struct tapi_handle *handle, const MSG_SIM_COUNT_S *pSimMsgCnt);
54         void setSimMsgEvent(struct tapi_handle *handle, const MSG_MESSAGE_INFO_S *pMsgInfo, bool bSuccess);
55         void setSaveSimMsgEvent(struct tapi_handle *handle, int simId, int result);
56         void setSaveClass2MsgEvent(struct tapi_handle *handle, int simId, int result, MSG_MESSAGE_INFO_S *data);
57         void setSimEvent(msg_sim_id_t SimId, bool bResult);
58         void setUpdateSimEvent(int SimId, bool bResult);
59         void setDelSimEvent(int SimId, bool bResult);
60
61         void setSmsData(const char *sca, const char *szData, int msgLength);
62         void setSmsTpduTotalSegCount(int totalSeg);
63
64 private:
65         SmsPluginSimMsg();
66         ~SmsPluginSimMsg();
67
68         void getSimMsgCount(struct tapi_handle *handle, MSG_SIM_COUNT_S *pSimMsgCnt);
69         bool getSimMsg(struct tapi_handle *handle, msg_sim_id_t SimMsgId, MSG_MESSAGE_INFO_S* pMsgInfo, int *simIdList);
70
71         void setSmsOptions(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_DELIVER_S *pDeliver);
72         void convertTimeStamp(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_DELIVER_S *pDeliver);
73
74         bool getSimMsgCntEvent(struct tapi_handle *handle, MSG_SIM_COUNT_S *pSimMsgCnt);
75         bool getSimMsgEvent(struct tapi_handle *handle, MSG_MESSAGE_INFO_S *pMsgInfo);
76         bool getSimEvent(msg_sim_id_t *pSimId);
77         bool getUpdateSimEvent();
78         bool getDelSimEvent(int *pSimId);
79
80
81         static SmsPluginSimMsg* pInstance;
82
83         msg_sim_id_t                            simMsgId;
84         int                             delSimMsgId;
85         int             simIdList[MAX_SIM_SMS_NUM];             /** send total simIds to handleSimMsg **/
86
87         MSG_SIM_COUNT_S                 simMsgCnt;
88
89         MSG_MESSAGE_INFO_S              simMsgInfo;
90         MSG_ADDRESS_INFO_S              simAddrInfo;
91
92         int                                     usedCnt;
93         int                                     totalCnt;
94
95         bool                                            bTapiResult;
96
97         SMS_DATA_INFO_S                 simMsgDataInfo;
98
99         MsgMutex mx;
100         MsgCndVar cv;
101 };
102
103 #endif /* SMS_PLUGIN_SIMMSG_H */
104