update tizen source
[framework/messaging/msg-service.git] / test_app / MsgTestStorage.h
1 /*
2 *
3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
4 *
5 * This file is part of msg-service.
6 *
7 * Contact: Jaeyun Jeong <jyjeong@samsung.com>
8 *          Sangkoo Kim <sangkoo.kim@samsung.com>
9 *          Seunghwan Lee <sh.cat.lee@samsung.com>
10 *          SoonMin Jung <sm0415.jung@samsung.com>
11 *          Jae-Young Lee <jy4710.lee@samsung.com>
12 *          KeeBum Kim <keebum.kim@samsung.com>
13 *
14 * PROPRIETARY/CONFIDENTIAL
15 *
16 * This software is the confidential and proprietary information of
17 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
18 * disclose such Confidential Information and shall use it only in
19 * accordance with the terms of the license agreement you entered
20 * into with SAMSUNG ELECTRONICS.
21 *
22 * SAMSUNG make no representations or warranties about the suitability
23 * of the software, either express or implied, including but not limited
24 * to the implied warranties of merchantability, fitness for a particular
25 * purpose, or non-infringement. SAMSUNG shall not be liable for any
26 * damages suffered by licensee as a result of using, modifying or
27 * distributing this software or its derivatives.
28 *
29 */
30
31
32 /**
33  *      @file           MsgTestStorage.h
34  *      @brief          Defines storage test function of messaging framework
35  *      @version                1.0
36  */
37
38 #ifndef MSG_TEST_STORAGE_H
39 #define MSG_TEST_STORAGE_H
40
41 /**
42  *      @section                Introduction
43  *      - Introduction : Overview on Messaging Storage Test Function
44  *      @section                Program
45  *      - Program : Messaging Storage Test Function Reference
46  */
47
48 /*==================================================================================================
49                                          INCLUDE FILES
50 ==================================================================================================*/
51
52 #include "MsgTypes.h"
53
54 /**
55  *      @ingroup                MESSAGING_FRAMEWORK
56  *      @defgroup       MESSAGING_STORAGE_TEST_FUNCTION Messaging Storage Test Function
57  *      @{
58  */
59
60 /*==================================================================================================
61                                      FUNCTION PROTOTYPES
62 ==================================================================================================*/
63
64 /**     @fn             void MsgTestAddMessage(MSG_HANDLE_T hMsgHandle)
65  *      @brief  Tests MsgAddMessage.
66  *      @param[in]      hMsgHandle is Message handle. \n
67  */
68 void MsgTestAddMessage(MSG_HANDLE_T hMsgHandle);
69
70
71 /**     @fn             void MsgTestGetMessage(MSG_HANDLE_T hMsgHandle, int MsgId)
72  *      @brief  Tests MsgGetMessage.
73  *      @param[in]      hMsgHandle is Message handle. \n
74  *      @param[in]      MsgId is the ID of the message to be returned. \n
75  */
76 void MsgTestGetMessage(MSG_HANDLE_T hMsgHandle, int MsgId);
77
78
79 /**     @fn             void MsgTestGetMessageList(MSG_HANDLE_T hMsgHandle, int FolderId)
80  *      @brief  Tests MsgGetMsgCommInfoList.
81  *      @param[in]      hMsgHandle is Message handle. \n
82  *      @param[in]      FolderId is the ID of the folder to be returned. \n
83  */
84 void MsgTestGetMessageList(MSG_HANDLE_T hMsgHandle, int FolderId);
85
86
87 /**     @fn             void MsgTestUpdateMessage(MSG_HANDLE_T hMsgHandle, msg_message_t *pMsg)
88  *      @brief  Tests MsgUpdateMessage.
89  *      @param[in]      hMsgHandle is Message handle. \n
90  *      @param[in]      pMsg is a pointer to an msg_message_t structure. \n
91  */
92 void MsgTestUpdateMessage(MSG_HANDLE_T hMsgHandle, msg_message_t pMsg);
93
94 /**     @fn             void MsgTestUpdateMMSMessage(MSG_HANDLE_T hMsgHandle, MSG_MESSAGE_ID_T nMsgId)
95  *      @brief  Tests MsgUpdateMessage.
96  *      @param[in]      hMsgHandle is Message handle. \n
97  *      @param[in]      pMsg is a pointer to an msg_message_t structure. \n
98  */
99 void MsgTestUpdateMMSMessage(MSG_HANDLE_T hMsgHandle, MSG_MESSAGE_ID_T nMsgId);
100
101 /**     @fn             void MsgTestMoveMessage(MSG_HANDLE_T hMsgHandle, MSG_MESSAGE_ID_T MsgId)
102  *      @brief  Tests MsgMoveMessageToFolder.
103  *      @param[in]      hMsgHandle is Message handle. \n
104  *      @param[in]      MsgId is the ID of the message to be moved. \n
105  */
106 void MsgTestMoveMessage(MSG_HANDLE_T hMsgHandle, MSG_MESSAGE_ID_T MsgId);
107
108
109 /**     @fn             void MsgTestMoveStorageMessage(MSG_HANDLE_T hMsgHandle, MSG_MESSAGE_ID_T MsgId, MSG_STORAGE_ID_T storageId)
110  *      @brief  Tests MsgMoveMessageToStorage.
111  *      @param[in]      hMsgHandle is Message handle. \n
112  *      @param[in]      MsgId is the ID of the message to be moved. \n
113  *      @param[in]      storageId is the destination storage ID. \n
114  */
115 void MsgTestMoveStorageMessage(MSG_HANDLE_T hMsgHandle, msg_message_t pMsg);
116
117
118 /**     @fn             void MsgTestAddFolder(MSG_HANDLE_T hMsgHandle)
119  *      @brief  Tests MsgAddFolder.
120  *      @remarks
121         Pre-condition : The storage has to be properly setup and initialized. \n
122         The code below is to create folder.
123  *      @code
124         void MsgTestAddFolder(MSG_HANDLE_T hMsgHandle)
125         {
126                 if (hMsgHandle == NULL)
127                 {
128                         MSG_DEBUG("Handle is NULL");
129                         return;
130                 }
131
132                 MSG_ERROR_T err = MSG_SUCCESS;
133
134                 // Make Folder
135                 MSG_FOLDER_INFO_S folderInfo;
136
137                 folderInfo.folderId = g_folderList.nCount + 1;
138                 folderInfo.folderType = MSG_FOLDER_TYPE_USER_DEF;
139
140                 char strName[MAX_FOLDER_NAME_SIZE+1];
141                 memset(strName, 0x00, sizeof(strName));
142                 cin.getline(strName, MAX_FOLDER_NAME_SIZE);
143                 strncpy(folderInfo.folderName, strName, MAX_FOLDER_NAME_SIZE);
144
145                 MSG_DEBUG("folderId [%d]", folderInfo.folderId);
146                 MSG_DEBUG("folderType [%d]", folderInfo.folderType);
147                 MSG_DEBUG("folderName [%s]", folderInfo.folderName);
148
149                 print("Start Creating New Folder...");
150
151                 // Create Folder
152                 err = MsgAddFolder(hMsgHandle, &folderInfo);
153
154                 if (err == MSG_SUCCESS)
155                         print("Creating New Folder is OK!");
156                 else
157                         print("Creating New Folder is failed!");
158         }
159  *      @endcode
160  *      @param[in]      hMsgHandle is Message handle.
161  */
162 void MsgTestAddFolder(MSG_HANDLE_T hMsgHandle);
163
164
165 /**     @fn             void MsgTestUpdateFolder(MSG_HANDLE_T hMsgHandle)
166  *      @brief  Tests MsgUpdateFolder.
167  *      @param[in]      hMsgHandle is Message handle.
168  */
169 void MsgTestUpdateFolder(MSG_HANDLE_T hMsgHandle);
170
171
172 /**     @fn             void MsgTestDeleteFolder(MSG_HANDLE_T hMsgHandle)
173  *      @brief  Tests MsgDeleteFolder.
174  *      @param[in]      hMsgHandle is Message handle.
175  */
176 void MsgTestDeleteFolder(MSG_HANDLE_T hMsgHandle);
177
178 void MsgTestDeleteMessage(MSG_HANDLE_T hMsgHandle, MSG_MESSAGE_ID_T nMsgId);
179
180 /**     @fn             void MsgPrintMMSBody(msg_message_t pMsg)
181  *      @brief  Prints mms body's (content) information.
182  *      @param[in]      pMsg is a pointer to an msg_message_t structure. \n
183  */
184 void MsgPrintMMSBody(msg_message_t pMsg);
185
186 /**     @fn             void MsgPrintMessage(MSG_HANDLE_T hMsgHandle, msg_message_t *pMsg)
187  *      @brief  Prints message information.
188  *      @param[in]      hMsgHandle is Message handle. \n
189  *      @param[in]      pMsg is a pointer to an msg_message_t structure. \n
190  */
191 void MsgPrintMessage(MSG_HANDLE_T hMsgHandle, msg_message_t pMsg, MSG_SENDINGOPT_S* pSendOpt);
192
193
194 /**     @fn             void MsgRunMsgMenu(MSG_HANDLE_T hMsgHandle, char Menu, msg_message_t *pMsg)
195  *      @brief  Runs the selected function in the message menu.
196  *      @param[in]      hMsgHandle is Message handle. \n
197  *      @param[in]      Menu indicates which menu is selected. \n
198  *      @param[in]      pMsg is a pointer to an msg_message_t structure. \n
199  */
200 void MsgRunMsgMenu(MSG_HANDLE_T hMsgHandle, char Menu, msg_message_t pMsg, MSG_SENDINGOPT_S *pSendOpt);
201
202
203 /**     @fn             void MsgRunMsgListMenu(MSG_HANDLE_T hMsgHandle, char *pMenu, int FolderId, MSG_MAIN_TYPE_T mainType, MSG_NETWORK_STATUS_T NetworkStatus)
204  *      @brief  Runs the selected function in the message list menu.
205  *      @param[in]      hMsgHandle is Message handle. \n
206  *      @param[in]      pMenu is a pointer that indicates which menu is selected. \n
207  *      @param[in]      FolderId is the ID of the folder to be run. \n
208  */
209 void MsgRunMsgListMenu(MSG_HANDLE_T hMsgHandle, int MsgId, int FolderId, MSG_MESSAGE_TYPE_T MsgType, MSG_NETWORK_STATUS_T NetworkStatus);
210
211
212 /**     @fn             void MsgGetCurrentTime(time_t *pTime)
213  *      @brief  Gets the current time.
214  *      @param[out]     pTime is a pointer that indicates the current time.
215  */
216 void MsgGetCurrentTime(time_t *pTime);
217
218
219 /**     @fn             char* MsgConvertMsgType(MSG_MAIN_TYPE_T MainType)
220  *      @brief  Converts the message type.
221  *      @param[in]      MainType indicates the message type to be returned.
222  *      @retval SMS \n
223  *      @retval MMS \n
224  *      @retval EMAIL \n
225  */
226 const char* MsgConvertMsgType(MSG_MESSAGE_TYPE_T MsgType);
227
228 const char* MsgConvertStorageId(MSG_STORAGE_ID_T StorageId);
229
230 const char* MsgConvertNetworkStatus(MSG_NETWORK_STATUS_T status);
231
232 /**     @fn             char* MsgConvertReadStatus(bool ReadStatus)
233  *      @brief  Converts the read status of a message.
234  *      @param[in]      ReadStatus indicates whether a message is read or not.
235  *      @retval READ \n
236  *      @retval UNREAD \n
237  */
238 const char* MsgConvertReadStatus(bool ReadStatus);
239
240
241 /**     @fn             char* MsgConvertProtectedStatus(bool ProtectedStatus)
242  *      @brief  Converts the protected status of a message.
243  *      @param[in]      ProtectedStatus indicates whether a message is protected or not.
244  *      @retval PROTECTED \n
245  *      @retval UNPROTECTED \n
246  */
247 const char* MsgConvertProtectedStatus(bool ProtectedStatus);
248
249
250 /**     @fn             char* MsgConvertTime(const time_t *pTime)
251  *      @brief  Converts the time_t value to string.
252  *      @param[in]      time_t value.
253  *      @retval String type time present. \n
254  */
255 void MsgConvertTime(time_t *pTime, char *pDisplayTme);
256
257 //MSG_ERROR_T convertMsgStruct(const msg_message_t *pSource, MSG_MESSAGE_INFO_S *pDest);
258
259 MSG_ERROR_T MsgTestSendReadReport(MSG_HANDLE_T hMsgHandle, msg_message_t pMsg, int mmsReadStatus, int version);
260
261 void MsgTestForwardMMSMessage(MSG_HANDLE_T hMsgHandle, MSG_MESSAGE_ID_T nMsgId);
262
263 void MsgTestRetrieveMessage(MSG_HANDLE_T hMsgHandle, MSG_MESSAGE_ID_T nMsgId);
264
265 void MsgTestMsgGen(MSG_HANDLE_T hMsgHandle);
266
267 //thread view
268 void MsgThreadViewMain(MSG_HANDLE_T hMsgHandle);
269
270 void MsgRunThreadViewMenu(MSG_HANDLE_T  hMsgHandle, MSG_THREAD_LIST_INDEX_S *pAddrList);
271
272 /**
273  *      @}
274  */
275
276
277 #endif //MSG_TEST_STORAGE_H
278