summaryrefslogtreecommitdiff
path: root/notification/include/notification_setting.h
blob: 9186cd6f8679d6e2c12977010036df80da0468f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
/*
 * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __NOTIFICATION_SETTING_H__
#define __NOTIFICATION_SETTING_H__

#include <stdbool.h>
#include <sys/types.h>

#include "notification.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct notification_setting *notification_setting_h;

/**
 * @internal
 * @brief Gets setting handle of current process.
 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
 * @param[out] setting The setting handle
 * @return #NOTIFICATION_ERROR_NONE on success,
 *         otherwise any other value on failure
 * @retval #NOTIFICATION_ERROR_NONE Success
 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Already exist private ID
 * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error
 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied
 * @par sample code:
 * @code
#include <notification_setting.h>
...
{
	int noti_err = 0;
	notification_setting_h setting = NULL;

	noti_err = notification_setting_get_setting(&setting);
	if (noti_err != NOTIFICATION_ERROR_NONE)
		return;
}
 * @endcode
 */
int notification_setting_get_setting(notification_setting_h *setting);

/**
 * @internal
 * @brief Gets value which whether information on the notification view is visible.
 * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif
 * @param[in] setting	The notification setting handle
 * @param[out] value	The visibility_class value
 * @return #NOTIFICATION_ERROR_NONE on success,
 *         otherwise any other value on failure
 * @retval #NOTIFICATION_ERROR_NONE         Success
 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @par sample code:
 * @code
#include <notification_setting.h>
...
{
	int noti_err = 0;
	bool value;
	notification_setting_h setting = NULL;

	...

	noti_err = notification_setting_get_visibility_class(setting, &value);
	if (noti_err != NOTIFICATION_ERROR_NONE) {
		return;
	}

	notification_setting_free_notification(setting);

	return 0;

}
 * @endcode
 */
int notification_setting_get_visibility_class(notification_setting_h setting, int *value);

/**
 * @internal
 * @brief Sets value which whether information on the notification view is visible.
 * @details After notification_setting_update_setting() call, the visibility_class value is not updated.
 * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif
 * @param[in] setting	The notification setting handle
 * @param[in] value	The visibility_class value
 * @return #NOTIFICATION_ERROR_NONE on success,
 *         otherwise any other value on failure
 * @retval #NOTIFICATION_ERROR_NONE         Success
 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @par sample code:
 * @code
#include <notification_setting.h>
...
{
	int noti_err = 0;
	bool value;
	notification_setting_h setting = NULL;

	...

	value = true;	// or false

	noti_err = notification_setting_set_visibility_class(setting, value);
	if (noti_err != NOTIFICATION_ERROR_NONE) {
		return;
	}

	notification_setting_free_notification(setting);

	return 0;

}
 * @endcode
 */
int notification_setting_set_visibility_class(notification_setting_h setting, int value);

/**
 * @internal
 * @brief Updates the notification setting handle.
 * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif
 * @privlevel public
 * @privilege %http://tizen.org/privilege/notification
 * @param[in] setting	The notification setting handle
 * @return #NOTIFICATION_ERROR_NONE on success,
 *         otherwise any other value on failure
 * @retval #NOTIFICATION_ERROR_NONE         Success
 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error
 * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service
 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied
 * @par sample code:
 * @code
#include <notification_setting.h>
...
{
	int noti_err = 0;
	bool value;
	notification_setting_h setting = NULL;

	...

	noti_err = notification_setting_update_setting(setting);
	if (noti_err != NOTIFICATION_ERROR_NONE) {
		return;
	}

	notification_setting_free_notification(setting);

	return 0;

}
 * @endcode
 */
int notification_setting_update_setting(notification_setting_h setting);

/**
 * @internal
 * @brief Frees the internal structure data of a notification setting handle.
 * @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif
 * @param[in] setting	The notification setting handle
 * @return #NOTIFICATION_ERROR_NONE on success,
 *         otherwise any other value on failure
 * @retval #NOTIFICATION_ERROR_NONE         Success
 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @par sample code:
 * @code
#include <notification_setting.h>
...
{
	int noti_err = 0;
	notification_setting_h setting = NULL;

	...

	noti_err = notification_setting_free_notification(setting);
	if (noti_err != NOTIFICATION_ERROR_NONE) {
		return;
	}

	return 0;

}
 * @endcode
 */
int notification_setting_free_notification(notification_setting_h setting);

/**
 * @internal
 * @brief Refreshs the setting table of current user.
 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
 * @param[in] uid User id
 * @return #NOTIFICATION_ERROR_NONE on success,
 *         otherwise any other value on failure
 * @retval #NOTIFICATION_ERROR_NONE Success
 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #NOTIFICATION_ERROR_FROM_DB Error from DB query
 * @par sample code:
 * @code
#include <notification_setting.h>
...
{
	int ret;

	ret = notification_setting_refresh_setting_table(uid);
	if (ret = NOTIFICATION_ERROR_NONE)
		return;
}
 * @endcode
 */
int notification_setting_refresh_setting_table(uid_t uid);

/**
 * @internal
 * @brief Initializes the system setting table of the current user.
 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
 * @param[in] uid User id
 * @return #NOTIFICATION_ERROR_NONE on success,
 *         otherwise any other value on failure
 * @retval #NOTIFICATION_ERROR_NONE Success
 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Already exist private ID
 * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error
 * @par sample code:
 * @code
#include <notification_setting.h>
...
{
	int ret;

	ret = notification_system_setting_init_system_setting_table(uid);
	if (ret != NOTIFICATION_ERROR_NONE)
		return;
}
 * @endcode
 */
int notification_system_setting_init_system_setting_table(uid_t uid);

#ifdef __cplusplus
}
#endif
#endif /* __NOTIFICATION_SETTING_H__ */