Changes to org.agl.homescreen interface
[staging/HomeScreen.git] / HomeScreen / src / homescreencontrolinterface.cpp
1 #include "homescreencontrolinterface.h"
2
3 HomeScreenControlInterface::HomeScreenControlInterface(QObject *parent) :
4     QObject(parent),
5     mp_homeScreenAdaptor(0),
6     mp_dBusAppFrameworkProxy()
7 {
8     // publish dbus homescreen interface
9     mp_homeScreenAdaptor = new HomescreenAdaptor((QObject*)this);
10     QDBusConnection dbus = QDBusConnection::sessionBus();
11     dbus.registerObject("/HomeScreen", this);
12     dbus.registerService("org.agl.homescreen");
13
14     qDebug("D-Bus: connect to org.agl.homescreenappframeworkbindertizen /AppFramework");
15     mp_dBusAppFrameworkProxy = new org::agl::appframework("org.agl.homescreenappframeworkbindertizen",
16                                               "/AppFramework",
17                                               QDBusConnection::sessionBus(),
18                                               0);
19 }
20
21 HomeScreenControlInterface::~HomeScreenControlInterface()
22 {
23     delete mp_dBusAppFrameworkProxy;
24     delete mp_homeScreenAdaptor;
25 }
26
27 QList<int> HomeScreenControlInterface::getAllSurfacesOfProcess(int pid)
28 {
29     qDebug("getAllSurfacesOfProcess %d", pid);
30     return newRequestGetAllSurfacesOfProcess(pid);
31 }
32
33 int HomeScreenControlInterface::getSurfaceStatus(int surfaceId)
34 {
35     qDebug("getSurfaceStatus %d", surfaceId);
36     return newRequestGetSurfaceStatus(surfaceId);
37 }
38
39 void HomeScreenControlInterface::hardKeyPressed(int key)
40 {
41     int pid = -1;
42
43     switch (key)
44     {
45     case InputEvent::HARDKEY_NAV:
46         qDebug("hardKeyPressed NAV key pressed!");
47         pid = mp_dBusAppFrameworkProxy->launchApp("demoapp");
48         qDebug("pid: %d", pid);
49         newRequestsToBeVisibleApp(pid);
50         break;
51     default:
52         qDebug("hardKeyPressed %d", key);
53         break;
54     }
55 }
56
57 void HomeScreenControlInterface::renderSurfaceToArea(int surfaceId, const QRect &renderArea)
58 {
59     qDebug("requestSurfaceIdToFullScreen %d", surfaceId);
60     newRequestRenderSurfaceToArea(surfaceId, renderArea);
61 }
62
63 void HomeScreenControlInterface::requestSurfaceIdToFullScreen(int surfaceId)
64 {
65     qDebug("requestSurfaceIdToFullScreen %d", surfaceId);
66     newRequestSurfaceIdToFullScreen(surfaceId);
67 }