2 * Copyright (C) 2016 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 "homescreenappframeworkbindertizen.h"
20 HomeScreenAppFrameworkBinderTizen::HomeScreenAppFrameworkBinderTizen(QObject *parent) :
22 mp_appframeworkAdaptor(0)
24 qDebug("D-Bus: register as org.agl.homescreenappframeworkbinder");
28 // publish app framework interface
29 mp_appframeworkAdaptor = new AppframeworkAdaptor((QObject*)this);
30 QDBusConnection dbus = QDBusConnection::sessionBus();
31 dbus.registerObject("/AppFramework", this);
32 dbus.registerService("org.agl.homescreenappframeworkbinder");
35 pkgmgrinfo_pkginfo_get_list(HomeScreenAppFrameworkBinderTizen::pkg_list_cb_static, this);
41 ai.setName("org.test.app1");
42 ai.setDescription("testdesc1");
43 ai.setIconPath("https://www.automotivelinux.org/sites/cpstandard/files/logo.png");
45 ai.setName("org.test.app2");
46 ai.setDescription("testdesc2");
51 HomeScreenAppFrameworkBinderTizen::~HomeScreenAppFrameworkBinderTizen()
53 delete mp_appframeworkAdaptor;
56 QStringList HomeScreenAppFrameworkBinderTizen::getAvailableAppNames()
59 for (int i = 0; i < m_apps.size(); ++i)
61 result.append(m_apps.at(i).getName());
63 qDebug("size: %d", result.size());
67 int HomeScreenAppFrameworkBinderTizen::launchApp(const QString &name)
71 qDebug("launchApp name: %s", name.toStdString().c_str());
72 pid = aul_launch_app(name.toStdString().c_str(), 0);
73 qDebug("launchApp pid: %d", pid);
76 qDebug("launchApp name: %s", name.toStdString().c_str());
83 void HomeScreenAppFrameworkBinderTizen::clearAppList()
88 void HomeScreenAppFrameworkBinderTizen::appendAppName(const char* name)
91 newApp.setName(QString(name));
92 m_apps.append(newApp);
96 void HomeScreenAppFrameworkBinderTizen::pkg_list_cb_non_static(pkgmgrinfo_pkginfo_h handle)
98 qDebug("pkg_list_cb_non_static");
100 pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid2);
101 printf("pkg_list_cb_non_static: %s\n", pkgid2);
102 appendAppName(pkgid2);
105 int HomeScreenAppFrameworkBinderTizen::pkg_list_cb_static(pkgmgrinfo_pkginfo_h handle, void *user_data)
107 qDebug("pkg_list_cb_static");
108 static_cast<HomeScreenAppFrameworkBinderTizen*>(user_data)->pkg_list_cb_non_static(handle);