summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyungKi Lee <mk5004.lee@samsung.com>2019-09-03 23:41:32 +0000
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>2019-09-03 23:41:32 +0000
commit3ac48844a8aec0f198693ecd3a468a04b9a463b4 (patch)
tree7f11a3776c8eba5979a79dc8b878aedb1f12ecd4
parent0f6d5bd5d5c48fb52a75652d1715e225336a6b16 (diff)
parent2850c6fa4a6b5aa1caf501c76aa00aeedfb91f23 (diff)
downloadnotification-3ac48844a8aec0f198693ecd3a468a04b9a463b4.tar.gz
notification-3ac48844a8aec0f198693ecd3a468a04b9a463b4.tar.bz2
notification-3ac48844a8aec0f198693ecd3a468a04b9a463b4.zip
Merge "Update new apis in stub" into tizen
-rw-r--r--notification-ex/api/notification_ex_checkbox.h6
-rw-r--r--notification-ex/api/notification_ex_event_info.h10
-rw-r--r--notification-ex/api/notification_ex_item.h56
-rw-r--r--notification-ex/api/notification_ex_manager.h3
-rw-r--r--notification-ex/api/notification_ex_progress.h15
-rw-r--r--notification-ex/checkbox_item.cc4
-rw-r--r--notification-ex/checkbox_item.h7
-rw-r--r--notification-ex/stub.cc248
-rw-r--r--notification-ex/text_item.h4
9 files changed, 342 insertions, 11 deletions
diff --git a/notification-ex/api/notification_ex_checkbox.h b/notification-ex/api/notification_ex_checkbox.h
index 9e9ba6b..ffaad6a 100644
--- a/notification-ex/api/notification_ex_checkbox.h
+++ b/notification-ex/api/notification_ex_checkbox.h
@@ -103,11 +103,13 @@ int noti_ex_item_checkbox_get_title(noti_ex_item_h handle, char **title);
int ret;
bool checked;
- ret = noti_ex_item_checkbox_is_checked(checkbox_item, &checked);
+ ret = noti_ex_item_checkbox_get_check_state(checkbox_item, &checked);
}
* @endcode
*/
-int noti_ex_item_checkbox_is_checked(noti_ex_item_h handle, bool *checked);
+int noti_ex_item_checkbox_get_check_state(noti_ex_item_h handle, bool *checked);
+
+int noti_ex_item_checkbox_set_check_state(noti_ex_item_h handle, bool checked);
/**
* @}
diff --git a/notification-ex/api/notification_ex_event_info.h b/notification-ex/api/notification_ex_event_info.h
index 12e7fb8..7279d58 100644
--- a/notification-ex/api/notification_ex_event_info.h
+++ b/notification-ex/api/notification_ex_event_info.h
@@ -109,7 +109,7 @@ int noti_ex_event_info_destroy(noti_ex_event_info_h handle);
* @retval #NOTI_EX_ERROR_NONE Success
* @retval #NOTI_EX_ERROR_INVALID_PARAMETER Invalid parameter
* @see #noti_ex_event_info_h
- * @see noti_ex_event_info_create()
+ * @see noti_ex_event_info_clone()
* @par Sample code:
* @code
#include <notification_ex.h>
@@ -134,7 +134,7 @@ int noti_ex_event_info_get_event_type(noti_ex_event_info_h handle, noti_ex_event
* @retval #NOTI_EX_ERROR_NONE Success
* @retval #NOTI_EX_ERROR_INVALID_PARAMETER Invalid parameter
* @see #noti_ex_event_info_h
- * @see noti_ex_event_info_create()
+ * @see noti_ex_event_info_clone()
* @par Sample code:
* @code
#include <notification_ex.h>
@@ -159,7 +159,7 @@ int noti_ex_event_info_get_owner(noti_ex_event_info_h handle, char **owner);
* @retval #NOTI_EX_ERROR_NONE Success
* @retval #NOTI_EX_ERROR_INVALID_PARAMETER Invalid parameter
* @see #noti_ex_event_info_h
- * @see noti_ex_event_info_create()
+ * @see noti_ex_event_info_clone()
* @par Sample code:
* @code
#include <notification_ex.h>
@@ -184,7 +184,7 @@ int noti_ex_event_info_get_channel(noti_ex_event_info_h handle, char **channel);
* @retval #NOTI_EX_ERROR_NONE Success
* @retval #NOTI_EX_ERROR_INVALID_PARAMETER Invalid parameter
* @see #noti_ex_event_info_h
- * @see noti_ex_event_info_create()
+ * @see noti_ex_event_info_clone()
* @par Sample code:
* @code
#include <notification_ex.h>
@@ -208,7 +208,7 @@ int noti_ex_event_info_get_item_id(noti_ex_event_info_h handle, char **item_id);
* @retval #NOTI_EX_ERROR_NONE Success
* @retval #NOTI_EX_ERROR_INVALID_PARAMETER Invalid parameter
* @see #noti_ex_event_info_h
- * @see noti_ex_event_info_create()
+ * @see noti_ex_event_info_clone()
* @par Sample code:
* @code
#include <notification_ex.h>
diff --git a/notification-ex/api/notification_ex_item.h b/notification-ex/api/notification_ex_item.h
index 77d1713..e639a38 100644
--- a/notification-ex/api/notification_ex_item.h
+++ b/notification-ex/api/notification_ex_item.h
@@ -96,6 +96,37 @@ typedef enum _noti_ex_item_policy {
} noti_ex_item_policy_e;
/**
+ * @brief Enumeration for main types of notification_ex item.
+ * @since_tizen 5.5
+ */
+typedef enum _noti_ex_item_main_type {
+ /**
+ * None
+ */
+ NOTI_EX_ITEM_MAIN_TYPE_NONE = 0,
+ /**
+ * Main title.
+ * This main type is valid only for items of type #NOTI_EX_ITEM_TYPE_TEXT.
+ */
+ NOTI_EX_ITEM_MAIN_TYPE_TITLE,
+ /**
+ * Main contents.
+ * This main type is valid only for items of type #NOTI_EX_ITEM_TYPE_TEXT.
+ */
+ NOTI_EX_ITEM_MAIN_TYPE_CONTENTS,
+ /**
+ * Main icon.
+ * This main type is valid only for items of type #NOTI_EX_ITEM_TYPE_IMAGE.
+ */
+ NOTI_EX_ITEM_MAIN_TYPE_ICON,
+ /**
+ * Main button.
+ * This main type is valid only for items of type #NOTI_EX_ITEM_TYPE_BUTTON.
+ */
+ NOTI_EX_ITEM_MAIN_TYPE_BUTTON,
+} noti_ex_item_main_type_e;
+
+/**
* @brief The handle for the color information.
* @since_tizen 5.5
*/
@@ -708,6 +739,18 @@ int noti_ex_style_get_color(noti_ex_style_h handle, noti_ex_color_h *color);
*/
int noti_ex_style_get_geometry(noti_ex_style_h handle, noti_ex_geometry_h *geometry);
+int noti_ex_style_get_background_image(noti_ex_style_h handle,
+ char **background_image);
+
+int noti_ex_style_set_background_image(noti_ex_style_h handle,
+ char *background_image);
+
+int noti_ex_style_get_background_color(noti_ex_style_h handle,
+ noti_ex_color_h *color);
+
+int noti_ex_style_set_background_color(noti_ex_style_h handle,
+ noti_ex_color_h color);
+
/**
* @brief The handle for the LED information.
* @since_tizen 5.5
@@ -1916,6 +1959,19 @@ int noti_ex_item_get_tag(noti_ex_item_h handle, char **tag);
*/
int noti_ex_item_set_tag(noti_ex_item_h handle, const char *tag);
+int noti_ex_item_get_ongoing_state(noti_ex_item_h handle, bool *ongoing);
+
+int noti_ex_item_set_ongoing_state(noti_ex_item_h handle, bool ongoing);
+
+int noti_ex_item_check_type_exist(noti_ex_item_h handle, int type, bool *exist);
+
+int noti_ex_item_get_main_type(noti_ex_item_h handle, int *type);
+
+int noti_ex_item_set_main_type(noti_ex_item_h handle, const char *id, int type);
+
+int noti_ex_item_find_by_main_type(noti_ex_item_h handle, int type,
+ noti_ex_item_h *item);
+
/**
* @}
*/
diff --git a/notification-ex/api/notification_ex_manager.h b/notification-ex/api/notification_ex_manager.h
index 7b0d035..f144036 100644
--- a/notification-ex/api/notification_ex_manager.h
+++ b/notification-ex/api/notification_ex_manager.h
@@ -275,6 +275,9 @@ void _manager_events_error_cb(noti_ex_manager_h handle, noti_ex_error_e error,
int noti_ex_manager_get(noti_ex_manager_h handle,
noti_ex_item_h **items, int *count);
+int noti_ex_manager_get_by_channel(noti_ex_manager_h handle, char *channel,
+ noti_ex_item_h **items, int *count);
+
/**
* @brief Updates notification.
* @since_tizen 5.5
diff --git a/notification-ex/api/notification_ex_progress.h b/notification-ex/api/notification_ex_progress.h
index 01d92be..b579d3b 100644
--- a/notification-ex/api/notification_ex_progress.h
+++ b/notification-ex/api/notification_ex_progress.h
@@ -29,6 +29,17 @@ extern "C" {
*/
/**
+ * @brief Enumeration for notification_ex progress item types.
+ * @since_tizen 5.5
+ */
+typedef enum _noti_ex_item_progress_type {
+ NOTI_EX_ITEM_PROGRESS_TYPE_DEFAULT, /**< Default */
+ NOTI_EX_ITEM_PROGRESS_TYPE_TIME, /**< Time */
+ NOTI_EX_ITEM_PROGRESS_TYPE_PERCENT, /**< Percent */
+ NOTI_EX_ITEM_PROGRESS_TYPE_PENDING, /**< Pending */
+} noti_ex_item_progress_type_e;
+
+/**
* @brief Creates the notification_ex item handle with progress.
* @details The notification_ex item is the predefined type of notifications.
* The notification can be created with one item or group of items.
@@ -156,6 +167,10 @@ int noti_ex_item_progress_get_min(noti_ex_item_h handle, float *min);
*/
int noti_ex_item_progress_get_max(noti_ex_item_h handle, float *max);
+int noti_ex_item_progress_get_type(noti_ex_item_h handle, int *type);
+
+int noti_ex_item_progress_set_type(noti_ex_item_h handle, int type);
+
/**
* @}
*/
diff --git a/notification-ex/checkbox_item.cc b/notification-ex/checkbox_item.cc
index bdda24d..b80a982 100644
--- a/notification-ex/checkbox_item.cc
+++ b/notification-ex/checkbox_item.cc
@@ -79,6 +79,10 @@ bool CheckBoxItem::IsChecked(void) const {
return impl_->checked_;
}
+void CheckBoxItem::SetChecked(bool checked) {
+ impl_->checked_ = checked;
+}
+
CheckBoxItem::~CheckBoxItem() = default;
CheckBoxItem::Impl::~Impl() = default;
diff --git a/notification-ex/checkbox_item.h b/notification-ex/checkbox_item.h
index 31e360e..2468a34 100644
--- a/notification-ex/checkbox_item.h
+++ b/notification-ex/checkbox_item.h
@@ -93,6 +93,13 @@ class EXPORT_API CheckBoxItem : public AbstractItem {
*/
bool IsChecked() const;
+ /**
+ * @brief Gets the check state of CheckBoxItem.
+ * @since_tizen 5.5
+ * @param[in] checked the check state
+ */
+ void SetChecked(bool checked);
+
private:
class Impl;
std::unique_ptr<Impl> impl_;
diff --git a/notification-ex/stub.cc b/notification-ex/stub.cc
index ec0ad47..afce06f 100644
--- a/notification-ex/stub.cc
+++ b/notification-ex/stub.cc
@@ -545,8 +545,8 @@ extern "C" EXPORT_API int noti_ex_item_checkbox_get_title(noti_ex_item_h handle,
return NOTI_EX_ERROR_NONE;
}
-extern "C" EXPORT_API int noti_ex_item_checkbox_is_checked(noti_ex_item_h handle,
- bool *checked) {
+extern "C" EXPORT_API int noti_ex_item_checkbox_get_check_state(
+ noti_ex_item_h handle, bool *checked) {
if (handle == nullptr || checked == nullptr) {
LOGE("Invalid parameter");
return NOTI_EX_ERROR_INVALID_PARAMETER;
@@ -562,6 +562,25 @@ extern "C" EXPORT_API int noti_ex_item_checkbox_is_checked(noti_ex_item_h handle
return NOTI_EX_ERROR_NONE;
}
+extern "C" EXPORT_API int noti_ex_item_checkbox_set_check_state(
+ noti_ex_item_h handle, bool checked) {
+ if (handle == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ Handle* h = static_cast<Handle*>(handle);
+ if (!h->IsValidType(AbstractItem::CheckBox)) {
+ LOGE("Invalid handle type");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ CheckBoxItem* p = static_cast<CheckBoxItem*>(h->Get());
+ p->SetChecked(checked);
+
+ return NOTI_EX_ERROR_NONE;
+}
+
extern "C" EXPORT_API int noti_ex_item_entry_create(noti_ex_item_h *handle,
const char *id) {
EntryItem* p;
@@ -1339,6 +1358,71 @@ extern "C" EXPORT_API int noti_ex_style_get_geometry(noti_ex_style_h handle,
return NOTI_EX_ERROR_NONE;
}
+extern "C" EXPORT_API int noti_ex_style_get_background_image(
+ noti_ex_style_h handle, char** background_image) {
+ if (handle == nullptr || background_image == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ shared_ptr<Style>* p = static_cast<shared_ptr<Style>*>(handle);
+ *background_image = strdup((*p)->GetBackgroundImage().c_str());
+
+ return NOTI_EX_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int noti_ex_style_set_background_image(
+ noti_ex_style_h handle, char* background_image) {
+ if (handle == nullptr || background_image == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ shared_ptr<Style>* p = static_cast<shared_ptr<Style>*>(handle);
+ (*p)->SetBackgroundImage(background_image);
+
+ return NOTI_EX_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int noti_ex_style_get_background_color(
+ noti_ex_style_h handle, noti_ex_color_h* color) {
+ if (handle == nullptr || color == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ shared_ptr<Style>* p = static_cast<shared_ptr<Style>*>(handle);
+ if ((*p)->GetBackgroundColor() == nullptr) {
+ LOGW("Color info is null");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ shared_ptr<Color>* col = new (std::nothrow) shared_ptr<Color>(
+ new (std::nothrow) Color(*((*p)->GetBackgroundColor())));
+ if (col == nullptr || col->get() == nullptr) {
+ LOGE("Out-of-memory");
+ return NOTI_EX_ERROR_OUT_OF_MEMORY;
+ }
+
+ *color = col;
+
+ return NOTI_EX_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int noti_ex_style_set_background_color(
+ noti_ex_style_h handle, noti_ex_color_h color) {
+ if (handle == nullptr || color == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ shared_ptr<Style>* p = static_cast<shared_ptr<Style>*>(handle);
+ shared_ptr<Color>* col = static_cast<shared_ptr<Color>*>(color);
+ (*p)->SetBackgroundColor(*col);
+
+ return NOTI_EX_ERROR_NONE;
+}
+
extern "C" EXPORT_API int noti_ex_led_info_create(noti_ex_led_info_h *handle,
noti_ex_color_h color) {
if (handle == nullptr) {
@@ -2032,6 +2116,93 @@ extern "C" EXPORT_API int noti_ex_item_set_tag(noti_ex_item_h handle,
return NOTI_EX_ERROR_NONE;
}
+extern "C" EXPORT_API int noti_ex_item_get_ongoing_state(noti_ex_item_h handle,
+ bool* ongoing) {
+ if (handle == nullptr || ongoing == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ Handle* p = static_cast<Handle*>(handle);
+ *ongoing = p->Get()->GetOnGoingState();
+
+ return NOTI_EX_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int noti_ex_item_set_ongoing_state(noti_ex_item_h handle,
+ bool ongoing) {
+ if (handle == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ Handle* p = static_cast<Handle*>(handle);
+ p->Get()->SetOnGoingState(ongoing);
+
+ return NOTI_EX_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int noti_ex_item_check_type_exist(noti_ex_item_h handle,
+ int type, bool* exist) {
+ if (handle == nullptr || exist == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ Handle* p = static_cast<Handle*>(handle);
+ *exist = p->Get()->IsItemTypeExist(type);
+
+ return NOTI_EX_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int noti_ex_item_get_main_type(noti_ex_item_h handle,
+ int* type) {
+ if (handle == nullptr || type == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ Handle* p = static_cast<Handle*>(handle);
+ *type = p->Get()->GetMainType();
+
+ return NOTI_EX_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int noti_ex_item_set_main_type(noti_ex_item_h handle,
+ const char* id, int type) {
+ if (handle == nullptr || id == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ Handle* p = static_cast<Handle*>(handle);
+ if (!(p->Get()->SetMainType(string(id),
+ static_cast<AbstractItem::MainType>(type))))
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+
+ return NOTI_EX_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int noti_ex_item_find_by_main_type(noti_ex_item_h handle,
+ int type, noti_ex_item_h* item) {
+ if (handle == nullptr || item == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ Handle* h = static_cast<Handle*>(handle);
+ if (!h->IsValidType(AbstractItem::Group)) {
+ LOGE("Invalid handle type");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ GroupItem* p = static_cast<GroupItem*>(h->Get());
+ AbstractItem& find_item = p->FindByMainType(static_cast<AbstractItem::MainType>(type));
+ *item = new Handle(&find_item);
+
+ return NOTI_EX_ERROR_NONE;
+}
+
extern "C" EXPORT_API int noti_ex_manager_create(noti_ex_manager_h *handle,
const char *receiver_group, noti_ex_manager_events_s event_callbacks,
void *data) {
@@ -2104,6 +2275,43 @@ extern "C" EXPORT_API int noti_ex_manager_get(noti_ex_manager_h handle,
return NOTI_EX_ERROR_NONE;
}
+extern "C" EXPORT_API int noti_ex_manager_get_by_channel(
+ noti_ex_manager_h handle, char* channel, noti_ex_item_h** items, int* count) {
+ if (handle == nullptr || channel == nullptr ||
+ items == nullptr || count == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ try {
+ ManagerStub* stub = static_cast<ManagerStub*>(handle);
+ list<unique_ptr<item::AbstractItem>> item_list = stub->Get(channel);
+ if (item_list.size() == 0) {
+ *items = nullptr;
+ *count = 0;
+ return NOTI_EX_ERROR_NONE;
+ }
+ noti_ex_item_h* added_item =
+ (noti_ex_item_h*)calloc(item_list.size(), sizeof(noti_ex_item_h));
+ if (added_item == nullptr) {
+ LOGE("Fail to create items");
+ return NOTI_EX_ERROR_OUT_OF_MEMORY;
+ }
+
+ int idx = 0;
+ for (auto& i : item_list) {
+ added_item[idx++] = static_cast<noti_ex_item_h>(new Handle(move(i)));
+ }
+ *items = added_item;
+ *count = item_list.size();
+ } catch (Exception &ex) {
+ LOGE("%s %d", ex.what(), ex.GetErrorCode());
+ return NOTI_EX_ERROR_IO_ERROR;
+ }
+
+ return NOTI_EX_ERROR_NONE;
+}
+
extern "C" EXPORT_API int noti_ex_manager_update(noti_ex_manager_h handle,
noti_ex_item_h noti, int *request_id) {
if (handle == nullptr || noti == nullptr || request_id == nullptr) {
@@ -2333,6 +2541,42 @@ extern "C" EXPORT_API int noti_ex_item_progress_get_max(noti_ex_item_h handle,
return NOTI_EX_ERROR_NONE;
}
+extern "C" EXPORT_API int noti_ex_item_progress_get_type(noti_ex_item_h handle,
+ int* type) {
+ if (handle == nullptr || type == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ Handle *h = static_cast<Handle*>(handle);
+ if (!h->IsValidType(AbstractItem::Progress)) {
+ LOGE("Invalid handle type");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+ ProgressItem* p = static_cast<ProgressItem*>(h->Get());
+ *type = static_cast<noti_ex_item_progress_type_e>(p->GetProgressType());
+
+ return NOTI_EX_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int noti_ex_item_progress_set_type(noti_ex_item_h handle,
+ int type) {
+ if (handle == nullptr) {
+ LOGE("Invalid parameter");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+
+ Handle *h = static_cast<Handle*>(handle);
+ if (!h->IsValidType(AbstractItem::Progress)) {
+ LOGE("Invalid handle type");
+ return NOTI_EX_ERROR_INVALID_PARAMETER;
+ }
+ ProgressItem* p = static_cast<ProgressItem*>(h->Get());
+ p->SetProgressType(static_cast<ProgressItem::Type>(type));
+
+ return NOTI_EX_ERROR_NONE;
+}
+
extern "C" EXPORT_API int noti_ex_reporter_create(noti_ex_reporter_h *handle,
noti_ex_reporter_events_s event_callbacks, void *data) {
if (handle == nullptr) {
diff --git a/notification-ex/text_item.h b/notification-ex/text_item.h
index 9e793fe..5139241 100644
--- a/notification-ex/text_item.h
+++ b/notification-ex/text_item.h
@@ -87,7 +87,7 @@ class EXPORT_API TextItem : public AbstractItem {
/**
* @brief Sets the contents of TextItem.
* @since_tizen 5.5
- * @return The text contents
+ * @param[in] contents the contents of TextItem
*/
void SetContents(std::string contents);
@@ -112,4 +112,4 @@ class EXPORT_API TextItem : public AbstractItem {
} // namespace item
} // namespace notification
-#endif // NOTIFICATION_EX_TEXT_ITEM_H_ \ No newline at end of file
+#endif // NOTIFICATION_EX_TEXT_ITEM_H_