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 "afm_user_daemon_proxy.h"
18 #include "homescreencontrolinterface.h"
20 extern org::AGL::afm::user *afm_user_daemon_proxy;
22 HomeScreenControlInterface::HomeScreenControlInterface(QObject *parent) :
24 mp_homeScreenAdaptor(0)
26 // publish dbus homescreen interface
27 mp_homeScreenAdaptor = new HomescreenAdaptor((QObject*)this);
29 QDBusConnection dbus = QDBusConnection::sessionBus();
30 dbus.registerObject("/HomeScreen", this);
31 dbus.registerService("org.agl.homescreen");
34 QList<int> HomeScreenControlInterface::getAllSurfacesOfProcess(int pid)
36 qDebug("getAllSurfacesOfProcess %d", pid);
37 return newRequestGetAllSurfacesOfProcess(pid);
40 int HomeScreenControlInterface::getSurfaceStatus(int surfaceId)
42 qDebug("getSurfaceStatus %d", surfaceId);
43 return newRequestGetSurfaceStatus(surfaceId);
46 void HomeScreenControlInterface::hardKeyPressed(int key)
52 case InputEvent::HARDKEY_NAV:
53 qDebug("hardKeyPressed NAV key pressed!");
54 pid = afm_user_daemon_proxy->start("navigation@0.1").value().toInt();
55 qDebug("pid: %d", pid);
56 emit newRequestsToBeVisibleApp(pid);
58 case InputEvent::HARDKEY_MEDIA:
59 qDebug("hardKeyPressed MEDIA key pressed!");
60 pid = afm_user_daemon_proxy->start("media@0.1").value().toInt();
61 qDebug("pid: %d", pid);
62 emit newRequestsToBeVisibleApp(pid);
65 qDebug("hardKeyPressed %d", key);
70 void HomeScreenControlInterface::renderSurfaceToArea(int surfaceId, int layoutArea)
72 qDebug("renderSurfaceToArea %d %d", surfaceId, layoutArea);
73 emit newRequestRenderSurfaceToArea(surfaceId, layoutArea);
76 bool HomeScreenControlInterface::renderAppToAreaAllowed(int appCategory, int layoutArea)
78 qDebug("renderAppToAreaAllowed %d %d", appCategory, layoutArea);
79 return true; //TODO: ask policy manager
82 void HomeScreenControlInterface::requestSurfaceIdToFullScreen(int surfaceId)
84 qDebug("requestSurfaceIdToFullScreen %d", surfaceId);
85 emit newRequestSurfaceIdToFullScreen(surfaceId);