From Fedora Project Wiki

Description

This advanced test case tests D-Bus integration by creating a simple application to send and receive signals via D-Bus.

Setup

  1. Ensure you've installed required packages: dbus-devel, gcc, and g++.
  2. Write the provided code into a file named dbus_example.c [gist].
  3. Compile the application with gcc dbus_example.c $(pkg-config --cflags --libs dbus-1) -o dbus_example.

How to test

  1. Run the compiled application using ./dbus_example.
  2. Observe the output to ensure that the signal is sent and then successfully received.

Expected Results

  1. The application should send the signal successfully with the message "Signal Sent!".
  2. The application should then receive the signal and display the message "Received Test signal with message: Test".

Optional

For further advanced testing:

  1. Try creating multiple instances of the program and see how they communicate using D-Bus.
  2. Modify the program to send different types of data over D-Bus, such as integers or more complex data structures.
  3. Here's an app to send and recieve the same Dbus signal [[1]]

NOTE : You need to compile and open two terminal windows with the same example to send and recieve.