diff options
author | Bocklage, Jens <Jens_Bocklage@mentor.com> | 2017-01-18 15:29:11 +0100 |
---|---|---|
committer | Bocklage, Jens <Jens_Bocklage@mentor.com> | 2017-01-18 15:29:11 +0100 |
commit | 0a6aadf18c17798b2624fb6ec9596ae24fa9eb1d (patch) | |
tree | d240edccc82c8c3d69f1335eab6e367c4761e7e1 | |
parent | 72d085b03604286e045f978d2d100d677b6534d6 (diff) |
Initial source commit
Taken from https://gerrit.automotivelinux.org/gerrit/p/staging/HomeScreen.git
Signed-off-by: Bocklage, Jens <Jens_Bocklage@mentor.com>
-rw-r--r-- | README.md | 39 | ||||
-rw-r--r-- | interfaces/LICENSE | 54 | ||||
-rw-r--r-- | interfaces/README.md | 11 | ||||
-rw-r--r-- | interfaces/homescreen.xml | 106 | ||||
-rw-r--r-- | libhomescreen.pro | 22 | ||||
-rw-r--r-- | libhomescreen/include/libhomescreen.hpp | 36 | ||||
-rw-r--r-- | libhomescreen/libhomescreen.pro | 47 | ||||
-rw-r--r-- | libhomescreen/src/libhomescreen.cpp | 160 | ||||
-rw-r--r-- | samplehomescreeninterfaceapp/samplehomescreeninterfaceapp.pro | 13 | ||||
-rw-r--r-- | samplehomescreeninterfaceapp/src/main.cpp | 31 | ||||
-rw-r--r-- | samplehomescreeninterfaceapp/src/sampleclass.cpp | 42 | ||||
-rw-r--r-- | samplehomescreeninterfaceapp/src/sampleclass.hpp | 24 |
12 files changed, 585 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..8d1290a --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +This project contains: + +libhomescreen: HomeScreen API C++ shared library + +AGL repo for source code: +https://gerrit.automotivelinux.org/gerrit/gitweb?p=staging%2FHomeScreen.git + +AGL repo for bitbake recipe: +https://gerrit.automotivelinux.org/gerrit/gitweb?p=AGL/meta-agl-demo.git;a=blob;f=recipes-demo-hmi/homescreen/homescreen_git.bb + + + + +Quickstart: + +Instructions for building libhomescreen +--------------------------------------- + +The libhomescreen is part of the +packagegroup-agl-demo-platform +packagegroup. + +This also includes the following apps: +- HomeScreenAppFrameworkBinderAGL +- InputEventManager +- SampleAppTimeDate +- SampleHomeScreenInterfaceApp +- WindowManager + + + + + +To build all the above, follow the instrucions on the AGL +documentation website: +http://docs.automotivelinux.org/docs/getting_started/en/dev/reference/source-code.html#features-supported-by-aglsetup + +Please activate the "agl-demo" feature when running the aglsetup script: +http://docs.automotivelinux.org/docs/getting_started/en/dev/reference/source-code.html#features-supported-by-aglsetup diff --git a/interfaces/LICENSE b/interfaces/LICENSE new file mode 100644 index 0000000..31c692a --- /dev/null +++ b/interfaces/LICENSE @@ -0,0 +1,54 @@ +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + + You must give any other recipients of the Work or Derivative Works a copy of this License; and + You must cause any modified files to carry prominent notices stating that You changed the files; and + You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + + You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/interfaces/README.md b/interfaces/README.md new file mode 100644 index 0000000..15dfaa9 --- /dev/null +++ b/interfaces/README.md @@ -0,0 +1,11 @@ +AGL Home Screen reference implementation +This lib provides the needed D-Bus interfaces + +Build with QtCreator 3.0.1 + +AGL repo for source code: +https://gerrit.automotivelinux.org/gerrit/#/admin/projects/staging/HomeScreen + +AGL repo for bitbake recipe: +https://gerrit.automotivelinux.org/gerrit/#/admin/projects/AGL/meta-agl-demo/recipes-demo-hmi/HomeScreen/HomeScreen_?.bb + diff --git a/interfaces/homescreen.xml b/interfaces/homescreen.xml new file mode 100644 index 0000000..378ff54 --- /dev/null +++ b/interfaces/homescreen.xml @@ -0,0 +1,106 @@ +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<!-- Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH + + 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. --> +<node> +<!-- + org.agl.homescreen: + @short_description: A generic interface for the HomeScreen app. + + This interface is a collection of methods from different functional areas to control the HomeScreen app. +--> + <interface name="org.agl.homescreen"> + <!-- + hardKeyPressed: + @key: The key that was pressed using the inputevent.hpp InputEvent::HardKey type. + + This is used to inject hard keys into the HomeScreen app. + --> + <method name="hardKeyPressed"> + <arg name="key" type="i" direction="in"/> + </method> + <!-- + getSurfaceStatus: + @surfaceId: The given surface. + @status: The status can be unknown (-1), visible (0), invisible (1) + + A surface can have three states. It can be visible, then it is shown on the screen. + It can be invisible, then it is not shown on the screen. Or the state is unknown. + --> + <method name="getSurfaceStatus"> + <arg name="surfaceId" type="i" direction="in"/> + <arg name="status" type="i" direction="out"/> + </method> + <!-- + requestSurfaceIdToFullScreen: + @surfaceId: The surface that request to be shown fullscreen. + + This allows an application to set a surface to full screen. + --> + <method name="requestSurfaceIdToFullScreen"> + <arg name="surfaceId" type="i" direction="in"/> + </method> + <!-- + getAllSurfacesOfProcess: + @pid: The PID of the process. + @surfaceIds: A list of surfaces that were created by the process. + + The surface IDs can for example be used to assign them to a layout render area. + --> + <method name="getAllSurfacesOfProcess"> + <arg name="pid" type="i" direction="in"/> + <arg name="surfaceIds" type="ai" direction="out"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<int>"/> + </method> + <!-- + renderAppToAreaAllowed: + @appCategory: The application category that is requested. Use enum AppCategory for this! + @layoutArea: The layout area where the application shall be rendered. Find the layoutArea ids in the layout definition! + @allowed: Returns true, if the application is allowed to be rendered in the area + + This function can be used to request, if it is allowed to render an application of a specific category + in a layout area. The idea is to decide from an application point of view to allocate recources or not. + Example: an application will decide to render video based on this call. This call will not change anything, it is only a request. + --> + <method name="renderAppToAreaAllowed"> + <arg name="appCategory" type="i" direction="in"/> + <arg name="layoutArea" type="i" direction="in"/> + <arg name="allowed" type="b" direction="out"/> + </method> + <!-- + renderSurfaceToArea: + @surfaceId: The surface that is requested. + @layoutArea: The layout area where the surface shall be rendered. Find the layoutArea ids in the layout definition! + + This is a special case. In the normal use case, one layout area is always filled completely + with the first surface, that the process creates (more precise: the surface with the lowest id). + By using this function, an app can request to position a different surface in the layout area. + --> + <method name="renderSurfaceToArea"> + <arg name="surfaceId" type="i" direction="in"/> + <arg name="layoutArea" type="i" direction="in"/> + </method> + <!-- + surfaceVisibilityChanged: + @surfaceId: The surface that changed. + @visible: True, if the surface is visible. + + This is emitted when the visible property of the surfaces changes. + --> + <signal name="surfaceVisibilityChanged"> + <arg name="surfaceId" type="i"/> + <arg name="visible" type="b"/> + </signal> + </interface> +</node> + diff --git a/libhomescreen.pro b/libhomescreen.pro new file mode 100644 index 0000000..1139864 --- /dev/null +++ b/libhomescreen.pro @@ -0,0 +1,22 @@ +# Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH +# +# 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. + +TEMPLATE = subdirs + +load(configure) + +SUBDIRS = libhomescreen \ + samplehomescreeninterfaceapp + +samplehomescreeninterfaceapp.depends = libhomescreen diff --git a/libhomescreen/include/libhomescreen.hpp b/libhomescreen/include/libhomescreen.hpp new file mode 100644 index 0000000..6baa805 --- /dev/null +++ b/libhomescreen/include/libhomescreen.hpp @@ -0,0 +1,36 @@ +#ifndef LIBHOMESCREEN_HPP +#define LIBHOMESCREEN_HPP + +#include <vector> + +// forward declarations +struct _LibHomeScreenHomescreen; +typedef struct _LibHomeScreenHomescreen LibHomeScreenHomescreen; + +typedef struct +{ + int x; + int y; + int width; + int height; +} sRectangle; + +class LibHomeScreen +{ +public: + LibHomeScreen(); + ~LibHomeScreen(); + + // these are representing the D-Bus methods: + std::vector<int> getAllSurfacesOfProcess(int pid); + int getSurfaceStatus(int surfaceId); + void hardKeyPressed(int key); + void renderSurfaceToArea(int surfaceId, int layoutArea); + bool renderAppToAreaAllowed(int appCategory, int layoutArea); + void requestSurfaceIdToFullScreen(int surfaceId); +private: + LibHomeScreenHomescreen *mp_libHomeScreenHomescreen_Proxy; +}; + +#endif // LIBHOMESCREEN_HPP + diff --git a/libhomescreen/libhomescreen.pro b/libhomescreen/libhomescreen.pro new file mode 100644 index 0000000..f7cae8e --- /dev/null +++ b/libhomescreen/libhomescreen.pro @@ -0,0 +1,47 @@ +TEMPLATE = lib +TARGET = homescreen +CONFIG -= qt + +SOURCES += \ + src/libhomescreen.cpp + +HEADERS += \ + include/libhomescreen.hpp + +CONFIG += link_pkgconfig +PKGCONFIG += glib-2.0 gio-unix-2.0 + +XMLSOURCES = \ + ../interfaces/homescreen.xml + +gen_proxy_skeleton_h.input = XMLSOURCES +gen_proxy_skeleton_h.commands = \ + gdbus-codegen --generate-c-code ${QMAKE_FILE_IN_BASE} --c-namespace LibHomeScreen --interface-prefix org.agl. ${QMAKE_FILE_IN} +gen_proxy_skeleton_h.output = ${QMAKE_FILE_IN_BASE}.h +gen_proxy_skeleton_h.variable_out = HEADERS +gen_proxy_skeleton_h.clean = ${QMAKE_FILE_IN_BASE}.h + +gen_proxy_skeleton_c.input = XMLSOURCES +gen_proxy_skeleton_c.commands = \ + gdbus-codegen --generate-c-code ${QMAKE_FILE_IN_BASE} --c-namespace LibHomeScreen --interface-prefix org.agl. ${QMAKE_FILE_IN} +gen_proxy_skeleton_c.output = ${QMAKE_FILE_IN_BASE}.c +gen_proxy_skeleton_c.variable_out = SOURCES +gen_proxy_skeleton_c.clean = ${QMAKE_FILE_IN_BASE}.c + +QMAKE_EXTRA_COMPILERS += gen_proxy_skeleton_h gen_proxy_skeleton_c + + +gen_docbook.target = doc +gen_docbook.commands = \ + gdbus-codegen --generate-docbook doc $$PWD/../interfaces/homescreen.xml + +QMAKE_EXTRA_TARGETS += gen_docbook +PRE_TARGETDEPS += doc + +CONFIG += create_pc create_prl +QMAKE_PKGCONFIG_NAME = libhomescreen +QMAKE_PKGCONFIG_DESCRIPTION = A generic interface for the HomeScreen app +QMAKE_PKGCONFIG_LIBDIR = /usr/lib64 +QMAKE_PKGCONFIG_INCDIR = /usr/include +QMAKE_PKGCONFIG_REQUIRES = glib-2.0 gio-unix-2.0 +QMAKE_PKGCONFIG_DESTDIR = pkgconfig diff --git a/libhomescreen/src/libhomescreen.cpp b/libhomescreen/src/libhomescreen.cpp new file mode 100644 index 0000000..ae8f563 --- /dev/null +++ b/libhomescreen/src/libhomescreen.cpp @@ -0,0 +1,160 @@ +extern "C" { +#include "homescreen.h" // generated from xml +} +#include "include/libhomescreen.hpp" + +#include <stdio.h> +#include <stdlib.h> + +LibHomeScreen::LibHomeScreen() +{ + GError *err = NULL; + + mp_libHomeScreenHomescreen_Proxy = lib_home_screen_homescreen_proxy_new_for_bus_sync( + G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + "org.agl.homescreen", + "/HomeScreen", + NULL, + &err); + + if (NULL != err) + { + fprintf(stderr, "Unable to create proxy: %s\n", err->message); + } +} + +LibHomeScreen::~LibHomeScreen() +{ + g_object_unref(mp_libHomeScreenHomescreen_Proxy); +} + +std::vector<int> LibHomeScreen::getAllSurfacesOfProcess(int pid) +{ + std::vector<int> result; + + GError *err = NULL; + + GVariant *out_surfaceIds; + + lib_home_screen_homescreen_call_get_all_surfaces_of_process_sync( + mp_libHomeScreenHomescreen_Proxy, + pid, + &out_surfaceIds, + NULL, + &err); + + if (NULL != err) + { + fprintf(stderr, "Unable to call getAllSurfacesOfProcess: %s\n", err->message); + } + + + GVariant *element; + GVariantIter iter; + int i; + + if (g_variant_iter_init(&iter, out_surfaceIds)) + { + while ((element = g_variant_iter_next_value(&iter)) != NULL) + { + g_variant_get(element, "i", &i); + result.push_back(i); + g_variant_unref(element); + } + } + + return result; +} + +int LibHomeScreen::getSurfaceStatus(int surfaceId) +{ + int result; + GError *err = NULL; + + GVariant *out_renderArea; + + lib_home_screen_homescreen_call_get_surface_status_sync( + mp_libHomeScreenHomescreen_Proxy, + surfaceId, + &result, + NULL, + &err); + + if (NULL != err) + { + fprintf(stderr, "Unable to call getSurfaceStatus: %s\n", err->message); + } + + return result; +} + +void LibHomeScreen::hardKeyPressed(int key) +{ + GError *err = NULL; + + lib_home_screen_homescreen_call_hard_key_pressed_sync( + mp_libHomeScreenHomescreen_Proxy, + key, + NULL, + &err); + + if (NULL != err) + { + fprintf(stderr, "Unable to call hardKeyPressed: %s\n", err->message); + } +} + +void LibHomeScreen::renderSurfaceToArea(int surfaceId, int layoutArea) +{ + GError *err = NULL; + + lib_home_screen_homescreen_call_render_surface_to_area_sync( + mp_libHomeScreenHomescreen_Proxy, + surfaceId, + layoutArea, + NULL, + &err); + + if (NULL != err) + { + fprintf(stderr, "Unable to call renderSurfaceToArea: %s\n", err->message); + } +} + +bool LibHomeScreen::renderAppToAreaAllowed(int appCategory, int layoutArea) +{ + gboolean result = true; + GError *err = NULL; + + lib_home_screen_homescreen_call_render_app_to_area_allowed_sync( + mp_libHomeScreenHomescreen_Proxy, + appCategory, + layoutArea, + &result, + NULL, + &err); + + if (NULL != err) + { + fprintf(stderr, "Unable to call renderAppToAreaAllowed: %s\n", err->message); + } + + return result; +} + +void LibHomeScreen::requestSurfaceIdToFullScreen(int surfaceId) +{ + GError *err = NULL; + + lib_home_screen_homescreen_call_request_surface_id_to_full_screen_sync( + mp_libHomeScreenHomescreen_Proxy, + surfaceId, + NULL, + &err); + + if (NULL != err) + { + fprintf(stderr, "Unable to call requestSurfaceIdToFullScreen: %s\n", err->message); + } +} diff --git a/samplehomescreeninterfaceapp/samplehomescreeninterfaceapp.pro b/samplehomescreeninterfaceapp/samplehomescreeninterfaceapp.pro new file mode 100644 index 0000000..92268a0 --- /dev/null +++ b/samplehomescreeninterfaceapp/samplehomescreeninterfaceapp.pro @@ -0,0 +1,13 @@ +TEMPLATE = app +TARGET = SampleHomeScreenInterfaceApp +CONFIG -= qt + +SOURCES += src/main.cpp \ + src/sampleclass.cpp + +HEADERS += \ + src/sampleclass.hpp + +INCLUDEPATH += $$PWD/../libhomescreen/include/ + +LIBS += -L$$OUT_PWD/../libhomescreen -lhomescreen diff --git a/samplehomescreeninterfaceapp/src/main.cpp b/samplehomescreeninterfaceapp/src/main.cpp new file mode 100644 index 0000000..5b48855 --- /dev/null +++ b/samplehomescreeninterfaceapp/src/main.cpp @@ -0,0 +1,31 @@ +#include <iostream> +#include "sampleclass.hpp" + +using namespace std; + +int main() +{ + cout << "SampleHomeScreenInterfaceApp" << endl; + cout << "v0.6.0" << endl; + + SampleClass *sampleClass = new SampleClass(); + + //sRectangle test = sampleClass->getLayoutRenderAreaForSurfaceId(1); + + sampleClass->hardKeyPressed(100); + sampleClass->hardKeyPressed(101); + sampleClass->hardKeyPressed(102); + + /*sRectangle renderArea; + renderArea.x = 0; + renderArea.y = 1; + renderArea.width = 12; + renderArea.height = 13; + sampleClass->renderSurfaceToArea(1, renderArea);*/ + + //sampleClass->requestSurfaceIdToFullScreen(1); + + delete sampleClass; + + return 0; +} diff --git a/samplehomescreeninterfaceapp/src/sampleclass.cpp b/samplehomescreeninterfaceapp/src/sampleclass.cpp new file mode 100644 index 0000000..a5e1fac --- /dev/null +++ b/samplehomescreeninterfaceapp/src/sampleclass.cpp @@ -0,0 +1,42 @@ +#include "sampleclass.hpp" + +SampleClass::SampleClass() : + mp_libHomeScreen(0) +{ + mp_libHomeScreen = new LibHomeScreen(); +} + +SampleClass::~SampleClass() +{ + delete mp_libHomeScreen; +} + +std::vector<int> SampleClass::getAllSurfacesOfProcess(int pid) +{ + return mp_libHomeScreen->getAllSurfacesOfProcess(pid); +} + +void SampleClass::hardKeyPressed(int key) +{ + mp_libHomeScreen->hardKeyPressed(key); +} + +int SampleClass::getSurfaceStatus(int surfaceId) +{ + return mp_libHomeScreen->getSurfaceStatus(surfaceId); +} + +void SampleClass::renderSurfaceToArea(int surfaceId, int layoutArea) +{ + mp_libHomeScreen->renderSurfaceToArea(surfaceId, layoutArea); +} + +bool SampleClass::renderAppToAreaAllowed(int appCategory, int layoutArea) +{ + return mp_libHomeScreen->renderAppToAreaAllowed(appCategory, layoutArea); +} + +void SampleClass::requestSurfaceIdToFullScreen(int surfaceId) +{ + mp_libHomeScreen->requestSurfaceIdToFullScreen(surfaceId); +} diff --git a/samplehomescreeninterfaceapp/src/sampleclass.hpp b/samplehomescreeninterfaceapp/src/sampleclass.hpp new file mode 100644 index 0000000..fd00afe --- /dev/null +++ b/samplehomescreeninterfaceapp/src/sampleclass.hpp @@ -0,0 +1,24 @@ +#ifndef SAMPLECLASS_HPP +#define SAMPLECLASS_HPP + +#include "libhomescreen.hpp" +#include <vector> + +class SampleClass +{ +public: + SampleClass(); + ~SampleClass(); + + std::vector<int> getAllSurfacesOfProcess(int pid); + int getSurfaceStatus(int surfaceId); + void hardKeyPressed(int key); + void renderSurfaceToArea(int surfaceId, int layoutArea); + bool renderAppToAreaAllowed(int appCategory, int layoutArea); + void requestSurfaceIdToFullScreen(int surfaceId); + +private: + LibHomeScreen *mp_libHomeScreen; +}; + +#endif // SAMPLECLASS_HPP |