Update behaivor of some func in stub.cc
[platform/core/api/notification.git] / notification-ex / stub.cc
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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 #include <dlog.h>
18 #include <glib.h>
19 #include <unistd.h>
20
21 #include <list>
22
23 #include "api/notification_ex_app_control_action.h"
24 #include "api/notification_ex_button.h"
25 #include "api/notification_ex_chat_message.h"
26 #include "api/notification_ex_checkbox.h"
27 #include "api/notification_ex_entry.h"
28 #include "api/notification_ex_event_info.h"
29 #include "api/notification_ex_group.h"
30 #include "api/notification_ex_image.h"
31 #include "api/notification_ex_input_selector.h"
32 #include "api/notification_ex_item.h"
33 #include "api/notification_ex_manager.h"
34 #include "api/notification_ex_progress.h"
35 #include "api/notification_ex_reporter.h"
36 #include "api/notification_ex_text.h"
37 #include "api/notification_ex_time.h"
38 #include "api/notification_ex_visibility_action.h"
39 #include "notification-ex/reporter.h"
40 #include "notification-ex/app_control_action.h"
41 #include "notification-ex/button_item.h"
42 #include "notification-ex/chat_message_item.h"
43 #include "notification-ex/checkbox_item.h"
44 #include "notification-ex/entry_item.h"
45 #include "notification-ex/group_item.h"
46 #include "notification-ex/input_selector_item.h"
47 #include "notification-ex/abstract_item.h"
48 #include "notification-ex/progress_item.h"
49 #include "notification-ex/time_item.h"
50 #include "notification-ex/visibility_action.h"
51
52 #ifdef LOG_TAG
53 #undef LOG_TAG
54 #endif
55 #define LOG_TAG "NOTIFICATION_EX"
56
57 #ifdef EXPORT_API
58 #undef EXPORT_API
59 #endif
60 #define EXPORT_API __attribute__((visibility("default")))
61
62 using namespace std;
63 using namespace notification::item;
64
65 extern "C" EXPORT_API int noti_ex_action_app_control_create(
66     noti_ex_action_h *handle, app_control_h app_control,
67     const char *extra) {
68   if (handle == nullptr || app_control == nullptr) {
69     LOGE("Invalid parameter");
70     return NOTI_EX_ERROR_INVALID_PARAMETER;
71   }
72
73   auto* p = new (std::nothrow) AppControlAction(app_control, extra);
74   if (p == nullptr) {
75     LOGE("Out-of-memory");
76     return NOTI_EX_ERROR_OUT_OF_MEMORY;
77   }
78
79   *handle = p;
80
81   return NOTI_EX_ERROR_NONE;
82 }
83
84 extern "C" EXPORT_API int noti_ex_action_app_control_set(
85     noti_ex_action_h handle, app_control_h app_control) {
86   if (handle == nullptr || app_control == nullptr) {
87     LOGE("Invalid parameter");
88     return NOTI_EX_ERROR_INVALID_PARAMETER;
89   }
90
91   AppControlAction* p = static_cast<AppControlAction*>(handle);
92   p->SetAppControl(app_control);
93
94   return NOTI_EX_ERROR_NONE;
95 }
96
97 extern "C" EXPORT_API int noti_ex_action_app_control_get(
98     noti_ex_action_h handle, app_control_h *app_control) {
99   if (handle == nullptr || app_control == nullptr) {
100     LOGE("Invalid parameter");
101     return NOTI_EX_ERROR_INVALID_PARAMETER;
102   }
103
104   AppControlAction* p = static_cast<AppControlAction*>(handle);
105   *app_control = p->GetAppControl();
106
107   return NOTI_EX_ERROR_NONE;
108 }
109
110 extern "C" EXPORT_API int noti_ex_item_button_create(noti_ex_item_h *handle,
111     const char *id, const char *title) {
112   ButtonItem* p;
113
114   if (handle == nullptr || title == nullptr) {
115     LOGE("Invalid parameter");
116     return NOTI_EX_ERROR_INVALID_PARAMETER;
117   }
118
119   if (id)
120     p = new (std::nothrow) ButtonItem(id, title);
121   else
122     p = new (std::nothrow) ButtonItem(title);
123
124   if (p == nullptr) {
125     LOGE("Out-of-memory");
126     return NOTI_EX_ERROR_OUT_OF_MEMORY;
127   }
128
129   *handle = p;
130
131   return NOTI_EX_ERROR_NONE;
132 }
133
134 extern "C" EXPORT_API int noti_ex_item_button_get_title(noti_ex_item_h handle,
135     char **title) {
136   if (handle == nullptr || title == nullptr) {
137     LOGE("Invalid parameter");
138     return NOTI_EX_ERROR_INVALID_PARAMETER;
139   }
140
141   ButtonItem* p = static_cast<ButtonItem*>(handle);
142   if (!p->GetTitle().empty()) {
143     *title = strdup(p->GetTitle().c_str());
144     if (*title == nullptr) {
145       LOGE("Out-of-memory");
146       return NOTI_EX_ERROR_OUT_OF_MEMORY;
147     }
148   }
149
150   return NOTI_EX_ERROR_NONE;
151 }
152
153 extern "C" EXPORT_API int noti_ex_item_chat_message_create(
154     noti_ex_item_h *handle, const char *id, noti_ex_item_h name,
155     noti_ex_item_h text, noti_ex_item_h image, noti_ex_item_h time,
156     noti_ex_item_chat_message_type_e message_type) {
157   if (handle == nullptr || message_type > NOTI_EX_ITEM_CHAT_MESSAGE_TYPE_SENDER) {
158     LOGE("Invalid parameter");
159     return NOTI_EX_ERROR_INVALID_PARAMETER;
160   }
161
162   TextItem* name_ = static_cast<TextItem*>(name);
163   TextItem* text_ = static_cast<TextItem*>(text);
164   ImageItem* image_ = static_cast<ImageItem*>(image);
165   TimeItem* time_ = static_cast<TimeItem*>(time);
166
167   auto* p = new (std::nothrow) ChatMessageItem(id,
168                 static_cast<std::shared_ptr<TextItem>>(name_),
169                 static_cast<std::shared_ptr<TextItem>>(text_),
170                 static_cast<std::shared_ptr<ImageItem>>(image_),
171                 static_cast<std::shared_ptr<TimeItem>>(time_),
172                 static_cast<ChatMessageItem::Type>((int)message_type));
173   if (p == nullptr) {
174     LOGE("Out-of-memory");
175     return NOTI_EX_ERROR_OUT_OF_MEMORY;
176   }
177
178   *handle = p;
179
180   return NOTI_EX_ERROR_NONE;
181 }
182
183 extern "C" EXPORT_API int noti_ex_item_chat_message_get_name(
184     noti_ex_item_h handle, noti_ex_item_h *name) {
185   if (handle == nullptr || name == nullptr) {
186     LOGE("Invalid parameter");
187     return NOTI_EX_ERROR_INVALID_PARAMETER;
188   }
189
190   ChatMessageItem* p = static_cast<ChatMessageItem*>(handle);
191   *name = &(p->GetNameItem());
192
193   return NOTI_EX_ERROR_NONE;
194 }
195
196 extern "C" EXPORT_API int noti_ex_item_chat_message_get_text(
197     noti_ex_item_h handle, noti_ex_item_h *text) {
198   if (handle == nullptr || text == nullptr) {
199     LOGE("Invalid parameter");
200     return NOTI_EX_ERROR_INVALID_PARAMETER;
201   }
202
203   ChatMessageItem* p = static_cast<ChatMessageItem*>(handle);
204   *text = &(p->GetTextItem());
205
206   return NOTI_EX_ERROR_NONE;
207 }
208
209 extern "C" EXPORT_API int noti_ex_item_chat_message_get_image(
210     noti_ex_item_h handle, noti_ex_item_h *image) {
211   if (handle == nullptr || image == nullptr) {
212     LOGE("Invalid parameter");
213     return NOTI_EX_ERROR_INVALID_PARAMETER;
214   }
215
216   ChatMessageItem* p = static_cast<ChatMessageItem*>(handle);
217   *image =  &(p->GetImageItem());
218
219   return NOTI_EX_ERROR_NONE;
220 }
221
222 extern "C" EXPORT_API int noti_ex_item_chat_message_get_time(
223     noti_ex_item_h handle, noti_ex_item_h *time) {
224   if (handle == nullptr || time == nullptr) {
225     LOGE("Invalid parameter");
226     return NOTI_EX_ERROR_INVALID_PARAMETER;
227   }
228
229   ChatMessageItem* p = static_cast<ChatMessageItem*>(handle);
230   *time = &(p->GetTimeItem());
231
232   return NOTI_EX_ERROR_NONE;
233 }
234
235 extern "C" EXPORT_API int noti_ex_item_chat_message_get_message_type(
236     noti_ex_item_h handle, noti_ex_item_chat_message_type_e *message_type) {
237   if (handle == nullptr || message_type == nullptr) {
238     LOGE("Invalid parameter");
239     return NOTI_EX_ERROR_INVALID_PARAMETER;
240   }
241
242   ChatMessageItem* p = static_cast<ChatMessageItem*>(handle);
243   *message_type = (noti_ex_item_chat_message_type_e)(p->GetMessageType());
244
245   return NOTI_EX_ERROR_NONE;
246 }
247
248 extern "C" EXPORT_API int noti_ex_item_checkbox_create(noti_ex_item_h *handle,
249     const char *id, const char *title, bool checked) {
250   CheckBoxItem* p;
251
252   if (handle == nullptr || title == nullptr) {
253     LOGE("Invalid parameter");
254     return NOTI_EX_ERROR_INVALID_PARAMETER;
255   }
256
257   p = new (std::nothrow) CheckBoxItem(id, title, checked);
258   if (p == nullptr) {
259     LOGE("Out-of-memory");
260     return NOTI_EX_ERROR_OUT_OF_MEMORY;
261   }
262
263   *handle = p;
264
265   return NOTI_EX_ERROR_NONE;
266 }
267
268 extern "C" EXPORT_API int noti_ex_item_checkbox_get_title(noti_ex_item_h handle,
269     char **title) {
270   if (handle == nullptr || title == nullptr) {
271     LOGE("Invalid parameter");
272     return NOTI_EX_ERROR_INVALID_PARAMETER;
273   }
274
275   CheckBoxItem* p = static_cast<CheckBoxItem*>(handle);
276   if (!p->GetTitle().empty()) {
277     *title = strdup(p->GetTitle().c_str());
278     if (*title == nullptr) {
279         LOGE("Out-of-memory");
280         return NOTI_EX_ERROR_OUT_OF_MEMORY;
281     }
282   }
283
284   return NOTI_EX_ERROR_NONE;
285 }
286
287 extern "C" EXPORT_API int noti_ex_item_checkbox_is_checked(noti_ex_item_h handle,
288     bool *checked) {
289   if (handle == nullptr || checked == nullptr) {
290     LOGE("Invalid parameter");
291     return NOTI_EX_ERROR_INVALID_PARAMETER;
292   }
293
294   CheckBoxItem* p = static_cast<CheckBoxItem*>(handle);
295   *checked = p->IsChecked();
296
297   return NOTI_EX_ERROR_NONE;
298 }
299
300 extern "C" EXPORT_API int noti_ex_item_entry_create(noti_ex_item_h *handle,
301     const char *id) {
302   EntryItem* p;
303
304   if (handle == nullptr) {
305     LOGE("Invalid parameter");
306     return NOTI_EX_ERROR_INVALID_PARAMETER;
307   }
308
309   p = new (std::nothrow) EntryItem(id);
310   if (p == nullptr) {
311     LOGE("Out-of-memory");
312     return NOTI_EX_ERROR_OUT_OF_MEMORY;
313   }
314
315   *handle = p;
316
317   return NOTI_EX_ERROR_NONE;
318 }
319
320 extern "C" EXPORT_API int noti_ex_item_entry_get_text(noti_ex_item_h handle,
321     char **text) {
322   if (handle == nullptr || text == nullptr) {
323     LOGE("Invalid parameter");
324     return NOTI_EX_ERROR_INVALID_PARAMETER;
325   }
326
327   EntryItem* p = static_cast<EntryItem*>(handle);
328   if (!p->GetText().empty()) {
329     *text = strdup(p->GetText().c_str());
330     if (*text == nullptr) {
331         LOGE("Out-of-memory");
332         return NOTI_EX_ERROR_OUT_OF_MEMORY;
333     }
334   }
335
336   return NOTI_EX_ERROR_NONE;
337 }
338
339 extern "C" EXPORT_API int noti_ex_item_entry_set_text(noti_ex_item_h handle,
340     const char *text) {
341   if (handle == nullptr || text == nullptr) {
342     LOGE("Invalid parameter");
343     return NOTI_EX_ERROR_INVALID_PARAMETER;
344   }
345
346   EntryItem* p = static_cast<EntryItem*>(handle);
347   p->SetText(std::string(text));
348
349   return NOTI_EX_ERROR_NONE;
350 }
351
352 extern "C" EXPORT_API int noti_ex_event_info_create(noti_ex_event_info_h *handle,
353     noti_ex_event_info_type_e type, const char *owner,
354     const char *channel, const char *item_id) {
355   return NOTI_EX_ERROR_NONE;
356 }
357
358 extern "C" EXPORT_API int noti_ex_event_info_destroy(
359     noti_ex_event_info_h handle) {
360   return NOTI_EX_ERROR_NONE;
361 }
362
363 extern "C" EXPORT_API int noti_ex_event_info_get_event_type(
364     noti_ex_event_info_h handle, noti_ex_event_info_type_e *event_type) {
365   return NOTI_EX_ERROR_NONE;
366 }
367
368 extern "C" EXPORT_API int noti_ex_event_info_get_owner(
369     noti_ex_event_info_h handle, char **owner) {
370   return NOTI_EX_ERROR_NONE;
371 }
372
373 extern "C" EXPORT_API int noti_ex_event_info_get_channel(
374     noti_ex_event_info_h handle, char **channel) {
375   return NOTI_EX_ERROR_NONE;
376 }
377
378 extern "C" EXPORT_API int noti_ex_event_info_get_item_id(
379     noti_ex_event_info_h handle, char **item_id) {
380   return NOTI_EX_ERROR_NONE;
381 }
382
383 extern "C" EXPORT_API int noti_ex_event_info_get_request_id(
384     noti_ex_event_info_h handle, int *req_id) {
385   return NOTI_EX_ERROR_NONE;
386 }
387
388 extern "C" EXPORT_API int noti_ex_item_group_create(noti_ex_item_h *handle,
389     const char *id) {
390   GroupItem* p;
391
392   if (handle == nullptr) {
393     LOGE("Invalid parameter");
394     return NOTI_EX_ERROR_INVALID_PARAMETER;
395   }
396
397   if (id)
398     p = new (std::nothrow) GroupItem(id);
399   else
400     p = new (std::nothrow) GroupItem();
401
402   if (p == nullptr) {
403     LOGE("Out-of-memory");
404     return NOTI_EX_ERROR_OUT_OF_MEMORY;
405   }
406
407   *handle = p;
408
409   return NOTI_EX_ERROR_NONE;
410 }
411
412 extern "C" EXPORT_API int noti_ex_item_group_set_direction(noti_ex_item_h handle,
413     bool vertical) {
414   if (handle == nullptr) {
415     LOGE("Invalid parameter");
416     return NOTI_EX_ERROR_INVALID_PARAMETER;
417   }
418
419   GroupItem* p = static_cast<GroupItem*>(handle);
420   p->SetDirection(vertical);
421
422   return NOTI_EX_ERROR_NONE;
423 }
424
425 extern "C" EXPORT_API int noti_ex_item_group_is_vertical(noti_ex_item_h handle,
426     bool *vertical) {
427   if (handle == nullptr) {
428     LOGE("Invalid parameter");
429     return NOTI_EX_ERROR_INVALID_PARAMETER;
430   }
431
432   GroupItem* p = static_cast<GroupItem*>(handle);
433   *vertical = p->IsVertical();
434
435   return NOTI_EX_ERROR_NONE;
436 }
437
438 extern "C" EXPORT_API int noti_ex_item_group_get_app_label(noti_ex_item_h handle,
439     char **label) {
440   if (handle == nullptr) {
441     LOGE("Invalid parameter");
442     return NOTI_EX_ERROR_INVALID_PARAMETER;
443   }
444
445   GroupItem* p = static_cast<GroupItem*>(handle);
446   if (!p->GetAppLabel().empty()) {
447     *label = strdup(p->GetAppLabel().c_str());
448     if (*label == nullptr) {
449       LOGE("Out-of-memory");
450       return NOTI_EX_ERROR_OUT_OF_MEMORY;
451     }
452   }
453
454   return NOTI_EX_ERROR_NONE;
455 }
456
457 extern "C" EXPORT_API int noti_ex_item_group_add_child(noti_ex_item_h handle,
458     noti_ex_item_h child) {
459   if (handle == nullptr || child == nullptr) {
460     LOGE("Invalid parameter");
461     return NOTI_EX_ERROR_INVALID_PARAMETER;
462   }
463
464   GroupItem* p = static_cast<GroupItem*>(handle);
465
466   AbstractItem* child_ = static_cast<AbstractItem*>(child);
467   p->AddChild(static_cast<std::shared_ptr<AbstractItem>>(child_));
468
469   return NOTI_EX_ERROR_NONE;
470 }
471
472 extern "C" EXPORT_API int noti_ex_item_group_remove_child(noti_ex_item_h handle,
473     const char *item_id) {
474   if (handle == nullptr || item_id == nullptr) {
475     LOGE("Invalid parameter");
476     return NOTI_EX_ERROR_INVALID_PARAMETER;
477   }
478
479   GroupItem* p = static_cast<GroupItem*>(handle);
480   p->RemoveChild(std::string(item_id));
481
482   return NOTI_EX_ERROR_NONE;
483 }
484
485 extern "C" EXPORT_API int noti_ex_item_group_foreach(
486     noti_ex_item_group_foreach_cb callback, void *data) {
487   if (callback == nullptr) {
488     LOGE("Invalid parameter");
489     return NOTI_EX_ERROR_INVALID_PARAMETER;
490   }
491
492   // To do
493
494   return 0;
495 }
496
497 extern "C" EXPORT_API int noti_ex_item_image_create(noti_ex_item_h *handle,
498     const char *id, const char *image_path) {
499   ImageItem* p;
500
501   if (handle == nullptr  || image_path == nullptr) {
502     LOGE("Invalid parameter");
503     return NOTI_EX_ERROR_INVALID_PARAMETER;
504   }
505
506   if (id)
507     p = new (std::nothrow) ImageItem(id, image_path);
508   else
509     p = new (std::nothrow) ImageItem(image_path);
510
511   if (p == nullptr) {
512     LOGE("Out-of-memory");
513     return NOTI_EX_ERROR_OUT_OF_MEMORY;
514   }
515
516   *handle = p;
517
518   return NOTI_EX_ERROR_NONE;
519 }
520
521 extern "C" EXPORT_API int noti_ex_item_image_get_image_path(
522     noti_ex_item_h handle, char **image_path) {
523   if (handle == nullptr || image_path == nullptr) {
524     LOGE("Invalid parameter");
525     return NOTI_EX_ERROR_INVALID_PARAMETER;
526   }
527
528   ImageItem* p = static_cast<ImageItem*>(handle);
529   if (!p->GetImagePath().empty()) {
530     *image_path = strdup(p->GetImagePath().c_str());
531     if (*image_path == nullptr) {
532       LOGE("Out-of-memory");
533       return NOTI_EX_ERROR_OUT_OF_MEMORY;
534     }
535   }
536
537   return NOTI_EX_ERROR_NONE;
538 }
539
540 extern "C" EXPORT_API int noti_ex_item_input_selector_create(
541     noti_ex_item_h *handle, const char *id) {
542   InputSelectorItem* p;
543
544   if (handle == nullptr) {
545     LOGE("Invalid parameter");
546     return NOTI_EX_ERROR_INVALID_PARAMETER;
547   }
548
549   if (id)
550     p = new (std::nothrow) InputSelectorItem(id);
551   else
552     p = new (std::nothrow) InputSelectorItem();
553
554   if (p == nullptr) {
555     LOGE("Out-of-memory");
556     return NOTI_EX_ERROR_OUT_OF_MEMORY;
557   }
558
559   *handle = p;
560
561   return NOTI_EX_ERROR_NONE;
562 }
563
564 extern "C" EXPORT_API int noti_ex_item_input_selector_get_contents(
565     noti_ex_item_h handle, char ***list, int *count) {
566   if (handle == nullptr || list == nullptr || count == nullptr) {
567     LOGE("Invalid parameter");
568     return NOTI_EX_ERROR_INVALID_PARAMETER;
569   }
570
571   // To do
572
573   return NOTI_EX_ERROR_NONE;
574 }
575
576 extern "C" EXPORT_API int noti_ex_item_input_selector_set_contents(
577     noti_ex_item_h handle, const char **contents, int count) {
578   if (handle == nullptr || contents == nullptr) {
579     LOGE("Invalid parameter");
580     return NOTI_EX_ERROR_INVALID_PARAMETER;
581   }
582
583   // To do
584
585   return NOTI_EX_ERROR_NONE;
586 }
587
588 extern "C" EXPORT_API int noti_ex_color_create(noti_ex_color_h *handle,
589     unsigned char a, unsigned char r, unsigned char g, unsigned char b) {
590   if (handle == nullptr) {
591     LOGE("Invalid parameter");
592     return NOTI_EX_ERROR_INVALID_PARAMETER;
593   }
594
595   auto* p = new (std::nothrow) Color(a, r, g, b);
596   if (p == nullptr) {
597     LOGE("Out-of-memory");
598     return NOTI_EX_ERROR_OUT_OF_MEMORY;
599   }
600
601   *handle = p;
602
603   return NOTI_EX_ERROR_NONE;
604 }
605
606 extern "C" EXPORT_API int noti_ex_color_destroy(noti_ex_color_h handle) {
607   if (handle == nullptr) {
608     LOGE("Invalid parameter");
609     return NOTI_EX_ERROR_INVALID_PARAMETER;
610   }
611
612   Color* p = static_cast<Color*>(handle);
613   p->~Color();
614
615   return NOTI_EX_ERROR_NONE;
616 }
617
618 extern "C" EXPORT_API int noti_ex_color_get_alpha(noti_ex_color_h handle,
619     unsigned char *val) {
620   if (handle == nullptr || val == nullptr) {
621     LOGE("Invalid parameter");
622     return NOTI_EX_ERROR_INVALID_PARAMETER;
623   }
624
625   Color* p = static_cast<Color*>(handle);
626   *val = p->GetAVal();
627
628   return NOTI_EX_ERROR_NONE;
629 }
630
631 extern "C" EXPORT_API int noti_ex_color_get_red(noti_ex_color_h handle,
632     unsigned char *val) {
633   if (handle == nullptr || val == nullptr) {
634     LOGE("Invalid parameter");
635     return NOTI_EX_ERROR_INVALID_PARAMETER;
636   }
637
638   Color* p = static_cast<Color*>(handle);
639   *val = p->GetRVal();
640
641   return NOTI_EX_ERROR_NONE;
642 }
643
644 extern "C" EXPORT_API int noti_ex_color_get_green(noti_ex_color_h handle,
645     unsigned char *val) {
646   if (handle == nullptr || val == nullptr) {
647     LOGE("Invalid parameter");
648     return NOTI_EX_ERROR_INVALID_PARAMETER;
649   }
650
651   Color* p = static_cast<Color*>(handle);
652   *val = p->GetGVal();
653
654   return NOTI_EX_ERROR_NONE;
655 }
656
657 extern "C" EXPORT_API int noti_ex_color_get_blue(noti_ex_color_h handle,
658     unsigned char *val) {
659   if (handle == nullptr || val == nullptr) {
660     LOGE("Invalid parameter");
661     return NOTI_EX_ERROR_INVALID_PARAMETER;
662   }
663
664   Color* p = static_cast<Color*>(handle);
665   *val = p->GetBVal();
666
667   return NOTI_EX_ERROR_NONE;
668 }
669
670 extern "C" EXPORT_API int noti_ex_padding_create(noti_ex_padding_h *handle,
671     int left, int top, int right, int bottom) {
672   if (handle == nullptr) {
673     LOGE("Invalid parameter");
674     return NOTI_EX_ERROR_INVALID_PARAMETER;
675   }
676
677   auto* p = new (std::nothrow) Padding(left, top, right, bottom);
678   if (p == nullptr) {
679     LOGE("Out-of-memory");
680     return NOTI_EX_ERROR_OUT_OF_MEMORY;
681   }
682
683   *handle = p;
684
685   return NOTI_EX_ERROR_NONE;
686 }
687
688 extern "C" EXPORT_API int noti_ex_padding_destroy(noti_ex_padding_h handle) {
689   if (handle == nullptr) {
690     LOGE("Invalid parameter");
691     return NOTI_EX_ERROR_INVALID_PARAMETER;
692   }
693
694   Padding* p = static_cast<Padding*>(handle);
695   p->~Padding();
696
697   return NOTI_EX_ERROR_NONE;
698 }
699
700 extern "C" EXPORT_API int noti_ex_padding_get_left(noti_ex_padding_h handle,
701     int *val) {
702   if (handle == nullptr || val == nullptr) {
703     LOGE("Invalid parameter");
704     return NOTI_EX_ERROR_INVALID_PARAMETER;
705   }
706
707   Padding* p = static_cast<Padding*>(handle);
708   *val = p->GetLeft();
709
710   return NOTI_EX_ERROR_NONE;
711 }
712
713 extern "C" EXPORT_API int noti_ex_padding_get_top(noti_ex_padding_h handle,
714     int *val) {
715   if (handle == nullptr || val == nullptr) {
716     LOGE("Invalid parameter");
717     return NOTI_EX_ERROR_INVALID_PARAMETER;
718   }
719
720   Padding* p = static_cast<Padding*>(handle);
721   *val = p->GetTop();
722
723   return NOTI_EX_ERROR_NONE;
724 }
725
726 extern "C" EXPORT_API int noti_ex_padding_get_right(noti_ex_padding_h handle,
727     int *val) {
728   if (handle == nullptr || val == nullptr) {
729     LOGE("Invalid parameter");
730     return NOTI_EX_ERROR_INVALID_PARAMETER;
731   }
732
733   Padding* p = static_cast<Padding*>(handle);
734   *val = p->GetRight();
735
736   return 0;
737 }
738
739 extern "C" EXPORT_API int noti_ex_padding_get_bottom(noti_ex_padding_h handle,
740     int *val) {
741   if (handle == nullptr || val == nullptr) {
742     LOGE("Invalid parameter");
743     return NOTI_EX_ERROR_INVALID_PARAMETER;
744   }
745
746   Padding* p = static_cast<Padding*>(handle);
747   *val = p->GetBottom();
748
749   return 0;
750 }
751
752 extern "C" EXPORT_API int noti_ex_geometry_create(noti_ex_geometry_h *handle,
753     int x, int y, int w, int h) {
754   if (handle == nullptr) {
755     LOGE("Invalid parameter");
756     return NOTI_EX_ERROR_INVALID_PARAMETER;
757   }
758
759   auto* p = new (std::nothrow) Geometry(x, y, w, h);
760   if (p == nullptr) {
761     LOGE("Out-of-memory");
762     return NOTI_EX_ERROR_OUT_OF_MEMORY;
763   }
764
765   *handle = p;
766
767   return NOTI_EX_ERROR_NONE;
768 }
769
770 extern "C" EXPORT_API int noti_ex_geometry_destroy(noti_ex_geometry_h handle) {
771   if (handle == nullptr) {
772     LOGE("Invalid parameter");
773     return NOTI_EX_ERROR_INVALID_PARAMETER;
774   }
775
776   Geometry* p = static_cast<Geometry*>(handle);
777   p->~Geometry();
778
779   return NOTI_EX_ERROR_NONE;
780 }
781
782 extern "C" EXPORT_API int noti_ex_geometry_get_x(noti_ex_geometry_h handle,
783     int *val) {
784   if (handle == nullptr || val == nullptr) {
785     LOGE("Invalid parameter");
786     return NOTI_EX_ERROR_INVALID_PARAMETER;
787   }
788
789   Geometry* p = static_cast<Geometry*>(handle);
790   *val = p->GetX();
791
792   return NOTI_EX_ERROR_NONE;
793 }
794
795 extern "C" EXPORT_API int noti_ex_geometry_get_y(noti_ex_geometry_h handle,
796     int *val) {
797   if (handle == nullptr || val == nullptr) {
798     LOGE("Invalid parameter");
799     return NOTI_EX_ERROR_INVALID_PARAMETER;
800   }
801
802   Geometry* p = static_cast<Geometry*>(handle);
803   *val = p->GetY();
804
805   return NOTI_EX_ERROR_NONE;
806 }
807
808 extern "C" EXPORT_API int noti_ex_geometry_get_width(noti_ex_geometry_h handle,
809     int *val) {
810   if (handle == nullptr || val == nullptr) {
811     LOGE("Invalid parameter");
812     return NOTI_EX_ERROR_INVALID_PARAMETER;
813   }
814
815   Geometry* p = static_cast<Geometry*>(handle);
816   *val = p->GetWidth();
817
818   return NOTI_EX_ERROR_NONE;
819 }
820
821 extern "C" EXPORT_API int noti_ex_geometry_get_height(noti_ex_geometry_h handle,
822     int *val) {
823   if (handle == nullptr || val == nullptr) {
824     LOGE("Invalid parameter");
825     return NOTI_EX_ERROR_INVALID_PARAMETER;
826   }
827
828   Geometry* p = static_cast<Geometry*>(handle);
829   *val = p->GetHeight();
830
831   return NOTI_EX_ERROR_NONE;
832 }
833
834 extern "C" EXPORT_API int noti_ex_style_create(noti_ex_style_h *handle,
835     noti_ex_color_h color,
836     noti_ex_padding_h padding,
837     noti_ex_geometry_h geometry) {
838   if (handle == nullptr) {
839     LOGE("Invalid parameter");
840     return NOTI_EX_ERROR_INVALID_PARAMETER;
841   }
842
843   Color* color_ = static_cast<Color*>(color);
844   Padding* padding_ = static_cast<Padding*>(padding);
845   Geometry* geo_ = static_cast<Geometry*>(geometry);
846
847   auto* p = new (std::nothrow) Style(*color_, *padding_, *geo_);
848   if (p == nullptr) {
849     LOGE("Out-of-memory");
850     return NOTI_EX_ERROR_OUT_OF_MEMORY;
851   }
852
853   *handle = p;
854
855   return NOTI_EX_ERROR_NONE;
856 }
857
858 extern "C" EXPORT_API int noti_ex_style_destroy(noti_ex_style_h handle) {
859   if (handle == nullptr) {
860     LOGE("Invalid parameter");
861     return NOTI_EX_ERROR_INVALID_PARAMETER;
862   }
863
864   Style* p = static_cast<Style*>(handle);
865   p->~Style();
866
867   return NOTI_EX_ERROR_NONE;
868 }
869
870 extern "C" EXPORT_API int noti_ex_style_get_padding(noti_ex_style_h handle,
871     noti_ex_padding_h *padding) {
872   if (handle == nullptr || padding == nullptr) {
873     LOGE("Invalid parameter");
874     return NOTI_EX_ERROR_INVALID_PARAMETER;
875   }
876
877   Style* p = static_cast<Style*>(handle);
878   Padding* padding_ = new (std::nothrow) Padding(p->GetPadding());
879   if (padding_ == nullptr) {
880     LOGE("Out-of-memory");
881     return NOTI_EX_ERROR_OUT_OF_MEMORY;
882   }
883
884   *padding = padding_;
885
886   return NOTI_EX_ERROR_NONE;
887 }
888
889 extern "C" EXPORT_API int noti_ex_style_get_color(noti_ex_style_h handle,
890     noti_ex_color_h *color) {
891   if (handle == nullptr || color == nullptr) {
892     LOGE("Invalid parameter");
893     return NOTI_EX_ERROR_INVALID_PARAMETER;
894   }
895
896   Style* p = static_cast<Style*>(handle);
897   Color* color_ = new (std::nothrow) Color(p->GetColor());
898   if (color_ == nullptr) {
899     LOGE("Out-of-memory");
900     return NOTI_EX_ERROR_OUT_OF_MEMORY;
901   }
902
903   *color = color_;
904
905   return NOTI_EX_ERROR_NONE;
906 }
907
908 extern "C" EXPORT_API int noti_ex_style_get_geometry(noti_ex_style_h handle,
909     noti_ex_geometry_h *geometry) {
910   if (handle == nullptr || geometry == nullptr) {
911     LOGE("Invalid parameter");
912     return NOTI_EX_ERROR_INVALID_PARAMETER;
913   }
914
915   Style* p = static_cast<Style*>(handle);
916   Geometry* geo_ = new (std::nothrow) Geometry(p->GetGeometry());
917   if (geo_ == nullptr) {
918     LOGE("Out-of-memory");
919     return NOTI_EX_ERROR_OUT_OF_MEMORY;
920   }
921
922   *geometry = geo_;
923
924   return NOTI_EX_ERROR_NONE;
925 }
926
927 extern "C" EXPORT_API int noti_ex_led_info_create(noti_ex_led_info_h *handle,
928     noti_ex_color_h color) {
929   if (handle == nullptr) {
930     LOGE("Invalid parameter");
931     return NOTI_EX_ERROR_INVALID_PARAMETER;
932   }
933
934   Color* color_ = static_cast<Color*>(color);
935   auto* p = new (std::nothrow) LEDInfo(*color_);
936   if (p == nullptr) {
937     LOGE("Out-of-memory");
938     return NOTI_EX_ERROR_OUT_OF_MEMORY;
939   }
940
941   *handle = p;
942
943   return NOTI_EX_ERROR_NONE;
944 }
945
946 extern "C" EXPORT_API int noti_ex_led_info_destroy(noti_ex_led_info_h handle) {
947   if (handle == nullptr) {
948     LOGE("Invalid parameter");
949     return NOTI_EX_ERROR_INVALID_PARAMETER;
950   }
951
952   LEDInfo* p = static_cast<LEDInfo*>(handle);
953   p->~LEDInfo();
954
955   return NOTI_EX_ERROR_NONE;
956 }
957
958 extern "C" EXPORT_API int noti_ex_led_info_set_on_period(
959     noti_ex_led_info_h handle, int ms) {
960   if (handle == nullptr) {
961     LOGE("Invalid parameter");
962     return NOTI_EX_ERROR_INVALID_PARAMETER;
963   }
964
965   LEDInfo* p = static_cast<LEDInfo*>(handle);
966   p->SetOnPeriod(ms);
967
968   return NOTI_EX_ERROR_NONE;
969 }
970
971 extern "C" EXPORT_API int noti_ex_led_info_get_on_period(
972     noti_ex_led_info_h handle, int *ms) {
973   if (handle == nullptr || ms == nullptr) {
974     LOGE("Invalid parameter");
975     return NOTI_EX_ERROR_INVALID_PARAMETER;
976   }
977
978   LEDInfo* p = static_cast<LEDInfo*>(handle);
979   *ms = p->GetOnPeriod();
980
981   return NOTI_EX_ERROR_NONE;
982 }
983
984 extern "C" EXPORT_API int noti_ex_led_info_set_off_period(
985     noti_ex_led_info_h handle, int ms) {
986   if (handle == nullptr) {
987     LOGE("Invalid parameter");
988     return NOTI_EX_ERROR_INVALID_PARAMETER;
989   }
990
991   LEDInfo* p = static_cast<LEDInfo*>(handle);
992   p->SetOffPeriod(ms);
993
994   return NOTI_EX_ERROR_NONE;
995 }
996
997 extern "C" EXPORT_API int noti_ex_led_info_get_off_period(
998     noti_ex_led_info_h handle, int *ms) {
999   if (handle == nullptr) {
1000     LOGE("Invalid parameter");
1001     return NOTI_EX_ERROR_INVALID_PARAMETER;
1002   }
1003
1004   LEDInfo* p = static_cast<LEDInfo*>(handle);
1005   *ms = p->GetOffPeriod();
1006
1007   return NOTI_EX_ERROR_NONE;
1008 }
1009
1010 extern "C" EXPORT_API int noti_ex_led_info_get_color(
1011     noti_ex_led_info_h handle, noti_ex_color_h *color) {
1012   if (handle == nullptr) {
1013     LOGE("Invalid parameter");
1014     return NOTI_EX_ERROR_INVALID_PARAMETER;
1015   }
1016
1017   LEDInfo* p = static_cast<LEDInfo*>(handle);
1018   Color* color_ = new (std::nothrow) Color(p->GetColor());
1019   if (color_ == nullptr) {
1020     LOGE("Out-of-memory");
1021     return NOTI_EX_ERROR_OUT_OF_MEMORY;
1022   }
1023
1024   *color = color_;
1025
1026   return NOTI_EX_ERROR_NONE;
1027 }
1028
1029 extern "C" EXPORT_API int noti_ex_action_destroy(noti_ex_action_h handle) {
1030   if (handle == nullptr) {
1031     LOGE("Invalid parameter");
1032     return NOTI_EX_ERROR_INVALID_PARAMETER;
1033   }
1034
1035   AbstractAction* p = static_cast<AbstractAction*>(handle);
1036   p->~AbstractAction();
1037
1038   return NOTI_EX_ERROR_NONE;
1039 }
1040
1041 extern "C" EXPORT_API int noti_ex_action_get_type(noti_ex_action_h handle,
1042     int *type) {
1043   if (handle == nullptr || type == nullptr) {
1044     LOGE("Invalid parameter");
1045     return NOTI_EX_ERROR_INVALID_PARAMETER;
1046   }
1047
1048   AbstractAction* p = static_cast<AbstractAction*>(handle);
1049   *type = p->GetType();
1050
1051   return NOTI_EX_ERROR_NONE;
1052 }
1053
1054 extern "C" EXPORT_API int noti_ex_action_is_local(noti_ex_action_h handle,
1055     bool *local) {
1056   if (handle == nullptr || local == nullptr) {
1057     LOGE("Invalid parameter");
1058     return NOTI_EX_ERROR_INVALID_PARAMETER;
1059   }
1060
1061   AbstractAction* p = static_cast<AbstractAction*>(handle);
1062   *local = p->IsLocal();
1063
1064   return NOTI_EX_ERROR_NONE;
1065 }
1066
1067 extern "C" EXPORT_API int noti_ex_action_execute(noti_ex_action_h handle,
1068     noti_ex_item_h item) {
1069   if (handle == nullptr || item==nullptr) {
1070     LOGE("Invalid parameter");
1071     return NOTI_EX_ERROR_INVALID_PARAMETER;
1072   }
1073
1074   AbstractAction* p = static_cast<AbstractAction*>(handle);
1075   AbstractItem* item_ = static_cast<AbstractItem*>(item);
1076   p->Execute(static_cast<std::shared_ptr<AbstractItem>>(item_));
1077
1078   return NOTI_EX_ERROR_NONE;
1079 }
1080
1081 extern "C" EXPORT_API int noti_ex_action_get_extra(noti_ex_action_h handle,
1082     char **extra) {
1083   if (handle == nullptr || extra == nullptr) {
1084     LOGE("Invalid parameter");
1085     return NOTI_EX_ERROR_INVALID_PARAMETER;
1086   }
1087
1088   AbstractAction* p = static_cast<AbstractAction*>(handle);
1089   if (!p->GetExtra().empty()) {
1090     *extra = strdup(p->GetExtra().c_str());
1091     if (*extra == nullptr) {
1092       LOGE("Out-of-memory");
1093       return NOTI_EX_ERROR_OUT_OF_MEMORY;
1094     }
1095   }
1096
1097   return NOTI_EX_ERROR_NONE;
1098 }
1099
1100 extern "C" EXPORT_API int noti_ex_item_info_get_hide_time(
1101     noti_ex_item_info_h handle, int *hide_time) {
1102   return 0;
1103 }
1104
1105 extern "C" EXPORT_API int noti_ex_item_info_set_hide_time(
1106     noti_ex_item_info_h handle, int hide_time) {
1107   return 0;
1108 }
1109
1110 extern "C" EXPORT_API int noti_ex_item_info_get_delete_time(
1111     noti_ex_item_info_h handle, int *delete_time) {
1112   return 0;
1113 }
1114
1115 extern "C" EXPORT_API int noti_ex_item_info_set_delete_time(
1116     noti_ex_item_info_h handle, int delete_time) {
1117   return 0;
1118 }
1119
1120 extern "C" EXPORT_API int noti_ex_item_info_get_time(
1121     noti_ex_item_info_h handle, time_t *time) {
1122   return 0;
1123 }
1124
1125 extern "C" EXPORT_API int noti_ex_item_destroy(noti_ex_item_h handle) {
1126   return 0;
1127 }
1128
1129 extern "C" EXPORT_API int noti_ex_item_find_by_id(noti_ex_item_h handle,
1130     const char *id, noti_ex_item_h *item) {
1131   return 0;
1132 }
1133
1134 extern "C" EXPORT_API int noti_ex_item_get_type(noti_ex_item_h handle,
1135     int *type) {
1136   return 0;
1137 }
1138
1139 extern "C" EXPORT_API int noti_ex_item_get_shared_path(noti_ex_item_h handle,
1140     char ***path, int *count) {
1141   return 0;
1142 }
1143
1144 extern "C" EXPORT_API int noti_ex_item_get_id(noti_ex_item_h handle,
1145     char **id) {
1146   return 0;
1147 }
1148
1149 extern "C" EXPORT_API int noti_ex_item_set_id(noti_ex_item_h handle,
1150     const char *id) {
1151   return 0;
1152 }
1153
1154 extern "C" EXPORT_API int noti_ex_item_get_action(noti_ex_item_h handle,
1155     noti_ex_action_h *action) {
1156   return 0;
1157 }
1158
1159 extern "C" EXPORT_API int noti_ex_item_set_action(noti_ex_item_h handle,
1160     noti_ex_action_h action) {
1161   return 0;
1162 }
1163
1164 extern "C" EXPORT_API int noti_ex_item_get_style(noti_ex_item_h handle,
1165     noti_ex_style_h *style) {
1166   return 0;
1167 }
1168
1169 extern "C" EXPORT_API int noti_ex_item_set_style(noti_ex_item_h handle,
1170     noti_ex_style_h style) {
1171   return 0;
1172 }
1173
1174 extern "C" EXPORT_API int noti_ex_item_set_visible(noti_ex_item_h handle,
1175     bool visible) {
1176   return 0;
1177 }
1178
1179 extern "C" EXPORT_API int noti_ex_item_get_visible(noti_ex_item_h handle,
1180     bool *visible) {
1181   return 0;
1182 }
1183
1184 extern "C" EXPORT_API int noti_ex_item_set_enable(noti_ex_item_h handle,
1185     bool enable) {
1186   return 0;
1187 }
1188
1189 extern "C" EXPORT_API int noti_ex_item_get_enable(noti_ex_item_h handle,
1190     bool *enable) {
1191   return 0;
1192 }
1193
1194 extern "C" EXPORT_API int noti_ex_item_add_receiver(noti_ex_item_h handle,
1195     const char *receiver_group) {
1196   return 0;
1197 }
1198
1199 extern "C" EXPORT_API int noti_ex_item_remove_receiver(noti_ex_item_h handle,
1200     const char *receiver_group) {
1201   return 0;
1202 }
1203
1204 extern "C" EXPORT_API int noti_ex_item_get_receiver_list(noti_ex_item_h handle,
1205     char ***list, int *count) {
1206   return 0;
1207 }
1208
1209 extern "C" EXPORT_API int noti_ex_item_set_policy(noti_ex_item_h handle,
1210     int policy) {
1211   return 0;
1212 }
1213
1214 extern "C" EXPORT_API int noti_ex_item_get_policy(noti_ex_item_h handle,
1215     int *policy) {
1216   return 0;
1217 }
1218
1219 extern "C" EXPORT_API int noti_ex_item_get_channel(noti_ex_item_h handle,
1220     char **channel) {
1221   return 0;
1222 }
1223
1224 extern "C" EXPORT_API int noti_ex_item_set_channel(noti_ex_item_h handle,
1225     const char *channel) {
1226   return 0;
1227 }
1228
1229 extern "C" EXPORT_API int noti_ex_item_set_led_info(noti_ex_item_h handle,
1230     noti_ex_led_info_h led) {
1231   return 0;
1232 }
1233
1234 extern "C" EXPORT_API int noti_ex_item_get_led_info(noti_ex_item_h handle,
1235     noti_ex_led_info_h *led) {
1236   return 0;
1237 }
1238
1239 extern "C" EXPORT_API int noti_ex_item_set_sound_path(noti_ex_item_h handle,
1240     const char *path) {
1241   return 0;
1242 }
1243
1244 extern "C" EXPORT_API int noti_ex_item_set_vibration_path(noti_ex_item_h handle,
1245     const char *path) {
1246   return 0;
1247 }
1248
1249 extern "C" EXPORT_API int noti_ex_item_get_sound_path(noti_ex_item_h handle,
1250     char **path) {
1251   return 0;
1252 }
1253
1254 extern "C" EXPORT_API int noti_ex_item_get_vibration_path(noti_ex_item_h handle,
1255     char **path) {
1256   return 0;
1257 }
1258
1259 extern "C" EXPORT_API int noti_ex_item_get_info(noti_ex_item_h handle,
1260     noti_ex_item_info_h *info) {
1261   return 0;
1262 }
1263
1264 extern "C" EXPORT_API int noti_ex_item_get_sender_app_id(noti_ex_item_h handle,
1265     char **id) {
1266   return 0;
1267 }
1268
1269 extern "C" EXPORT_API int noti_ex_item_set_sender_app_id(noti_ex_item_h handle,
1270     const char *id) {
1271   return 0;
1272 }
1273
1274 extern "C" EXPORT_API int noti_ex_item_get_tag(noti_ex_item_h handle,
1275     char **tag) {
1276   return 0;
1277 }
1278
1279 extern "C" EXPORT_API int noti_ex_item_set_tag(noti_ex_item_h handle,
1280     const char *tag) {
1281   return 0;
1282 }
1283
1284 extern "C" EXPORT_API int noti_ex_manager_create(noti_ex_manager_h *handle,
1285     const char *receiver_group, noti_ex_manager_events_s event_callbacks,
1286     void *data) {
1287   return 0;
1288 }
1289
1290 extern "C" EXPORT_API int noti_ex_manager_deatroy(noti_ex_manager_h handle) {
1291   return 0;
1292 }
1293
1294 extern "C" EXPORT_API int noti_ex_manager_get(noti_ex_manager_h handle,
1295     noti_ex_item_h **items, int *count) {
1296   return 0;
1297 }
1298
1299 extern "C" EXPORT_API int noti_ex_manager_update(noti_ex_manager_h handle,
1300     noti_ex_item_h noti, int *request_id) {
1301   return 0;
1302 }
1303
1304 extern "C" EXPORT_API int noti_ex_manager_delete(noti_ex_manager_h handle,
1305     noti_ex_item_h noti, int *request_id) {
1306   return 0;
1307 }
1308
1309 extern "C" EXPORT_API int noti_ex_manager_delete_all(noti_ex_manager_h handle,
1310     int *request_id) {
1311   return 0;
1312 }
1313
1314 extern "C" EXPORT_API int noti_ex_manager_hide(noti_ex_manager_h handle,
1315     noti_ex_item_h noti, int *request_id) {
1316   return 0;
1317 }
1318
1319 extern "C" EXPORT_API int noti_ex_manager_find_by_root_id(
1320     noti_ex_manager_h handle, const char *root_id, noti_ex_item_h *item) {
1321   return 0;
1322 }
1323
1324 extern "C" EXPORT_API int noti_ex_manager_send_error(noti_ex_manager_h handle,
1325     noti_ex_event_info_h info, noti_ex_error_e error, int *request_id) {
1326   return 0;
1327 }
1328
1329 extern "C" EXPORT_API int noti_ex_manager_get_count(noti_ex_manager_h handle,
1330     int *cnt) {
1331   return 0;
1332 }
1333
1334 extern "C" EXPORT_API int noti_ex_item_progress_create(noti_ex_item_h *handle,
1335     const char *id, float min, float current, float max) {
1336   ProgressItem* p;
1337
1338   if (handle == nullptr) {
1339     LOGE("Invalid parameter");
1340     return NOTI_EX_ERROR_INVALID_PARAMETER;
1341   }
1342
1343   if (id)
1344     p = new (std::nothrow) ProgressItem(id, min, current, max);
1345   else
1346     p = new (std::nothrow) ProgressItem(min, current, max);
1347
1348   if (p == nullptr) {
1349     LOGE("Out-of-memory");
1350     return NOTI_EX_ERROR_OUT_OF_MEMORY;
1351   }
1352
1353   *handle = p;
1354
1355   return NOTI_EX_ERROR_NONE;
1356 }
1357
1358 extern "C" EXPORT_API int noti_ex_item_progress_get_current(
1359     noti_ex_item_h handle, float *current) {
1360   if (handle == nullptr || current == nullptr) {
1361     LOGE("Invalid parameter");
1362     return NOTI_EX_ERROR_INVALID_PARAMETER;
1363   }
1364
1365   ProgressItem* p = static_cast<ProgressItem*>(handle);
1366   *current = p->GetCurrent();
1367
1368   return NOTI_EX_ERROR_NONE;
1369 }
1370
1371 extern "C" EXPORT_API int noti_ex_item_progress_set_current(
1372     noti_ex_item_h handle, float current) {
1373   if (handle == nullptr) {
1374     LOGE("Invalid parameter");
1375     return NOTI_EX_ERROR_INVALID_PARAMETER;
1376   }
1377
1378   ProgressItem* p = static_cast<ProgressItem*>(handle);
1379   p->SetCurrent(current);
1380
1381   return NOTI_EX_ERROR_NONE;
1382 }
1383
1384 extern "C" EXPORT_API int noti_ex_item_progress_get_min(noti_ex_item_h handle,
1385     float *min) {
1386   if (handle == nullptr || min == nullptr) {
1387     LOGE("Invalid parameter");
1388     return NOTI_EX_ERROR_INVALID_PARAMETER;
1389   }
1390
1391   ProgressItem* p = static_cast<ProgressItem*>(handle);
1392   *min = p->GetMin();
1393
1394   return NOTI_EX_ERROR_NONE;
1395 }
1396
1397 extern "C" EXPORT_API int noti_ex_item_progress_get_max(noti_ex_item_h handle,
1398     float *max) {
1399   if (handle == nullptr || max == nullptr) {
1400     LOGE("Invalid parameter");
1401     return NOTI_EX_ERROR_INVALID_PARAMETER;
1402   }
1403
1404   ProgressItem* p = static_cast<ProgressItem*>(handle);
1405   *max = p->GetMax();
1406
1407   return NOTI_EX_ERROR_NONE;
1408 }
1409
1410 extern "C" EXPORT_API int noti_ex_reporter_create(noti_ex_reporter_h *handle,
1411     noti_ex_reporter_events_s event_callbacks, void *data) {
1412   return NOTI_EX_ERROR_NONE;
1413 }
1414
1415 extern "C" EXPORT_API int noti_ex_reporter_destroy(noti_ex_reporter_h handle) {
1416   return NOTI_EX_ERROR_NONE;
1417 }
1418
1419 extern "C" EXPORT_API int noti_ex_reporter_send_error(noti_ex_reporter_h handle,
1420     noti_ex_event_info_h info, noti_ex_error_e error, int *request_id) {
1421   return 0;
1422 }
1423
1424 extern "C" EXPORT_API int noti_ex_reporter_post(noti_ex_reporter_h handle,
1425     noti_ex_item_h noti, int *request_id) {
1426   return 0;
1427 }
1428
1429 extern "C" EXPORT_API int noti_ex_reporter_post_list(noti_ex_reporter_h handle,
1430     noti_ex_item_h *noti_list, int count, int *request_id) {
1431   return 0;
1432 }
1433
1434 extern "C" EXPORT_API int noti_ex_reporter_update(noti_ex_reporter_h handle,
1435     noti_ex_item_h noti, int *request_id) {
1436   return 0;
1437 }
1438
1439 extern "C" EXPORT_API int noti_ex_reporter_delete(noti_ex_reporter_h handle,
1440     noti_ex_item_h noti, int *request_id) {
1441   return 0;
1442 }
1443
1444 extern "C" EXPORT_API int noti_ex_reporter_delete_all(
1445     noti_ex_reporter_h handle, int *request_id) {
1446   return 0;
1447 }
1448
1449 extern "C" EXPORT_API int noti_ex_reporter_find_by_root_id(
1450     noti_ex_reporter_h handle, const char *root_id, noti_ex_item_h *item) {
1451   return 0;
1452 }
1453
1454 extern "C" EXPORT_API int noti_ex_item_text_create(noti_ex_item_h *handle,
1455     const char *id, const char *text, const char *hyper_link) {
1456   if (handle == nullptr) {
1457     LOGE("Invalid parameter");
1458     return NOTI_EX_ERROR_INVALID_PARAMETER;
1459   }
1460
1461   auto* p = new (std::nothrow) TextItem(id, std::string(text),
1462                 std::string(hyper_link));
1463   if (p == nullptr) {
1464     LOGE("Out-of-memory");
1465     return NOTI_EX_ERROR_OUT_OF_MEMORY;
1466   }
1467
1468   *handle = p;
1469
1470   return NOTI_EX_ERROR_NONE;
1471 }
1472
1473 extern "C" EXPORT_API int noti_ex_item_text_set_contents(noti_ex_item_h handle,
1474     const char *contents) {
1475   if (handle == nullptr) {
1476     LOGE("Invalid parameter");
1477     return NOTI_EX_ERROR_INVALID_PARAMETER;
1478   }
1479
1480   TextItem* p = static_cast<TextItem*>(handle);
1481   p->SetContents(std::string(contents));
1482
1483   return NOTI_EX_ERROR_NONE;
1484 }
1485
1486 extern "C" EXPORT_API int noti_ex_item_text_get_contents(noti_ex_item_h handle,
1487     char **contents) {
1488   if (handle == nullptr || contents == nullptr) {
1489     LOGE("Invalid parameter");
1490     return NOTI_EX_ERROR_INVALID_PARAMETER;
1491   }
1492
1493   TextItem* p = static_cast<TextItem*>(handle);
1494   if (!p->GetContents().empty()) {
1495     *contents = strdup(p->GetContents().c_str());
1496     if (*contents == nullptr) {
1497       LOGE("Out-of-memory");
1498       return NOTI_EX_ERROR_OUT_OF_MEMORY;
1499     }
1500   }
1501
1502   return NOTI_EX_ERROR_NONE;
1503 }
1504
1505 extern "C" EXPORT_API int noti_ex_item_text_get_hyper_link(
1506     noti_ex_item_h handle, char **hyper_link) {
1507   if (handle == nullptr || hyper_link == nullptr) {
1508     LOGE("Invalid parameter");
1509     return NOTI_EX_ERROR_INVALID_PARAMETER;
1510   }
1511
1512   TextItem* p = static_cast<TextItem*>(handle);
1513   if (!p->GetHyperLink().empty()) {
1514     *hyper_link = strdup(p->GetHyperLink().c_str());
1515     if (*hyper_link == nullptr) {
1516       LOGE("Out-of-memory");
1517       return NOTI_EX_ERROR_OUT_OF_MEMORY;
1518     }
1519   }
1520
1521   return NOTI_EX_ERROR_NONE;
1522 }
1523
1524 extern "C" EXPORT_API int noti_ex_item_time_create(noti_ex_item_h *handle,
1525     const char *id, time_t time) {
1526   TimeItem* p;
1527
1528   if (handle == nullptr) {
1529     LOGE("Invalid parameter");
1530     return NOTI_EX_ERROR_INVALID_PARAMETER;
1531   }
1532
1533   if (time) {
1534     if (id)
1535       p = new (std::nothrow) TimeItem(id, time);
1536     else
1537       p = new (std::nothrow) TimeItem(time);
1538   } else {
1539       p = new (std::nothrow) TimeItem();
1540   }
1541
1542   if (p == nullptr) {
1543     LOGE("Out-of-memory");
1544     return NOTI_EX_ERROR_OUT_OF_MEMORY;
1545   }
1546
1547   *handle = p;
1548
1549   return NOTI_EX_ERROR_NONE;
1550 }
1551
1552 extern "C" EXPORT_API int noti_ex_item_time_get_time(noti_ex_item_h handle,
1553     time_t *time) {
1554   if (handle == nullptr || time == nullptr) {
1555     LOGE("Invalid parameter");
1556     return NOTI_EX_ERROR_INVALID_PARAMETER;
1557   }
1558
1559   TimeItem*p = static_cast<TimeItem*>(handle);
1560   *time = p->GetTime();
1561
1562   return NOTI_EX_ERROR_NONE;
1563 }
1564
1565 extern "C" EXPORT_API int noti_ex_action_visibility_create(
1566     noti_ex_action_h *handle, const char *extra) {
1567   if (handle == nullptr) {
1568     LOGE("Invalid parameter");
1569     return NOTI_EX_ERROR_INVALID_PARAMETER;
1570   }
1571
1572   auto* p = new (std::nothrow) VisibilityAction(extra);
1573   if (p == nullptr) {
1574     LOGE("Out-of-memory");
1575     return NOTI_EX_ERROR_OUT_OF_MEMORY;
1576   }
1577
1578   *handle = p;
1579
1580   return NOTI_EX_ERROR_NONE;
1581 }
1582
1583 extern "C" EXPORT_API int noti_ex_action_visibility_set(noti_ex_action_h handle,
1584     const char *id, bool visible) {
1585   if (handle == nullptr || id == nullptr) {
1586     LOGE("Invalid parameter");
1587     return NOTI_EX_ERROR_INVALID_PARAMETER;
1588   }
1589
1590   VisibilityAction* p = static_cast<VisibilityAction*>(handle);
1591   p->SetVisibility(id, visible);
1592
1593   return 0;
1594 }