INSTALL(FILES ${LOCAL_PUBLIC_HEADER_DIR}/${flag} DESTINATION include/${PROJECT_NAME}/public_api/widget_view_manager)
ENDFOREACH(flag)
+
INSTALL(FILES ${ROOT_SRC_DIR}/widget_viewer_dali/images/unknown.png DESTINATION ${IMAGE_DIR})
ADD_SUBDIRECTORY(po)
+ADD_SUBDIRECTORY(watch-viewer-dali)
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(watch_viewer_dali CXX)
+
+SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
+SET(EXEC_PREFIX "\${prefix}")
+SET(PROJECT_NAME "${PROJECT_NAME}")
+SET(LIBDIR ${LIB_INSTALL_DIR})
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+SET(VERSION_MAJOR "${MAJORVER}")
+SET(VERSION "${FULLVER}")
+
+SET(IMAGE_DIR "${TZ_SYS_SHARE}/${PROJECT_NAME}/images")
+SET(LOCALE_DIR "${TZ_SYS_SHARE}/${PROJECT_NAME}/locale")
+SET(ROOT_SRC_DIR ${CMAKE_SOURCE_DIR}/../..)
+
+IF("${ENABLE_ECOREWL2}" STREQUAL "On")
+ OPTION(USE_ECOREWL2 "Use ecorewl2" ON)
+ENDIF()
+
+IF(USE_ECOREWL2)
+ ADD_DEFINITIONS("-DECORE_WL2")
+ ADD_DEFINITIONS("-DEFL_BETA_API_SUPPORT")
+ENDIF()
+
+INCLUDE(FindPkgConfig)
+IF(USE_ECOREWL2)
+pkg_check_modules(watch_viewer_dali REQUIRED
+ dlog
+ capi-system-info
+ dali2-core
+ dali2-adaptor
+ dali2-toolkit
+ cynara-client
+ ecore-wl2
+ ecore-input
+ tizen-remote-surface-client
+ screen_connector_watcher
+ watch-holder-base
+)
+ELSE()
+pkg_check_modules(watch_viewer_dali REQUIRED
+ dlog
+ capi-system-info
+ dali2-core
+ dali2-adaptor
+ dali2-toolkit
+ cynara-client
+ ecore-wayland
+ ecore-input
+ tizen-remote-surface-client
+ screen_connector_watcher
+ watch-holder-base
+)
+ENDIF()
+
+SET(BUILD_SOURCE
+ ${ROOT_SRC_DIR}/watch_viewer_dali/public_api/watch_view/watch_view.cpp
+ ${ROOT_SRC_DIR}/watch_viewer_dali/public_api/watch_view/watch.cpp
+ ${ROOT_SRC_DIR}/watch_viewer_dali/internal/watch_view/watch_view_impl.cpp
+)
+
+FOREACH(flag ${watch_viewer_dali_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -DHIDE_DALI_INTERNALS -Wall -Werror -Winline -g")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fprofile-arcs -ftest-coverage")
+SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
+
+SET(LOCAL_PUBLIC_HEADER_DIR ${ROOT_SRC_DIR}/watch_viewer_dali/public_api)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${ROOT_SRC_DIR})
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${BUILD_SOURCE})
+
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${watch_viewer_dali_LDFLAGS} "-lpthread")
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+FILE(GLOB LOCAL_WATCH_VIEW_HEADER_LIST RELATIVE "${LOCAL_PUBLIC_HEADER_DIR}" "${LOCAL_PUBLIC_HEADER_DIR}/watch_view/*.h")
+FOREACH(flag ${LOCAL_WATCH_VIEW_HEADER_LIST})
+ INSTALL(FILES ${LOCAL_PUBLIC_HEADER_DIR}/${flag} DESTINATION include/${PROJECT_NAME}/public_api/watch_view)
+ENDFOREACH(flag)
--- /dev/null
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: watch_viewer_dali
+Description: Support development of the Watch Viewer DALi Frontend library
+Version: @VERSION@
+Libs: -L${libdir} -lwatch_viewer_dali
+Cflags: -I${includedir}
+cppflags: -I${includedir}
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(wayland-tbm-client)
BuildRequires: pkgconfig(screen_connector_watcher)
+BuildRequires: pkgconfig(watch-holder-base)
%if 0%{?gcov:1}
BuildRequires: lcov
%endif
%description devel
Header and package configuration files for the widget viewer development
+
#################################################
# widget-viewer-gcov
#################################################
/sbin/ldconfig
exit 0
+################################################
+# watch_viewer_dali
+##########################################
+%package -n watch_viewer_dali
+Summary: APIs to view watch applications
+Version: 1.4.12
+License: Flora-1.1
+Group: System/Libraries
+Requires: watch_viewer_dali = %{version}-%{release}
+
+%description -n watch_viewer_dali
+A set of APIs to control watch applications
+
+%package -n watch_viewer_dali-devel
+Summary: Development Library for widget Viewer Dali Application
+Group: Development/Building
+Requires: watch_viewer_dali = %{version}-%{release}
+
+%description -n watch_viewer_dali-devel
+Header & package configuration of watch_viewer_dali
+
+%post -n watch_viewer_dali -p /sbin/ldconfig
+%postun -n watch_viewer_dali -p /sbin/ldconfig
+
##############################
# Files in Binary Packages
##############################
%{_includedir}/widget_viewer_dali/*
%{_libdir}/pkgconfig/widget_viewer_dali.pc
+%files -n watch_viewer_dali
+%manifest watch_viewer_dali.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libwatch_viewer_dali.so*
+
+%files -n watch_viewer_dali-devel
+%defattr(-,root,root,-)
+%{_includedir}/watch_viewer_dali/*
+%{_libdir}/pkgconfig/watch_viewer_dali.pc
+
%if 0%{?gcov:1}
%files gcov
%{_datadir}/gcov/obj/*
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <watch_viewer_dali/internal/watch_view/watch_view_impl.h>
+
+// INTERNAL INCLUDES
+
+// EXTERNAL INCLUDES
+//#include <dali/public-api/common/stage.h>
+#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/key-event.h>
+#include <dali/public-api/events/wheel-event.h>
+#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/public-api/object/property-array.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali/integration-api/debug.h>
+#include <string.h>
+#ifdef ECORE_WL2
+#include <Ecore_Wl2.h>
+#else
+#include <Ecore_Wayland.h>
+#endif
+#include <Ecore_Input.h>
+#include <tzplatform_config.h>
+#include <wayland-extension/tizen-extension-client-protocol.h>
+#include <tbm_surface_internal.h>
+#include <unistd.h>
+#include <libintl.h>
+#include <xkbcommon/xkbcommon.h>
+
+namespace Dali
+{
+
+namespace WatchView
+{
+
+namespace Internal
+{
+#define GET_LOCALE_TEXT(string) dgettext(PKGNAME, string)
+
+#if defined(DEBUG_ENABLED)
+Integration::Log::Filter* gWatchViewLogging = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_WATCH_VIEW" );
+#endif
+
+BaseHandle Create()
+{
+ return Dali::BaseHandle();
+}
+
+const char* const CUSTOM_SHADER( "shader" );
+const char* const CUSTOM_VERTEX_SHADER( "vertexShader" );
+const char* const CUSTOM_FRAGMENT_SHADER( "fragmentShader" );
+const char* const DEFAULT_SAMPLER_TYPE_NAME( "sampler2D" );
+const char* const CUSTOM_SAMPLER_TYPE_NAME( "samplerExternalOES" );
+
+static const char* VERTEX_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
+ attribute mediump vec2 aPosition;\n
+ varying mediump vec2 vTexCoord;\n
+ uniform mediump mat4 uMvpMatrix;\n
+ uniform mediump vec3 uSize;\n
+ varying mediump vec2 sTexCoordRect;\n
+ void main()\n
+ {\n
+ gl_Position = uMvpMatrix * vec4(aPosition * uSize.xy, 0.0, 1.0);\n
+ vTexCoord = aPosition + vec2(0.5);\n
+ }\n
+);
+
+static const char* FRAGMENT_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
+ uniform lowp vec4 uColor;\n
+ varying mediump vec2 vTexCoord;\n
+ uniform samplerExternalOES sTexture;\n
+ void main()\n
+ {\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
+ }\n
+);
+
+Dali::WatchView::WatchView WatchView::New( Window window, const std::string& watchId, const std::string& contentInfo, int width, int height )
+{
+ // Create the implementation, temporarily owned on stack
+ IntrusivePtr< WatchView > internalWatchView = new WatchView( window, watchId, contentInfo, width, height );
+
+ // Pass ownership to CustomActor
+ Dali::WatchView::WatchView watchView( *internalWatchView );
+
+ // Second-phase init of the implementation
+ // This can only be done after the CustomActor connection has been made...
+ internalWatchView->Initialize();
+
+ return watchView;
+}
+
+WatchView::WatchView()
+: WatchHolderBase( 0, 0 ),
+ Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
+ mContentInfo(),
+ mWidth( 0 ),
+ mHeight( 0 ),
+ mPid( 0 ),
+ mBuffer( NULL ),
+ mWindow()
+{
+}
+
+WatchView::WatchView( Window window, const std::string& watchId, const std::string& contentInfo, int width, int height)
+: WatchHolderBase( width, height ),
+ Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
+ mWatchId( watchId ),
+ mContentInfo( contentInfo ),
+ mWidth( width ),
+ mHeight( height ),
+ mPid( 0 ),
+ mBuffer( NULL ),
+ mWindow( window )
+{
+}
+
+WatchView::~WatchView()
+{
+}
+
+bool WatchView::PauseWatch()
+{
+ // To do :: Pause a Watch
+ return true;
+}
+
+bool WatchView::ResumeWatch()
+{
+ // To do :: Resume a Watch
+ return true;
+}
+
+// Overide from WatchBase
+std::shared_ptr<WatchBase> WatchView::CreateWatch(std::string appid, bool mock)
+{
+ struct wl_surface *wlsurface;
+ wlsurface = GetWlSurface();
+ std::shared_ptr<screen_connector::WlSurface> wlsurface_class = std::shared_ptr<screen_connector::WlSurface>( new screen_connector::WlSurface(wlsurface, false));
+
+ return Watch::New( appid, wlsurface_class, this);
+}
+
+std::shared_ptr<WatchBase> WatchView::CreateWatch(int rid, std::string id, std::string appid, bool mock)
+{
+ struct wl_surface *wlsurface;
+ wlsurface = GetWlSurface();
+ std::shared_ptr<screen_connector::WlSurface> wlsurface_class = std::shared_ptr<screen_connector::WlSurface>( new screen_connector::WlSurface(wlsurface, false));
+
+ return Watch::New(rid, id, appid, wlsurface_class, this);
+}
+
+std::shared_ptr<WatchBase> WatchView::CreateWatch(std::string appid, tizen_base::Bundle extra, bool mock)
+{
+ struct wl_surface *wlsurface;
+ wlsurface = GetWlSurface();
+ std::shared_ptr<screen_connector::WlSurface> wlsurface_class = std::shared_ptr<screen_connector::WlSurface>( new screen_connector::WlSurface(wlsurface, false));
+
+ return Watch::New( appid, wlsurface_class, extra, this);
+}
+
+std::shared_ptr<WatchBase> WatchView::CreateWatch(int rid, std::string id, std::string appid, tizen_base::Bundle extra, bool mock)
+{
+ struct wl_surface *wlsurface;
+ wlsurface = GetWlSurface();
+ std::shared_ptr<screen_connector::WlSurface> wlsurface_class = std::shared_ptr<screen_connector::WlSurface>( new screen_connector::WlSurface(wlsurface, false));
+
+ return Watch::New( rid, id, appid, wlsurface_class, extra, this );
+}
+
+void WatchView::OnAdded(const WatchBase& watch)
+{
+ DALI_LOG_RELEASE_INFO("watchView::OnAdded");
+ watch.NotifyChangedEvent();
+ watch.GetExtra();
+}
+
+void WatchView::OnRemoved(const WatchBase& watch)
+{
+ DALI_LOG_RELEASE_INFO("watchView::OnRemoved");
+}
+
+void WatchView::OnUpdated(const WatchBase& watch)
+{
+ DALI_LOG_RELEASE_INFO("watchView::OnUpdated");
+ UpdateBuffer( watch );
+}
+
+void WatchView::OnLaunched(const WatchBase& watch)
+{
+ DALI_LOG_RELEASE_INFO("watchView::OnLaunched");
+}
+
+void WatchView::OnDead(const WatchBase& watch)
+{
+ DALI_LOG_RELEASE_INFO("watchView::OnDead");
+}
+
+void WatchView::OnBound(const WatchBase& watch)
+{
+ DALI_LOG_RELEASE_INFO("watchView::OnBound");
+}
+
+wl_surface* WatchView::GetWlSurface() const
+{
+ struct wl_surface *wlsurface;
+ if( mWindow )
+ {
+ Any nativeHandle = mWindow.GetNativeHandle();
+ Ecore_Wl2_Window * wlWindow = AnyCast<Ecore_Wl2_Window*>( nativeHandle );
+ wlsurface = ecore_wl2_window_surface_get(wlWindow);
+ }
+ return wlsurface;
+}
+
+const std::string& WatchView::GetWatchId() const
+{
+ return mWatchId;
+}
+
+const std::string& WatchView::GetContentInfo()
+{
+ //To do : need to set content
+ mContentInfo.clear();
+ return mContentInfo;
+}
+
+void WatchView::CreateWatchRenderer()
+{
+ Dali::Any source;
+ mImageSource = Dali::NativeImageSource::New( source );
+ Dali::Texture texture = Dali::Texture::New( *mImageSource );
+
+ Dali::Geometry geometry = CreateQuadGeometry();
+ Dali::Shader shader = CreateShader();
+ mRenderer = Dali::Renderer::New( geometry, shader );
+
+ Dali::TextureSet textureSet = Dali::TextureSet::New();
+ textureSet.SetTexture( 0u, texture );
+ mRenderer.SetTextures( textureSet );
+
+ //EFL app should be pre multiplied image.
+ mRenderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true );
+
+ Self().AddRenderer( mRenderer );
+}
+
+void WatchView::RemoveWatchRenderer()
+{
+ if( mRenderer )
+ {
+ Self().RemoveRenderer( mRenderer );
+ }
+}
+
+void WatchView::OnInitialize()
+{
+ Launch( mWatchId, false, nullptr );
+}
+
+void WatchView::OnSceneConnection( int depth )
+{
+ Control::OnSceneConnection( depth );
+}
+
+void WatchView::OnSceneDisconnection()
+{
+ Control::OnSceneDisconnection();
+}
+
+void WatchView::OnSizeSet( const Vector3& targetSize )
+{
+}
+
+bool WatchView::IsWatchRenderer()
+{
+ return ( mRenderer )? true: false;
+}
+
+void WatchView::UpdateImageSource( tbm_surface_h source )
+{
+ mImageSource = Dali::NativeImageSource::New( source );
+ Dali::Texture texture = Dali::Texture::New( *mImageSource );
+
+ if( mRenderer )
+ {
+ Dali::TextureSet textureSet = mRenderer.GetTextures();
+ textureSet.SetTexture( 0u, texture );
+ mRenderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true );
+ }
+}
+
+Vector3 WatchView::GetNaturalSize()
+{
+ Vector3 size;
+ size.x = mWidth;
+ size.y = mHeight;
+
+ if( size.x > 0 && size.y > 0 )
+ {
+ size.z = std::min( size.x, size.y );
+ return size;
+ }
+ else
+ {
+ return Control::GetNaturalSize();
+ }
+}
+
+void WatchView::UpdateBuffer(const WatchBase& watch)
+{
+ if( !IsWatchRenderer() )
+ {
+ CreateWatchRenderer();
+ }
+
+ struct wl_buffer *buffer;
+ std::shared_ptr<screen_connector::WlBuffer> wlBuffer;
+ wlBuffer = watch.GetCurrentImage();
+ buffer = wlBuffer->GetRaw();
+
+ //get tbm surface from buffer
+ tbm_surface_h tbmSurface = static_cast< tbm_surface_h >( wl_buffer_get_user_data( buffer ) );
+ UpdateImageSource( tbmSurface );
+
+ mBuffer = buffer;
+}
+
+Dali::Shader WatchView::CreateShader()
+{
+ std::string fragmentShader = "#extension GL_OES_EGL_image_external:require\n";
+ fragmentShader += "\n";
+ std::string vertexShader;
+ std::string customFragmentShader;
+
+ vertexShader = VERTEX_SHADER_TEXTURE;
+ fragmentShader += FRAGMENT_SHADER_TEXTURE;
+
+ return Dali::Shader::New( vertexShader, fragmentShader );
+}
+
+Dali::Geometry WatchView::CreateQuadGeometry()
+{
+ const float halfWidth = 0.5f;
+ const float halfHeight = 0.5f;
+ struct QuadVertex { Vector2 position;};
+ QuadVertex quadVertexData[4] =
+ {
+ { Vector2(-halfWidth, -halfHeight) },
+ { Vector2(-halfWidth, halfHeight) },
+ { Vector2( halfWidth, -halfHeight) },
+ { Vector2( halfWidth, halfHeight) }
+ };
+
+ Property::Map quadVertexFormat;
+ quadVertexFormat["aPosition"] = Property::VECTOR2;
+ PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
+ quadVertices.SetData( quadVertexData, 4 );
+
+ // Create the geometry object
+ Dali::Geometry geometry = Dali::Geometry::New();
+ geometry.AddVertexBuffer( quadVertices );
+ geometry.SetType( Geometry::TRIANGLE_STRIP );
+
+ return geometry;
+}
+
+void WatchView::OnRelayout( const Vector2& size, RelayoutContainer& container )
+{
+ Control::OnRelayout( size, container );
+}
+
+} // namespace Internal
+
+} // namespace WatchView
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_WATCH_VIEW_INTERNAL_WATCH_VIEW_H__
+#define __DALI_WATCH_VIEW_INTERNAL_WATCH_VIEW_H__
+
+/*
+ * Samsung API
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <watch_viewer_dali/public_api/watch_view/watch_view.h>
+#include <watch_viewer_dali/public_api/watch_view/watch.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/adaptor-framework/native-image-source.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
+#include <dali/public-api/object/property-map.h>
+#include <wayland-extension/tizen-remote-surface-client-protocol.h>
+#include <tbm_surface.h>
+#include <screen_connector_toolkit.h>
+
+namespace Dali
+{
+
+namespace WatchView
+{
+
+namespace Internal
+{
+
+class WatchView : public WatchHolderBase, public Toolkit::Internal::Control
+{
+public:
+
+ /**
+ * @copydoc Dali::WatchView::WatchView::New
+ */
+ static Dali::WatchView::WatchView New( Window window, const std::string& watchId, const std::string& contentInfo, int width, int height );
+
+ /**
+ * @copydoc Dali::WatchView::WatchView::PauseWatch
+ */
+ bool PauseWatch();
+
+ /**
+ * @copydoc Dali::WatchView::WatchView::ResumeWatch
+ */
+ bool ResumeWatch();
+public: // Internal API
+
+ /**
+ * @brief Get wayland surface from window
+ */
+ wl_surface* GetWlSurface() const;
+
+ /**
+ * @brief Get WatchId
+ */
+ const std::string& GetWatchId() const;
+
+ /**
+ * @brief Get ContentInfo
+ */
+ const std::string& GetContentInfo();
+
+ /**
+ * @brief Remove a WatchRenderer
+ */
+ void RemoveWatchRenderer();
+
+ /**
+ * @brief Check whether the WatchRenderer is created or not
+ */
+ bool IsWatchRenderer();
+
+ /**
+ * @brief Update a ImageSource for replace tbm surface
+ */
+ void UpdateImageSource( tbm_surface_h source );
+
+ /**
+ * @brief Create a WatchRenderer
+ */
+ void CreateWatchRenderer();
+
+ /**
+ * @brief Update a buffer for rendering
+ */
+ void UpdateBuffer(const WatchBase& watch);
+
+protected:
+
+ /**
+ * Construct a new WatchView.
+ */
+ WatchView();
+
+ /**
+ * Construct a new WatchView.
+ */
+ WatchView( Window window, const std::string& watchId, const std::string& contentInfo, int width, int height );
+
+ /**
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~WatchView();
+
+ Dali::Shader CreateShader();
+
+ Dali::Geometry CreateQuadGeometry();
+
+
+public: // From WatchHolderBase
+ std::shared_ptr<WatchBase> CreateWatch(std::string appid,
+ bool mock = false) override;
+ std::shared_ptr<WatchBase> CreateWatch(int rid, std::string id,
+ std::string appid, bool mock = false) override;
+ std::shared_ptr<WatchBase> CreateWatch(std::string appid,
+ tizen_base::Bundle extra, bool mock = false) override;
+ std::shared_ptr<WatchBase> CreateWatch(int rid, std::string id,
+ std::string appid, tizen_base::Bundle extra, bool mock = false) override;
+
+ void OnAdded(const WatchBase& watch) override;
+ void OnRemoved(const WatchBase& watch) override;
+ void OnUpdated(const WatchBase& watch) override;
+ void OnLaunched(const WatchBase& watch) override;
+ void OnDead(const WatchBase& watch) override;
+ void OnBound(const WatchBase& watch) override;
+
+
+private: // From Control
+
+ /**
+ * @copydoc Toolkit::Control::OnInitialize()
+ */
+ virtual void OnInitialize();
+
+ /**
+ * @copydoc Toolkit::Control::OnSceneConnect()
+ */
+ virtual void OnSceneConnection( int depth );
+
+ /**
+ * @copydoc Toolkit::Control::OnSceneDisconnection()
+ */
+ virtual void OnSceneDisconnection();
+
+ /**
+ * @copydoc Toolkit::Control::OnSizeSet()
+ */
+ virtual void OnSizeSet( const Vector3& targetSize );
+
+ /**
+ * @copydoc Toolkit::Control::GetNaturalSize
+ */
+ virtual Vector3 GetNaturalSize();
+ /**
+ * @copydoc Toolkit::Control::OnRelayout()
+ */
+ virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ) override ;
+private:
+
+ // Undefined
+ WatchView( const WatchView& );
+
+ // Undefined
+ WatchView& operator= ( const WatchView& );
+
+private:
+ Dali::NativeImageSourcePtr mImageSource;
+ Dali::Texture mNativeTexture;
+ Dali::TextureSet mTextureSet;
+ Dali::Renderer mRenderer;
+
+ std::string mWatchId;
+ std::string mContentInfo;
+
+ int mWidth;
+ int mHeight;
+ int mPid;
+
+ wl_buffer* mBuffer;
+ Window mWindow;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::WatchView& GetImplementation( WatchView& watchView )
+{
+ DALI_ASSERT_ALWAYS( watchView );
+
+ Dali::RefObject& handle = watchView.GetImplementation();
+
+ return static_cast<Internal::WatchView&>( handle );
+}
+
+inline const Internal::WatchView& GetImplementation( const WatchView& watchView )
+{
+ DALI_ASSERT_ALWAYS( watchView );
+
+ const Dali::RefObject& handle = watchView.GetImplementation();
+
+ return static_cast<const Internal::WatchView&>( handle );
+}
+
+} // namespace WatchView
+
+} // namespace Dali
+
+#endif // __DALI_WATCH_VIEW_INTERNAL_WATCH_VIEW_H__
--- /dev/null
+/*
+ * Copyright (c) 2020 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <watch_viewer_dali/public_api/watch_view/watch.h>
+
+namespace Dali
+{
+
+namespace WatchView
+{
+
+WatchPtr Watch::New( std::string appid,
+ std::shared_ptr<screen_connector::WlSurface> surface,
+ tizen_base::Bundle extra,
+ IEvent* listener, bool mock )
+{
+ WatchPtr watch = std::make_shared<Watch>( std::move(appid), surface, std::move(extra), listener, mock );
+ return watch;
+}
+
+WatchPtr Watch::New( int rid, std::string id, std::string appid,
+ std::shared_ptr<screen_connector::WlSurface> surface,
+ tizen_base::Bundle extra,
+ IEvent* listener, bool mock )
+{
+ WatchPtr watch = std::make_shared<Watch>( rid, std::move(id), std::move(appid), surface, std::move(extra), listener, mock );
+ return watch;
+}
+WatchPtr Watch::New( std::string appid,
+ std::shared_ptr<screen_connector::WlSurface> surface,
+ IEvent* listener, bool mock )
+{
+ WatchPtr watch = std::make_shared<Watch>( std::move(appid), surface, listener, mock );
+ return watch;
+}
+
+WatchPtr Watch::New( int rid, std::string id, std::string appid,
+ std::shared_ptr<screen_connector::WlSurface> surface,
+ IEvent* listener, bool mock )
+{
+ WatchPtr watch = std::make_shared<Watch>( rid, std::move(id), std::move(appid), surface, listener, mock );
+ return watch;
+}
+
+Watch::Watch( std::string appid, std::shared_ptr<screen_connector::WlSurface> surface,
+ tizen_base::Bundle extra, IEvent* listener, bool mock )
+: WatchBase(appid, surface, extra, listener, mock)
+{
+}
+
+Watch::Watch(int rid, std::string id, std::string appid,
+ std::shared_ptr<screen_connector::WlSurface> surface, tizen_base::Bundle extra,
+ IEvent* listener, bool mock)
+: WatchBase(rid, id, appid,surface, extra, listener, mock)
+{
+}
+
+Watch::Watch(std::string appid, std::shared_ptr<screen_connector::WlSurface> surface,
+ IEvent* listener, bool mock)
+: WatchBase(appid, surface, listener, mock)
+{
+}
+
+Watch::Watch(int rid, std::string id, std::string appid, std::shared_ptr<screen_connector::WlSurface> surface,
+ IEvent* listener, bool mock)
+: WatchBase(rid, id, appid, surface, listener, mock)
+{
+}
+
+Watch::~Watch()
+{
+}
+
+} // namespcae Watch
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_WATCH_VIEW_WATCH_H__
+#define __DALI_WATCH_VIEW_WATCH_H__
+
+/*
+ * Samsung API
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// EXTERNAL INCLUDES
+#include <watch_viewer_dali/public_api/watch_view/watch_view.h>
+
+namespace Dali
+{
+
+namespace WatchView
+{
+
+class Watch;
+typedef std::shared_ptr< Watch > WatchPtr;
+
+/**
+ * @brief Watch class is the base class for Watch Buffer
+ */
+class Watch : public WatchBase
+{
+ public:
+ friend class WatchView;
+
+ /**
+ * @brief Creates an handle to a new Watch.
+ * @param[in] appid The application id
+ * @param[in] surface The surface from window
+ * @param[in] extra The bundle for send a message to WatchApplication
+ * @param[in] listener The class of WatchBase is for send a event
+ * @param[in] mock The dummy object for test
+ * @return A new WatchPtr
+ */
+ static WatchPtr New( std::string appid,
+ std::shared_ptr<screen_connector::WlSurface> surface,
+ tizen_base::Bundle extra,
+ IEvent* listener, bool mock = false );
+
+ /**
+ * @brief Creates an handle to a new Watch.
+ * @param[in] rid The resource id of watch.it is for reference the watch.
+ * @param[in] id The instance id for watch.
+ * @param[in] appid The application id
+ * @param[in] surface The surface from window
+ * @param[in] extra The bundle for send a message to WatchApplication
+ * @param[in] listener The class of WatchBase is for send a event
+ * @param[in] mock The dummy object for test
+ * @return A new WatchPtr
+ */
+ static WatchPtr New( int rid, std::string id, std::string appid,
+ std::shared_ptr<screen_connector::WlSurface> surface,
+ tizen_base::Bundle extra,
+ IEvent* listener, bool mock = false );
+
+ /**
+ * @brief Creates an handle to a new Watch.
+ * @param[in] appid The application id
+ * @param[in] surface The surface from window
+ * @param[in] listener The class of WatchBase is for send a event
+ * @param[in] mock The dummy object for test
+ * @return A new WatchPtr
+ */
+ static WatchPtr New( std::string appid,
+ std::shared_ptr<screen_connector::WlSurface> surface,
+ IEvent* listener, bool mock = false );
+
+ /**
+ * @brief Creates an handle to a new Watch.
+ * @param[in] rid The resource id of watch.it is for reference the watch.
+ * @param[in] id The instance id for watch.
+ * @param[in] appid The application id
+ * @param[in] surface The surface from window
+ * @param[in] listener The class of WatchBase is for send a event
+ * @param[in] mock The dummy object for test
+ * @return A new WatchPtr
+ */
+ static WatchPtr New( int rid, std::string id, std::string appid,
+ std::shared_ptr<screen_connector::WlSurface> surface,
+ IEvent* listener, bool mock = false );
+
+ /**
+ * @brief Creates an uninitialized handle.
+ */
+ Watch( std::string appid,
+ std::shared_ptr<screen_connector::WlSurface> surface,
+ tizen_base::Bundle extra,
+ IEvent* listener, bool mock = false );
+
+ /**
+ * @brief Creates an uninitialized handle.
+ */
+ Watch( int rid, std::string id, std::string appid,
+ std::shared_ptr<screen_connector::WlSurface> surface,
+ tizen_base::Bundle extra,
+ IEvent* listener, bool mock = false );
+
+ /**
+ * @brief Creates an uninitialized handle.
+ */
+ Watch( std::string appid,
+ std::shared_ptr<screen_connector::WlSurface> surface,
+ IEvent* listener, bool mock = false );
+
+ /**
+ * @brief Creates an uninitialized handle.
+ */
+ Watch( int rid, std::string id, std::string appid,
+ std::shared_ptr<screen_connector::WlSurface> surface,
+ IEvent* listener, bool mock = false );
+
+ virtual ~Watch();
+};
+
+
+} // namespace WatchView
+
+} // namespace Dali
+
+#endif // __DALI_WATCH_VIEW_WATCH_H__
\ No newline at end of file
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <watch_viewer_dali/public_api/watch_view/watch_view.h>
+
+// INTERNAL INCLUDES
+#include <watch_viewer_dali/internal/watch_view/watch_view_impl.h>
+
+namespace Dali
+{
+
+namespace WatchView
+{
+
+WatchView WatchView::New( Window window, const std::string& watchId, const std::string& contentInfo, int width, int height )
+{
+ return Internal::WatchView::New( window, watchId, contentInfo, width, height );
+}
+
+WatchView WatchView::DownCast( BaseHandle handle )
+{
+ return Toolkit::Control::DownCast<WatchView, Internal::WatchView>( handle );
+}
+
+WatchView::WatchView()
+{
+}
+
+WatchView::WatchView( const WatchView& copy ) = default;
+
+WatchView& WatchView::operator=( const WatchView& rhs ) = default;
+
+WatchView::WatchView( WatchView&& rhs ) = default;
+
+WatchView& WatchView::operator=( WatchView&& rhs ) = default;
+
+WatchView::~WatchView()
+{
+}
+
+bool WatchView::PauseWatch()
+{
+ return Dali::WatchView::GetImplementation( *this ).PauseWatch();
+}
+
+bool WatchView::ResumeWatch()
+{
+ return Dali::WatchView::GetImplementation( *this ).ResumeWatch();
+}
+
+WatchView::WatchView( Internal::WatchView& implementation )
+: Control( implementation )
+{
+}
+
+WatchView::WatchView( Dali::Internal::CustomActor* internal )
+: Control( internal )
+{
+ VerifyCustomActorPointer<Internal::WatchView>( internal );
+}
+
+} // namespace WatchView
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_WATCH_VIEW_WATCH_VIEW_H__
+#define __DALI_WATCH_VIEW_WATCH_VIEW_H__
+
+/*
+ * Samsung API
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <memory>
+#include <watch_holder_base.hh>
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+#include <dali/public-api/adaptor-framework/window.h>
+
+namespace Dali
+{
+
+namespace WatchView
+{
+
+namespace Internal DALI_INTERNAL
+{
+class WatchView;
+}
+
+/**
+ * @addtogroup dali_watch_view
+ * @{
+ */
+
+/**
+ * @brief WatchView is a class for displaying the watch image and controlling the watch.
+ * @since_tizen 6.0
+ */
+using namespace watch_holder;
+
+class DALI_IMPORT_API WatchView : public Toolkit::Control
+{
+public:
+ /**
+ * @brief Create watch view.
+ *
+ * @since_tizen 6.0
+ * @privlevel public
+ * @param[in] window The window of this control
+ * @param[in] contentInfo Contents that will be given to the watch.
+ * @param[in] width The watch width.
+ * @param[in] height The watch height.
+ * @return A handle to WatchView.
+ */
+ static WatchView New( Window window, const std::string& watchId, const std::string& contentInfo, int width, int height );
+
+ /**
+ * @brief Downcast a handle to WatchView handle.
+ *
+ * If the BaseHandle points is a WatchView the downcast returns a valid handle.
+ * If not the returned handle is left empty.
+ *
+ * @since_tizen 6.0
+ * @param[in] handle Handle to an object
+ * @return handle to a WatchView or an empty handle
+ */
+ static WatchView DownCast( BaseHandle handle );
+
+ /**
+ * @brief Creates an empty handle.
+ * @since_tizen 6.0
+ */
+ WatchView();
+
+ /**
+ * @brief Copy constructor.
+ *
+ * @since_tizen 6.0
+ * @param[in] handle The handle to copy from.
+ */
+ WatchView( const WatchView& handle );
+
+ /**
+ * @brief Assignment operator.
+ *
+ * @since_tizen 6.0
+ * @param[in] handle The handle to copy from.
+ * @return A reference to this.
+ */
+ WatchView& operator=( const WatchView& handle );
+
+ /**
+ * @brief Move constructor.
+ *
+ * @since_tizen 6.0
+ * @param[in] rhs A reference to the moved handle
+ */
+ WatchView( WatchView&& rhs );
+
+ /**
+ * @brief Move assignment operator.
+ *
+ * @since_tizen 6.0
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this handle
+ */
+ WatchView& operator=( WatchView&& rhs );
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ * @since_tizen 6.0
+ */
+ ~WatchView();
+
+ /**
+ * @brief Pauses a given watch.
+ *
+ * @since_tizen 6.0
+ * @privlevel public
+ * @return true on success, false otherwise.
+ */
+ bool PauseWatch();
+
+ /**
+ * @brief Resume a given watch.
+ *
+ * @since_tizen 6.0
+ * @privlevel public
+ * @return true on success, false otherwise.
+ */
+ bool ResumeWatch();
+
+public: // Not intended for application developers
+
+ /**
+ * @internal
+ * @brief Creates a handle using the WatchView::Internal implementation.
+ *
+ * @since_tizen 6.0
+ * @param[in] implementation The WatchView implementation.
+ */
+ DALI_INTERNAL WatchView( Internal::WatchView& implementation );
+
+ /**
+ * @internal
+ * @brief Allows the creation of this control from an Internal::CustomActor pointer.
+ *
+ * @since_tizen 6.0
+ * @param[in] internal A pointer to the internal CustomActor.
+ */
+ DALI_INTERNAL WatchView( Dali::Internal::CustomActor* internal );
+};
+
+/**
+ * @}
+ */
+} // namespace WatchView
+
+} // namespace Dali
+
+#endif // __DALI_WATCH_VIEW_WATCH_VIEW_H__