2 * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "homescreencontrolinterface.h"
19 HomeScreenControlInterface::HomeScreenControlInterface(QObject *parent) :
21 mp_homeScreenAdaptor(0),
22 mp_dBusAppFrameworkProxy()
24 // publish dbus homescreen interface
25 mp_homeScreenAdaptor = new HomescreenAdaptor((QObject*)this);
26 QDBusConnection dbus = QDBusConnection::sessionBus();
27 dbus.registerObject("/HomeScreen", this);
28 dbus.registerService("org.agl.homescreen");
30 qDebug("D-Bus: connect to org.agl.homescreenappframeworkbindertizen /AppFramework");
31 mp_dBusAppFrameworkProxy = new org::agl::appframework("org.agl.homescreenappframeworkbindertizen",
33 QDBusConnection::sessionBus(),
37 HomeScreenControlInterface::~HomeScreenControlInterface()
39 delete mp_dBusAppFrameworkProxy;
40 delete mp_homeScreenAdaptor;
43 QList<int> HomeScreenControlInterface::getAllSurfacesOfProcess(int pid)
45 qDebug("getAllSurfacesOfProcess %d", pid);
46 return newRequestGetAllSurfacesOfProcess(pid);
49 int HomeScreenControlInterface::getSurfaceStatus(int surfaceId)
51 qDebug("getSurfaceStatus %d", surfaceId);
52 return newRequestGetSurfaceStatus(surfaceId);
55 void HomeScreenControlInterface::hardKeyPressed(int key)
61 case InputEvent::HARDKEY_NAV:
62 qDebug("hardKeyPressed NAV key pressed!");
63 pid = mp_dBusAppFrameworkProxy->launchApp("navigation@0.1");
64 qDebug("pid: %d", pid);
65 emit newRequestsToBeVisibleApp(pid);
67 case InputEvent::HARDKEY_MEDIA:
68 qDebug("hardKeyPressed MEDIA key pressed!");
69 pid = mp_dBusAppFrameworkProxy->launchApp("media@0.1");
70 qDebug("pid: %d", pid);
71 emit newRequestsToBeVisibleApp(pid);
74 qDebug("hardKeyPressed %d", key);
79 void HomeScreenControlInterface::renderSurfaceToArea(int surfaceId, int layoutArea)
81 qDebug("renderSurfaceToArea %d %d", surfaceId, layoutArea);
82 emit newRequestRenderSurfaceToArea(surfaceId, layoutArea);
85 bool HomeScreenControlInterface::renderAppToAreaAllowed(int appCategory, int layoutArea)
87 qDebug("renderAppToAreaAllowed %d %d", appCategory, layoutArea);
88 return true; //TODO: ask policy manager
91 void HomeScreenControlInterface::requestSurfaceIdToFullScreen(int surfaceId)
93 qDebug("requestSurfaceIdToFullScreen %d", surfaceId);
94 emit newRequestSurfaceIdToFullScreen(surfaceId);