View Single Post
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#8
Originally Posted by nauman.altaf View Post
MEventFeed::instance()->addItem() is meventfeed method to generate event feed. What is corresponding DBus method to generate event feed?

i checked com.nokia.home.EventFeed service and it is listing these methods

~ # qdbus com.nokia.home.EventFeed /eventfeed
method qlonglong com.nokia.home.EventFeed.addItem(QVariantMap parameters)
method void com.nokia.home.EventFeed.addRefreshAction(QString action)
signal void com.nokia.home.EventFeed.refreshRequested()
method void com.nokia.home.EventFeed.removeItem(qlonglong id)
method void com.nokia.home.EventFeed.removeItemsBySourceName(Q String sourceName)
method void com.nokia.home.EventFeed.updateItem(qlonglong id, QVariantMap parameters)

My DBus service is working Ok and yes i have used the wrapper generator through qdbusxml2cpp.

In the below link

http://harmattan-dev.nokia.com/docs/...-Bus_call.html

its is stated to use below configurations

MRemoteAction action("com.mycompany.example", "/path", "com.mycompany.example", "refresh");
QDBusInterface interface("com.nokia.home.EventFeed", "/eventfeed", "com.nokia.home.EventFeed", QDBusConnection::sessionBus());
interface.call(QDBus::NoBlock, "addRefreshAction", action.toString());

but at the end it is again using MEventFeed::instance()->addItem()
in the refresh() method. that means MEventFeed::instance()->addItem() is the only way to generate feeds on home screen.
You can use the com.nokia.home.EventFeed.addItem(QVariantMap parameters) method to add an item to the event feed. Construct a QVariantMap and pass it in the method call:

Code:
QDBusMessage message = QDBusMessage::createMethodCall(
                "com.nokia.home.EventFeed",
                "/eventfeed",
                "com.nokia.home.EventFeed",
                "addItem");

QVariantList args;
QVariantMap itemArgs;
itemArgs.insert("title", "event title");
itemArgs.insert("icon", QString("/path/to/application/icon"));
itemArgs.insert("body", "event description");
itemArgs.insert("imageList", QStringList() << "thumbnail.png");
itemArgs.insert("timestamp", QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
itemArgs.insert("video", false);
itemArgs.insert("footer", "event footer");
itemArgs.insert("sourceName", QString("myapplication"));
itemArgs.insert("sourceDisplayName", QString("My Application"));
itemArgs.insert("action", QString("com.me.myApplication / com.me.myApplication showContent %1").arg(URI));

QDBusConnection bus = QDBusConnection::sessionBus();
args.append(itemArgs);
message.setArguments(args);
bus.call(message);
The URI that forms part of the action argument must be base64 encoded, otherwise it won't work. Since the addItem method returns a qlonglong, it's also a good idea to use QDBusConnection::callWithCallback(), so you can check the return value (-1 if unsuccessful).
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub