{"id":29,"date":"2012-11-07T09:49:09","date_gmt":"2012-11-07T12:49:09","guid":{"rendered":"http:\/\/programcounter.wordpress.com\/?p=29"},"modified":"2012-11-07T09:49:09","modified_gmt":"2012-11-07T12:49:09","slug":"edbus","status":"publish","type":"post","link":"https:\/\/programcounter.net\/blog\/index.php\/2012\/11\/07\/edbus\/","title":{"rendered":"EDBus &#8211; EFL D-Bus wrapper"},"content":{"rendered":"<p>As I have wrote in a previous post, I will talk about the newest EFL library: EDBus.<br \/>\nEDBus is a D-Bus wrapper, that provides easy access to D-Bus for EFL applications.<\/p>\n<p><strong>But what is D-Bus?<\/strong><br \/>\nIt&#8217;s a protocol of communication between processes, like CORBA and DCOP.\u00a0Heavily used in all UNIX graphical toolkits, with Windows port and specified by FreeDesktop.org.<br \/>\nHere is a good source of information about D-DBus: <a href=\"http:\/\/dbus.freedesktop.org\/doc\/dbus-tutorial.html\" target=\"_blank\" rel=\"noopener\">http:\/\/dbus.freedesktop.org\/doc\/dbus-tutorial.html<\/a><\/p>\n<p><strong>But what about E_DBus? (the old D-Bus binding for EFL)<\/strong><br \/>\nE_DBus is a thin layer between libdbus and ecore (library that provides main loop), to\u00a0use it it&#8217;s necessary to use libdbus functions to handle with messages which is not trivial and also does not have support to most of FreeDesktop.org interfaces, leaving this work to applications developers.<\/p>\n<p>So EDBus comes to replace E_DBus, and we not only removed the &#8220;_&#8221; on name but all libdus functions\u00a0are encapsulated into a simple and friendly API, here is a sample,\u00a0reading a message with this signature: &#8220;a(sb)&#8221;<\/p>\n<p>E_DBus + libdbus:<\/p>\n<pre>\ndbus_message_iter_init_append(msg, &amp;iter);\ndbus_message_iter_recurse(&amp;iter, &amp;array);\nwhile (dbus_message_iter_get_arg_type(&amp;array) != DBUS_TYPE_INVALID)\n  {\n     dbus_message_iter_recurse(&amp;array, &amp;st);\n     dbus_message_iter_get_basic(&amp;st, &amp;txt);\n     dbus_message_iter_next(&amp;st);\n     dbus_message_iter_get_basic(&amp;st, &amp;b);\n     printf(&quot;%s - %dn&quot;, txt, b);\n     dbus_message_iter_next(&amp;array);\n  }\n<\/pre>\n<p>EDBus:<\/p>\n<pre>\nedbus_message_arguments_get(msg, &quot;a(sb)&quot;, &amp;array)\nwhile (edbus_message_iter_get_and_next(array, '(', &amp;st))\n  {\n     edbus_message_iter_arguments_get(st, &quot;sb&quot;, &amp;txt, &amp;b);\n     printf(&quot;%s - %dn&quot;, txt, b);\n  }\n<\/pre>\n<p>Most applications when\u00a0ported to EDBus had 50% fewer lines of D-Bus code.<br \/>\nHere a list with more EDBus advantages:<\/p>\n<ul>\n<li>High abstraction of method call using Proxies<\/li>\n<li>Life cycle of objects simplified<\/li>\n<li>arg0, arg1,&#8230;. match rules to signal handlers<\/li>\n<li>Conversion of Eina_Value to and from EDBus_Message<\/li>\n<li>ObjectManager interface support<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>In a future I\u00a0will write giving more details about all advantages,\u00a0but now you could download the EDBus code and read examples.<br \/>\n<a href=\"http:\/\/svn.enlightenment.org\/svn\/e\/trunk\/edbus\" target=\"_blank\" rel=\"noopener\">http:\/\/svn.enlightenment.org\/svn\/e\/trunk\/edbus<\/a><\/p>\n<p>EDBus still under development, soon we will have a code generator, you only will need pass the Introspection XML and client and server D-Bus code will come almost free. Another object is remove libdbus dependency and talk directly with D-Bus Daemon through socket.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As I have wrote in a previous post, I will talk about the newest EFL library: EDBus. EDBus is a D-Bus wrapper, that provides easy access to D-Bus for EFL applications. But what is D-Bus? It&#8217;s a protocol of communication between processes, like CORBA and DCOP.\u00a0Heavily used in all UNIX graphical toolkits, with Windows port [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2,4,9],"tags":[],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-dbus","category-efl-2","category-profusion"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/programcounter.net\/blog\/index.php\/wp-json\/wp\/v2\/posts\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/programcounter.net\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/programcounter.net\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/programcounter.net\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/programcounter.net\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=29"}],"version-history":[{"count":0,"href":"https:\/\/programcounter.net\/blog\/index.php\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"wp:attachment":[{"href":"https:\/\/programcounter.net\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/programcounter.net\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/programcounter.net\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}