Add homescreen API documentation
authorJens Bocklage <jens_bocklage@mentor.com>
Fri, 20 Jan 2017 17:30:39 +0000 (18:30 +0100)
committerJens Bocklage <jens_bocklage@mentor.com>
Fri, 20 Jan 2017 17:30:39 +0000 (18:30 +0100)
Signed-off-by: Jens Bocklage <jens_bocklage@mentor.com>
homescreen/docs/homescreen_api.md [new file with mode: 0644]
homescreen/docs/pictures/api_getAllSurfacesOfProcess.png [new file with mode: 0644]
homescreen/docs/pictures/api_getSurfaceStatus_1.png [new file with mode: 0644]
homescreen/docs/pictures/api_getSurfaceStatus_2.png [new file with mode: 0644]
homescreen/docs/pictures/api_getSurfaceStatus_3.png [new file with mode: 0644]
homescreen/docs/pictures/api_hardKeyPressed.png [new file with mode: 0644]
homescreen/docs/pictures/api_renderSurfaceToArea.png [new file with mode: 0644]
homescreen/docs/pictures/api_renderSurfaceToAreaAllowed.png [new file with mode: 0644]
homescreen/docs/pictures/api_requestSurfaceIdToFullScreen.png [new file with mode: 0644]
homescreen/docs/pictures/api_surfaceVisibilityChanged.png [new file with mode: 0644]

diff --git a/homescreen/docs/homescreen_api.md b/homescreen/docs/homescreen_api.md
new file mode 100644 (file)
index 0000000..13be181
--- /dev/null
@@ -0,0 +1,185 @@
+# HomeScreen API\r
+The HomeScreen app provides an own interface for some special use cases concerning the surfaces and user inputs.\r
+\r
+The interface is implemented as D-Bus interface.\r
+This is the introspection, describing the interface:\r
+\r
+```\r
+<node>\r
+       <interface name="org.agl.homescreen">\r
+               <method name="hardKeyPressed">\r
+                       <arg name="key" type="i" direction="in"/>\r
+               </method>\r
+               <method name="getSurfaceStatus">\r
+                       <arg name="surfaceId" type="i" direction="in"/>\r
+                       <arg name="status" type="i" direction="out"/>\r
+               </method>\r
+               <method name="requestSurfaceIdToFullScreen">\r
+                       <arg name="surfaceId" type="i" direction="in"/>\r
+               </method>\r
+               <method name="getAllSurfacesOfProcess">\r
+                       <arg name="pid" type="i" direction="in"/>\r
+                       <arg name="surfaceIds" type="ai" direction="out"/>\r
+                       <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;int&gt;"/>\r
+               </method>\r
+               <method name="getLayoutRenderAreaForSurfaceId">\r
+                       <arg name="surfaceId" type="i" direction="in"/>\r
+                       <arg name="renderArea" type="(iiii)" direction="out"/>\r
+                       <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QRect"/>\r
+               </method>\r
+               <method name="renderSurfaceToAreaAllowed">\r
+                       <arg name="surfaceId" type="i" direction="in"/>\r
+                       <arg name="layoutArea" type="i" direction="in"/>\r
+                       <arg name="allowed" type="b" direction="out"/>\r
+               </method>\r
+               <method name="renderSurfaceToArea">\r
+                       <arg name="surfaceId" type="i" direction="in"/>\r
+                       <arg name="layoutArea" type="i" direction="in"/>\r
+               </method>\r
+       </interface>\r
+</node>\r
+```\r
+\r
+These interface will change during further development, so check back frequently.\r
+\r
+## User Input Events API calls\r
+\r
+### hardKeyPressed\r
+\r
+Use hardKeyPressed to inject hard key press events into the HomeScreen app.\r
+This Interface call can be used by applications like the InputEventManager to inject hard keys into the HomeScreen application.\r
+\r
+#### Example\r
+\r
+if someone presses the Hard Key “NAV” on the target, this key may be injected using this interface to make the HomeScreen launch the navigation application.\r
+Right now, only a few keys are defined (in inputevent.hpp):\r
+\r
+```\r
+namespace InputEvent {\r
+    typedef enum HardKey\r
+    {\r
+        HARDKEY_UNDEFINED,\r
+        HARDKEY_NAV,\r
+        HARDKEY_MEDIA\r
+    } eHardKey;\r
+}\r
+```\r
+\r
+This will change in the future.\r
\r
+![AGL HVAC](pictures/api_hardKeyPressed.png)\r
\r
+A “normal” application would not need to call this API.\r
+\r
+## Surface control API calls\r
+\r
+The normal use case when starting an application is:\r
+The user presses a hard key or uses the app launcher to start an app. The app is then started and is shown full screen.\r
+The org.agl.homescreen API provides some methods to get information about some status and some methods to show surfaces on the screen.\r
+\r
+### getSurfaceStatus\r
+\r
+A surface can be visible or invisible (please do not confuse “visible” and “visibility”). This function allows to request the current status.\r
+\r
+```\r
+<method name="getSurfaceStatus">\r
+       <arg name="surfaceId" type="i" direction="in"/>\r
+       <arg name="status" type="i" direction="out"/>\r
+</method>\r
+```\r
+\r
+Right now an application has to pull this information.\r
+This is not optimal and will change in the future. There are two options:\r
+*   The homescreen API will provide a signal that is emitted every time the visible status of surfaces changes. This would be way more efficient, because it would save time and avoid a re-occurring API call. __UPDATE:__ There is a D-Bus signal implemented in this API\r
+*   For Qt, there is already a patch available that provides this information as a base class property. See https://codereview.qt-project.org/#/c/176211/ This would be optimal for Qt widget applications. But not useful for other languages, e.g. Java. __UPDATE:__ This patch got reverted in AGL!\r
+\r
+#### Current implementation\r
\r
+![AGL HVAC](pictures/api_getSurfaceStatus_1.png)\r
\r
+#### Option 1\r
+\r
+![AGL HVAC](pictures/api_getSurfaceStatus_2.png)\r
+\r
+#### Option 2\r
+\r
+![AGL HVAC](pictures/api_getSurfaceStatus_3.png)\r
+\r
+### requestSurfaceIdToFullScreen\r
+\r
+This function will set the given surface to full screen.\r
+\r
+```\r
+<method name="requestSurfaceIdToFullScreen">\r
+       <arg name="surfaceId" type="i" direction="in"/>\r
+</method>\r
+```\r
+\r
+It will hide all other surfaces.\r
+\r
+![AGL HVAC](pictures/api_requestSurfaceIdToFullScreen.png)\r
\r
+### getAllSurfacesOfProcess\r
+\r
+This returns all surfaces that are created by the given process ID.\r
+\r
+```\r
+<method name="getAllSurfacesOfProcess">\r
+       <arg name="pid" type="i" direction="in"/>\r
+       <arg name="surfaceIds" type="ai" direction="out"/>\r
+       <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;int&gt;"/>\r
+</method>\r
+```\r
+\r
+A process can create more than one surface. By default, the surface with the lowest surface ID is shown on the screen. If an application wants to know all surfaces that were created by an application, this method will provide them.\r
+\r
+![AGL HVAC](pictures/api_getAllSurfacesOfProcess.png)\r
+\r
+### renderSurfaceToAreaAllowed\r
+\r
+Before calling renderSurfaceToArea, an application can request, if it is allowed to render the surface to this area. This makes sense for an application that would begin to allocate resources to render. But if it is not allowed to render the surface, the application could avoid allocating the resources.\r
+\r
+```\r
+<method name="renderSurfaceToAreaAllowed">\r
+       <arg name="surfaceId" type="i" direction="in"/>\r
+       <arg name="layoutArea" type="i" direction="in"/>\r
+       <arg name="allowed" type="b" direction="out"/>\r
+</method>\r
+```\r
+\r
+The call will not affect the current setup, it will only request if it is allowed or not.\r
+\r
+![AGL HVAC](pictures/api_renderSurfaceToAreaAllowed.png)\r
+\r
+### renderSurfaceToArea\r
+\r
+By default, the HomeScreen application decides, where to render an applications surface. The concept of Layouts defines this. This API call can override the default behavior. An app can request to render a surface in a specific Layout Area.\r
+\r
+```\r
+<method name="renderSurfaceToArea">\r
+       <arg name="surfaceId" type="i" direction="in"/>\r
+       <arg name="layoutArea" type="i" direction="in"/>\r
+</method>\r
+```\r
+\r
+The surface that was previously rendered in this Layout are will be hidden.\r
+\r
+![AGL HVAC](pictures/api_renderSurfaceToArea.png)\r
+\r
+The homescreen interface functionality is not fully implemented, but the API is available. For example using the libhomescreen.so.\r
+\r
+### surfaceVisibilityChanged\r
+\r
+Whenever the visibility property of a surface changes, this signal is emitted.\r
+\r
+```\r
+<signal name="surfaceVisibilityChanged">\r
+       <arg name="surfaceId" type="i"/>\r
+       <arg name="visible" type="b"/>\r
+</signal>\r
+```\r
+\r
+Visibility here means visible. The name of the signal is from the Weston surface property “visibility”.\r
+See here for reference: https://github.com/ntanibata/wayland-ivi-extension/blob/master/ivi-layermanagement-api/ilmCommon/include/ilm_types.h\r
\r
+![AGL HVAC](pictures/api_surfaceVisibilityChanged.png)\r
diff --git a/homescreen/docs/pictures/api_getAllSurfacesOfProcess.png b/homescreen/docs/pictures/api_getAllSurfacesOfProcess.png
new file mode 100644 (file)
index 0000000..5c862d7
Binary files /dev/null and b/homescreen/docs/pictures/api_getAllSurfacesOfProcess.png differ
diff --git a/homescreen/docs/pictures/api_getSurfaceStatus_1.png b/homescreen/docs/pictures/api_getSurfaceStatus_1.png
new file mode 100644 (file)
index 0000000..1e18fcf
Binary files /dev/null and b/homescreen/docs/pictures/api_getSurfaceStatus_1.png differ
diff --git a/homescreen/docs/pictures/api_getSurfaceStatus_2.png b/homescreen/docs/pictures/api_getSurfaceStatus_2.png
new file mode 100644 (file)
index 0000000..e66d708
Binary files /dev/null and b/homescreen/docs/pictures/api_getSurfaceStatus_2.png differ
diff --git a/homescreen/docs/pictures/api_getSurfaceStatus_3.png b/homescreen/docs/pictures/api_getSurfaceStatus_3.png
new file mode 100644 (file)
index 0000000..50a3b10
Binary files /dev/null and b/homescreen/docs/pictures/api_getSurfaceStatus_3.png differ
diff --git a/homescreen/docs/pictures/api_hardKeyPressed.png b/homescreen/docs/pictures/api_hardKeyPressed.png
new file mode 100644 (file)
index 0000000..a8a3660
Binary files /dev/null and b/homescreen/docs/pictures/api_hardKeyPressed.png differ
diff --git a/homescreen/docs/pictures/api_renderSurfaceToArea.png b/homescreen/docs/pictures/api_renderSurfaceToArea.png
new file mode 100644 (file)
index 0000000..a61fc2f
Binary files /dev/null and b/homescreen/docs/pictures/api_renderSurfaceToArea.png differ
diff --git a/homescreen/docs/pictures/api_renderSurfaceToAreaAllowed.png b/homescreen/docs/pictures/api_renderSurfaceToAreaAllowed.png
new file mode 100644 (file)
index 0000000..35dbbcf
Binary files /dev/null and b/homescreen/docs/pictures/api_renderSurfaceToAreaAllowed.png differ
diff --git a/homescreen/docs/pictures/api_requestSurfaceIdToFullScreen.png b/homescreen/docs/pictures/api_requestSurfaceIdToFullScreen.png
new file mode 100644 (file)
index 0000000..6d2f712
Binary files /dev/null and b/homescreen/docs/pictures/api_requestSurfaceIdToFullScreen.png differ
diff --git a/homescreen/docs/pictures/api_surfaceVisibilityChanged.png b/homescreen/docs/pictures/api_surfaceVisibilityChanged.png
new file mode 100644 (file)
index 0000000..f519757
Binary files /dev/null and b/homescreen/docs/pictures/api_surfaceVisibilityChanged.png differ