Fix issue : fail to make thumbnail
[platform/core/messaging/msg-service.git] / plugin / sms_plugin / include / SmsPluginSetting.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_SETTING_H
18 #define SMS_PLUGIN_SETTING_H
19
20
21 /*==================================================================================================
22                                          INCLUDE FILES
23 ==================================================================================================*/
24 #include "MsgMutex.h"
25 #include "MsgSettingTypes.h"
26 #include <list>
27 #include <map>
28
29 extern "C"
30 {
31         #include <tapi_common.h>
32 }
33
34 typedef map <int, MSG_SMSC_LIST_S> smscListMap;
35 typedef map <int, SMS_SIM_MAILBOX_LIST_S> smsSimMailboxListMap;
36 typedef map <int, SMS_SIM_MWI_INFO_S> simMwiInfoMap;
37 typedef map <int, MSG_CBMSG_OPT_S>      cbOptMap;
38
39 /*==================================================================================================
40                                      CLASS DEFINITIONS
41 ==================================================================================================*/
42 class SmsPluginSetting
43 {
44 public:
45         static SmsPluginSetting* instance();
46
47         void setConfigData(const MSG_SETTING_S *pSetting);
48         void getConfigData(MSG_SETTING_S *pSetting);
49         void getMeImei(char *pImei);
50
51         void setParamCntEvent(int ParamCnt);
52         void setParamEvent(TapiHandle *handle, const MSG_SMSC_DATA_S *pSmscData, int RecordIdx, bool bSuccess);
53         void setCbConfigEvent(TapiHandle *handle, const MSG_CBMSG_OPT_S *pCbOpt, bool bSuccess);
54         void setMailboxInfoEvent(TapiHandle *handle, SMS_SIM_MAILBOX_LIST_S *pVoiceOpt, bool bSuccess, bool bMbdn);
55         void setMwiInfo(int simIndex, MSG_SUB_TYPE_T type, int count);
56         void setMwiInfoEvent(TapiHandle *handle, SMS_SIM_MWI_INFO_S *pMwiInfo, bool bSuccess);
57         void setResultFromSim(bool bResult);
58         void setResultImei(bool bResult, char *pImei);
59
60         void setSmscInfo(const MSG_SMSC_LIST_S *pSmscList);
61
62         void setSimChangeStatus(TapiHandle *handle, bool bInitializing);
63         void getSmscListInfo(int simIndex, MSG_SMSC_LIST_S *pSmscList);
64         void SimRefreshCb(TapiHandle *handle);
65
66 private:
67         SmsPluginSetting();
68         ~SmsPluginSetting();
69
70         void updateSimStatus(TapiHandle *handle);
71
72         void initConfigData(TapiHandle *handle);
73         static void* init_config_data(void *data);
74         static void* initSimInfo(void *data);
75         void* processInitSimInfo(void *data);
76
77         void addSMSCList(MSG_SMSC_LIST_S *pSmscList);
78
79         msg_error_t addCbOpt(MSG_CBMSG_OPT_S *pCbOpt);
80         void getCbOpt(MSG_SETTING_S *pSetting, int simIndex);
81
82         void setParamList(const MSG_SMSC_LIST_S *pSMSCList);
83         void getParamList(MSG_SMSC_LIST_S *pSMSCList);
84
85         int getParamCount(TapiHandle *handle);
86         bool getParam(TapiHandle *handle, int Index, MSG_SMSC_DATA_S *pSmscData);
87
88         bool setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt);
89         bool getCbConfig(MSG_CBMSG_OPT_S *pCbOpt);
90
91         void setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt);
92         bool getVoiceMailInfo(TapiHandle *handle);
93
94         bool getMwiInfo(TapiHandle *handle);
95         bool getMsisdnInfo(TapiHandle *handle);
96         bool getSimServiceTable(TapiHandle *handle);
97         bool getResultImei(char *pImei);
98
99         int getParamCntEvent();
100         bool getParamEvent(TapiHandle *handle, MSG_SMSC_DATA_S *pSmscData);
101         bool getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt);
102
103         bool getMailboxInfoEvent();
104
105         bool getResultFromSim();
106
107         SMS_PID_T convertPid(MSG_SMS_PID_T pid);
108         void deliverVoiceMsgNoti(int simIndex, int mwiCnt);
109
110         static SmsPluginSetting* pInstance;
111         std::list<TapiHandle *> tel_handle_list;
112
113         /* Setting values for keeping in setting instance */
114         smscListMap                     smscList;
115         MSG_SIM_STATUS_T                simStatus[MAX_TELEPHONY_HANDLE_CNT+1];
116         MSG_SMSC_DATA_S                 smscData[MAX_TELEPHONY_HANDLE_CNT+1];
117         smsSimMailboxListMap    simMailboxList;
118         simMwiInfoMap                   simMwiInfo;
119         cbOptMap                                cbOpt;
120
121         /* Local values for getting from SIM(TAPI) */
122         bool    bTapiResult;
123         int             paramCnt;
124         int             selectedParam;
125         int     selectedSimIndex;
126         char    meImei[MAX_ME_IMEI_LEN + 1];
127
128         bool    bMbdnEnable[MAX_TELEPHONY_HANDLE_CNT];
129
130         MsgMutex mx;
131         MsgCndVar cv;
132 };
133
134 #endif /* SMS_PLUGIN_SETTING_H */
135