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
- Ensure you've installed required packages:
dbus-devel
,gcc
, andg++
. - Write the provided code into a file named
dbus_example.c
[gist]. - Compile the application with
gcc dbus_example.c $(pkg-config --cflags --libs dbus-1) -o dbus_example
.
How to test
- Run the compiled application using
./dbus_example
. - Observe the output to ensure that the signal is sent and then successfully received.
Expected Results
- The application should send the signal successfully with the message "Signal Sent!".
- The application should then receive the signal and display the message "Received Test signal with message: Test".
Optional
For further advanced testing:
- Try creating multiple instances of the program and see how they communicate using D-Bus.
- Modify the program to send different types of data over D-Bus, such as integers or more complex data structures.
- 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.