Add request id to event info 61/201861/4
authorhyunho <hhstark.kang@samsung.com>
Wed, 20 Mar 2019 07:17:04 +0000 (16:17 +0900)
committerhyunho <hhstark.kang@samsung.com>
Thu, 21 Mar 2019 04:18:39 +0000 (13:18 +0900)
Change-Id: I8faa05630da98f211b52ba967134577a99e161a2
Signed-off-by: hyunho <hhstark.kang@samsung.com>
44 files changed:
notification-ex/abstract_item.cc
notification-ex/abstract_item.h
notification-ex/app_control_action.h
notification-ex/chat_message_item.h
notification-ex/chat_message_item_implementation.h
notification-ex/checkbox_item.cc
notification-ex/checkbox_item.h
notification-ex/checkbox_item_implementation.h
notification-ex/dbus_connection_manager.cc
notification-ex/dbus_event_listener.cc
notification-ex/dbus_event_listener_implementation.h
notification-ex/dbus_sender.cc
notification-ex/dbus_sender_implementation.h
notification-ex/entry_item.h
notification-ex/event_info.cc
notification-ex/event_info_implementation.h
notification-ex/event_info_internal.h
notification-ex/ex_bundle.h
notification-ex/ex_util.cc
notification-ex/ex_util.h
notification-ex/icon_item.cc
notification-ex/icon_item.h
notification-ex/icon_item_implementation.h
notification-ex/icon_text_item.h
notification-ex/icon_text_item_implementation.h
notification-ex/ievent_info.h
notification-ex/ievent_info_internal.h
notification-ex/iitem_info.h
notification-ex/iitem_info_internal.h
notification-ex/image_item.h
notification-ex/image_item_implementation.h
notification-ex/item_info_internal.h
notification-ex/manager.cc
notification-ex/manager.h
notification-ex/manager_implementation.h
notification-ex/reporter.cc
notification-ex/reporter.h
notification-ex/reporter_implementation.h
notification-ex/text_item.h
notification-ex/time_item.cc
notification-ex/time_item.h
notification-ex/time_item_implementation.h
unittest/src/test_abstract_item.cc
unittest/src/test_bundle.cc

index f3a80a8871172100ce3560a91bd75a183de88499..5c1f0f2bbbe853bd610b070a9a123f3499d83649 100644 (file)
@@ -414,9 +414,5 @@ void AbstractItem::SetUid(int uid) {
   impl_->uid_ = uid;
 }
 
-int AbstractItem::GetRequestId() {
-  return impl_->request_id_;
-}
-
 }  // namespace item
 }  // namespace notification
index 172b31be6d6d74db34fbbeb402972523e124d449..dd8bf24526ddd74035b5e1c3b43eae62c08fbd7c 100644 (file)
@@ -258,7 +258,6 @@ class EXPORT_API AbstractItem {
   time_t GetTime();
   int GetUid();
   void SetUid(int uid);
-  int GetRequestId();
 
  private:
   class Impl;
index 6d53e9254c7d16c8ac8640d51dd47e47e23c53c5..875e27f9e53a567cd3ba974906d4a6caa53e7073 100644 (file)
@@ -48,4 +48,3 @@ class EXPORT_API AppControlAction : public AbstractAction {
 }  // namespace notification
 
 #endif  // NOTIFICATION_EX_APP_CONTROL_ACTION_H_
-
index 03899e3b300245b24a698824812a22fac23b83d8..4585035432c2f37c1974db4720ee3bfcfdaa28cc 100644 (file)
@@ -60,5 +60,5 @@ class EXPORT_API ChatMessageItem : public AbstractItem {
 };  // class ChatMessageItem
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_CHAT_MESSAGE_ITEM_H_
index 299a0a1928867edfa3e532a9ff8218b2e65c6d3f..b6e0cc474b4013ec5c9604896e2b6290949dcd3a 100644 (file)
@@ -48,5 +48,5 @@ class ChatMessageItem::Impl {
 };
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_CHAT_MESSAGE_ITEM_IMPLEMENTATION_H_
index ce2c5fed80c617191d4e6e62ac5cb656f2d01f88..ed5e99a6c888b5b05aa8ef5a8a005308f19e72a2 100644 (file)
@@ -82,4 +82,4 @@ CheckBoxItem::~CheckBoxItem() = default;
 CheckBoxItem::Impl::~Impl() = default;
 
 }  // namespace item
-}  // namespace notification_ex
+}  // namespace notification
index 6eab2ead05ba9a9eb27cec952e09550cd0bc3b97..c71fdf58c0b93efd0b00f5f2c3d796de4cddc3e4 100644 (file)
@@ -45,5 +45,5 @@ private:
 };  // class CheckBoxItem
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_CHECKBOX_ITEM_H_
index 83de7517d29d0b47727c5b0b0973591b4789769a..1435fb6090815704451ecd71aca031ec9773d9e6 100644 (file)
@@ -41,5 +41,5 @@ class CheckBoxItem::Impl {
 };
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_CHECKBOX_ITEM_IMPLEMENTATION_H_
index 736dfe9881be415d29ccaba659708f6936f029f1..2cf9297168f83e2e124e8b524fdbb1c02dac8b67 100644 (file)
@@ -116,4 +116,4 @@ int DBusConnectionManager::Init() {
   return NOTIFICATION_ERROR_NONE;
 }
 
-}  // nampace notification
+}  // namespace notification
index 0ff42d195ae9ab68b45c4a3d72c840e97c118209..c5f048ba0765054bb8aa6f268d4b1de5c6e8c300 100644 (file)
@@ -215,4 +215,4 @@ list<Bundle> DBusEventListener::NotifyObserver(const IEventInfo& info) {
   return impl_->observer_->OnRequest(info);
 }
 
-}  // nampace notification
+}  // namespace notification
index feff2a3121ae4cb4f1583f802a7a69acba600277..be2f58b961cc328771b3c3ab43d5f734d2a5e72c 100644 (file)
@@ -59,5 +59,5 @@ class DBusEventListener::Impl {
   DBusEventListener* parent_;
 };
 
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_DBUS_EVENT_LISTENER_IMPLEMENTATION_H_
index 1e43ac7dfed46837a0192e03b7fcf922b5a22fe4..33d99da9c99bd9c2e90e882ef9ca5434fb73d934 100644 (file)
@@ -151,4 +151,4 @@ std::list<Bundle> DBusSender::Request(const IEventInfo& info) {
   return ret_list;
 }
 
-}  // nampace notification
+}  // namespace notification
index e0b61c9ead6fbe32f8be4ee0adf6bc06e1a60115..b82299b05919b73ae00861a25ff35552fb4e183f 100644 (file)
@@ -40,5 +40,5 @@ class DBusSender::Impl {
   DBusSender* parent_;
 };
 
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_DBUS_SENDER_IMPLEMENTATION_H_
\ No newline at end of file
index 38a32fb498839633bf8399002235cb304c580798..e22af08466a67037021ca9eac354e9ec92bd8b4f 100644 (file)
@@ -50,5 +50,5 @@ class EXPORT_API EntryItem : public AbstractItem {
 };  // class EntryItem
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_ENTRY_ITEM_H_
\ No newline at end of file
index d6562fba7929d1c84662a52a340bf7cc488305e6..2853e6d75be07ef511e29ab205fa37ca120d0501 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "notification-ex/event_info_internal.h"
 #include "notification-ex/event_info_implementation.h"
+#include "notification-ex/ex_util.h"
 
 #ifdef LOG_TAG
 #undef LOG_TAG
 #define NOTIFICATION_EX_EVENT_ITEM_ID_KEY "__NOTIFICATION_EX_EVENT_ITEM_ID_KEY__"
 #define NOTIFICATION_EX_EVENT_TAG_KEY "__NOTIFICATION_EX_EVENT_TAG_KEY__"
 #define NOTIFICATION_EX_EVENT_UID_KEY "__NOTIFICATION_EX_EVENT_UID_KEY__"
+#define NOTIFICATION_EX_EVENT_REQUEST_ID_KEY "__NOTIFICATION_EX_EVENT_REQUEST_ID_KEY__"
 
 using namespace std;
 namespace notification {
 
-EventInfo::EventInfo(IEventInfo::EventType type, std::string owner,
-    std::string channel, std::string item_id, std::string tag)
+EventInfo::EventInfo(IEventInfo::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)) {
 }
 EventInfo::~EventInfo() = default;
 EventInfo::Impl::~Impl() = default;
 
-EventInfo::Impl::Impl(EventInfo* parent, IEventInfo::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),
-    tag_(tag), parent_(parent) {
+EventInfo::Impl::Impl(EventInfo* parent,
+    IEventInfo::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), tag_(tag), parent_(parent) {
   uid_ = getuid();
+  request_id_ = util::GetRequestId();
   LOGI("EventInfo impl created");
 }
 
@@ -62,6 +66,9 @@ EventInfo::EventInfo(Bundle serialized)
   impl_->tag_ = serialized.GetString(NOTIFICATION_EX_EVENT_TAG_KEY);
   string uid_str = serialized.GetString(NOTIFICATION_EX_EVENT_UID_KEY);
   impl_->uid_ = (uid_t)strtol(uid_str.c_str(), NULL, 10);
+  string request_id_str =
+      serialized.GetString(NOTIFICATION_EX_EVENT_REQUEST_ID_KEY);
+  impl_->request_id_ = (int)strtol(request_id_str.c_str(), NULL, 10);
 }
 
 string EventInfo::GetString(IEventInfo::EventType type) {
@@ -90,6 +97,8 @@ Bundle EventInfo::Serialize() const {
   serialized.Add(NOTIFICATION_EX_EVENT_ITEM_ID_KEY, impl_->item_id_);
   serialized.Add(NOTIFICATION_EX_EVENT_TAG_KEY, impl_->tag_);
   serialized.Add(NOTIFICATION_EX_EVENT_UID_KEY, to_string((int)impl_->uid_));
+  serialized.Add(
+      NOTIFICATION_EX_EVENT_REQUEST_ID_KEY, to_string(impl_->request_id_));
 
   return serialized;
 }
@@ -122,4 +131,8 @@ void EventInfo::SetUid(uid_t uid) {
   impl_->uid_ = uid;
 }
 
+int EventInfo::GetRequestId() const {
+  return impl_->request_id_;
+}
+
 }  // namespace notification
index 5eeec2926a2c16ff686f8f0688a2fba4f53594a0..5bd175f0d52751c96dc7043ca2884594146f257e 100644 (file)
@@ -34,8 +34,9 @@ class EventInfo::Impl {
 
  private:
   friend class EventInfo;
-  Impl(EventInfo* parent, IEventInfo::EventType type, std::string owner,
-    std::string channel, std::string item_id, std::string tag);
+  Impl(EventInfo* parent, IEventInfo::EventType type,
+    std::string owner, std::string channel,
+    std::string item_id, std::string tag);
 
  private:
   EventType type_;
@@ -44,8 +45,9 @@ class EventInfo::Impl {
   std::string item_id_;
   std::string tag_;
   uid_t uid_;
+  int request_id_;
   EventInfo* parent_;
 };
 
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_EVENT_INFO_IMPLEMENTATION_H_
\ No newline at end of file
index 6cf8bbfed5ad8c064cf4aef05ae4dae86125007e..31b268e9258a5a11ce698781cf93cb5fb633e36b 100644 (file)
@@ -44,6 +44,7 @@ class EventInfo : public IEventInfoInternal {
   std::string GetChannel() const override;
   std::string GetItemId() const override;
   std::string GetTag() const override;
+  int GetRequestId() const override;
   Bundle Serialize() const override;
   static std::string GetString(EventType type);
 
index 4eaf47fb852cc805f0ccebf779155c2438d92036..65879207fe427d8f84db8edebc999390ec89699b 100644 (file)
@@ -155,7 +155,7 @@ class EXPORT_API Bundle final {
     return 0;
   }
 
-  int Remove(const std::string& key) {
+  int Delete(const std::string& key) {
     return bundle_del(handle_, key.c_str());
   }
 
index be5136f6968594111dea5ae0863560fe72172b1e..975a6ee5bbacf8788bb76fa1b87f4d9efe4e4ca2 100644 (file)
@@ -41,6 +41,12 @@ std::string GetQuarkToString(GQuark quark) {
   return g_quark_to_string(quark);
 }
 
+int GetRequestId() {
+  static int id = 0;
+  g_atomic_int_inc(&id);
+  return id;
+}
+
 string GetAppId() {
   static string appid = "";
   char appid_buf[MAX_PACKAGE_STR_SIZE] = {0, };
index dba3e8286afc79e8f9e923e26eb1eba3c1a0c90c..958a34869d6a03aecc660278646ec5acc07db7c0 100644 (file)
@@ -26,6 +26,7 @@ namespace util {
   std::string GetAppId();
   GQuark GetQuarkFromString(std::string str);
   std::string GetQuarkToString(GQuark quark);
+  int GetRequestId();
 }  // namespace util
 }  // namespace notification
 
index 2b3a0d6b6c83ddc920df3dd96095c82d14e0a2a1..bee8104894161327963ee31ffdeb7ad5de4c2aa1 100644 (file)
@@ -51,5 +51,4 @@ int IconItem::GetType() const {
 }
 
 }  // namespace item
-}  // namespace notification_ex
-
+}  // namespace notification
index 4875316e76d339abe81c0bbb61ac3c67c42f0b6a..35e9c56444eccc8204cd8966d8ea249f877a93f4 100644 (file)
@@ -41,5 +41,5 @@ class EXPORT_API IconItem : public ImageItem {
 };  // class IconItem
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_ICON_ITEM_H_
index f80f53967f45a1d6ff0e7dbf3a0112a9818d86ea..4da0f014f014f0df0fdae577d9ef742e672ee8cb 100644 (file)
@@ -40,5 +40,5 @@ class IconItem::Impl {
 };
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_ICON_ITEM_IMPLEMENTATION_H_
index 2653076a59c4d63b6cf35cc70c5462d292781336..9a3330ecf00411e6c8884bee8367ea18ec1b0d18 100644 (file)
@@ -50,5 +50,5 @@ class EXPORT_API IconTextItem : public AbstractItem {
 };  // class IconTextItem
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_ICON_TEXT_ITEM_H_
index 87e23bcac2c1a79062b31904e1da19bf819ebef4..7c7451282d90a7eafc49154312b6a98c2488ed39 100644 (file)
@@ -42,5 +42,5 @@ class IconTextItem::Impl {
 };
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_ICON_TEXT_ITEM_IMPLEMENTATION_H_
index f7847ef59c4812c2e20417b8b1a8000417d213d6..faf5cd0b19d5e85571da1c5c2af59e5e4f8ef6b6 100644 (file)
@@ -39,8 +39,9 @@ class EXPORT_API IEventInfo {
   virtual std::string GetChannel() const = 0;
   virtual std::string GetItemId() const = 0;
   virtual std::string GetTag() const = 0;
+  virtual int GetRequestId() const = 0;
   virtual Bundle Serialize() const = 0;
 };
 
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_IEVENT_INFO_H_
index 7ed5f3b7839df49f7139c9822359f0e70efb750a..15ca6ece4debd409da86e12eab34e21c2bfd18fa 100644 (file)
@@ -28,5 +28,5 @@ class IEventInfoInternal : public IEventInfo {
   virtual void SetUid(uid_t uid) = 0;
 };
 
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_IEVENT_INFO_INTERNAL_H_
index 049bf97b2d92ddb4acb422d765f732786cb35c5a..b6b096bd3a77d1891a1ef7fb75db8bae4174dd94 100644 (file)
@@ -28,5 +28,5 @@ class EXPORT_API IItemInfo {
 };
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_IITEM_INFO_H_
index 1fd215fc6c511298b364431fefac026c8bcbbd7b..cf584e58add1e31b9e7acadd4cd1bd819839c823 100644 (file)
@@ -39,5 +39,5 @@ class EXPORT_API IItemInfoInternal : public IItemInfo {
 };
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_IITEM_INFO_INTERNAL_H_
index ea536504ae343e36ccd0a0a316e9e31a46efb977..a17516de69a78e690b65c942cc0d0302a4bea637 100644 (file)
@@ -46,5 +46,5 @@ class EXPORT_API ImageItem : public AbstractItem {
 };  //class ImageItem
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_IMAGE_ITEM_H_
index 80396f11a9fd3a5029ca807d8091ae5189f929ed..367649f338c5af6ba1c0423adb40b523c452ef51 100644 (file)
@@ -40,5 +40,5 @@ class ImageItem::Impl {
 };
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_IMAGE_ITEM_IMPLEMENTATION_H_
index 4f438d65f29220548bf7263499489d6cd13ca4ea..10b0c4fbc0bb4df7a92a99d141554cb54c1e67bc 100644 (file)
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef NOTIFICATION_EX_ITEM_INFO_H_
-#define NOTIFICATION_EX_ITEM_INFO_H_
+#ifndef NOTIFICATION_EX_ITEM_INFO_INTERNAL_H_
+#define NOTIFICATION_EX_ITEM_INFO_INTERNAL_H_
 
 #include "notification-ex/abstract_item_implementation.h"
 #include "notification-ex/iitem_info_internal.h"
@@ -42,5 +42,5 @@ class AbstractItem::Impl::ItemInfo : public IItemInfoInternal {
 };
 
 }  // namespace item
-}  // nampace notification
-#endif  // NOTIFICATION_EX_ITEM_INFO_H_
+}  // namespace notification
+#endif  // NOTIFICATION_EX_ITEM_INFO_INTERNAL_H_
index 8ad885b6ae242f29943db302afe800abc463b5a0..32fa9715ef7827e9be724cd1ded85e14bfa677cf 100644 (file)
@@ -60,7 +60,7 @@ Manager::Impl::Impl(Manager* parent,
   listener_->RegisterObserver(parent_);
 }
 
-void Manager::Impl::SendNotify(shared_ptr<item::AbstractItem> noti,
+int Manager::Impl::SendNotify(shared_ptr<item::AbstractItem> noti,
     IEventInfo::EventType type) {
   Bundle serialized = noti->Serialize();
   EventInfo info(type, util::GetAppId(), noti->GetChannel());
@@ -68,19 +68,20 @@ void Manager::Impl::SendNotify(shared_ptr<item::AbstractItem> noti,
 
   /* Reply to Sender */
   sender_->Notify(info, serialized_list, noti->GetSenderAppId());
+  return info.GetRequestId();
 }
 
-void Manager::Update(shared_ptr<item::AbstractItem> noti) {
-  impl_->SendNotify(noti, EventInfo::Update);
+int Manager::Update(shared_ptr<item::AbstractItem> noti) {
+  return impl_->SendNotify(noti, EventInfo::Update);
 }
 
-void Manager::Remove(shared_ptr<item::AbstractItem> noti) {
-  impl_->SendNotify(noti, EventInfo::Delete);
+int Manager::Delete(shared_ptr<item::AbstractItem> noti) {
+  return impl_->SendNotify(noti, EventInfo::Delete);
 }
 
-void Manager::Hide(shared_ptr<item::AbstractItem> noti) {
+int Manager::Hide(shared_ptr<item::AbstractItem> noti) {
   ((IItemInfoInternal*)noti->GetInfo().get())->AddHideViewer(util::GetAppId());
-  impl_->SendNotify(noti, EventInfo::Update);
+  return impl_->SendNotify(noti, EventInfo::Update);
 }
 
 shared_ptr<item::AbstractItem> Manager::FindByRootID(string id) {
@@ -106,12 +107,13 @@ list<shared_ptr<item::AbstractItem>> Manager::Get() {
   return gen_list;
 }
 
-void Manager::SendEvent(const IEventInfo& info,
+int Manager::SendEvent(const IEventInfo& info,
     shared_ptr<item::AbstractItem> noti) {
   Bundle serialized = noti->Serialize();
   Bundle serialized_info = info.Serialize();
   list<Bundle> serialized_list {serialized};
   impl_->sender_->Notify(info, serialized_list, noti->GetSenderAppId());
+  return info.GetRequestId();
 }
 
 list<Bundle> Manager::OnRequest(const IEventInfo& info) {
@@ -179,4 +181,4 @@ string Manager::GetPath() {
   return NOTIFICATION_EX_MANAGER_OBJECT_PATH;
 }
 
-}  // nampace notification
+}  // namespace notification
index 65e802add080cd6114e7408fd514a8583db127dd..d3692cad3c7fa7b88e183464174e0c6bfcf10f92 100644 (file)
@@ -21,6 +21,7 @@
 #include <list>
 #include <memory>
 
+#include "notification-ex/common.h"
 #include "notification-ex/abstract_item.h"
 #include "notification-ex/event_observer_interface.h"
 #include "notification-ex/event_sender_interface.h"
@@ -39,11 +40,11 @@ class EXPORT_API Manager : public IEventObserver {
   virtual ~Manager();
 
   std::list<std::shared_ptr<item::AbstractItem>> Get();
-  void Update(std::shared_ptr<item::AbstractItem> noti);
-  void Remove(std::shared_ptr<item::AbstractItem> noti);
-  void Hide(std::shared_ptr<item::AbstractItem> noti);
+  int Update(std::shared_ptr<item::AbstractItem> noti);
+  int Delete(std::shared_ptr<item::AbstractItem> noti);
+  int Hide(std::shared_ptr<item::AbstractItem> noti);
   std::shared_ptr<item::AbstractItem> FindByRootID(std::string id);
-  void SendEvent(const IEventInfo& info, std::shared_ptr<item::AbstractItem> noti);
+  int SendEvent(const IEventInfo& info, std::shared_ptr<item::AbstractItem> noti);
   void OnEvent(const IEventInfo& info, std::list<Bundle> serialized) override;
   std::list<Bundle> OnRequest(const IEventInfo& info) override;
   static std::string GetPath();
index 4b76ca6dcbec3759ca753946a6173cc0ab19c92b..55028222356262d22099ed6ba69873495c7dcfa3 100644 (file)
@@ -35,7 +35,7 @@ class Manager::Impl {
 
  private:
   friend class Manager;
-  void SendNotify(std::shared_ptr<item::AbstractItem> noti,
+  int SendNotify(std::shared_ptr<item::AbstractItem> noti,
       IEventInfo::EventType type);
   std::unique_ptr<IEventSender> sender_;
   std::unique_ptr<IEventListener> listener_;
index cfe5097bcc285c66102a2613b581ddc513c1f441..ef5d397003d23155e8da5aa868974b65c2fe64cb 100644 (file)
@@ -55,20 +55,21 @@ Reporter::Impl::Impl(Reporter* parent,
   listener_->RegisterObserver(parent_);
 }
 
-void Reporter::Impl::SendNotify(shared_ptr<item::AbstractItem> noti,
+int Reporter::Impl::SendNotify(shared_ptr<item::AbstractItem> noti,
     IEventInfo::EventType type) {
   Bundle serialized = noti->Serialize();
   EventInfo info(type, util::GetAppId(), noti->GetChannel());
   list<Bundle> serialized_list {serialized};
   sender_->Notify(info, serialized_list);
+  return info.GetRequestId();
 }
 
-void Reporter::Post(std::shared_ptr<item::AbstractItem> noti) {
+int Reporter::Post(std::shared_ptr<item::AbstractItem> noti) {
   LOGI("Post noti");
-  impl_->SendNotify(noti, EventInfo::Post);
+  return impl_->SendNotify(noti, EventInfo::Post);
 }
 
-void Reporter::Post(std::list<std::shared_ptr<AbstractItem>> notiList) {
+int Reporter::Post(std::list<std::shared_ptr<AbstractItem>> notiList) {
   EventInfo info(EventInfo::Post, util::GetAppId(), "");
   list<Bundle> serialized_list;
   for (auto& i : notiList) {
@@ -76,14 +77,15 @@ void Reporter::Post(std::list<std::shared_ptr<AbstractItem>> notiList) {
     serialized_list.push_back(b);
   }
   impl_->sender_->Notify(info, serialized_list);
+  return info.GetRequestId();
 }
 
-void Reporter::Update(std::shared_ptr<AbstractItem> noti) {
-  impl_->SendNotify(noti, EventInfo::Update);
+int Reporter::Update(std::shared_ptr<AbstractItem> noti) {
+  return impl_->SendNotify(noti, EventInfo::Update);
 }
 
-void Reporter::Remove(std::shared_ptr<AbstractItem> noti) {
-  impl_->SendNotify(noti, EventInfo::Delete);
+int Reporter::Delete(std::shared_ptr<AbstractItem> noti) {
+  return impl_->SendNotify(noti, EventInfo::Delete);
 }
 
 std::shared_ptr<AbstractItem> Reporter::FindByRootID(std::string id) {
@@ -99,11 +101,12 @@ std::shared_ptr<AbstractItem> Reporter::FindByRootID(std::string id) {
   return gen_item;
 }
 
-void Reporter::SendEvent(const IEventInfo& info,
+int Reporter::SendEvent(const IEventInfo& info,
     shared_ptr<item::AbstractItem> noti) {
   Bundle serialized = noti->Serialize();
   list<Bundle> serialized_list {serialized};
   impl_->sender_->Notify(info, serialized_list);
+  return info.GetRequestId();
 }
 
 void Reporter::OnEvent(const IEventInfo& info, list<Bundle> serialized) {
@@ -136,4 +139,4 @@ string Reporter::GetPath() {
   return NOTIFICATION_EX_REPORTER_OBJECT_PATH;
 }
 
-}  // nampace notification
+}  // namespace notification
index d416abad466ba1c0c487a81bc073d5022dad02d2..a087d17a1f3c453aeaa71c272bdc70f3a3dad13d 100644 (file)
@@ -39,11 +39,11 @@ class EXPORT_API Reporter : public IEventObserver {
         std::unique_ptr<IEventListener> listener);
   virtual ~Reporter();
 
-  void SendEvent(const IEventInfo& info, std::shared_ptr<item::AbstractItem> noti);
-  void Post(std::shared_ptr<item::AbstractItem> noti);
-  void Post(std::list<std::shared_ptr<item::AbstractItem>> notiList);
-  void Update(std::shared_ptr<item::AbstractItem> noti);
-  void Remove(std::shared_ptr<item::AbstractItem> noti);
+  int SendEvent(const IEventInfo& info, std::shared_ptr<item::AbstractItem> noti);
+  int Post(std::shared_ptr<item::AbstractItem> noti);
+  int Post(std::list<std::shared_ptr<item::AbstractItem>> notiList);
+  int Update(std::shared_ptr<item::AbstractItem> noti);
+  int Delete(std::shared_ptr<item::AbstractItem> noti);
   std::shared_ptr<item::AbstractItem> FindByRootID(std::string id);
   virtual void OnEvent(const IEventInfo& info,
       std::list<std::shared_ptr<item::AbstractItem>> notiList);
index 4a0c41d547350de7d3a6ba1c267dce82ea49ec94..8628dcf4e2104ac214ce7b99e95500d70b57f50d 100644 (file)
@@ -35,7 +35,7 @@ class Reporter::Impl {
 
  private:
   friend class Reporter;
-  void SendNotify(std::shared_ptr<item::AbstractItem> noti,
+  int SendNotify(std::shared_ptr<item::AbstractItem> noti,
       IEventInfo::EventType type);
   std::unique_ptr<IEventSender> sender_;
   std::unique_ptr<IEventListener> listener_;
index 9f9a987e71eaf5c3a619af09ae73e3ab7aaba11a..178d7c4bccbfd7dafebc35585636573904d4f211 100644 (file)
@@ -49,5 +49,5 @@ class EXPORT_API TextItem : public AbstractItem {
 };  // class TextItem
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_TEXT_ITEM_H_
\ No newline at end of file
index e97cd911fd8785fee1bd2489f7fb5311db536d5f..f02e413296b2056e990d85dfd7b784daca236dd1 100644 (file)
@@ -101,4 +101,4 @@ TimeItem::~TimeItem() = default;
 TimeItem::Impl::~Impl() = default;
 
 }  // namespace item
-}  // namespace notification_ex
+}  // namespace notification
index 29a8d56096629656bceeb943f6035951b9493cc9..5322eb3ea57c00247830a7e33919725d72197a4d 100644 (file)
@@ -50,5 +50,5 @@ class EXPORT_API TimeItem : public AbstractItem {
 };  // class TimeItem
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_TIME_ITEM_H_
index 9637fde745002a5f429cf9d662962037ffc1deeb..6330db08a4a7acb237cc51391cf7a1d929858e27 100644 (file)
@@ -42,5 +42,5 @@ class TimeItem::Impl {
 };
 
 }  // namespace item
-}  // nampace notification
+}  // namespace notification
 #endif  // NOTIFICATION_EX_TIME_ITEM_IMPLEMENTATION_H_
index dfb532026d32c69859396092c10d485068aeaa79..f66f1ece8ed02799bb7f872d53b61d7430722d90 100644 (file)
@@ -128,7 +128,6 @@ TEST_F(AbstractItemTest, SerializeDeserialize) {
   ASSERT_EQ(gen_test->GetId(), "test_id");
   ASSERT_EQ(gen_test->GetType(), MY_ITEM_TYPE);
   ASSERT_EQ(gen_test->GetUid(), 3);
-  ASSERT_EQ(gen_test->GetRequestId(), 0);
   ASSERT_EQ(gen_test->GetEnable(), false);
   ASSERT_EQ(gen_test->GetVisible(),false);
   ASSERT_EQ(gen_test->GetPolicy(), AbstractItem::Policy::OnBootClear);
index ab52838d0f02677f96b3c87d65a75aa576809f10..a7e66ccfef4d53d3f083eb69db1e5aa540a2f642 100644 (file)
@@ -93,12 +93,12 @@ TEST(Bundle, GetCount) {
   EXPECT_EQ(bundle.GetCount(), 2);
 }
 
-TEST(Bundle, Remove) {
+TEST(Bundle, Delete) {
   Bundle bundle;
   int r = bundle.Add("TestKey1", "TestVal1");
   EXPECT_EQ(r, 0);
 
-  r = bundle.Remove("TestKey1");
+  r = bundle.Delete("TestKey1");
   EXPECT_EQ(r, 0);
 
   EXPECT_EQ(bundle.GetString("TestKey1"), "");