Changes

Jump to: navigation, search

D-Bus and other Linux desktop integration improvements

206 bytes added, 13:49, 15 December 2006
DBUS Tutorial and info
const char* sigvalue = "Hello World";
You do the following to make teh Message object a signal. The internals adds the flags it a signal. There are other functions that make a message into a methodcall, method response, or errors.
printf("Attempting to create a new Signal.\n");
"com.halcyoncomplex.test", // interface name of the signal
"test"); // name of the signal
if (NULL == msg) { fprintf(stderr, "Message Null\n"); exit(1); } else printf("Signal Created.\n"); Adding arguments. Type string for our Hello World.  printf("Attempting to add arguments to signal.\n"); dbus_message_iter_init_append(msg, &args); if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &sigvalue)) { fprintf(stderr, "Out Of Memory!\n"); exit(1); } else printf("Added argument of type(String) with value(Hello World)\n"); Now we send the signal.  printf("Attempting to send signal.\n"); // send the message and flush the connection if (!dbus_connection_send(conn, msg, &serial)) { fprintf(stderr, "Out Of Memory!\n"); exit(1); } else printf("Signal Sent. =)\n"); Clean up.  printf("Serial value for my signal is: %u\n",&serial); //printf("Flushing connection.\n"); dbus_connection_flush(conn); printf("Unreferencing message object.\n"); // free the message dbus_message_unref(msg); //////////////////////////////////////////////////////////////////////////// printf("Closing connection.\n"); dbus_connection_close(conn); }
== Suggestions & Ideas ==
1
edit

Navigation menu