Tizen Native API
4.0
|
Eldbus
- Date:
- 2012 (created)
Table of Contents
Introduction
Eldbus is a wrapper around the dbus library, which is a message bus system. It also implements a set of specifications using dbus as interprocess communication.
Modules
- Core
- Connection
- Object Mapper
- Proxy
- Message
- Signal Handler
- Pending
- Service
- Basic FreeDesktop.Org Methods
How to compile
Eldbus is a library your application links to. The procedure for this is very simple. You simply have to compile your application with the appropriate compiler flags that the pkg-config
script outputs. For example:
Compiling C or C++ files into object files:
gcc -c -o main.o main.c `pkg-config --cflags eldbus`
Linking object files into a binary executable:
gcc -o my_application main.o `pkg-config --libs eldbus`
See pkgconfig
Next Steps
After you understood what Eldbus is and installed it in your system you should proceed understanding the programming interface.
Recommended reading:
- Core for library init, shutdown and getting a connection.
- Proxy to easily bind a client object to an interface.
- Object Mapper to monitor server objects and properties.
Introductory Example
//Compile with: // gcc -o ofono-dial ofono-dial.c `pkg-config --cflags --libs eldbus ecore` #include "Eldbus.h" #include <Ecore.h> static void on_dial(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED) { const char *errname, *errmsg; const char *call_path; if (eldbus_message_error_get(msg, &errname, &errmsg)) { fprintf(stderr, "Error: %s %s\n", errname, errmsg); return; } if (!eldbus_message_arguments_get(msg, "o", &call_path)) { fprintf(stderr, "Error: could not get call path\n"); return; } printf("dialed! call path: %s\n", call_path); } int main(int argc, char *argv[]) { Eldbus_Connection *conn; Eldbus_Object *obj; Eldbus_Proxy *manager; Eldbus_Pending *pending; const char *number, *hide_callerid; if (argc < 2) { fprintf(stderr, "Usage:\n\t%s <number> [hide_callerid]\n", argv[0]); return EXIT_FAILURE; } number = argv[1]; hide_callerid = (argc > 2) ? argv[2] : ""; ecore_init(); eldbus_init(); conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM); if (!conn) { fprintf(stderr, "Error: could not get system bus\n"); return EXIT_FAILURE; } obj = eldbus_object_get(conn, "org.ofono", "/"); if (!obj) { fprintf(stderr, "Error: could not get object\n"); return EXIT_FAILURE; } manager = eldbus_proxy_get(obj, "org.ofono.Manager"); if (!manager) { fprintf(stderr, "Error: could not get proxy\n"); return EXIT_FAILURE; } pending = eldbus_proxy_call(manager, "Dial", on_dial, NULL, -1, "ss", number, hide_callerid); if (!pending) { fprintf(stderr, "Error: could not call\n"); return EXIT_FAILURE; } ecore_main_loop_begin(); eldbus_proxy_unref(manager); eldbus_object_unref(obj); eldbus_connection_unref(conn); eldbus_shutdown(); ecore_shutdown(); return 0; }
More examples can be found at eldbus_examples.