#define __WATCH_HOLDER_H__
#include <app_control.h>
-#include <Evas.h>
#include <bundle.h>
+#include <Evas.h>
#include "watch.h"
namespace watch_holder {
Watch::Watch(string appid, Evas_Object* viewer_win, Watch::IEvent* listener)
- : RemoteSurfaceEvas(appid, RemoteSurface::WATCH,
+ : RemoteSurfaceEvas(appid, RemoteSurface::WATCH,
make_shared<screen_connector::EvasObject>(viewer_win, false)),
appid_(appid), listener_(listener) {
RemoteSurfaceEvas::SetAutoVisibility(false);
RemoteSurfaceEvas::SetAutoVisibility(false);
}
+Watch::Watch(string appid, Evas_Object* viewer_win, tizen_base::Bundle extra, Watch::IEvent* listener)
+ : RemoteSurfaceEvas(appid, RemoteSurface::WATCH,
+ make_shared<screen_connector::EvasObject>(viewer_win, false)),
+ appid_(appid), listener_(listener), extra_data_(extra) {
+ RemoteSurfaceEvas::SetAutoVisibility(false);
+}
+
+Watch::Watch(int rid, string id, string appid, Evas_Object* viewer_win, tizen_base::Bundle extra, Watch::IEvent* listener)
+ : RemoteSurfaceEvas(rid, id, RemoteSurface::WATCH,
+ make_shared<screen_connector::EvasObject>(viewer_win, false)),
+ appid_(appid), listener_(listener), extra_data_(extra) {
+ RemoteSurfaceEvas::SetAutoVisibility(false);
+}
+
void Watch::Resume() {
RemoteSurfaceEvas::NoRenderPush(200);
RemoteSurfaceEvas::SendVisibility(true);
return appid_;
}
-Bundle Watch::GetExtra() {
- Bundle b;
- return b;
-}
-
bool Watch::IsFaulted() {
return false;
}
return current_image_;
}
+Bundle Watch::GetExtra() {
+ return extra_data_;
+}
+
void Watch::OnEvasAdded(const std::string& appId, const std::string& instId,
int pid, const screen_connector::EvasObject& image) {
current_image_ = image.GetRaw();
virtual void OnUpdated(const Watch& watch) = 0;
virtual void OnRemoved(const Watch& watch) = 0;
};
+
Watch(std::string appid, Evas_Object* viewer_win, IEvent* listener);
- Watch(int rid, std::string id, std::string appid,
- Evas_Object* viewer_win, Watch::IEvent* listener);
+ Watch(int rid, std::string id, std::string appid, Evas_Object* viewer_win,
+ Watch::IEvent* listener);
+ Watch(std::string appid, Evas_Object* viewer_win, tizen_base::Bundle extra,
+ IEvent* listener);
+ Watch(int rid, std::string id, std::string appid, Evas_Object* viewer_win,
+ tizen_base::Bundle extra, Watch::IEvent* listener);
void Resume() override;
void Pause() override;
+
void Terminate();
void Bind(Evas_Object* win);
void Unbind();
IEvent* listener_;
Evas_Object* current_image_ = nullptr;
Evas_Object* bind_win_ = nullptr;
+ tizen_base::Bundle extra_data_;
};
} // namespace watch_holder
Evas_Coord x, y, w, h;
evas_object_geometry_get(win_, &x, &y, &w, &h);
Bundle data;
+
if (extra != nullptr)
data = Bundle(extra, true, true);
aul_svc_set_appid(data.GetHandle(), watch_appid.c_str());
data.Add("WATCH_HEIGHT", std::to_string(h));
data.Add("WATCH_BG_LAUNCH", std::to_string((int)background));
data.Add(AUL_K_WIDGET_VIEWER, appid_);
+
+ if (extra != nullptr)
+ extra_map_[watch_appid] = Bundle(extra, true, true);
+
int pid = appsvc_run_service(data.GetHandle(), 0, nullptr, nullptr);
if (pid < 0) {
LOGE("Fail to run watch (%d)", pid);
aul_app_com_result_e res, bundle *envelope, void *user_data) {
Bundle launch_data(envelope, false, false);
WatchHolder* holder = (WatchHolder*)user_data;
-
string viewer_appid = launch_data.GetString(AUL_K_WIDGET_VIEWER);
if (viewer_appid != holder->appid_) {
- LOGE("It's not mine (%s)", viewer_appid.c_str());
+ LOGE("It's not mine (%s:%s)", viewer_appid.c_str(), holder->appid_.c_str());
return 0;
}
string watch_appid = launch_data.GetString(AUL_K_APPID);
- holder->stack_.push_back(make_shared<Watch>(watch_appid, holder->win_, holder));
+
+ if (holder->extra_map_.find(watch_appid) != holder->extra_map_.end()) {
+ Bundle extra(holder->extra_map_[watch_appid]);
+ holder->stack_.push_back(make_shared<Watch>(watch_appid, holder->win_, extra, holder));
+ holder->extra_map_.erase(watch_appid);
+ } else {
+ holder->stack_.push_back(make_shared<Watch>(watch_appid, holder->win_, holder));
+ }
LOGE("LAUNCH DONE (%s)", viewer_appid.c_str());
return 0;
}
#include <string>
#include <list>
+#include <map>
#include <memory>
#include <Evas.h>
#include <bundle.h>
+#include <bundle_cpp.h>
#include <aul_app_com.h>
#include "watch.hh"
private:
std::string appid_;
Evas_Object* win_;
+ std::map<std::string, tizen_base::Bundle> extra_map_;
std::list<std::shared_ptr<Watch>> stack_;
aul_app_com_connection_h launch_signal_conn_ = nullptr;
aul_app_com_connection_h dead_signal_conn_ = nullptr;