update tizen source
[framework/messaging/msg-service.git] / mapi / MapiSetting.cpp
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 #include <errno.h>
32
33 #include "MsgHandle.h"
34 #include "MsgDebug.h"
35 #include "MsgException.h"
36 #include "MapiSetting.h"
37
38
39 /*==================================================================================================
40                                      FUNCTION IMPLEMENTATION
41 ==================================================================================================*/
42 EXPORT_API int msg_set_config(MSG_HANDLE_T handle, const MSG_SETTING_S *setting)
43 {
44         MSG_ERROR_T err =  MSG_SUCCESS;
45
46         if (handle == NULL || setting == NULL)
47         {
48                 return -EINVAL;
49         }
50
51         MsgHandle* pHandle = (MsgHandle*)handle;
52
53         try
54         {
55                 err = pHandle->setConfig(setting);
56         }
57         catch (MsgException& e)
58         {
59                 MSG_FATAL("%s", e.what());
60                 return MSG_ERR_SET_WRITE_ERROR;
61         }
62
63         return err;
64 }
65
66
67 EXPORT_API int msg_get_config(MSG_HANDLE_T handle, MSG_SETTING_S *setting)
68 {
69         MSG_ERROR_T err =  MSG_SUCCESS;
70
71         if (handle == NULL || setting == NULL)
72         {
73                 return -EINVAL;
74         }
75
76         MsgHandle* pHandle = (MsgHandle*)handle;
77
78         try
79         {
80                 err = pHandle->getConfig(setting);
81         }
82         catch (MsgException& e)
83         {
84                 MSG_FATAL("%s", e.what());
85                 return MSG_ERR_SET_READ_ERROR;
86         }
87
88         return err;
89 }
90