diff options
30 files changed, 228 insertions, 235 deletions
diff --git a/notification-ex/abstract_item.cc b/notification-ex/abstract_item.cc index 8e0edae..e1e4860 100644 --- a/notification-ex/abstract_item.cc +++ b/notification-ex/abstract_item.cc @@ -31,7 +31,6 @@ #endif #define LOG_TAG "NOTIFICATION_EX" - #define ABSTRACT_ITEM_TYPE_KEY "__ABSTRACT_ITEM_TYPE_KEY__" #define ABSTRACT_ITEM_ID_KEY "__ABSTRACT_ITEM_ID_KEY__" #define ABSTRACT_ITEM_SENDER_APPID_KEY "__ABSTRACT_ITEM_SENDER_APPID_KEY__" @@ -49,21 +48,19 @@ string AbstractItem::Impl::GenerateItemId() { return string(uuid) + ":" + id; } -AbstractItem::AbstractItem( - std::shared_ptr<AbstractAction> action) - : impl_(new Impl(this, action)) { +AbstractItem::AbstractItem(std::shared_ptr<AbstractAction> action) + : impl_(new Impl(this, action)) { } AbstractItem::AbstractItem(std::string id, std::shared_ptr<AbstractAction> action) - : impl_(new Impl(this, id, action)) { + : impl_(new Impl(this, id, action)) { } AbstractItem::Impl::Impl(AbstractItem* parent, string id, std::shared_ptr<AbstractAction> action) - : id_(id), action_(action), parent_(parent), + : id_(id), action_(action), parent_(parent), info_(std::make_shared<ItemInfo>(this)) { - if (id_.empty()) id_ = GenerateItemId(); sender_appid_ = util::GetAppId(); @@ -72,7 +69,7 @@ AbstractItem::Impl::Impl(AbstractItem* parent, string id, AbstractItem::Impl::Impl(AbstractItem* parent, std::shared_ptr<AbstractAction> action) - : action_(action), parent_(parent), + : action_(action), parent_(parent), info_(std::make_shared<ItemInfo>(this)) { LOGI("GroupItem created"); @@ -102,7 +99,7 @@ void AbstractItem::Deserialize(Bundle b) { } string AbstractItem::GetId() const { - return impl_->id_; + return impl_->id_; } shared_ptr<AbstractAction> AbstractItem::GetAction() const { diff --git a/notification-ex/app_control_action.cc b/notification-ex/app_control_action.cc index 5108c11..d58c8d7 100644 --- a/notification-ex/app_control_action.cc +++ b/notification-ex/app_control_action.cc @@ -143,5 +143,5 @@ app_control_h AppControlAction::GetAppControl() const { return impl_->control_; } -} //namespace item +} //namespace item } //namespace notification diff --git a/notification-ex/button_item.cc b/notification-ex/button_item.cc index 3042d35..0c862ab 100644 --- a/notification-ex/button_item.cc +++ b/notification-ex/button_item.cc @@ -46,7 +46,7 @@ ButtonItem::~ButtonItem() = default; ButtonItem::Impl::~Impl() = default; ButtonItem::Impl::Impl(ButtonItem* parent, string title) - : title_(title), parent_(parent) { + : title_(title), parent_(parent) { LOGI("ButtonItem impl created"); } diff --git a/notification-ex/chat_message_item.cc b/notification-ex/chat_message_item.cc index ec59249..eb89fb8 100644 --- a/notification-ex/chat_message_item.cc +++ b/notification-ex/chat_message_item.cc @@ -36,16 +36,18 @@ namespace notification { namespace item { ChatMessageItem::ChatMessageItem(std::string id, std::shared_ptr<TextItem> name, - std::shared_ptr<TextItem> text, std::shared_ptr<TextItem> data, - std::shared_ptr<TimeItem> time, Type type, std::shared_ptr<AbstractAction> action) - : AbstractItem(id, action), - impl_(new Impl(this, name, text, data, time, type)) { + std::shared_ptr<TextItem> text, std::shared_ptr<TextItem> data, + std::shared_ptr<TimeItem> time, Type type, + std::shared_ptr<AbstractAction> action) + : AbstractItem(id, action), + impl_(new Impl(this, name, text, data, time, type)) { } ChatMessageItem::Impl::Impl(ChatMessageItem* parent, - std::shared_ptr<TextItem> name, std::shared_ptr<TextItem> text, - std::shared_ptr<TextItem> data, std::shared_ptr<TimeItem> time, Type type) - : parent_(parent), name_(name), text_(text), data_(data), time_(time), type_(type) { + std::shared_ptr<TextItem> name, std::shared_ptr<TextItem> text, + std::shared_ptr<TextItem> data, std::shared_ptr<TimeItem> time, Type type) + : parent_(parent), name_(name), text_(text), data_(data), time_(time), + type_(type) { LOGI("ChatMessageItem impl created"); } diff --git a/notification-ex/checkbox_item.cc b/notification-ex/checkbox_item.cc index 7fb4873..ce2c5fe 100644 --- a/notification-ex/checkbox_item.cc +++ b/notification-ex/checkbox_item.cc @@ -33,12 +33,12 @@ namespace notification { namespace item { CheckBoxItem::CheckBoxItem(std::string id, std::string title, bool checked, - std::shared_ptr<AbstractAction> action) - : AbstractItem(id, action), impl_(new Impl(this, title, checked)) { + std::shared_ptr<AbstractAction> action) + : AbstractItem(id, action), impl_(new Impl(this, title, checked)) { } CheckBoxItem::Impl::Impl(CheckBoxItem* parent, std::string title, bool checked) - : parent_(parent), title_(title), checked_(checked) { + : parent_(parent), title_(title), checked_(checked) { LOGI("CheckBoxItem impl created"); } diff --git a/notification-ex/dbus_connection_manager.cc b/notification-ex/dbus_connection_manager.cc index 5c2abe8..736dfe9 100644 --- a/notification-ex/dbus_connection_manager.cc +++ b/notification-ex/dbus_connection_manager.cc @@ -36,6 +36,7 @@ namespace notification { DBusConnectionManager::DBusConnectionManager() = default; DBusConnectionManager::~DBusConnectionManager() = default; + DBusConnectionManager& DBusConnectionManager::GetInst() { static DBusConnectionManager w_inst; int ret; @@ -115,4 +116,4 @@ int DBusConnectionManager::Init() { return NOTIFICATION_ERROR_NONE; } -} // nampace notification
\ No newline at end of file +} // nampace notification diff --git a/notification-ex/dbus_event_listener.cc b/notification-ex/dbus_event_listener.cc index 455ce93..1aa4b45 100644 --- a/notification-ex/dbus_event_listener.cc +++ b/notification-ex/dbus_event_listener.cc @@ -29,14 +29,13 @@ #endif #define LOG_TAG "NOTIFICATION_EX" - #define MAX_PACKAGE_STR_SIZE 512 using namespace std; namespace notification { DBusEventListener::DBusEventListener(string path) - : impl_(new Impl(this, path)) { + : impl_(new Impl(this, path)) { LOGW("Created (%s)", path.c_str()); } @@ -47,7 +46,7 @@ DBusEventListener::~DBusEventListener() { DBusEventListener::Impl::~Impl() = default; DBusEventListener::Impl::Impl(DBusEventListener* parent, string path) - : subscribe_id_(0), registration_id_(0), path_(path), parent_(parent) { + : subscribe_id_(0), registration_id_(0), path_(path), parent_(parent) { LOGI("ButtonItem impl created"); } @@ -215,4 +214,4 @@ list<Bundle> DBusEventListener::NotifyObserver(const EventInfo& info) { return impl_->observer_->OnRequest(info); } -} // nampace notification
\ No newline at end of file +} // nampace notification diff --git a/notification-ex/dbus_event_listener.h b/notification-ex/dbus_event_listener.h index bea87d7..ea1452b 100644 --- a/notification-ex/dbus_event_listener.h +++ b/notification-ex/dbus_event_listener.h @@ -17,8 +17,6 @@ #ifndef NOTIFICATION_EX_DBUS_LISTENER_H_ #define NOTIFICATION_EX_DBUS_LISTENER_H_ -#include <gio/gio.h> - #include "notification-ex/event_listener_interface.h" namespace notification { diff --git a/notification-ex/dbus_sender.cc b/notification-ex/dbus_sender.cc index c3e9991..760a5a0 100644 --- a/notification-ex/dbus_sender.cc +++ b/notification-ex/dbus_sender.cc @@ -31,21 +31,19 @@ #endif #define LOG_TAG "NOTIFICATION_EX" - #define MAX_PACKAGE_STR_SIZE 512 using namespace std; namespace notification { -DBusSender::DBusSender(string path) - : impl_(new Impl(this, path)) { +DBusSender::DBusSender(string path) : impl_(new Impl(this, path)) { LOGW("Created (%s)", path.c_str()); } DBusSender::Impl::~Impl() = default; DBusSender::Impl::Impl(DBusSender* parent, string path) - : path_(path), parent_(parent) { + : path_(path), parent_(parent) { LOGI("ButtonItem impl created"); } @@ -53,8 +51,8 @@ DBusSender::~DBusSender() { LOGW("Destroyed"); } -bool DBusSender::Impl::EmitSignal(string bus_name, - string signal_name, GVariant* data) { +bool DBusSender::Impl::EmitSignal(string bus_name, string signal_name, + GVariant* data) { GError* err = NULL; gboolean result = TRUE; @@ -78,8 +76,8 @@ bool DBusSender::Impl::EmitSignal(string bus_name, return result; } -void DBusSender::Notify(const EventInfo& info, - list<Bundle> serialized, string dest_appid) { +void DBusSender::Notify(const EventInfo& info, list<Bundle> serialized, + string dest_appid) { string signal_name = EventInfo::GetString(info.GetEventType()); string appid = util::GetAppId(); string bus_name = ""; @@ -104,8 +102,8 @@ void DBusSender::Notify(const EventInfo& info, g_variant_builder_unref(builder); } -GDBusMessage* DBusSender::Impl::MethodCall(string appid, - string method_name, Bundle serialized) { +GDBusMessage* DBusSender::Impl::MethodCall(string appid, string method_name, + Bundle serialized) { GError* err = nullptr; GDBusMessage* msg = g_dbus_message_new_method_call( DBusConnectionManager::GetInst().GetDataProviderMasterName().c_str(), @@ -153,4 +151,4 @@ std::list<Bundle> DBusSender::Request(const EventInfo& info) { return ret_list; } -} // nampace notification
\ No newline at end of file +} // nampace notification diff --git a/notification-ex/dbus_sender.h b/notification-ex/dbus_sender.h index a347bcf..b9c9659 100644 --- a/notification-ex/dbus_sender.h +++ b/notification-ex/dbus_sender.h @@ -17,8 +17,6 @@ #ifndef NOTIFICATION_EX_DBUS_SENDER_H_ #define NOTIFICATION_EX_DBUS_SENDER_H_ -#include <gio/gio.h> - #include "notification-ex/ex_bundle.h" #include "notification-ex/event_sender_interface.h" #include "notification-ex/event_info.h" diff --git a/notification-ex/default_action_factory.cc b/notification-ex/default_action_factory.cc index e60012e..89f7689 100644 --- a/notification-ex/default_action_factory.cc +++ b/notification-ex/default_action_factory.cc @@ -35,16 +35,16 @@ namespace item { unique_ptr<AbstractAction> DefaultActionFactory::CreateAction(int type) { switch (type) { - case AbstractAction::NullObject : - THROW(NOTIFICATION_ERROR_INVALID_PARAMETER); - case AbstractAction::AppControl : - app_control_h control; - app_control_create(&control); - return unique_ptr<AbstractAction>(new AppControlAction(control)); - case AbstractAction::Visibility : - return unique_ptr<AbstractAction>(new VisibilityAction()); - case AbstractAction::Custom : - return nullptr; + case AbstractAction::NullObject : + THROW(NOTIFICATION_ERROR_INVALID_PARAMETER); + case AbstractAction::AppControl : + app_control_h control; + app_control_create(&control); + return unique_ptr<AbstractAction>(new AppControlAction(control)); + case AbstractAction::Visibility : + return unique_ptr<AbstractAction>(new VisibilityAction()); + case AbstractAction::Custom : + return nullptr; } return nullptr; diff --git a/notification-ex/default_item_factory.cc b/notification-ex/default_item_factory.cc index bf77bb7..13e43d7 100644 --- a/notification-ex/default_item_factory.cc +++ b/notification-ex/default_item_factory.cc @@ -45,35 +45,35 @@ namespace item { unique_ptr<AbstractItem> DefaultItemFactory::CreateItem(int type) { switch (type) { - case AbstractItem::NullObject : - THROW(NOTIFICATION_ERROR_INVALID_PARAMETER); - case AbstractItem::Text : - return unique_ptr<AbstractItem>(new TextItem("","")); - case AbstractItem::Icon : - return unique_ptr<AbstractItem>(new IconItem("")); - case AbstractItem::Image : - return unique_ptr<AbstractItem>(new ImageItem("")); - case AbstractItem::Button : - return unique_ptr<AbstractItem>(new ButtonItem("")); - case AbstractItem::ChatMessage : - return unique_ptr<AbstractItem>(new ChatMessageItem("", + case AbstractItem::NullObject : + THROW(NOTIFICATION_ERROR_INVALID_PARAMETER); + case AbstractItem::Text : + return unique_ptr<AbstractItem>(new TextItem("","")); + case AbstractItem::Icon : + return unique_ptr<AbstractItem>(new IconItem("")); + case AbstractItem::Image : + return unique_ptr<AbstractItem>(new ImageItem("")); + case AbstractItem::Button : + return unique_ptr<AbstractItem>(new ButtonItem("")); + case AbstractItem::ChatMessage : + return unique_ptr<AbstractItem>(new ChatMessageItem("", nullptr, nullptr, nullptr, nullptr, ChatMessageItem::Type::user)); - case AbstractItem::CheckBox : - return unique_ptr<AbstractItem>(new CheckBoxItem("", "")); - case AbstractItem::IconText : - return unique_ptr<AbstractItem>(new IconTextItem("", nullptr, nullptr)); - case AbstractItem::InputSelector : - return unique_ptr<AbstractItem>(new InputSelectorItem()); - case AbstractItem::Group : - return unique_ptr<AbstractItem>(new GroupItem()); - case AbstractItem::Entry : - return unique_ptr<AbstractItem>(new EntryItem("")); - case AbstractItem::Progress : - return unique_ptr<AbstractItem>(new ProgressItem(0.0, 0.0, 0.0)); - case AbstractItem::Time : - return unique_ptr<AbstractItem>(new TimeItem()); - case AbstractItem::Custom : - return unique_ptr<AbstractItem>(new ButtonItem("")); + case AbstractItem::CheckBox : + return unique_ptr<AbstractItem>(new CheckBoxItem("", "")); + case AbstractItem::IconText : + return unique_ptr<AbstractItem>(new IconTextItem("", nullptr, nullptr)); + case AbstractItem::InputSelector : + return unique_ptr<AbstractItem>(new InputSelectorItem()); + case AbstractItem::Group : + return unique_ptr<AbstractItem>(new GroupItem()); + case AbstractItem::Entry : + return unique_ptr<AbstractItem>(new EntryItem("")); + case AbstractItem::Progress : + return unique_ptr<AbstractItem>(new ProgressItem(0.0, 0.0, 0.0)); + case AbstractItem::Time : + return unique_ptr<AbstractItem>(new TimeItem()); + case AbstractItem::Custom : + return unique_ptr<AbstractItem>(new ButtonItem("")); } return nullptr; diff --git a/notification-ex/entry_item.cc b/notification-ex/entry_item.cc index dd62de0..9b0bdc6 100644 --- a/notification-ex/entry_item.cc +++ b/notification-ex/entry_item.cc @@ -34,15 +34,15 @@ namespace notification { namespace item { EntryItem::EntryItem(std::shared_ptr<AbstractAction> action) - : AbstractItem(action), impl_(new Impl(this)) { + : AbstractItem(action), impl_(new Impl(this)) { } EntryItem::EntryItem(std::string id, std::shared_ptr<AbstractAction> action) - : AbstractItem(id, action), impl_(new Impl(this)) { + : AbstractItem(id, action), impl_(new Impl(this)) { } EntryItem::Impl::Impl(EntryItem* parent) - : parent_(parent) { + : parent_(parent) { LOGI("EntryItem created"); } diff --git a/notification-ex/event_info.cc b/notification-ex/event_info.cc index a0d9f4b..0ffbe10 100644 --- a/notification-ex/event_info.cc +++ b/notification-ex/event_info.cc @@ -37,14 +37,14 @@ namespace notification { EventInfo::EventInfo(EventInfo::EventType type, std::string owner, std::string channel, std::string item_id, std::string tag) - : impl_(new Impl(this, type, owner, channel, item_id, tag)) { + : impl_(new Impl(this, type, owner, channel, item_id, tag)) { } EventInfo::~EventInfo() = default; EventInfo::Impl::~Impl() = default; EventInfo::Impl::Impl(EventInfo* parent, EventInfo::EventType type, std::string owner, std::string channel, std::string item_id, std::string tag) - : type_(type), owner_(owner), channel_(channel), item_id_(item_id), + : type_(type), owner_(owner), channel_(channel), item_id_(item_id), tag_(tag), parent_(parent) { LOGI("EventInfo impl created"); } @@ -60,18 +60,18 @@ EventInfo::EventInfo(Bundle serialized) { string EventInfo::GetString(EventInfo::EventType type) { switch(type) { - case Post: - return "Post"; - break; - case Update: - return "Update"; - break; - case Delete: - return "Delete"; - break; - case Get: - return "Get"; - break; + case Post: + return "Post"; + break; + case Update: + return "Update"; + break; + case Delete: + return "Delete"; + break; + case Get: + return "Get"; + break; } return ""; } diff --git a/notification-ex/ex_util.cc b/notification-ex/ex_util.cc index dca6606..a7ddcaf 100644 --- a/notification-ex/ex_util.cc +++ b/notification-ex/ex_util.cc @@ -16,7 +16,6 @@ #include <dlog.h> #include <aul.h> -#include <aul.h> #include <fcntl.h> #include <unistd.h> @@ -34,66 +33,67 @@ using namespace std; namespace notification { namespace util { - GQuark GetQuarkFromString(string str) { - return g_quark_from_string(str.c_str()); - } +GQuark GetQuarkFromString(string str) { + return g_quark_from_string(str.c_str()); +} - std::string GetQuarkToString(GQuark quark) { - return g_quark_to_string(quark); - } +std::string GetQuarkToString(GQuark quark) { + return g_quark_to_string(quark); +} + +string GetAppId() { + static string appid = ""; + char appid_buf[MAX_PACKAGE_STR_SIZE] = {0, }; - string GetAppId() { - static string appid = ""; - char appid_buf[MAX_PACKAGE_STR_SIZE] = {0, }; + if (!appid.empty()) { + LOGI("appid(%s)", appid.c_str()); + return appid; + } - if (!appid.empty()) { - LOGI("appid(%s)", appid.c_str()); - return appid; + int pid = getpid(); + int ret = aul_app_get_appid_bypid(pid, appid_buf, sizeof(appid_buf)); + if (ret == AUL_R_OK) { + appid = string(appid_buf); + } else { + int fd, i; + int last_slash_index = 0; + char proc_buf[MAX_PACKAGE_STR_SIZE] = { 0, }; + + snprintf(proc_buf, sizeof(proc_buf), "/proc/%d/cmdline", pid); + + fd = open(proc_buf, O_RDONLY); + if (fd < 0) { + LOGE("Fail to get appid (%d)", errno); + return ""; } - int pid = getpid(); - int ret = aul_app_get_appid_bypid(pid, appid_buf, sizeof(appid_buf)); - if (ret == AUL_R_OK) { - appid = string(appid_buf); - } else { - int fd, i; - int last_slash_index = 0; - char proc_buf[MAX_PACKAGE_STR_SIZE] = { 0, }; - - snprintf(proc_buf, sizeof(proc_buf), "/proc/%d/cmdline", pid); - - fd = open(proc_buf, O_RDONLY); - if (fd < 0) { - LOGE("Fail to get appid (%d)", errno); - return ""; - } - - ret = read(fd, appid_buf, sizeof(appid_buf) - 1); - if (ret <= 0) { - LOGE("Fail to get appid (%d)", errno); - close(fd); - return ""; - } + ret = read(fd, appid_buf, sizeof(appid_buf) - 1); + if (ret <= 0) { + LOGE("Fail to get appid (%d)", errno); close(fd); + return ""; + } + close(fd); - for (i = 0 ; i < ret ; i++) { - if (appid_buf[i] == '/') - last_slash_index = i; - } - - if (last_slash_index == (ret - 1)) { - LOGE("Fail to get appid (%s)", appid_buf); - return ""; - } + for (i = 0 ; i < ret ; i++) { + if (appid_buf[i] == '/') + last_slash_index = i; + } - if (last_slash_index == 0) - appid = string(appid_buf); - else - appid = string(&appid_buf[last_slash_index + 1]); + if (last_slash_index == (ret - 1)) { + LOGE("Fail to get appid (%s)", appid_buf); + return ""; } - LOGI("appid(%s)", appid.c_str()); - return appid; + if (last_slash_index == 0) + appid = string(appid_buf); + else + appid = string(&appid_buf[last_slash_index + 1]); } + + LOGI("appid(%s)", appid.c_str()); + return appid; +} + } // namespace util } // namespace watchface_complication diff --git a/notification-ex/ex_util.h b/notification-ex/ex_util.h index c4250d4..191cd68 100644 --- a/notification-ex/ex_util.h +++ b/notification-ex/ex_util.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/notification-ex/factory_manager.cc b/notification-ex/factory_manager.cc index 4945d50..10e3118 100644 --- a/notification-ex/factory_manager.cc +++ b/notification-ex/factory_manager.cc @@ -33,7 +33,6 @@ namespace item { FactoryManager& FactoryManager::GetInst() { static FactoryManager manager; - return manager; } diff --git a/notification-ex/group_item.cc b/notification-ex/group_item.cc index 6e65f0a..db2a7ec 100644 --- a/notification-ex/group_item.cc +++ b/notification-ex/group_item.cc @@ -42,15 +42,15 @@ namespace notification { namespace item { GroupItem::GroupItem(string id, shared_ptr<AbstractAction> action) - : AbstractItem(id), impl_(new Impl(this)) { + : AbstractItem(id), impl_(new Impl(this)) { } GroupItem::GroupItem(shared_ptr<AbstractAction> action) - : AbstractItem(), impl_(new Impl(this)) { + : AbstractItem(), impl_(new Impl(this)) { } GroupItem::Impl::Impl(GroupItem* parent) - : parent_(parent) { + : parent_(parent) { LOGI("GroupItem created"); } diff --git a/notification-ex/icon_item.cc b/notification-ex/icon_item.cc index 8e266a1..2b3a0d6 100644 --- a/notification-ex/icon_item.cc +++ b/notification-ex/icon_item.cc @@ -30,16 +30,16 @@ namespace notification { namespace item { IconItem::IconItem(std::string iconPath, std::shared_ptr<AbstractAction> action) - : ImageItem(iconPath, action) , impl_(new Impl(this, iconPath)) { + : ImageItem(iconPath, action) , impl_(new Impl(this, iconPath)) { } IconItem::IconItem(std::string id, std::string iconPath, - std::shared_ptr<AbstractAction> action) - : ImageItem(id, iconPath, action), impl_(new Impl(this, iconPath)) { + std::shared_ptr<AbstractAction> action) + : ImageItem(id, iconPath, action), impl_(new Impl(this, iconPath)) { } IconItem::Impl::Impl(IconItem* parent, std::string iconPath) - : parent_(parent), iconPath_(iconPath) { + : parent_(parent), iconPath_(iconPath) { LOGI("IconItem impl created"); } diff --git a/notification-ex/icon_text_item.cc b/notification-ex/icon_text_item.cc index a237ae9..813a230 100644 --- a/notification-ex/icon_text_item.cc +++ b/notification-ex/icon_text_item.cc @@ -33,14 +33,13 @@ namespace notification { namespace item { IconTextItem::IconTextItem(std::string id, std::shared_ptr<IconItem> icon, - std::shared_ptr<TextItem> text, std::shared_ptr<AbstractAction> action) - : AbstractItem(id, action), - impl_(new Impl(this, icon, text)) { + std::shared_ptr<TextItem> text, std::shared_ptr<AbstractAction> action) + : AbstractItem(id, action), impl_(new Impl(this, icon, text)) { } IconTextItem::Impl::Impl(IconTextItem* parent, std::shared_ptr<IconItem> icon, - std::shared_ptr<TextItem> text) - : parent_(parent), icon_(icon), text_(text) { + std::shared_ptr<TextItem> text) + : parent_(parent), icon_(icon), text_(text) { LOGI("IconTextItem impl created"); } diff --git a/notification-ex/image_item.cc b/notification-ex/image_item.cc index bce699d..c829f5e 100644 --- a/notification-ex/image_item.cc +++ b/notification-ex/image_item.cc @@ -32,17 +32,17 @@ namespace notification { namespace item { ImageItem::ImageItem(std::string imagePath, - std::shared_ptr<AbstractAction> action) - : AbstractItem(action), impl_(new Impl(this, imagePath)) { + std::shared_ptr<AbstractAction> action) + : AbstractItem(action), impl_(new Impl(this, imagePath)) { } ImageItem::ImageItem(std::string id, std::string imagePath, - std::shared_ptr<AbstractAction> action) - : AbstractItem(id, action), impl_(new Impl(this, imagePath)) { + std::shared_ptr<AbstractAction> action) + : AbstractItem(id, action), impl_(new Impl(this, imagePath)) { } ImageItem::Impl::Impl(ImageItem* parent, std::string imagePath) - : parent_(parent), imagePath_(imagePath) { + : parent_(parent), imagePath_(imagePath) { LOGI("ImageItem impl created"); } @@ -60,7 +60,6 @@ Bundle ImageItem::Serialize() const { void ImageItem::Deserialize(Bundle b) { AbstractItem::Deserialize(b); - impl_->imagePath_ = b.GetString(IMAGE_PATH_KEY); } @@ -78,6 +77,5 @@ std::string ImageItem::GetImagePath() const { ImageItem::~ImageItem() = default; ImageItem::Impl::~Impl() = default; - } // namespace item } // namespace notification diff --git a/notification-ex/input_selector_item.cc b/notification-ex/input_selector_item.cc index 37867e2..f8ea926 100644 --- a/notification-ex/input_selector_item.cc +++ b/notification-ex/input_selector_item.cc @@ -36,18 +36,18 @@ namespace notification { namespace item { InputSelectorItem::InputSelectorItem(std::shared_ptr<AbstractAction> action) - : AbstractItem(action), impl_(new Impl(this)) { + : AbstractItem(action), impl_(new Impl(this)) { } InputSelectorItem::InputSelectorItem(string id, std::shared_ptr<AbstractAction> action) - : AbstractItem(id, action), impl_(new Impl(this)) { + : AbstractItem(id, action), impl_(new Impl(this)) { } InputSelectorItem::~InputSelectorItem() = default; InputSelectorItem::Impl::~Impl() = default; InputSelectorItem::Impl::Impl(InputSelectorItem* parent) - : parent_(parent) { + : parent_(parent) { LOGI("InputSelectorItem impl created"); } diff --git a/notification-ex/item_info.cc b/notification-ex/item_info.cc index 6bf60ff..8556e0c 100644 --- a/notification-ex/item_info.cc +++ b/notification-ex/item_info.cc @@ -31,7 +31,8 @@ using namespace std; namespace notification { namespace item { -AbstractItem::Impl::ItemInfo::ItemInfo(AbstractItem::Impl* impl) : impl_(impl) {} +AbstractItem::Impl::ItemInfo::ItemInfo(AbstractItem::Impl* impl) : impl_(impl) { +} int AbstractItem::Impl::ItemInfo::GetVersion() const { return impl_->version_; @@ -66,6 +67,5 @@ std::list<std::string> AbstractItem::Impl::ItemInfo::GetHideViewerList() const { return impl_->hide_viewer_list_; } - } // namespace item } // namespace notification diff --git a/notification-ex/manager.cc b/notification-ex/manager.cc index d46b1e1..78d83c2 100644 --- a/notification-ex/manager.cc +++ b/notification-ex/manager.cc @@ -42,16 +42,17 @@ using namespace notification::item; namespace notification { Manager::Manager(IEventSender* sender, IEventListener* listener, string receiver_group) - : impl_(new Impl(this, sender, listener, receiver_group)) { + : impl_(new Impl(this, sender, listener, receiver_group)) { } Manager::~Manager() = default; Manager::Impl::~Impl() { listener_->UnRegisterObserver(parent_); } + Manager::Impl::Impl(Manager* parent, IEventSender* sender, IEventListener* listener, string receiver_group) - : sender_(sender), listener_(listener), receiver_group_(receiver_group), + : sender_(sender), listener_(listener), receiver_group_(receiver_group), parent_(parent) { LOGI("impl created"); listener_->RegisterObserver(parent_); @@ -81,8 +82,7 @@ void Manager::Hide(shared_ptr<item::AbstractItem> noti) { } shared_ptr<item::AbstractItem> Manager::FindByRootID(string id) { - EventInfo info(EventInfo::Get, - util::GetAppId(), "", id); + EventInfo info(EventInfo::Get, util::GetAppId(), "", id); list<Bundle> result = impl_->sender_->Request(info); if (result.size() == 0) { LOGE("Fail to get noti"); @@ -104,7 +104,8 @@ list<shared_ptr<item::AbstractItem>> Manager::Get() { return gen_list; } -void Manager::SendEvent(const EventInfo& info, shared_ptr<item::AbstractItem> noti) { +void Manager::SendEvent(const EventInfo& info, + shared_ptr<item::AbstractItem> noti) { Bundle serialized = noti->Serialize(); Bundle serialized_info = info.Serialize(); list<Bundle> serialized_list {serialized}; @@ -124,46 +125,48 @@ void Manager::OnEvent(const EventInfo& info, list<Bundle> serialized) { shared_ptr<AbstractItem> gen_item; const EventInfo::EventType type = info.GetEventType(); switch(type) { - case EventInfo::Post: - { - list<shared_ptr<item::AbstractItem>> added; - for (auto& i : serialized) { - gen_item = ItemInflator::Create(i); - if (gen_item->CanReceive(impl_->receiver_group_)) - added.emplace_back(gen_item); + case EventInfo::Post: { + list<shared_ptr<item::AbstractItem>> added; + for (auto& i : serialized) { + gen_item = ItemInflator::Create(i); + if (gen_item->CanReceive(impl_->receiver_group_)) + added.emplace_back(gen_item); + } + if (added.size() > 0) + OnAdd(info, added); + break; } - if (added.size() > 0) - OnAdd(info, added); - break; - } - case EventInfo::Update: - { - for (auto& i : serialized) { - gen_item = ItemInflator::Create(i); - if (gen_item->CanReceive(impl_->receiver_group_)) - OnUpdate(info, gen_item); + case EventInfo::Update: { + for (auto& i : serialized) { + gen_item = ItemInflator::Create(i); + if (gen_item->CanReceive(impl_->receiver_group_)) + OnUpdate(info, gen_item); + } + break; } - break; - } - case EventInfo::Delete: - for (auto& i : serialized) { - gen_item = ItemInflator::Create(i); - if (gen_item->CanReceive(impl_->receiver_group_)) - OnDelete(info, gen_item); + case EventInfo::Delete: { + for (auto& i : serialized) { + gen_item = ItemInflator::Create(i); + if (gen_item->CanReceive(impl_->receiver_group_)) + OnDelete(info, gen_item); + } + break; } - break; - case EventInfo::Get: - break; + case EventInfo::Get: + break; } } -void Manager::OnAdd(const EventInfo& info, list<shared_ptr<item::AbstractItem>> addedItem) { +void Manager::OnAdd(const EventInfo& info, + list<shared_ptr<item::AbstractItem>> addedItem) { } -void Manager::OnUpdate(const EventInfo& info, shared_ptr<item::AbstractItem> updatedItem) { +void Manager::OnUpdate(const EventInfo& info, + shared_ptr<item::AbstractItem> updatedItem) { } -void Manager::OnDelete(const EventInfo& info, shared_ptr<item::AbstractItem> deletedItem) { +void Manager::OnDelete(const EventInfo& info, + shared_ptr<item::AbstractItem> deletedItem) { } list<shared_ptr<item::AbstractItem>> Manager::OnRequestEvent(const EventInfo& info) { @@ -174,4 +177,4 @@ string Manager::GetPath() { return NOTIFICATION_EX_MANAGER_OBJECT_PATH; } -} // nampace notification
\ No newline at end of file +} // nampace notification diff --git a/notification-ex/null_item.cc b/notification-ex/null_item.cc index 5d688d2..3c0f7f8 100644 --- a/notification-ex/null_item.cc +++ b/notification-ex/null_item.cc @@ -31,12 +31,12 @@ namespace notification { namespace item { NullItem::NullItem(shared_ptr<AbstractAction> action) - : AbstractItem(action) { + : AbstractItem(action) { } NullItem::NullItem(string id, shared_ptr<AbstractAction> action) - : AbstractItem(id, action) { + : AbstractItem(id, action) { } NullItem::~NullItem() = default; diff --git a/notification-ex/progress_item.cc b/notification-ex/progress_item.cc index 36dd5df..9738ea3 100644 --- a/notification-ex/progress_item.cc +++ b/notification-ex/progress_item.cc @@ -38,21 +38,22 @@ namespace item { ProgressItem::ProgressItem(float min_val, float current, float max_val, std::shared_ptr<AbstractAction> action) - : AbstractItem(action), + : AbstractItem(action), impl_(new Impl(min_val, current, max_val, this)) { } -ProgressItem::ProgressItem(string id, float min_val, float current, float max_val, - std::shared_ptr<AbstractAction> action) - : AbstractItem(id, action), - impl_(new Impl(min_val, current, max_val, this)) { +ProgressItem::ProgressItem(string id, float min_val, float current, + float max_val, std::shared_ptr<AbstractAction> action) + : AbstractItem(id, action), + impl_(new Impl(min_val, current, max_val, this)) { } ProgressItem::~ProgressItem() = default; ProgressItem::Impl::~Impl() = default; -ProgressItem::Impl::Impl(float min_val, float current, float max_val, ProgressItem* parent) - : min_(min_val), current_(current), max_(max_val), parent_(parent) { +ProgressItem::Impl::Impl(float min_val, float current, float max_val, + ProgressItem* parent) + : min_(min_val), current_(current), max_(max_val), parent_(parent) { if (min_val > current || max_val < current) THROW(NOTIFICATION_ERROR_INVALID_PARAMETER); LOGI("ProgressItem impl created"); diff --git a/notification-ex/reporter.cc b/notification-ex/reporter.cc index 893b615..bd32670 100644 --- a/notification-ex/reporter.cc +++ b/notification-ex/reporter.cc @@ -32,7 +32,6 @@ #endif #define LOG_TAG "NOTIFICATION_EX" - #define MAX_PACKAGE_STR_SIZE 512 #define NOTIFICATION_EX_REPORTER_OBJECT_PATH "/org/tizen/notification_ex_reporter" @@ -41,16 +40,17 @@ using namespace notification::item; namespace notification { Reporter::Reporter(IEventSender* sender, IEventListener* listener) - : impl_(new Impl(this, sender, listener)) { + : impl_(new Impl(this, sender, listener)) { } Reporter::~Reporter() = default; Reporter::Impl::~Impl() { listener_->UnRegisterObserver(parent_); } + Reporter::Impl::Impl(Reporter* parent, IEventSender* sender, IEventListener* listener) - : sender_(sender), listener_(listener), parent_(parent) { + : sender_(sender), listener_(listener), parent_(parent) { LOGI("impl created"); listener_->RegisterObserver(parent_); } @@ -88,8 +88,7 @@ void Reporter::Remove(std::shared_ptr<AbstractItem> noti) { std::shared_ptr<AbstractItem> Reporter::FindByRootID(std::string id) { Bundle serialized; - EventInfo info(EventInfo::Get, - util::GetAppId(), "", id); + EventInfo info(EventInfo::Get, util::GetAppId(), "", id); list<Bundle> result = impl_->sender_->Request(info); if (result.size() == 0) { LOGE("Fail to get noti"); @@ -100,7 +99,8 @@ std::shared_ptr<AbstractItem> Reporter::FindByRootID(std::string id) { return gen_item; } -void Reporter::SendEvent(const EventInfo& info, shared_ptr<item::AbstractItem> noti) { +void Reporter::SendEvent(const EventInfo& info, + shared_ptr<item::AbstractItem> noti) { Bundle serialized = noti->Serialize(); list<Bundle> serialized_list {serialized}; impl_->sender_->Notify(info, serialized_list); @@ -136,4 +136,4 @@ string Reporter::GetPath() { return NOTIFICATION_EX_REPORTER_OBJECT_PATH; } -} // nampace notification
\ No newline at end of file +} // nampace notification diff --git a/notification-ex/text_item.cc b/notification-ex/text_item.cc index f5d5ed2..075df87 100644 --- a/notification-ex/text_item.cc +++ b/notification-ex/text_item.cc @@ -33,12 +33,12 @@ namespace notification { namespace item { TextItem::TextItem(std::string id, std::string text, std::string hyperlink, - std::shared_ptr<AbstractAction> action) - : AbstractItem(id, action), impl_(new Impl(this, text, hyperlink)) { + std::shared_ptr<AbstractAction> action) + : AbstractItem(id, action), impl_(new Impl(this, text, hyperlink)) { } TextItem::Impl::Impl(TextItem* parent, std::string text, std::string hyperlink) - : parent_(parent), text_(text), hyperlink_(hyperlink) { + : parent_(parent), text_(text), hyperlink_(hyperlink) { LOGI("TextItem created"); } @@ -87,4 +87,4 @@ std::string TextItem::GetHyperLink() const { } } // namespace item -} // namespace notification
\ No newline at end of file +} // namespace notification diff --git a/notification-ex/time_item.cc b/notification-ex/time_item.cc index 0816373..e97cd91 100644 --- a/notification-ex/time_item.cc +++ b/notification-ex/time_item.cc @@ -32,7 +32,7 @@ namespace notification { namespace item { TimeItem::TimeItem(std::shared_ptr<AbstractAction> action) - : AbstractItem(action), impl_(new Impl(this, 0)) { + : AbstractItem(action), impl_(new Impl(this, 0)) { time_t current_time; time(¤t_time); @@ -40,16 +40,16 @@ TimeItem::TimeItem(std::shared_ptr<AbstractAction> action) } TimeItem::TimeItem(time_t time, std::shared_ptr<AbstractAction> action) - : AbstractItem(action), impl_(new Impl(this, time)) { + : AbstractItem(action), impl_(new Impl(this, time)) { } TimeItem::TimeItem(std::string id, time_t time, - std::shared_ptr<AbstractAction> action) - : AbstractItem(id, action), impl_(new Impl(this, time)) { + std::shared_ptr<AbstractAction> action) + : AbstractItem(id, action), impl_(new Impl(this, time)) { } TimeItem::Impl::Impl(TimeItem* parent, time_t time) - : parent_(parent), time_(time) { + : parent_(parent), time_(time) { LOGI("TimeItem impl created"); } diff --git a/notification-ex/visibility_action.cc b/notification-ex/visibility_action.cc index 1ec90b5..f274eb2 100644 --- a/notification-ex/visibility_action.cc +++ b/notification-ex/visibility_action.cc @@ -124,5 +124,5 @@ void VisibilityAction::SetVisibility(std::string id, bool visible) { id, visible)); } -} //namespace item +} //namespace item } //namespace notification |