Add missing implementations 74/227774/3
authorhyunho <hhstark.kang@samsung.com>
Mon, 16 Mar 2020 08:52:01 +0000 (17:52 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Mon, 16 Mar 2020 08:58:59 +0000 (08:58 +0000)
Change-Id: I2a0336847f8afe5d75f489f6ba99846c672ee5a2
Signed-off-by: hyunho <hhstark.kang@samsung.com>
watch-holder/src/sharable_watch_interface.hh
watch-holder/src/watch.cc
watch-holder/src/watch.hh

index a8b08f1..1315a7b 100644 (file)
@@ -29,11 +29,11 @@ class ISharableWatch {
   virtual void Resume() = 0;
   virtual void Pause() = 0;
   virtual Evas_Object* GetCurrentImage() const = 0;
-  virtual bool IsBound() = 0;
+  virtual bool IsBound() const = 0;
   virtual std::string GetAppId() const = 0;
   virtual int GetPid() const = 0;
-  virtual tizen_base::Bundle GetExtra() = 0;
-  virtual bool IsFaulted() = 0;
+  virtual tizen_base::Bundle GetExtra() const = 0;
+  virtual bool IsFaulted() const = 0;
   virtual void BlockUpdate(bool enable) = 0;
 };
 
index 73e3012..61c98c8 100644 (file)
@@ -78,17 +78,18 @@ void Watch::BlockUpdate(bool enable) {
 }
 
 void Watch::OnAuxMsg(void *data, Evas_Object *o, void *ev_info) {
-       Watch* wa = (Watch*)data;
-       Elm_Win_Aux_Message *msg = (Elm_Win_Aux_Message *)ev_info;
-       const char *key = elm_win_aux_msg_key_get(wa->bind_win_, msg);
-       const char *val = elm_win_aux_msg_val_get(wa->bind_win_, msg);
-
-       if (!strcmp(key, "tz_remote_surface_mng") && !strcmp(val, "prebind")) {
-               wa->listener_->OnBound(*wa);
-               LOGI("Start bind mode !!");
-               evas_object_smart_callback_del(wa->bind_win_,
-                       "aux,msg,received", OnAuxMsg);
-       }
+  Watch* wa = (Watch*)data;
+  Elm_Win_Aux_Message *msg = (Elm_Win_Aux_Message *)ev_info;
+  const char *key = elm_win_aux_msg_key_get(wa->bind_win_, msg);
+  const char *val = elm_win_aux_msg_val_get(wa->bind_win_, msg);
+
+  if (!strcmp(key, "tz_remote_surface_mng") && !strcmp(val, "prebind")) {
+    wa->is_bound_ = true;
+    wa->listener_->OnBound(*wa);
+    LOGI("Start bind mode !!");
+    evas_object_smart_callback_del(wa->bind_win_,
+      "aux,msg,received", OnAuxMsg);
+  }
 }
 
 void Watch::CancelTouch() {
@@ -103,40 +104,41 @@ int Watch::GetPid() const {
   return pid_;
 }
 
-bool Watch::IsBound() {
-  return false;
+bool Watch::IsBound() const {
+  return is_bound_;
 }
 
 string Watch::GetAppId() const {
   return appid_;
 }
 
-bool Watch::IsFaulted() {
-  return false;
+bool Watch::IsFaulted() const {
+  return is_faulted_;
 }
 
 void Watch::Bind(Evas_Object* win) {
   bind_win_ = win;
   elm_win_aux_hint_add(win, "wm.policy.win.msg.use", "1");
-       evas_object_smart_callback_add(win, "aux,msg,received",
-                       OnAuxMsg, this);
+  evas_object_smart_callback_add(win, "aux,msg,received",
+      OnAuxMsg, this);
   RemoteSurfaceEvas::Bind(screen_connector::EvasObject(win, false));
 }
 
 void Watch::Unbind() {
   RemoteSurfaceEvas::Unbind();
+  is_bound_ = false;
 }
 
 Evas_Object* Watch::GetCurrentImage() const {
   return current_image_;
 }
 
-Bundle Watch::GetExtra() {
+Bundle Watch::GetExtra() const {
   return extra_data_;
 }
 
 void Watch::SetFaulted(bool faulted) {
-  is_faulted = faulted;
+  is_faulted_ = faulted;
 }
 
 void Watch::OnEvasAdded(const std::string& appId, const std::string& instId,
index 61712bf..1c40fac 100644 (file)
@@ -55,12 +55,12 @@ class EXPORT_API Watch : private screen_connector::RemoteSurfaceEvas,
   void CancelTouch();
   Evas_Object* GetCurrentImage() const override;
   int NotifyChangedEvent() const;
-  bool IsBound() override;
+  bool IsBound() const override;
   std::string GetAppId() const;
   int GetPid() const override;
   int GetRid() const ;
-  tizen_base::Bundle GetExtra() override;
-  bool IsFaulted() override;
+  tizen_base::Bundle GetExtra() const override;
+  bool IsFaulted() const override;
   void BlockUpdate(bool enable) override;
 
  private:
@@ -81,7 +81,8 @@ class EXPORT_API Watch : private screen_connector::RemoteSurfaceEvas,
   Evas_Object* current_image_ = nullptr;
   Evas_Object* bind_win_ = nullptr;
   tizen_base::Bundle extra_data_;
-  bool is_faulted = false;
+  bool is_faulted_ = false;
+  bool is_bound_ = false;
 };
 
 }  // namespace watch_holder